[PATCH i-g-t 15/23] lib/igt_fb: Expose igt_fb_is_gen12_mc_ccs_modifier()

Ville Syrjala ville.syrjala at linux.intel.com
Mon Sep 2 14:37:50 UTC 2024


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

I'm going to need is_gen12_mc_ccs_modifier() outside of
igt_fb.c. Rename it to igt_fb_is_gen12_mc_ccs_modifier()
and expose it to everyone.

v2: Add docs (J-P)

Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 lib/igt_fb.c | 18 ++++++++++++------
 lib/igt_fb.h |  1 +
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 534ed9aa4e55..dbf9b1035cfd 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -589,7 +589,13 @@ void igt_get_fb_tile_size(int fd, uint64_t modifier, int fb_bpp,
 	}
 }
 
-static bool is_gen12_mc_ccs_modifier(uint64_t modifier)
+/**
+ * igt_fb_is_gen12_mc_ccs_modifier:
+ * @modifier: drm modifier
+ *
+ * This function returns true if @modifier supports media compression.
+ */
+bool igt_fb_is_gen12_mc_ccs_modifier(uint64_t modifier)
 {
 	return modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS ||
 		modifier == I915_FORMAT_MOD_4_TILED_DG2_MC_CCS ||
@@ -611,7 +617,7 @@ bool igt_fb_is_gen12_rc_ccs_cc_modifier(uint64_t modifier)
 
 static bool is_gen12_ccs_modifier(uint64_t modifier)
 {
-	return is_gen12_mc_ccs_modifier(modifier) ||
+	return igt_fb_is_gen12_mc_ccs_modifier(modifier) ||
 		igt_fb_is_gen12_rc_ccs_cc_modifier(modifier) ||
 		modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS ||
 		modifier == I915_FORMAT_MOD_4_TILED_DG2_RC_CCS ||
@@ -2518,7 +2524,7 @@ static bool ccs_needs_enginecopy(const struct igt_fb *fb)
 	if (igt_fb_is_gen12_rc_ccs_cc_modifier(fb->modifier))
 		return true;
 
-	if (is_gen12_mc_ccs_modifier(fb->modifier))
+	if (igt_fb_is_gen12_mc_ccs_modifier(fb->modifier))
 		return true;
 
 	if (igt_fb_is_ccs_modifier(fb->modifier) &&
@@ -2652,7 +2658,7 @@ igt_fb_create_intel_buf(int fd, struct buf_ops *bops,
 		} else
 			igt_assert_eq(fb->strides[1] & 127, 0);
 
-		if (is_gen12_mc_ccs_modifier(fb->modifier))
+		if (igt_fb_is_gen12_mc_ccs_modifier(fb->modifier))
 			compression = I915_COMPRESSION_MEDIA;
 		else
 			compression = I915_COMPRESSION_RENDER;
@@ -2746,7 +2752,7 @@ static bool use_vebox_copy(const struct igt_fb *src_fb,
 			   const struct igt_fb *dst_fb)
 {
 
-	return is_gen12_mc_ccs_modifier(dst_fb->modifier) ||
+	return igt_fb_is_gen12_mc_ccs_modifier(dst_fb->modifier) ||
 	       igt_format_is_yuv(src_fb->drm_format) ||
 	       igt_format_is_yuv(dst_fb->drm_format);
 }
@@ -2821,7 +2827,7 @@ static struct blt_copy_object *allocate_and_initialize_blt(const struct igt_fb *
 		       intel_get_pat_idx_uc(fb->fd),
 		       blt_tile,
 		       igt_fb_is_ccs_modifier(fb->modifier) ? COMPRESSION_ENABLED : COMPRESSION_DISABLED,
-		       is_gen12_mc_ccs_modifier(fb->modifier) ? COMPRESSION_TYPE_MEDIA : COMPRESSION_TYPE_3D);
+		       igt_fb_is_gen12_mc_ccs_modifier(fb->modifier) ? COMPRESSION_TYPE_MEDIA : COMPRESSION_TYPE_3D);
 
 	blt_set_geom(blt, stride, 0, 0, fb->width, fb->plane_height[plane], 0, 0);
 	blt->plane_offset = fb->offsets[plane];
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index 12c9574827f2..eb707cc34560 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -183,6 +183,7 @@ uint64_t igt_fb_tiling_to_mod(uint64_t tiling);
 
 bool igt_fb_is_ccs_modifier(uint64_t modifier);
 bool igt_fb_is_gen12_rc_ccs_cc_modifier(uint64_t modifier);
+bool igt_fb_is_gen12_mc_ccs_modifier(uint64_t modifier);
 bool igt_fb_is_ccs_plane(const struct igt_fb *fb, int plane);
 bool igt_fb_is_gen12_ccs_cc_plane(const struct igt_fb *fb, int plane);
 int igt_fb_ccs_to_main_plane(const struct igt_fb *fb, int ccs_plane);
-- 
2.44.2



More information about the igt-dev mailing list