diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 17 | 
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index e8440d306496..10b9e99c8941 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -127,8 +127,6 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, union drm_amdgpu_cs  		goto free_chunk;  	} -	mutex_lock(&p->ctx->lock); -  	/* skip guilty context job */  	if (atomic_read(&p->ctx->guilty) == 1) {  		ret = -ECANCELED; @@ -585,6 +583,16 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,  		}  	} +	/* Move fence waiting after getting reservation lock of +	 * PD root. Then there is no need on a ctx mutex lock. +	 */ +	r = amdgpu_ctx_wait_prev_fence(p->ctx, p->entity); +	if (unlikely(r != 0)) { +		if (r != -ERESTARTSYS) +			DRM_ERROR("amdgpu_ctx_wait_prev_fence failed.\n"); +		goto error_validate; +	} +  	amdgpu_cs_get_threshold_for_moves(p->adev, &p->bytes_moved_threshold,  					  &p->bytes_moved_vis_threshold);  	p->bytes_moved = 0; @@ -700,7 +708,6 @@ static void amdgpu_cs_parser_fini(struct amdgpu_cs_parser *parser, int error,  	dma_fence_put(parser->fence);  	if (parser->ctx) { -		mutex_unlock(&parser->ctx->lock);  		amdgpu_ctx_put(parser->ctx);  	}  	if (parser->bo_list) @@ -944,7 +951,7 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev,  	if (parser->job->uf_addr && ring->funcs->no_user_fence)  		return -EINVAL; -	return amdgpu_ctx_wait_prev_fence(parser->ctx, parser->entity); +	return 0;  }  static int amdgpu_cs_process_fence_dep(struct amdgpu_cs_parser *p, @@ -1360,7 +1367,6 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)  		goto out;  	r = amdgpu_cs_submit(&parser, cs); -  out:  	amdgpu_cs_parser_fini(&parser, r, reserved_buffers); @@ -1506,6 +1512,7 @@ int amdgpu_cs_fence_to_handle_ioctl(struct drm_device *dev, void *data,  		return 0;  	default: +		dma_fence_put(fence);  		return -EINVAL;  	}  }  | 
