| 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/gbm_buffer.h" | 15 #include "ui/ozone/platform/dri/gbm_buffer.h" |
| 16 #include "ui/ozone/platform/dri/gbm_surface.h" | 16 #include "ui/ozone/platform/dri/gbm_surface.h" |
| 17 #include "ui/ozone/platform/dri/gbm_surfaceless.h" | 17 #include "ui/ozone/platform/dri/gbm_surfaceless.h" |
| 18 #include "ui/ozone/platform/dri/page_flip_event_handler.h" |
| 18 #include "ui/ozone/platform/dri/screen_manager.h" | 19 #include "ui/ozone/platform/dri/screen_manager.h" |
| 19 #include "ui/ozone/public/native_pixmap.h" | 20 #include "ui/ozone/public/native_pixmap.h" |
| 20 #include "ui/ozone/public/overlay_candidates_ozone.h" | 21 #include "ui/ozone/public/overlay_candidates_ozone.h" |
| 21 #include "ui/ozone/public/ozone_switches.h" | 22 #include "ui/ozone/public/ozone_switches.h" |
| 22 #include "ui/ozone/public/surface_ozone_egl.h" | 23 #include "ui/ozone/public/surface_ozone_egl.h" |
| 23 | 24 |
| 24 namespace ui { | 25 namespace ui { |
| 25 namespace { | 26 namespace { |
| 26 | 27 |
| 27 class SingleOverlay : public OverlayCandidatesOzone { | 28 class SingleOverlay : public OverlayCandidatesOzone { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 122 |
| 122 return surface.Pass(); | 123 return surface.Pass(); |
| 123 } | 124 } |
| 124 | 125 |
| 125 scoped_ptr<SurfaceOzoneEGL> | 126 scoped_ptr<SurfaceOzoneEGL> |
| 126 GbmSurfaceFactory::CreateSurfacelessEGLSurfaceForWidget( | 127 GbmSurfaceFactory::CreateSurfacelessEGLSurfaceForWidget( |
| 127 gfx::AcceleratedWidget widget) { | 128 gfx::AcceleratedWidget widget) { |
| 128 if (!allow_surfaceless_) | 129 if (!allow_surfaceless_) |
| 129 return scoped_ptr<SurfaceOzoneEGL>(); | 130 return scoped_ptr<SurfaceOzoneEGL>(); |
| 130 | 131 |
| 132 if (!flip_handler_) |
| 133 flip_handler_ = |
| 134 scoped_ptr<PageFlipEventHandler>(new PageFlipEventHandler()); |
| 135 |
| 131 DriWindowDelegate* delegate = GetOrCreateWindowDelegate(widget); | 136 DriWindowDelegate* delegate = GetOrCreateWindowDelegate(widget); |
| 132 return scoped_ptr<SurfaceOzoneEGL>(new GbmSurfaceless(delegate)); | 137 return scoped_ptr<SurfaceOzoneEGL>( |
| 138 new GbmSurfaceless(delegate, flip_handler_.get())); |
| 133 } | 139 } |
| 134 | 140 |
| 135 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap( | 141 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap( |
| 136 gfx::AcceleratedWidget widget, | 142 gfx::AcceleratedWidget widget, |
| 137 gfx::Size size, | 143 gfx::Size size, |
| 138 BufferFormat format, | 144 BufferFormat format, |
| 139 BufferUsage usage) { | 145 BufferUsage usage) { |
| 140 if (usage == MAP) | 146 if (usage == MAP) |
| 141 return NULL; | 147 return NULL; |
| 142 | 148 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 scoped_ptr<DriWindowDelegate> delegate(new DriWindowDelegateImpl( | 212 scoped_ptr<DriWindowDelegate> delegate(new DriWindowDelegateImpl( |
| 207 widget, drm_, window_manager_, screen_manager_)); | 213 widget, drm_, window_manager_, screen_manager_)); |
| 208 delegate->Initialize(); | 214 delegate->Initialize(); |
| 209 window_manager_->AddWindowDelegate(widget, delegate.Pass()); | 215 window_manager_->AddWindowDelegate(widget, delegate.Pass()); |
| 210 } | 216 } |
| 211 | 217 |
| 212 return window_manager_->GetWindowDelegate(widget); | 218 return window_manager_->GetWindowDelegate(widget); |
| 213 } | 219 } |
| 214 | 220 |
| 215 } // namespace ui | 221 } // namespace ui |
| OLD | NEW |