diff options
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gpu_error.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_scheduler.c | 28 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_scheduler.h | 1 |
4 files changed, 35 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 983aafecce7d..2d3c956e382b 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -2678,6 +2678,10 @@ void __i915_add_request(struct drm_i915_gem_request *request, WARN_ON(request->seqno != dev_priv->last_seqno); } + /* Notify the scheduler, if it doesn't already track this request */ + if (!request->scheduler_qe) + i915_scheduler_fly_request(request); + /* Record the position of the start of the request so that * should we detect the updated seqno part-way through the * GPU processing the request, we never over-estimate the diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c index 89051700aea7..f87e5cb50b27 100644 --- a/drivers/gpu/drm/i915/i915_gpu_error.c +++ b/drivers/gpu/drm/i915/i915_gpu_error.c @@ -1376,6 +1376,8 @@ static void i915_gem_record_rings(struct drm_device *dev, i915_gem_obj_ggtt_offset(request->ringbuf->obj); erq->scheduler_state = !sqe ? 'u' : i915_scheduler_queue_status_chr(sqe->status); + if (request->scheduler_flags & I915_REQ_SF_UNTRACKED) + erq->scheduler_state = 'U'; } } } diff --git a/drivers/gpu/drm/i915/i915_scheduler.c b/drivers/gpu/drm/i915/i915_scheduler.c index 3887bf92fd26..c7fb5ac5cee9 100644 --- a/drivers/gpu/drm/i915/i915_scheduler.c +++ b/drivers/gpu/drm/i915/i915_scheduler.c @@ -281,6 +281,34 @@ static void i915_scheduler_node_fly(struct i915_scheduler_queue_entry *node) } } +/* An untracked request is being launched ... */ +void i915_scheduler_fly_request(struct drm_i915_gem_request *req) +{ + struct drm_i915_private *dev_priv = req->i915; + struct i915_scheduler *scheduler = dev_priv->scheduler; + + if (!i915.enable_scheduler) { + req->scheduler_flags |= I915_REQ_SF_UNTRACKED; + return; + } + + WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex)); + + /* This shouldn't happen */ + WARN_ON(i915_scheduler_is_engine_busy(req->engine)); + + /* We don't expect to see nodes that are already tracked */ + if (!WARN_ON(req->scheduler_qe)) { + /* + * Untracked node (e.g. context initialisation batch buffer), + * must not be inside scheduler submission path. + */ + WARN_ON((scheduler->flags[req->engine->id] & I915_SF_SUBMITTING)); + scheduler->stats[req->engine->id].non_batch++; + req->scheduler_flags |= I915_REQ_SF_UNTRACKED; + } +} + static inline uint32_t i915_scheduler_count_flying(struct i915_scheduler *scheduler, struct intel_engine_cs *engine) { diff --git a/drivers/gpu/drm/i915/i915_scheduler.h b/drivers/gpu/drm/i915/i915_scheduler.h index 47b260f8b6b7..f5f93f525e69 100644 --- a/drivers/gpu/drm/i915/i915_scheduler.h +++ b/drivers/gpu/drm/i915/i915_scheduler.h @@ -216,6 +216,7 @@ bool i915_scheduler_is_engine_flying(struct intel_engine_cs *engine); bool i915_scheduler_is_engine_preempting(struct intel_engine_cs *engine); bool i915_scheduler_is_engine_busy(struct intel_engine_cs *engine); void i915_scheduler_work_handler(struct work_struct *work); +void i915_scheduler_fly_request(struct drm_i915_gem_request *req); int i915_scheduler_flush(struct intel_engine_cs *engine, bool is_locked); int i915_scheduler_flush_stamp(struct intel_engine_cs *engine, unsigned long stamp, bool is_locked); |