All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 1/8] tests/kms_ccs: Convert int/bool to enum
@ 2017-08-08 16:16 Daniel Stone
  2017-08-08 16:16 ` [PATCH i-g-t 2/8] tests/kms_ccs: Split FB generation into helper Daniel Stone
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Daniel Stone @ 2017-08-08 16:16 UTC (permalink / raw)
  To: intel-gfx; +Cc: daniel.vetter

Rather than using TEST_UNCOMPRESSED / TEST_COMPRESSED as alternately
either an int or a bool, change it to a bitfield enum.

This will let us add more parameters later to control framebuffer
generation.

Signed-off-by: Daniel Stone <daniels@collabora.com>
---
 tests/kms_ccs.c | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
index ef952f2b..14d23ac1 100644
--- a/tests/kms_ccs.c
+++ b/tests/kms_ccs.c
@@ -35,6 +35,10 @@ enum test_flags {
 	TEST_BAD_ROTATION_90		= 1 << 4,
 };
 
+enum test_fb_flags {
+	FB_COMPRESSED			= 1 << 0,
+};
+
 typedef struct {
 	int drm_fd;
 	igt_display_t display;
@@ -53,7 +57,7 @@ typedef struct {
 
 #define RED			0x00ff0000
 
-static void render_fb(data_t *data, bool compressed,
+static void render_fb(data_t *data, enum test_fb_flags fb_flags,
 		      int height, unsigned int stride)
 {
 	struct igt_fb *fb = &data->fb;
@@ -67,7 +71,7 @@ static void render_fb(data_t *data, bool compressed,
 			    0, fb->size,
 			    PROT_READ | PROT_WRITE);
 
-	if (compressed) {
+	if (fb_flags & FB_COMPRESSED) {
 		/* In the compressed case, we want the top half of the
 		 * surface to be uncompressed and the bottom half to be
 		 * compressed.
@@ -128,7 +132,7 @@ static void render_ccs(data_t *data, uint32_t gem_handle,
 	munmap(ptr, size);
 }
 
-static void display_fb(data_t *data, int compressed)
+static void display_fb(data_t *data, enum test_fb_flags fb_flags)
 {
 	struct local_drm_mode_fb_cmd2 f = {};
 	struct igt_fb *fb = &data->fb;
@@ -146,7 +150,7 @@ static void display_fb(data_t *data, int compressed)
 
 	mode = igt_output_get_mode(data->output);
 
-	if (compressed)
+	if (fb_flags & FB_COMPRESSED)
 		modifier = LOCAL_I915_FORMAT_MOD_Y_TILED_CCS;
 	else
 		modifier = LOCAL_I915_FORMAT_MOD_Y_TILED;
@@ -167,7 +171,7 @@ static void display_fb(data_t *data, int compressed)
 	f.offsets[0] = 0;
 	size[0] = f.pitches[0] * ALIGN(height, 32);
 
-	if (compressed) {
+	if (fb_flags & FB_COMPRESSED) {
 		/* From the Sky Lake PRM, Vol 12, "Color Control Surface":
 		 *
 		 *    "The compression state of the cache-line pair is
@@ -215,9 +219,9 @@ static void display_fb(data_t *data, int compressed)
 	fb->cairo_surface = NULL;
 	fb->domain = 0;
 
-	render_fb(data, compressed, f.height, f.pitches[0]);
+	render_fb(data, fb_flags, f.height, f.pitches[0]);
 
-	if (compressed)
+	if (fb_flags & FB_COMPRESSED)
 		render_ccs(data, f.handles[0], f.offsets[1], size[1],
 			   f.height, f.pitches[1]);
 
@@ -238,25 +242,24 @@ static void display_fb(data_t *data, int compressed)
 	igt_debug_wait_for_keypress("ccs");
 }
 
-#define TEST_UNCOMPRESSED 0
-#define TEST_COMPRESSED 1
-
 static void test_output(data_t *data)
 {
 	igt_display_t *display = &data->display;
 	igt_plane_t *primary;
 	igt_crc_t crc, ref_crc;
 	igt_pipe_crc_t *pipe_crc;
+	enum test_fb_flags fb_flags = 0;
 
 	igt_output_set_pipe(data->output, data->pipe);
 
 	if (data->flags & TEST_CRC) {
+
 		pipe_crc = igt_pipe_crc_new(data->drm_fd, data->pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
 
-		display_fb(data, TEST_COMPRESSED);
+		display_fb(data, fb_flags | FB_COMPRESSED);
 		igt_pipe_crc_collect_crc(pipe_crc, &ref_crc);
 
-		display_fb(data, TEST_UNCOMPRESSED);
+		display_fb(data, fb_flags);
 		igt_pipe_crc_collect_crc(pipe_crc, &crc);
 
 		igt_assert_crc_equal(&crc, &ref_crc);
@@ -267,7 +270,7 @@ static void test_output(data_t *data)
 
 	if (data->flags & TEST_BAD_PIXEL_FORMAT ||
 	    data->flags & TEST_BAD_ROTATION_90) {
-		display_fb(data, TEST_COMPRESSED);
+		display_fb(data, fb_flags | FB_COMPRESSED);
 	}
 
 	primary = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
-- 
2.13.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH i-g-t 2/8] tests/kms_ccs: Split FB generation into helper
  2017-08-08 16:16 [PATCH i-g-t 1/8] tests/kms_ccs: Convert int/bool to enum Daniel Stone
@ 2017-08-08 16:16 ` Daniel Stone
  2017-08-08 16:16 ` [PATCH i-g-t 3/8] tests/kms_ccs: Remove excessive FB alignment Daniel Stone
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Daniel Stone @ 2017-08-08 16:16 UTC (permalink / raw)
  To: intel-gfx; +Cc: daniel.vetter

Create a new helper for generating and rendering the framebuffer, rather
than doing it inline with applying the configuration. This will be used
later to generate a different plane configuration.

Signed-off-by: Daniel Stone <daniels@collabora.com>
---
 tests/kms_ccs.c | 73 ++++++++++++++++++++++++++++++---------------------------
 1 file changed, 39 insertions(+), 34 deletions(-)

diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
index 14d23ac1..cdc56f79 100644
--- a/tests/kms_ccs.c
+++ b/tests/kms_ccs.c
@@ -57,18 +57,15 @@ typedef struct {
 
 #define RED			0x00ff0000
 
-static void render_fb(data_t *data, enum test_fb_flags fb_flags,
+static void render_fb(data_t *data, uint32_t gem_handle, unsigned int size,
+		      enum test_fb_flags fb_flags,
 		      int height, unsigned int stride)
 {
-	struct igt_fb *fb = &data->fb;
 	uint32_t *ptr;
 	unsigned int half_height, half_size;
 	int i;
 
-	igt_assert(fb->fb_id);
-
-	ptr = gem_mmap__cpu(data->drm_fd, fb->gem_handle,
-			    0, fb->size,
+	ptr = gem_mmap__cpu(data->drm_fd, gem_handle, 0, size,
 			    PROT_READ | PROT_WRITE);
 
 	if (fb_flags & FB_COMPRESSED) {
@@ -84,18 +81,18 @@ static void render_fb(data_t *data, enum test_fb_flags fb_flags,
 		 */
 		half_height = ALIGN(height, 128) / 2;
 		half_size = half_height * stride;
-		for (i = 0; i < fb->size / 4; i++) {
+		for (i = 0; i < size / 4; i++) {
 			if (i < half_size / 4)
 				ptr[i] = RED;
 			else
 				ptr[i] = COMPRESSED_RED;
 		}
 	} else {
-		for (i = 0; i < fb->size / 4; i++)
+		for (i = 0; i < size / 4; i++)
 			ptr[i] = RED;
 	}
 
-	munmap(ptr, fb->size);
+	munmap(ptr, size);
 }
 
 static unsigned int
@@ -118,8 +115,7 @@ static void render_ccs(data_t *data, uint32_t gem_handle,
 	half_height = ALIGN(height, 128) / 2;
 	ccs_half_height = half_height / 16;
 
-	ptr = gem_mmap__cpu(data->drm_fd, gem_handle,
-			    offset, size,
+	ptr = gem_mmap__cpu(data->drm_fd, gem_handle, offset, size,
 			    PROT_READ | PROT_WRITE);
 
 	for (i = 0; i < size; i++) {
@@ -132,32 +128,23 @@ static void render_ccs(data_t *data, uint32_t gem_handle,
 	munmap(ptr, size);
 }
 
-static void display_fb(data_t *data, enum test_fb_flags fb_flags)
+static void generate_fb(data_t *data, struct igt_fb *fb,
+			int width, int height,
+			enum test_fb_flags fb_flags)
 {
 	struct local_drm_mode_fb_cmd2 f = {};
-	struct igt_fb *fb = &data->fb;
-	igt_display_t *display = &data->display;
-	igt_plane_t *primary;
-	drmModeModeInfo *mode;
-	unsigned int width, height;
 	unsigned int size[2];
 	uint64_t modifier;
-	enum igt_commit_style commit = COMMIT_UNIVERSAL;
 	int ret;
 
-	if (data->display.is_atomic)
-		commit = COMMIT_ATOMIC;
-
-	mode = igt_output_get_mode(data->output);
-
 	if (fb_flags & FB_COMPRESSED)
 		modifier = LOCAL_I915_FORMAT_MOD_Y_TILED_CCS;
 	else
 		modifier = LOCAL_I915_FORMAT_MOD_Y_TILED;
 
 	f.flags = LOCAL_DRM_MODE_FB_MODIFIERS;
-	f.width = ALIGN(mode->hdisplay, 16);
-	f.height = ALIGN(mode->vdisplay, 8);
+	f.width = ALIGN(width, 16);
+	f.height = ALIGN(height, 8);
 
 	if (data->flags & TEST_BAD_PIXEL_FORMAT)
 		f.pixel_format = DRM_FORMAT_RGB565;
@@ -195,9 +182,13 @@ static void display_fb(data_t *data, enum test_fb_flags fb_flags)
 
 		f.handles[0] = gem_create(data->drm_fd, size[0] + size[1]);
 		f.handles[1] = f.handles[0];
+		render_ccs(data, f.handles[1], f.offsets[1], size[1],
+			   height, f.pitches[1]);
 	} else
 		f.handles[0] = gem_create(data->drm_fd, size[0]);
 
+	render_fb(data, f.handles[0], size[0], fb_flags, height, f.pitches[0]);
+
 	ret = drmIoctl(data->drm_fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f);
 	if (data->flags & TEST_BAD_PIXEL_FORMAT) {
 		igt_assert_eq(ret, -1);
@@ -218,15 +209,30 @@ static void display_fb(data_t *data, enum test_fb_flags fb_flags)
 	fb->size = size[0];
 	fb->cairo_surface = NULL;
 	fb->domain = 0;
+}
+
+static void try_config(data_t *data, enum test_fb_flags fb_flags)
+{
+	igt_display_t *display = &data->display;
+	igt_plane_t *primary;
+	drmModeModeInfo *drm_mode = igt_output_get_mode(data->output);
+	enum igt_commit_style commit;
+	int ret;
 
-	render_fb(data, fb_flags, f.height, f.pitches[0]);
+	if (data->display.is_atomic)
+		commit = COMMIT_ATOMIC;
+	else
+		commit = COMMIT_UNIVERSAL;
 
-	if (fb_flags & FB_COMPRESSED)
-		render_ccs(data, f.handles[0], f.offsets[1], size[1],
-			   f.height, f.pitches[1]);
+	generate_fb(data, &data->fb, drm_mode->hdisplay, drm_mode->vdisplay,
+		    fb_flags);
+	if (data->flags & TEST_BAD_PIXEL_FORMAT)
+		return;
 
 	primary = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
-	igt_plane_set_fb(primary, fb);
+	igt_plane_set_position(primary, 0, 0);
+	igt_plane_set_size(primary, drm_mode->hdisplay, drm_mode->vdisplay);
+	igt_plane_set_fb(primary, &data->fb);
 
 	if (data->flags & TEST_ROTATE_180)
 		igt_plane_set_rotation(primary, IGT_ROTATION_180);
@@ -253,13 +259,12 @@ static void test_output(data_t *data)
 	igt_output_set_pipe(data->output, data->pipe);
 
 	if (data->flags & TEST_CRC) {
-
 		pipe_crc = igt_pipe_crc_new(data->drm_fd, data->pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
 
-		display_fb(data, fb_flags | FB_COMPRESSED);
+		try_config(data, fb_flags | FB_COMPRESSED);
 		igt_pipe_crc_collect_crc(pipe_crc, &ref_crc);
 
-		display_fb(data, fb_flags);
+		try_config(data, fb_flags);
 		igt_pipe_crc_collect_crc(pipe_crc, &crc);
 
 		igt_assert_crc_equal(&crc, &ref_crc);
@@ -270,7 +275,7 @@ static void test_output(data_t *data)
 
 	if (data->flags & TEST_BAD_PIXEL_FORMAT ||
 	    data->flags & TEST_BAD_ROTATION_90) {
-		display_fb(data, fb_flags | FB_COMPRESSED);
+		try_config(data, fb_flags | FB_COMPRESSED);
 	}
 
 	primary = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
-- 
2.13.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH i-g-t 3/8] tests/kms_ccs: Remove excessive FB alignment
  2017-08-08 16:16 [PATCH i-g-t 1/8] tests/kms_ccs: Convert int/bool to enum Daniel Stone
  2017-08-08 16:16 ` [PATCH i-g-t 2/8] tests/kms_ccs: Split FB generation into helper Daniel Stone
@ 2017-08-08 16:16 ` Daniel Stone
  2017-08-08 16:16 ` [PATCH i-g-t 4/8] tests/kms_ccs: Paramaterize color for framebuffer Daniel Stone
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Daniel Stone @ 2017-08-08 16:16 UTC (permalink / raw)
  To: intel-gfx; +Cc: daniel.vetter

We don't need to align the framebuffer dimensions to the tile size. As
long as the pitch is aligned to the tile width, and the BO dimensions
can fit full tiles of both aligned pitch and aligned height, we don't
need to claim the FB itself is larger.

Signed-off-by: Daniel Stone <daniels@collabora.com>
---
 tests/kms_ccs.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
index cdc56f79..c02a0433 100644
--- a/tests/kms_ccs.c
+++ b/tests/kms_ccs.c
@@ -143,16 +143,14 @@ static void generate_fb(data_t *data, struct igt_fb *fb,
 		modifier = LOCAL_I915_FORMAT_MOD_Y_TILED;
 
 	f.flags = LOCAL_DRM_MODE_FB_MODIFIERS;
-	f.width = ALIGN(width, 16);
-	f.height = ALIGN(height, 8);
+	f.width = width;
+	f.height = height;
 
 	if (data->flags & TEST_BAD_PIXEL_FORMAT)
 		f.pixel_format = DRM_FORMAT_RGB565;
 	else
 		f.pixel_format = DRM_FORMAT_XRGB8888;
 
-	width = f.width;
-	height = f.height;
 	f.pitches[0] = ALIGN(width * 4, 128);
 	f.modifier[0] = modifier;
 	f.offsets[0] = 0;
@@ -173,12 +171,12 @@ static void generate_fb(data_t *data, struct igt_fb *fb,
 		 * 32x16.  Since the main surface has a 32-bit format, we
 		 * need to multiply width by 4 to get bytes.
 		 */
-		width = ALIGN(f.width * 4, 32) / 32;
-		height = ALIGN(f.height, 16) / 16;
-		f.pitches[1] = ALIGN(width * 1, 128);
+		int ccs_width = ALIGN(width * 4, 32) / 32;
+		int ccs_height = ALIGN(height, 16) / 16;
+		f.pitches[1] = ALIGN(ccs_width * 1, 128);
 		f.modifier[1] = modifier;
 		f.offsets[1] = size[0];
-		size[1] = f.pitches[1] * ALIGN(height, 32);
+		size[1] = f.pitches[1] * ALIGN(ccs_height, 32);
 
 		f.handles[0] = gem_create(data->drm_fd, size[0] + size[1]);
 		f.handles[1] = f.handles[0];
-- 
2.13.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH i-g-t 4/8] tests/kms_ccs: Paramaterize color for framebuffer
  2017-08-08 16:16 [PATCH i-g-t 1/8] tests/kms_ccs: Convert int/bool to enum Daniel Stone
  2017-08-08 16:16 ` [PATCH i-g-t 2/8] tests/kms_ccs: Split FB generation into helper Daniel Stone
  2017-08-08 16:16 ` [PATCH i-g-t 3/8] tests/kms_ccs: Remove excessive FB alignment Daniel Stone
@ 2017-08-08 16:16 ` Daniel Stone
  2017-08-08 16:16 ` [PATCH i-g-t 5/8] tests/kms_ccs: Reshuffle test name and loop Daniel Stone
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Daniel Stone @ 2017-08-08 16:16 UTC (permalink / raw)
  To: intel-gfx; +Cc: daniel.vetter

Will be used in later patches.

Signed-off-by: Daniel Stone <daniels@collabora.com>
---
 tests/kms_ccs.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
index c02a0433..50bb2ad6 100644
--- a/tests/kms_ccs.c
+++ b/tests/kms_ccs.c
@@ -48,14 +48,12 @@ typedef struct {
 	enum test_flags flags;
 } data_t;
 
+#define RED			0x00ff0000
 #define COMPRESSED_RED		0x0ff0000f
-#define COMPRESSED_GREEN	0x000ff00f
-#define COMPRESSED_BLUE		0x00000fff
 
 #define CCS_UNCOMPRESSED	0x0
 #define CCS_COMPRESSED		0x55
 
-#define RED			0x00ff0000
 
 static void render_fb(data_t *data, uint32_t gem_handle, unsigned int size,
 		      enum test_fb_flags fb_flags,
@@ -63,6 +61,8 @@ static void render_fb(data_t *data, uint32_t gem_handle, unsigned int size,
 {
 	uint32_t *ptr;
 	unsigned int half_height, half_size;
+	uint32_t uncompressed_color = RED;
+	uint32_t compressed_color = COMPRESSED_RED;
 	int i;
 
 	ptr = gem_mmap__cpu(data->drm_fd, gem_handle, 0, size,
@@ -83,13 +83,13 @@ static void render_fb(data_t *data, uint32_t gem_handle, unsigned int size,
 		half_size = half_height * stride;
 		for (i = 0; i < size / 4; i++) {
 			if (i < half_size / 4)
-				ptr[i] = RED;
+				ptr[i] = uncompressed_color;
 			else
-				ptr[i] = COMPRESSED_RED;
+				ptr[i] = compressed_color;
 		}
 	} else {
 		for (i = 0; i < size / 4; i++)
-			ptr[i] = RED;
+			ptr[i] = uncompressed_color;
 	}
 
 	munmap(ptr, size);
-- 
2.13.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH i-g-t 5/8] tests/kms_ccs: Reshuffle test name and loop
  2017-08-08 16:16 [PATCH i-g-t 1/8] tests/kms_ccs: Convert int/bool to enum Daniel Stone
                   ` (2 preceding siblings ...)
  2017-08-08 16:16 ` [PATCH i-g-t 4/8] tests/kms_ccs: Paramaterize color for framebuffer Daniel Stone
@ 2017-08-08 16:16 ` Daniel Stone
  2017-08-08 16:16 ` [PATCH i-g-t 6/8] tests/kms_ccs: Test for supported modifier Daniel Stone
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Daniel Stone @ 2017-08-08 16:16 UTC (permalink / raw)
  To: intel-gfx; +Cc: daniel.vetter

In preparation for also testing sprites.

Signed-off-by: Daniel Stone <daniels@collabora.com>
---
 tests/kms_ccs.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
index 50bb2ad6..1a5cdcd4 100644
--- a/tests/kms_ccs.c
+++ b/tests/kms_ccs.c
@@ -342,13 +342,13 @@ igt_main
 
 	for (data.pipe = PIPE_A; data.pipe < IGT_MAX_PIPES; data.pipe++) {
 		data.flags = TEST_CRC;
-		igt_subtest_f("pipe-%s-crc-basic", kmstest_pipe_name(data.pipe))
+		igt_subtest_f("pipe-%s-crc-primary-basic",
+			      kmstest_pipe_name(data.pipe))
 			test(&data);
-	}
 
-	for (data.pipe = PIPE_A; data.pipe < IGT_MAX_PIPES; data.pipe++) {
-		data.flags = TEST_CRC | TEST_ROTATE_180;
-		igt_subtest_f("pipe-%s-crc-rotation-180", kmstest_pipe_name(data.pipe))
+		data.flags |= TEST_ROTATE_180;
+		igt_subtest_f("pipe-%s-crc-primary-rotation-180",
+			      kmstest_pipe_name(data.pipe))
 			test(&data);
 	}
 
-- 
2.13.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH i-g-t 6/8] tests/kms_ccs: Test for supported modifier
  2017-08-08 16:16 [PATCH i-g-t 1/8] tests/kms_ccs: Convert int/bool to enum Daniel Stone
                   ` (3 preceding siblings ...)
  2017-08-08 16:16 ` [PATCH i-g-t 5/8] tests/kms_ccs: Reshuffle test name and loop Daniel Stone
@ 2017-08-08 16:16 ` Daniel Stone
  2017-08-10  4:48   ` Jason Ekstrand
  2017-08-08 16:16 ` [PATCH i-g-t 7/8] tests/kms_ccs: Split all tests into subtests Daniel Stone
  2017-08-08 16:16 ` [PATCH i-g-t 8/8] tests/kms_ccs: Test CCS on sprite planes Daniel Stone
  6 siblings, 1 reply; 10+ messages in thread
From: Daniel Stone @ 2017-08-08 16:16 UTC (permalink / raw)
  To: intel-gfx; +Cc: daniel.vetter

Make sure the CCS modifier is supported on our plane, before we try to
use it on that plane.

Signed-off-by: Daniel Stone <daniels@collabora.com>
---
 tests/kms_ccs.c | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 116 insertions(+), 1 deletion(-)

diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
index 1a5cdcd4..e74a68af 100644
--- a/tests/kms_ccs.c
+++ b/tests/kms_ccs.c
@@ -54,6 +54,118 @@ typedef struct {
 #define CCS_UNCOMPRESSED	0x0
 #define CCS_COMPRESSED		0x55
 
+struct local_drm_format_modifier {
+       /* Bitmask of formats in get_plane format list this info applies to. The
+	* offset allows a sliding window of which 64 formats (bits).
+	*
+	* Some examples:
+	* In today's world with < 65 formats, and formats 0, and 2 are
+	* supported
+	* 0x0000000000000005
+	*		  ^-offset = 0, formats = 5
+	*
+	* If the number formats grew to 128, and formats 98-102 are
+	* supported with the modifier:
+	*
+	* 0x0000003c00000000 0000000000000000
+	*		  ^
+	*		  |__offset = 64, formats = 0x3c00000000
+	*
+	*/
+       uint64_t formats;
+       uint32_t offset;
+       uint32_t pad;
+
+       /* This modifier can be used with the format for this plane. */
+       uint64_t modifier;
+};
+
+struct local_drm_format_modifier_blob {
+#define LOCAL_FORMAT_BLOB_CURRENT 1
+	/* Version of this blob format */
+	uint32_t version;
+
+	/* Flags */
+	uint32_t flags;
+
+	/* Number of fourcc formats supported */
+	uint32_t count_formats;
+
+	/* Where in this blob the formats exist (in bytes) */
+	uint32_t formats_offset;
+
+	/* Number of drm_format_modifiers */
+	uint32_t count_modifiers;
+
+	/* Where in this blob the modifiers exist (in bytes) */
+	uint32_t modifiers_offset;
+
+	/* u32 formats[] */
+	/* struct drm_format_modifier modifiers[] */
+};
+
+static inline uint32_t *
+formats_ptr(struct local_drm_format_modifier_blob *blob)
+{
+	return (uint32_t *)(((char *)blob) + blob->formats_offset);
+}
+
+static inline struct local_drm_format_modifier *
+modifiers_ptr(struct local_drm_format_modifier_blob *blob)
+{
+	return (struct local_drm_format_modifier *)(((char *)blob) + blob->modifiers_offset);
+}
+
+static void plane_require_ccs(data_t *data, igt_plane_t *plane, uint32_t format)
+{
+	drmModePropertyBlobPtr blob;
+	struct local_drm_format_modifier_blob *blob_data;
+	struct local_drm_format_modifier *modifiers;
+	uint32_t *formats;
+	uint64_t blob_id;
+	bool ret;
+	int fmt_idx = -1;
+
+	ret = kmstest_get_property(data->drm_fd, plane->drm_plane->plane_id,
+				   DRM_MODE_OBJECT_PLANE, "IN_FORMATS",
+				   NULL, &blob_id, NULL);
+	igt_skip_on_f(ret == false, "IN_FORMATS not supported by kernel\n");
+	igt_skip_on_f(blob_id == 0, "IN_FORMATS not supported by plane\n");
+	blob = drmModeGetPropertyBlob(data->drm_fd, blob_id);
+	igt_assert(blob);
+	igt_assert_lte(sizeof(struct local_drm_format_modifier_blob),
+		       blob->length);
+
+	blob_data = (struct local_drm_format_modifier_blob *) blob->data;
+	formats = formats_ptr(blob_data);
+	for (int i = 0; i < blob_data->count_formats; i++) {
+		if (formats[i] == format) {
+			fmt_idx = i;
+			break;
+		}
+	}
+
+	igt_skip_on_f(fmt_idx == -1,
+		      "Format 0x%x not supported by plane\n", format);
+
+	modifiers = modifiers_ptr(blob_data);
+	for (int i = 0; i < blob_data->count_modifiers; i++) {
+		if (modifiers[i].modifier != LOCAL_I915_FORMAT_MOD_Y_TILED_CCS)
+			continue;
+
+		if (modifiers[i].offset > fmt_idx ||
+		    fmt_idx > modifiers[i].offset + 63)
+			continue;
+
+		if (modifiers[i].formats &
+		    (1UL << (fmt_idx - modifiers[i].offset)))
+			return;
+
+		igt_skip("i915 CCS modifier not supported for format\n");
+	}
+
+	igt_skip("i915 CCS modifier not supported by kernel for plane\n");
+}
 
 static void render_fb(data_t *data, uint32_t gem_handle, unsigned int size,
 		      enum test_fb_flags fb_flags,
@@ -222,12 +334,15 @@ static void try_config(data_t *data, enum test_fb_flags fb_flags)
 	else
 		commit = COMMIT_UNIVERSAL;
 
+	primary = igt_output_get_plane_type(data->output,
+					    DRM_PLANE_TYPE_PRIMARY);
+	plane_require_ccs(data, primary, DRM_FORMAT_XRGB8888);
+
 	generate_fb(data, &data->fb, drm_mode->hdisplay, drm_mode->vdisplay,
 		    fb_flags);
 	if (data->flags & TEST_BAD_PIXEL_FORMAT)
 		return;
 
-	primary = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
 	igt_plane_set_position(primary, 0, 0);
 	igt_plane_set_size(primary, drm_mode->hdisplay, drm_mode->vdisplay);
 	igt_plane_set_fb(primary, &data->fb);
-- 
2.13.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH i-g-t 7/8] tests/kms_ccs: Split all tests into subtests
  2017-08-08 16:16 [PATCH i-g-t 1/8] tests/kms_ccs: Convert int/bool to enum Daniel Stone
                   ` (4 preceding siblings ...)
  2017-08-08 16:16 ` [PATCH i-g-t 6/8] tests/kms_ccs: Test for supported modifier Daniel Stone
@ 2017-08-08 16:16 ` Daniel Stone
  2017-08-08 16:16 ` [PATCH i-g-t 8/8] tests/kms_ccs: Test CCS on sprite planes Daniel Stone
  6 siblings, 0 replies; 10+ messages in thread
From: Daniel Stone @ 2017-08-08 16:16 UTC (permalink / raw)
  To: intel-gfx; +Cc: daniel.vetter

Some subtests were magically doing a for-each-pipe loop. Remove that,
and have all multi-pipe tests actually work across all pipes.

Signed-off-by: Daniel Stone <daniels@collabora.com>
---
 tests/kms_ccs.c | 62 +++++++++++++++++++--------------------------------------
 1 file changed, 20 insertions(+), 42 deletions(-)

diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
index e74a68af..79856f97 100644
--- a/tests/kms_ccs.c
+++ b/tests/kms_ccs.c
@@ -369,6 +369,13 @@ static void test_output(data_t *data)
 	igt_pipe_crc_t *pipe_crc;
 	enum test_fb_flags fb_flags = 0;
 
+	igt_display_require_output_on_pipe(display, data->pipe);
+
+	/* Sets data->output with a valid output. */
+	for_each_valid_output_on_pipe(display, data->pipe, data->output) {
+		break;
+	}
+
 	igt_output_set_pipe(data->output, data->pipe);
 
 	if (data->flags & TEST_CRC) {
@@ -404,31 +411,6 @@ static void test_output(data_t *data)
 		igt_remove_fb(data->drm_fd, &data->fb);
 }
 
-static void test(data_t *data)
-{
-	igt_display_t *display = &data->display;
-	int valid_tests = 0;
-	enum pipe wanted_pipe = data->pipe;
-
-	igt_skip_on(wanted_pipe >= display->n_pipes);
-
-	for_each_pipe_with_valid_output(display, data->pipe, data->output) {
-		if (wanted_pipe != PIPE_NONE && data->pipe != wanted_pipe)
-			continue;
-
-		test_output(data);
-
-		valid_tests++;
-
-		igt_info("\n%s on pipe %s, connector %s: PASSED\n\n",
-			 igt_subtest_name(),
-			 kmstest_pipe_name(data->pipe),
-			 igt_output_name(data->output));
-	}
-
-	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
-}
-
 static data_t data;
 
 igt_main
@@ -443,28 +425,24 @@ igt_main
 		igt_display_init(&data.display, data.drm_fd);
 	}
 
-	igt_subtest_f("bad-pixel-format") {
+	for_each_pipe(&data.display, data.pipe) {
+		const char *pipe_name = kmstest_pipe_name(data.pipe);
+
 		data.flags = TEST_BAD_PIXEL_FORMAT;
-		data.pipe = PIPE_NONE;
-		test(&data);
-	}
+		igt_subtest_f("pipe-%s-bad-pixel-format", pipe_name)
+			test_output(&data);
 
-	igt_subtest_f("bad-rotation-90") {
 		data.flags = TEST_BAD_ROTATION_90;
-		data.pipe = PIPE_NONE;
-		test(&data);
-	}
+		igt_subtest_f("pipe-%s-bad-rotation-90", pipe_name)
+			test_output(&data);
 
-	for (data.pipe = PIPE_A; data.pipe < IGT_MAX_PIPES; data.pipe++) {
 		data.flags = TEST_CRC;
-		igt_subtest_f("pipe-%s-crc-primary-basic",
-			      kmstest_pipe_name(data.pipe))
-			test(&data);
-
-		data.flags |= TEST_ROTATE_180;
-		igt_subtest_f("pipe-%s-crc-primary-rotation-180",
-			      kmstest_pipe_name(data.pipe))
-			test(&data);
+		igt_subtest_f("pipe-%s-crc-primary-basic", pipe_name)
+			test_output(&data);
+
+		data.flags = TEST_CRC | TEST_ROTATE_180;
+		igt_subtest_f("pipe-%s-crc-primary-rotation-180", pipe_name)
+			test_output(&data);
 	}
 
 	igt_fixture
-- 
2.13.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH i-g-t 8/8] tests/kms_ccs: Test CCS on sprite planes
  2017-08-08 16:16 [PATCH i-g-t 1/8] tests/kms_ccs: Convert int/bool to enum Daniel Stone
                   ` (5 preceding siblings ...)
  2017-08-08 16:16 ` [PATCH i-g-t 7/8] tests/kms_ccs: Split all tests into subtests Daniel Stone
@ 2017-08-08 16:16 ` Daniel Stone
  2017-08-10  5:20   ` Jason Ekstrand
  6 siblings, 1 reply; 10+ messages in thread
From: Daniel Stone @ 2017-08-08 16:16 UTC (permalink / raw)
  To: intel-gfx; +Cc: daniel.vetter

Also try to test CCS on available non-primary planes. However, as there
is not enough bandwidth to scan out both the primary and sprite planes
when using CCS (or even Y-tiled), fall back to linear for the primary
plane when using CCS for a sprite/cursor plane.

Signed-off-by: Daniel Stone <daniels@collabora.com>
---
 tests/kms_ccs.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 67 insertions(+), 7 deletions(-)

diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
index 79856f97..c544b36f 100644
--- a/tests/kms_ccs.c
+++ b/tests/kms_ccs.c
@@ -37,19 +37,24 @@ enum test_flags {
 
 enum test_fb_flags {
 	FB_COMPRESSED			= 1 << 0,
+	FB_HAS_PLANE			= 1 << 1,
 };
 
 typedef struct {
 	int drm_fd;
 	igt_display_t display;
 	struct igt_fb fb;
+	struct igt_fb fb_sprite;
 	igt_output_t *output;
 	enum pipe pipe;
 	enum test_flags flags;
+	igt_plane_t *plane;
 } data_t;
 
 #define RED			0x00ff0000
 #define COMPRESSED_RED		0x0ff0000f
+#define GREEN			0x0000ff00
+#define COMPRESSED_GREEN	0x000ff00f
 
 #define CCS_UNCOMPRESSED	0x0
 #define CCS_COMPRESSED		0x55
@@ -173,8 +178,10 @@ static void render_fb(data_t *data, uint32_t gem_handle, unsigned int size,
 {
 	uint32_t *ptr;
 	unsigned int half_height, half_size;
-	uint32_t uncompressed_color = RED;
-	uint32_t compressed_color = COMPRESSED_RED;
+	uint32_t uncompressed_color = data->plane ? GREEN : RED;
+	uint32_t compressed_color =
+		data->plane ? COMPRESSED_GREEN : COMPRESSED_RED;
+	uint32_t bad_color = RED;
 	int i;
 
 	ptr = gem_mmap__cpu(data->drm_fd, gem_handle, 0, size,
@@ -200,8 +207,19 @@ static void render_fb(data_t *data, uint32_t gem_handle, unsigned int size,
 				ptr[i] = compressed_color;
 		}
 	} else {
-		for (i = 0; i < size / 4; i++)
-			ptr[i] = uncompressed_color;
+		/* When we're displaying the primary plane underneath a
+		 * sprite plane, cut out a 128 x 128 area (less than the sprite)
+		 * plane size which we paint red, so we know easily if it's
+		 * bad.
+		 */
+		for (i = 0; i < size / 4; i++) {
+			if ((fb_flags & FB_HAS_PLANE) &&
+			     i < (stride * 128) && (i % (stride / 4)) < 1) {
+				ptr[i] = bad_color;
+			} else {
+				ptr[i] = uncompressed_color;
+			}
+		}
 	}
 
 	munmap(ptr, size);
@@ -249,10 +267,17 @@ static void generate_fb(data_t *data, struct igt_fb *fb,
 	uint64_t modifier;
 	int ret;
 
+	/* Use either compressed or Y-tiled to test. However, given the lack of
+	 * available bandwidth, we use linear for the primary plane when
+	 * testing sprites, since we cannot fit two CCS planes into the
+	 * available FIFO configurations.
+	 */
 	if (fb_flags & FB_COMPRESSED)
 		modifier = LOCAL_I915_FORMAT_MOD_Y_TILED_CCS;
-	else
+	else if (!(fb_flags & FB_HAS_PLANE))
 		modifier = LOCAL_I915_FORMAT_MOD_Y_TILED;
+	else
+		modifier = 0;
 
 	f.flags = LOCAL_DRM_MODE_FB_MODIFIERS;
 	f.width = width;
@@ -338,8 +363,17 @@ static void try_config(data_t *data, enum test_fb_flags fb_flags)
 					    DRM_PLANE_TYPE_PRIMARY);
 	plane_require_ccs(data, primary, DRM_FORMAT_XRGB8888);
 
-	generate_fb(data, &data->fb, drm_mode->hdisplay, drm_mode->vdisplay,
-		    fb_flags);
+	if (data->plane && fb_flags & FB_COMPRESSED) {
+		plane_require_ccs(data, data->plane, DRM_FORMAT_XRGB8888);
+		generate_fb(data, &data->fb, drm_mode->hdisplay,
+			    drm_mode->vdisplay,
+			    (fb_flags & ~FB_COMPRESSED) | FB_HAS_PLANE);
+		generate_fb(data, &data->fb_sprite, 256, 256, fb_flags);
+	} else {
+		generate_fb(data, &data->fb, drm_mode->hdisplay,
+			    drm_mode->vdisplay, fb_flags);
+	}
+
 	if (data->flags & TEST_BAD_PIXEL_FORMAT)
 		return;
 
@@ -347,6 +381,12 @@ static void try_config(data_t *data, enum test_fb_flags fb_flags)
 	igt_plane_set_size(primary, drm_mode->hdisplay, drm_mode->vdisplay);
 	igt_plane_set_fb(primary, &data->fb);
 
+	if (data->plane && fb_flags & FB_COMPRESSED) {
+		igt_plane_set_position(data->plane, 0, 0);
+		igt_plane_set_size(data->plane, 256, 256);
+		igt_plane_set_fb(data->plane, &data->fb_sprite);
+	}
+
 	if (data->flags & TEST_ROTATE_180)
 		igt_plane_set_rotation(primary, IGT_ROTATION_180);
 	if (data->flags & TEST_BAD_ROTATION_90)
@@ -359,6 +399,13 @@ static void try_config(data_t *data, enum test_fb_flags fb_flags)
 		igt_assert_eq(ret, 0);
 
 	igt_debug_wait_for_keypress("ccs");
+
+	if (data->plane && fb_flags & FB_COMPRESSED) {
+		igt_plane_set_position(data->plane, 0, 0);
+		igt_plane_set_size(data->plane, 0, 0);
+		igt_plane_set_fb(data->plane, NULL);
+		igt_remove_fb(display->drm_fd, &data->fb_sprite);
+	}
 }
 
 static void test_output(data_t *data)
@@ -427,6 +474,7 @@ igt_main
 
 	for_each_pipe(&data.display, data.pipe) {
 		const char *pipe_name = kmstest_pipe_name(data.pipe);
+		int sprite_idx = 0;
 
 		data.flags = TEST_BAD_PIXEL_FORMAT;
 		igt_subtest_f("pipe-%s-bad-pixel-format", pipe_name)
@@ -443,6 +491,18 @@ igt_main
 		data.flags = TEST_CRC | TEST_ROTATE_180;
 		igt_subtest_f("pipe-%s-crc-primary-rotation-180", pipe_name)
 			test_output(&data);
+
+		data.flags = TEST_CRC;
+		for_each_plane_on_pipe(&data.display, data.pipe, data.plane) {
+			if (data.plane->type == DRM_PLANE_TYPE_PRIMARY)
+				continue;
+			sprite_idx++;
+			igt_subtest_f("pipe-%s-crc-sprite-%d-basic", pipe_name,
+				      sprite_idx)
+				test_output(&data);
+		}
+
+		data.plane = NULL;
 	}
 
 	igt_fixture
-- 
2.13.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH i-g-t 6/8] tests/kms_ccs: Test for supported modifier
  2017-08-08 16:16 ` [PATCH i-g-t 6/8] tests/kms_ccs: Test for supported modifier Daniel Stone
@ 2017-08-10  4:48   ` Jason Ekstrand
  0 siblings, 0 replies; 10+ messages in thread
From: Jason Ekstrand @ 2017-08-10  4:48 UTC (permalink / raw)
  To: Daniel Stone; +Cc: Daniel Vetter, Intel GFX


[-- Attachment #1.1: Type: text/plain, Size: 5861 bytes --]

On Tue, Aug 8, 2017 at 9:16 AM, Daniel Stone <daniels@collabora.com> wrote:

> Make sure the CCS modifier is supported on our plane, before we try to
> use it on that plane.
>
> Signed-off-by: Daniel Stone <daniels@collabora.com>
> ---
>  tests/kms_ccs.c | 117 ++++++++++++++++++++++++++++++
> +++++++++++++++++++++++++-
>  1 file changed, 116 insertions(+), 1 deletion(-)
>
> diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
> index 1a5cdcd4..e74a68af 100644
> --- a/tests/kms_ccs.c
> +++ b/tests/kms_ccs.c
> @@ -54,6 +54,118 @@ typedef struct {
>  #define CCS_UNCOMPRESSED       0x0
>  #define CCS_COMPRESSED         0x55
>
> +struct local_drm_format_modifier {
> +       /* Bitmask of formats in get_plane format list this info applies
> to. The
> +       * offset allows a sliding window of which 64 formats (bits).
> +       *
> +       * Some examples:
> +       * In today's world with < 65 formats, and formats 0, and 2 are
> +       * supported
> +       * 0x0000000000000005
> +       *                 ^-offset = 0, formats = 5
> +       *
> +       * If the number formats grew to 128, and formats 98-102 are
> +       * supported with the modifier:
> +       *
> +       * 0x0000003c00000000 0000000000000000
> +       *                 ^
> +       *                 |__offset = 64, formats = 0x3c00000000
> +       *
> +       */
> +       uint64_t formats;
> +       uint32_t offset;
> +       uint32_t pad;
> +
> +       /* This modifier can be used with the format for this plane. */
> +       uint64_t modifier;
> +};
> +
> +struct local_drm_format_modifier_blob {
> +#define LOCAL_FORMAT_BLOB_CURRENT 1
> +       /* Version of this blob format */
> +       uint32_t version;
> +
> +       /* Flags */
> +       uint32_t flags;
> +
> +       /* Number of fourcc formats supported */
> +       uint32_t count_formats;
> +
> +       /* Where in this blob the formats exist (in bytes) */
> +       uint32_t formats_offset;
> +
> +       /* Number of drm_format_modifiers */
> +       uint32_t count_modifiers;
> +
> +       /* Where in this blob the modifiers exist (in bytes) */
> +       uint32_t modifiers_offset;
> +
> +       /* u32 formats[] */
> +       /* struct drm_format_modifier modifiers[] */
> +};
> +
> +static inline uint32_t *
> +formats_ptr(struct local_drm_format_modifier_blob *blob)
> +{
> +       return (uint32_t *)(((char *)blob) + blob->formats_offset);
> +}
> +
> +static inline struct local_drm_format_modifier *
> +modifiers_ptr(struct local_drm_format_modifier_blob *blob)
> +{
> +       return (struct local_drm_format_modifier *)(((char *)blob) +
> blob->modifiers_offset);
> +}
> +
> +static void plane_require_ccs(data_t *data, igt_plane_t *plane, uint32_t
> format)
> +{
> +       drmModePropertyBlobPtr blob;
> +       struct local_drm_format_modifier_blob *blob_data;
> +       struct local_drm_format_modifier *modifiers;
> +       uint32_t *formats;
> +       uint64_t blob_id;
> +       bool ret;
> +       int fmt_idx = -1;
> +
> +       ret = kmstest_get_property(data->drm_fd,
> plane->drm_plane->plane_id,
> +                                  DRM_MODE_OBJECT_PLANE, "IN_FORMATS",
> +                                  NULL, &blob_id, NULL);
> +       igt_skip_on_f(ret == false, "IN_FORMATS not supported by
> kernel\n");
> +       igt_skip_on_f(blob_id == 0, "IN_FORMATS not supported by plane\n");
> +       blob = drmModeGetPropertyBlob(data->drm_fd, blob_id);
> +       igt_assert(blob);
> +       igt_assert_lte(sizeof(struct local_drm_format_modifier_blob),
> +                      blob->length);
> +
> +       blob_data = (struct local_drm_format_modifier_blob *) blob->data;
> +       formats = formats_ptr(blob_data);
>

might consider an assert:

igt_assert(formats + blob_data->count_formats <= blob->length)


> +       for (int i = 0; i < blob_data->count_formats; i++) {
> +               if (formats[i] == format) {
> +                       fmt_idx = i;
> +                       break;
> +               }
> +       }
> +
> +       igt_skip_on_f(fmt_idx == -1,
> +                     "Format 0x%x not supported by plane\n", format);
> +
> +       modifiers = modifiers_ptr(blob_data);
>

igt_assert(modifiers + blob_data->count_modifiers <= blob->length)


> +       for (int i = 0; i < blob_data->count_modifiers; i++) {
> +               if (modifiers[i].modifier != LOCAL_I915_FORMAT_MOD_Y_TILED_
> CCS)
> +                       continue;
> +
> +               if (modifiers[i].offset > fmt_idx ||
> +                   fmt_idx > modifiers[i].offset + 63)
> +                       continue;
> +
> +               if (modifiers[i].formats &
> +                   (1UL << (fmt_idx - modifiers[i].offset)))
> +                       return;
> +
> +               igt_skip("i915 CCS modifier not supported for format\n");
> +       }
> +
> +       igt_skip("i915 CCS modifier not supported by kernel for plane\n");
> +}
>
>  static void render_fb(data_t *data, uint32_t gem_handle, unsigned int
> size,
>                       enum test_fb_flags fb_flags,
> @@ -222,12 +334,15 @@ static void try_config(data_t *data, enum
> test_fb_flags fb_flags)
>         else
>                 commit = COMMIT_UNIVERSAL;
>
> +       primary = igt_output_get_plane_type(data->output,
> +                                           DRM_PLANE_TYPE_PRIMARY);
> +       plane_require_ccs(data, primary, DRM_FORMAT_XRGB8888);
> +
>         generate_fb(data, &data->fb, drm_mode->hdisplay,
> drm_mode->vdisplay,
>                     fb_flags);
>         if (data->flags & TEST_BAD_PIXEL_FORMAT)
>                 return;
>
> -       primary = igt_output_get_plane_type(data->output,
> DRM_PLANE_TYPE_PRIMARY);
>         igt_plane_set_position(primary, 0, 0);
>         igt_plane_set_size(primary, drm_mode->hdisplay,
> drm_mode->vdisplay);
>         igt_plane_set_fb(primary, &data->fb);
> --
> 2.13.4
>
>

[-- Attachment #1.2: Type: text/html, Size: 7824 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH i-g-t 8/8] tests/kms_ccs: Test CCS on sprite planes
  2017-08-08 16:16 ` [PATCH i-g-t 8/8] tests/kms_ccs: Test CCS on sprite planes Daniel Stone
@ 2017-08-10  5:20   ` Jason Ekstrand
  0 siblings, 0 replies; 10+ messages in thread
From: Jason Ekstrand @ 2017-08-10  5:20 UTC (permalink / raw)
  To: Daniel Stone; +Cc: Daniel Vetter, Intel GFX


[-- Attachment #1.1: Type: text/plain, Size: 7466 bytes --]

On Tue, Aug 8, 2017 at 9:16 AM, Daniel Stone <daniels@collabora.com> wrote:

> Also try to test CCS on available non-primary planes. However, as there
> is not enough bandwidth to scan out both the primary and sprite planes
> when using CCS (or even Y-tiled), fall back to linear for the primary
> plane when using CCS for a sprite/cursor plane.
>
> Signed-off-by: Daniel Stone <daniels@collabora.com>
> ---
>  tests/kms_ccs.c | 74 ++++++++++++++++++++++++++++++
> +++++++++++++++++++++------
>  1 file changed, 67 insertions(+), 7 deletions(-)
>
> diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
> index 79856f97..c544b36f 100644
> --- a/tests/kms_ccs.c
> +++ b/tests/kms_ccs.c
> @@ -37,19 +37,24 @@ enum test_flags {
>
>  enum test_fb_flags {
>         FB_COMPRESSED                   = 1 << 0,
> +       FB_HAS_PLANE                    = 1 << 1,
>  };
>
>  typedef struct {
>         int drm_fd;
>         igt_display_t display;
>         struct igt_fb fb;
> +       struct igt_fb fb_sprite;
>         igt_output_t *output;
>         enum pipe pipe;
>         enum test_flags flags;
> +       igt_plane_t *plane;
>  } data_t;
>
>  #define RED                    0x00ff0000
>  #define COMPRESSED_RED         0x0ff0000f
> +#define GREEN                  0x0000ff00
> +#define COMPRESSED_GREEN       0x000ff00f
>
>  #define CCS_UNCOMPRESSED       0x0
>  #define CCS_COMPRESSED         0x55
> @@ -173,8 +178,10 @@ static void render_fb(data_t *data, uint32_t
> gem_handle, unsigned int size,
>  {
>         uint32_t *ptr;
>         unsigned int half_height, half_size;
> -       uint32_t uncompressed_color = RED;
> -       uint32_t compressed_color = COMPRESSED_RED;
> +       uint32_t uncompressed_color = data->plane ? GREEN : RED;
> +       uint32_t compressed_color =
> +               data->plane ? COMPRESSED_GREEN : COMPRESSED_RED;
> +       uint32_t bad_color = RED;
>         int i;
>
>         ptr = gem_mmap__cpu(data->drm_fd, gem_handle, 0, size,
> @@ -200,8 +207,19 @@ static void render_fb(data_t *data, uint32_t
> gem_handle, unsigned int size,
>                                 ptr[i] = compressed_color;
>                 }
>         } else {
> -               for (i = 0; i < size / 4; i++)
> -                       ptr[i] = uncompressed_color;
> +               /* When we're displaying the primary plane underneath a
> +                * sprite plane, cut out a 128 x 128 area (less than the
> sprite)
> +                * plane size which we paint red, so we know easily if it's
> +                * bad.
> +                */
> +               for (i = 0; i < size / 4; i++) {
> +                       if ((fb_flags & FB_HAS_PLANE) &&
> +                            i < (stride * 128) && (i % (stride / 4)) < 1)
> {
>

I think this should be:

    (i / (stride / 4)) < 128 && (i % (stride / 4)) < 128

Other than that and the other two comments I made on another patch, this
series looks good to me.  Patches 1-5 are

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>

Patches 6-7 are

Acked-by: Jason Ekstrand <jason@jlekstrand.net>

I don't feel 100% confident reviewing them without lots of reading of IGT
docs.


> +                               ptr[i] = bad_color;
> +                       } else {
> +                               ptr[i] = uncompressed_color;
> +                       }
> +               }
>         }
>
>         munmap(ptr, size);
> @@ -249,10 +267,17 @@ static void generate_fb(data_t *data, struct igt_fb
> *fb,
>         uint64_t modifier;
>         int ret;
>
> +       /* Use either compressed or Y-tiled to test. However, given the
> lack of
> +        * available bandwidth, we use linear for the primary plane when
> +        * testing sprites, since we cannot fit two CCS planes into the
> +        * available FIFO configurations.
> +        */
>         if (fb_flags & FB_COMPRESSED)
>                 modifier = LOCAL_I915_FORMAT_MOD_Y_TILED_CCS;
> -       else
> +       else if (!(fb_flags & FB_HAS_PLANE))
>                 modifier = LOCAL_I915_FORMAT_MOD_Y_TILED;
> +       else
> +               modifier = 0;
>
>         f.flags = LOCAL_DRM_MODE_FB_MODIFIERS;
>         f.width = width;
> @@ -338,8 +363,17 @@ static void try_config(data_t *data, enum
> test_fb_flags fb_flags)
>                                             DRM_PLANE_TYPE_PRIMARY);
>         plane_require_ccs(data, primary, DRM_FORMAT_XRGB8888);
>
> -       generate_fb(data, &data->fb, drm_mode->hdisplay,
> drm_mode->vdisplay,
> -                   fb_flags);
> +       if (data->plane && fb_flags & FB_COMPRESSED) {
> +               plane_require_ccs(data, data->plane, DRM_FORMAT_XRGB8888);
> +               generate_fb(data, &data->fb, drm_mode->hdisplay,
> +                           drm_mode->vdisplay,
> +                           (fb_flags & ~FB_COMPRESSED) | FB_HAS_PLANE);
> +               generate_fb(data, &data->fb_sprite, 256, 256, fb_flags);
> +       } else {
> +               generate_fb(data, &data->fb, drm_mode->hdisplay,
> +                           drm_mode->vdisplay, fb_flags);
> +       }
> +
>         if (data->flags & TEST_BAD_PIXEL_FORMAT)
>                 return;
>
> @@ -347,6 +381,12 @@ static void try_config(data_t *data, enum
> test_fb_flags fb_flags)
>         igt_plane_set_size(primary, drm_mode->hdisplay,
> drm_mode->vdisplay);
>         igt_plane_set_fb(primary, &data->fb);
>
> +       if (data->plane && fb_flags & FB_COMPRESSED) {
> +               igt_plane_set_position(data->plane, 0, 0);
> +               igt_plane_set_size(data->plane, 256, 256);
> +               igt_plane_set_fb(data->plane, &data->fb_sprite);
> +       }
> +
>         if (data->flags & TEST_ROTATE_180)
>                 igt_plane_set_rotation(primary, IGT_ROTATION_180);
>         if (data->flags & TEST_BAD_ROTATION_90)
> @@ -359,6 +399,13 @@ static void try_config(data_t *data, enum
> test_fb_flags fb_flags)
>                 igt_assert_eq(ret, 0);
>
>         igt_debug_wait_for_keypress("ccs");
> +
> +       if (data->plane && fb_flags & FB_COMPRESSED) {
> +               igt_plane_set_position(data->plane, 0, 0);
> +               igt_plane_set_size(data->plane, 0, 0);
> +               igt_plane_set_fb(data->plane, NULL);
> +               igt_remove_fb(display->drm_fd, &data->fb_sprite);
> +       }
>  }
>
>  static void test_output(data_t *data)
> @@ -427,6 +474,7 @@ igt_main
>
>         for_each_pipe(&data.display, data.pipe) {
>                 const char *pipe_name = kmstest_pipe_name(data.pipe);
> +               int sprite_idx = 0;
>
>                 data.flags = TEST_BAD_PIXEL_FORMAT;
>                 igt_subtest_f("pipe-%s-bad-pixel-format", pipe_name)
> @@ -443,6 +491,18 @@ igt_main
>                 data.flags = TEST_CRC | TEST_ROTATE_180;
>                 igt_subtest_f("pipe-%s-crc-primary-rotation-180",
> pipe_name)
>                         test_output(&data);
> +
> +               data.flags = TEST_CRC;
> +               for_each_plane_on_pipe(&data.display, data.pipe,
> data.plane) {
> +                       if (data.plane->type == DRM_PLANE_TYPE_PRIMARY)
> +                               continue;
> +                       sprite_idx++;
> +                       igt_subtest_f("pipe-%s-crc-sprite-%d-basic",
> pipe_name,
> +                                     sprite_idx)
> +                               test_output(&data);
> +               }
> +
> +               data.plane = NULL;
>         }
>
>         igt_fixture
> --
> 2.13.4
>
>

[-- Attachment #1.2: Type: text/html, Size: 9939 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-08-10  5:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-08 16:16 [PATCH i-g-t 1/8] tests/kms_ccs: Convert int/bool to enum Daniel Stone
2017-08-08 16:16 ` [PATCH i-g-t 2/8] tests/kms_ccs: Split FB generation into helper Daniel Stone
2017-08-08 16:16 ` [PATCH i-g-t 3/8] tests/kms_ccs: Remove excessive FB alignment Daniel Stone
2017-08-08 16:16 ` [PATCH i-g-t 4/8] tests/kms_ccs: Paramaterize color for framebuffer Daniel Stone
2017-08-08 16:16 ` [PATCH i-g-t 5/8] tests/kms_ccs: Reshuffle test name and loop Daniel Stone
2017-08-08 16:16 ` [PATCH i-g-t 6/8] tests/kms_ccs: Test for supported modifier Daniel Stone
2017-08-10  4:48   ` Jason Ekstrand
2017-08-08 16:16 ` [PATCH i-g-t 7/8] tests/kms_ccs: Split all tests into subtests Daniel Stone
2017-08-08 16:16 ` [PATCH i-g-t 8/8] tests/kms_ccs: Test CCS on sprite planes Daniel Stone
2017-08-10  5:20   ` Jason Ekstrand

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.