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