Index: ui/ozone/platform/dri/hardware_display_plane_manager_legacy.cc |
diff --git a/ui/ozone/platform/dri/hardware_display_plane_manager_legacy.cc b/ui/ozone/platform/dri/hardware_display_plane_manager_legacy.cc |
index efa47b684432b812ff6a38fea85942c041fbd3db..9b385bb5613998d27df00e7bb4f60cf6dff11927 100644 |
--- a/ui/ozone/platform/dri/hardware_display_plane_manager_legacy.cc |
+++ b/ui/ozone/platform/dri/hardware_display_plane_manager_legacy.cc |
@@ -22,10 +22,19 @@ bool HardwareDisplayPlaneManagerLegacy::Commit( |
if (plane_list->plane_list.empty()) // No assigned planes, nothing to do. |
return true; |
bool ret = true; |
- plane_list->plane_list.swap(plane_list->old_plane_list); |
- plane_list->plane_list.clear(); |
for (const auto& flip : plane_list->legacy_page_flips) { |
dnicoara
2015/01/16 21:40:08
Add a comment before the for-loop mentioning why t
achaulk
2015/01/21 21:50:53
Done.
|
// Permission Denied is a legitimate error |
+ for (const auto& plane : flip.planes) { |
+ if (!drm_->PageFlipOverlay(flip.crtc_id, plane.framebuffer, plane.bounds, |
+ plane.src_rect, plane.plane)) { |
+ LOG(ERROR) << "Cannot display plane on overlay: error=" |
+ << strerror(errno) << "crtc=" << flip.crtc |
+ << " plane=" << plane.plane; |
+ ret = false; |
+ flip.crtc->PageFlipFailed(); |
+ break; |
+ } |
+ } |
if (!drm_->PageFlip(flip.crtc_id, flip.framebuffer, |
base::Bind(&CrtcController::OnPageFlipEvent, |
flip.crtc->AsWeakPtr()))) { |
@@ -37,20 +46,28 @@ bool HardwareDisplayPlaneManagerLegacy::Commit( |
ret = false; |
} |
flip.crtc->PageFlipFailed(); |
- } else { |
- for (const auto& plane : flip.planes) { |
- if (!drm_->PageFlipOverlay(flip.crtc_id, plane.framebuffer, |
- plane.bounds, plane.src_rect, plane.plane)) { |
- LOG(ERROR) << "Cannot display plane on overlay: error=" |
- << strerror(errno); |
- ret = false; |
- flip.crtc->PageFlipFailed(); |
- break; |
- } |
+ } |
+ } |
+ for (HardwareDisplayPlane* plane : plane_list->old_plane_list) { |
dnicoara
2015/01/16 21:40:08
Should this be done before the PageFlip()? I think
achaulk
2015/01/21 21:50:53
No, it only changes planes that haven't been re-us
|
+ bool found = |
+ std::find(plane_list->plane_list.begin(), plane_list->plane_list.end(), |
+ plane) != plane_list->plane_list.end(); |
+ if (!found && !plane->in_use()) { |
+ // This plane is being released, so we need to zero it. |
+ if (!drm_->PageFlipOverlay(plane->owning_crtc(), 0, gfx::Rect(), |
+ gfx::Rect(), plane->plane_id())) { |
+ LOG(ERROR) << "Cannot free overlay: error=" << strerror(errno) |
+ << "crtc=" << plane->owning_crtc() |
+ << " plane=" << plane->plane_id(); |
+ ret = false; |
+ break; |
} |
} |
} |
+ plane_list->plane_list.swap(plane_list->old_plane_list); |
+ plane_list->plane_list.clear(); |
plane_list->legacy_page_flips.clear(); |
+ plane_list->committed = true; |
return ret; |
} |