Skip to contentSkip to conversation

amdgpu: don't call add_handle_to_table for KMS BO exports

PATCH In review Marek Olšák 2 participants 2 messages Jul 6, 2018 – Jul 9, 2018 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 amdgpu: don't call add_handle_to_table for KMS BO exports

From: Marek Olšák <[email protected]>

---
 amdgpu/amdgpu_bo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
amdgpu/amdgpu_bo.c +1 -1
index 9e37b14..9e7f958 100644
@@ -233,21 +233,21 @@ int amdgpu_bo_export(amdgpu_bo_handle bo,
 	switch (type) {
 	case amdgpu_bo_handle_type_gem_flink_name:
 		r = amdgpu_bo_export_flink(bo);
 		if (r)
 			return r;
 
 		*shared_handle = bo->flink_name;
 		return 0;
 
 	case amdgpu_bo_handle_type_kms:
-		amdgpu_add_handle_to_table(bo);
+		/* Don't add the handle to the hash table. It can't be reimported. */
 		*shared_handle = bo->handle;
 		return 0;
 
 	case amdgpu_bo_handle_type_dma_buf_fd:
 		amdgpu_add_handle_to_table(bo);
 		return drmPrimeHandleToFD(bo->dev->fd, bo->handle,
 					  DRM_CLOEXEC | DRM_RDWR,
 					  (int*)shared_handle);
 	}
 	return -EINVAL;
Signature · 6 lines
2.7.4

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

A message that is not in the archive (sent off-list or not yet received): 1530908218-10976-1-git-send-email-maraeo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

Reviewed-by Junwei Zhang
#2 lore raw
Quoted 13 lines · Marek Olšák

From: Marek Olšák <[email protected]>

---
  amdgpu/amdgpu_bo.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
amdgpu/amdgpu_bo.c +0 -0
index 9e37b14..9e7f958 100644
@@ -233,21 +233,21 @@ int amdgpu_bo_export(amdgpu_bo_handle bo,
  	switch (type) {
  	case amdgpu_bo_handle_type_gem_flink_name:

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

Quoted 10 lines
amdgpu/amdgpu_bo.c +1 -1
  		r = amdgpu_bo_export_flink(bo);
  		if (r)
  			return r;
 
  		*shared_handle = bo->flink_name;
  		return 0;
 
  	case amdgpu_bo_handle_type_kms:
-		amdgpu_add_handle_to_table(bo);
+		/* Don't add the handle to the hash table. It can't be reimported. */

Yeah, good catch.

That's really likely to confuse someone.
Maybe we need to consider to separate it into a new function.

Jerry

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

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

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