From 06369caa40262bae9dad1cbfad7365e27e6be5e8 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Tue, 11 Mar 2025 21:28:24 -0700 Subject: [PATCH] pan/kmod: set DRM_RDWR for exported dma-bufs This allows the exported fds to be mapped for writing. This is needed for virtgpu native ctx support where the fds are mapped rw when the mappings are added to the guest by kvm. This aligns with other mesa drivers, and unblocks the extended testing with venus on top. Part-of: --- src/panfrost/lib/kmod/pan_kmod.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/panfrost/lib/kmod/pan_kmod.h b/src/panfrost/lib/kmod/pan_kmod.h index 8b809d4a54a..99540bf6d8e 100644 --- a/src/panfrost/lib/kmod/pan_kmod.h +++ b/src/panfrost/lib/kmod/pan_kmod.h @@ -565,7 +565,8 @@ pan_kmod_bo_export(struct pan_kmod_bo *bo) { int fd; - if (drmPrimeHandleToFD(bo->dev->fd, bo->handle, DRM_CLOEXEC, &fd)) { + if (drmPrimeHandleToFD(bo->dev->fd, bo->handle, DRM_CLOEXEC | DRM_RDWR, + &fd)) { mesa_loge("drmPrimeHandleToFD() failed (err=%d)", errno); return -1; }