<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Aug 8, 2017 at 9:16 AM, Daniel Stone <span dir="ltr"><<a href="mailto:daniels@collabora.com" target="_blank">daniels@collabora.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Also try to test CCS on available non-primary planes. However, as there<br>
is not enough bandwidth to scan out both the primary and sprite planes<br>
when using CCS (or even Y-tiled), fall back to linear for the primary<br>
plane when using CCS for a sprite/cursor plane.<br>
<br>
Signed-off-by: Daniel Stone <<a href="mailto:daniels@collabora.com">daniels@collabora.com</a>><br>
---<br>
tests/kms_ccs.c | 74 ++++++++++++++++++++++++++++++<wbr>+++++++++++++++++++++------<br>
1 file changed, 67 insertions(+), 7 deletions(-)<br>
<br>
diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c<br>
index 79856f97..c544b36f 100644<br>
--- a/tests/kms_ccs.c<br>
+++ b/tests/kms_ccs.c<br>
@@ -37,19 +37,24 @@ enum test_flags {<br>
<br>
enum test_fb_flags {<br>
FB_COMPRESSED = 1 << 0,<br>
+ FB_HAS_PLANE = 1 << 1,<br>
};<br>
<br>
typedef struct {<br>
int drm_fd;<br>
igt_display_t display;<br>
struct igt_fb fb;<br>
+ struct igt_fb fb_sprite;<br>
igt_output_t *output;<br>
enum pipe pipe;<br>
enum test_flags flags;<br>
+ igt_plane_t *plane;<br>
} data_t;<br>
<br>
#define RED 0x00ff0000<br>
#define COMPRESSED_RED 0x0ff0000f<br>
+#define GREEN 0x0000ff00<br>
+#define COMPRESSED_GREEN 0x000ff00f<br>
<br>
#define CCS_UNCOMPRESSED 0x0<br>
#define CCS_COMPRESSED 0x55<br>
@@ -173,8 +178,10 @@ static void render_fb(data_t *data, uint32_t gem_handle, unsigned int size,<br>
{<br>
uint32_t *ptr;<br>
unsigned int half_height, half_size;<br>
- uint32_t uncompressed_color = RED;<br>
- uint32_t compressed_color = COMPRESSED_RED;<br>
+ uint32_t uncompressed_color = data->plane ? GREEN : RED;<br>
+ uint32_t compressed_color =<br>
+ data->plane ? COMPRESSED_GREEN : COMPRESSED_RED;<br>
+ uint32_t bad_color = RED;<br>
int i;<br>
<br>
ptr = gem_mmap__cpu(data->drm_fd, gem_handle, 0, size,<br>
@@ -200,8 +207,19 @@ static void render_fb(data_t *data, uint32_t gem_handle, unsigned int size,<br>
ptr[i] = compressed_color;<br>
}<br>
} else {<br>
- for (i = 0; i < size / 4; i++)<br>
- ptr[i] = uncompressed_color;<br>
+ /* When we're displaying the primary plane underneath a<br>
+ * sprite plane, cut out a 128 x 128 area (less than the sprite)<br>
+ * plane size which we paint red, so we know easily if it's<br>
+ * bad.<br>
+ */<br>
+ for (i = 0; i < size / 4; i++) {<br>
+ if ((fb_flags & FB_HAS_PLANE) &&<br>
+ i < (stride * 128) && (i % (stride / 4)) < 1) {<br></blockquote><div><br></div><div>I think this should be:<br><br> (i / (stride / 4)) < 128 && (i % (stride / 4)) < 128<br><br></div><div>Other than that and the other two comments I made on another patch, this series looks good to me. Patches 1-5 are<br><br></div><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br><br></div><div>Patches 6-7 are<br><br></div><div>Acked-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br><br></div><div>I don't feel 100% confident reviewing them without lots of reading of IGT docs.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ ptr[i] = bad_color;<br>
+ } else {<br>
+ ptr[i] = uncompressed_color;<br>
+ }<br>
+ }<br>
}<br>
<br>
munmap(ptr, size);<br>
@@ -249,10 +267,17 @@ static void generate_fb(data_t *data, struct igt_fb *fb,<br>
uint64_t modifier;<br>
int ret;<br>
<br>
+ /* Use either compressed or Y-tiled to test. However, given the lack of<br>
+ * available bandwidth, we use linear for the primary plane when<br>
+ * testing sprites, since we cannot fit two CCS planes into the<br>
+ * available FIFO configurations.<br>
+ */<br>
if (fb_flags & FB_COMPRESSED)<br>
modifier = LOCAL_I915_FORMAT_MOD_Y_TILED_<wbr>CCS;<br>
- else<br>
+ else if (!(fb_flags & FB_HAS_PLANE))<br>
modifier = LOCAL_I915_FORMAT_MOD_Y_TILED;<br>
+ else<br>
+ modifier = 0;<br>
<br>
f.flags = LOCAL_DRM_MODE_FB_MODIFIERS;<br>
f.width = width;<br>
@@ -338,8 +363,17 @@ static void try_config(data_t *data, enum test_fb_flags fb_flags)<br>
DRM_PLANE_TYPE_PRIMARY);<br>
plane_require_ccs(data, primary, DRM_FORMAT_XRGB8888);<br>
<br>
- generate_fb(data, &data->fb, drm_mode->hdisplay, drm_mode->vdisplay,<br>
- fb_flags);<br>
+ if (data->plane && fb_flags & FB_COMPRESSED) {<br>
+ plane_require_ccs(data, data->plane, DRM_FORMAT_XRGB8888);<br>
+ generate_fb(data, &data->fb, drm_mode->hdisplay,<br>
+ drm_mode->vdisplay,<br>
+ (fb_flags & ~FB_COMPRESSED) | FB_HAS_PLANE);<br>
+ generate_fb(data, &data->fb_sprite, 256, 256, fb_flags);<br>
+ } else {<br>
+ generate_fb(data, &data->fb, drm_mode->hdisplay,<br>
+ drm_mode->vdisplay, fb_flags);<br>
+ }<br>
+<br>
if (data->flags & TEST_BAD_PIXEL_FORMAT)<br>
return;<br>
<br>
@@ -347,6 +381,12 @@ static void try_config(data_t *data, enum test_fb_flags fb_flags)<br>
igt_plane_set_size(primary, drm_mode->hdisplay, drm_mode->vdisplay);<br>
igt_plane_set_fb(primary, &data->fb);<br>
<br>
+ if (data->plane && fb_flags & FB_COMPRESSED) {<br>
+ igt_plane_set_position(data-><wbr>plane, 0, 0);<br>
+ igt_plane_set_size(data-><wbr>plane, 256, 256);<br>
+ igt_plane_set_fb(data->plane, &data->fb_sprite);<br>
+ }<br>
+<br>
if (data->flags & TEST_ROTATE_180)<br>
igt_plane_set_rotation(<wbr>primary, IGT_ROTATION_180);<br>
if (data->flags & TEST_BAD_ROTATION_90)<br>
@@ -359,6 +399,13 @@ static void try_config(data_t *data, enum test_fb_flags fb_flags)<br>
igt_assert_eq(ret, 0);<br>
<br>
igt_debug_wait_for_keypress("<wbr>ccs");<br>
+<br>
+ if (data->plane && fb_flags & FB_COMPRESSED) {<br>
+ igt_plane_set_position(data-><wbr>plane, 0, 0);<br>
+ igt_plane_set_size(data-><wbr>plane, 0, 0);<br>
+ igt_plane_set_fb(data->plane, NULL);<br>
+ igt_remove_fb(display->drm_fd, &data->fb_sprite);<br>
+ }<br>
}<br>
<br>
static void test_output(data_t *data)<br>
@@ -427,6 +474,7 @@ igt_main<br>
<br>
for_each_pipe(&data.display, data.pipe) {<br>
const char *pipe_name = kmstest_pipe_name(data.pipe);<br>
+ int sprite_idx = 0;<br>
<br>
data.flags = TEST_BAD_PIXEL_FORMAT;<br>
igt_subtest_f("pipe-%s-bad-<wbr>pixel-format", pipe_name)<br>
@@ -443,6 +491,18 @@ igt_main<br>
data.flags = TEST_CRC | TEST_ROTATE_180;<br>
igt_subtest_f("pipe-%s-crc-<wbr>primary-rotation-180", pipe_name)<br>
test_output(&data);<br>
+<br>
+ data.flags = TEST_CRC;<br>
+ for_each_plane_on_pipe(&data.<wbr>display, data.pipe, data.plane) {<br>
+ if (data.plane->type == DRM_PLANE_TYPE_PRIMARY)<br>
+ continue;<br>
+ sprite_idx++;<br>
+ igt_subtest_f("pipe-%s-crc-<wbr>sprite-%d-basic", pipe_name,<br>
+ sprite_idx)<br>
+ test_output(&data);<br>
+ }<br>
+<br>
+ data.plane = NULL;<br>
}<br>
<br>
igt_fixture<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.13.4<br>
<br>
</font></span></blockquote></div><br></div></div>