diff mbox

[i-g-t,v3,7/7] tests/kms_ccs: Test case for wrong aux buffer stripe size

Message ID 20170831061810.11773-8-krisman@collabora.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Gabriel Krisman Bertazi Aug. 31, 2017, 6:18 a.m. UTC
Two scenarios tested:
  - unaligned stripe
  - Stripe too small

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
---
 tests/kms_ccs.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

Comments

Daniel Stone Sept. 5, 2017, 8:03 a.m. UTC | #1
Hi Gabriel,

On 31 August 2017 at 07:18, Gabriel Krisman Bertazi
<krisman@collabora.co.uk> wrote:
> Two scenarios tested:
>   - unaligned stripe
>   - Stripe too small

'stride' in the commit message please. ;) But it is fine everywhere
through the code.

> @@ -323,7 +326,14 @@ static void generate_fb(data_t *data, struct igt_fb *fb,
>                  */
>                 int ccs_width = ALIGN(width * 4, 32) / 32;
>                 int ccs_height = ALIGN(height, 16) / 16;
> -               f.pitches[1] = ALIGN(ccs_width * 1, 128);
> +               int aux_stride = ALIGN(ccs_width * 1, 128);
> +
> +               if (fb_flags & FB_MISALIGN_AUX_STRIDE)
> +                       aux_stride = ccs_width;

aux_stride -= 64 perhaps?

> +               else if (fb_flags & FB_SMALL_AUX_STRIDE)
> +                       aux_stride = ALIGN(ccs_width/2, 128);

This one seems OK, but maybe want to skip it in the unlikely case that
(w <= 1024), since that already has the smallest possible valid stride
at 128.

Cheers,
Daniel
diff mbox

Patch

diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
index 95de6963226d..2e6efe95ffca 100644
--- a/tests/kms_ccs.c
+++ b/tests/kms_ccs.c
@@ -36,15 +36,18 @@  enum test_flags {
 	TEST_NO_AUX_BUFFER		= 1 << 5,
 	TEST_BAD_CCS_OFFSET		= 1 << 6,
 	TEST_BAD_CCS_HANDLE		= 1 << 7,
+	TEST_BAD_AUX_STRIDE		= 1 << 8,
 };
 
 #define TEST_FAIL_ON_ADDFB2 \
 	(TEST_BAD_PIXEL_FORMAT | TEST_NO_AUX_BUFFER | TEST_BAD_CCS_OFFSET | \
-	 TEST_BAD_CCS_HANDLE)
+	 TEST_BAD_CCS_HANDLE | TEST_BAD_AUX_STRIDE)
 
 enum test_fb_flags {
 	FB_COMPRESSED			= 1 << 0,
 	FB_HAS_PLANE			= 1 << 1,
+	FB_MISALIGN_AUX_STRIDE		= 1 << 2,
+	FB_SMALL_AUX_STRIDE		= 1 << 3,
 };
 
 typedef struct {
@@ -323,7 +326,14 @@  static void generate_fb(data_t *data, struct igt_fb *fb,
 		 */
 		int ccs_width = ALIGN(width * 4, 32) / 32;
 		int ccs_height = ALIGN(height, 16) / 16;
-		f.pitches[1] = ALIGN(ccs_width * 1, 128);
+		int aux_stride = ALIGN(ccs_width * 1, 128);
+
+		if (fb_flags & FB_MISALIGN_AUX_STRIDE)
+			aux_stride = ccs_width;
+		else if (fb_flags & FB_SMALL_AUX_STRIDE)
+			aux_stride = ALIGN(ccs_width/2, 128);
+
+		f.pitches[1] = aux_stride;
 		f.modifier[1] = modifier;
 
 		if (data->flags & TEST_BAD_CCS_OFFSET) {
@@ -478,6 +488,11 @@  static void test_output(data_t *data)
 		try_config(data, fb_flags | FB_COMPRESSED);
 	}
 
+	if (data->flags & TEST_BAD_AUX_STRIDE) {
+		try_config(data, fb_flags | FB_COMPRESSED | FB_MISALIGN_AUX_STRIDE);
+		try_config(data, fb_flags | FB_COMPRESSED | FB_SMALL_AUX_STRIDE);
+	}
+
 	primary = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
 	igt_plane_set_fb(primary, NULL);
 	igt_plane_set_rotation(primary, IGT_ROTATION_0);
@@ -556,6 +571,9 @@  igt_main
 		igt_subtest_f("pipe-%s-ccs-on-another-bo", pipe_name)
 			test_output(&data);
 
+		data.flags = TEST_BAD_AUX_STRIDE;
+		igt_subtest_f("pipe-%s-bad-aux-stride", pipe_name)
+			test_output(&data);
 	}
 
 	igt_fixture