Re: Help understanding allocation and mapping flow of virtio-gpu 3D resource blobs

2024-02-04 Thread Manos Pitsidianakis

Good morning Alex,

Just one observation,

On Sun, 04 Feb 2024 13:06, Alex Bennée  wrote:

Hi,

I'm trying to get an understanding of the blob allocation and mapping
flow for virtio-gpu for Vulkan and Rutabaga. Having gotten all the
various libraries setup I'm still seeing failures when running a TCG
guest (buildroot + latest glm, mesa, vkmark) with:

 ./qemu-system-aarch64 \
-M virt -cpu cortex-a76 \
-m 8192 \
-object memory-backend-memfd,id=mem,size=8G,share=on \
-serial mon:stdio \
-kernel 
~/lsrc/linux.git/builds/arm64.initramfs/arch/arm64/boot/Image \
-append "console=ttyAMA0" \
-device virtio-gpu-gl,context_init=true,blob=true,hostmem=4G \
-display sdl,gl=on -d 
guest_errors,trace:virtio_gpu_cmd_res\*,trace:virtio_gpu_virgl_process_command 
-D debug.log

which shows up as detected in dmesg but not to vulkaninfo:

 [0.644879] virtio-pci :00:01.0: enabling device ( -> 0003)
 [0.648643] virtio-pci :00:02.0: enabling device ( -> 0002)
 [0.672391] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
 [0.678071] Serial: AMBA driver
 [0.682122] [drm] pci: virtio-gpu-pci detected at :00:02.0
 [0.683249] [drm] Host memory window: 0x80 +0x1
 [0.683420] [drm] features: +virgl +edid +resource_blob +host_visible
 [0.683470] [drm] features: +context_init
 [0.695695] [drm] number of scanouts: 1
 [0.695837] [drm] number of cap sets: 3
 [0.716173] [drm] cap set 0: id 1, max-version 1, max-size 308
 [0.716499] [drm] cap set 1: id 2, max-version 2, max-size 1384
 [0.716686] [drm] cap set 2: id 4, max-version 0, max-size 160
 [0.726001] [drm] Initialized virtio_gpu 0.1.0 0 for :00:02.0 on minor 0
 virgl_resource_create: err=0, res=2
 virgl_renderer_resource_attach_iov: 0x55b843c17a80/2
 virgl_resource_attach_iov: pipe_resource: 0x55b8434da8f0
 vrend_pipe_resource_attach_iov: 0x43

 ...

 # vulkaninfo --summary
 WARNING: [Loader Message] Code 0 : terminator_CreateInstance: Failed to 
CreateInstance in ICD 1.  Skipping ICD.


a common problem I have when testing different mesa builds is not 
declaring the intended driver each time. I could be getting errors like 
yours but if I set the VK_ICD_FILENAMES env var to the correct driver 
manifest (the installed icd.d/virtio-*.json file from my mesa build) the 
device is properly recognized. Might be unrelated to this error, but 
still it helps to define it explicitly each time.





 error: XDG_RUNTIME_DIR is invalid or not set in the environment.
 ==
 VULKANINFO
 ==

 Vulkan Instance Version: 1.3.262


 Instance Extensions: count = 12
 ---
 VK_EXT_debug_report: extension revision 10
 VK_EXT_debug_utils : extension revision 2
 VK_KHR_device_group_creation   : extension revision 1
 VK_KHR_external_fence_capabilities : extension revision 1
 VK_KHR_external_memory_capabilities: extension revision 1
 VK_KHR_external_semaphore_capabilities : extension revision 1
 VK_KHR_get_physical_device_properties2 : extension revision 2
 VK_KHR_get_surface_capabilities2   : extension revision 1
 VK_KHR_portability_enumeration : extension revision 1
 VK_KHR_surface : extension revision 25
 VK_KHR_surface_protected_capabilities  : extension revision 1
 VK_LUNARG_direct_driver_loading: extension revision 1

 Instance Layers:
 

 Devices:
 
 GPU0:
 apiVersion = 1.3.267
 driverVersion  = 0.0.1
 vendorID   = 0x10005
 deviceID   = 0x
 deviceType = PHYSICAL_DEVICE_TYPE_CPU
 deviceName = llvmpipe (LLVM 15.0.3, 128 bits)
 driverID   = DRIVER_ID_MESA_LLVMPIPE
 driverName = llvmpipe
 driverInfo = Mesa 23.3.2 (LLVM 15.0.3)
 conformanceVersion = 1.3.1.1
 deviceUUID = 6d657361-3233-2e33-2e32-
 driverUUID = 6c6c766d-7069-7065--4944

With an older and more hacked up set of the blob patches I can get
vulkaninfo to work but I see multiple GPUs and vkmark falls over when
mapping stuff:

 # vulkaninfo --summary
 render_state_create_resource: res_id = 5
 vkr_context_add_resource: res_id = 5
 vkr_context_import_resource_internal: res_id = 5
 virgl_resource_create: err=0, res=5
 render_state_create_resource: res_id = 6
 vkr_context_add_resource: res_id = 6
 vkr_context_import_resource_internal: res_id = 6
 virgl_resource_create: err=0, res=6
 error: XDG_RUNTIME_DIR is invalid or not set in the environment.
 ==
 VULKANINFO
 ==

 Vulkan Instance Version: 1.3.262


 Instance Extensions: count = 12
 ---
 VK_EXT_debug_report: extension revision 10
 VK_EXT_debug_utils : extension

Re: Help understanding allocation and mapping flow of virtio-gpu 3D resource blobs

2024-02-04 Thread Alex Bennée
Alex Bennée  writes:

(doh, replying to virglrender-devel thanks to autocomplete failure)

> Hi,
>
> I'm trying to get an understanding of the blob allocation and mapping
> flow for virtio-gpu for Vulkan and Rutabaga. Having gotten all the
> various libraries setup I'm still seeing failures when running a TCG
> guest (buildroot + latest glm, mesa, vkmark) with:
>
>   ./qemu-system-aarch64 \
>  -M virt -cpu cortex-a76 \
>  -m 8192 \
>  -object memory-backend-memfd,id=mem,size=8G,share=on \
>  -serial mon:stdio \
>  -kernel 
> ~/lsrc/linux.git/builds/arm64.initramfs/arch/arm64/boot/Image \
>  -append "console=ttyAMA0" \
>  -device virtio-gpu-gl,context_init=true,blob=true,hostmem=4G \
>  -display sdl,gl=on -d 
> guest_errors,trace:virtio_gpu_cmd_res\*,trace:virtio_gpu_virgl_process_command
>  -D debug.log
>
> which shows up as detected in dmesg but not to vulkaninfo:
>
>   [0.644879] virtio-pci :00:01.0: enabling device ( -> 0003)  
>   
>   [0.648643] virtio-pci :00:02.0: enabling device ( -> 0002)
>   [0.672391] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled 
>   
>
>   [0.678071] Serial: AMBA driver  
>   
>   [0.682122] [drm] pci: virtio-gpu-pci detected at :00:02.0   
>   [0.683249] [drm] Host memory window: 0x80 +0x1
>   [0.683420] [drm] features: +virgl +edid +resource_blob +host_visible
>   [0.683470] [drm] features: +context_init
>   
>
>   [0.695695] [drm] number of scanouts: 1  
>   
>   [0.695837] [drm] number of cap sets: 3  
>   
>   [0.716173] [drm] cap set 0: id 1, max-version 1, max-size 308
>   [0.716499] [drm] cap set 1: id 2, max-version 2, max-size 1384  
>   [0.716686] [drm] cap set 2: id 4, max-version 0, max-size 160   
>   
>
>   [0.726001] [drm] Initialized virtio_gpu 0.1.0 0 for :00:02.0 on 
> minor 0
>   virgl_resource_create: err=0, res=2 
>   
>   virgl_renderer_resource_attach_iov: 0x55b843c17a80/2
>   
>   virgl_resource_attach_iov: pipe_resource: 0x55b8434da8f0
>   
>   vrend_pipe_resource_attach_iov: 0x43   
>
>   ...
>
>   # vulkaninfo --summary
>   WARNING: [Loader Message] Code 0 : terminator_CreateInstance: Failed to 
> CreateInstance in ICD 1.  Skipping ICD.
>   error: XDG_RUNTIME_DIR is invalid or not set in the environment.
>   ==
>   VULKANINFO
>   ==
>
>   Vulkan Instance Version: 1.3.262
>
>
>   Instance Extensions: count = 12
>   ---
>   VK_EXT_debug_report: extension revision 10
>   VK_EXT_debug_utils : extension revision 2
>   VK_KHR_device_group_creation   : extension revision 1
>   VK_KHR_external_fence_capabilities : extension revision 1
>   VK_KHR_external_memory_capabilities: extension revision 1
>   VK_KHR_external_semaphore_capabilities : extension revision 1
>   VK_KHR_get_physical_device_properties2 : extension revision 2
>   VK_KHR_get_surface_capabilities2   : extension revision 1
>   VK_KHR_portability_enumeration : extension revision 1
>   VK_KHR_surface : extension revision 25
>   VK_KHR_surface_protected_capabilities  : extension revision 1
>   VK_LUNARG_direct_driver_loading: extension revision 1
>
>   Instance Layers:
>   
>
>   Devices:
>   
>   GPU0:
>   apiVersion = 1.3.267
>   driverVersion  = 0.0.1
>   vendorID   = 0x10005
>   deviceID   = 0x
>   deviceType = PHYSICAL_DEVICE_TYPE_CPU
>   deviceName = llvmpipe (LLVM 15.0.3, 128 bits)
>   driverID   = DRIVER_ID_MESA_LLVMPIPE
>   driverName = llvmpipe
>   driverInfo = Mesa 23.3.2 (LLVM 15.0.3)
>   conformanceVersion = 1.3.1.1
>   deviceUUID = 6d657361-3233-2e33-2e32-
>   driverUUID = 6c6c766d-7069-7065--4944
>
> With an older and more hacked up set of the blob patches I can get
> vulkaninfo to work but I see multiple GPUs and vkmark falls over when
> mapping stuff:
>
>   # vulkaninfo --summary
>   render_state_create_resource: res_id = 5
>   vkr_context_add_resource: res_id = 5
>   vkr_context_impor