[igt-dev] [PATCH v1] igt/tests: Fix kms_concurrent from skipping

Stanislav Lisovskiy
2019-04-16T08:18:26Z

From: "Lisovskiy, Stanislav" <stanislav.lisovskiy@intel.com>

With current resource/bw limitation paradigm,
we should not skip the whole test case, if we
could not make use of a single pipe.
Now skipping only if all pipes were unusable
with current configuration.

Change-Id: I7677e3e80c74e8b7303fb4edb4aba926afbedb49
Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
---
tests/kms_concurrent.c | 54 ++++++++++++++++++++++++++++++++++++++----
1 file changed, 49 insertions(+), 5 deletions(-)

diff --git a/tests/kms_concurrent.c b/tests/kms_concurrent.c
index d82ca040..7e833846 100644
--- a/tests/kms_concurrent.c
+++ b/tests/kms_concurrent.c
@@ -54,12 +54,17 @@ struct {
/*
* Common code across all tests, acting on data_t
*/
-static void test_init(data_t *data, enum pipe pipe, int n_planes,
+static int test_init(data_t *data, enum pipe pipe, int n_planes,
igt_output_t *output)
{
drmModeModeInfo *mode;
igt_plane_t *primary;
int ret;
+ uint64_t cursor_width, cursor_height;
+ uint64_t plane_width, plane_height;
+
+ do_or_die(drmGetCap(data->display.drm_fd, DRM_CAP_CURSOR_WIDTH, &cursor_width));
+ do_or_die(drmGetCap(data->display.drm_fd, DRM_CAP_CURSOR_HEIGHT, &cursor_height));

data->plane = calloc(n_planes, sizeof(*data->plane));
igt_assert_f(data->plane != NULL, "Failed to allocate memory for planes\n");
@@ -74,7 +79,10 @@ static void test_init(data_t *data, enum pipe pipe, int n_planes,

mode = igt_output_get_mode(output);

- igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+ plane_width = mode->hdisplay;
+ plane_height = mode->vdisplay;
+
+ igt_create_color_fb(data->drm_fd, plane_width, plane_height,
DRM_FORMAT_XRGB8888,
LOCAL_I915_FORMAT_MOD_X_TILED,
0.0f, 0.0f, 1.0f,
@@ -82,8 +90,38 @@ static void test_init(data_t *data, enum pipe pipe, int n_planes,

igt_plane_set_fb(data->plane[primary->index], &data->fb[primary->index]);

- ret = igt_display_try_commit2(&data->display, COMMIT_ATOMIC);
- igt_skip_on(ret != 0);
+ ret = igt_display_try_commit_atomic(&data->display, DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+
+ while (ret) {
+ if (plane_width <= cursor_width)
+ break;
+
+ if (plane_height <= cursor_height)
+ break;
+
+ igt_remove_fb(data->display.drm_fd, &data->fb[primary->index]);
+ plane_width /= 2;
+ plane_height /= 2;
+
+ igt_create_color_fb(data->drm_fd, plane_width, plane_height,
+ DRM_FORMAT_XRGB8888,
+ LOCAL_I915_FORMAT_MOD_X_TILED,
+ 0.0f, 0.0f, 1.0f,
+ &data->fb[primary->index]);
+
+ igt_plane_set_fb(data->plane[primary->index], &data->fb[primary->index]);
+ igt_plane_set_size(data->plane[primary->index], plane_width, plane_height);
+
+ ret = igt_display_try_commit_atomic(&data->display, DRM_MODE_ATOMIC_TEST_ONLY, NULL);
+ }
+ if (ret) {
+ igt_plane_set_fb(data->plane[primary->index], NULL);
+ igt_remove_fb(data->display.drm_fd, &data->fb[primary->index]);
+ igt_output_set_pipe(output, PIPE_NONE);
+ } else {
+ ret = igt_display_try_commit2(&data->display, COMMIT_ATOMIC);
+ }
+ return ret;
}

static void test_fini(data_t *data, enum pipe pipe, int n_planes,
@@ -315,7 +353,13 @@ run_test(data_t *data, enum pipe pipe, igt_output_t *output)
igt_info("Testing resolution with connector %s using pipe %s with seed %d\n",
igt_output_name(output), kmstest_pipe_name(pipe), opt.seed);

- test_init(data, pipe, n_planes, output);
+ /*
+ * If we can't use one pipe due to hardware limitations
+ * let's just continue, skip only if none of the pipes were
+ * usable at all.
+ */
+ if (test_init(data, pipe, n_planes, output))
+ continue;

igt_fork(child, 1) {
test_plane_position_with_output(data, pipe, output);
--
2.17.1