From: Pranay Samala <pranay.samala@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: karthik.b.s@intel.com, sameer.lattannavar@intel.com,
pranay.samala@intel.com
Subject: [PATCH i-g-t v3 1/3] tests/kms_hdr: Move framebuffer into data_t for centralized cleanup
Date: Wed, 6 May 2026 09:45:25 +0530 [thread overview]
Message-ID: <20260506041527.56862-2-pranay.samala@intel.com> (raw)
In-Reply-To: <20260506041527.56862-1-pranay.samala@intel.com>
Move igt_fb_t afb from local variable in test functions into the
shared data_t struct, and add igt_remove_fb() to test_fini() so the
framebuffer is always freed during cleanup, even when a test exits
early.
v2:
- Update commit message (Karthik)
v3:
- Rebase
Signed-off-by: Pranay Samala <pranay.samala@intel.com>
Reviewed-by: Karthik B S <karthik.b.s@intel.com>
---
tests/kms_hdr.c | 30 +++++++++++++-----------------
1 file changed, 13 insertions(+), 17 deletions(-)
diff --git a/tests/kms_hdr.c b/tests/kms_hdr.c
index 876c1c03a..3cd14c074 100644
--- a/tests/kms_hdr.c
+++ b/tests/kms_hdr.c
@@ -108,12 +108,14 @@ typedef struct data {
int fd;
int w;
int h;
+ igt_fb_t afb;
} data_t;
/* Common test cleanup. */
static void test_fini(data_t *data)
{
igt_pipe_crc_free(data->pipe_crc);
+ igt_remove_fb(data->fd, &data->afb);
igt_display_reset(&data->display);
}
@@ -176,20 +178,19 @@ static void test_bpc_switch_on_output(data_t *data, igt_crtc_t *crtc,
{
igt_display_t *display = &data->display;
igt_crc_t ref_crc, new_crc;
- igt_fb_t afb;
int afb_id, ret;
/* 10-bit formats are slow, so limit the size. */
afb_id = igt_create_fb(data->fd, 512, 512,
- format, DRM_FORMAT_MOD_LINEAR, &afb);
+ format, DRM_FORMAT_MOD_LINEAR, &data->afb);
igt_assert(afb_id);
- draw_hdr_pattern(&afb);
+ draw_hdr_pattern(&data->afb);
/* Plane may be required to fit fullscreen. Check it here and allow
* smaller plane size in following tests.
*/
- igt_plane_set_fb(data->primary, &afb);
+ igt_plane_set_fb(data->primary, &data->afb);
if (igt_crtc_num_scalers(crtc) >= 1)
igt_plane_set_size(data->primary, data->w, data->h);
else
@@ -197,8 +198,8 @@ static void test_bpc_switch_on_output(data_t *data, igt_crtc_t *crtc,
ret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_TEST_ONLY, NULL);
if (!ret) {
- data->w = afb.width;
- data->h = afb.height;
+ data->w = data->afb.width;
+ data->h = data->afb.height;
}
/* Start in 8bpc. */
@@ -237,7 +238,6 @@ static void test_bpc_switch_on_output(data_t *data, igt_crtc_t *crtc,
igt_assert_crc_equal(&ref_crc, &new_crc);
test_fini(data);
- igt_remove_fb(data->fd, &afb);
}
/* Returns true if an output supports max bpc property. */
@@ -347,20 +347,19 @@ static void test_static_toggle(data_t *data, igt_crtc_t *crtc,
igt_display_t *display = &data->display;
struct hdr_output_metadata hdr;
igt_crc_t ref_crc, new_crc;
- igt_fb_t afb;
int afb_id;
/* 10-bit formats are slow, so limit the size. */
afb_id = igt_create_fb(data->fd, 512, 512,
- format, DRM_FORMAT_MOD_LINEAR, &afb);
+ format, DRM_FORMAT_MOD_LINEAR, &data->afb);
igt_assert(afb_id);
- draw_hdr_pattern(&afb);
+ draw_hdr_pattern(&data->afb);
igt_hdr_fill_st2084(&hdr);
/* Start with no metadata. */
- igt_plane_set_fb(data->primary, &afb);
+ igt_plane_set_fb(data->primary, &data->afb);
igt_plane_set_size(data->primary, data->w, data->h);
igt_hdr_set_metadata(data->output, NULL);
igt_output_set_prop_value(data->output, IGT_CONNECTOR_MAX_BPC, 8);
@@ -423,7 +422,6 @@ static void test_static_toggle(data_t *data, igt_crtc_t *crtc,
cleanup:
test_fini(data);
- igt_remove_fb(data->fd, &afb);
}
static void test_static_swap(data_t *data, igt_crtc_t *crtc,
@@ -431,19 +429,18 @@ static void test_static_swap(data_t *data, igt_crtc_t *crtc,
{
igt_display_t *display = &data->display;
igt_crc_t ref_crc, new_crc;
- igt_fb_t afb;
int afb_id;
struct hdr_output_metadata hdr;
/* 10-bit formats are slow, so limit the size. */
afb_id = igt_create_fb(data->fd, 512, 512,
- format, DRM_FORMAT_MOD_LINEAR, &afb);
+ format, DRM_FORMAT_MOD_LINEAR, &data->afb);
igt_assert(afb_id);
- draw_hdr_pattern(&afb);
+ draw_hdr_pattern(&data->afb);
/* Start in SDR. */
- igt_plane_set_fb(data->primary, &afb);
+ igt_plane_set_fb(data->primary, &data->afb);
igt_plane_set_size(data->primary, data->w, data->h);
igt_output_set_prop_value(data->output, IGT_CONNECTOR_MAX_BPC, 8);
@@ -516,7 +513,6 @@ static void test_static_swap(data_t *data, igt_crtc_t *crtc,
}
test_fini(data);
- igt_remove_fb(data->fd, &afb);
}
static void test_invalid_metadata_sizes(data_t *data)
--
2.34.1
next prev parent reply other threads:[~2026-05-06 4:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-06 4:15 [PATCH i-g-t v3 0/3] Fix incorrect skips and improve cleanup Pranay Samala
2026-05-06 4:15 ` Pranay Samala [this message]
2026-05-06 4:15 ` [PATCH i-g-t v3 2/3] tests/kms_hdr: Move test_fini() for proper cleanup Pranay Samala
2026-05-06 4:15 ` [PATCH i-g-t v3 3/3] tests/kms_hdr: Move capability checks inside dynamic subtests Pranay Samala
2026-05-06 4:50 ` ✓ i915.CI.BAT: success for Fix incorrect skips and improve cleanup (rev3) Patchwork
2026-05-06 4:54 ` ✓ Xe.CI.BAT: " Patchwork
2026-05-06 7:00 ` ✗ i915.CI.Full: failure " Patchwork
2026-05-06 7:52 ` ✗ Xe.CI.FULL: " Patchwork
2026-05-06 12:54 ` ✓ i915.CI.Full: success " Patchwork
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=20260506041527.56862-2-pranay.samala@intel.com \
--to=pranay.samala@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=karthik.b.s@intel.com \
--cc=sameer.lattannavar@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