Skip to contentSkip to conversation

libdrm: amdgpu: Adding DRM_RDWR flag in amdgpu_bo_export

PATCH In review Satyajit Sahu 2 participants 2 messages Feb 26, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libdrm: amdgpu: Adding DRM_RDWR flag in amdgpu_bo_export

From: Satyajit <[email protected]>

Currently while exporting prime handle to fd read write access is not granted. mmap fails because of this. mmap was not supported on prime initially.
Here is link to related discussion
https://lists.freedesktop.org/archives/dri-devel/2017-February/131840.html

Adding the DRM_RDWR flag in amdgpu_bo_export to support mmap.

---
 amdgpu/amdgpu_bo.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
amdgpu/amdgpu_bo.c +3 -2
index 3853fd0..014c6ff 100644
@@ -250,8 +250,9 @@ int amdgpu_bo_export(amdgpu_bo_handle bo,
 
 	case amdgpu_bo_handle_type_dma_buf_fd:
 		amdgpu_add_handle_to_table(bo);
-		return drmPrimeHandleToFD(bo->dev->fd, bo->handle, DRM_CLOEXEC,
-				       (int*)shared_handle);
+		return drmPrimeHandleToFD(bo->dev->fd, bo->handle,
+					  DRM_CLOEXEC | DRM_RDWR,
+					  (int*)shared_handle);
 	}
 	return -EINVAL;
 }
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 1/1
#1 lore raw

Am 26.02.2018 um 13:37 schrieb Satyajit Sahu:

Quoted 11 lines

From: Satyajit <[email protected]>

Currently while exporting prime handle to fd read write access is not granted. mmap fails because of this. mmap was not supported on prime initially.
Here is link to related discussion
https://lists.freedesktop.org/archives/dri-devel/2017-February/131840.html

Adding the DRM_RDWR flag in amdgpu_bo_export to support mmap.

Quoted 10 lines
---
  amdgpu/amdgpu_bo.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
amdgpu/amdgpu_bo.c +0 -0
index 3853fd0..014c6ff 100644
@@ -250,8 +250,9 @@ int amdgpu_bo_export(amdgpu_bo_handle bo,
 

amdgpu/amdgpu_bo.c int amdgpu_bo_export(amdgpu_bo_handle bo, · line 258

Quoted 10 lines
amdgpu/amdgpu_bo.c +3 -2
  	case amdgpu_bo_handle_type_dma_buf_fd:
  		amdgpu_add_handle_to_table(bo);
-		return drmPrimeHandleToFD(bo->dev->fd, bo->handle, DRM_CLOEXEC,
-				       (int*)shared_handle);
+		return drmPrimeHandleToFD(bo->dev->fd, bo->handle,
+					  DRM_CLOEXEC | DRM_RDWR,
+					  (int*)shared_handle);
  	}
  	return -EINVAL;
  }

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel