Re: [PATCH v5 07/19] rust: drm: restrict AlwaysRefCounted to Normal GEM Object context

"Alexandre Courbot" <[email protected]>
Newsgroups dev.linux.lists.nova-gpu,dev.linux.lists.driver-core,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel,org.kernel.vger.rust-for-linux
Message-ID <[email protected]>
On Sun Jun 28, 2026 at 11:53 PM JST, Danilo Krummrich wrote:
> Restrict AlwaysRefCounted for gem::Object and gem::shmem::Object to the
> Normal context, since only Normal objects should be independently
> reference-counted.
>
> To avoid cascading through IntoGEMObject (which had AlwaysRefCounted as
> a supertrait), remove AlwaysRefCounted from IntoGEMObject's supertraits
> and instead add it as an explicit bound on lookup_handle(), which is the
> only BaseObject method that returns an ARef.
>
> Since Object::new() and shmem::Object::new() return ARef<Self>, move
> them to Normal-only impl blocks. Similarly, simplify ObjectConfig and
> shmem's parent_resv_obj field to the Normal context.
>
> Remove the DeviceContext generic from DriverObject::new() and
> Driver::Object, since GEM objects can only be constructed in the Normal
> context. Simplify DriverAllocImpl accordingly.

I think this last item could be its own patch - it wouldn't introduce
any extra churn, and would separate the concepts (restricting GEM
references to `Normal` context, and updating the API) nicely, making the
first patch a bit more focused (~+20/-35 LoCs extracted from it).

But even without this,

Reviewed-by: Alexandre Courbot <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.