[PATCH i-g-t v1 1/2] lib/igt_kms: Add support to get list of async modifiers

Santhosh Reddy Guddati santhosh.reddy.guddati at intel.com
Thu Oct 3 08:44:19 UTC 2024


Signed-off-by: Santhosh Reddy Guddati <santhosh.reddy.guddati at intel.com>
---
 lib/igt_kms.c | 38 +++++++++++++++++++++++++++++++++++++-
 lib/igt_kms.h |  9 ++++++++-
 2 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 3269ec58f..efbdd6bb9 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -687,6 +687,7 @@ const char * const igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
 	[IGT_PLANE_ZPOS] = "zpos",
 	[IGT_PLANE_FB_DAMAGE_CLIPS] = "FB_DAMAGE_CLIPS",
 	[IGT_PLANE_SCALING_FILTER] = "SCALING_FILTER",
+	[IGT_PLANE_IN_FORMATS_ASYNC] = "IN_FORMATS_ASYNC",
 };
 
 const char * const igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = {
@@ -5688,11 +5689,12 @@ static int igt_count_plane_format_mod(const struct drm_format_modifier_blob *blo
 
 static void igt_fill_plane_format_mod(igt_display_t *display, igt_plane_t *plane)
 {
-	const struct drm_format_modifier_blob *blob_data;
+	const struct drm_format_modifier_blob *blob_data, *async_blob_data;
 	drmModePropertyBlobPtr blob;
 	uint64_t blob_id;
 	int idx = 0;
 	int count;
+	int async_count;
 
 	if (!igt_plane_has_prop(plane, IGT_PLANE_IN_FORMATS)) {
 		drmModePlanePtr p = plane->drm_plane;
@@ -5752,6 +5754,40 @@ static void igt_fill_plane_format_mod(igt_display_t *display, igt_plane_t *plane
 	}
 
 	igt_assert_eq(idx, plane->format_mod_count);
+
+	 if (igt_plane_get_prop(plane, IGT_PLANE_IN_FORMATS_ASYNC)) {
+ 
+		 blob_id = igt_plane_get_prop(plane, IGT_PLANE_IN_FORMATS_ASYNC);
+
+                 blob = drmModeGetPropertyBlob(display->drm_fd, blob_id);
+                 if (blob) {
+                         async_blob_data = (const struct drm_format_modifier_blob *)blob->data;
+                         async_count = igt_count_plane_format_mod(async_blob_data);
+                         if (async_count) {
+                                 plane->async_format_mod_count = async_count;
+                                 plane->async_modifiers = calloc(async_count, sizeof(plane->async_modifiers[0]));
+                                 igt_assert(plane->async_modifiers);
+
+                                 for (int i = 0; i < async_blob_data->count_modifiers; i++) {
+                                         for (int j = 0; j < 64; j++) {
+                                                 const struct drm_format_modifier *async_modifiers =
+							 modifiers_ptr(async_blob_data);
+                                                 const uint32_t *formats = formats_ptr(async_blob_data);
+
+                                                 if (!(async_modifiers[i].formats & (1ULL << j)))
+                                                         continue;
+                                                 plane->formats[idx] = formats[async_modifiers[i].offset + j];
+                                                 plane->async_modifiers[idx] = async_modifiers[i].modifier;
+                                                 idx++;
+                                                 igt_assert_lte(idx, plane->async_format_mod_count);
+                                         }
+                                 }
+                                igt_assert_eq(idx, plane->async_format_mod_count);
+                         }
+                         drmModeFreePropertyBlob(blob);
+                 }
+         }
+
 }
 
 /**
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 2461fa47c..e1ebeabf1 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -359,7 +359,8 @@ enum igt_atomic_plane_properties {
        IGT_PLANE_SCALING_FILTER,
        IGT_PLANE_HOTSPOT_X,
        IGT_PLANE_HOTSPOT_Y,
-       IGT_NUM_PLANE_PROPS
+	   IGT_PLANE_IN_FORMATS_ASYNC,
+       IGT_NUM_PLANE_PROPS,
 };
 
 /**
@@ -432,6 +433,9 @@ typedef struct igt_plane {
 	uint64_t *modifiers;
 	uint32_t *formats;
 	int format_mod_count;
+
+	uint64_t *async_modifiers;
+	int async_format_mod_count;
 } igt_plane_t;
 
 /*
@@ -1241,5 +1245,8 @@ bool intel_pipe_output_combo_valid(igt_display_t *display);
 bool igt_check_output_is_dp_mst(igt_output_t *output);
 int igt_get_dp_mst_connector_id(igt_output_t *output);
 int get_num_scalers(igt_display_t *display, enum pipe pipe);
+//bool igt_get_supported_async_modifiers(igt_plane_t *plane, uint32_t *formats,
+//			int num_formats, uint64_t **modifiers, int *num_modifiers);
+bool igt_get_supported_async_modifier(igt_plane_t *plane);
 
 #endif /* __IGT_KMS_H__ */
-- 
2.34.1



More information about the igt-dev mailing list