drm/i915: check context reset stats before relocations
Doing it early prevents moving and relocating objects in vain for contexts that won't get any GPU time. Reported-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
70903c3ba8
commit
d299cce76e
|
@ -884,6 +884,24 @@ validate_exec_list(struct drm_i915_gem_exec_object2 *exec,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
i915_gem_validate_context(struct drm_device *dev, struct drm_file *file,
|
||||
const u32 ctx_id)
|
||||
{
|
||||
struct i915_ctx_hang_stats *hs;
|
||||
|
||||
hs = i915_gem_context_get_hang_stats(dev, file, ctx_id);
|
||||
if (IS_ERR(hs))
|
||||
return PTR_ERR(hs);
|
||||
|
||||
if (hs->banned) {
|
||||
DRM_DEBUG("Context %u tried to submit while banned\n", ctx_id);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
i915_gem_execbuffer_move_to_active(struct list_head *vmas,
|
||||
struct intel_ring_buffer *ring)
|
||||
|
@ -963,8 +981,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
|
|||
struct drm_i915_gem_object *batch_obj;
|
||||
struct drm_clip_rect *cliprects = NULL;
|
||||
struct intel_ring_buffer *ring;
|
||||
struct i915_ctx_hang_stats *hs;
|
||||
u32 ctx_id = i915_execbuffer2_get_context_id(*args);
|
||||
const u32 ctx_id = i915_execbuffer2_get_context_id(*args);
|
||||
u32 exec_start, exec_len;
|
||||
u32 mask, flags;
|
||||
int ret, mode, i;
|
||||
|
@ -1101,6 +1118,12 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
|
|||
goto pre_mutex_err;
|
||||
}
|
||||
|
||||
ret = i915_gem_validate_context(dev, file, ctx_id);
|
||||
if (ret) {
|
||||
mutex_unlock(&dev->struct_mutex);
|
||||
goto pre_mutex_err;
|
||||
}
|
||||
|
||||
eb = eb_create(args);
|
||||
if (eb == NULL) {
|
||||
mutex_unlock(&dev->struct_mutex);
|
||||
|
@ -1153,17 +1176,6 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
|
|||
if (ret)
|
||||
goto err;
|
||||
|
||||
hs = i915_gem_context_get_hang_stats(dev, file, ctx_id);
|
||||
if (IS_ERR(hs)) {
|
||||
ret = PTR_ERR(hs);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (hs->banned) {
|
||||
ret = -EIO;
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = i915_switch_context(ring, file, ctx_id);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
|
Loading…
Reference in a new issue