[RFC PATCH v5 02/32] tests/kms_writeback: Fix kms_writeback for VKMS
Harry Wentland
harry.wentland at amd.com
Mon Feb 26 21:13:46 UTC 2024
VKMS doesn't like us to add buffers with unknown fourcc
type. Other drivers might behave similarly. Make sure
we avoid creating 10bpc buffers if they are not supported.
Signed-off-by: Harry Wentland <harry.wentland at amd.com>
---
tests/kms_writeback.c | 37 +++++++++++++++++++++----------------
1 file changed, 21 insertions(+), 16 deletions(-)
diff --git a/tests/kms_writeback.c b/tests/kms_writeback.c
index cda13b850dfb..8d9f502f88f1 100644
--- a/tests/kms_writeback.c
+++ b/tests/kms_writeback.c
@@ -133,21 +133,24 @@ static bool check_writeback_config(igt_display_t *display, igt_output_t *output,
height = override_mode.vdisplay;
for (i = 0; i < sizeof(fourcc) / sizeof(uint32_t); i++) {
-
- ret = igt_create_fb(display->drm_fd, width, height,
- fourcc[i], modifier, &input_fb);
- igt_assert(ret >= 0);
-
- ret = igt_create_fb(display->drm_fd, width, height,
- fourcc[i], modifier, &output_fb);
- igt_assert(ret >= 0);
-
plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+
+ if (!igt_plane_has_format_mod(plane, fourcc[i], DRM_FORMAT_MOD_LINEAR))
+ continue;
+
+ ret = igt_create_fb(display->drm_fd, width, height,
+ fourcc[i], modifier, &input_fb);
+ igt_assert(ret >= 0);
+
+ ret = igt_create_fb(display->drm_fd, width, height,
+ fourcc[i], modifier, &output_fb);
+ igt_assert(ret >= 0);
+
igt_plane_set_fb(plane, &input_fb);
igt_output_set_writeback_fb(output, &output_fb);
ret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_TEST_ONLY |
- DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+ DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
igt_plane_set_fb(plane, NULL);
igt_remove_fb(display->drm_fd, &input_fb);
igt_remove_fb(display->drm_fd, &output_fb);
@@ -589,12 +592,14 @@ igt_main_args("b:c:f:dl", long_options, help_str, opt_handler, NULL)
&input_fb);
igt_assert(fb_id >= 0);
- fb_id = igt_create_fb(display.drm_fd, mode.hdisplay,
- mode.vdisplay,
- DRM_FORMAT_XRGB2101010,
- DRM_FORMAT_MOD_LINEAR,
- &input_fb_10bit);
- igt_assert(fb_id >= 0);
+ if (igt_plane_has_format_mod(plane, DRM_FORMAT_XRGB2101010, DRM_FORMAT_MOD_LINEAR)) {
+ fb_id = igt_create_fb(display.drm_fd, mode.hdisplay,
+ mode.vdisplay,
+ DRM_FORMAT_XRGB2101010,
+ DRM_FORMAT_MOD_LINEAR,
+ &input_fb_10bit);
+ igt_assert(fb_id >= 0);
+ }
igt_plane_set_fb(plane, &input_fb);
--
2.44.0
More information about the igt-dev
mailing list