OLD | NEW |
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 <EGL/egl.h> | 7 #include <EGL/egl.h> |
8 #include <gbm.h> | 8 #include <gbm.h> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "ui/gfx/ozone/surface_ozone_egl.h" | |
12 #include "ui/ozone/platform/dri/buffer_data.h" | 11 #include "ui/ozone/platform/dri/buffer_data.h" |
13 #include "ui/ozone/platform/dri/dri_vsync_provider.h" | 12 #include "ui/ozone/platform/dri/dri_vsync_provider.h" |
14 #include "ui/ozone/platform/dri/gbm_surface.h" | 13 #include "ui/ozone/platform/dri/gbm_surface.h" |
15 #include "ui/ozone/platform/dri/hardware_display_controller.h" | 14 #include "ui/ozone/platform/dri/hardware_display_controller.h" |
16 #include "ui/ozone/platform/dri/scanout_surface.h" | 15 #include "ui/ozone/platform/dri/scanout_surface.h" |
17 #include "ui/ozone/platform/dri/screen_manager.h" | 16 #include "ui/ozone/platform/dri/screen_manager.h" |
| 17 #include "ui/ozone/public/surface_ozone_egl.h" |
18 | 18 |
19 namespace ui { | 19 namespace ui { |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 class GbmSurfaceAdapter : public gfx::SurfaceOzoneEGL { | 23 class GbmSurfaceAdapter : public ui::SurfaceOzoneEGL { |
24 public: | 24 public: |
25 GbmSurfaceAdapter(const base::WeakPtr<HardwareDisplayController>& controller); | 25 GbmSurfaceAdapter(const base::WeakPtr<HardwareDisplayController>& controller); |
26 virtual ~GbmSurfaceAdapter(); | 26 virtual ~GbmSurfaceAdapter(); |
27 | 27 |
28 // SurfaceOzoneEGL: | 28 // SurfaceOzoneEGL: |
29 virtual intptr_t GetNativeWindow() OVERRIDE; | 29 virtual intptr_t GetNativeWindow() OVERRIDE; |
30 virtual bool ResizeNativeWindow(const gfx::Size& viewport_size) OVERRIDE; | 30 virtual bool ResizeNativeWindow(const gfx::Size& viewport_size) OVERRIDE; |
31 virtual bool OnSwapBuffers() OVERRIDE; | 31 virtual bool OnSwapBuffers() OVERRIDE; |
32 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() OVERRIDE; | 32 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() OVERRIDE; |
33 | 33 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 return false; | 136 return false; |
137 } | 137 } |
138 | 138 |
139 set_gl_get_proc_address.Run(get_proc_address); | 139 set_gl_get_proc_address.Run(get_proc_address); |
140 add_gl_library.Run(egl_library); | 140 add_gl_library.Run(egl_library); |
141 add_gl_library.Run(gles_library); | 141 add_gl_library.Run(gles_library); |
142 | 142 |
143 return true; | 143 return true; |
144 } | 144 } |
145 | 145 |
146 scoped_ptr<gfx::SurfaceOzoneEGL> GbmSurfaceFactory::CreateEGLSurfaceForWidget( | 146 scoped_ptr<ui::SurfaceOzoneEGL> GbmSurfaceFactory::CreateEGLSurfaceForWidget( |
147 gfx::AcceleratedWidget w) { | 147 gfx::AcceleratedWidget w) { |
148 CHECK(state_ == INITIALIZED); | 148 CHECK(state_ == INITIALIZED); |
149 ResetCursor(w); | 149 ResetCursor(w); |
150 | 150 |
151 return scoped_ptr<gfx::SurfaceOzoneEGL>( | 151 return scoped_ptr<ui::SurfaceOzoneEGL>( |
152 new GbmSurfaceAdapter(screen_manager_->GetDisplayController(w))); | 152 new GbmSurfaceAdapter(screen_manager_->GetDisplayController(w))); |
153 } | 153 } |
154 | 154 |
155 gfx::NativeBufferOzone GbmSurfaceFactory::CreateNativeBuffer( | 155 gfx::NativeBufferOzone GbmSurfaceFactory::CreateNativeBuffer( |
156 gfx::Size size, | 156 gfx::Size size, |
157 BufferFormat format) { | 157 BufferFormat format) { |
158 uint32_t gbm_format = 0; | 158 uint32_t gbm_format = 0; |
159 switch (format) { | 159 switch (format) { |
160 case SurfaceFactoryOzone::UNKNOWN: | 160 case SurfaceFactoryOzone::UNKNOWN: |
161 return 0; | 161 return 0; |
(...skipping 16 matching lines...) Expand all Loading... |
178 if (!buffer_object) | 178 if (!buffer_object) |
179 return 0; | 179 return 0; |
180 | 180 |
181 BufferData* data = BufferData::CreateData(drm_, buffer_object); | 181 BufferData* data = BufferData::CreateData(drm_, buffer_object); |
182 DCHECK(data) << "Failed to associate the buffer with the controller"; | 182 DCHECK(data) << "Failed to associate the buffer with the controller"; |
183 | 183 |
184 return reinterpret_cast<gfx::NativeBufferOzone>(buffer_object); | 184 return reinterpret_cast<gfx::NativeBufferOzone>(buffer_object); |
185 } | 185 } |
186 | 186 |
187 } // namespace ui | 187 } // namespace ui |
OLD | NEW |