Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: ui/ozone/platform/dri/gbm_surface_factory.cc

Issue 758853005: Remove Initialize/Shutdown from DriSurfaceFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: GN Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/ozone/platform/dri/gbm_surface_factory.h" 5 #include "ui/ozone/platform/dri/gbm_surface_factory.h"
6 6
7 #include <gbm.h> 7 #include <gbm.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 gbm_device* device, 79 gbm_device* device,
80 ScreenManager* screen_manager, 80 ScreenManager* screen_manager,
81 DriWindowDelegateManager* window_manager) { 81 DriWindowDelegateManager* window_manager) {
82 drm_ = dri; 82 drm_ = dri;
83 device_ = device; 83 device_ = device;
84 screen_manager_ = screen_manager; 84 screen_manager_ = screen_manager;
85 window_manager_ = window_manager; 85 window_manager_ = window_manager;
86 } 86 }
87 87
88 intptr_t GbmSurfaceFactory::GetNativeDisplay() { 88 intptr_t GbmSurfaceFactory::GetNativeDisplay() {
89 DCHECK(state_ == INITIALIZED);
90 return reinterpret_cast<intptr_t>(device_); 89 return reinterpret_cast<intptr_t>(device_);
91 } 90 }
92 91
93 const int32* GbmSurfaceFactory::GetEGLSurfaceProperties( 92 const int32* GbmSurfaceFactory::GetEGLSurfaceProperties(
94 const int32* desired_list) { 93 const int32* desired_list) {
95 static const int32 kConfigAttribs[] = { 94 static const int32 kConfigAttribs[] = {
96 EGL_BUFFER_SIZE, 32, 95 EGL_BUFFER_SIZE, 32,
97 EGL_ALPHA_SIZE, 8, 96 EGL_ALPHA_SIZE, 8,
98 EGL_BLUE_SIZE, 8, 97 EGL_BLUE_SIZE, 8,
99 EGL_GREEN_SIZE, 8, 98 EGL_GREEN_SIZE, 8,
100 EGL_RED_SIZE, 8, 99 EGL_RED_SIZE, 8,
101 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, 100 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
102 EGL_SURFACE_TYPE, EGL_WINDOW_BIT, 101 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
103 EGL_NONE 102 EGL_NONE
104 }; 103 };
105 104
106 return kConfigAttribs; 105 return kConfigAttribs;
107 } 106 }
108 107
109 bool GbmSurfaceFactory::LoadEGLGLES2Bindings( 108 bool GbmSurfaceFactory::LoadEGLGLES2Bindings(
110 AddGLLibraryCallback add_gl_library, 109 AddGLLibraryCallback add_gl_library,
111 SetGLGetProcAddressProcCallback set_gl_get_proc_address) { 110 SetGLGetProcAddressProcCallback set_gl_get_proc_address) {
112 return LoadDefaultEGLGLES2Bindings(add_gl_library, set_gl_get_proc_address); 111 return LoadDefaultEGLGLES2Bindings(add_gl_library, set_gl_get_proc_address);
113 } 112 }
114 113
115 scoped_ptr<SurfaceOzoneEGL> GbmSurfaceFactory::CreateEGLSurfaceForWidget( 114 scoped_ptr<SurfaceOzoneEGL> GbmSurfaceFactory::CreateEGLSurfaceForWidget(
116 gfx::AcceleratedWidget widget) { 115 gfx::AcceleratedWidget widget) {
117 DCHECK(state_ == INITIALIZED);
118
119 DriWindowDelegate* delegate = GetOrCreateWindowDelegate(widget); 116 DriWindowDelegate* delegate = GetOrCreateWindowDelegate(widget);
120 117
121 scoped_ptr<GbmSurface> surface(new GbmSurface(delegate, device_, drm_)); 118 scoped_ptr<GbmSurface> surface(new GbmSurface(delegate, device_, drm_));
122 if (!surface->Initialize()) 119 if (!surface->Initialize())
123 return nullptr; 120 return nullptr;
124 121
125 return surface.Pass(); 122 return surface.Pass();
126 } 123 }
127 124
128 scoped_ptr<SurfaceOzoneEGL> 125 scoped_ptr<SurfaceOzoneEGL>
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 scoped_ptr<DriWindowDelegate> delegate(new DriWindowDelegateImpl( 206 scoped_ptr<DriWindowDelegate> delegate(new DriWindowDelegateImpl(
210 widget, drm_, window_manager_, screen_manager_)); 207 widget, drm_, window_manager_, screen_manager_));
211 delegate->Initialize(); 208 delegate->Initialize();
212 window_manager_->AddWindowDelegate(widget, delegate.Pass()); 209 window_manager_->AddWindowDelegate(widget, delegate.Pass());
213 } 210 }
214 211
215 return window_manager_->GetWindowDelegate(widget); 212 return window_manager_->GetWindowDelegate(widget);
216 } 213 }
217 214
218 } // namespace ui 215 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/dri_window_delegate_impl_unittest.cc ('k') | ui/ozone/platform/dri/ozone_platform_dri.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698