Re: [PATCH] drm/ssd130x: Use drm_atomic_get_new_plane_state()

From: Javier Martinez Canillas
Date: Fri Sep 23 2022 - 05:16:15 EST


Hello Ville,

On 9/23/22 11:05, Ville Syrjälä wrote:
> On Fri, Sep 23, 2022 at 10:34:47AM +0200, Javier Martinez Canillas wrote:
>> The struct drm_plane .state shouldn't be accessed directly but instead the
>> drm_atomic_get_new_plane_state() helper function should be used.
>>
>> This is based on a similar patch from Thomas Zimmermann for the simpledrm
>> driver. No functional changes.
>>
>> Suggested-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
>> Signed-off-by: Javier Martinez Canillas <javierm@xxxxxxxxxx>
>
> Reviewed-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
>

Thanks.

> I wonder how many naked obj->state dereferences are still
> left in places where they should be using the get_{new,old}()
> stuff. Might have to write a bit of cocci to find out...
>
>
> Btw on a somewhat related note, I've been thinking about bringing
> for_each_crtc_in_state() & co. back (got removed in commit
> 77ac3b00b131 ("drm/atomic: Remove deprecated accessor macros"))
> but this time without any object state iterator variable. Now that
> we're more often just plumbing the full atomic state through I
> think there are bunch of places that don't need the object state(s)
> within the loop at all, so having to have those variables around
> makes the whole thing a bit noisy. Also IIRC we had to add some
> (void) casts into the current macros to hide some compiler warnings
> about unused variables. Could get rid of at least some of those extra
> casts again.
>
> I don't suppose there's anyone interested in doing that so I don't
> have to? ;)
>

Maybe you can add an entry in Documentation/gpu/todo.rst, explaining
this and putting yourself as a contact?

--
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat