Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: ui/ozone/platform/drm/gpu/gbm_surfaceless.cc

Issue 1311043016: Switch DRM platform to using a separate thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mv-drm-calls-on-thread2
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/ozone/platform/drm/gpu/gbm_surfaceless.h" 5 #include "ui/ozone/platform/drm/gpu/gbm_surfaceless.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.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" 9 #include "ui/ozone/platform/drm/gpu/drm_vsync_provider.h"
12 #include "ui/ozone/platform/drm/gpu/drm_window.h" 10 #include "ui/ozone/platform/drm/gpu/drm_window_proxy.h"
13 #include "ui/ozone/platform/drm/gpu/gbm_buffer.h" 11 #include "ui/ozone/platform/drm/gpu/gbm_buffer.h"
14 #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h" 12 #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h"
15 13
16 namespace ui { 14 namespace ui {
17 namespace { 15 namespace {
18 void EmptyPageFlipCallback(gfx::SwapResult result) { 16 void EmptyPageFlipCallback(gfx::SwapResult result) {
19 } 17 }
20 } // namespace 18 } // namespace
21 19
22 GbmSurfaceless::GbmSurfaceless(DrmWindow* window, 20 GbmSurfaceless::GbmSurfaceless(scoped_ptr<DrmWindowProxy> window)
23 DrmDeviceManager* drm_device_manager) 21 : window_(window.Pass()) {}
24 : window_(window), drm_device_manager_(drm_device_manager) {
25 }
26 22
27 GbmSurfaceless::~GbmSurfaceless() { 23 GbmSurfaceless::~GbmSurfaceless() {
28 } 24 }
29 25
30 intptr_t GbmSurfaceless::GetNativeWindow() { 26 intptr_t GbmSurfaceless::GetNativeWindow() {
31 NOTREACHED(); 27 NOTREACHED();
32 return 0; 28 return 0;
33 } 29 }
34 30
35 bool GbmSurfaceless::ResizeNativeWindow(const gfx::Size& viewport_size) { 31 bool GbmSurfaceless::ResizeNativeWindow(const gfx::Size& viewport_size) {
36 return true; 32 return true;
37 } 33 }
38 34
39 bool GbmSurfaceless::OnSwapBuffers() { 35 bool GbmSurfaceless::OnSwapBuffers() {
40 return window_->SchedulePageFlip(true /* is_sync */, 36 return window_->SchedulePageFlip(true /* is_sync */,
41 base::Bind(&EmptyPageFlipCallback)); 37 base::Bind(&EmptyPageFlipCallback));
42 } 38 }
43 39
44 bool GbmSurfaceless::OnSwapBuffersAsync( 40 bool GbmSurfaceless::OnSwapBuffersAsync(
45 const SwapCompletionCallback& callback) { 41 const SwapCompletionCallback& callback) {
46 return window_->SchedulePageFlip(false /* is_sync */, callback); 42 return window_->SchedulePageFlip(false /* is_sync */, callback);
47 } 43 }
48 44
49 scoped_ptr<gfx::VSyncProvider> GbmSurfaceless::CreateVSyncProvider() { 45 scoped_ptr<gfx::VSyncProvider> GbmSurfaceless::CreateVSyncProvider() {
50 return make_scoped_ptr(new DrmVSyncProvider(window_)); 46 return make_scoped_ptr(new DrmVSyncProvider(window_.get()));
51 } 47 }
52 48
53 bool GbmSurfaceless::IsUniversalDisplayLinkDevice() { 49 bool GbmSurfaceless::IsUniversalDisplayLinkDevice() {
54 if (!drm_device_manager_) 50 return window_->IsDisplayedOnUniversalDisplayLinkDevice();
55 return false;
56 scoped_refptr<DrmDevice> drm_primary =
57 drm_device_manager_->GetDrmDevice(gfx::kNullAcceleratedWidget);
58 DCHECK(drm_primary);
59
60 HardwareDisplayController* controller = window_->GetController();
61 if (!controller)
62 return false;
63 scoped_refptr<DrmDevice> drm = controller->GetAllocationDrmDevice();
64 DCHECK(drm);
65
66 return drm_primary != drm;
67 } 51 }
68 52
69 } // namespace ui 53 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698