From: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: swati2.sharma@intel.com, juha-pekka.heikkila@intel.com
Subject: [PATCH i-g-t v2] tests/kms_plane_cursor: Use additional FB for reference image
Date: Thu, 27 Nov 2025 19:38:00 +0530 [thread overview]
Message-ID: <20251127140800.1379905-1-chaitanya.kumar.borah@intel.com> (raw)
Painting directly on the FB currently being scanned out ends up
modifying the frontbuffer. Since the FB isn’t marked dirty, those
updates never reach the actual buffer, leading to stale or incorrect
reference images during testing.
To avoid this, create a reference framebuffer in addition to the one
created for the primary plane and alternately flip
between them while collecting crcs for the reference image and output
image respectively.
While at it, remove draw_color as it is no longer used.
v2:
- Simplify implementation to use a single ref_fb instead of two
- Remove draw_color()
- Remove redundant commit
Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
---
tests/kms_plane_cursor.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/tests/kms_plane_cursor.c b/tests/kms_plane_cursor.c
index 9fa36bfd4..258b22b1a 100644
--- a/tests/kms_plane_cursor.c
+++ b/tests/kms_plane_cursor.c
@@ -78,6 +78,7 @@ typedef struct data {
igt_pipe_t *pipe;
igt_pipe_crc_t *pipe_crc;
drmModeModeInfo *mode;
+ igt_fb_t ref_fb;
igt_fb_t pfb;
igt_fb_t ofb;
igt_fb_t cfb;
@@ -129,16 +130,6 @@ static void test_fini(data_t *data)
igt_display_commit2(&data->display, COMMIT_ATOMIC);
}
-/* Fills a FB with the solid color given. */
-static void draw_color(igt_fb_t *fb, double r, double g, double b)
-{
- cairo_t *cr = igt_get_cairo_ctx(fb->fd, fb);
-
- cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
- igt_paint_color(cr, 0, 0, fb->width, fb->height, r, g, b);
- igt_put_cairo_ctx(cr);
-}
-
/*
* Draws white and gray (if overlay FB is given) on the primary FB.
* Draws a magenta square where the cursor should be over top both planes.
@@ -152,6 +143,7 @@ static void test_cursor_pos(data_t *data, int x, int y, unsigned int flags)
{
igt_crc_t ref_crc, test_crc;
cairo_t *cr;
+ igt_fb_t *ref_fb = &data->ref_fb;
igt_fb_t *pfb = &data->pfb;
igt_fb_t *ofb = &data->ofb;
igt_fb_t *cfb = &data->cfb;
@@ -159,8 +151,8 @@ static void test_cursor_pos(data_t *data, int x, int y, unsigned int flags)
int ch = cfb->height;
const rect_t *or = &data->or;
- cr = igt_get_cairo_ctx(pfb->fd, pfb);
- igt_paint_color(cr, 0, 0, pfb->width, pfb->height, 1.0, 1.0, 1.0);
+ cr = igt_get_cairo_ctx(ref_fb->fd, ref_fb);
+ igt_paint_color(cr, 0, 0, ref_fb->width, ref_fb->height, 1.0, 1.0, 1.0);
if (flags & TEST_OVERLAY)
igt_paint_color(cr, or->x, or->y, or->w, or->h, 0.5, 0.5, 0.5);
@@ -168,6 +160,7 @@ static void test_cursor_pos(data_t *data, int x, int y, unsigned int flags)
igt_paint_color(cr, x, y, cw, ch, 1.0, 0.0, 1.0);
igt_put_cairo_ctx(cr);
+ igt_plane_set_fb(data->primary, ref_fb);
if (flags & TEST_OVERLAY)
igt_plane_set_fb(data->overlay, NULL);
igt_plane_set_fb(data->cursor, NULL);
@@ -176,7 +169,7 @@ static void test_cursor_pos(data_t *data, int x, int y, unsigned int flags)
igt_pipe_crc_start(data->pipe_crc);
igt_pipe_crc_get_current(data->drm_fd, data->pipe_crc, &ref_crc);
- draw_color(pfb, 1.0, 1.0, 1.0);
+ igt_plane_set_fb(data->primary, pfb);
if (flags & TEST_OVERLAY) {
igt_plane_set_fb(data->overlay, ofb);
@@ -249,6 +242,7 @@ static void test_cleanup(data_t *data)
igt_remove_fb(data->drm_fd, &data->cfb);
igt_remove_fb(data->drm_fd, &data->ofb);
igt_remove_fb(data->drm_fd, &data->pfb);
+ igt_remove_fb(data->drm_fd, &data->ref_fb);
}
static void test_cursor(data_t *data, int size, unsigned int flags)
@@ -263,6 +257,9 @@ static void test_cursor(data_t *data, int size, unsigned int flags)
test_cleanup(data);
+ igt_create_fb(data->drm_fd, sw, sh, DRM_FORMAT_XRGB8888,
+ DRM_FORMAT_MOD_LINEAR, &data->ref_fb);
+
igt_create_color_fb(data->drm_fd, sw, sh, DRM_FORMAT_XRGB8888,
DRM_FORMAT_MOD_LINEAR, 1.0, 1.0, 1.0, &data->pfb);
--
2.25.1
next reply other threads:[~2025-11-27 14:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-27 14:08 Chaitanya Kumar Borah [this message]
2025-11-27 17:40 ` ✓ i915.CI.BAT: success for tests/kms_plane_cursor: Use additional FB for reference image Patchwork
2025-11-27 17:53 ` ✓ Xe.CI.BAT: " Patchwork
2025-11-27 19:24 ` ✗ i915.CI.Full: failure " Patchwork
2025-11-27 19:44 ` ✗ Xe.CI.Full: " Patchwork
2025-12-04 9:09 ` ✓ i915.CI.Full: success " Patchwork
2025-12-04 9:34 ` [PATCH i-g-t v2] " Juha-Pekka Heikkilä
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=20251127140800.1379905-1-chaitanya.kumar.borah@intel.com \
--to=chaitanya.kumar.borah@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=juha-pekka.heikkila@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;
as well as URLs for NNTP newsgroup(s).