From: Sowmiya S <sowmiya.s@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: suraj.kandpal@intel.com, swati2.sharma@intel.com,
Sowmiya S <sowmiya.s@intel.com>
Subject: [PATCH i-g-t v5 4/6] tests/kms_writeback: Refactor format handling in commit_and_dump_fb
Date: Thu, 8 Jan 2026 21:18:15 +0530 [thread overview]
Message-ID: <20260108154817.48665-5-sowmiya.s@intel.com> (raw)
In-Reply-To: <20260108154817.48665-1-sowmiya.s@intel.com>
Modify commit_and_dump_fb to select supported
formats if provided; Apply default format based
on the platform when none are specified.
v4: Add get format function to assign format
based on vendor type as a default format.
v5: Change function name more descriptive
Signed-off-by: Sowmiya S <sowmiya.s@intel.com>
---
tests/kms_writeback.c | 38 +++++++++++++++++++++++++++++++++++---
1 file changed, 35 insertions(+), 3 deletions(-)
diff --git a/tests/kms_writeback.c b/tests/kms_writeback.c
index defe43686..be123adcc 100644
--- a/tests/kms_writeback.c
+++ b/tests/kms_writeback.c
@@ -101,6 +101,13 @@ const uint32_t fourcc[] = {
DRM_FORMAT_XBGR2101010,
};
+static uint32_t get_default_format_by_vendor(igt_display_t *display)
+{
+ if (is_intel_device(display->drm_fd))
+ return DRM_FORMAT_XBGR8888;
+ return DRM_FORMAT_XRGB8888;
+}
+
static bool check_writeback_config(igt_display_t *display, igt_output_t *output,
drmModeModeInfo override_mode)
{
@@ -447,7 +454,7 @@ static void do_single_commit(igt_output_t *output, igt_plane_t *plane, igt_fb_t
}
static void commit_and_dump_fb(igt_display_t *display, igt_output_t *output, igt_plane_t *plane,
- igt_fb_t *input_fb, drmModeModeInfo *mode)
+ igt_fb_t *input_fb, drmModeModeInfo *mode)
{
cairo_surface_t *fb_surface_out;
char filepath_out[PATH_MAX];
@@ -456,12 +463,37 @@ static void commit_and_dump_fb(igt_display_t *display, igt_output_t *output, igt
char *file_name;
unsigned int fb_id;
igt_fb_t output_fb;
+ uint32_t format;
path_name = getenv("IGT_FRAME_DUMP_PATH");
file_name = getenv("FRAME_PNG_FILE_NAME");
+ if (!data.wb_fmt) {
+ format = get_default_format_by_vendor(display);
+ } else {
+ drmModePropertyBlobRes *formats_blob;
+
+ formats_blob = igt_get_writeback_formats_blob(output);
+ igt_assert_f(formats_blob, "No writeback pixel formats\n");
+ igt_assert(!(formats_blob->length % 4));
+ for (int i = 0; i < formats_blob->length; i++) {
+ format = ((uint32_t *)formats_blob->data)[i];
+ // Skip zero or unknown formats
+ if (format == 0 || strcmp(igt_format_str(format), "invalid") == 0) {
+ format = 0;
+ continue;
+ }
+ igt_debug("Supported writeback format: %s\n", igt_format_str(format));
+ if (format == data.format)
+ break;
+ format = 0;
+ }
+ drmModeFreePropertyBlob(formats_blob);
+ }
+ igt_assert_f(format, "Given format not supported\n");
+
fb_id = igt_create_fb(display->drm_fd, mode->hdisplay, mode->vdisplay,
- data.wb_fmt ? data.format : DRM_FORMAT_XRGB8888,
+ format,
igt_fb_mod_to_tiling(0), &output_fb);
igt_require(fb_id > 0);
@@ -584,7 +616,7 @@ int igt_main_args("b:c:f:dl", long_options, help_str, opt_handler, NULL)
fb_id = igt_create_fb(display.drm_fd, mode.hdisplay,
mode.vdisplay,
- DRM_FORMAT_XRGB8888,
+ get_default_format_by_vendor(&display),
DRM_FORMAT_MOD_LINEAR,
&input_fb);
igt_assert(fb_id >= 0);
--
2.43.0
next prev parent reply other threads:[~2026-01-08 15:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-08 15:48 [PATCH i-g-t v5 0/6] Add writeback changes for intel-supported formats Sowmiya S
2026-01-08 15:48 ` [PATCH i-g-t v5 1/6] tests/kms_writeback: Add support for intel-specific formats Sowmiya S
2026-01-08 15:48 ` [PATCH i-g-t v5 2/6] lib/igt_fb: Validate supported formats for crc calculation Sowmiya S
2026-01-08 15:48 ` [PATCH i-g-t v5 3/6] tests/kms_writeback: Add intel check for vendor-specific restriction Sowmiya S
2026-01-09 3:32 ` Kandpal, Suraj
2026-01-08 15:48 ` Sowmiya S [this message]
2026-01-09 3:35 ` [PATCH i-g-t v5 4/6] tests/kms_writeback: Refactor format handling in commit_and_dump_fb Kandpal, Suraj
2026-01-08 15:48 ` [PATCH i-g-t v5 5/6] tests/kms_writeback: Refactor writeback-fb-id subtest Sowmiya S
2026-01-08 15:48 ` [PATCH i-g-t v5 6/6] tests/kms_writeback: Refactor writeback-check-output subtest Sowmiya S
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260108154817.48665-5-sowmiya.s@intel.com \
--to=sowmiya.s@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=suraj.kandpal@intel.com \
--cc=swati2.sharma@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox