OLD | NEW |
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/hardware_display_controller.h" | 5 #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h" |
6 | 6 |
7 #include <drm.h> | 7 #include <drm.h> |
8 #include <string.h> | 8 #include <string.h> |
9 #include <xf86drm.h> | 9 #include <xf86drm.h> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
14 #include "third_party/skia/include/core/SkCanvas.h" | 14 #include "third_party/skia/include/core/SkCanvas.h" |
15 #include "ui/gfx/geometry/point.h" | 15 #include "ui/gfx/geometry/point.h" |
16 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
17 #include "ui/gfx/swap_result.h" | 17 #include "ui/gfx/swap_result.h" |
18 #include "ui/ozone/platform/drm/gpu/crtc_controller.h" | 18 #include "ui/ozone/platform/drm/gpu/crtc_controller.h" |
19 #include "ui/ozone/platform/drm/gpu/drm_buffer.h" | 19 #include "ui/ozone/platform/drm/gpu/drm_buffer.h" |
20 #include "ui/ozone/platform/drm/gpu/drm_device.h" | 20 #include "ui/ozone/platform/drm/gpu/drm_device.h" |
21 #include "ui/ozone/platform/drm/gpu/page_flip_request.h" | 21 #include "ui/ozone/platform/drm/gpu/page_flip_request.h" |
22 #include "ui/ozone/public/native_pixmap.h" | 22 #include "ui/ozone/public/native_pixmap.h" |
23 | 23 |
24 namespace ui { | 24 namespace ui { |
25 | 25 |
| 26 namespace { |
| 27 |
| 28 void EmptyFlipCallback(gfx::SwapResult) {} |
| 29 |
| 30 } // namespace |
| 31 |
26 HardwareDisplayController::HardwareDisplayController( | 32 HardwareDisplayController::HardwareDisplayController( |
27 scoped_ptr<CrtcController> controller, | 33 scoped_ptr<CrtcController> controller, |
28 const gfx::Point& origin) | 34 const gfx::Point& origin) |
29 : origin_(origin), | 35 : origin_(origin), |
30 is_disabled_(controller->is_disabled()) { | 36 is_disabled_(controller->is_disabled()) { |
31 AddCrtc(controller.Pass()); | 37 AddCrtc(controller.Pass()); |
32 } | 38 } |
33 | 39 |
34 HardwareDisplayController::~HardwareDisplayController() { | 40 HardwareDisplayController::~HardwareDisplayController() { |
35 // Reset the cursor. | 41 // Reset the cursor. |
(...skipping 29 matching lines...) Expand all Loading... |
65 | 71 |
66 void HardwareDisplayController::Disable() { | 72 void HardwareDisplayController::Disable() { |
67 TRACE_EVENT0("drm", "HDC::Disable"); | 73 TRACE_EVENT0("drm", "HDC::Disable"); |
68 for (size_t i = 0; i < crtc_controllers_.size(); ++i) | 74 for (size_t i = 0; i < crtc_controllers_.size(); ++i) |
69 crtc_controllers_[i]->Disable(); | 75 crtc_controllers_[i]->Disable(); |
70 | 76 |
71 | 77 |
72 is_disabled_ = true; | 78 is_disabled_ = true; |
73 } | 79 } |
74 | 80 |
75 bool HardwareDisplayController::SchedulePageFlip( | 81 void HardwareDisplayController::SchedulePageFlip( |
| 82 const OverlayPlaneList& plane_list, |
| 83 const PageFlipCallback& callback) { |
| 84 ActualSchedulePageFlip(plane_list, false /* test_only */, callback); |
| 85 } |
| 86 |
| 87 bool HardwareDisplayController::TestPageFlip( |
| 88 const OverlayPlaneList& plane_list) { |
| 89 return ActualSchedulePageFlip(plane_list, true /* test_only */, |
| 90 base::Bind(&EmptyFlipCallback)); |
| 91 } |
| 92 |
| 93 bool HardwareDisplayController::ActualSchedulePageFlip( |
76 const OverlayPlaneList& plane_list, | 94 const OverlayPlaneList& plane_list, |
77 bool test_only, | 95 bool test_only, |
78 const PageFlipCallback& callback) { | 96 const PageFlipCallback& callback) { |
79 TRACE_EVENT0("drm", "HDC::SchedulePageFlip"); | 97 TRACE_EVENT0("drm", "HDC::SchedulePageFlip"); |
80 | 98 |
81 DCHECK(!is_disabled_); | 99 DCHECK(!is_disabled_); |
82 | 100 |
83 // Ignore requests with no planes to schedule. | 101 // Ignore requests with no planes to schedule. |
84 if (plane_list.empty()) { | 102 if (plane_list.empty()) { |
85 callback.Run(gfx::SwapResult::SWAP_ACK); | 103 callback.Run(gfx::SwapResult::SWAP_ACK); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 280 |
263 scoped_refptr<DrmDevice> HardwareDisplayController::GetAllocationDrmDevice() | 281 scoped_refptr<DrmDevice> HardwareDisplayController::GetAllocationDrmDevice() |
264 const { | 282 const { |
265 DCHECK(!crtc_controllers_.empty()); | 283 DCHECK(!crtc_controllers_.empty()); |
266 // TODO(dnicoara) When we support mirroring across DRM devices, figure out | 284 // TODO(dnicoara) When we support mirroring across DRM devices, figure out |
267 // which device should be used for allocations. | 285 // which device should be used for allocations. |
268 return crtc_controllers_[0]->drm(); | 286 return crtc_controllers_[0]->drm(); |
269 } | 287 } |
270 | 288 |
271 } // namespace ui | 289 } // namespace ui |
OLD | NEW |