All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Guillaume La Roque" <glaroque@baylibre.com>
Cc: dri-devel@lists.freedesktop.org,
	linux-amlogic@lists.infradead.org, neil.armstrong@linaro.org
Subject: Re: [PATCH v3 3/9] drm/meson: keep RGB scanout state per OSD
Date: Thu, 03 Dec 2026 20:21:28 +0000	[thread overview]
Message-ID: <sashiko-outbox-248621@kernel.org> (raw)
In-Reply-To: <20261203-meson-g12a-osd2-v3-3-2cf76729b5d5@baylibre.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/meson: unvalidated fb->offsets[0] alignment for OSD1
  canvas and GXM AFBC
--

commit 3b070782f8ebee577006ed589de24b8f70f0c4cc
Author: Guillaume La Roque <glaroque@baylibre.com>

drm/meson: keep RGB scanout state per OSD

This commit groups the OSD register cache and framebuffer parameters into a
per-plane struct meson_osd_state array while keeping the primary scaler and
AFBC controls separate.

> diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c
> index 0506e29b6ef3b..1698aaecee88b 100644
> --- a/drivers/gpu/drm/meson/meson_plane.c
> +++ b/drivers/gpu/drm/meson/meson_plane.c

[ ... ]

> @@ -368,19 +369,16 @@ static void meson_plane_atomic_update(struct drm_plane *plane,
>  		if (new_state->crtc->mode.flags & DRM_MODE_FLAG_INTERLACE)
>  			dst_h /= 2;
>  
> -		priv->viu.osd_blend_din0_scope_h = ((dest.x2 - 1) << 16) | dest.x1;
> -		priv->viu.osd_blend_din0_scope_v = ((dest.y2 - 1) << 16) | dest.y1;
> -		priv->viu.osb_blend0_size = dst_h << 16 | dst_w;
> -		priv->viu.osb_blend1_size = dst_h << 16 | dst_w;
> +		osd->blend_size = dst_h << 16 | dst_w;
>  	}
>  
>  	/* Update Canvas with buffer address */
>  	gem = drm_fb_dma_get_gem_obj(fb, 0);
>  
> -	priv->viu.osd1_addr = gem->dma_addr + fb->offsets[0];
> -	priv->viu.osd1_stride = fb->pitches[0];
> -	priv->viu.osd1_height = fb->height;
> -	priv->viu.osd1_width = fb->width;
> +	osd->addr = gem->dma_addr + fb->offsets[0];
> +	osd->stride = fb->pitches[0];
> +	osd->height = fb->height;
> +	osd->width = fb->width;

[Severity: Medium]
Does meson_plane_atomic_check() validate fb->offsets[0] alignment before
osd->addr is programmed?

drm_gem_fb_create() checks buffer size but not fb->offsets[0] alignment.  For
linear scanout, meson_canvas_config() rounds addr up to an 8-byte boundary
via ((addr + 7) >> 3), shifting scanout and allowing canvas DMA to read up to
8 bytes past the end of a tightly sized buffer.

For GXM AFBC, meson_gxm_afbcd_setup() shifts priv->viu.osd[0].addr right by 4
bits, silently dropping the low 4 bits of a non-16-byte-aligned address and
pointing the decoder at the wrong header.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-meson-g12a-osd2-v3-0-2cf76729b5d5@baylibre.com?part=3

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Guillaume La Roque" <glaroque@baylibre.com>
Cc: dri-devel@lists.freedesktop.org,
	linux-amlogic@lists.infradead.org, neil.armstrong@linaro.org
Subject: Re: [PATCH v3 3/9] drm/meson: keep RGB scanout state per OSD
Date: Thu, 03 Dec 2026 20:21:28 +0000	[thread overview]
Message-ID: <sashiko-outbox-248621@kernel.org> (raw)
In-Reply-To: <20261203-meson-g12a-osd2-v3-3-2cf76729b5d5@baylibre.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/meson: unvalidated fb->offsets[0] alignment for OSD1
  canvas and GXM AFBC
--

commit 3b070782f8ebee577006ed589de24b8f70f0c4cc
Author: Guillaume La Roque <glaroque@baylibre.com>

drm/meson: keep RGB scanout state per OSD

This commit groups the OSD register cache and framebuffer parameters into a
per-plane struct meson_osd_state array while keeping the primary scaler and
AFBC controls separate.

> diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c
> index 0506e29b6ef3b..1698aaecee88b 100644
> --- a/drivers/gpu/drm/meson/meson_plane.c
> +++ b/drivers/gpu/drm/meson/meson_plane.c

[ ... ]

> @@ -368,19 +369,16 @@ static void meson_plane_atomic_update(struct drm_plane *plane,
>  		if (new_state->crtc->mode.flags & DRM_MODE_FLAG_INTERLACE)
>  			dst_h /= 2;
>  
> -		priv->viu.osd_blend_din0_scope_h = ((dest.x2 - 1) << 16) | dest.x1;
> -		priv->viu.osd_blend_din0_scope_v = ((dest.y2 - 1) << 16) | dest.y1;
> -		priv->viu.osb_blend0_size = dst_h << 16 | dst_w;
> -		priv->viu.osb_blend1_size = dst_h << 16 | dst_w;
> +		osd->blend_size = dst_h << 16 | dst_w;
>  	}
>  
>  	/* Update Canvas with buffer address */
>  	gem = drm_fb_dma_get_gem_obj(fb, 0);
>  
> -	priv->viu.osd1_addr = gem->dma_addr + fb->offsets[0];
> -	priv->viu.osd1_stride = fb->pitches[0];
> -	priv->viu.osd1_height = fb->height;
> -	priv->viu.osd1_width = fb->width;
> +	osd->addr = gem->dma_addr + fb->offsets[0];
> +	osd->stride = fb->pitches[0];
> +	osd->height = fb->height;
> +	osd->width = fb->width;

[Severity: Medium]
Does meson_plane_atomic_check() validate fb->offsets[0] alignment before
osd->addr is programmed?

drm_gem_fb_create() checks buffer size but not fb->offsets[0] alignment.  For
linear scanout, meson_canvas_config() rounds addr up to an 8-byte boundary
via ((addr + 7) >> 3), shifting scanout and allowing canvas DMA to read up to
8 bytes past the end of a tightly sized buffer.

For GXM AFBC, meson_gxm_afbcd_setup() shifts priv->viu.osd[0].addr right by 4
bits, silently dropping the low 4 bits of a non-16-byte-aligned address and
pointing the decoder at the wrong header.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-meson-g12a-osd2-v3-0-2cf76729b5d5@baylibre.com?part=3

  reply	other threads:[~2026-12-03 20:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 19:55 [PATCH v3 0/9] drm/meson: add a second RGB plane on G12A Guillaume La Roque
2026-12-03 19:55 ` Guillaume La Roque
2026-12-03 19:55 ` [PATCH v3 1/9] drm/meson: honor framebuffer offsets for the primary plane Guillaume La Roque
2026-12-03 19:55   ` Guillaume La Roque
2026-12-03 20:18   ` sashiko-bot
2026-12-03 20:18     ` sashiko-bot
2026-12-03 19:55 ` [PATCH v3 2/9] drm/meson: isolate primary plane scaler setup Guillaume La Roque
2026-12-03 19:55   ` Guillaume La Roque
2026-12-03 19:55 ` [PATCH v3 3/9] drm/meson: keep RGB scanout state per OSD Guillaume La Roque
2026-12-03 19:55   ` Guillaume La Roque
2026-12-03 20:21   ` sashiko-bot [this message]
2026-12-03 20:21     ` sashiko-bot
2026-12-03 19:55 ` [PATCH v3 4/9] drm/meson: parameterize the G12A OSD color matrix setup Guillaume La Roque
2026-12-03 19:55   ` Guillaume La Roque
2026-12-03 19:55 ` [PATCH v3 5/9] drm/meson: handle primary plane zpos allocation failure Guillaume La Roque
2026-12-03 19:55   ` Guillaume La Roque
2026-12-03 19:55 ` [PATCH v3 6/9] drm/meson: select RGB plane registers by OSD index Guillaume La Roque
2026-12-03 19:55   ` Guillaume La Roque
2026-12-03 19:55 ` [PATCH v3 7/9] drm/meson: serialize OSD state updates with the IRQ Guillaume La Roque
2026-12-03 19:55   ` Guillaume La Roque
2026-12-03 19:55 ` [PATCH v3 8/9] drm/meson: clear pending primary updates while disabled Guillaume La Roque
2026-12-03 19:55   ` Guillaume La Roque
2026-12-03 20:41   ` sashiko-bot
2026-12-03 20:41     ` sashiko-bot
2026-12-03 19:55 ` [PATCH v3 9/9] drm/meson: add a linear RGB overlay on G12A OSD2 Guillaume La Roque
2026-12-03 19:55   ` Guillaume La Roque

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=sashiko-outbox-248621@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=glaroque@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=neil.armstrong@linaro.org \
    --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.