Index: ui/ozone/platform/drm/gpu/hardware_display_plane_manager.cc |
diff --git a/ui/ozone/platform/drm/gpu/hardware_display_plane_manager.cc b/ui/ozone/platform/drm/gpu/hardware_display_plane_manager.cc |
index 75905fc88f7f645ee4b839b34dc6d5b2a14c41a6..5c8ea5493ae9dedc995a6bd84ece224197c631a0 100644 |
--- a/ui/ozone/platform/drm/gpu/hardware_display_plane_manager.cc |
+++ b/ui/ozone/platform/drm/gpu/hardware_display_plane_manager.cc |
@@ -297,4 +297,35 @@ HardwareDisplayPlaneManager::GetCompatibleHardwarePlaneIds( |
return plane_ids; |
} |
+bool HardwareDisplayPlaneManager::IsFormatSupported(uint32_t fourcc_format, |
+ uint32_t z_order, |
+ uint32_t crtc_id) const { |
+ int crtc_index = LookupCrtcIndex(crtc_id); |
+ if (crtc_index < 0) { |
+ LOG(ERROR) << "Cannot find crtc " << crtc_id; |
+ return false; |
+ } |
+ |
+ // We dont have a way to query the z_order of a plane. This is a temporary |
+ // solution till driver exposes z_order property. |
+ uint32_t plane_z_order = 0; |
+ for (auto* hardware_plane : planes_) { |
+ if (plane_z_order > z_order) |
+ break; |
+ |
+ if (!hardware_plane->CanUseForCrtc(crtc_index)) |
+ continue; |
+ |
+ if (plane_z_order != z_order) { |
+ plane_z_order++; |
+ continue; |
+ } |
+ |
+ if (hardware_plane->IsSupportedFormat(fourcc_format)) |
+ return true; |
+ } |
+ |
+ return false; |
+} |
+ |
} // namespace ui |