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 <[email protected]> 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/[email protected]?part=1
