All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ze Huang" <ze.huang@oss.qualcomm.com>
Cc: imx@lists.linux.dev, dri-devel@lists.freedesktop.org,
	Frank.Li@kernel.org
Subject: Re: [PATCH 9/9] drm/xen: replace struct drm_simple_display_pipe with regular atomic helpers
Date: Sat, 04 Jul 2026 18:53:45 +0000	[thread overview]
Message-ID: <20260704185346.627B61F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260705-drm-simple-kms-removal-v1-9-b4e1ca053623@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Hardcoded `possible_crtcs` mask restricts all primary planes to CRTC 0, breaking multi-display support.
- [High] Direct access of global `plane->state` and `crtc->state` in atomic commit hooks leads to race conditions and stalled events.
--

commit 8a32b307abb3d8e006d032d01a1802aa1e4ae6f0
Author: Ze Huang <ze.huang@oss.qualcomm.com>

drm/xen: replace struct drm_simple_display_pipe with regular atomic helpers

Replace Xen frontend simple display pipe with explicit plane, CRTC and
encoder objects for each pipeline. Keep generic plane-state validation
before Xen-specific checks, and install GEM framebuffer prepare helper
explicitly.

> diff --git a/drivers/gpu/drm/xen/xen_drm_front_kms.c b/drivers/gpu/drm/xen/xen_drm_front_kms.c
> index 48772b5fe71cf..57e1bef452f83 100644
> --- a/drivers/gpu/drm/xen/xen_drm_front_kms.c
> +++ b/drivers/gpu/drm/xen/xen_drm_front_kms.c

[ ... ]

> @@ -105,17 +105,15 @@ static void send_pending_event(struct xen_drm_front_drm_pipeline *pipeline)
>  	spin_unlock_irqrestore(&dev->event_lock, flags);
>  }
>  
> -static void display_enable(struct drm_simple_display_pipe *pipe,
> -			   struct drm_crtc_state *crtc_state,
> -			   struct drm_plane_state *plane_state)
> +static void xen_drm_crtc_helper_atomic_enable(struct drm_crtc *crtc,
> +					      struct drm_atomic_commit *state)
>  {
> -	struct xen_drm_front_drm_pipeline *pipeline =
> -			to_xen_drm_pipeline(pipe);
> -	struct drm_crtc *crtc = &pipe->crtc;
> +	struct xen_drm_front_drm_pipeline *pipeline = to_xen_drm_pipeline(crtc);
> +	struct drm_plane_state *plane_state = pipeline->plane.state;

[Severity: High]
Is it safe to access the global pipeline->plane.state directly here? If
non-blocking commits overlap, this pointer might point to a newer,
uncommitted state. Should this code use drm_atomic_get_new_plane_state()
to extract the state from the drm_atomic_commit object instead?

>  	struct drm_framebuffer *fb = plane_state->fb;
>  	int ret, idx;

[ ... ]

> @@ -242,15 +259,19 @@ static int display_check(struct drm_simple_display_pipe *pipe,
>  	return 0;
>  }
>  
> -static void display_update(struct drm_simple_display_pipe *pipe,
> -			   struct drm_plane_state *old_plane_state)
> +static void xen_drm_plane_helper_atomic_update(struct drm_plane *plane,
> +					       struct drm_atomic_commit *state)
>  {
> -	struct xen_drm_front_drm_pipeline *pipeline =
> -			to_xen_drm_pipeline(pipe);
> -	struct drm_crtc *crtc = &pipe->crtc;
> +	struct drm_plane_state *old_plane_state = drm_atomic_get_old_plane_state(state, plane);
> +	struct drm_crtc *crtc = plane->state->crtc ?: old_plane_state->crtc;

[Severity: High]
Can accessing the global plane->state pointer here cause race conditions?
It might be safer to use drm_atomic_get_new_plane_state(state, plane)->crtc
to ensure the correct state is referenced during the atomic commit.

> +	struct xen_drm_front_drm_pipeline *pipeline;
>  	struct drm_pending_vblank_event *event;
>  	int idx;
>  
> +	if (!crtc)
> +		return;
> +
> +	pipeline = to_xen_drm_pipeline(crtc);
>  	event = crtc->state->event;

[Severity: High]
Similarly, does reading and modifying the global crtc->state directly risk
fetching state from a concurrent commit instead of the current one?

>  	if (event) {
>  		struct drm_device *dev = crtc->dev;

[ ... ]

> @@ -331,10 +395,37 @@ static int display_pipe_init(struct xen_drm_front_drm_info *drm_info,
>  
>  	formats = xen_drm_front_conn_get_formats(&format_count);
>  
> -	return drm_simple_display_pipe_init(dev, &pipeline->pipe,
> -					    &display_funcs, formats,
> -					    format_count, NULL,
> -					    &pipeline->conn);
> +	ret = drm_universal_plane_init(dev, &pipeline->plane, 1,
> +				       &display_plane_funcs,
> +				       formats, format_count,
> +				       NULL,
> +				       DRM_PLANE_TYPE_PRIMARY, NULL);

[Severity: High]
Does hardcoding the possible_crtcs mask to 1 restrict all primary planes to
CRTC 0? For pipelines with an index greater than 0, the CRTC might fail to
find a compatible primary plane during atomic validation. Would using
1 << pipeline->index allow multi-display configurations to work correctly?

> +	if (ret)
> +		return ret;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260705-drm-simple-kms-removal-v1-0-b4e1ca053623@oss.qualcomm.com?part=9

  reply	other threads:[~2026-07-04 18:53 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-04 18:31 [PATCH 0/9] drm: replace simple display pipe users with atomic helpers Ze Huang
2026-07-04 18:31 ` [PATCH 1/9] drm/arcpgu: replace struct drm_simple_display_pipe with regular " Ze Huang
2026-07-04 18:43   ` sashiko-bot
2026-07-06  7:43     ` Thomas Zimmermann
2026-07-06  8:01   ` Thomas Zimmermann
2026-07-06 13:26     ` Ze Huang
2026-07-04 18:31 ` [PATCH 2/9] drm/aspeed: " Ze Huang
2026-07-04 18:52   ` sashiko-bot
2026-07-06  8:31   ` Thomas Zimmermann
2026-07-06 13:32     ` Ze Huang
2026-07-04 18:31 ` [PATCH 3/9] drm/imx: " Ze Huang
2026-07-04 18:46   ` sashiko-bot
2026-07-08 13:02     ` Ze Huang
2026-07-08 12:44   ` Thomas Zimmermann
2026-07-08 13:07     ` Ze Huang
2026-07-04 18:31 ` [PATCH 4/9] drm/mcde: " Ze Huang
2026-07-04 18:44   ` sashiko-bot
2026-07-08 14:44     ` Ze Huang
2026-07-08 13:02   ` Thomas Zimmermann
2026-07-08 14:04     ` Ze Huang
2026-07-04 18:31 ` [PATCH 5/9] drm/pl111: " Ze Huang
2026-07-04 18:45   ` sashiko-bot
2026-07-08 13:03   ` Thomas Zimmermann
2026-07-08 14:46     ` Ze Huang
2026-07-04 18:31 ` [PATCH 6/9] drm/gm12u320: " Ze Huang
2026-07-04 18:45   ` sashiko-bot
2026-07-10  9:20     ` Thomas Zimmermann
2026-07-10  9:26       ` Thomas Zimmermann
2026-07-10  9:09   ` Thomas Zimmermann
2026-07-10  9:21     ` Thomas Zimmermann
2026-07-04 18:31 ` [PATCH 7/9] drm/repaper: " Ze Huang
2026-07-04 18:31 ` [PATCH 8/9] drm/tve200: " Ze Huang
2026-07-04 18:46   ` sashiko-bot
2026-07-08 15:17     ` Ze Huang
2026-07-04 18:31 ` [PATCH 9/9] drm/xen: " Ze Huang
2026-07-04 18:53   ` sashiko-bot [this message]
2026-07-08 15:29     ` Ze Huang
2026-07-06  7:27 ` [PATCH 0/9] drm: replace simple display pipe users with " Thomas Zimmermann
2026-07-06  8:22   ` Ze Huang
2026-07-08 12:42     ` Thomas Zimmermann

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=20260704185346.627B61F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=imx@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=ze.huang@oss.qualcomm.com \
    /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.