[PATCH v4 1/9] drm/meson: honor framebuffer offsets for the primary plane

sashiko-bot at kernel.org sashiko-bot at kernel.org
Fri Dec 4 00:30:50 PST 2026


Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/meson: visible check bypasses OSD1 offset alignment
  validation
--

commit a206a4eb63f9b00457aac18f015af8890bc450de
Author: Guillaume La Roque <glaroque at baylibre.com>

drm/meson: honor framebuffer offsets for the primary plane

This commit adds fb->offsets[0] to the primary plane scanout address and
rejects unaligned scanout addresses in meson_plane_atomic_check().

> diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c
> index c17afe6712f93..30afeadc7e010 100644
> --- a/drivers/gpu/drm/meson/meson_plane.c
> +++ b/drivers/gpu/drm/meson/meson_plane.c

[ ... ]

> @@ -92,11 +97,23 @@ static int meson_plane_atomic_check(struct drm_plane *plane,
>  	 * - Upscaling up to 5x, vertical and horizontal
>  	 * - Final coordinates must match crtc size
>  	 */
> -	return drm_atomic_helper_check_plane_state(new_plane_state,
> -						   crtc_state,
> -						   FRAC_16_16(1, 5),
> -						   DRM_PLANE_NO_SCALING,
> -						   false, true);
> +	ret = drm_atomic_helper_check_plane_state(new_plane_state,
> +						  crtc_state,
> +						  FRAC_16_16(1, 5),
> +						  DRM_PLANE_NO_SCALING,
> +						  false, true);
> +	if (ret || !new_plane_state->visible)
> +		return ret;
> +
> +	if (fb->modifier != DRM_FORMAT_MOD_LINEAR)
> +		alignment = meson_vpu_is_compatible(meson_plane->priv,
> +						    VPU_COMPATIBLE_G12A) ? 64 : 16;
> +
> +	gem = drm_fb_dma_get_gem_obj(fb, 0);
> +	if (!IS_ALIGNED(gem->dma_addr + fb->offsets[0], alignment))
> +		return -EINVAL;
> +
> +	return 0;
>  }

[Severity: Medium]
Can returning early on !new_plane_state->visible bypass the alignment check
while meson_plane_atomic_update() still programs the unaligned osd1_addr?

When userspace commits an offscreen primary plane on an active CRTC with an
unaligned fb->offsets[0], drm_atomic_helper_check_plane_state() sets
visible to false and returns 0.  drm_atomic_helper_commit_planes() still
calls meson_plane_atomic_update() regardless of visible.

meson_plane_atomic_update() does not check new_state->visible and still
sets priv->viu.osd1_addr and enables OSD1.  meson_canvas_config() then
rounds unaligned linear addresses up, reading up to 7 bytes past a tightly
sized GEM buffer, and AFBC receives an unaligned header address.

Checking alignment whenever fb is set, or disabling OSD1 in
meson_plane_atomic_update() when !new_state->visible, would close this gap.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204-meson-g12a-osd2-v4-0-ad356340dbd6@baylibre.com?part=1



More information about the linux-amlogic mailing list