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 <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" |
11 #include "third_party/khronos/EGL/egl.h" | 11 #include "third_party/khronos/EGL/egl.h" |
12 #include "ui/ozone/common/egl_util.h" | 12 #include "ui/ozone/common/egl_util.h" |
13 #include "ui/ozone/platform/dri/dri_window_delegate_impl.h" | 13 #include "ui/ozone/platform/dri/dri_window_delegate_impl.h" |
14 #include "ui/ozone/platform/dri/dri_window_delegate_manager.h" | 14 #include "ui/ozone/platform/dri/dri_window_delegate_manager.h" |
15 #include "ui/ozone/platform/dri/drm_device_manager.h" | 15 #include "ui/ozone/platform/dri/drm_device_manager.h" |
16 #include "ui/ozone/platform/dri/gbm_buffer.h" | 16 #include "ui/ozone/platform/dri/gbm_buffer.h" |
17 #include "ui/ozone/platform/dri/gbm_surface.h" | 17 #include "ui/ozone/platform/dri/gbm_surface.h" |
18 #include "ui/ozone/platform/dri/gbm_surfaceless.h" | 18 #include "ui/ozone/platform/dri/gbm_surfaceless.h" |
19 #include "ui/ozone/platform/dri/gbm_wrapper.h" | 19 #include "ui/ozone/platform/dri/gbm_wrapper.h" |
20 #include "ui/ozone/platform/dri/hardware_display_controller.h" | 20 #include "ui/ozone/platform/dri/hardware_display_controller.h" |
21 #include "ui/ozone/public/native_pixmap.h" | 21 #include "ui/ozone/public/native_pixmap.h" |
22 #include "ui/ozone/public/overlay_candidates_ozone.h" | 22 #include "ui/ozone/public/overlay_candidates_ozone.h" |
23 #include "ui/ozone/public/ozone_switches.h" | 23 #include "ui/ozone/public/ozone_switches.h" |
| 24 #include "ui/ozone/public/surface_ozone_canvas.h" |
24 #include "ui/ozone/public/surface_ozone_egl.h" | 25 #include "ui/ozone/public/surface_ozone_egl.h" |
25 | 26 |
26 namespace ui { | 27 namespace ui { |
27 namespace { | 28 namespace { |
28 | 29 |
29 class SingleOverlay : public OverlayCandidatesOzone { | 30 class SingleOverlay : public OverlayCandidatesOzone { |
30 public: | 31 public: |
31 SingleOverlay() {} | 32 SingleOverlay() {} |
32 ~SingleOverlay() override {} | 33 ~SingleOverlay() override {} |
33 | 34 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 107 |
107 return kConfigAttribs; | 108 return kConfigAttribs; |
108 } | 109 } |
109 | 110 |
110 bool GbmSurfaceFactory::LoadEGLGLES2Bindings( | 111 bool GbmSurfaceFactory::LoadEGLGLES2Bindings( |
111 AddGLLibraryCallback add_gl_library, | 112 AddGLLibraryCallback add_gl_library, |
112 SetGLGetProcAddressProcCallback set_gl_get_proc_address) { | 113 SetGLGetProcAddressProcCallback set_gl_get_proc_address) { |
113 return LoadDefaultEGLGLES2Bindings(add_gl_library, set_gl_get_proc_address); | 114 return LoadDefaultEGLGLES2Bindings(add_gl_library, set_gl_get_proc_address); |
114 } | 115 } |
115 | 116 |
| 117 scoped_ptr<SurfaceOzoneCanvas> GbmSurfaceFactory::CreateCanvasForWidget( |
| 118 gfx::AcceleratedWidget widget) { |
| 119 LOG(FATAL) << "Software rendering mode is not supported with GBM platform"; |
| 120 return nullptr; |
| 121 } |
| 122 |
116 scoped_ptr<SurfaceOzoneEGL> GbmSurfaceFactory::CreateEGLSurfaceForWidget( | 123 scoped_ptr<SurfaceOzoneEGL> GbmSurfaceFactory::CreateEGLSurfaceForWidget( |
117 gfx::AcceleratedWidget widget) { | 124 gfx::AcceleratedWidget widget) { |
118 scoped_refptr<GbmWrapper> gbm = GetGbmDevice(widget); | 125 scoped_refptr<GbmWrapper> gbm = GetGbmDevice(widget); |
119 DCHECK(gbm); | 126 DCHECK(gbm); |
120 | 127 |
121 scoped_ptr<GbmSurface> surface( | 128 scoped_ptr<GbmSurface> surface( |
122 new GbmSurface(window_manager_->GetWindowDelegate(widget), gbm)); | 129 new GbmSurface(window_manager_->GetWindowDelegate(widget), gbm)); |
123 if (!surface->Initialize()) | 130 if (!surface->Initialize()) |
124 return nullptr; | 131 return nullptr; |
125 | 132 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 return false; | 214 return false; |
208 } | 215 } |
209 | 216 |
210 scoped_refptr<GbmWrapper> GbmSurfaceFactory::GetGbmDevice( | 217 scoped_refptr<GbmWrapper> GbmSurfaceFactory::GetGbmDevice( |
211 gfx::AcceleratedWidget widget) { | 218 gfx::AcceleratedWidget widget) { |
212 return static_cast<GbmWrapper*>( | 219 return static_cast<GbmWrapper*>( |
213 drm_device_manager_->GetDrmDevice(widget).get()); | 220 drm_device_manager_->GetDrmDevice(widget).get()); |
214 } | 221 } |
215 | 222 |
216 } // namespace ui | 223 } // namespace ui |
OLD | NEW |