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 26 matching lines...) Expand all Loading... |
53 for (size_t i = 0; i < crtc_controllers_.size(); ++i) | 54 for (size_t i = 0; i < crtc_controllers_.size(); ++i) |
54 crtc_controllers_[i]->Disable(); | 55 crtc_controllers_[i]->Disable(); |
55 | 56 |
56 | 57 |
57 is_disabled_ = true; | 58 is_disabled_ = true; |
58 } | 59 } |
59 | 60 |
60 bool HardwareDisplayController::SchedulePageFlip( | 61 bool HardwareDisplayController::SchedulePageFlip( |
61 const OverlayPlaneList& plane_list, | 62 const OverlayPlaneList& plane_list, |
62 bool is_sync, | 63 bool is_sync, |
63 const base::Closure& callback) { | 64 const PageFlipCallback& callback) { |
64 TRACE_EVENT0("drm", "HDC::SchedulePageFlip"); | 65 TRACE_EVENT0("drm", "HDC::SchedulePageFlip"); |
65 | 66 |
66 DCHECK(!is_disabled_); | 67 DCHECK(!is_disabled_); |
67 | 68 |
68 // Ignore requests with no planes to schedule. | 69 // Ignore requests with no planes to schedule. |
69 if (plane_list.empty()) { | 70 if (plane_list.empty()) { |
70 callback.Run(); | 71 callback.Run(gfx::SwapAck); |
71 return true; | 72 return true; |
72 } | 73 } |
73 | 74 |
74 scoped_refptr<PageFlipRequest> page_flip_request = | 75 scoped_refptr<PageFlipRequest> page_flip_request = |
75 new PageFlipRequest(crtc_controllers_.size(), callback); | 76 new PageFlipRequest(crtc_controllers_.size(), callback); |
76 | 77 |
77 OverlayPlaneList pending_planes = plane_list; | 78 OverlayPlaneList pending_planes = plane_list; |
78 std::sort(pending_planes.begin(), pending_planes.end(), | 79 std::sort(pending_planes.begin(), pending_planes.end(), |
79 [](const OverlayPlane& l, const OverlayPlane& r) { | 80 [](const OverlayPlane& l, const OverlayPlane& r) { |
80 return l.z_order < r.z_order; | 81 return l.z_order < r.z_order; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 197 |
197 scoped_refptr<DrmDevice> HardwareDisplayController::GetAllocationDrmDevice() | 198 scoped_refptr<DrmDevice> HardwareDisplayController::GetAllocationDrmDevice() |
198 const { | 199 const { |
199 DCHECK(!crtc_controllers_.empty()); | 200 DCHECK(!crtc_controllers_.empty()); |
200 // TODO(dnicoara) When we support mirroring across DRM devices, figure out | 201 // TODO(dnicoara) When we support mirroring across DRM devices, figure out |
201 // which device should be used for allocations. | 202 // which device should be used for allocations. |
202 return crtc_controllers_[0]->drm(); | 203 return crtc_controllers_[0]->drm(); |
203 } | 204 } |
204 | 205 |
205 } // namespace ui | 206 } // namespace ui |
OLD | NEW |