@@ -26,7 +26,6 @@ use core::fmt;
2626use core:: fmt:: { Debug , Formatter } ;
2727use core:: marker:: PhantomData ;
2828use core:: mem;
29- use core:: mem:: MaybeUninit ;
3029use core:: ops:: Range ;
3130use core:: ptr:: NonNull ;
3231
@@ -54,8 +53,6 @@ pub(crate) trait RawAllocation {
5453 fn ptr ( & self ) -> Option < NonNull < u8 > > ;
5554 /// Returns the GPU VA pointer as a u64.
5655 fn gpu_ptr ( & self ) -> u64 ;
57- /// Returns the size of the allocation in bytes.
58- fn size ( & self ) -> usize ;
5956 /// Returns the AsahiDevice that owns this allocation.
6057 fn device ( & self ) -> & AsahiDevice ;
6158}
@@ -191,8 +188,6 @@ pub(crate) trait Allocator {
191188 // TODO: Needs associated_type_defaults
192189 // type Allocation<T> = GenericAlloc<T, Self::Raw>;
193190
194- /// Returns the `AsahiDevice` associated with this allocator.
195- fn device ( & self ) -> & AsahiDevice ;
196191 /// Returns whether CPU-side mapping is enabled.
197192 fn cpu_maps ( & self ) -> bool ;
198193 /// Returns the minimum alignment for allocations.
@@ -218,36 +213,6 @@ pub(crate) trait Allocator {
218213 GpuObject :: < T , GenericAlloc < T , Self :: Raw > > :: new ( self . alloc_object ( ) ?, inner, callback)
219214 }
220215
221- /// Allocate a new GpuStruct object. See [`GpuObject::new_boxed`].
222- #[ inline( never) ]
223- fn new_boxed < T : GpuStruct > (
224- & mut self ,
225- inner : KBox < T > ,
226- callback : impl for < ' a > FnOnce (
227- & ' a T ,
228- & ' a mut MaybeUninit < T :: Raw < ' a > > ,
229- ) -> Result < & ' a mut T :: Raw < ' a > > ,
230- ) -> Result < GpuObject < T , GenericAlloc < T , Self :: Raw > > > {
231- GpuObject :: < T , GenericAlloc < T , Self :: Raw > > :: new_boxed ( self . alloc_object ( ) ?, inner, callback)
232- }
233-
234- /// Allocate a new GpuStruct object. See [`GpuObject::new_inplace`].
235- #[ inline( never) ]
236- fn new_inplace < T : GpuStruct > (
237- & mut self ,
238- inner : T ,
239- callback : impl for < ' a > FnOnce (
240- & ' a T ,
241- & ' a mut MaybeUninit < T :: Raw < ' a > > ,
242- ) -> Result < & ' a mut T :: Raw < ' a > > ,
243- ) -> Result < GpuObject < T , GenericAlloc < T , Self :: Raw > > > {
244- GpuObject :: < T , GenericAlloc < T , Self :: Raw > > :: new_inplace (
245- self . alloc_object ( ) ?,
246- inner,
247- callback,
248- )
249- }
250-
251216 /// Allocate a new GpuStruct object. See [`GpuObject::new_default`].
252217 #[ inline( never) ]
253218 fn new_default < T : GpuStruct + Default > (
@@ -259,25 +224,6 @@ pub(crate) trait Allocator {
259224 GpuObject :: < T , GenericAlloc < T , Self :: Raw > > :: new_default ( self . alloc_object ( ) ?)
260225 }
261226
262- /// Allocate a new GpuStruct object. See [`GpuObject::new_init_prealloc`].
263- #[ inline( never) ]
264- fn new_init_prealloc <
265- ' a ,
266- T : GpuStruct ,
267- I : Init < T , kernel:: error:: Error > ,
268- R : PinInit < T :: Raw < ' a > , kernel:: error:: Error > ,
269- > (
270- & mut self ,
271- inner_init : impl FnOnce ( GpuWeakPointer < T > ) -> I ,
272- raw_init : impl FnOnce ( & ' a T , GpuWeakPointer < T > ) -> R ,
273- ) -> Result < GpuObject < T , GenericAlloc < T , Self :: Raw > > > {
274- GpuObject :: < T , GenericAlloc < T , Self :: Raw > > :: new_init_prealloc (
275- self . alloc_object ( ) ?,
276- inner_init,
277- raw_init,
278- )
279- }
280-
281227 /// Allocate a new GpuStruct object. See [`GpuObject::new_init`].
282228 #[ inline( never) ]
283229 fn new_init < ' a , T : GpuStruct , R : PinInit < T :: Raw < ' a > , F > , E , F > (
@@ -445,7 +391,6 @@ pub(crate) struct SimpleAllocation {
445391 dev : AsahiDevRef ,
446392 ptr : Option < NonNull < u8 > > ,
447393 gpu_ptr : u64 ,
448- size : usize ,
449394 _mapping : mmu:: KernelMapping ,
450395 obj : crate :: gem:: ObjectRef ,
451396}
@@ -476,10 +421,6 @@ impl RawAllocation for SimpleAllocation {
476421 fn gpu_ptr ( & self ) -> u64 {
477422 self . gpu_ptr
478423 }
479- fn size ( & self ) -> usize {
480- self . size
481- }
482-
483424 fn device ( & self ) -> & AsahiDevice {
484425 & self . dev
485426 }
@@ -532,10 +473,6 @@ impl SimpleAllocator {
532473impl Allocator for SimpleAllocator {
533474 type Raw = SimpleAllocation ;
534475
535- fn device ( & self ) -> & AsahiDevice {
536- & self . dev
537- }
538-
539476 fn cpu_maps ( & self ) -> bool {
540477 self . cpu_maps
541478 }
@@ -590,7 +527,6 @@ impl Allocator for SimpleAllocator {
590527 dev : self . dev . clone ( ) ,
591528 ptr : NonNull :: new ( ptr) ,
592529 gpu_ptr,
593- size,
594530 _mapping : mapping,
595531 obj,
596532 } )
@@ -681,9 +617,6 @@ impl RawAllocation for HeapAllocation {
681617 fn gpu_ptr ( & self ) -> u64 {
682618 self . 0 . as_ref ( ) . unwrap ( ) . start ( )
683619 }
684- fn size ( & self ) -> usize {
685- self . 0 . as_ref ( ) . unwrap ( ) . size ( ) as usize
686- }
687620 fn device ( & self ) -> & AsahiDevice {
688621 & self . 0 . as_ref ( ) . unwrap ( ) . dev
689622 }
@@ -1030,10 +963,6 @@ impl HeapAllocator {
1030963impl Allocator for HeapAllocator {
1031964 type Raw = HeapAllocation ;
1032965
1033- fn device ( & self ) -> & AsahiDevice {
1034- & self . dev
1035- }
1036-
1037966 fn cpu_maps ( & self ) -> bool {
1038967 self . cpu_maps
1039968 }
0 commit comments