[PATCH i-g-t v6 11/12] benchmarks/kms_fb_stress: Create a benchmark for writeback formats
Arthur Grillo
arthurgrillo at riseup.net
Fri Sep 13 00:39:35 UTC 2024
Create a benchmark that tests the performance of each supported format
for the writeback.
As IGT lib doesn't have a way to get the writeback formats it's needed
to call DRM directly.
Signed-off-by: Arthur Grillo <arthurgrillo at riseup.net>
---
benchmarks/kms_fb_stress.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/benchmarks/kms_fb_stress.c b/benchmarks/kms_fb_stress.c
index 57df3ae2bac9..818201f1b8b6 100644
--- a/benchmarks/kms_fb_stress.c
+++ b/benchmarks/kms_fb_stress.c
@@ -36,6 +36,8 @@ struct data_t {
int fd;
igt_display_t display;
igt_output_t *wb_output;
+ uint32_t *wb_formats;
+ size_t num_wb_formats;
drmModeModeInfo *mode;
struct kms_t kms;
};
@@ -148,6 +150,25 @@ static void set_crtc_size(struct data_t *data)
igt_assert_f(0, "CRTC size %dx%d not supported\n", crtc->width, crtc->height);
}
+static drmModePropertyBlobRes *get_writeback_formats_blob(igt_output_t *output)
+{
+ drmModePropertyBlobRes *blob = NULL;
+ uint64_t blob_id;
+ int ret;
+
+ ret = kmstest_get_property(output->display->drm_fd,
+ output->config.connector->connector_id,
+ DRM_MODE_OBJECT_CONNECTOR,
+ igt_connector_prop_names[IGT_CONNECTOR_WRITEBACK_PIXEL_FORMATS],
+ NULL, &blob_id, NULL);
+ if (ret)
+ blob = drmModeGetPropertyBlob(output->display->drm_fd, blob_id);
+
+ igt_assert(blob);
+
+ return blob;
+}
+
static void stress_driver(struct data_t *data)
{
struct timespec then, now;
@@ -274,6 +295,7 @@ igt_main
igt_fixture {
int ret;
+ drmModePropertyBlobRes *blob;
data.kms = default_kms;
@@ -313,6 +335,15 @@ igt_main
DRM_PLANE_TYPE_OVERLAY,
1);
igt_assert(data.kms.overlay_b.base != NULL);
+
+ blob = get_writeback_formats_blob(data.wb_output);
+ igt_assert(blob->length % 4 == 0);
+
+ data.num_wb_formats = blob->length / 4;
+ data.wb_formats = malloc(sizeof(uint32_t) * data.num_wb_formats);
+
+ for (size_t i = 0; i < data.num_wb_formats; i++)
+ data.wb_formats[i] = *(uint32_t *)(blob->data + i * 4);
}
igt_subtest("default-stress") {
@@ -344,6 +375,26 @@ igt_main
}
}
+ igt_subtest("writeback") {
+ data.kms.primary.enable = false;
+ data.kms.overlay_a.enable = false;
+ data.kms.overlay_b.enable = false;
+ data.kms.writeback.enable = true;
+
+ for (size_t i = 0; i < data.num_wb_formats; i++) {
+ data.kms.writeback.format = data.wb_formats[i];
+
+ if (!igt_fb_supported_format(data.kms.writeback.format)) {
+ igt_warn("Format 0x%x(%.4s) is not supported by IGT\n",
+ data.kms.writeback.format,
+ (char *)&data.kms.writeback.format);
+ continue;
+ }
+
+ stress_driver(&data);
+ }
+ }
+
igt_fixture {
igt_display_fini(&data.display);
drm_close_driver(data.fd);
--
2.46.0
More information about the igt-dev
mailing list