On Mon Feb 23, 2026 at 12:22 PM CET, Alice Ryhl wrote:
> On Mon, Feb 23, 2026 at 11:44:12AM +0100, Danilo Krummrich wrote:
>> On Mon Feb 23, 2026 at 10:15 AM CET, Alice Ryhl wrote:
>> > On Sat, Feb 21, 2026 at 04:09:41PM +0100, Danilo Krummrich wrote:
>> >> On Sat Feb 21, 2026 at 9:46 AM CET, Alice Ryhl wrote:
>> >> > So, should we get rid of GpuVmBoRegistered in favor of ARef<GpuVm<T>>?
>> >> 
>> >> I wanted to avoid exposing the reference count, as I suspect drivers 
>> >> might not
>> >> need it in Rust, but I don't know for sure.
>> >> 
>> >> We could also define it as GpuVmBo<T>(ARef<GpuVmBoInner<T>>), where
>> >> GpuVmBoInner<T> is private, but I also don't want you to go back and 
>> >> forth with
>> >> this in case it turns out we do need drivers to be able to take a 
>> >> reference
>> >> count and I also don't think it hurts too much exposing the reference 
>> >> count,
>> >> even if not needed.
>> >> 
>> >> So, either is fine with me, ARef<GpuVmBo<T>> or
>> >> GpuVmBo<T>(ARef<GpuVmBoInner<T>>).
>> >
>> > I don't think GpuVmBo<T>(ARef<GpuVmBoInner<T>>) works because we need to
>> > be able to talk about both ARef<GpuVmBoInner<T>> and &GpuVmBoInner<T>.
>> > The reference type is returned by several different APIs, so the Inner
>> > type can't be private.
>> 
>> I meant NonNull<GpuVmBoInner<T>>, analogous to the current GpuVmBoRegistered.
>
> Not sure what you mean.

What I meant was doing what you currently have, with the following changes:

- Rename GpuVmBoRegistered<T> to GpuVmBo<T>.
- Rename GpuVmBo<T> to GpuVmBoInner<T> and make it private.

The downside is that both GpuVmBo<T> and GpuVmBoAlloc<T> can't dereference to
GpuVmBoInner<T>, so we'd need some forwarding methods.

The advantage is that we can hide the reference count and keep it simple with
only two driver types, GpuVmBo<T> and GpuVmBoAlloc<T>.

But I'm also fine with just ARef<GpuVmBo<T>> and GpuVmBoAlloc<T>.

Reply via email to