Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(399)

Unified Diff: ui/ozone/platform/drm/gpu/hardware_display_controller.cc

Issue 1279703004: Ozone: HDC should only keep track of planes owned by it’s crtc controllers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comments Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 5ee481931ff3c6f6626260e922775ba847cb378a..8d9aa165e9baa7ed828cbf8acfd3cb67645d5414 100644
--- a/ui/ozone/platform/drm/gpu/hardware_display_controller.cc
+++ b/ui/ozone/platform/drm/gpu/hardware_display_controller.cc
@@ -139,9 +139,20 @@ bool HardwareDisplayController::MoveCursor(const gfx::Point& location) {
}
void HardwareDisplayController::AddCrtc(scoped_ptr<CrtcController> controller) {
- owned_hardware_planes_.add(
- controller->drm().get(),
- scoped_ptr<HardwareDisplayPlaneList>(new HardwareDisplayPlaneList()));
+ scoped_ptr<HardwareDisplayPlaneList> crtc_plane_list =
+ scoped_ptr<HardwareDisplayPlaneList>(new HardwareDisplayPlaneList());
+
+ // Check if this controller owns any planes and if so keep track of them.
+ scoped_refptr<DrmDevice> drm = controller->drm();
+ HardwareDisplayPlaneManager* manager = drm->plane_manager();
+ const ScopedVector<HardwareDisplayPlane>& all_planes = manager->planes();
+ uint32_t crtc = controller->crtc();
+ for (auto* plane : all_planes) {
+ if (plane->in_use() && (plane->owning_crtc() == crtc))
+ crtc_plane_list->old_plane_list.push_back(plane);
+ }
+
+ owned_hardware_planes_.add(drm.get(), crtc_plane_list.Pass());
dnicoara 2015/08/19 14:09:44 Move this at the begining and use the result to ge
kalyank 2015/08/19 15:38:54 Done.
kalyank 2015/08/19 15:38:54 Acknowledged.
crtc_controllers_.push_back(controller.Pass());
}
@@ -163,8 +174,18 @@ scoped_ptr<CrtcController> HardwareDisplayController::RemoveCrtc(
break;
}
}
- if (!found)
+ if (found) {
+ std::vector<HardwareDisplayPlane*> all_planes;
+ HardwareDisplayPlaneList* plane_list =
+ owned_hardware_planes_.get(drm.get());
+ all_planes.swap(plane_list->old_plane_list);
+ for (auto* plane : all_planes) {
+ if (plane->owning_crtc() != crtc)
+ plane_list->old_plane_list.push_back(plane);
+ }
+ } else {
owned_hardware_planes_.erase(controller->drm().get());
+ }
return controller.Pass();
}
@@ -183,6 +204,21 @@ bool HardwareDisplayController::HasCrtc(const scoped_refptr<DrmDevice>& drm,
return false;
}
+bool HardwareDisplayController::HasPlane(const scoped_refptr<DrmDevice>& drm,
+ uint32_t plane_id,
+ uint32_t crtc) const {
+ HardwareDisplayPlaneList* plane_list = owned_hardware_planes_.get(drm.get());
+ if (!plane_list)
+ return false;
+
+ for (auto* plane : plane_list->old_plane_list) {
+ if (plane->plane_id() == plane_id && plane->owning_crtc() == crtc)
+ return true;
+ }
+
+ return false;
+}
+
bool HardwareDisplayController::IsMirrored() const {
return crtc_controllers_.size() > 1;
}

Powered by Google App Engine
This is Rietveld 408576698