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/ozone/platform/drm/gpu/crtc_controller.h" | 18 #include "ui/ozone/platform/drm/gpu/crtc_controller.h" |
18 #include "ui/ozone/platform/drm/gpu/drm_buffer.h" | 19 #include "ui/ozone/platform/drm/gpu/drm_buffer.h" |
19 #include "ui/ozone/platform/drm/gpu/drm_device.h" | 20 #include "ui/ozone/platform/drm/gpu/drm_device.h" |
20 #include "ui/ozone/platform/drm/gpu/page_flip_request.h" | 21 #include "ui/ozone/platform/drm/gpu/page_flip_request.h" |
21 #include "ui/ozone/public/native_pixmap.h" | 22 #include "ui/ozone/public/native_pixmap.h" |
22 | 23 |
23 namespace ui { | 24 namespace ui { |
24 | 25 |
25 HardwareDisplayController::HardwareDisplayController( | 26 HardwareDisplayController::HardwareDisplayController( |
26 scoped_ptr<CrtcController> controller, | 27 scoped_ptr<CrtcController> controller, |
(...skipping 29 matching lines...) Expand all Loading... |
56 crtc_controllers_[i]->Disable(); | 57 crtc_controllers_[i]->Disable(); |
57 | 58 |
58 | 59 |
59 is_disabled_ = true; | 60 is_disabled_ = true; |
60 } | 61 } |
61 | 62 |
62 bool HardwareDisplayController::SchedulePageFlip( | 63 bool HardwareDisplayController::SchedulePageFlip( |
63 const OverlayPlaneList& plane_list, | 64 const OverlayPlaneList& plane_list, |
64 bool is_sync, | 65 bool is_sync, |
65 bool test_only, | 66 bool test_only, |
66 const base::Closure& callback) { | 67 const PageFlipCallback& callback) { |
67 TRACE_EVENT0("drm", "HDC::SchedulePageFlip"); | 68 TRACE_EVENT0("drm", "HDC::SchedulePageFlip"); |
68 | 69 |
69 DCHECK(!is_disabled_); | 70 DCHECK(!is_disabled_); |
70 | 71 |
71 // Ignore requests with no planes to schedule. | 72 // Ignore requests with no planes to schedule. |
72 if (plane_list.empty()) { | 73 if (plane_list.empty()) { |
73 callback.Run(); | 74 callback.Run(gfx::SwapResult::SWAP_ACK); |
74 return true; | 75 return true; |
75 } | 76 } |
76 | 77 |
77 scoped_refptr<PageFlipRequest> page_flip_request = | 78 scoped_refptr<PageFlipRequest> page_flip_request = |
78 new PageFlipRequest(crtc_controllers_.size(), callback); | 79 new PageFlipRequest(crtc_controllers_.size(), callback); |
79 | 80 |
80 OverlayPlaneList pending_planes = plane_list; | 81 OverlayPlaneList pending_planes = plane_list; |
81 std::sort(pending_planes.begin(), pending_planes.end(), | 82 std::sort(pending_planes.begin(), pending_planes.end(), |
82 [](const OverlayPlane& l, const OverlayPlane& r) { | 83 [](const OverlayPlane& l, const OverlayPlane& r) { |
83 return l.z_order < r.z_order; | 84 return l.z_order < r.z_order; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 204 |
204 scoped_refptr<DrmDevice> HardwareDisplayController::GetAllocationDrmDevice() | 205 scoped_refptr<DrmDevice> HardwareDisplayController::GetAllocationDrmDevice() |
205 const { | 206 const { |
206 DCHECK(!crtc_controllers_.empty()); | 207 DCHECK(!crtc_controllers_.empty()); |
207 // TODO(dnicoara) When we support mirroring across DRM devices, figure out | 208 // TODO(dnicoara) When we support mirroring across DRM devices, figure out |
208 // which device should be used for allocations. | 209 // which device should be used for allocations. |
209 return crtc_controllers_[0]->drm(); | 210 return crtc_controllers_[0]->drm(); |
210 } | 211 } |
211 | 212 |
212 } // namespace ui | 213 } // namespace ui |
OLD | NEW |