All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Thomas Zimmermann" <tzimmermann@suse.de>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v4 1/6] drm/hibmc: Use drm_atomic_helper_check_plane_state()
Date: Thu, 18 Jun 2026 12:48:16 +0000	[thread overview]
Message-ID: <20260618124817.1D0BE1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260618123142.92298-2-tzimmermann@suse.de>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Relaxing plane bounds checking allows configurations that the hardware programming function (`hibmc_plane_atomic_update`) does not support, causing the plane to be rendered incorrectly.
--

commit 4786b7e1e5ba6fbcc8a7b196d600f9e14eb06bb6
Author: Thomas Zimmermann <tzimmermann@suse.de>

drm/hibmc: Use drm_atomic_helper_check_plane_state()

This commit replaces custom plane boundary checks with the shared
drm_atomic_helper_check_plane_state() helper.

> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> index 3066dc9ebc647..7c0b88c774b5e 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> @@ -72,46 +72,28 @@ static int hibmc_get_best_clock_idx(const struct drm_display_mode *mode)
>  static int hibmc_plane_atomic_check(struct drm_plane *plane,
>  				    struct drm_atomic_commit *state)
>  {
[ ... ]
> +	ret = drm_atomic_helper_check_plane_state(new_plane_state, new_crtc_state,
> +						  DRM_PLANE_NO_SCALING,
> +						  DRM_PLANE_NO_SCALING,
> +						  false, true);
> +	if (ret)
> +		return ret;
> +	else if (!new_plane_state->visible)
> +		return 0;

[Severity: High]
Does this introduce a mismatch with the hardware update logic?

The atomic helper permits planes larger than the CRTC by adjusting the source
offsets (src_x and src_y), and also permits completely off-screen planes by
setting visible to false.

However, looking at hibmc_plane_atomic_update(), it appears the hardware
programming function unconditionally scans out from the base address of the
framebuffer. It does not seem to check if the plane is visible to skip
programming, nor does it appear to account for src_x and src_y offsets.

If userspace submits an off-screen plane or a plane with a panning offset,
will the hardware incorrectly scan out the unshifted framebuffer, causing
display corruption?

>  	if (new_plane_state->fb->pitches[0] % 128 != 0) {
>  		drm_dbg_atomic(plane->dev, "wrong stride with 128-byte aligned\n");
>  		return -EINVAL;
>  	}
> +
>  	return 0;
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260618123142.92298-1-tzimmermann@suse.de?part=1

  reply	other threads:[~2026-06-18 12:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-18 12:28 [PATCH v4 0/6] drm/hibmc: Fix plane helpers and convert to gem-shmem Thomas Zimmermann
2026-06-18 12:28 ` [PATCH v4 1/6] drm/hibmc: Use drm_atomic_helper_check_plane_state() Thomas Zimmermann
2026-06-18 12:48   ` sashiko-bot [this message]
2026-06-18 12:28 ` [PATCH v4 2/6] drm/hibmc: Fix list of formats on the primary plane Thomas Zimmermann
2026-06-18 12:43   ` sashiko-bot
2026-06-18 12:28 ` [PATCH v4 3/6] drm/hibmc: Store fb in variable in atomic_update Thomas Zimmermann
2026-06-18 12:28 ` [PATCH v4 4/6] drm/hibmc: Do not use cpp from struct drm_format_info Thomas Zimmermann
2026-06-18 12:28 ` [PATCH v4 5/6] drm/hibmc: Verify the framebuffer pitch to be a multiple of 128 Thomas Zimmermann
2026-06-18 12:28 ` [PATCH v4 6/6] drm/hibmc: Use gem-shmem with shadow-plane helpers for memory management Thomas Zimmermann
2026-06-18 12:43   ` sashiko-bot

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=20260618124817.1D0BE1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tzimmermann@suse.de \
    /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.