igt_pipe_refresh was added for the forked helper, we could just call it
from the fork to prevent races against MODE_ID.

The static 1024x768 mode is allocated on the stack and returned, which will
result in a garbage mode. Make the fallback mode global to prevent this.

igt_output_set_pipe is unneeded, override_mode is enough to force the
right mode.

Signed-off-by: Maarten Lankhorst <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103342
---
 tests/kms_concurrent.c | 43 ++++++++++++++++++++-----------------------
 1 file changed, 20 insertions(+), 23 deletions(-)

diff --git a/tests/kms_concurrent.c b/tests/kms_concurrent.c
index 7f44c596b4c4..3b2e601505c4 100644
--- a/tests/kms_concurrent.c
+++ b/tests/kms_concurrent.c
@@ -91,8 +91,6 @@ static void test_fini(data_t *data, enum pipe pipe, int 
n_planes,
 {
        int i;
 
-       igt_pipe_refresh(&data->display, pipe, true);
-
        for (i = 0; i < n_planes; i++) {
                igt_plane_t *plane = data->plane[i];
 
@@ -228,6 +226,8 @@ test_plane_position_with_output(data_t *data, enum pipe 
pipe, igt_output_t *outp
        bool loop_forever = opt.iterations == LOOP_FOREVER ? true : false;
        int max_planes = data->display.pipes[pipe].n_planes;
 
+       igt_pipe_refresh(&data->display, pipe, true);
+
        i = 0;
        while (i < iterations || loop_forever) {
                prepare_planes(data, pipe, max_planes, output);
@@ -237,27 +237,28 @@ test_plane_position_with_output(data_t *data, enum pipe 
pipe, igt_output_t *outp
        }
 }
 
+static drmModeModeInfo std_1024_mode = {
+       .clock = 65000,
+       .hdisplay = 1024,
+       .hsync_start = 1048,
+       .hsync_end = 1184,
+       .htotal = 1344,
+       .hskew = 0,
+       .vdisplay = 768,
+       .vsync_start = 771,
+       .vsync_end = 777,
+       .vtotal = 806,
+       .vscan = 0,
+       .vrefresh = 60,
+       .flags = 0xA,
+       .type = 0x40,
+       .name = "Custom 1024x768",
+};
+
 static drmModeModeInfo *
 get_lowres_mode(data_t *data, drmModeModeInfo *mode_default,
                igt_output_t *output)
 {
-       drmModeModeInfo std_1024_mode = {
-               .clock = 65000,
-               .hdisplay = 1024,
-               .hsync_start = 1048,
-               .hsync_end = 1184,
-               .htotal = 1344,
-               .hskew = 0,
-               .vdisplay = 768,
-               .vsync_start = 771,
-               .vsync_end = 777,
-               .vtotal = 806,
-               .vscan = 0,
-               .vrefresh = 60,
-               .flags = 0xA,
-               .type = 0x40,
-               .name = "Custom 1024x768",
-       };
        drmModeModeInfo *mode = &std_1024_mode;
        drmModeConnector *connector = output->config.connector;
        int limit = mode_default->vdisplay - SIZE_PLANE;
@@ -292,19 +293,15 @@ test_resolution_with_output(data_t *data, enum pipe pipe, 
igt_output_t *output)
 
        i = 0;
        while (i < iterations || loop_forever) {
-               igt_pipe_refresh(&data->display, pipe, true);
-
                mode_hi = igt_output_get_mode(output);
                mode_lo = get_lowres_mode(data, mode_hi, output);
 
                /* switch to lower resolution */
                igt_output_override_mode(output, mode_lo);
-               igt_output_set_pipe(output, pipe);
                igt_display_commit2(&data->display, COMMIT_ATOMIC);
 
                /* switch back to higher resolution */
                igt_output_override_mode(output, NULL);
-               igt_output_set_pipe(output, pipe);
                igt_display_commit2(&data->display, COMMIT_ATOMIC);
 
                i++;
-- 
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to