[PATCH 4/4] rust: drm: gem: Implement AlwaysRefCounted for all gem objects automatically
Danilo Krummrich
dakr at kernel.org
Mon May 12 12:24:16 UTC 2025
On Thu, May 01, 2025 at 02:33:19PM -0400, Lyude Paul wrote:
> Currently we are requiring AlwaysRefCounted in most trait bounds for gem
> objects, and implementing it by hand for our only current type of gem
> object. However, all gem objects use the same functions for reference
> counting - and all gem objects support reference counting.
>
> We're planning on adding support for shmem gem objects, let's move this
> around a bit by instead making IntoGEMObject require AlwaysRefCounted as a
> trait bound, and then provide a blanket AlwaysRefCounted implementation for
> any object that implements IntoGEMObject so all gem object types can use
> the same AlwaysRefCounted implementation. This also makes things less
> verbose by making the AlwaysRefCounted trait bound implicit for any
> IntoGEMObject bound.
>
> Signed-off-by: Lyude Paul <lyude at redhat.com>
Great idea!
Reviewed-by: Danilo Krummrich <dakr at kernel.org>
More information about the dri-devel
mailing list