| 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/drm/gpu/gbm_surfaceless.h" | 5 #include "ui/ozone/platform/drm/gpu/gbm_surfaceless.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" |
| 9 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| 10 #include "third_party/khronos/EGL/egl.h" | 11 #include "third_party/khronos/EGL/egl.h" |
| 11 #include "ui/ozone/common/egl_util.h" | 12 #include "ui/ozone/common/egl_util.h" |
| 12 #include "ui/ozone/platform/drm/gpu/drm_device.h" | 13 #include "ui/ozone/platform/drm/gpu/drm_device.h" |
| 13 #include "ui/ozone/platform/drm/gpu/drm_vsync_provider.h" | 14 #include "ui/ozone/platform/drm/gpu/drm_vsync_provider.h" |
| 14 #include "ui/ozone/platform/drm/gpu/drm_window_proxy.h" | 15 #include "ui/ozone/platform/drm/gpu/drm_window_proxy.h" |
| 15 #include "ui/ozone/platform/drm/gpu/gbm_surface_factory.h" | 16 #include "ui/ozone/platform/drm/gpu/gbm_surface_factory.h" |
| 16 #include "ui/ozone/platform/drm/gpu/scanout_buffer.h" | 17 #include "ui/ozone/platform/drm/gpu/scanout_buffer.h" |
| 17 | 18 |
| 18 namespace ui { | 19 namespace ui { |
| 19 | 20 |
| 20 GbmSurfaceless::GbmSurfaceless(scoped_ptr<DrmWindowProxy> window, | 21 GbmSurfaceless::GbmSurfaceless(std::unique_ptr<DrmWindowProxy> window, |
| 21 GbmSurfaceFactory* surface_manager) | 22 GbmSurfaceFactory* surface_manager) |
| 22 : window_(std::move(window)), surface_manager_(surface_manager) { | 23 : window_(std::move(window)), surface_manager_(surface_manager) { |
| 23 surface_manager_->RegisterSurface(window_->widget(), this); | 24 surface_manager_->RegisterSurface(window_->widget(), this); |
| 24 } | 25 } |
| 25 | 26 |
| 26 GbmSurfaceless::~GbmSurfaceless() { | 27 GbmSurfaceless::~GbmSurfaceless() { |
| 27 surface_manager_->UnregisterSurface(window_->widget()); | 28 surface_manager_->UnregisterSurface(window_->widget()); |
| 28 } | 29 } |
| 29 | 30 |
| 30 void GbmSurfaceless::QueueOverlayPlane(const OverlayPlane& plane) { | 31 void GbmSurfaceless::QueueOverlayPlane(const OverlayPlane& plane) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 45 return false; | 46 return false; |
| 46 } | 47 } |
| 47 | 48 |
| 48 void GbmSurfaceless::OnSwapBuffersAsync( | 49 void GbmSurfaceless::OnSwapBuffersAsync( |
| 49 const SwapCompletionCallback& callback) { | 50 const SwapCompletionCallback& callback) { |
| 50 TRACE_EVENT0("drm", "GbmSurfaceless::OnSwapBuffersAsync"); | 51 TRACE_EVENT0("drm", "GbmSurfaceless::OnSwapBuffersAsync"); |
| 51 window_->SchedulePageFlip(planes_, callback); | 52 window_->SchedulePageFlip(planes_, callback); |
| 52 planes_.clear(); | 53 planes_.clear(); |
| 53 } | 54 } |
| 54 | 55 |
| 55 scoped_ptr<gfx::VSyncProvider> GbmSurfaceless::CreateVSyncProvider() { | 56 std::unique_ptr<gfx::VSyncProvider> GbmSurfaceless::CreateVSyncProvider() { |
| 56 return make_scoped_ptr(new DrmVSyncProvider(window_.get())); | 57 return base::WrapUnique(new DrmVSyncProvider(window_.get())); |
| 57 } | 58 } |
| 58 | 59 |
| 59 bool GbmSurfaceless::IsUniversalDisplayLinkDevice() { | 60 bool GbmSurfaceless::IsUniversalDisplayLinkDevice() { |
| 60 return planes_.empty() ? false : planes_[0].buffer->RequiresGlFinish(); | 61 return planes_.empty() ? false : planes_[0].buffer->RequiresGlFinish(); |
| 61 } | 62 } |
| 62 | 63 |
| 63 void* /* EGLConfig */ GbmSurfaceless::GetEGLSurfaceConfig( | 64 void* /* EGLConfig */ GbmSurfaceless::GetEGLSurfaceConfig( |
| 64 const EglConfigCallbacks& egl) { | 65 const EglConfigCallbacks& egl) { |
| 65 EGLint config_attribs[] = {EGL_BUFFER_SIZE, | 66 EGLint config_attribs[] = {EGL_BUFFER_SIZE, |
| 66 32, | 67 32, |
| 67 EGL_ALPHA_SIZE, | 68 EGL_ALPHA_SIZE, |
| 68 8, | 69 8, |
| 69 EGL_BLUE_SIZE, | 70 EGL_BLUE_SIZE, |
| 70 8, | 71 8, |
| 71 EGL_GREEN_SIZE, | 72 EGL_GREEN_SIZE, |
| 72 8, | 73 8, |
| 73 EGL_RED_SIZE, | 74 EGL_RED_SIZE, |
| 74 8, | 75 8, |
| 75 EGL_RENDERABLE_TYPE, | 76 EGL_RENDERABLE_TYPE, |
| 76 EGL_OPENGL_ES2_BIT, | 77 EGL_OPENGL_ES2_BIT, |
| 77 EGL_SURFACE_TYPE, | 78 EGL_SURFACE_TYPE, |
| 78 EGL_DONT_CARE, | 79 EGL_DONT_CARE, |
| 79 EGL_NONE}; | 80 EGL_NONE}; |
| 80 return ChooseEGLConfig(egl, config_attribs); | 81 return ChooseEGLConfig(egl, config_attribs); |
| 81 } | 82 } |
| 82 | 83 |
| 83 } // namespace ui | 84 } // namespace ui |
| OLD | NEW |