Refcounting in drm_exec

Christian König christian.koenig at amd.com
Thu Aug 31 15:19:09 UTC 2023


Hi Thomas,

Am 31.08.23 um 17:12 schrieb Thomas Hellström:
> Hi, Christian, Danilo
>
> Looking at the drm_exec code it seems we refcount *all* locked objects 
> until drm_exec_fini(). Are callers supposed to be able to *rely* on this?

Yes, that's one of the motivations for this component.

> I'm asking because refcounting appears only strictly necessary for 
> contended- and prelocked objects, and callers would otherwise need to 
> make sure they don't drop a locked object across the lock? It's going 
> to be pretty hard to change this in the future if we want for added 
> efficiency if people start to rely on it.
>
> Also seems drm_exec_unlock_all() drops the prelocked object without 
> unlocking. I'll put together a patch.

That's correct behavior.

The prelocked object is part of the locked objects array as well. So we 
just need to drop the reference.

This was actually a bug in one of the earlier versions.

Regards,
Christian.

>
> Thanks,
>
> Thomas'
>



More information about the dri-devel mailing list