Chromium Code Reviews| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 | 125 |
| 125 return surface.Pass(); | 126 return surface.Pass(); |
| 126 } | 127 } |
| 127 | 128 |
| 128 scoped_ptr<SurfaceOzoneEGL> | 129 scoped_ptr<SurfaceOzoneEGL> |
| 129 GbmSurfaceFactory::CreateSurfacelessEGLSurfaceForWidget( | 130 GbmSurfaceFactory::CreateSurfacelessEGLSurfaceForWidget( |
| 130 gfx::AcceleratedWidget widget) { | 131 gfx::AcceleratedWidget widget) { |
| 131 if (!allow_surfaceless_) | 132 if (!allow_surfaceless_) |
| 132 return scoped_ptr<SurfaceOzoneEGL>(); | 133 return scoped_ptr<SurfaceOzoneEGL>(); |
| 133 | 134 |
| 135 if (!flip_handler_) | |
| 136 flip_handler_ = | |
| 137 scoped_ptr<PageFilpEventHandler>(new PageFilpEventHandler()); | |
|
brianderson
2014/12/10 22:48:05
PageFilp -> PageFlip
kalyank
2014/12/11 12:55:58
Done.
| |
| 138 | |
| 134 DriWindowDelegate* delegate = GetOrCreateWindowDelegate(widget); | 139 DriWindowDelegate* delegate = GetOrCreateWindowDelegate(widget); |
| 135 return scoped_ptr<SurfaceOzoneEGL>(new GbmSurfaceless(delegate)); | 140 return scoped_ptr<SurfaceOzoneEGL>( |
| 141 new GbmSurfaceless(delegate, flip_handler_.get())); | |
| 136 } | 142 } |
| 137 | 143 |
| 138 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap( | 144 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap( |
| 139 gfx::AcceleratedWidget widget, | 145 gfx::AcceleratedWidget widget, |
| 140 gfx::Size size, | 146 gfx::Size size, |
| 141 BufferFormat format, | 147 BufferFormat format, |
| 142 BufferUsage usage) { | 148 BufferUsage usage) { |
| 143 if (usage == MAP) | 149 if (usage == MAP) |
| 144 return NULL; | 150 return NULL; |
| 145 | 151 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 scoped_ptr<DriWindowDelegate> delegate(new DriWindowDelegateImpl( | 215 scoped_ptr<DriWindowDelegate> delegate(new DriWindowDelegateImpl( |
| 210 widget, drm_, window_manager_, screen_manager_)); | 216 widget, drm_, window_manager_, screen_manager_)); |
| 211 delegate->Initialize(); | 217 delegate->Initialize(); |
| 212 window_manager_->AddWindowDelegate(widget, delegate.Pass()); | 218 window_manager_->AddWindowDelegate(widget, delegate.Pass()); |
| 213 } | 219 } |
| 214 | 220 |
| 215 return window_manager_->GetWindowDelegate(widget); | 221 return window_manager_->GetWindowDelegate(widget); |
| 216 } | 222 } |
| 217 | 223 |
| 218 } // namespace ui | 224 } // namespace ui |
| OLD | NEW |