diff mbox series

[v3,3/5] drm/plane: Function to check async supported modifier/format

Message ID 20250108-asyn-v3-3-f4399635eec9@intel.com (mailing list archive)
State New
Headers show
Series Expose modifiers/formats supported by async flips | expand

Commit Message

Arun R Murthy Jan. 8, 2025, 5:39 a.m. UTC
Seperate function for async flips is to be called in order to check the
provided format/modifier support.
At present the flag for async flip is stored in crtc_state as async flip
is supported on only one plane for a given crtc. The same is being
used over here to decide the async function pointer.

Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
---
 drivers/gpu/drm/drm_plane.c | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 4f35eec2b7770fcc90c3e07a9068b31c0563a4c0..9e08ba4318cf0c07fa0701023659986855e0e98a 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -238,12 +238,21 @@  int drm_plane_create_format_blob(struct drm_device *dev,
 	mod = modifiers_ptr(blob_data);
 	for (i = 0; i < modifier_count; i++) {
 		for (j = 0; j < format_count; j++) {
-			if (is_async ||
-			    !plane->funcs->format_mod_supported ||
-			    plane->funcs->format_mod_supported(plane,
-							       formats[j],
-							       modifiers[i])) {
-				mod->formats |= 1ULL << j;
+			if (is_async) {
+				if (!plane->funcs->format_mod_supported_async ||
+				    plane->funcs->format_mod_supported_async(plane,
+									     formats[j],
+									     modifiers[i])) {
+					mod->formats |= 1ULL << j;
+				}
+
+			} else {
+				if (!plane->funcs->format_mod_supported ||
+				    plane->funcs->format_mod_supported(plane,
+								       formats[j],
+								       modifiers[i])) {
+					mod->formats |= 1ULL << j;
+				}
 			}
 		}
 
@@ -910,6 +919,7 @@  bool drm_plane_has_format(struct drm_plane *plane,
 			  u32 format, u64 modifier)
 {
 	unsigned int i;
+	bool is_async = plane->crtc->state->async_flip;
 
 	for (i = 0; i < plane->format_count; i++) {
 		if (format == plane->format_types[i])
@@ -918,8 +928,12 @@  bool drm_plane_has_format(struct drm_plane *plane,
 	if (i == plane->format_count)
 		return false;
 
-	if (plane->funcs->format_mod_supported) {
-		if (!plane->funcs->format_mod_supported(plane, format, modifier))
+	if (is_async ? plane->funcs->format_mod_supported_async :
+			plane->funcs->format_mod_supported) {
+		if (!(is_async ? plane->funcs->format_mod_supported_async(
+						plane, format, modifier) :
+					plane->funcs->format_mod_supported(
+						plane, format, modifier)))
 			return false;
 	} else {
 		if (!plane->modifier_count)