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