mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Shenghao Yang <me@shenghaoyang.info>,
	Ruben Wauters <rubenru09@aol.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	kernel test robot <lkp@intel.com>,
	Dan Carpenter <dan.carpenter@linaro.org>
Subject: Re: [PATCH v3] drm/gud: fix NULL crtc dereference on display disable
Date: Wed, 18 Feb 2026 09:04:33 +0100	[thread overview]
Message-ID: <6440e721-daea-4d1d-a920-7eb786dec7f5@suse.de> (raw)
In-Reply-To: <8c5ff095-539e-4c63-b811-efb7de8002ce@shenghaoyang.info>

Hi

Am 18.02.26 um 05:22 schrieb Shenghao Yang:
> Hi,
>
> Thanks for taking a look!
>
> On 6/2/26 15:52, Thomas Zimmermann wrote:
>
>>>    +void gud_crtc_atomic_enable(struct drm_crtc *crtc,
>>> +               struct drm_atomic_state *state)
>>> +{
>>> +    struct drm_device *drm = crtc->dev;
>>> +    struct gud_device *gdrm = to_gud_device(drm);
>>> +    int idx;
>>> +
>>> +    if (!drm_dev_enter(drm, &idx))
>>> +        return;
>>> +
>>> +    if (crtc->state->mode_changed || crtc->state->connectors_changed) {
>> I think you can do this unconditionally. Atomic_enable is supposed to be a full modeset and take some time.  For simple pageflips, this function doesn't run at all.
>>
> I was trying this with proptest and toggling DPMS - the atomic_disable() and
> atomic_enable() functions get called in that path even if the mode doesn't
> change.
>
> The driver in 6.12 LTS (before the atomic changes) didn't send
> SET_CONTROLLER_ENABLE commands on DPMS changes either, so I thought it'd be
> safer to do the same here.

Leave it as it is if you like. But in DRM, we don't have real DPMS 
support for atomic modesetting. The DPMS on state is a full 
atomic_enable and the off and blanking states are atomic_disable IIRC. 
Doing that would be the correct handling.

Best regards
Thomas

>
>>> +        gud_usb_set_u8(gdrm, GUD_REQ_SET_CONTROLLER_ENABLE, 1);
>>> +        gud_usb_set(gdrm, GUD_REQ_SET_STATE_COMMIT, 0, NULL, 0);
>>> +    }
>>> +
>>> +    gud_usb_set_u8(gdrm, GUD_REQ_SET_DISPLAY_ENABLE, crtc->state->active);
>> Why not write '1' unconditionally? IIRC the active bit is always true in atomic_enable.
>>
> Yup looking at drm_atomic_helper_commit_crtc_enable() the call to
> atomic_enable() is skipped if !active - I'll sort this in v4!
>
> drm_atomic_helper_commit_crtc_enable(struct drm_device *dev, struct drm_atomic_state *state)
> {
> ...
> 	for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
> ...
> 		if (!new_crtc_state->active)
> 			continue;
> }
>
> Shenghao
>
>

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)



  reply	other threads:[~2026-02-18  8:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-03 17:26 Shenghao Yang
2026-02-06  7:52 ` Thomas Zimmermann
2026-02-18  4:22   ` Shenghao Yang
2026-02-18  8:04     ` Thomas Zimmermann [this message]
2026-02-18 14:29       ` Shenghao Yang
2026-02-18 14:46         ` 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=6440e721-daea-4d1d-a920-7eb786dec7f5@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@gmail.com \
    --cc=dan.carpenter@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=me@shenghaoyang.info \
    --cc=mripard@kernel.org \
    --cc=rubenru09@aol.com \
    --cc=simona@ffwll.ch \
    /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

all inboxes | Powered by JetHome®