kms_ccs testcase improvements
v2 cover kms_ccs testcase improvements
Hey,
Here is a v2 including other testcases for kms_ccs as well as random fixes to that test and one to igt_kms.
I have two other testcases that I wanted to share together with this set for kms_ccs, but they will come later.
Please notice that the testcase for the overlapping buffers will hit a failure because linux fails to detect the overlapping buffers in add_fb2. I'll submit on another thread with a patch to linux fixing the ioctl, which will make this test suceed.
Please, let me know your feedback,
Gabriel Krisman Bertazi (7):
tests/kms_ccs: Test pipes other than pipe A lib/igt_kms: Fix off-by-one bug on skip of missing pipe tests/kms_ccs: Prevent segfault if pipe is not supported tests/kms_ccs: Test case where the CCS buffer was not provided tests/kms_ccs: Test case where CCS and main buffer overlaps tests/kms_ccs: Test case where CCS is on a different BO tests/kms_ccs: Test case for wrong aux buffer stripe size
lib/igt_kms.c | 2 +- tests/kms_ccs.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 74 insertions(+), 10 deletions(-)
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/7 tests/kms_ccs: Test pipes other than pipe A
Commit d41c4ccbd2f9 ("tests/kms_ccs: Fix subtest enumeration") accidently removed the update of data.pipe, causing kms_ccs to silently only test PIPE_A.
This fixes the behavior reported by Daniel Vetter where tests would succeed even on nonexistent pipes.
--- tests/kms_ccs.c | 2 ++ 1 file changed, 2 insertions(+)
tests/kms_ccs.c +2 -0
@@ -483,6 +483,8 @@ igt_mainconst char *pipe_name =kmstest_pipe_name (pipe);int sprite_idx =0 ; + data.pipe = pipe; + data.flags =TEST_BAD_PIXEL_FORMAT ; igt_subtest_f("pipe-%s-bad-pixel-format", pipe_name)test_output (&data);
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 2/7 lib/igt_kms: Fix off-by-one bug on skip of missing pipe
In reply to Gabriel Krisman Bertazidisplay->n_pipes is zero-indexed, so N returned in igt_display_get_n_pipes is already not a valid pipe. This patch prevents kms_ccs from going nuts when testing the first unxesting pipe.
--- lib/igt_kms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/igt_kms.c +1 -1
@@ -1864,7 +1864,7 @@ void igt_display_require_output_on_pipe(igt_display_t *display, enum pipe pipe) {igt_output_t *output; -igt_skip_on_f (igt_display_get_n_pipes (display) < pipe, +igt_skip_on_f (igt_display_get_n_pipes (display) <= pipe,"Pipe %s does not exist.\n" ,kmstest_pipe_name (pipe));for_each_valid_output_on_pipe (display, pipe, output)
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 3/7 tests/kms_ccs: Prevent segfault if pipe is not supported
In reply to Gabriel Krisman Bertazifor_each_plane_on_pipe() indexes bad memory when iterating over an invalid pipe. Make sure the pipe exists before trying to use it. This prevents the crash below:
root@ideacentre:~# igt-gpu-tools/tests/kms_ccs --r pipe-D-crc-sprite-planes-basic IGT-Version: 1.19-g59f0e3d182a8 (x86_64) (Linux: 4.13.0-rc6.intel-boxes+x86_64) Received signal SIGSEGV. Stack trace: #0 [fatal_sig_handler+0x185] #1 [killpg+0x40] #2 [__real_main485+0x2de] #3 [main+0x3f] #4 [__libc_start_main+0xf1] #5 [_start+0x2a] #6 [<unknown>+0x2a] Subtest pipe-D-crc-sprite-planes-basic: CRASH (0.004s)
--- tests/kms_ccs.c | 3 +++ 1 file changed, 3 insertions(+)
tests/kms_ccs.c +3 -0
@@ -503,6 +503,9 @@ igt_main data.flags =TEST_CRC ; igt_subtest_f("pipe-%s-crc-sprite-planes-basic", pipe_name) { + +igt_display_require_output_on_pipe (&data.display, data.pipe); +for_each_plane_on_pipe (&data.display, data.pipe, data.plane) {if (data.plane->type ==DRM_PLANE_TYPE_PRIMARY )continue ;
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 4/7 tests/kms_ccs: Test case where the CCS buffer was not provided
In reply to Gabriel Krisman Bertazi--- tests/kms_ccs.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
tests/kms_ccs.c +19 -6
@@ -33,8 +33,12 @@ enum test_flags {TEST_ROTATE_180 =1 <<2 ,TEST_BAD_PIXEL_FORMAT =1 <<3 ,TEST_BAD_ROTATION_90 =1 <<4 , + TEST_NO_AUX_BUFFER = 1 << 5, }; +#define TEST_FAIL_ON_ADDFB2 \ + (TEST_BAD_PIXEL_FORMAT | TEST_NO_AUX_BUFFER) +enum test_fb_flags {FB_COMPRESSED =1 <<0 , FB_HAS_PLANE = 1 << 1,
@@ -321,16 +325,19 @@ static void generate_fb(data_t *data, struct igt_fb *fb, 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 ]; -render_ccs (data, f.handles[1 ], f.offsets[1 ], size[1 ], - height, f.pitches[1 ]); + +if (!(data->flags &TEST_NO_AUX_BUFFER )) { + 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 ) { +if (data->flags &TEST_FAIL_ON_ADDFB2 ) {igt_assert_eq (ret,-1 );igt_assert_eq (errno,EINVAL );return ;
@@ -379,7 +386,7 @@ static void try_config(data_t *data, enum test_fb_flags fb_flags) drm_mode->vdisplay, fb_flags); } -if (data->flags &TEST_BAD_PIXEL_FORMAT ) +if (data->flags &TEST_FAIL_ON_ADDFB2 )return ;igt_plane_set_position (primary,0 ,0 );
@@ -446,7 +453,8 @@ static void test_output(data_t *data) }if (data->flags &TEST_BAD_PIXEL_FORMAT || - data->flags &TEST_BAD_ROTATION_90 ) { + data->flags &TEST_BAD_ROTATION_90 || + data->flags &TEST_NO_AUX_BUFFER ) {try_config (data, fb_flags |FB_COMPRESSED ); }
@@ -515,6 +523,11 @@ igt_main } data.plane =NULL ; + + data.flags =TEST_NO_AUX_BUFFER ; + igt_subtest_f("pipe-%s-missing-ccs-buffer", pipe_name) +test_output (&data); + } igt_fixture
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 4/7] tests/kms_ccs: Test case where the CCS buffer was not provided
Hi Gabriel,
tests/kms_ccs.c static void generate_fb(data_t *data, struct igt_fb *fb, · line 333
Quoted 13 lines · Gabriel Krisman Bertazi
tests/kms_ccs.c +6
-3@@ -321,16 +325,19 @@ static void generate_fb(data_t *data, struct igt_fb *fb, 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 ]; -render_ccs (data, f.handles[1 ], f.offsets[1 ], size[1 ], - height, f.pitches[1 ]); + +if (!(data->flags &TEST_NO_AUX_BUFFER )) { + f.handles[1 ] = f.handles[0 ]; +render_ccs (data, f.handles[1 ], f.offsets[1 ], size[1 ], + height, f.pitches[1 ]); + }
Doesn't this leave modifier[1] still set? If so, that'll get rejected by core code already for a mismatch.
Cheers,
Daniel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 5/7 tests/kms_ccs: Test case where CCS and main buffer overlaps
In reply to Gabriel Krisman Bertazi--- tests/kms_ccs.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
tests/kms_ccs.c +15 -3
@@ -34,10 +34,11 @@ enum test_flags {TEST_BAD_PIXEL_FORMAT =1 <<3 ,TEST_BAD_ROTATION_90 =1 <<4 ,TEST_NO_AUX_BUFFER =1 <<5 , + TEST_BAD_CCS_OFFSET = 1 << 6, };#define TEST_FAIL_ON_ADDFB2 \ - (TEST_BAD_PIXEL_FORMAT | TEST_NO_AUX_BUFFER) + (TEST_BAD_PIXEL_FORMAT | TEST_NO_AUX_BUFFER | TEST_BAD_CCS_OFFSET)enum test_fb_flags { FB_COMPRESSED = 1 << 0,
@@ -321,7 +322,13 @@ static void generate_fb(data_t *data, struct igt_fb *fb,int ccs_height =ALIGN (height,16 ) /16 ; f.pitches[1 ] =ALIGN (ccs_width *1 ,128 ); f.modifier[1 ] = modifier; - f.offsets[1 ] = size[0 ]; + +if (data->flags &TEST_BAD_CCS_OFFSET ) { +/* Overlap CCS buffer with the color buffer. */ + f.offsets[1 ] =0 ; + }else + f.offsets[1 ] = size[0 ]; + size[1 ] = f.pitches[1 ] *ALIGN (ccs_height,32 ); f.handles[0 ] =gem_create (data->drm_fd, size[0 ] + size[1 ]);
@@ -454,7 +461,8 @@ static void test_output(data_t *data)if (data->flags &TEST_BAD_PIXEL_FORMAT || data->flags &TEST_BAD_ROTATION_90 || - data->flags &TEST_NO_AUX_BUFFER ) { + data->flags &TEST_NO_AUX_BUFFER || + data->flags &TEST_BAD_CCS_OFFSET ) {try_config (data, fb_flags |FB_COMPRESSED ); }
@@ -528,6 +536,10 @@ igt_main igt_subtest_f("pipe-%s-missing-ccs-buffer", pipe_name)test_output (&data); + data.flags =TEST_BAD_CCS_OFFSET ; + igt_subtest_f("pipe-%s-invalid-ccs-offset", pipe_name) +test_output (&data); + } igt_fixture
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 5/7] tests/kms_ccs: Test case where CCS and main buffer overlaps
tests/kms_ccs.c static void generate_fb(data_t *data, struct igt_fb *fb, · line 328
Quoted 9 lines · Gabriel Krisman Bertazi
tests/kms_ccs.c +4
-1@@ -321,7 +322,13 @@ static void generate_fb(data_t *data, struct igt_fb *fb,int ccs_height =ALIGN (height,16 ) /16 ; f.pitches[1 ] =ALIGN (ccs_width *1 ,128 ); f.modifier[1 ] = modifier; - f.offsets[1 ] = size[0 ]; + +if (data->flags &TEST_BAD_CCS_OFFSET ) { +/* Overlap CCS buffer with the color buffer. */ + f.offsets[1 ] =0 ;
How about size[0] - 1024? That will give us an aligned-to-128 value which looks plausible, and should overlap actual colour data.
Cheers,
Daniel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 6/7 tests/kms_ccs: Test case where CCS is on a different BO
In reply to Gabriel Krisman Bertazi--- tests/kms_ccs.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)
tests/kms_ccs.c +20 -4
@@ -35,10 +35,12 @@ enum test_flags {TEST_BAD_ROTATION_90 =1 <<4 ,TEST_NO_AUX_BUFFER =1 <<5 ,TEST_BAD_CCS_OFFSET =1 <<6 , + TEST_BAD_CCS_HANDLE = 1 << 7, };#define TEST_FAIL_ON_ADDFB2 \ - (TEST_BAD_PIXEL_FORMAT | TEST_NO_AUX_BUFFER | TEST_BAD_CCS_OFFSET) + (TEST_BAD_PIXEL_FORMAT | TEST_NO_AUX_BUFFER | TEST_BAD_CCS_OFFSET | \ + TEST_BAD_CCS_HANDLE)enum test_fb_flags { FB_COMPRESSED = 1 << 0,
@@ -276,6 +278,7 @@ static void generate_fb(data_t *data, struct igt_fb *fb,unsigned int size[2 ];uint64_t modifier;int ret; +uint32_t ccs_handle;/* Use either compressed or Y-tiled to test. However, given the lack of * available bandwidth, we use linear for the primary plane when
@@ -331,10 +334,18 @@ static void generate_fb(data_t *data, struct igt_fb *fb, size[1 ] = f.pitches[1 ] *ALIGN (ccs_height,32 ); - f.handles[0 ] =gem_create (data->drm_fd, size[0 ] + size[1 ]); +if (data->flags &TEST_BAD_CCS_HANDLE ) { +/* Put the CCS buffer on a different BO. */ + f.handles[0 ] =gem_create (data->drm_fd, size[0 ]); + ccs_handle =gem_create (data->drm_fd, size[1 ]); + f.offsets[1 ] =0 ; + }else { + f.handles[0 ] =gem_create (data->drm_fd, size[0 ] + size[1 ]); + ccs_handle = f.handles[0 ]; + }if (!(data->flags &TEST_NO_AUX_BUFFER )) { - f.handles[1 ] = f.handles[0 ]; + f.handles[1 ] = ccs_handle;render_ccs (data, f.handles[1 ], f.offsets[1 ], size[1 ], height, f.pitches[1 ]); }
@@ -462,7 +473,8 @@ static void test_output(data_t *data)if (data->flags &TEST_BAD_PIXEL_FORMAT || data->flags &TEST_BAD_ROTATION_90 || data->flags &TEST_NO_AUX_BUFFER || - data->flags &TEST_BAD_CCS_OFFSET ) { + data->flags &TEST_BAD_CCS_OFFSET || + data->flags &TEST_BAD_CCS_HANDLE ) {try_config (data, fb_flags |FB_COMPRESSED ); }
@@ -540,6 +552,10 @@ igt_main igt_subtest_f("pipe-%s-invalid-ccs-offset", pipe_name)test_output (&data); + data.flags =TEST_BAD_CCS_HANDLE ; + igt_subtest_f("pipe-%s-ccs-on-another-bo", pipe_name) +test_output (&data); + } igt_fixture
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 6/7] tests/kms_ccs: Test case where CCS is on a different BO
Hi Gabriel,
tests/kms_ccs.c static void generate_fb(data_t *data, struct igt_fb *fb, · line 341
Quoted 5 lines · Gabriel Krisman Bertazi
tests/kms_ccs.c +5
-0+if (data->flags &TEST_BAD_CCS_HANDLE ) { +/* Put the CCS buffer on a different BO. */ + f.handles[0 ] =gem_create (data->drm_fd, size[0 ]); + ccs_handle =gem_create (data->drm_fd, size[1 ]); + f.offsets[1 ] =0 ;
This could be caught by offsets[1] < size[0] checking. Could you please create both BOs with (size[0] + size[1]), and set (offset[1] == size[0])? In other words, the only thing differing at all is the BO.
Cheers,
Daniel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 7/7 tests/kms_ccs: Test case for wrong aux buffer stripe size
In reply to Gabriel Krisman BertaziTwo scenarios tested:
- unaligned stripe
- Stripe too small
--- tests/kms_ccs.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
tests/kms_ccs.c +20 -2
@@ -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
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx