From: Harry Wentland <harry.wentland@amd.com>
To: <igt-dev@lists.freedesktop.org>
Cc: Harry Wentland <harry.wentland@amd.com>, Alex Hung <alex.hung@amd.com>
Subject: [PATCH v4 04/10] lib/igt_fb: Add YUV color pattern framebuffer support
Date: Fri, 31 Jul 2026 14:01:54 -0400 [thread overview]
Message-ID: <20260731180200.668795-5-harry.wentland@amd.com> (raw)
In-Reply-To: <20260731180200.668795-1-harry.wentland@amd.com>
Add igt_create_color_pattern_fb_yuv() function to create test pattern
framebuffers in YUV formats. This extends the existing color pattern
functionality to support YUV testing, handling proper conversion from
RGB test patterns to YUV color spaces with correct encoding and range.
Assisted-by: Claude:claude-sonnet-4-5
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Alex Hung <alex.hung@amd.com>
---
lib/igt_fb.c | 41 +++++++++++++++++++++++++++++++++++++++++
lib/igt_fb.h | 6 ++++++
2 files changed, 47 insertions(+)
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index e623b2f64d7c..6c3b9b0b9208 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -2403,6 +2403,47 @@ unsigned int igt_create_color_pattern_fb(int fd, int width, int height,
return fb_id;
}
+/**
+ * igt_create_color_pattern_fb_yuv:
+ * @fd: open drm file descriptor
+ * @width: width of the framebuffer in pixel
+ * @height: height of the framebuffer in pixel
+ * @format: drm fourcc pixel format code
+ * @modifier: tiling layout of the framebuffer
+ * @color_encoding: color encoding for YUV formats (e.g., BT.601, BT.709, BT.2020)
+ * @color_range: color range for YUV formats (limited or full range)
+ * @r: red value to use as background, 0.0 for black, 1.0 for red
+ * @g: green value to use as background, 0.0 for black, 1.0 for green
+ * @b: blue value to use as background, 0.0 for black, 1.0 for blue
+ * @fb: pointer to an #igt_fb structure
+ *
+ * This creates a framebuffer for YUV formats with the specified color encoding
+ * and range. Cairo is used to draw the background color and test pattern, with
+ * automatic RGB to YUV conversion based on the specified encoding and range.
+ *
+ * Returns:
+ * The kms id of the created framebuffer on success or a negative error code on
+ * failure.
+ */
+unsigned int igt_create_color_pattern_fb_yuv(int fd, int width, int height,
+ uint32_t format, uint64_t modifier,
+ enum igt_color_encoding color_encoding,
+ enum igt_color_range color_range,
+ double r, double g, double b,
+ struct igt_fb *fb /* out */)
+{
+ unsigned int fb_id;
+
+ fb_id = igt_create_fb_with_bo_size(fd, width, height, format, modifier,
+ color_encoding, color_range,
+ fb, 0, 0);
+ igt_assert(fb_id);
+
+ igt_paint_test_pattern_color_fb(fd, fb, r, g, b);
+
+ return fb_id;
+}
+
/**
* igt_create_image_fb:
* @drm_fd: open drm file descriptor
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index 8e5907dabed4..213e2d77795d 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -153,6 +153,12 @@ unsigned int igt_create_color_pattern_fb(int fd, int width, int height,
uint32_t format, uint64_t modifier,
double r, double g, double b,
struct igt_fb *fb /* out */);
+unsigned int igt_create_color_pattern_fb_yuv(int fd, int width, int height,
+ uint32_t format, uint64_t modifier,
+ enum igt_color_encoding color_encoding,
+ enum igt_color_range color_range,
+ double r, double g, double b,
+ struct igt_fb *fb /* out */);
unsigned int igt_create_image_fb(int drm_fd, int width, int height,
uint32_t format, uint64_t modifier,
const char *filename,
--
2.55.0
next prev parent reply other threads:[~2026-07-31 18:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 18:01 [PATCH v4 00/10] [PATCH v4 00/10] YUV Conversion Colorop tests Harry Wentland
2026-07-31 18:01 ` [PATCH v4 01/10] include/drm-uapi: Add DRM_COLOROP_FIXED_MATRIX Harry Wentland
2026-07-31 18:01 ` [PATCH v4 02/10] lib/igt_kms: Add IGT_COLOROP_FIXED_MATRIX property Harry Wentland
2026-07-31 18:01 ` [PATCH v4 03/10] tests/kms_colorop_helper: Add Fixed Matrix colorop infrastructure Harry Wentland
2026-07-31 18:01 ` Harry Wentland [this message]
2026-07-31 18:01 ` [PATCH v4 05/10] lib/igt_color_encoding: Add XRGB2101010 format support Harry Wentland
2026-07-31 18:01 ` [PATCH v4 06/10] lib/igt_color: Add YUV pixel reading support Harry Wentland
2026-07-31 18:01 ` [PATCH v4 07/10] lib/igt_color: Refactor transform_pixels for input/output FBs and CSC Harry Wentland
2026-07-31 18:01 ` [PATCH v4 08/10] tests/kms_colorop: Add FIXED_MATRIX colorop tests Harry Wentland
2026-07-31 18:01 ` [PATCH v4 09/10] tests/kms_colorop: Add bypass transition tests Harry Wentland
2026-07-31 18:02 ` [PATCH v4 10/10] tests/kms_colorop: Increase VKMS bracket to 3 up Harry Wentland
2026-07-31 18:33 ` ✓ Xe.CI.BAT: success for YUV Conversion Colorop tests (rev3) Patchwork
2026-07-31 18:53 ` ✗ i915.CI.BAT: failure " Patchwork
2026-07-31 20:49 ` ✓ Xe.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=20260731180200.668795-5-harry.wentland@amd.com \
--to=harry.wentland@amd.com \
--cc=alex.hung@amd.com \
--cc=igt-dev@lists.freedesktop.org \
/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