[PATCH i-g-t v4 6/7] benchmarks/kms_fb_stress: Optionally enable the overlay planes
Arthur Grillo
arthurgrillo at riseup.net
Thu Apr 11 18:51:16 UTC 2024
In the future, we would like to not use overlay planes, so make them
optional.
Signed-off-by: Arthur Grillo <arthurgrillo at riseup.net>
---
benchmarks/kms_fb_stress.c | 88 +++++++++++++++++++++++++++-------------------
1 file changed, 52 insertions(+), 36 deletions(-)
diff --git a/benchmarks/kms_fb_stress.c b/benchmarks/kms_fb_stress.c
index bb85dfb18d2b..7c5db2ce5af7 100644
--- a/benchmarks/kms_fb_stress.c
+++ b/benchmarks/kms_fb_stress.c
@@ -37,6 +37,7 @@ struct data_t {
igt_output_t *wb_output;
drmModeModeInfo *mode;
struct kms_t kms;
+ bool use_overlay;
};
static void plane_setup(struct plane_t *plane, int index)
@@ -75,30 +76,36 @@ static void gen_fbs(struct data_t *data)
&kms->primary.fbs[i]);
}
- if (have_supported_pixman_stride(data->fd, &kms->overlay_a)) {
- igt_create_color_fb(data->fd,
- kms->overlay_a.rect.width, kms->overlay_a.rect.height,
- kms->overlay_a.format, DRM_FORMAT_MOD_LINEAR,
- i, !i, i,
- &kms->overlay_a.fbs[i]);
- } else {
- igt_create_fb(data->fd,
- kms->overlay_a.rect.width, kms->overlay_a.rect.height,
- kms->overlay_a.format, DRM_FORMAT_MOD_LINEAR,
- &kms->overlay_a.fbs[i]);
- }
-
- if (have_supported_pixman_stride(data->fd, &kms->overlay_b)) {
- igt_create_color_fb(data->fd,
- kms->overlay_b.rect.width, kms->overlay_b.rect.height,
- kms->overlay_b.format, DRM_FORMAT_MOD_LINEAR,
- i, i, !i,
- &kms->overlay_b.fbs[i]);
- } else {
- igt_create_fb(data->fd,
- kms->overlay_b.rect.width, kms->overlay_b.rect.height,
- kms->overlay_b.format, DRM_FORMAT_MOD_LINEAR,
- &kms->overlay_b.fbs[i]);
+ if (data->use_overlay) {
+ if (have_supported_pixman_stride(data->fd, &kms->overlay_a)) {
+ igt_create_color_fb(data->fd,
+ kms->overlay_a.rect.width,
+ kms->overlay_a.rect.height,
+ kms->overlay_a.format, DRM_FORMAT_MOD_LINEAR,
+ i, !i, i,
+ &kms->overlay_a.fbs[i]);
+ } else {
+ igt_create_fb(data->fd,
+ kms->overlay_a.rect.width,
+ kms->overlay_a.rect.height,
+ kms->overlay_a.format, DRM_FORMAT_MOD_LINEAR,
+ &kms->overlay_a.fbs[i]);
+ }
+
+ if (have_supported_pixman_stride(data->fd, &kms->overlay_b)) {
+ igt_create_color_fb(data->fd,
+ kms->overlay_b.rect.width,
+ kms->overlay_b.rect.height,
+ kms->overlay_b.format, DRM_FORMAT_MOD_LINEAR,
+ i, i, !i,
+ &kms->overlay_b.fbs[i]);
+ } else {
+ igt_create_fb(data->fd,
+ kms->overlay_b.rect.width,
+ kms->overlay_b.rect.height,
+ kms->overlay_b.format, DRM_FORMAT_MOD_LINEAR,
+ &kms->overlay_b.fbs[i]);
+ }
}
kms->writeback.rect.width = mode->hdisplay;
@@ -173,12 +180,14 @@ static void stress_driver(struct data_t *data)
igt_info("\tprimary:\n");
igt_info("\t\tformat: %s\n", igt_format_str(data->kms.primary.format));
igt_info("\t\trectangle: " RECT_FMT "\n", RECT_ARG(&data->kms.primary.rect));
- igt_info("\toverlay A:\n");
- igt_info("\t\tformat: %s\n", igt_format_str(data->kms.overlay_a.format));
- igt_info("\t\trectangle: " RECT_FMT "\n", RECT_ARG(&data->kms.overlay_a.rect));
- igt_info("\toverlay B:\n");
- igt_info("\t\tformat: %s\n", igt_format_str(data->kms.overlay_b.format));
- igt_info("\t\trectangle: " RECT_FMT "\n", RECT_ARG(&data->kms.overlay_b.rect));
+ if (data->use_overlay) {
+ igt_info("\toverlay A:\n");
+ igt_info("\t\tformat: %s\n", igt_format_str(data->kms.overlay_a.format));
+ igt_info("\t\trectangle: " RECT_FMT "\n", RECT_ARG(&data->kms.overlay_a.rect));
+ igt_info("\toverlay B:\n");
+ igt_info("\t\tformat: %s\n", igt_format_str(data->kms.overlay_b.format));
+ igt_info("\t\trectangle: " RECT_FMT "\n", RECT_ARG(&data->kms.overlay_b.rect));
+ }
igt_info("\twriteback:\n");
igt_info("\t\tformat: %s\n", igt_format_str(data->kms.writeback.format));
igt_info("\t\trectangle: " RECT_FMT "\n", RECT_ARG(&data->kms.writeback.rect));
@@ -192,9 +201,11 @@ static void stress_driver(struct data_t *data)
plane_setup(&data->kms.primary, fb_index);
- plane_setup(&data->kms.overlay_a, fb_index);
+ if (data->use_overlay) {
+ plane_setup(&data->kms.overlay_a, fb_index);
- plane_setup(&data->kms.overlay_b, fb_index);
+ plane_setup(&data->kms.overlay_b, fb_index);
+ }
igt_output_set_writeback_fb(data->wb_output, &data->kms.writeback.fbs[fb_index]);
@@ -210,14 +221,18 @@ static void stress_driver(struct data_t *data)
elapsed = igt_time_elapsed(&then, &now);
igt_plane_set_fb(data->kms.primary.base, NULL);
- igt_plane_set_fb(data->kms.overlay_a.base, NULL);
- igt_plane_set_fb(data->kms.overlay_b.base, NULL);
+ if (data->use_overlay) {
+ igt_plane_set_fb(data->kms.overlay_a.base, NULL);
+ igt_plane_set_fb(data->kms.overlay_b.base, NULL);
+ }
igt_output_set_writeback_fb(data->wb_output, NULL);
for (int i = 0; i < NUM_FBS; i++) {
igt_remove_fb(data->fd, &data->kms.primary.fbs[i]);
- igt_remove_fb(data->fd, &data->kms.overlay_a.fbs[i]);
- igt_remove_fb(data->fd, &data->kms.overlay_b.fbs[i]);
+ if (data->use_overlay) {
+ igt_remove_fb(data->fd, &data->kms.overlay_a.fbs[i]);
+ igt_remove_fb(data->fd, &data->kms.overlay_b.fbs[i]);
+ }
igt_remove_fb(data->fd, &data->kms.writeback.fbs[i]);
}
@@ -302,6 +317,7 @@ igt_main
}
igt_subtest("default-stress") {
+ data.use_overlay = true;
stress_driver(&data);
}
--
2.44.0
More information about the igt-dev
mailing list