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 1/9] drm/meson: honor framebuffer offsets for the primary plane
Date: Thu, 03 Dec 2026 20:18:11 +0000	[thread overview]
Message-ID: <sashiko-outbox-248614@kernel.org> (raw)
In-Reply-To: <20261203-meson-g12a-osd2-v3-1-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
  scanout
--

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

drm/meson: honor framebuffer offsets for the primary plane

This commit adds fb->offsets[0] to gem->dma_addr when computing
priv->viu.osd1_addr in meson_plane_atomic_update() so primary plane scanout
honors the framebuffer plane offset.

> diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c
> index c17afe6712f93..7174093227fd7 100644
> --- a/drivers/gpu/drm/meson/meson_plane.c
> +++ b/drivers/gpu/drm/meson/meson_plane.c
> @@ -363,7 +363,7 @@ static void meson_plane_atomic_update(struct drm_plane *plane,
>  	/* Update Canvas with buffer address */
>  	gem = drm_fb_dma_get_gem_obj(fb, 0);
>
> -	priv->viu.osd1_addr = gem->dma_addr;
> +	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;

[Severity: Medium]
Should meson_plane_atomic_check() validate the alignment of fb->offsets[0]
before adding it to gem->dma_addr?

Neither drm_gem_fb_create() nor meson_plane_atomic_check() checks offset
alignment.  In linear mode, meson_canvas_config() programs ((addr + 7) >> 3),
silently rounding a non-8-byte-aligned offset (such as a 4-byte XRGB8888
offset) up by up to 7 bytes.

That shifts the scanout start and can cause the Canvas DMA engine to read up
to 7 bytes past the end of a tightly sized GEM buffer.

In AFBC mode, meson_gxm_afbcd_setup() truncates bits [3:0] for
OSD1_AFBCD_HDR_PTR and OSD1_AFBCD_FRAME_PTR while keeping them in
OSD1_AFBCD_CHROMA_PTR, and meson_g12a_afbcd_setup() writes osd1_addr without
checking 64-byte AFBC header alignment.

Rejecting unaligned fb->offsets[0] with -EINVAL in meson_plane_atomic_check()
for linear (8-byte) and AFBC modes would avoid silent misprogramming.

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

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 1/9] drm/meson: honor framebuffer offsets for the primary plane
Date: Thu, 03 Dec 2026 20:18:11 +0000	[thread overview]
Message-ID: <sashiko-outbox-248614@kernel.org> (raw)
In-Reply-To: <20261203-meson-g12a-osd2-v3-1-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
  scanout
--

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

drm/meson: honor framebuffer offsets for the primary plane

This commit adds fb->offsets[0] to gem->dma_addr when computing
priv->viu.osd1_addr in meson_plane_atomic_update() so primary plane scanout
honors the framebuffer plane offset.

> diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c
> index c17afe6712f93..7174093227fd7 100644
> --- a/drivers/gpu/drm/meson/meson_plane.c
> +++ b/drivers/gpu/drm/meson/meson_plane.c
> @@ -363,7 +363,7 @@ static void meson_plane_atomic_update(struct drm_plane *plane,
>  	/* Update Canvas with buffer address */
>  	gem = drm_fb_dma_get_gem_obj(fb, 0);
>
> -	priv->viu.osd1_addr = gem->dma_addr;
> +	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;

[Severity: Medium]
Should meson_plane_atomic_check() validate the alignment of fb->offsets[0]
before adding it to gem->dma_addr?

Neither drm_gem_fb_create() nor meson_plane_atomic_check() checks offset
alignment.  In linear mode, meson_canvas_config() programs ((addr + 7) >> 3),
silently rounding a non-8-byte-aligned offset (such as a 4-byte XRGB8888
offset) up by up to 7 bytes.

That shifts the scanout start and can cause the Canvas DMA engine to read up
to 7 bytes past the end of a tightly sized GEM buffer.

In AFBC mode, meson_gxm_afbcd_setup() truncates bits [3:0] for
OSD1_AFBCD_HDR_PTR and OSD1_AFBCD_FRAME_PTR while keeping them in
OSD1_AFBCD_CHROMA_PTR, and meson_g12a_afbcd_setup() writes osd1_addr without
checking 64-byte AFBC header alignment.

Rejecting unaligned fb->offsets[0] with -EINVAL in meson_plane_atomic_check()
for linear (8-byte) and AFBC modes would avoid silent misprogramming.

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

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

  reply	other threads:[~2026-12-03 20:18 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 [this message]
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
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-248614@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.