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 "base/bind.h" |
| 8 #include "base/bind_helpers.h" |
| 9 #include "ui/ozone/platform/drm/gpu/drm_device.h" |
| 10 #include "ui/ozone/platform/drm/gpu/drm_device_manager.h" |
| 11 #include "ui/ozone/platform/drm/gpu/drm_vsync_provider.h" |
| 12 #include "ui/ozone/platform/drm/gpu/drm_window.h" |
| 13 #include "ui/ozone/platform/drm/gpu/gbm_buffer.h" |
| 14 #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h" |
| 15 |
| 16 namespace ui { |
| 17 namespace { |
| 18 void EmptyPageFlipCallback(gfx::SwapResult result) { |
| 19 } |
| 20 } // namespace |
| 21 |
| 22 GbmSurfaceless::GbmSurfaceless(DrmWindow* window_delegate, |
| 23 DrmDeviceManager* drm_device_manager) |
| 24 : window_delegate_(window_delegate), |
| 25 drm_device_manager_(drm_device_manager) { |
| 26 } |
| 27 |
| 28 GbmSurfaceless::~GbmSurfaceless() { |
| 29 } |
| 30 |
| 31 intptr_t GbmSurfaceless::GetNativeWindow() { |
| 32 NOTREACHED(); |
| 33 return 0; |
| 34 } |
| 35 |
| 36 bool GbmSurfaceless::ResizeNativeWindow(const gfx::Size& viewport_size) { |
| 37 return true; |
| 38 } |
| 39 |
| 40 bool GbmSurfaceless::OnSwapBuffers() { |
| 41 return window_delegate_->SchedulePageFlip(true /* is_sync */, |
| 42 base::Bind(&EmptyPageFlipCallback)); |
| 43 } |
| 44 |
| 45 bool GbmSurfaceless::OnSwapBuffersAsync( |
| 46 const SwapCompletionCallback& callback) { |
| 47 return window_delegate_->SchedulePageFlip(false /* is_sync */, callback); |
| 48 } |
| 49 |
| 50 scoped_ptr<gfx::VSyncProvider> GbmSurfaceless::CreateVSyncProvider() { |
| 51 return make_scoped_ptr(new DrmVSyncProvider(window_delegate_)); |
| 52 } |
| 53 |
| 54 bool GbmSurfaceless::IsUniversalDisplayLinkDevice() { |
| 55 if (!drm_device_manager_) |
| 56 return false; |
| 57 scoped_refptr<DrmDevice> drm_primary = |
| 58 drm_device_manager_->GetDrmDevice(gfx::kNullAcceleratedWidget); |
| 59 DCHECK(drm_primary); |
| 60 |
| 61 HardwareDisplayController* controller = window_delegate_->GetController(); |
| 62 if (!controller) |
| 63 return false; |
| 64 scoped_refptr<DrmDevice> drm = controller->GetAllocationDrmDevice(); |
| 65 DCHECK(drm); |
| 66 |
| 67 return drm_primary != drm; |
| 68 } |
| 69 |
| 70 } // namespace ui |
OLD | NEW |