From 52ac6bdae64845b9f9f2405e0208fe7f038019fe Mon Sep 17 00:00:00 2001 From: Weifeng Liu Date: Wed, 27 Nov 2024 09:33:18 +0000 Subject: [PATCH] Use ivshmem-backed virtio-GPU as KMS driver in the case of QNX The QNX scenario uses ivshmem-backed virtio-GPU for display, a special use case for us. We distinguish this scenario by checking whether the ivshmem virtio-GPU is the only virtio-GPU on the system. Tracked-On: OAM-127906 Signed-off-by: Weifeng Liu --- cros_gralloc/cros_gralloc_driver.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cros_gralloc/cros_gralloc_driver.cc b/cros_gralloc/cros_gralloc_driver.cc index 22c1b85..39784c4 100644 --- a/cros_gralloc/cros_gralloc_driver.cc +++ b/cros_gralloc/cros_gralloc_driver.cc @@ -958,9 +958,17 @@ int cros_gralloc_driver::select_render_driver(uint64_t gpu_grp_type) int cros_gralloc_driver::select_kms_driver(uint64_t gpu_grp_type) { + // virtio-GPU without blob cannot import external buffers. if (gpu_grp_type & GPU_GRP_TYPE_HAS_VIRTIO_GPU_NO_BLOB_BIT) { return GPU_GRP_TYPE_VIRTIO_GPU_NO_BLOB_IDX; } + // QNX case: virtio-GPU is ivshmem backed device and cannot import external buffers. + // Screen cast also uses ivshmem virtio-GPU but we have virtio-GPU supporting blob. + if ((gpu_grp_type & GPU_GRP_TYPE_HAS_VIRTIO_GPU_IVSHMEM_BIT) && + !(gpu_grp_type & GPU_GRP_TYPE_HAS_VIRTIO_GPU_BLOB_BIT) && + !(gpu_grp_type & GPU_GRP_TYPE_HAS_VIRTIO_GPU_BLOB_P2P_BIT)) { + return GPU_GRP_TYPE_VIRTIO_GPU_IVSHMEM_IDX; + } if (gpu_grp_type & GPU_GRP_TYPE_HAS_INTEL_DGPU_BIT) { return GPU_GRP_TYPE_INTEL_DGPU_IDX; }