diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c index 1c9991738477..4b584cb75bf4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c | |||
@@ -132,6 +132,7 @@ static int amdgpu_gem_map_attach(struct dma_buf *dma_buf, | |||
132 | { | 132 | { |
133 | struct drm_gem_object *obj = dma_buf->priv; | 133 | struct drm_gem_object *obj = dma_buf->priv; |
134 | struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj); | 134 | struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj); |
135 | struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); | ||
135 | long r; | 136 | long r; |
136 | 137 | ||
137 | r = drm_gem_map_attach(dma_buf, target_dev, attach); | 138 | 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 | goto error_detach; | 144 | goto error_detach; |
144 | 145 | ||
145 | 146 | ||
146 | if (dma_buf->ops != &amdgpu_dmabuf_ops) { | 147 | if (attach->dev->driver != adev->dev->driver) { |
147 | /* | 148 | /* |
148 | * Wait for all shared fences to complete before we switch to future | 149 | * Wait for all shared fences to complete before we switch to future |
149 | * use of exclusive fence on this prime shared bo. | 150 | * 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 | if (r) | 163 | if (r) |
163 | goto error_unreserve; | 164 | goto error_unreserve; |
164 | 165 | ||
165 | if (dma_buf->ops != &amdgpu_dmabuf_ops) | 166 | if (attach->dev->driver != adev->dev->driver) |
166 | bo->prime_shared_count++; | 167 | bo->prime_shared_count++; |
167 | 168 | ||
168 | error_unreserve: | 169 | error_unreserve: |
@@ -179,6 +180,7 @@ static void amdgpu_gem_map_detach(struct dma_buf *dma_buf, | |||
179 | { | 180 | { |
180 | struct drm_gem_object *obj = dma_buf->priv; | 181 | struct drm_gem_object *obj = dma_buf->priv; |
181 | struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj); | 182 | struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj); |
183 | struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); | ||
182 | int ret = 0; | 184 | int ret = 0; |
183 | 185 | ||
184 | ret = amdgpu_bo_reserve(bo, true); | 186 | ret = amdgpu_bo_reserve(bo, true); |
@@ -186,7 +188,7 @@ static void amdgpu_gem_map_detach(struct dma_buf *dma_buf, | |||
186 | goto error; | 188 | goto error; |
187 | 189 | ||
188 | amdgpu_bo_unpin(bo); | 190 | amdgpu_bo_unpin(bo); |
189 | if (dma_buf->ops != &amdgpu_dmabuf_ops && bo->prime_shared_count) | 191 | if (attach->dev->driver != adev->dev->driver && bo->prime_shared_count) |
190 | bo->prime_shared_count--; | 192 | bo->prime_shared_count--; |
191 | amdgpu_bo_unreserve(bo); | 193 | amdgpu_bo_unreserve(bo); |
192 | 194 | ||