Fix search results being clipped in app list.
[chromium-blink-merge.git] / ui / ozone / platform / drm / gpu / gbm_surfaceless.cc
blob138d207fdf78953297953866148eb3b979140155
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 {
18 GbmSurfaceless::GbmSurfaceless(DrmWindow* window_delegate,
19 DrmDeviceManager* drm_device_manager)
20 : window_delegate_(window_delegate),
21 drm_device_manager_(drm_device_manager) {
24 GbmSurfaceless::~GbmSurfaceless() {
27 intptr_t GbmSurfaceless::GetNativeWindow() {
28 NOTREACHED();
29 return 0;
32 bool GbmSurfaceless::ResizeNativeWindow(const gfx::Size& viewport_size) {
33 return true;
36 bool GbmSurfaceless::OnSwapBuffers() {
37 HardwareDisplayController* controller = window_delegate_->GetController();
38 if (!controller)
39 return true;
41 return controller->SchedulePageFlip(true /* is_sync */,
42 base::Bind(&base::DoNothing));
45 bool GbmSurfaceless::OnSwapBuffersAsync(
46 const SwapCompletionCallback& callback) {
47 HardwareDisplayController* controller = window_delegate_->GetController();
48 if (!controller) {
49 callback.Run();
50 return true;
53 return controller->SchedulePageFlip(false /* is_sync */, callback);
56 scoped_ptr<gfx::VSyncProvider> GbmSurfaceless::CreateVSyncProvider() {
57 return make_scoped_ptr(new DrmVSyncProvider(window_delegate_));
60 bool GbmSurfaceless::IsUniversalDisplayLinkDevice() {
61 if (!drm_device_manager_)
62 return false;
63 scoped_refptr<DrmDevice> drm_primary =
64 drm_device_manager_->GetDrmDevice(gfx::kNullAcceleratedWidget);
65 DCHECK(drm_primary);
67 HardwareDisplayController* controller = window_delegate_->GetController();
68 if (!controller)
69 return false;
70 scoped_refptr<DrmDevice> drm = controller->GetAllocationDrmDevice();
71 DCHECK(drm);
73 return drm_primary != drm;
76 } // namespace ui