From 5090aa71604765135100b7b55e201837dd389e13 Mon Sep 17 00:00:00 2001 From: Gurchetan Singh Date: Mon, 16 Jun 2025 07:42:56 -0700 Subject: [PATCH] gfxstream: fix opening virtgpu DRM Somebody needs to modify Cuttlefish's SELinux rules to account for the syscalls used by drmGetDevices2(). Reviewed-by: Marcin Radomski Part-of: --- .../guest/platform/linux/LinuxVirtGpuDevice.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gfxstream/guest/platform/linux/LinuxVirtGpuDevice.cpp b/src/gfxstream/guest/platform/linux/LinuxVirtGpuDevice.cpp index d1084821517..9b55eada0e9 100644 --- a/src/gfxstream/guest/platform/linux/LinuxVirtGpuDevice.cpp +++ b/src/gfxstream/guest/platform/linux/LinuxVirtGpuDevice.cpp @@ -164,12 +164,21 @@ int32_t LinuxVirtGpuDevice::init(int32_t descriptor) { #endif if (descriptor < 0) { +#if DETECT_OS_ANDROID + // Somebody needs to modify CF's SELinux rules to account for the syscalls used by + // drmGetDevices2(). + mDeviceHandle = static_cast(drmOpenRender(128)); + if (mDeviceHandle < 0) { + mesa_loge("Failed to open rendernode: %s", strerror(errno)); + return -EINVAL; + } +#else ret = openDevice(); if (ret < 0) { mesa_logd("no virtio_gpu devices found"); return ret; } - +#endif } else { mDeviceHandle = dup(descriptor); if (mDeviceHandle < 0) {