diff options
author | Christian König <christian.koenig@amd.com> | 2017-10-09 09:18:43 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-10-19 15:27:04 -0400 |
commit | e55f2b646df3318e24f12b8388ab6e5cccb3e92d (patch) | |
tree | de65b871c6ad10ddfc97a9b74b953d46b72e27f1 /drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | |
parent | 14e47f93c5cc4a1237dbacc137e174706093b69c (diff) |
drm/amdgpu: move the VRAM lost counter per context
Instead of per device track the VRAM lost per context and return ECANCELED
instead of ENODEV.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index 9daa7cac0ffb..b355189533d2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | |||
@@ -172,7 +172,11 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data) | |||
172 | if (ret) | 172 | if (ret) |
173 | goto free_all_kdata; | 173 | goto free_all_kdata; |
174 | 174 | ||
175 | p->job->vram_lost_counter = fpriv->vram_lost_counter; | 175 | p->job->vram_lost_counter = atomic_read(&p->adev->vram_lost_counter); |
176 | if (p->ctx->vram_lost_counter != p->job->vram_lost_counter) { | ||
177 | ret = -ECANCELED; | ||
178 | goto free_all_kdata; | ||
179 | } | ||
176 | 180 | ||
177 | if (p->uf_entry.robj) | 181 | if (p->uf_entry.robj) |
178 | p->job->uf_addr = uf_offset; | 182 | p->job->uf_addr = uf_offset; |
@@ -1205,7 +1209,6 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p, | |||
1205 | int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) | 1209 | int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) |
1206 | { | 1210 | { |
1207 | struct amdgpu_device *adev = dev->dev_private; | 1211 | struct amdgpu_device *adev = dev->dev_private; |
1208 | struct amdgpu_fpriv *fpriv = filp->driver_priv; | ||
1209 | union drm_amdgpu_cs *cs = data; | 1212 | union drm_amdgpu_cs *cs = data; |
1210 | struct amdgpu_cs_parser parser = {}; | 1213 | struct amdgpu_cs_parser parser = {}; |
1211 | bool reserved_buffers = false; | 1214 | bool reserved_buffers = false; |
@@ -1213,8 +1216,6 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) | |||
1213 | 1216 | ||
1214 | if (!adev->accel_working) | 1217 | if (!adev->accel_working) |
1215 | return -EBUSY; | 1218 | return -EBUSY; |
1216 | if (amdgpu_kms_vram_lost(adev, fpriv)) | ||
1217 | return -ENODEV; | ||
1218 | 1219 | ||
1219 | parser.adev = adev; | 1220 | parser.adev = adev; |
1220 | parser.filp = filp; | 1221 | parser.filp = filp; |