Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ui / ozone / platform / drm / gpu / gbm_surfaceless.cc
blobcc713863ef9c33210c462e5c375194d693779cef
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.
5 #include "ui/ozone/platform/drm/gpu/gbm_surfaceless.h"
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"
16 namespace ui {
17 namespace {
18 void EmptyPageFlipCallback(gfx::SwapResult result) {
20 } // namespace
22 GbmSurfaceless::GbmSurfaceless(DrmWindow* window,
23 DrmDeviceManager* drm_device_manager)
24 : window_(window), drm_device_manager_(drm_device_manager) {
27 GbmSurfaceless::~GbmSurfaceless() {
30 intptr_t GbmSurfaceless::GetNativeWindow() {
31 NOTREACHED();
32 return 0;
35 bool GbmSurfaceless::ResizeNativeWindow(const gfx::Size& viewport_size) {
36 return true;
39 bool GbmSurfaceless::OnSwapBuffers() {
40 return window_->SchedulePageFlip(true /* is_sync */,
41 base::Bind(&EmptyPageFlipCallback));
44 bool GbmSurfaceless::OnSwapBuffersAsync(
45 const SwapCompletionCallback& callback) {
46 return window_->SchedulePageFlip(false /* is_sync */, callback);
49 scoped_ptr<gfx::VSyncProvider> GbmSurfaceless::CreateVSyncProvider() {
50 return make_scoped_ptr(new DrmVSyncProvider(window_));
53 bool GbmSurfaceless::IsUniversalDisplayLinkDevice() {
54 if (!drm_device_manager_)
55 return false;
56 scoped_refptr<DrmDevice> drm_primary =
57 drm_device_manager_->GetDrmDevice(gfx::kNullAcceleratedWidget);
58 DCHECK(drm_primary);
60 HardwareDisplayController* controller = window_->GetController();
61 if (!controller)
62 return false;
63 scoped_refptr<DrmDevice> drm = controller->GetAllocationDrmDevice();
64 DCHECK(drm);
66 return drm_primary != drm;
69 } // namespace ui