drm/tegra: Avoid using import_attach directly
cover drm/tegra: Avoid using import_attach directly
The field import_attach of struct drm_gem_object is often only required by PRIME code. In other places, replace its use with clearer alternatives.
Thomas Zimmermann (2):
drm/tegra: Test for imported buffers with drm_gem_is_imported() drm/tegra: Use dma_buf from GEM object instance
drivers/gpu/drm/tegra/gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.49.0
PATCH 1/2 drm/tegra: Test for imported buffers with drm_gem_is_imported()
Instead of testing import_attach for imported GEM buffers, invoke drm_gem_is_imported() to do the test.
--- drivers/gpu/drm/tegra/gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tegra/gem.c +1 -1
@@ -523,7 +523,7 @@ void tegra_bo_free_object(struct drm_gem_object *gem)if (tegra->domain) {tegra_bo_iommu_unmap (tegra, bo); -if (gem->import_attach) { +if (drm_gem_is_imported (gem)) {dma_buf_unmap_attachment_unlocked (gem->import_attach, bo->sgt,DMA_TO_DEVICE );dma_buf_detach (gem->import_attach->dmabuf, gem->import_attach);
Signature · 1 line
2.49.0
PATCH 2/2 drm/tegra: Use dma_buf from GEM object instance
In reply to Thomas ZimmermannAvoid 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 an implementation detail of PRIME.
--- drivers/gpu/drm/tegra/gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tegra/gem.c +1 -1
@@ -526,7 +526,7 @@ void tegra_bo_free_object(struct drm_gem_object *gem)if (drm_gem_is_imported (gem)) {dma_buf_unmap_attachment_unlocked (gem->import_attach, bo->sgt,DMA_TO_DEVICE ); -dma_buf_detach (gem->import_attach->dmabuf, gem->import_attach); +dma_buf_detach (gem->dma_buf, gem->import_attach); } }
Signature · 1 line
2.49.0
Quoted 11 lines · Thomas Zimmermann
The field
import_attachof structdrm_gem_objectis often only required by PRIME code. In other places, replace its use with clearer alternatives.Thomas Zimmermann (2):
drm/tegra: Test for imported buffers withdrm_gem_is_imported()drm/tegra: Usedma_buffrom GEM object instancedrivers/gpu/drm/tegra/gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Thierry Reding
AppliedQuoted 10 lines · Thomas Zimmermann
The field
import_attachof structdrm_gem_objectis often only required by PRIME code. In other places, replace its use with clearer alternatives.Thomas Zimmermann (2):
drm/tegra: Test for imported buffers withdrm_gem_is_imported()drm/tegra: Usedma_buffrom GEM object instancedrivers/gpu/drm/tegra/gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Applied, thanks.
Thierry