kms_rotation_crc cleanups
cover kms_rotation_crc cleanups
From: Tvrtko Ursulin <[email protected]>
I thought I will need to add some page flipping tests here and wanted to do some cleanups first.
Unfortunately (or fortunately), kms_flip_tiling already tests Y tiled flips with CRC so the focus shifts to fixing that one.
But these cleanups are still an improvement in amount of code and clarity.
This is on top of Sonika's 90/270 kms_rotation_crc patch which I r-b-ed.
Tvrtko Ursulin (7):
kms_rotation_crc: Local framebuffers do not need to be global
kms_rotation_crc: Framebuffer used for initial modeset does not need
to be painted
kms_rotation_crc: Remove unused variable in negative test
kms_rotation_crc: Negative test does not need to render anything
kms_rotation_crc: Consolidate plane and cursor code paths
kms_rotation_crc: No need to square the buffer in paint
kms_rotation_crc: Use main test for negative cases
tests/kms_rotation_crc.c | 271 ++++++++++++++++------------------------------- 1 file changed, 92 insertions(+), 179 deletions(-)
Signature · 6 lines
2.3.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/7 kms_rotation_crc: Local framebuffers do not need to be global
From: Tvrtko Ursulin <[email protected]>
--- tests/kms_rotation_crc.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
tests/kms_rotation_crc.c +9 -10
@@ -36,8 +36,6 @@ typedef struct {struct igt_fb fb;struct igt_fb fb_cursor;struct igt_fb fb_full; -struct igt_fb fb_565; -struct igt_fb fb_tiling;igt_crc_t ref_crc;igt_pipe_crc_t *pipe_crc;igt_rotation_t rotation;
@@ -247,6 +245,7 @@ static void test_unsupported_tiling_pixel_format(data_t *data, enum igt_plane plenum pipe pipe;int valid_tests =0 ;int fb_tiling_id, fb_565_id; +struct igt_fb fb_565, fb_tiling;for_each_connected_output (display, output) {for_each_pipe (display, pipe) {
@@ -262,10 +261,10 @@ static void test_unsupported_tiling_pixel_format(data_t *data, enum igt_plane pl mode->hdisplay, mode->vdisplay,DRM_FORMAT_XRGB8888 ,LOCAL_DRM_FORMAT_MOD_NONE , - &data->fb_tiling); + &fb_tiling);igt_assert (fb_tiling_id); -paint_squares (data, &data->fb_tiling, mode,IGT_ROTATION_0 , plane); -igt_plane_set_fb (plane, &data->fb_tiling); +paint_squares (data, &fb_tiling, mode,IGT_ROTATION_0 , plane); +igt_plane_set_fb (plane, &fb_tiling);/* For the first modeset with legacy commit */ igt_display_commit (display);igt_plane_set_rotation (plane, data->rotation);
@@ -276,10 +275,10 @@ static void test_unsupported_tiling_pixel_format(data_t *data, enum igt_plane pl mode->hdisplay, mode->vdisplay,DRM_FORMAT_RGB565 ,LOCAL_I915_FORMAT_MOD_Y_TILED , - &data->fb_565); + &fb_565);igt_assert (fb_565_id); -paint_squares (data, &data->fb_565, mode,IGT_ROTATION_0 , plane); -igt_plane_set_fb (plane, &data->fb_565); +paint_squares (data, &fb_565, mode,IGT_ROTATION_0 , plane); +igt_plane_set_fb (plane, &fb_565);igt_plane_set_rotation (plane, data->rotation);/* Shud fail because 90/270 is not supported with RGB565 */ igt_assert (igt_display_try_commit2 (display,COMMIT_UNIVERSAL ) == -EINVAL );
@@ -294,8 +293,8 @@ static void test_unsupported_tiling_pixel_format(data_t *data, enum igt_plane pl valid_tests++; -igt_remove_fb (data->gfx_fd, &data->fb_tiling); -igt_remove_fb (data->gfx_fd, &data->fb_565); +igt_remove_fb (data->gfx_fd, &fb_tiling); +igt_remove_fb (data->gfx_fd, &fb_565);cleanup_crtc (data, output, plane);igt_display_commit (display);
Signature · 6 lines
2.3.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/7 kms_rotation_crc: Framebuffer used for initial modeset does not need to be painted
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
It is just there to light up the display using the full modeset. Also renamed it from fb_full to fb_modeset to be more descriptive.
--- tests/kms_rotation_crc.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-)
tests/kms_rotation_crc.c +10 -15
@@ -35,7 +35,7 @@ typedef struct {igt_display_t display;struct igt_fb fb;struct igt_fb fb_cursor; -struct igt_fb fb_full; +struct igt_fb fb_modeset;igt_crc_t ref_crc;igt_pipe_crc_t *pipe_crc;igt_rotation_t rotation;
@@ -117,11 +117,10 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe, {drmModeModeInfo *mode;igt_display_t *display = &data->display; -int fb_id, fb_cursor_id, fb_full_id; +int fb_id, fb_cursor_id, fb_modeset_id;int w, h;uint64_t tiling =LOCAL_DRM_FORMAT_MOD_NONE ;enum igt_commit_style commit =COMMIT_LEGACY ; -int old_rotation;igt_plane_t *primary;igt_output_set_pipe (output, pipe);
@@ -135,12 +134,12 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe, w = mode->hdisplay; h = mode->vdisplay; - fb_full_id =igt_create_fb (data->gfx_fd, - w, h, -DRM_FORMAT_XRGB8888 , - tiling, - &data->fb_full); -igt_assert (fb_full_id); + fb_modeset_id =igt_create_fb (data->gfx_fd, + w, h, +DRM_FORMAT_XRGB8888 , + tiling, + &data->fb_modeset); +igt_assert (fb_modeset_id);/* * With igt_display_commit2 and COMMIT_UNIVERSAL, we call just the
@@ -149,13 +148,9 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,* we create an fb covering the crtc and call commit */ - old_rotation = data->rotation; - data->rotation =IGT_ROTATION_0 ; primary =igt_output_get_plane (output,IGT_PLANE_PRIMARY ); -paint_squares (data, &data->fb_full, mode,IGT_ROTATION_0 , primary); -igt_plane_set_fb (primary, &data->fb_full); +igt_plane_set_fb (primary, &data->fb_modeset);igt_display_commit (display); - data->rotation = old_rotation;/* * For 90/270, we will use create smaller fb so that the rotated
@@ -221,7 +216,7 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)igt_remove_fb (data->gfx_fd, &data->fb);igt_remove_fb (data->gfx_fd, &data->fb_cursor); -igt_remove_fb (data->gfx_fd, &data->fb_full); +igt_remove_fb (data->gfx_fd, &data->fb_modeset);/* XXX: see the note in prepare_crtc() */ if (!plane->is_primary) {
Signature · 6 lines
2.3.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/7 kms_rotation_crc: Remove unused variable in negative test
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
--- tests/kms_rotation_crc.c | 3 --- 1 file changed, 3 deletions(-)
tests/kms_rotation_crc.c +0 -3
@@ -238,7 +238,6 @@ static void test_unsupported_tiling_pixel_format(data_t *data, enum igt_plane pligt_display_t *display = &data->display;igt_output_t *output;enum pipe pipe; -int valid_tests =0 ;int fb_tiling_id, fb_565_id;struct igt_fb fb_565, fb_tiling;
@@ -286,8 +285,6 @@ static void test_unsupported_tiling_pixel_format(data_t *data, enum igt_plane plkmstest_set_vt_graphics_mode ();prepare_crtc (data, output, pipe, plane); - valid_tests++; -igt_remove_fb (data->gfx_fd, &fb_tiling);igt_remove_fb (data->gfx_fd, &fb_565);cleanup_crtc (data, output, plane);
Signature · 6 lines
2.3.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/7 kms_rotation_crc: Negative test does not need to render anything
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
--- tests/kms_rotation_crc.c | 2 -- 1 file changed, 2 deletions(-)
tests/kms_rotation_crc.c +0 -2
@@ -257,7 +257,6 @@ static void test_unsupported_tiling_pixel_format(data_t *data, enum igt_plane plLOCAL_DRM_FORMAT_MOD_NONE , &fb_tiling);igt_assert (fb_tiling_id); -paint_squares (data, &fb_tiling, mode,IGT_ROTATION_0 , plane);igt_plane_set_fb (plane, &fb_tiling);/* For the first modeset with legacy commit */ igt_display_commit (display);
@@ -271,7 +270,6 @@ static void test_unsupported_tiling_pixel_format(data_t *data, enum igt_plane plLOCAL_I915_FORMAT_MOD_Y_TILED , &fb_565);igt_assert (fb_565_id); -paint_squares (data, &fb_565, mode,IGT_ROTATION_0 , plane);igt_plane_set_fb (plane, &fb_565);igt_plane_set_rotation (plane, data->rotation);/* Shud fail because 90/270 is not supported with RGB565 */
Signature · 6 lines
2.3.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/7 kms_rotation_crc: Consolidate plane and cursor code paths
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
There can only be one, either a plane or a cursor, in each subtest so there is no need for two framebuffer varilables and also some codepaths can be unified.
--- tests/kms_rotation_crc.c | 150 ++++++++++++++++++++--------------------------- 1 file changed, 62 insertions(+), 88 deletions(-)
tests/kms_rotation_crc.c +62 -88
@@ -34,81 +34,64 @@ typedef struct {int gfx_fd;igt_display_t display;struct igt_fb fb; -struct igt_fb fb_cursor;struct igt_fb fb_modeset;igt_crc_t ref_crc;igt_pipe_crc_t *pipe_crc;igt_rotation_t rotation;int pos_x;int pos_y; +unsigned int w, h; } data_t;static void -paint_squares (data_t *data,struct igt_fb *fb,drmModeModeInfo *mode, -igt_rotation_t rotation,igt_plane_t *plane) +paint_squares (data_t *data,drmModeModeInfo *mode,igt_rotation_t rotation, +igt_plane_t *plane) {cairo_t *cr; -int w, h; +unsigned int w = data->w; +unsigned int h = data->h; -if (plane->is_cursor) { - w =128 ; - h =128 ; - cr =igt_get_cairo_ctx (data->gfx_fd, &data->fb_cursor); + cr =igt_get_cairo_ctx (data->gfx_fd, &data->fb); -if (rotation ==IGT_ROTATION_180 ) { -cairo_translate (cr, w, h); -cairo_rotate (cr,M_PI ); - } - -igt_paint_color (cr,0 ,0 , w /2 , h /2 ,.75 ,0.5 ,0.5 ); -igt_paint_color (cr, w /2 ,0 , w /2 , h /2 ,0.5 ,.75 ,0.5 ); -igt_paint_color (cr,0 , h /2 , w /2 , h /2 ,0.5 ,0.5 ,.75 ); -igt_paint_color (cr, w /2 , h /2 , w /2 , h /2 ,.75 ,.75 ,.75 ); - }else { - w = mode->hdisplay; - h = mode->vdisplay; - - cr =igt_get_cairo_ctx (data->gfx_fd, fb); +if (rotation ==IGT_ROTATION_180 ) { +cairo_translate (cr, w, h); +cairo_rotate (cr,M_PI ); + } -if (rotation ==IGT_ROTATION_180 ) { -cairo_translate (cr, w, h); -cairo_rotate (cr,M_PI ); - } +/* +* "rotation" is used for creating ref rotated fb and +* "data->rotation" is used to determine the required size +* while creating unrotated fb. +*/ +if (rotation ==IGT_ROTATION_90 ) { +/* Paint 4 squares with width == height in Blue, Red, +Green, White Clockwise order to look like 90 degree rotated*/ + w = h = mode->vdisplay; +igt_paint_color (cr,0 ,0 , w /2 , h /2 ,0.0 ,0.0 ,1.0 ); +igt_paint_color (cr, w /2 ,0 , w /2 , h /2 ,1.0 ,0.0 ,0.0 ); +igt_paint_color (cr,0 , h /2 , w /2 , h /2 ,1.0 ,1.0 ,1.0 ); +igt_paint_color (cr, w /2 , h /2 , w /2 , h /2 ,0.0 ,1.0 ,0.0 ); + + }else if (rotation ==IGT_ROTATION_270 ) { +/* Paint 4 squares with width == height in Green, White, +Blue, Red Clockwise order to look like 270 degree rotated*/ + w = h = mode->vdisplay; +igt_paint_color (cr,0 ,0 , w /2 , h /2 ,0.0 ,1.0 ,0.0 ); +igt_paint_color (cr, w /2 ,0 , w /2 , h /2 ,1.0 ,1.0 ,1.0 ); +igt_paint_color (cr,0 , h /2 , w /2 , h /2 ,1.0 ,0.0 ,0.0 ); +igt_paint_color (cr, w /2 , h /2 , w /2 , h /2 ,0.0 ,0.0 ,1.0 ); -/* -* "rotation" is used for creating ref rotated fb and -* "data->rotation" is used to determine the required size -* while creating unrotated fb. -*/ -if (rotation ==IGT_ROTATION_90 ) { -/* Paint 4 squares with width == height in Blue, Red, -Green, White Clockwise order to look like 90 degree rotated*/ - w = h = mode->vdisplay; -igt_paint_color (cr,0 ,0 , w /2 , h /2 ,0.0 ,0.0 ,1.0 ); -igt_paint_color (cr, w /2 ,0 , w /2 , h /2 ,1.0 ,0.0 ,0.0 ); -igt_paint_color (cr,0 , h /2 , w /2 , h /2 ,1.0 ,1.0 ,1.0 ); -igt_paint_color (cr, w /2 , h /2 , w /2 , h /2 ,0.0 ,1.0 ,0.0 ); - - }else if (rotation ==IGT_ROTATION_270 ) { -/* Paint 4 squares with width == height in Green, White, -Blue, Red Clockwise order to look like 270 degree rotated*/ + }else { +if (data->rotation ==IGT_ROTATION_90 || + data->rotation ==IGT_ROTATION_270 ) w = h = mode->vdisplay; -igt_paint_color (cr,0 ,0 , w /2 , h /2 ,0.0 ,1.0 ,0.0 ); -igt_paint_color (cr, w /2 ,0 , w /2 , h /2 ,1.0 ,1.0 ,1.0 ); -igt_paint_color (cr,0 , h /2 , w /2 , h /2 ,1.0 ,0.0 ,0.0 ); -igt_paint_color (cr, w /2 , h /2 , w /2 , h /2 ,0.0 ,0.0 ,1.0 ); - - }else { -if (data->rotation ==IGT_ROTATION_90 || - data->rotation ==IGT_ROTATION_270 ) - w = h = mode->vdisplay; -/* Paint with 4 squares of Red, Green, White, Blue Clockwise */ -igt_paint_color (cr,0 ,0 , w /2 , h /2 ,1.0 ,0.0 ,0.0 ); -igt_paint_color (cr, w /2 ,0 , w /2 , h /2 ,0.0 ,1.0 ,0.0 ); -igt_paint_color (cr,0 , h /2 , w /2 , h /2 ,0.0 ,0.0 ,1.0 ); -igt_paint_color (cr, w /2 , h /2 , w /2 , h /2 ,1.0 ,1.0 ,1.0 ); - } +/* Paint with 4 squares of Red, Green, White, Blue Clockwise */ +igt_paint_color (cr,0 ,0 , w /2 , h /2 ,1.0 ,0.0 ,0.0 ); +igt_paint_color (cr, w /2 ,0 , w /2 , h /2 ,0.0 ,1.0 ,0.0 ); +igt_paint_color (cr,0 , h /2 , w /2 , h /2 ,0.0 ,0.0 ,1.0 ); +igt_paint_color (cr, w /2 , h /2 , w /2 , h /2 ,1.0 ,1.0 ,1.0 ); } +cairo_destroy (cr); }
@@ -117,9 +100,10 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe, {drmModeModeInfo *mode;igt_display_t *display = &data->display; -int fb_id, fb_cursor_id, fb_modeset_id; -int w, h; +int fb_id, fb_modeset_id; +unsigned int w, h;uint64_t tiling =LOCAL_DRM_FORMAT_MOD_NONE ; +uint32_t pixel_format =DRM_FORMAT_XRGB8888 ;enum igt_commit_style commit =COMMIT_LEGACY ;igt_plane_t *primary;
@@ -136,7 +120,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe, fb_modeset_id =igt_create_fb (data->gfx_fd, w, h, -DRM_FORMAT_XRGB8888 , + pixel_format, tiling, &data->fb_modeset);igt_assert (fb_modeset_id);
@@ -157,35 +141,31 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,* frame can fit in */ if (data->rotation ==IGT_ROTATION_90 || - data->rotation ==IGT_ROTATION_270 ) { + data->rotation ==IGT_ROTATION_270 ) { tiling =LOCAL_I915_FORMAT_MOD_Y_TILED ; w = h = mode->vdisplay; + }else if (plane->is_cursor) { + pixel_format =DRM_FORMAT_ARGB8888 ; + w = h =128 ; } + data->w = w; + data->h = h; + fb_id =igt_create_fb (data->gfx_fd, - w, h, -DRM_FORMAT_XRGB8888 , - tiling, - &data->fb); + w, h, + pixel_format, + tiling, + &data->fb);igt_assert (fb_id); - fb_cursor_id =igt_create_fb (data->gfx_fd, -128 ,128 , -DRM_FORMAT_ARGB8888 , -LOCAL_DRM_FORMAT_MOD_NONE , - &data->fb_cursor); -igt_assert (fb_cursor_id); -/* Step 1: create a reference CRC for a software-rotated fb */ -if (plane->is_cursor) { -paint_squares (data, &data->fb_cursor, mode, data->rotation, plane); -igt_plane_set_fb (plane, &data->fb_cursor); - }else { -paint_squares (data, &data->fb, mode, data->rotation, plane); -igt_plane_set_fb (plane, &data->fb); +paint_squares (data, mode, data->rotation, plane); +igt_plane_set_fb (plane, &data->fb); +if (!plane->is_cursor)igt_plane_set_position (plane, data->pos_x, data->pos_y); - } +if (plane->is_primary || plane->is_cursor) {igt_require (data->display.has_universal_planes); commit =COMMIT_UNIVERSAL ;
@@ -198,13 +178,8 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,* Step 2: prepare the plane with an non-rotated fb let the hw * rotate it. */ -if (plane->is_cursor) { -paint_squares (data, &data->fb_cursor, mode,IGT_ROTATION_0 , plane); -igt_plane_set_fb (plane, &data->fb_cursor); - }else { -paint_squares (data, &data->fb, mode,IGT_ROTATION_0 , plane); -igt_plane_set_fb (plane, &data->fb); - } +paint_squares (data, mode,IGT_ROTATION_0 , plane); +igt_plane_set_fb (plane, &data->fb); }static void cleanup_crtc (data_t *data,igt_output_t *output,igt_plane_t *plane)
@@ -215,7 +190,6 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane) data->pipe_crc =NULL ;igt_remove_fb (data->gfx_fd, &data->fb); -igt_remove_fb (data->gfx_fd, &data->fb_cursor);igt_remove_fb (data->gfx_fd, &data->fb_modeset);/* XXX: see the note in prepare_crtc() */
Signature · 6 lines
2.3.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/7 kms_rotation_crc: No need to square the buffer in paint
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
Now that size is calculated in a single place and correct geometry passed in, paint squares does not need to concern itself with it.
--- tests/kms_rotation_crc.c | 10 ---------- 1 file changed, 10 deletions(-)
tests/kms_rotation_crc.c +0 -10
@@ -58,15 +58,9 @@ paint_squares(data_t *data, drmModeModeInfo *mode, igt_rotation_t rotation,cairo_rotate (cr,M_PI ); } -/* -* "rotation" is used for creating ref rotated fb and -* "data->rotation" is used to determine the required size -* while creating unrotated fb. -*/ if (rotation ==IGT_ROTATION_90 ) {/* Paint 4 squares with width == height in Blue, Red, Green, White Clockwise order to look like 90 degree rotated*/ - w = h = mode->vdisplay;igt_paint_color (cr,0 ,0 , w /2 , h /2 ,0.0 ,0.0 ,1.0 );igt_paint_color (cr, w /2 ,0 , w /2 , h /2 ,1.0 ,0.0 ,0.0 );igt_paint_color (cr,0 , h /2 , w /2 , h /2 ,1.0 ,1.0 ,1.0 );
@@ -75,16 +69,12 @@ paint_squares(data_t *data, drmModeModeInfo *mode, igt_rotation_t rotation, }else if (rotation ==IGT_ROTATION_270 ) {/* Paint 4 squares with width == height in Green, White, Blue, Red Clockwise order to look like 270 degree rotated*/ - w = h = mode->vdisplay;igt_paint_color (cr,0 ,0 , w /2 , h /2 ,0.0 ,1.0 ,0.0 );igt_paint_color (cr, w /2 ,0 , w /2 , h /2 ,1.0 ,1.0 ,1.0 );igt_paint_color (cr,0 , h /2 , w /2 , h /2 ,1.0 ,0.0 ,0.0 );igt_paint_color (cr, w /2 , h /2 , w /2 , h /2 ,0.0 ,0.0 ,1.0 ); }else { -if (data->rotation ==IGT_ROTATION_90 || - data->rotation ==IGT_ROTATION_270 ) - w = h = mode->vdisplay;/* Paint with 4 squares of Red, Green, White, Blue Clockwise */ igt_paint_color (cr,0 ,0 , w /2 , h /2 ,1.0 ,0.0 ,0.0 );igt_paint_color (cr, w /2 ,0 , w /2 , h /2 ,0.0 ,1.0 ,0.0 );
Signature · 6 lines
2.3.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 7/7 kms_rotation_crc: Use main test for negative cases
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
Saves a good amount of code duplication by supporting expected failures from the main loop.
--- tests/kms_rotation_crc.c | 106 +++++++++++++++-------------------------------- 1 file changed, 33 insertions(+), 73 deletions(-)
tests/kms_rotation_crc.c +33 -73
@@ -41,6 +41,8 @@ typedef struct {int pos_x;int pos_y;unsigned int w, h; +uint32_t override_fmt; +uint64_t override_tiling; } data_t; static void
@@ -92,8 +94,10 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,igt_display_t *display = &data->display;int fb_id, fb_modeset_id;unsigned int w, h; -uint64_t tiling =LOCAL_DRM_FORMAT_MOD_NONE ; -uint32_t pixel_format =DRM_FORMAT_XRGB8888 ; +uint64_t tiling = data->override_tiling ? + data->override_tiling :LOCAL_DRM_FORMAT_MOD_NONE ; +uint32_t pixel_format = data->override_fmt ? + data->override_fmt :DRM_FORMAT_XRGB8888 ;enum igt_commit_style commit =COMMIT_LEGACY ;igt_plane_t *primary;
@@ -132,10 +136,12 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,*/ if (data->rotation ==IGT_ROTATION_90 || data->rotation ==IGT_ROTATION_270 ) { - tiling =LOCAL_I915_FORMAT_MOD_Y_TILED ; + tiling = data->override_tiling ? + data->override_tiling :LOCAL_I915_FORMAT_MOD_Y_TILED ; w = h = mode->vdisplay; }else if (plane->is_cursor) { - pixel_format =DRM_FORMAT_ARGB8888 ; + pixel_format = data->override_fmt ? + data->override_fmt :DRM_FORMAT_ARGB8888 ; w = h =128 ; }
@@ -196,67 +202,6 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)igt_display_commit (display); } -static void test_unsupported_tiling_pixel_format (data_t *data,enum igt_plane plane_type) -{ -drmModeModeInfo *mode; -igt_display_t *display = &data->display; -igt_output_t *output; -enum pipe pipe; -int fb_tiling_id, fb_565_id; -struct igt_fb fb_565, fb_tiling; - -for_each_connected_output (display, output) { -for_each_pipe (display, pipe) { -igt_plane_t *plane; - -igt_output_set_pipe (output, pipe); - - plane =igt_output_get_plane (output, plane_type); -igt_require (igt_plane_supports_rotation (plane)); - mode =igt_output_get_mode (output); - - fb_tiling_id =igt_create_fb (data->gfx_fd, - mode->hdisplay, mode->vdisplay, -DRM_FORMAT_XRGB8888 , -LOCAL_DRM_FORMAT_MOD_NONE , - &fb_tiling); -igt_assert (fb_tiling_id); -igt_plane_set_fb (plane, &fb_tiling); -/* For the first modeset with legacy commit */ -igt_display_commit (display); -igt_plane_set_rotation (plane, data->rotation); -/* Shud fail because 90/270 is only supported with Y/Yf */ -igt_assert (igt_display_try_commit2 (display,COMMIT_UNIVERSAL ) == -EINVAL ); - - fb_565_id =igt_create_fb (data->gfx_fd, - mode->hdisplay, mode->vdisplay, -DRM_FORMAT_RGB565 , -LOCAL_I915_FORMAT_MOD_Y_TILED , - &fb_565); -igt_assert (fb_565_id); -igt_plane_set_fb (plane, &fb_565); -igt_plane_set_rotation (plane, data->rotation); -/* Shud fail because 90/270 is not supported with RGB565 */ -igt_assert (igt_display_try_commit2 (display,COMMIT_UNIVERSAL ) == -EINVAL ); - -/* -* check the rotation state has been reset when the VT -* mode is restored -*/ -kmstest_restore_vt_mode (); -kmstest_set_vt_graphics_mode (); -prepare_crtc (data, output, pipe, plane); - -igt_remove_fb (data->gfx_fd, &fb_tiling); -igt_remove_fb (data->gfx_fd, &fb_565); -cleanup_crtc (data, output, plane); - -igt_display_commit (display); - - } - } -} -static void test_plane_rotation (data_t *data,enum igt_plane plane_type) {igt_display_t *display = &data->display;
@@ -265,6 +210,7 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)int valid_tests =0 ;igt_crc_t crc_output, crc_unrotated;enum igt_commit_style commit =COMMIT_LEGACY ; +int ret;if (plane_type ==IGT_PLANE_PRIMARY || plane_type ==IGT_PLANE_CURSOR ) {igt_require (data->display.has_universal_planes);
@@ -288,11 +234,16 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)igt_pipe_crc_collect_crc (data->pipe_crc, &crc_unrotated);igt_plane_set_rotation (plane, data->rotation); -igt_display_commit2 (display, commit); - -igt_pipe_crc_collect_crc (data->pipe_crc, &crc_output); - -igt_assert_crc_equal (&data->ref_crc, &crc_output); + ret =igt_display_try_commit2 (display, commit); +if (data->override_fmt || data->override_tiling) { +igt_assert (ret == -EINVAL ); + }else { +igt_assert (ret ==0 ); +igt_pipe_crc_collect_crc (data->pipe_crc, + &crc_output); +igt_assert_crc_equal (&data->ref_crc, + &crc_output); + }/* * check the rotation state has been reset when the VT
@@ -376,12 +327,21 @@ igt_maintest_plane_rotation (&data,IGT_PLANE_2 ); } - igt_subtest_f("90-rotation-unsupported-tiling-pixel-format") { + igt_subtest_f("bad-pixel-format") {igt_require (gen >=9 ); - data.rotation =IGT_ROTATION_90 ; data.pos_x =0 , data.pos_y =0 ; -test_unsupported_tiling_pixel_format (&data,IGT_PLANE_PRIMARY ); + data.rotation =IGT_ROTATION_90 ; + data.override_fmt =DRM_FORMAT_RGB565 ; +test_plane_rotation (&data,IGT_PLANE_PRIMARY ); + } + + igt_subtest_f("bad-tiling") { +igt_require (gen >=9 ); + data.override_fmt =0 ; + data.rotation =IGT_ROTATION_90 ; + data.override_tiling =LOCAL_DRM_FORMAT_MOD_NONE ; +test_plane_rotation (&data,IGT_PLANE_PRIMARY ); } igt_fixture {
Signature · 6 lines
2.3.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t 7/7] kms_rotation_crc: Use main test for negative cases
Thanks Tvrtko.
This series makes kms_rotation_crc much cleaner :)
Quoted 166 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
Saves a good amount of code duplication by supporting expected failures from the main loop.
Signed-off-by Tvrtko Ursulin <[email protected]>Cc Sonika Jindal <[email protected]>--- tests/kms_rotation_crc.c | 106 +++++++++++++++-------------------------------- 1 file changed, 33 insertions(+), 73 deletions(-)tests/kms_rotation_crc.c +26
-73@@ -41,6 +41,8 @@ typedef struct {int pos_x;int pos_y;unsigned int w, h; +uint32_t override_fmt; +uint64_t override_tiling; } data_t; static void@@ -92,8 +94,10 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,igt_display_t *display = &data->display;int fb_id, fb_modeset_id;unsigned int w, h; -uint64_t tiling =LOCAL_DRM_FORMAT_MOD_NONE ; -uint32_t pixel_format =DRM_FORMAT_XRGB8888 ; +uint64_t tiling = data->override_tiling ? + data->override_tiling :LOCAL_DRM_FORMAT_MOD_NONE ; +uint32_t pixel_format = data->override_fmt ? + data->override_fmt :DRM_FORMAT_XRGB8888 ;enum igt_commit_style commit =COMMIT_LEGACY ;igt_plane_t *primary;@@ -132,10 +136,12 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,*/ if (data->rotation ==IGT_ROTATION_90 || data->rotation ==IGT_ROTATION_270 ) { - tiling =LOCAL_I915_FORMAT_MOD_Y_TILED ; + tiling = data->override_tiling ? + data->override_tiling :LOCAL_I915_FORMAT_MOD_Y_TILED ; w = h = mode->vdisplay; }else if (plane->is_cursor) { - pixel_format =DRM_FORMAT_ARGB8888 ; + pixel_format = data->override_fmt ? + data->override_fmt :DRM_FORMAT_ARGB8888 ; w = h =128 ; }@@ -196,67 +202,6 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)igt_display_commit (display); } -static void test_unsupported_tiling_pixel_format (data_t *data,enum igt_plane plane_type) -{ -drmModeModeInfo *mode; -igt_display_t *display = &data->display; -igt_output_t *output; -enum pipe pipe; -int fb_tiling_id, fb_565_id; -struct igt_fb fb_565, fb_tiling; - -for_each_connected_output (display, output) { -for_each_pipe (display, pipe) { -igt_plane_t *plane; - -igt_output_set_pipe (output, pipe); - - plane =igt_output_get_plane (output, plane_type); -igt_require (igt_plane_supports_rotation (plane)); - mode =igt_output_get_mode (output); - - fb_tiling_id =igt_create_fb (data->gfx_fd, - mode->hdisplay, mode->vdisplay, -DRM_FORMAT_XRGB8888 , -LOCAL_DRM_FORMAT_MOD_NONE , - &fb_tiling); -igt_assert (fb_tiling_id); -igt_plane_set_fb (plane, &fb_tiling); -/* For the first modeset with legacy commit */ -igt_display_commit (display); -igt_plane_set_rotation (plane, data->rotation); -/* Shud fail because 90/270 is only supported with Y/Yf */ -igt_assert (igt_display_try_commit2 (display,COMMIT_UNIVERSAL ) == -EINVAL ); - - fb_565_id =igt_create_fb (data->gfx_fd, - mode->hdisplay, mode->vdisplay, -DRM_FORMAT_RGB565 , -LOCAL_I915_FORMAT_MOD_Y_TILED , - &fb_565); -igt_assert (fb_565_id); -igt_plane_set_fb (plane, &fb_565); -igt_plane_set_rotation (plane, data->rotation); -/* Shud fail because 90/270 is not supported with RGB565 */ -igt_assert (igt_display_try_commit2 (display,COMMIT_UNIVERSAL ) == -EINVAL ); - -/* -* check the rotation state has been reset when the VT -* mode is restored -*/ -kmstest_restore_vt_mode (); -kmstest_set_vt_graphics_mode (); -prepare_crtc (data, output, pipe, plane); - -igt_remove_fb (data->gfx_fd, &fb_tiling); -igt_remove_fb (data->gfx_fd, &fb_565); -cleanup_crtc (data, output, plane); - -igt_display_commit (display); - - } - } -} -static void test_plane_rotation (data_t *data,enum igt_plane plane_type) {igt_display_t *display = &data->display;@@ -265,6 +210,7 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)int valid_tests =0 ;igt_crc_t crc_output, crc_unrotated;enum igt_commit_style commit =COMMIT_LEGACY ; +int ret;if (plane_type ==IGT_PLANE_PRIMARY || plane_type ==IGT_PLANE_CURSOR ) {igt_require (data->display.has_universal_planes);@@ -288,11 +234,16 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)igt_pipe_crc_collect_crc (data->pipe_crc, &crc_unrotated);igt_plane_set_rotation (plane, data->rotation); -igt_display_commit2 (display, commit); - -igt_pipe_crc_collect_crc (data->pipe_crc, &crc_output); - -igt_assert_crc_equal (&data->ref_crc, &crc_output); + ret =igt_display_try_commit2 (display, commit); +if (data->override_fmt || data->override_tiling) { +igt_assert (ret == -EINVAL ); + }else { +igt_assert (ret ==0 ); +igt_pipe_crc_collect_crc (data->pipe_crc, + &crc_output); +igt_assert_crc_equal (&data->ref_crc, + &crc_output); + }/* * check the rotation state has been reset when the VT @@ -376,12 +327,21 @@ igt_maintest_plane_rotation (&data,IGT_PLANE_2 ); } - igt_subtest_f("90-rotation-unsupported-tiling-pixel-format") { + igt_subtest_f("bad-pixel-format") {igt_require (gen >=9 ); - data.rotation =IGT_ROTATION_90 ; data.pos_x =0 , data.pos_y =0 ; -test_unsupported_tiling_pixel_format (&data,IGT_PLANE_PRIMARY ); + data.rotation =IGT_ROTATION_90 ; + data.override_fmt =DRM_FORMAT_RGB565 ; +test_plane_rotation (&data,IGT_PLANE_PRIMARY ); + }
tests/kms_rotation_crc.c igt_main · line 347
Quoted 10 lines
tests/kms_rotation_crc.c +7
-0+ + igt_subtest_f("bad-tiling") { +igt_require (gen >=9 ); + data.override_fmt =0 ; + data.rotation =IGT_ROTATION_90 ; + data.override_tiling =LOCAL_DRM_FORMAT_MOD_NONE ; +test_plane_rotation (&data,IGT_PLANE_PRIMARY ); } igt_fixture {
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t 7/7] kms_rotation_crc: Use main test for negative cases
Quoted 4 lines · Sonika
Thanks Tvrtko.
This series makeskms_rotation_crcmuch cleaner :)Reviewed-by Sonika Jindal <[email protected]>
Thanks, I've pushed the whole series.
Quoted 198 lines · Tvrtko Ursulin
Quoted 194 lines
From: Tvrtko Ursulin <[email protected]>
Saves a good amount of code duplication by supporting expected failures from the main loop.
Signed-off-by Tvrtko Ursulin <[email protected]>Cc Sonika Jindal <[email protected]>--- tests/kms_rotation_crc.c | 106 +++++++++++++++-------------------------------- 1 file changed, 33 insertions(+), 73 deletions(-)tests/kms_rotation_crc.c +6
-2@@ -41,6 +41,8 @@ typedef struct {int pos_x;int pos_y;unsigned int w, h; +uint32_t override_fmt; +uint64_t override_tiling; } data_t; static void@@ -92,8 +94,10 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe, igt_display_t *display = &data->display;int fb_id, fb_modeset_id;unsigned int w, h; -uint64_t tiling =LOCAL_DRM_FORMAT_MOD_NONE ; -uint32_t pixel_format =DRM_FORMAT_XRGB8888 ; +uint64_t tiling = data->override_tiling ? + data->override_tiling :LOCAL_DRM_FORMAT_MOD_NONE ; +uint32_t pixel_format = data->override_fmt ? + data->override_fmt :DRM_FORMAT_XRGB8888 ;enum igt_commit_style commit =COMMIT_LEGACY ;igt_plane_t *primary;tests/kms_rotation_crc.c +4
-2@@ -132,10 +136,12 @@ static void prepare_crtc(data_t *data, igt_output_t*output, enum pipe pipe, */ if (data->rotation ==IGT_ROTATION_90 || data->rotation ==IGT_ROTATION_270 ) { - tiling =LOCAL_I915_FORMAT_MOD_Y_TILED ; + tiling = data->override_tiling ? + data->override_tiling :LOCAL_I915_FORMAT_MOD_Y_TILED ; w = h = mode->vdisplay; }else if (plane->is_cursor) { - pixel_format =DRM_FORMAT_ARGB8888 ; + pixel_format = data->override_fmt ? + data->override_fmt :DRM_FORMAT_ARGB8888 ; w = h =128 ;}tests/kms_rotation_crc.c +0
-30@@ -196,67 +202,6 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)igt_display_commit (display); } -static void test_unsupported_tiling_pixel_format (data_t *data,enum igt_plane plane_type) -{ -drmModeModeInfo *mode; -igt_display_t *display = &data->display; -igt_output_t *output; -enum pipe pipe; -int fb_tiling_id, fb_565_id; -struct igt_fb fb_565, fb_tiling; - -for_each_connected_output (display, output) { -for_each_pipe (display, pipe) { -igt_plane_t *plane; - -igt_output_set_pipe (output, pipe); - - plane =igt_output_get_plane (output, plane_type); -igt_require (igt_plane_supports_rotation (plane)); - mode =igt_output_get_mode (output); - - fb_tiling_id =igt_create_fb (data->gfx_fd, - mode->hdisplay, mode->vdisplay, -DRM_FORMAT_XRGB8888 , -LOCAL_DRM_FORMAT_MOD_NONE , - &fb_tiling); -igt_assert (fb_tiling_id); -igt_plane_set_fb (plane, &fb_tiling); -/* For the first modeset with legacy commit */ -igt_display_commit (display); -igt_plane_set_rotation (plane, data->rotation); -/* Shud fail because 90/270 is only supported with Y/Yf */
- igt_assert(igt_display_try_commit2(display,COMMIT_UNIVERSAL) ==-EINVAL);tests/kms_rotation_crc.c +0
-10- - fb_565_id =igt_create_fb (data->gfx_fd, - mode->hdisplay, mode->vdisplay, -DRM_FORMAT_RGB565 , -LOCAL_I915_FORMAT_MOD_Y_TILED , - &fb_565); -igt_assert (fb_565_id); -igt_plane_set_fb (plane, &fb_565); -igt_plane_set_rotation (plane, data->rotation); -/* Shud fail because 90/270 is not supported with RGB565 */
- igt_assert(igt_display_try_commit2(display,COMMIT_UNIVERSAL) ==-EINVAL);tests/kms_rotation_crc.c +0
-3- -/* -* check the rotation state has been reset when the VT
tests/kms_rotation_crc.c +1
-16-* mode is restored -*/ -kmstest_restore_vt_mode (); -kmstest_set_vt_graphics_mode (); -prepare_crtc (data, output, pipe, plane); - -igt_remove_fb (data->gfx_fd, &fb_tiling); -igt_remove_fb (data->gfx_fd, &fb_565); -cleanup_crtc (data, output, plane); - -igt_display_commit (display); - - } - } -} -static void test_plane_rotation (data_t *data,enum igt_plane plane_type) {igt_display_t *display = &data->display;@@ -265,6 +210,7 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)int valid_tests =0 ;igt_crc_t crc_output, crc_unrotated;enum igt_commit_style commit =COMMIT_LEGACY ; +int ret; if (plane_type == IGT_PLANE_PRIMARY || plane_type ==IGT_PLANE_CURSOR) { igt_require(data->display.has_universal_planes);tests/kms_rotation_crc.c +10
-5@@ -288,11 +234,16 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type) igt_pipe_crc_collect_crc(data->pipe_crc, &crc_unrotated);igt_plane_set_rotation (plane, data->rotation); -igt_display_commit2 (display, commit); - -igt_pipe_crc_collect_crc (data->pipe_crc, &crc_output); - -igt_assert_crc_equal (&data->ref_crc, &crc_output); + ret =igt_display_try_commit2 (display, commit); +if (data->override_fmt || data->override_tiling) { +igt_assert (ret == -EINVAL ); + }else { +igt_assert (ret ==0 ); +igt_pipe_crc_collect_crc (data->pipe_crc, + &crc_output); +igt_assert_crc_equal (&data->ref_crc, + &crc_output); + }/*
* check the rotation state has been reset when
the VTtests/kms_rotation_crc.c +12
-3@@ -376,12 +327,21 @@ igt_maintest_plane_rotation (&data,IGT_PLANE_2 ); } - igt_subtest_f("90-rotation-unsupported-tiling-pixel-format") { + igt_subtest_f("bad-pixel-format") {igt_require (gen >=9 ); - data.rotation =IGT_ROTATION_90 ; data.pos_x =0 , data.pos_y =0 ; -test_unsupported_tiling_pixel_format (&data, IGT_PLANE_PRIMARY); + data.rotation =IGT_ROTATION_90 ; + data.override_fmt =DRM_FORMAT_RGB565 ; +test_plane_rotation (&data,IGT_PLANE_PRIMARY ); + } + + igt_subtest_f("bad-tiling") { +igt_require (gen >=9 ); + data.override_fmt =0 ; + data.rotation =IGT_ROTATION_90 ; + data.override_tiling =LOCAL_DRM_FORMAT_MOD_NONE ; +test_plane_rotation (&data,IGT_PLANE_PRIMARY ); }
Quoted 6 lines
Quoted 2 lines
igt_fixture {_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx