AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Ripard <mripard@kernel.org>
To: Leo Li <sunpeng.li@amd.com>
Cc: "Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	dri-devel@lists.freedesktop.org,
	"Christian König" <christian.koenig@amd.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Harry Wentland" <harry.wentland@amd.com>,
	"Rodrigo Siqueira" <siqueira@igalia.com>,
	amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 66/75] drm/amdgpu: dm: Convert to atomic_create_state
Date: Tue, 20 Oct 2026 15:08:21 +0200	[thread overview]
Message-ID: <atdbcaZo2YO54YY7@houat> (raw)
In-Reply-To: <a94849ae-f553-4752-a236-746fa89e23fa@amd.com>

[-- Attachment #1: Type: text/plain, Size: 2336 bytes --]

Hi Leo,

Thanks for reviewing this

On Mon, Oct 19, 2026 at 12:38:47PM -0400, Leo Li wrote:
> > @@ -736,11 +736,11 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
> >  
> >  	/*
> >  	 * Initialize connector state before adding the connectror to drm and
> >  	 * framebuffer lists
> >  	 */
> > -	amdgpu_dm_connector_funcs_reset(connector);
> 
> I'm actually not sure why there was a state reset here.
> amdgpu_dm_connector_init_helper() is called earlier in this func and
> that already did a reset.

Yeah, it's something sashiko flagged too and I removed that call (and
updated the comment).

> > +	connector->state = amdgpu_dm_connector_atomic_create_state(connector);
> 
> That asside, looks like this can overwrite the alloc'd state from
> init_helper() without freeing. So to keep the previous behavior and
> avoid regressing, perhaps we can do this:
> 
> 	conn_state = amdgpu_dm_connector_atomic_create_state(connector);
> 	if (!IS_ERR(conn_state)) {
> 		if (connector->state)
> 			connector->funcs->atomic_destroy_state(connector, connector->state);
> 		connector->state = conn_state;
> 	}

If we are to handle errors properly and remain equivalent, then
something like the following would be more accurate I guess?

if (connector->state) {
    connector->funcs->atomic_destroy_state(connector, connector->state);
    connector->state = NULL;
}

conn_state = amdgpu_dm_connector_atomic_create_state(connector);
if (IS_ERR(conn_state))
    return NULL;

connector->state = conn_state;

Would you prefer that, or should I remove the call to create_state
entirely because it's redundant?

> >  	/*
> >  	 * Some of the properties below require access to state, like bpc.
> >  	 * Allocate some default initial connector state with our reset helper.
> >  	 */
> > -	if (wbcon->base.base.funcs->reset)
> > -		wbcon->base.base.funcs->reset(&wbcon->base.base);
> > +	if (!wbcon->base.base.state &&
> > +	    wbcon->base.base.funcs->atomic_create_state) {
> > +		struct drm_connector_state *conn_state;
> > +
> > +		conn_state = amdgpu_dm_connector_atomic_create_state(&wbcon->base.base);
> 
> Nit: functionally the same, but would
> `wbcon->base.base.funcs->atomic_create_state(&wbcon->base.base);` be
> clearer?

Totally, I'll fix it
Thanks!
Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]

  reply	other threads:[~2026-10-20 13:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14 17:26 [PATCH 00/75] drm/connector: Convert all drivers to atomic_create_state and remove reset Maxime Ripard
2026-10-14 17:26 ` [PATCH 03/75] drm/amdgpu: vkms: Switch to drm_atomic_helper_connector_create_state Maxime Ripard
2026-10-14 17:26 ` [PATCH 04/75] drm/amdgpu: dm: " Maxime Ripard
2026-10-16 16:41   ` Leo Li
2026-10-14 17:27 ` [PATCH 66/75] drm/amdgpu: dm: Convert to atomic_create_state Maxime Ripard
2026-10-19 16:38   ` Leo Li
2026-10-20 13:08     ` Maxime Ripard [this message]
2026-10-20 16:11       ` Leo Li
2026-10-16 15:06 ` (subset) [PATCH 00/75] drm/connector: Convert all drivers to atomic_create_state and remove reset Maxime Ripard
2026-10-16 15:12 ` Maxime Ripard
2026-10-19 15:15 ` Maxime Ripard

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=atdbcaZo2YO54YY7@houat \
    --to=mripard@kernel.org \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=simona@ffwll.ch \
    --cc=siqueira@igalia.com \
    --cc=sunpeng.li@amd.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox