From: sashiko-bot@kernel.org
To: "Harry Wentland" <harry.wentland@amd.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v4 05/11] drm/vkms: Add atomic check and matrix handling for fixed matrix colorop
Date: Wed, 22 Jul 2026 13:59:00 +0000 [thread overview]
Message-ID: <20260722135900.D19361F00A3F@smtp.kernel.org> (raw)
In-Reply-To: <20260722134607.136293-6-harry.wentland@amd.com>
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
New issues:
- [High] Page flips that do not modify the color pipeline incorrectly bypass the YUV-to-RGB conversion matrix.
- [Medium] vkms_plane_atomic_check fails to validate the bypass state for the fixed matrix colorop.
- [Medium] FIXED_MATRIX colorop is silently ignored for RGB formats, and state is unconditionally interpreted as fixed_matrix.
Pre-existing issues:
- [High] The background composer accesses live DRM object state (`colorop->state`), risking Use-After-Free.
--
--- Patch [5]: [PATCH v4 05/11] drm/vkms: Add atomic check and matrix handling for fixed matrix colorop ---
commit 7c8489284a67e8c66fd1ead26966ba84d8380366
Author: Harry Wentland <harry.wentland@amd.com>
drm/vkms: Add atomic check and matrix handling for fixed matrix colorop
This commit validates that YUV framebuffers use a non-bypassed fixed matrix
colorop when a color pipeline is active. It also maps the fixed matrix type
to color encoding and range for YUV-to-RGB conversion, while treating the
fixed matrix colorop as a no-op during composition.
> diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c
> index 83d217085ad09..899120cd07ac5 100644
> --- a/drivers/gpu/drm/vkms/vkms_composer.c
> +++ b/drivers/gpu/drm/vkms/vkms_composer.c
> @@ -187,6 +187,12 @@ static void apply_colorop(struct pixel_argb_s32 *pixel, struct drm_colorop *colo
> if (colorop_state->data)
> apply_3x4_matrix(pixel,
> (struct drm_color_ctm_3x4 *)colorop_state->data->data);
> + } else if (colorop->type == DRM_COLOROP_FIXED_MATRIX) {
> + /*
> + * Fixed Matrix is a no-op here. YUV-to-RGB conversion
> + * is handled at format read time via the
> + * conversion_matrix set in vkms_plane_atomic_update().
> + */
> }
[Severity: Medium]
If userspace applies a DRM_COLOROP_FIXED_MATRIX to an RGB plane, will this
silently ignore the operation instead of properly rejecting it in the atomic
check?
[Severity: High]
This isn't a bug introduced by this patch, but doesn't reading the live
colorop->state pointer asynchronously in the worker risk a use-after-free
if a concurrent atomic commit frees the old state?
Looking at the beginning of apply_colorop() in vkms_composer.c:
static void apply_colorop(struct pixel_argb_s32 *pixel, struct drm_colorop *colorop)
{
struct drm_colorop_state *colorop_state = colorop->state;
Should VKMS snapshot the required properties into vkms_plane_state during
atomic_update instead of dereferencing the live DRM object state asynchronously?
[ ... ]
> diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
> index 68cb2a3335e64..6ee5c3f3207c5 100644
> --- a/drivers/gpu/drm/vkms/vkms_plane.c
> +++ b/drivers/gpu/drm/vkms/vkms_plane.c
[ ... ]
> @@ -148,7 +152,49 @@ static void vkms_plane_atomic_update(struct drm_plane *plane,
> frame_info->rotation = new_state->rotation;
>
> vkms_plane_state->pixel_read_line = get_pixel_read_line_function(fmt);
> - get_conversion_matrix_to_argb_u16(fmt, new_state->color_encoding, new_state->color_range,
> +
> + if (new_state->color_pipeline) {
> + struct drm_colorop *colorop = new_state->color_pipeline;
> + struct drm_colorop_state *colorop_state;
> +
> + colorop_state = drm_atomic_get_new_colorop_state(state, colorop);
> + bypass = !colorop_state || colorop_state->bypass;
[Severity: High]
Could this logic inadvertently break YUV decoding on standard page flips?
If a page flip does not include the colorop in the atomic commit,
drm_atomic_get_new_colorop_state() returns NULL, which forces bypass to true.
Will this reset the conversion matrix to a no-op on the second frame?
> +
> + if (!bypass) {
> + switch (colorop_state->fixed_matrix_type) {
[Severity: Medium]
When the active colorop on an RGB plane is a 1D_CURVE instead of a
FIXED_MATRIX, will this unconditionally misinterpret the state struct and read
an invalid fixed_matrix_type?
> + case DRM_COLOROP_FM_YCBCR601_FULL_RGB:
> + encoding = DRM_COLOR_YCBCR_BT601;
> + range = DRM_COLOR_YCBCR_FULL_RANGE;
> + break;
[ ... ]
> @@ -175,6 +221,13 @@ static int vkms_plane_atomic_check(struct drm_plane *plane,
> if (ret != 0)
> return ret;
>
> + if (new_plane_state->color_pipeline && new_plane_state->fb->format->is_yuv) {
> + struct drm_colorop *colorop = new_plane_state->color_pipeline;
> +
> + if (colorop->type != DRM_COLOROP_FIXED_MATRIX)
> + return -EINVAL;
[Severity: Medium]
The commit message states that "The fixed matrix colorop must not be bypassed"
when the framebuffer format is YUV.
Does this atomic check fail to enforce that rule by not retrieving the
colorop state to check its bypass property?
> + }
> +
> return 0;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260722134607.136293-1-harry.wentland@amd.com?part=5
next prev parent reply other threads:[~2026-07-22 13:59 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 13:45 [PATCH v4 00/11] YUV conversion colorop with amdgpu and VKMS Harry Wentland
2026-07-22 13:45 ` [PATCH v4 01/11] drm/colorop: Add DRM_COLOROP_FIXED_MATRIX Harry Wentland
2026-07-22 13:55 ` sashiko-bot
2026-07-22 13:45 ` [PATCH v4 02/11] drm/vkms: Fix limited-range YCbCr to RGB conversion scaling Harry Wentland
2026-07-22 13:45 ` [PATCH v4 03/11] drm/vkms: Add KUnit test for YCbCr to RGB conversion matrices Harry Wentland
2026-07-22 14:01 ` sashiko-bot
2026-07-22 13:46 ` [PATCH v4 04/11] drm/vkms: Add fixed matrix colorop to color pipeline Harry Wentland
2026-07-22 13:46 ` [PATCH v4 05/11] drm/vkms: Add atomic check and matrix handling for fixed matrix colorop Harry Wentland
2026-07-22 13:59 ` sashiko-bot [this message]
2026-07-22 13:46 ` [PATCH v4 06/11] drm/amd/display: Add fixed matrix colorop to color pipeline Harry Wentland
2026-07-22 14:03 ` sashiko-bot
2026-07-22 13:46 ` [PATCH v4 07/11] drm/amd/display: Implement fixed matrix colorop color space mapping Harry Wentland
2026-07-22 14:14 ` sashiko-bot
2026-07-22 13:46 ` [PATCH v4 08/11] drm/amd/display: Use GAMCOR for first TF if YUV conversion is needed Harry Wentland
2026-07-22 13:46 ` [PATCH v4 09/11] drm/amd/display: Check actual state during commit_tail Harry Wentland
2026-07-22 14:08 ` sashiko-bot
2026-07-22 13:46 ` [PATCH v4 10/11] drm/amd/display: Set color_space to plane_infos Harry Wentland
2026-07-22 14:13 ` sashiko-bot
2026-07-22 13:46 ` [PATCH v4 11/11] drm/amd/display: Force GAMCOR for subsampled surfaces with PQ/Gamma22/HLG Harry Wentland
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=20260722135900.D19361F00A3F@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.