Skip to content

Commit

Permalink
drm/amdgpu: fix "mitigate workaround for i915"
Browse files Browse the repository at this point in the history
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=105633
Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Christian König authored and Alex Deucher committed Mar 21, 2018
1 parent 3296c4a commit 2333bf9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ static int amdgpu_gem_map_attach(struct dma_buf *dma_buf,
{
struct drm_gem_object *obj = dma_buf->priv;
struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
long r;

r = drm_gem_map_attach(dma_buf, target_dev, attach);
Expand All @@ -143,7 +144,7 @@ static int amdgpu_gem_map_attach(struct dma_buf *dma_buf,
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
* use of exclusive fence on this prime shared bo.
Expand All @@ -162,7 +163,7 @@ static int amdgpu_gem_map_attach(struct dma_buf *dma_buf,
if (r)
goto error_unreserve;

if (dma_buf->ops != &amdgpu_dmabuf_ops)
if (attach->dev->driver != adev->dev->driver)
bo->prime_shared_count++;

error_unreserve:
Expand All @@ -179,14 +180,15 @@ static void amdgpu_gem_map_detach(struct dma_buf *dma_buf,
{
struct drm_gem_object *obj = dma_buf->priv;
struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
int ret = 0;

ret = amdgpu_bo_reserve(bo, true);
if (unlikely(ret != 0))
goto error;

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--;
amdgpu_bo_unreserve(bo);

Expand Down

0 comments on commit 2333bf9

Please sign in to comment.