blob: 138d207fdf78953297953866148eb3b979140155 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/ozone/platform/drm/gpu/gbm_surfaceless.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "ui/ozone/platform/drm/gpu/drm_device.h"
#include "ui/ozone/platform/drm/gpu/drm_device_manager.h"
#include "ui/ozone/platform/drm/gpu/drm_vsync_provider.h"
#include "ui/ozone/platform/drm/gpu/drm_window.h"
#include "ui/ozone/platform/drm/gpu/gbm_buffer.h"
#include "ui/ozone/platform/drm/gpu/hardware_display_controller.h"
namespace ui {
GbmSurfaceless::GbmSurfaceless(DrmWindow* window_delegate,
DrmDeviceManager* drm_device_manager)
: window_delegate_(window_delegate),
drm_device_manager_(drm_device_manager) {
}
GbmSurfaceless::~GbmSurfaceless() {
}
intptr_t GbmSurfaceless::GetNativeWindow() {
NOTREACHED();
return 0;
}
bool GbmSurfaceless::ResizeNativeWindow(const gfx::Size& viewport_size) {
return true;
}
bool GbmSurfaceless::OnSwapBuffers() {
HardwareDisplayController* controller = window_delegate_->GetController();
if (!controller)
return true;
return controller->SchedulePageFlip(true /* is_sync */,
base::Bind(&base::DoNothing));
}
bool GbmSurfaceless::OnSwapBuffersAsync(
const SwapCompletionCallback& callback) {
HardwareDisplayController* controller = window_delegate_->GetController();
if (!controller) {
callback.Run();
return true;
}
return controller->SchedulePageFlip(false /* is_sync */, callback);
}
scoped_ptr<gfx::VSyncProvider> GbmSurfaceless::CreateVSyncProvider() {
return make_scoped_ptr(new DrmVSyncProvider(window_delegate_));
}
bool GbmSurfaceless::IsUniversalDisplayLinkDevice() {
if (!drm_device_manager_)
return false;
scoped_refptr<DrmDevice> drm_primary =
drm_device_manager_->GetDrmDevice(gfx::kNullAcceleratedWidget);
DCHECK(drm_primary);
HardwareDisplayController* controller = window_delegate_->GetController();
if (!controller)
return false;
scoped_refptr<DrmDevice> drm = controller->GetAllocationDrmDevice();
DCHECK(drm);
return drm_primary != drm;
}
} // namespace ui
|