@@ -7,7 +7,9 @@ use std::{
77 collections:: BTreeMap ,
88 io:: IoSliceMut ,
99 os:: fd:: { AsFd , FromRawFd , RawFd } ,
10+ path:: PathBuf ,
1011 result:: Result ,
12+ str:: FromStr ,
1113 sync:: { Arc , Mutex } ,
1214} ;
1315
@@ -16,7 +18,8 @@ use log::{debug, error, trace, warn};
1618use rutabaga_gfx:: {
1719 Resource3DInfo , ResourceCreate3D , ResourceCreateBlob , Rutabaga , RutabagaBuilder ,
1820 RutabagaComponentType , RutabagaFence , RutabagaFenceHandler , RutabagaHandle ,
19- RutabagaIntoRawDescriptor , RutabagaIovec , Transfer3D , RUTABAGA_HANDLE_TYPE_MEM_DMABUF ,
21+ RutabagaIntoRawDescriptor , RutabagaIovec , RutabagaPath , Transfer3D ,
22+ RUTABAGA_HANDLE_TYPE_MEM_DMABUF , RUTABAGA_PATH_TYPE_GPU ,
2023} ;
2124#[ cfg( feature = "gfxstream" ) ]
2225use vhost:: vhost_user:: gpu_message:: VhostUserGpuScanout ;
@@ -403,14 +406,26 @@ impl RutabagaVirtioGpu {
403406 GpuMode :: Gfxstream => RutabagaComponentType :: Gfxstream ,
404407 } ;
405408
406- let builder = RutabagaBuilder :: new ( gpu_config. capsets ( ) . bits ( ) , fence)
409+ let mut builder = RutabagaBuilder :: new ( gpu_config. capsets ( ) . bits ( ) , fence)
407410 . set_use_egl ( gpu_config. flags ( ) . use_egl )
408411 . set_use_gles ( gpu_config. flags ( ) . use_gles )
409412 . set_use_surfaceless ( gpu_config. flags ( ) . use_surfaceless )
410413 // Since vhost-user-gpu is out-of-process this is the only type of blob resource that
411414 // could work, so this is always enabled
412415 . set_use_external_blob ( true ) ;
413416
417+ let mut rutabaga_paths = Vec :: new ( ) ;
418+ if let Some ( gpu_path) = gpu_config. gpu_path . as_ref ( ) {
419+ rutabaga_paths. push ( RutabagaPath {
420+ // PathBuf::from_str() never fails
421+ path : PathBuf :: from_str ( gpu_path) . unwrap ( ) ,
422+ path_type : RUTABAGA_PATH_TYPE_GPU ,
423+ } ) ;
424+ }
425+ if !rutabaga_paths. is_empty ( ) {
426+ builder = builder. set_rutabaga_paths ( Some ( rutabaga_paths) ) ;
427+ }
428+
414429 ( builder, component)
415430 }
416431
@@ -1155,7 +1170,7 @@ mod tests {
11551170 _ => panic ! ( "Unsupported component type for test" ) ,
11561171 } ;
11571172
1158- let config = GpuConfig :: new ( gpu_mode, capsets, GpuFlags :: default ( ) ) . unwrap ( ) ;
1173+ let config = GpuConfig :: new ( gpu_mode, capsets, GpuFlags :: default ( ) , None ) . unwrap ( ) ;
11591174
11601175 // Mock memory
11611176 let mem = GuestMemoryAtomic :: new (
0 commit comments