freedreno/drm, turnip: set DRM_RDWR for exported dma-bufs
This allows the exported fds to be mapped for writing. My use case is for virtio-gpu blob resources where the fds are mapped rw and mappings are added to the guests using KVM_SET_USER_MEMORY_REGION. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14699>
This commit is contained in:
@@ -416,7 +416,8 @@ fd_bo_dmabuf(struct fd_bo *bo)
|
||||
{
|
||||
int ret, prime_fd;
|
||||
|
||||
ret = drmPrimeHandleToFD(bo->dev->fd, bo->handle, DRM_CLOEXEC, &prime_fd);
|
||||
ret = drmPrimeHandleToFD(bo->dev->fd, bo->handle, DRM_CLOEXEC | DRM_RDWR,
|
||||
&prime_fd);
|
||||
if (ret) {
|
||||
ERROR_MSG("failed to get dmabuf fd: %d", ret);
|
||||
return ret;
|
||||
|
@@ -288,7 +288,7 @@ tu_bo_export_dmabuf(struct tu_device *dev, struct tu_bo *bo)
|
||||
{
|
||||
int prime_fd;
|
||||
int ret = drmPrimeHandleToFD(dev->fd, bo->gem_handle,
|
||||
DRM_CLOEXEC, &prime_fd);
|
||||
DRM_CLOEXEC | DRM_RDWR, &prime_fd);
|
||||
|
||||
return ret == 0 ? prime_fd : -1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user