From 6c0ce98cb0e68c8c73210e26472f776790950d7f Mon Sep 17 00:00:00 2001 From: Gurchetan Singh Date: Wed, 3 Jul 2024 13:50:34 -0700 Subject: [PATCH] gfxstream: guest: add experimental fence passing APIs This uses the new fence passing APIs provided by kumquat. Reviewed-by: Aaron Ruby Acked-by: Yonggang Luo Acked-by: Adam Jackson Part-of: --- src/gfxstream/guest/platform/include/VirtGpu.h | 8 ++++++-- .../guest/platform/kumquat/VirtGpuKumquatDevice.cpp | 1 + src/gfxstream/guest/platform/linux/LinuxVirtGpuDevice.cpp | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/gfxstream/guest/platform/include/VirtGpu.h b/src/gfxstream/guest/platform/include/VirtGpu.h index c0bfa3b22e4..a43deb42ece 100644 --- a/src/gfxstream/guest/platform/include/VirtGpu.h +++ b/src/gfxstream/guest/platform/include/VirtGpu.h @@ -44,14 +44,18 @@ enum VirtGpuParamId : uint32_t { kParamContextInit = 5, kParamSupportedCapsetIds = 6, kParamExplicitDebugName = 7, - kParamCreateGuestHandle = 8, - kParamMax = 9, + // Experimental, not in upstream Linux + kParamFencePassing = 8, + kParamCreateGuestHandle = 9, + kParamMax = 10, }; enum VirtGpuExecBufferFlags : uint32_t { kFenceIn = 0x0001, kFenceOut = 0x0002, kRingIdx = 0x0004, + kShareableIn = 0x0008, + kShareableOut = 0x0010, }; enum VirtGpuCapset { diff --git a/src/gfxstream/guest/platform/kumquat/VirtGpuKumquatDevice.cpp b/src/gfxstream/guest/platform/kumquat/VirtGpuKumquatDevice.cpp index da2bd71c584..0dfa209156f 100644 --- a/src/gfxstream/guest/platform/kumquat/VirtGpuKumquatDevice.cpp +++ b/src/gfxstream/guest/platform/kumquat/VirtGpuKumquatDevice.cpp @@ -44,6 +44,7 @@ VirtGpuKumquatDevice::VirtGpuKumquatDevice(enum VirtGpuCapset capset, int fd) PARAM(VIRTGPU_KUMQUAT_PARAM_CONTEXT_INIT), PARAM(VIRTGPU_KUMQUAT_PARAM_SUPPORTED_CAPSET_IDs), PARAM(VIRTGPU_KUMQUAT_PARAM_EXPLICIT_DEBUG_NAME), + PARAM(VIRTGPU_KUMQUAT_PARAM_FENCE_PASSING), PARAM(VIRTGPU_KUMQUAT_PARAM_CREATE_GUEST_HANDLE), }; diff --git a/src/gfxstream/guest/platform/linux/LinuxVirtGpuDevice.cpp b/src/gfxstream/guest/platform/linux/LinuxVirtGpuDevice.cpp index 5078a11fd7d..da79b926227 100644 --- a/src/gfxstream/guest/platform/linux/LinuxVirtGpuDevice.cpp +++ b/src/gfxstream/guest/platform/linux/LinuxVirtGpuDevice.cpp @@ -31,6 +31,9 @@ #include "virtgpu_drm.h" #include "virtgpu_gfxstream_protocol.h" +#define VIRTGPU_PARAM_CREATE_FENCE_PASSING 9 /* Fence passing */ +#define VIRTGPU_PARAM_CREATE_GUEST_HANDLE 10 /* Host OS handle can be created from guest memory. */ + #define PARAM(x) \ (struct VirtGpuParam) { x, #x, 0 } @@ -42,6 +45,7 @@ LinuxVirtGpuDevice::LinuxVirtGpuDevice(enum VirtGpuCapset capset, int fd) : Virt PARAM(VIRTGPU_PARAM_RESOURCE_BLOB), PARAM(VIRTGPU_PARAM_HOST_VISIBLE), PARAM(VIRTGPU_PARAM_CROSS_DEVICE), PARAM(VIRTGPU_PARAM_CONTEXT_INIT), PARAM(VIRTGPU_PARAM_SUPPORTED_CAPSET_IDs), PARAM(VIRTGPU_PARAM_EXPLICIT_DEBUG_NAME), + PARAM(VIRTGPU_PARAM_CREATE_FENCE_PASSING), PARAM(VIRTGPU_PARAM_CREATE_GUEST_HANDLE), };