mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 16:48:26 +02:00 
			
		
		
		
	drm/gem-shmem: Use dma_buf from GEM object instance
Avoid dereferencing struct drm_gem_object.import_attach for the imported dma-buf. The dma_buf field in the GEM object instance refers to the same buffer. Prepares to make import_attach optional. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Anusha Srivatsa <asrivats@redhat.com> Reviewed-by: Christian König <christian.koenig@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250226172457.217725-6-tzimmermann@suse.de
This commit is contained in:
		
							parent
							
								
									dbdd636e51
								
							
						
					
					
						commit
						1a148af060
					
				
					 1 changed files with 3 additions and 3 deletions
				
			
		|  | @ -339,10 +339,10 @@ int drm_gem_shmem_vmap(struct drm_gem_shmem_object *shmem, | |||
| 	int ret = 0; | ||||
| 
 | ||||
| 	if (drm_gem_is_imported(obj)) { | ||||
| 		ret = dma_buf_vmap(obj->import_attach->dmabuf, map); | ||||
| 		ret = dma_buf_vmap(obj->dma_buf, map); | ||||
| 		if (!ret) { | ||||
| 			if (drm_WARN_ON(obj->dev, map->is_iomem)) { | ||||
| 				dma_buf_vunmap(obj->import_attach->dmabuf, map); | ||||
| 				dma_buf_vunmap(obj->dma_buf, map); | ||||
| 				return -EIO; | ||||
| 			} | ||||
| 		} | ||||
|  | @ -405,7 +405,7 @@ void drm_gem_shmem_vunmap(struct drm_gem_shmem_object *shmem, | |||
| 	struct drm_gem_object *obj = &shmem->base; | ||||
| 
 | ||||
| 	if (drm_gem_is_imported(obj)) { | ||||
| 		dma_buf_vunmap(obj->import_attach->dmabuf, map); | ||||
| 		dma_buf_vunmap(obj->dma_buf, map); | ||||
| 	} else { | ||||
| 		dma_resv_assert_held(shmem->base.resv); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Thomas Zimmermann
						Thomas Zimmermann