Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [PATCH i-g-t v2 11/15] tests/kms_big_fb: Test planar YCbCr formats
Date: Fri, 22 Dec 2023 16:31:55 +0200	[thread overview]
Message-ID: <20231222143159.24662-12-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20231222143159.24662-1-ville.syrjala@linux.intel.com>

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

Panning around inside planar YCbCr framebuffers is a bit
more involved that the RGB counterpart. It seems prudent
to test that we are correctly handling these case.

We'll manually trick rendercopy to also copy the chroma
plane for us. It might be nice to make rendercopy eventually
handle this entirely on its own, but for now we'll take this
slight shortcut.
---
 tests/intel/kms_big_fb.c | 38 ++++++++++++++++++++++++++++++--------
 1 file changed, 30 insertions(+), 8 deletions(-)

diff --git a/tests/intel/kms_big_fb.c b/tests/intel/kms_big_fb.c
index 2b6fadeaa7a6..5dadf67bb020 100644
--- a/tests/intel/kms_big_fb.c
+++ b/tests/intel/kms_big_fb.c
@@ -42,27 +42,27 @@
 #include "xe/xe_query.h"
 
 /**
- * SUBTEST: linear-%dbpp-rotate-%d
+ * SUBTEST: linear-%s-rotate-%d
  * Description: Sanity check if addfb ioctl works correctly for given combination
  *              of Linear modifier with %arg[1]-bpp & %arg[2]-rotation
  * Functionality: big_fbs, kms_gem_interop, rotation
  *
- * SUBTEST: linear-%dbpp-rotate-%d-hflip
+ * SUBTEST: linear-%s-rotate-%d-hflip
  * Description: Sanity check if addfb ioctl works correctly for given combination
  *              of Linear modifier with %arg[1]-bpp & %arg[2]-rotation
  * Functionality: big_fbs, kms_gem_interop, rotation
  *
- * arg[1].values:       8, 16, 32, 64
+ * arg[1].values:       8bpp, 16bpp, 32bpp, 64bpp, nv12, p016
  * arg[2].values:       0, 90, 180, 270
  */
 
 /**
- * SUBTEST: %s-%dbpp-rotate-%d
+ * SUBTEST: %s-%s-rotate-%d
  * Description: Sanity check if addfb ioctl works correctly for given combination
  *              of %arg[1] with %arg[2]-bpp & %arg[3]-rotation
  * Functionality: big_fbs, kms_gem_interop, rotation, tiling
  *
- * SUBTEST: %s-%dbpp-rotate-%d-hflip
+ * SUBTEST: %s-%s-rotate-%d-hflip
  * Description: Sanity check if addfb ioctl works correctly for given combination
  *              of %arg[1] with %arg[2]-bpp & %arg[3]-rotation
  * Functionality: big_fbs, kms_gem_interop, rotation, tiling
@@ -74,7 +74,7 @@
  * @y-tiled:            TILE-Y modifier
  * @yf-tiled:           TILE-YF modifier
  *
- * arg[2].values:       8, 16, 32, 64
+ * arg[2].values:       8bpp, 16bpp, 32bpp, 64bpp, nv12, p016
  * arg[3].values:       0, 90, 180, 270
  *
  * arg[4]:
@@ -237,6 +237,18 @@ static void copy_pattern(data_t *data,
 	 */
 	if (data->render_copy) {
 		data->render_copy(data->ibb, src, sx, sy, w, h, dst, dx, dy);
+
+		/* FIXME rendercopy should do this for us perhaps? */
+		if (igt_format_is_yuv_semiplanar(data->format)) {
+			igt_assert(!igt_fb_is_ccs_modifier(data->modifier));
+
+			src->bpp *= 2;
+			src->surface[0] = src->surface[1];
+			dst->bpp *= 2;
+			dst->surface[0] = dst->surface[1];
+
+			data->render_copy(data->ibb, src, sx/2, sy/2, w/2, h/2, dst, dx/2, dy/2);
+		}
 	} else {
 		w = min(w, src_fb->width - sx);
 		w = min(w, dst_fb->width - dx);
@@ -320,6 +332,10 @@ static void generate_pattern(data_t *data,
 				     pat_fb.width, pat_fb.height);
 			w++;
 			h++;
+			if (igt_format_is_yuv_semiplanar(data->format)) {
+				w++;
+				h++;
+			}
 		}
 	}
 
@@ -479,8 +495,9 @@ static bool test_plane(data_t *data)
 		int y = coords[i].y;
 
 		/* Hardware limitation */
-		if (data->format == DRM_FORMAT_RGB565 &&
-		    igt_rotation_90_or_270(data->rotation)) {
+		if ((data->format == DRM_FORMAT_RGB565 &&
+		     igt_rotation_90_or_270(data->rotation)) ||
+		    igt_format_is_yuv_semiplanar(data->format)) {
 			x &= ~1;
 			y &= ~1;
 		}
@@ -941,6 +958,9 @@ static bool has_async_flip(data_t *data)
 	 * TODO: preferably probe all this stuff with
 	 * TEST_ONLY rather than hardcoding it...
 	 */
+	if (igt_format_is_yuv_semiplanar(data->format))
+		return false;
+
 	if (intel_display_ver(data->devid) < 12 &&
 	    data->modifier == DRM_FORMAT_MOD_LINEAR)
 		return false;
@@ -969,6 +989,8 @@ static const struct {
 	{ DRM_FORMAT_RGB565, "16bpp", },
 	{ DRM_FORMAT_XRGB8888, "32bpp", },
 	{ DRM_FORMAT_XBGR16161616F, "64bpp", },
+	{ DRM_FORMAT_NV12, "nv12", },
+	{ DRM_FORMAT_P016, "p016", },
 };
 
 static const igt_rotation_t rotations[] = {
-- 
2.41.0

  parent reply	other threads:[~2023-12-22 14:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-22 14:31 [PATCH i-g-t v2 00/15] tests/kms_big_fb: Test planar formats, and CCS Ville Syrjala
2023-12-22 14:31 ` [PATCH i-g-t v2 01/15] lib/rendercopy: Add deltas to all surface relocs Ville Syrjala
2023-12-22 14:31 ` [PATCH i-g-t v2 02/15] tests/kms_big_fb: Use igt_fb_create_intel_buf() Ville Syrjala
2023-12-22 14:31 ` [PATCH i-g-t v2 03/15] lib/igt_fb: Expose igt_fb_is_ccs_modifier() Ville Syrjala
2023-12-22 14:31 ` [PATCH i-g-t v2 04/15] tests/kms_big_fb: Fix async Ville Syrjala
2023-12-22 14:31 ` [PATCH i-g-t v2 05/15] tests/kms_big_fb: Test async flips + linear on tgl+ Ville Syrjala
2023-12-22 14:31 ` [PATCH i-g-t v2 06/15] tests/kms_big_fb: Determine the max fb size the same way always Ville Syrjala
2023-12-22 14:31 ` [PATCH i-g-t v2 07/15] tests/kms_frontbuffer_tracking: Use igt_create_fb() Ville Syrjala
2023-12-22 14:31 ` [PATCH i-g-t v2 08/15] lib/igt_fb: Make igt_calc_fb_size() somewhat usable Ville Syrjala
2023-12-22 14:31 ` [PATCH i-g-t v2 09/15] tests/kms_big_fb: Nuke fliptab[] Ville Syrjala
2023-12-22 14:31 ` [PATCH i-g-t v2 10/15] tests/kms_big_fb: Replace 'bpp' with 'name' Ville Syrjala
2023-12-22 14:31 ` Ville Syrjala [this message]
2023-12-22 14:31 ` [PATCH i-g-t v2 12/15] tests/kms_big_fb: Also test some CCS modifiers Ville Syrjala
2023-12-22 14:31 ` [PATCH i-g-t v2 13/15] lib/rendercopy: Always setup clear color for TGL Ville Syrjala
2023-12-22 14:31 ` [PATCH i-g-t v2 14/15] tests/kms_big_fb: Enable CCS testing " Ville Syrjala
2023-12-22 14:31 ` [PATCH i-g-t v2 15/15] lib/rendercopy: Enable clear color consistently Ville Syrjala

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231222143159.24662-12-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox