Index: ui/ozone/platform/drm/gpu/hardware_display_controller.cc |
diff --git a/ui/ozone/platform/drm/gpu/hardware_display_controller.cc b/ui/ozone/platform/drm/gpu/hardware_display_controller.cc |
index f9f08ea1926f5fb6691f12eb7dc5c2b82205053a..305f6fadf68f8e9af7daaee4eace7d1a611fe36f 100644 |
--- a/ui/ozone/platform/drm/gpu/hardware_display_controller.cc |
+++ b/ui/ozone/platform/drm/gpu/hardware_display_controller.cc |
@@ -14,17 +14,22 @@ |
#include "third_party/skia/include/core/SkCanvas.h" |
#include "ui/gfx/geometry/point.h" |
#include "ui/gfx/geometry/size.h" |
+#include "ui/gfx/native_widget_types.h" |
#include "ui/ozone/platform/drm/gpu/crtc_controller.h" |
#include "ui/ozone/platform/drm/gpu/drm_buffer.h" |
#include "ui/ozone/platform/drm/gpu/drm_device.h" |
#include "ui/ozone/public/native_pixmap.h" |
namespace ui { |
+namespace { |
+void EmptyPageFlipCallback(int result) { |
+} |
+} // namespace |
HardwareDisplayController::PageFlipRequest::PageFlipRequest( |
const OverlayPlaneList& planes, |
bool is_sync, |
- const base::Closure& callback) |
+ const PageFlipCallback& callback) |
: planes(planes), is_sync(is_sync), callback(callback) { |
} |
@@ -56,13 +61,14 @@ bool HardwareDisplayController::Modeset(const OverlayPlane& primary, |
mode_ = mode; |
current_planes_ = std::vector<OverlayPlane>(1, primary); |
+ pending_planes_.clear(); |
ClearPendingRequests(); |
// Because a page flip is pending we need to leave some state for the |
// callback. We use the modeset state since it is the only valid state. |
if (HasPendingPageFlips()) |
- requests_.push_back( |
- PageFlipRequest(current_planes_, false, base::Bind(&base::DoNothing))); |
+ requests_.push_back(PageFlipRequest(current_planes_, false, |
+ base::Bind(&EmptyPageFlipCallback))); |
return status; |
} |
@@ -70,13 +76,7 @@ bool HardwareDisplayController::Modeset(const OverlayPlane& primary, |
bool HardwareDisplayController::Enable() { |
TRACE_EVENT0("drm", "HDC::Enable"); |
DCHECK(!current_planes_.empty()); |
- |
- const OverlayPlane* primary = nullptr; |
- // Use the last scheduled buffer to modeset to preserve request order. |
- if (!requests_.empty()) |
- primary = OverlayPlane::GetPrimaryPlane(requests_.back().planes); |
- else |
- primary = OverlayPlane::GetPrimaryPlane(current_planes_); |
+ const OverlayPlane* primary = OverlayPlane::GetPrimaryPlane(current_planes_); |
return Modeset(*primary, mode_); |
} |
@@ -95,12 +95,12 @@ void HardwareDisplayController::QueueOverlayPlane(const OverlayPlane& plane) { |
bool HardwareDisplayController::SchedulePageFlip( |
bool is_sync, |
- const base::Closure& callback) { |
+ const PageFlipCallback& callback) { |
TRACE_EVENT0("drm", "HDC::SchedulePageFlip"); |
// Ignore requests with no planes to schedule. |
if (pending_planes_.empty()) { |
- callback.Run(); |
+ callback.Run(gfx::SwapAck); |
return true; |
} |
@@ -120,6 +120,10 @@ bool HardwareDisplayController::SchedulePageFlip( |
return status; |
} |
+bool HardwareDisplayController::SchedulePageFlipWithoutCallback(bool is_sync) { |
+ return SchedulePageFlip(is_sync, base::Bind(&EmptyPageFlipCallback)); |
+} |
+ |
bool HardwareDisplayController::SetCursor( |
const scoped_refptr<ScanoutBuffer>& buffer) { |
bool status = true; |
@@ -260,7 +264,7 @@ void HardwareDisplayController::OnPageFlipEvent() { |
// Normally the caller would handle the error call, but because we're in a |
// delayed schedule the initial SchedulePageFlip() already returned true, |
// thus we need to run the callback. |
- request.callback.Run(); |
+ request.callback.Run(gfx::SwapFailed); |
} |
} |
@@ -318,14 +322,14 @@ void HardwareDisplayController::ProcessPageFlipRequest() { |
requests_.pop_front(); |
current_planes_.swap(request.planes); |
- request.callback.Run(); |
+ request.callback.Run(gfx::SwapAck); |
} |
void HardwareDisplayController::ClearPendingRequests() { |
while (!requests_.empty()) { |
PageFlipRequest request = requests_.front(); |
requests_.pop_front(); |
- request.callback.Run(); |
+ request.callback.Run(gfx::SwapAck); |
} |
} |