Commit 2333bf9a authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/amdgpu: fix "mitigate workaround for i915"

Mixed up exporter and importer here. E.g. while mapping the BO we need
to check the importer not the exporter.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105633Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Tested-by: default avatarMike Lothian <mike@fireburn.co.uk>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 3296c4ae
...@@ -132,6 +132,7 @@ static int amdgpu_gem_map_attach(struct dma_buf *dma_buf, ...@@ -132,6 +132,7 @@ static int amdgpu_gem_map_attach(struct dma_buf *dma_buf,
{ {
struct drm_gem_object *obj = dma_buf->priv; struct drm_gem_object *obj = dma_buf->priv;
struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj); struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
long r; long r;
r = drm_gem_map_attach(dma_buf, target_dev, attach); r = drm_gem_map_attach(dma_buf, target_dev, attach);
...@@ -143,7 +144,7 @@ static int amdgpu_gem_map_attach(struct dma_buf *dma_buf, ...@@ -143,7 +144,7 @@ static int amdgpu_gem_map_attach(struct dma_buf *dma_buf,
goto error_detach; goto error_detach;
if (dma_buf->ops != &amdgpu_dmabuf_ops) { if (attach->dev->driver != adev->dev->driver) {
/* /*
* Wait for all shared fences to complete before we switch to future * Wait for all shared fences to complete before we switch to future
* use of exclusive fence on this prime shared bo. * use of exclusive fence on this prime shared bo.
...@@ -162,7 +163,7 @@ static int amdgpu_gem_map_attach(struct dma_buf *dma_buf, ...@@ -162,7 +163,7 @@ static int amdgpu_gem_map_attach(struct dma_buf *dma_buf,
if (r) if (r)
goto error_unreserve; goto error_unreserve;
if (dma_buf->ops != &amdgpu_dmabuf_ops) if (attach->dev->driver != adev->dev->driver)
bo->prime_shared_count++; bo->prime_shared_count++;
error_unreserve: error_unreserve:
...@@ -179,6 +180,7 @@ static void amdgpu_gem_map_detach(struct dma_buf *dma_buf, ...@@ -179,6 +180,7 @@ static void amdgpu_gem_map_detach(struct dma_buf *dma_buf,
{ {
struct drm_gem_object *obj = dma_buf->priv; struct drm_gem_object *obj = dma_buf->priv;
struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj); struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
int ret = 0; int ret = 0;
ret = amdgpu_bo_reserve(bo, true); ret = amdgpu_bo_reserve(bo, true);
...@@ -186,7 +188,7 @@ static void amdgpu_gem_map_detach(struct dma_buf *dma_buf, ...@@ -186,7 +188,7 @@ static void amdgpu_gem_map_detach(struct dma_buf *dma_buf,
goto error; goto error;
amdgpu_bo_unpin(bo); amdgpu_bo_unpin(bo);
if (dma_buf->ops != &amdgpu_dmabuf_ops && bo->prime_shared_count) if (attach->dev->driver != adev->dev->driver && bo->prime_shared_count)
bo->prime_shared_count--; bo->prime_shared_count--;
amdgpu_bo_unreserve(bo); amdgpu_bo_unreserve(bo);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment