* [igt-dev] [PATCHv2 i-g-t 4/4] tests/kms_async_flips: Test all modifiers
2023-05-18 11:25 ` [igt-dev] [PATCHv2 i-g-t 1/4] tests/kms_async_flips: Get " Arun R Murthy
@ 2023-05-18 11:25 ` Arun R Murthy
2023-05-18 11:58 ` Karthik B S
0 siblings, 1 reply; 6+ messages in thread
From: Arun R Murthy @ 2023-05-18 11:25 UTC (permalink / raw)
To: igt-dev; +Cc: Arun R Murthy
Run the basic async flip test for all modifiers reported
by the plane (for the XRGB8888 format). The driver may not
support async flip with all modifiers so we allow this to fail.
v2: print output name along with the modifier
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
---
tests/kms_async_flips.c | 51 +++++++++++++++++++++++++++++++++--------
1 file changed, 41 insertions(+), 10 deletions(-)
diff --git a/tests/kms_async_flips.c b/tests/kms_async_flips.c
index c86bc18b..3fbd4084 100644
--- a/tests/kms_async_flips.c
+++ b/tests/kms_async_flips.c
@@ -53,6 +53,8 @@ typedef struct {
igt_output_t *output;
unsigned long flip_timestamp_us;
double flip_interval;
+ uint64_t modifier;
+ igt_plane_t *plane;
igt_pipe_crc_t *pipe_crc;
igt_crc_t ref_crc;
int flip_count;
@@ -60,6 +62,7 @@ typedef struct {
bool flip_pending;
enum pipe pipe;
bool alternate_sync_async;
+ bool allow_fail;
} data_t;
static void flip_handler(int fd_, unsigned int sequence, unsigned int tv_sec,
@@ -132,7 +135,7 @@ static void make_fb(data_t *data, struct igt_fb *fb,
rec_width = width / (ARRAY_SIZE(data->bufs) * 2);
igt_create_color_fb(data->drm_fd, width, height, DRM_FORMAT_XRGB8888,
- default_modifier(data), 0.0, 0.0, 0.5, fb);
+ data->modifier, 0.0, 0.0, 0.5, fb);
cr = igt_get_cairo_ctx(data->drm_fd, fb);
igt_paint_color_rand(cr, rec_width * 2 + rec_width * index, 0, rec_width, height);
@@ -158,24 +161,26 @@ static void test_init(data_t *data)
data->refresh_rate = mode->vrefresh;
igt_output_set_pipe(data->output, data->pipe);
+
+ data->plane = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
}
static void test_init_fbs(data_t *data)
{
int i;
uint32_t width, height;
- igt_plane_t *plane;
static uint32_t prev_output_id;
+ static uint64_t prev_modifier;
drmModeModeInfo *mode;
mode = igt_output_get_mode(data->output);
width = mode->hdisplay;
height = mode->vdisplay;
- plane = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
-
- if (prev_output_id != data->output->id) {
+ if (prev_output_id != data->output->id ||
+ prev_modifier != data->modifier) {
prev_output_id = data->output->id;
+ prev_modifier = data->modifier;
if (data->bufs[0].fb_id) {
for (i = 0; i < ARRAY_SIZE(data->bufs); i++)
@@ -186,8 +191,8 @@ static void test_init_fbs(data_t *data)
make_fb(data, &data->bufs[i], width, height, i);
}
- igt_plane_set_fb(plane, &data->bufs[0]);
- igt_plane_set_size(plane, width, height);
+ igt_plane_set_fb(data->plane, &data->bufs[0]);
+ igt_plane_set_size(data->plane, width, height);
igt_display_commit2(&data->display, data->display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
}
@@ -242,8 +247,10 @@ static void test_async_flip(data_t *data)
ret = drmModePageFlip(data->drm_fd, data->crtc_id,
data->bufs[frame % 4].fb_id,
flags, data);
-
- igt_assert(ret == 0);
+ if (frame == 1 && data->allow_fail)
+ igt_skip_on(ret == -EINVAL);
+ else
+ igt_assert(ret == 0);
wait_flip_event(data);
@@ -555,6 +562,8 @@ static void run_test(data_t *data, void (*test)(data_t *))
continue;
test_init(data);
+ data->allow_fail = false;
+ data->modifier = default_modifier(data);
igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(data->pipe), data->output->name) {
test_init_fbs(data);
test(data);
@@ -562,6 +571,28 @@ static void run_test(data_t *data, void (*test)(data_t *))
}
}
+static void run_test_with_modifiers(data_t *data, void (*test)(data_t *))
+{
+ for_each_pipe_with_valid_output(&data->display, data->pipe, data->output) {
+ test_init(data);
+
+ for (int i = 0; i < data->plane->format_mod_count; i++) {
+ if (data->plane->formats[i] != DRM_FORMAT_XRGB8888)
+ continue;
+
+ data->allow_fail = true;
+ data->modifier = data->plane->modifiers[i];
+
+ igt_dynamic_f("pipe-%s-%s-%s", kmstest_pipe_name(data->pipe),
+ data->output->name,
+ igt_fb_modifier_name(data->modifier)) {
+ test_init_fbs(data);
+ test(data);
+ }
+ }
+ }
+}
+
static data_t data;
igt_main_args("e", NULL, NULL, NULL, &data)
@@ -592,7 +623,7 @@ igt_main_args("e", NULL, NULL, NULL, &data)
igt_describe("Wait for page flip events in between successive asynchronous flips");
igt_subtest_with_dynamic("async-flip-with-page-flip-events") {
data.alternate_sync_async = false;
- run_test(&data, test_async_flip);
+ run_test_with_modifiers(&data, test_async_flip);
}
igt_describe("Alternate between sync and async flips");
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [igt-dev] [PATCHv2 i-g-t 4/4] tests/kms_async_flips: Test all modifiers
2023-05-18 11:25 ` [igt-dev] [PATCHv2 i-g-t 4/4] tests/kms_async_flips: Test all modifiers Arun R Murthy
@ 2023-05-18 11:58 ` Karthik B S
0 siblings, 0 replies; 6+ messages in thread
From: Karthik B S @ 2023-05-18 11:58 UTC (permalink / raw)
To: Arun R Murthy, igt-dev
On 5/18/2023 4:55 PM, Arun R Murthy wrote:
> Run the basic async flip test for all modifiers reported
> by the plane (for the XRGB8888 format). The driver may not
> support async flip with all modifiers so we allow this to fail.
>
> v2: print output name along with the modifier
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
Reviewed-by: Karthik B S <karthik.b.s@intel.com>
> ---
> tests/kms_async_flips.c | 51 +++++++++++++++++++++++++++++++++--------
> 1 file changed, 41 insertions(+), 10 deletions(-)
>
> diff --git a/tests/kms_async_flips.c b/tests/kms_async_flips.c
> index c86bc18b..3fbd4084 100644
> --- a/tests/kms_async_flips.c
> +++ b/tests/kms_async_flips.c
> @@ -53,6 +53,8 @@ typedef struct {
> igt_output_t *output;
> unsigned long flip_timestamp_us;
> double flip_interval;
> + uint64_t modifier;
> + igt_plane_t *plane;
> igt_pipe_crc_t *pipe_crc;
> igt_crc_t ref_crc;
> int flip_count;
> @@ -60,6 +62,7 @@ typedef struct {
> bool flip_pending;
> enum pipe pipe;
> bool alternate_sync_async;
> + bool allow_fail;
> } data_t;
>
> static void flip_handler(int fd_, unsigned int sequence, unsigned int tv_sec,
> @@ -132,7 +135,7 @@ static void make_fb(data_t *data, struct igt_fb *fb,
> rec_width = width / (ARRAY_SIZE(data->bufs) * 2);
>
> igt_create_color_fb(data->drm_fd, width, height, DRM_FORMAT_XRGB8888,
> - default_modifier(data), 0.0, 0.0, 0.5, fb);
> + data->modifier, 0.0, 0.0, 0.5, fb);
>
> cr = igt_get_cairo_ctx(data->drm_fd, fb);
> igt_paint_color_rand(cr, rec_width * 2 + rec_width * index, 0, rec_width, height);
> @@ -158,24 +161,26 @@ static void test_init(data_t *data)
> data->refresh_rate = mode->vrefresh;
>
> igt_output_set_pipe(data->output, data->pipe);
> +
> + data->plane = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
> }
>
> static void test_init_fbs(data_t *data)
> {
> int i;
> uint32_t width, height;
> - igt_plane_t *plane;
> static uint32_t prev_output_id;
> + static uint64_t prev_modifier;
> drmModeModeInfo *mode;
>
> mode = igt_output_get_mode(data->output);
> width = mode->hdisplay;
> height = mode->vdisplay;
>
> - plane = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
> -
> - if (prev_output_id != data->output->id) {
> + if (prev_output_id != data->output->id ||
> + prev_modifier != data->modifier) {
> prev_output_id = data->output->id;
> + prev_modifier = data->modifier;
>
> if (data->bufs[0].fb_id) {
> for (i = 0; i < ARRAY_SIZE(data->bufs); i++)
> @@ -186,8 +191,8 @@ static void test_init_fbs(data_t *data)
> make_fb(data, &data->bufs[i], width, height, i);
> }
>
> - igt_plane_set_fb(plane, &data->bufs[0]);
> - igt_plane_set_size(plane, width, height);
> + igt_plane_set_fb(data->plane, &data->bufs[0]);
> + igt_plane_set_size(data->plane, width, height);
>
> igt_display_commit2(&data->display, data->display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
> }
> @@ -242,8 +247,10 @@ static void test_async_flip(data_t *data)
> ret = drmModePageFlip(data->drm_fd, data->crtc_id,
> data->bufs[frame % 4].fb_id,
> flags, data);
> -
> - igt_assert(ret == 0);
> + if (frame == 1 && data->allow_fail)
> + igt_skip_on(ret == -EINVAL);
> + else
> + igt_assert(ret == 0);
>
> wait_flip_event(data);
>
> @@ -555,6 +562,8 @@ static void run_test(data_t *data, void (*test)(data_t *))
> continue;
>
> test_init(data);
> + data->allow_fail = false;
> + data->modifier = default_modifier(data);
> igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(data->pipe), data->output->name) {
> test_init_fbs(data);
> test(data);
> @@ -562,6 +571,28 @@ static void run_test(data_t *data, void (*test)(data_t *))
> }
> }
>
> +static void run_test_with_modifiers(data_t *data, void (*test)(data_t *))
> +{
> + for_each_pipe_with_valid_output(&data->display, data->pipe, data->output) {
> + test_init(data);
> +
> + for (int i = 0; i < data->plane->format_mod_count; i++) {
> + if (data->plane->formats[i] != DRM_FORMAT_XRGB8888)
> + continue;
> +
> + data->allow_fail = true;
> + data->modifier = data->plane->modifiers[i];
> +
> + igt_dynamic_f("pipe-%s-%s-%s", kmstest_pipe_name(data->pipe),
> + data->output->name,
> + igt_fb_modifier_name(data->modifier)) {
> + test_init_fbs(data);
> + test(data);
> + }
> + }
> + }
> +}
> +
> static data_t data;
>
> igt_main_args("e", NULL, NULL, NULL, &data)
> @@ -592,7 +623,7 @@ igt_main_args("e", NULL, NULL, NULL, &data)
> igt_describe("Wait for page flip events in between successive asynchronous flips");
> igt_subtest_with_dynamic("async-flip-with-page-flip-events") {
> data.alternate_sync_async = false;
> - run_test(&data, test_async_flip);
> + run_test_with_modifiers(&data, test_async_flip);
> }
>
> igt_describe("Alternate between sync and async flips");
^ permalink raw reply [flat|nested] 6+ messages in thread
* [igt-dev] [PATCHv2 i-g-t 4/4] tests/kms_async_flips: Test all modifiers
2023-05-18 12:13 [igt-dev] [PATCHv2 i-g-t 1/4] tests/kms_async_flips: Get rid of i915 specific fb creation Arun R Murthy
@ 2023-05-18 12:13 ` Arun R Murthy
2023-05-19 4:32 ` Arun R Murthy
0 siblings, 1 reply; 6+ messages in thread
From: Arun R Murthy @ 2023-05-18 12:13 UTC (permalink / raw)
To: igt-dev; +Cc: Arun R Murthy
Run the basic async flip test for all modifiers reported
by the plane (for the XRGB8888 format). The driver may not
support async flip with all modifiers so we allow this to fail.
v2: print output name along with the modifier
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
---
tests/kms_async_flips.c | 51 +++++++++++++++++++++++++++++++++--------
1 file changed, 41 insertions(+), 10 deletions(-)
diff --git a/tests/kms_async_flips.c b/tests/kms_async_flips.c
index c86bc18b..3fbd4084 100644
--- a/tests/kms_async_flips.c
+++ b/tests/kms_async_flips.c
@@ -53,6 +53,8 @@ typedef struct {
igt_output_t *output;
unsigned long flip_timestamp_us;
double flip_interval;
+ uint64_t modifier;
+ igt_plane_t *plane;
igt_pipe_crc_t *pipe_crc;
igt_crc_t ref_crc;
int flip_count;
@@ -60,6 +62,7 @@ typedef struct {
bool flip_pending;
enum pipe pipe;
bool alternate_sync_async;
+ bool allow_fail;
} data_t;
static void flip_handler(int fd_, unsigned int sequence, unsigned int tv_sec,
@@ -132,7 +135,7 @@ static void make_fb(data_t *data, struct igt_fb *fb,
rec_width = width / (ARRAY_SIZE(data->bufs) * 2);
igt_create_color_fb(data->drm_fd, width, height, DRM_FORMAT_XRGB8888,
- default_modifier(data), 0.0, 0.0, 0.5, fb);
+ data->modifier, 0.0, 0.0, 0.5, fb);
cr = igt_get_cairo_ctx(data->drm_fd, fb);
igt_paint_color_rand(cr, rec_width * 2 + rec_width * index, 0, rec_width, height);
@@ -158,24 +161,26 @@ static void test_init(data_t *data)
data->refresh_rate = mode->vrefresh;
igt_output_set_pipe(data->output, data->pipe);
+
+ data->plane = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
}
static void test_init_fbs(data_t *data)
{
int i;
uint32_t width, height;
- igt_plane_t *plane;
static uint32_t prev_output_id;
+ static uint64_t prev_modifier;
drmModeModeInfo *mode;
mode = igt_output_get_mode(data->output);
width = mode->hdisplay;
height = mode->vdisplay;
- plane = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
-
- if (prev_output_id != data->output->id) {
+ if (prev_output_id != data->output->id ||
+ prev_modifier != data->modifier) {
prev_output_id = data->output->id;
+ prev_modifier = data->modifier;
if (data->bufs[0].fb_id) {
for (i = 0; i < ARRAY_SIZE(data->bufs); i++)
@@ -186,8 +191,8 @@ static void test_init_fbs(data_t *data)
make_fb(data, &data->bufs[i], width, height, i);
}
- igt_plane_set_fb(plane, &data->bufs[0]);
- igt_plane_set_size(plane, width, height);
+ igt_plane_set_fb(data->plane, &data->bufs[0]);
+ igt_plane_set_size(data->plane, width, height);
igt_display_commit2(&data->display, data->display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
}
@@ -242,8 +247,10 @@ static void test_async_flip(data_t *data)
ret = drmModePageFlip(data->drm_fd, data->crtc_id,
data->bufs[frame % 4].fb_id,
flags, data);
-
- igt_assert(ret == 0);
+ if (frame == 1 && data->allow_fail)
+ igt_skip_on(ret == -EINVAL);
+ else
+ igt_assert(ret == 0);
wait_flip_event(data);
@@ -555,6 +562,8 @@ static void run_test(data_t *data, void (*test)(data_t *))
continue;
test_init(data);
+ data->allow_fail = false;
+ data->modifier = default_modifier(data);
igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(data->pipe), data->output->name) {
test_init_fbs(data);
test(data);
@@ -562,6 +571,28 @@ static void run_test(data_t *data, void (*test)(data_t *))
}
}
+static void run_test_with_modifiers(data_t *data, void (*test)(data_t *))
+{
+ for_each_pipe_with_valid_output(&data->display, data->pipe, data->output) {
+ test_init(data);
+
+ for (int i = 0; i < data->plane->format_mod_count; i++) {
+ if (data->plane->formats[i] != DRM_FORMAT_XRGB8888)
+ continue;
+
+ data->allow_fail = true;
+ data->modifier = data->plane->modifiers[i];
+
+ igt_dynamic_f("pipe-%s-%s-%s", kmstest_pipe_name(data->pipe),
+ data->output->name,
+ igt_fb_modifier_name(data->modifier)) {
+ test_init_fbs(data);
+ test(data);
+ }
+ }
+ }
+}
+
static data_t data;
igt_main_args("e", NULL, NULL, NULL, &data)
@@ -592,7 +623,7 @@ igt_main_args("e", NULL, NULL, NULL, &data)
igt_describe("Wait for page flip events in between successive asynchronous flips");
igt_subtest_with_dynamic("async-flip-with-page-flip-events") {
data.alternate_sync_async = false;
- run_test(&data, test_async_flip);
+ run_test_with_modifiers(&data, test_async_flip);
}
igt_describe("Alternate between sync and async flips");
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [igt-dev] [PATCHv2 i-g-t 4/4] tests/kms_async_flips: Test all modifiers
2023-05-18 12:13 ` [igt-dev] [PATCHv2 i-g-t 4/4] tests/kms_async_flips: Test all modifiers Arun R Murthy
@ 2023-05-19 4:32 ` Arun R Murthy
0 siblings, 0 replies; 6+ messages in thread
From: Arun R Murthy @ 2023-05-19 4:32 UTC (permalink / raw)
To: igt-dev; +Cc: Arun R Murthy
Run the basic async flip test for all modifiers reported
by the plane (for the XRGB8888 format). The driver may not
support async flip with all modifiers so we allow this to fail.
v2: print output name along with the modifier
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
Reviewed-by: Karthik B S <karthik.b.s@intel.com>
---
tests/kms_async_flips.c | 51 +++++++++++++++++++++++++++++++++--------
1 file changed, 41 insertions(+), 10 deletions(-)
diff --git a/tests/kms_async_flips.c b/tests/kms_async_flips.c
index c86bc18b..3fbd4084 100644
--- a/tests/kms_async_flips.c
+++ b/tests/kms_async_flips.c
@@ -53,6 +53,8 @@ typedef struct {
igt_output_t *output;
unsigned long flip_timestamp_us;
double flip_interval;
+ uint64_t modifier;
+ igt_plane_t *plane;
igt_pipe_crc_t *pipe_crc;
igt_crc_t ref_crc;
int flip_count;
@@ -60,6 +62,7 @@ typedef struct {
bool flip_pending;
enum pipe pipe;
bool alternate_sync_async;
+ bool allow_fail;
} data_t;
static void flip_handler(int fd_, unsigned int sequence, unsigned int tv_sec,
@@ -132,7 +135,7 @@ static void make_fb(data_t *data, struct igt_fb *fb,
rec_width = width / (ARRAY_SIZE(data->bufs) * 2);
igt_create_color_fb(data->drm_fd, width, height, DRM_FORMAT_XRGB8888,
- default_modifier(data), 0.0, 0.0, 0.5, fb);
+ data->modifier, 0.0, 0.0, 0.5, fb);
cr = igt_get_cairo_ctx(data->drm_fd, fb);
igt_paint_color_rand(cr, rec_width * 2 + rec_width * index, 0, rec_width, height);
@@ -158,24 +161,26 @@ static void test_init(data_t *data)
data->refresh_rate = mode->vrefresh;
igt_output_set_pipe(data->output, data->pipe);
+
+ data->plane = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
}
static void test_init_fbs(data_t *data)
{
int i;
uint32_t width, height;
- igt_plane_t *plane;
static uint32_t prev_output_id;
+ static uint64_t prev_modifier;
drmModeModeInfo *mode;
mode = igt_output_get_mode(data->output);
width = mode->hdisplay;
height = mode->vdisplay;
- plane = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
-
- if (prev_output_id != data->output->id) {
+ if (prev_output_id != data->output->id ||
+ prev_modifier != data->modifier) {
prev_output_id = data->output->id;
+ prev_modifier = data->modifier;
if (data->bufs[0].fb_id) {
for (i = 0; i < ARRAY_SIZE(data->bufs); i++)
@@ -186,8 +191,8 @@ static void test_init_fbs(data_t *data)
make_fb(data, &data->bufs[i], width, height, i);
}
- igt_plane_set_fb(plane, &data->bufs[0]);
- igt_plane_set_size(plane, width, height);
+ igt_plane_set_fb(data->plane, &data->bufs[0]);
+ igt_plane_set_size(data->plane, width, height);
igt_display_commit2(&data->display, data->display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
}
@@ -242,8 +247,10 @@ static void test_async_flip(data_t *data)
ret = drmModePageFlip(data->drm_fd, data->crtc_id,
data->bufs[frame % 4].fb_id,
flags, data);
-
- igt_assert(ret == 0);
+ if (frame == 1 && data->allow_fail)
+ igt_skip_on(ret == -EINVAL);
+ else
+ igt_assert(ret == 0);
wait_flip_event(data);
@@ -555,6 +562,8 @@ static void run_test(data_t *data, void (*test)(data_t *))
continue;
test_init(data);
+ data->allow_fail = false;
+ data->modifier = default_modifier(data);
igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(data->pipe), data->output->name) {
test_init_fbs(data);
test(data);
@@ -562,6 +571,28 @@ static void run_test(data_t *data, void (*test)(data_t *))
}
}
+static void run_test_with_modifiers(data_t *data, void (*test)(data_t *))
+{
+ for_each_pipe_with_valid_output(&data->display, data->pipe, data->output) {
+ test_init(data);
+
+ for (int i = 0; i < data->plane->format_mod_count; i++) {
+ if (data->plane->formats[i] != DRM_FORMAT_XRGB8888)
+ continue;
+
+ data->allow_fail = true;
+ data->modifier = data->plane->modifiers[i];
+
+ igt_dynamic_f("pipe-%s-%s-%s", kmstest_pipe_name(data->pipe),
+ data->output->name,
+ igt_fb_modifier_name(data->modifier)) {
+ test_init_fbs(data);
+ test(data);
+ }
+ }
+ }
+}
+
static data_t data;
igt_main_args("e", NULL, NULL, NULL, &data)
@@ -592,7 +623,7 @@ igt_main_args("e", NULL, NULL, NULL, &data)
igt_describe("Wait for page flip events in between successive asynchronous flips");
igt_subtest_with_dynamic("async-flip-with-page-flip-events") {
data.alternate_sync_async = false;
- run_test(&data, test_async_flip);
+ run_test_with_modifiers(&data, test_async_flip);
}
igt_describe("Alternate between sync and async flips");
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [igt-dev] [PATCHv2 i-g-t 4/4] tests/kms_async_flips: Test all modifiers
[not found] <20230519053447.1332519-4-arun.r.murthy@intel.com>
@ 2023-05-19 6:38 ` Arun R Murthy
0 siblings, 0 replies; 6+ messages in thread
From: Arun R Murthy @ 2023-05-19 6:38 UTC (permalink / raw)
To: igt-dev; +Cc: Arun R Murthy
Run the basic async flip test for all modifiers reported
by the plane (for the XRGB8888 format). The driver may not
support async flip with all modifiers so we allow this to fail.
v2: print output name along with the modifier
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
Reviewed-by: Karthik B S <karthik.b.s@intel.com>
---
tests/kms_async_flips.c | 51 +++++++++++++++++++++++++++++++++--------
1 file changed, 41 insertions(+), 10 deletions(-)
diff --git a/tests/kms_async_flips.c b/tests/kms_async_flips.c
index ccec981c..5cb797de 100644
--- a/tests/kms_async_flips.c
+++ b/tests/kms_async_flips.c
@@ -53,6 +53,8 @@ typedef struct {
igt_output_t *output;
unsigned long flip_timestamp_us;
double flip_interval;
+ uint64_t modifier;
+ igt_plane_t *plane;
igt_pipe_crc_t *pipe_crc;
igt_crc_t ref_crc;
int flip_count;
@@ -60,6 +62,7 @@ typedef struct {
bool flip_pending;
enum pipe pipe;
bool alternate_sync_async;
+ bool allow_fail;
} data_t;
static void flip_handler(int fd_, unsigned int sequence, unsigned int tv_sec,
@@ -132,7 +135,7 @@ static void make_fb(data_t *data, struct igt_fb *fb,
rec_width = width / (ARRAY_SIZE(data->bufs) * 2);
igt_create_color_fb(data->drm_fd, width, height, DRM_FORMAT_XRGB8888,
- default_modifier(data), 0.0, 0.0, 0.5, fb);
+ data->modifier, 0.0, 0.0, 0.5, fb);
cr = igt_get_cairo_ctx(data->drm_fd, fb);
igt_paint_color_rand(cr, rec_width * 2 + rec_width * index, 0, rec_width, height);
@@ -158,24 +161,26 @@ static void test_init(data_t *data)
data->refresh_rate = mode->vrefresh;
igt_output_set_pipe(data->output, data->pipe);
+
+ data->plane = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
}
static void test_init_fbs(data_t *data)
{
int i;
uint32_t width, height;
- igt_plane_t *plane;
static uint32_t prev_output_id;
+ static uint64_t prev_modifier;
drmModeModeInfo *mode;
mode = igt_output_get_mode(data->output);
width = mode->hdisplay;
height = mode->vdisplay;
- plane = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
-
- if (prev_output_id != data->output->id) {
+ if (prev_output_id != data->output->id ||
+ prev_modifier != data->modifier) {
prev_output_id = data->output->id;
+ prev_modifier = data->modifier;
if (data->bufs[0].fb_id) {
for (i = 0; i < ARRAY_SIZE(data->bufs); i++)
@@ -186,8 +191,8 @@ static void test_init_fbs(data_t *data)
make_fb(data, &data->bufs[i], width, height, i);
}
- igt_plane_set_fb(plane, &data->bufs[0]);
- igt_plane_set_size(plane, width, height);
+ igt_plane_set_fb(data->plane, &data->bufs[0]);
+ igt_plane_set_size(data->plane, width, height);
igt_display_commit2(&data->display, data->display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
}
@@ -242,8 +247,10 @@ static void test_async_flip(data_t *data)
ret = drmModePageFlip(data->drm_fd, data->crtc_id,
data->bufs[frame % 4].fb_id,
flags, data);
-
- igt_assert(ret == 0);
+ if (frame == 1 && data->allow_fail)
+ igt_skip_on(ret == -EINVAL);
+ else
+ igt_assert(ret == 0);
wait_flip_event(data);
@@ -555,6 +562,8 @@ static void run_test(data_t *data, void (*test)(data_t *))
continue;
test_init(data);
+ data->allow_fail = false;
+ data->modifier = default_modifier(data);
igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(data->pipe), data->output->name) {
test_init_fbs(data);
test(data);
@@ -562,6 +571,28 @@ static void run_test(data_t *data, void (*test)(data_t *))
}
}
+static void run_test_with_modifiers(data_t *data, void (*test)(data_t *))
+{
+ for_each_pipe_with_valid_output(&data->display, data->pipe, data->output) {
+ test_init(data);
+
+ for (int i = 0; i < data->plane->format_mod_count; i++) {
+ if (data->plane->formats[i] != DRM_FORMAT_XRGB8888)
+ continue;
+
+ data->allow_fail = true;
+ data->modifier = data->plane->modifiers[i];
+
+ igt_dynamic_f("pipe-%s-%s-%s", kmstest_pipe_name(data->pipe),
+ data->output->name,
+ igt_fb_modifier_name(data->modifier)) {
+ test_init_fbs(data);
+ test(data);
+ }
+ }
+ }
+}
+
static data_t data;
igt_main
@@ -592,7 +623,7 @@ igt_main
igt_describe("Wait for page flip events in between successive asynchronous flips");
igt_subtest_with_dynamic("async-flip-with-page-flip-events") {
data.alternate_sync_async = false;
- run_test(&data, test_async_flip);
+ run_test_with_modifiers(&data, test_async_flip);
}
igt_describe("Alternate between sync and async flips");
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [igt-dev] [PATCHv2 i-g-t 4/4] tests/kms_async_flips: Test all modifiers
2023-05-19 6:44 [igt-dev] [PATCH i-g-t 0/4] some cleanup on kms_async_clip Arun R Murthy
@ 2023-05-19 6:44 ` Arun R Murthy
0 siblings, 0 replies; 6+ messages in thread
From: Arun R Murthy @ 2023-05-19 6:44 UTC (permalink / raw)
To: igt-dev; +Cc: Arun R Murthy
Run the basic async flip test for all modifiers reported
by the plane (for the XRGB8888 format). The driver may not
support async flip with all modifiers so we allow this to fail.
v2: print output name along with the modifier
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
Reviewed-by: Karthik B S <karthik.b.s@intel.com>
---
tests/kms_async_flips.c | 51 +++++++++++++++++++++++++++++++++--------
1 file changed, 41 insertions(+), 10 deletions(-)
diff --git a/tests/kms_async_flips.c b/tests/kms_async_flips.c
index ccec981c..5cb797de 100644
--- a/tests/kms_async_flips.c
+++ b/tests/kms_async_flips.c
@@ -53,6 +53,8 @@ typedef struct {
igt_output_t *output;
unsigned long flip_timestamp_us;
double flip_interval;
+ uint64_t modifier;
+ igt_plane_t *plane;
igt_pipe_crc_t *pipe_crc;
igt_crc_t ref_crc;
int flip_count;
@@ -60,6 +62,7 @@ typedef struct {
bool flip_pending;
enum pipe pipe;
bool alternate_sync_async;
+ bool allow_fail;
} data_t;
static void flip_handler(int fd_, unsigned int sequence, unsigned int tv_sec,
@@ -132,7 +135,7 @@ static void make_fb(data_t *data, struct igt_fb *fb,
rec_width = width / (ARRAY_SIZE(data->bufs) * 2);
igt_create_color_fb(data->drm_fd, width, height, DRM_FORMAT_XRGB8888,
- default_modifier(data), 0.0, 0.0, 0.5, fb);
+ data->modifier, 0.0, 0.0, 0.5, fb);
cr = igt_get_cairo_ctx(data->drm_fd, fb);
igt_paint_color_rand(cr, rec_width * 2 + rec_width * index, 0, rec_width, height);
@@ -158,24 +161,26 @@ static void test_init(data_t *data)
data->refresh_rate = mode->vrefresh;
igt_output_set_pipe(data->output, data->pipe);
+
+ data->plane = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
}
static void test_init_fbs(data_t *data)
{
int i;
uint32_t width, height;
- igt_plane_t *plane;
static uint32_t prev_output_id;
+ static uint64_t prev_modifier;
drmModeModeInfo *mode;
mode = igt_output_get_mode(data->output);
width = mode->hdisplay;
height = mode->vdisplay;
- plane = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
-
- if (prev_output_id != data->output->id) {
+ if (prev_output_id != data->output->id ||
+ prev_modifier != data->modifier) {
prev_output_id = data->output->id;
+ prev_modifier = data->modifier;
if (data->bufs[0].fb_id) {
for (i = 0; i < ARRAY_SIZE(data->bufs); i++)
@@ -186,8 +191,8 @@ static void test_init_fbs(data_t *data)
make_fb(data, &data->bufs[i], width, height, i);
}
- igt_plane_set_fb(plane, &data->bufs[0]);
- igt_plane_set_size(plane, width, height);
+ igt_plane_set_fb(data->plane, &data->bufs[0]);
+ igt_plane_set_size(data->plane, width, height);
igt_display_commit2(&data->display, data->display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
}
@@ -242,8 +247,10 @@ static void test_async_flip(data_t *data)
ret = drmModePageFlip(data->drm_fd, data->crtc_id,
data->bufs[frame % 4].fb_id,
flags, data);
-
- igt_assert(ret == 0);
+ if (frame == 1 && data->allow_fail)
+ igt_skip_on(ret == -EINVAL);
+ else
+ igt_assert(ret == 0);
wait_flip_event(data);
@@ -555,6 +562,8 @@ static void run_test(data_t *data, void (*test)(data_t *))
continue;
test_init(data);
+ data->allow_fail = false;
+ data->modifier = default_modifier(data);
igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(data->pipe), data->output->name) {
test_init_fbs(data);
test(data);
@@ -562,6 +571,28 @@ static void run_test(data_t *data, void (*test)(data_t *))
}
}
+static void run_test_with_modifiers(data_t *data, void (*test)(data_t *))
+{
+ for_each_pipe_with_valid_output(&data->display, data->pipe, data->output) {
+ test_init(data);
+
+ for (int i = 0; i < data->plane->format_mod_count; i++) {
+ if (data->plane->formats[i] != DRM_FORMAT_XRGB8888)
+ continue;
+
+ data->allow_fail = true;
+ data->modifier = data->plane->modifiers[i];
+
+ igt_dynamic_f("pipe-%s-%s-%s", kmstest_pipe_name(data->pipe),
+ data->output->name,
+ igt_fb_modifier_name(data->modifier)) {
+ test_init_fbs(data);
+ test(data);
+ }
+ }
+ }
+}
+
static data_t data;
igt_main
@@ -592,7 +623,7 @@ igt_main
igt_describe("Wait for page flip events in between successive asynchronous flips");
igt_subtest_with_dynamic("async-flip-with-page-flip-events") {
data.alternate_sync_async = false;
- run_test(&data, test_async_flip);
+ run_test_with_modifiers(&data, test_async_flip);
}
igt_describe("Alternate between sync and async flips");
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-05-19 6:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20230519053447.1332519-4-arun.r.murthy@intel.com>
2023-05-19 6:38 ` [igt-dev] [PATCHv2 i-g-t 4/4] tests/kms_async_flips: Test all modifiers Arun R Murthy
2023-05-19 6:44 [igt-dev] [PATCH i-g-t 0/4] some cleanup on kms_async_clip Arun R Murthy
2023-05-19 6:44 ` [igt-dev] [PATCHv2 i-g-t 4/4] tests/kms_async_flips: Test all modifiers Arun R Murthy
-- strict thread matches above, loose matches on Subject: below --
2023-05-18 12:13 [igt-dev] [PATCHv2 i-g-t 1/4] tests/kms_async_flips: Get rid of i915 specific fb creation Arun R Murthy
2023-05-18 12:13 ` [igt-dev] [PATCHv2 i-g-t 4/4] tests/kms_async_flips: Test all modifiers Arun R Murthy
2023-05-19 4:32 ` Arun R Murthy
2023-05-16 6:22 [igt-dev] [PATCH i-g-t 1/4] tests/kms_async_flips: Ger rid of i915 specific fb creation Arun R Murthy
2023-05-18 11:25 ` [igt-dev] [PATCHv2 i-g-t 1/4] tests/kms_async_flips: Get " Arun R Murthy
2023-05-18 11:25 ` [igt-dev] [PATCHv2 i-g-t 4/4] tests/kms_async_flips: Test all modifiers Arun R Murthy
2023-05-18 11:58 ` Karthik B S
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox