[PATCH i-g-t 15/37] lib/igt_fb: Extract ccs_needs_enginecopy()

Ville Syrjala ville.syrjala at linux.intel.com
Tue Jul 2 23:27:55 UTC 2024


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

We have two copies of the code to determine if CCS needs to
use enginecopy. Extract the code to a helper.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 lib/igt_fb.c | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index c48a61b5f148..6c9b4b7f3107 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -2494,17 +2494,29 @@ static bool block_copy_ok(const struct igt_fb *fb)
 					       fb_tile_to_blt_tile(fb->modifier));
 }
 
+static bool ccs_needs_enginecopy(const struct igt_fb *fb)
+{
+	if (is_gen12_mc_ccs_modifier(fb->modifier))
+		return true;
+
+	if (is_ccs_modifier(fb->modifier) &&
+	    !HAS_FLATCCS(intel_get_drm_devid(fb->fd)))
+		return true;
+
+	return false;
+}
+
 static bool blitter_ok(const struct igt_fb *fb)
 {
 	if (!is_intel_device(fb->fd))
 		return false;
 
-	if ((!HAS_FLATCCS(intel_get_drm_devid(fb->fd)) &&
-	    is_ccs_modifier(fb->modifier)) ||
-	    is_gen12_mc_ccs_modifier(fb->modifier) ||
-	    (!blt_uses_extended_block_copy(fb->fd) &&
+	if (ccs_needs_enginecopy(fb))
+		return false;
+
+	if (!blt_uses_extended_block_copy(fb->fd) &&
 	    fb->modifier == I915_FORMAT_MOD_X_TILED &&
-	    is_xe_device(fb->fd)))
+	    is_xe_device(fb->fd))
 		return false;
 
 	if (is_xe_device(fb->fd))
@@ -2544,10 +2556,11 @@ static bool use_enginecopy(const struct igt_fb *fb)
 	if (blitter_ok(fb))
 		return false;
 
+	if (ccs_needs_enginecopy(fb))
+		return true;
+
 	return fb->modifier == I915_FORMAT_MOD_Yf_TILED ||
-	       fb->modifier == I915_FORMAT_MOD_X_TILED ||
-	       (!HAS_FLATCCS(intel_get_drm_devid(fb->fd)) && is_ccs_modifier(fb->modifier)) ||
-	       is_gen12_mc_ccs_modifier(fb->modifier);
+		fb->modifier == I915_FORMAT_MOD_X_TILED;
 }
 
 static bool use_blitter(const struct igt_fb *fb)
-- 
2.44.2



More information about the igt-dev mailing list