Linux-Amlogic Archive on 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 v2 1/9] drm/meson: honor framebuffer offsets for the primary plane
Date: Thu, 03 Dec 2026 19:43:45 +0000	[thread overview]
Message-ID: <sashiko-outbox-248536@kernel.org> (raw)
In-Reply-To: <20261203-meson-g12a-osd2-v2-1-8a4a57d32e20@baylibre.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/meson: unvalidated fb->offsets[0] alignment in
  meson_plane_atomic_update()
--

commit 8d8faaad8589d5470ee43df783af8a02a180150e
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().

> diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c
> index 76eb8b80ad8a5..639234d2f9d42 100644
> --- a/drivers/gpu/drm/meson/meson_plane.c
> +++ b/drivers/gpu/drm/meson/meson_plane.c
> @@ -368,7 +368,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];

[Severity: Medium]
Can an unaligned fb->offsets[0] misprogram the Canvas or AFBC scanout
address here?

Neither drm_gem_fb_create() nor meson_plane_atomic_check() checks
fb->offsets[0] alignment.  For linear scanout, meson_canvas_config() writes
((addr + 7) >> 3) to DMC_CAV_LUT_DATAL, silently rounding unaligned offsets
up by up to 7 bytes and reading past a tightly sized GEM buffer.

For GXM AFBC, meson_gxm_afbcd_setup() shifts osd1_addr >> 4 for
OSD1_AFBCD_HDR_PTR and OSD1_AFBCD_FRAME_PTR while keeping the low bits in
OSD1_AFBCD_CHROMA_PTR, truncating non-16-byte-aligned offsets.

For G12A AFBC, meson_g12a_afbcd_setup() writes osd1_addr directly to
VPU_MAFBC_HEADER_BUF_ADDR_LOW_S0 without checking 64-byte AFBC header
alignment.

Should meson_plane_atomic_check() reject framebuffers whose fb->offsets[0]
violates the Canvas (8-byte) or AFBC (16/64-byte) alignment requirements?

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

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

  parent reply	other threads:[~2026-12-03 19:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 19:21 [PATCH v2 0/9] drm/meson: add a second RGB plane on G12A Guillaume La Roque
2026-12-03 19:21 ` [PATCH v2 1/9] drm/meson: honor framebuffer offsets for the primary plane Guillaume La Roque
2026-12-03 19:31   ` Neil Armstrong
2026-12-03 19:43   ` sashiko-bot [this message]
2026-12-03 19:21 ` [PATCH v2 2/9] drm/meson: isolate primary plane scaler setup Guillaume La Roque
2026-12-03 19:32   ` Neil Armstrong
2026-12-03 19:21 ` [PATCH v2 3/9] drm/meson: keep RGB scanout state per OSD Guillaume La Roque
2026-12-03 19:32   ` Neil Armstrong
2026-12-03 19:21 ` [PATCH v2 4/9] drm/meson: parameterize the G12A OSD color matrix setup Guillaume La Roque
2026-12-03 19:21 ` [PATCH v2 5/9] drm/meson: handle primary plane zpos allocation failure Guillaume La Roque
2026-12-03 19:21 ` [PATCH v2 6/9] drm/meson: select RGB plane registers by OSD index Guillaume La Roque
2026-12-03 19:21 ` [PATCH v2 7/9] drm/meson: serialize OSD state updates with the IRQ Guillaume La Roque
2026-12-03 19:33   ` Neil Armstrong
2026-12-03 19:21 ` [PATCH v2 8/9] drm/meson: clear pending primary updates while disabled Guillaume La Roque
2026-12-03 19:21 ` [PATCH v2 9/9] drm/meson: add a linear RGB overlay on G12A OSD2 Guillaume La Roque
2026-12-03 19:34   ` Neil Armstrong
     [not found] ` <f6fd5020-f64f-484b-a922-e8ff207c3626@linaro.org>
2026-12-03 19:58   ` [PATCH v2 0/9] drm/meson: add a second RGB plane on G12A 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-248536@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox