History

drm/i915/scheduler: Signal the arrival of a new request

The start of the scheduler, add a hook into request submission for the scheduler to see the arrival of new requests and prepare its runqueues.

Chris Wilson committed 10 years ago

Commit 0de91361 parent 663f71e5 files · +34 −0Browse files

Unified · Split

5 files
  1. drivers/gpu/drm/i915/i915_drv.c +4 −0
  2. drivers/gpu/drm/i915/i915_gem_request.c +13 −0
  3. drivers/gpu/drm/i915/intel_engine_cs.c +3 −0
  4. drivers/gpu/drm/i915/intel_ringbuffer.h +9 −0
  5. include/uapi/drm/i915_drm.h +5 −0
drivers/gpu/drm/i915/i915_drv.c+4−0
@@ -323,6 +323,10 @@ static int i915_getparam(struct drm_device *dev, void *data, · 322 unmodified lines
323323 */
324324 value = i915_gem_mmap_gtt_version();
325325 break;
326+ case I915_PARAM_HAS_SCHEDULER:
327+ value = dev_priv->engine[RCS] &&
328+ dev_priv->engine[RCS]->schedule;
329+ break;
326330 case I915_PARAM_MMAP_VERSION:
327331 /* Remember to bump this if the version changes! */
328332 case I915_PARAM_HAS_GEM:
drivers/gpu/drm/i915/i915_gem_request.c+13−0
@@ -762,6 +762,19 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches) · 761 unmodified lines
762762
763763 i915_gem_mark_busy(engine);
764764
765+ /* Let the backend know a new request has arrived that may need
766+ * to adjust the existing execution schedule due to a high priority
767+ * request - i.e. we may want to preempt the current request in order
768+ * to run a high priority dependency chain *before* we can execute this
769+ * request.
770+ *
771+ * This is called before the request is ready to run so that we can
772+ * decide whether to preempt the entire chain so that it is ready to
773+ * run at the earliest possible convenience.
774+ */
775+ if (engine->schedule)
776+ engine->schedule(request, 0);
777+
765778 local_bh_disable();
766779 i915_sw_fence_commit(&request->submit);
767780 local_bh_enable(); /* Kick the execlists tasklet if just scheduled */
drivers/gpu/drm/i915/intel_engine_cs.c+3−0
@@ -102,6 +102,9 @@ intel_engine_setup(struct drm_i915_private *dev_priv, · 101 unmodified lines
102102 engine->mmio_base = info->mmio_base;
103103 engine->irq_shift = info->irq_shift;
104104
105+ /* Nothing to do here, execute in order of dependencies */
106+ engine->schedule = NULL;
107+
105108 dev_priv->engine[id] = engine;
106109 return 0;
107110 }
drivers/gpu/drm/i915/intel_ringbuffer.h+9−0
@@ -267,6 +267,15 @@ struct intel_engine_cs { · 266 unmodified lines
267267 */
268268 void (*submit_request)(struct drm_i915_gem_request *req);
269269
270+ /* Call when the priority on a request has changed and it and its
271+ * dependencies may need rescheduling. Note the request itself may
272+ * not be ready to run!
273+ *
274+ * Called under the struct_mutex.
275+ */
276+ void (*schedule)(struct drm_i915_gem_request *request,
277+ int priority);
278+
270279 /* Some chipsets are not quite as coherent as advertised and need
271280 * an expensive kick to force a true read of the up-to-date seqno.
272281 * However, the up-to-date seqno is not always required and the last
include/uapi/drm/i915_drm.h+5−0
@@ -389,6 +389,11 @@ typedef struct drm_i915_irq_wait { · 388 unmodified lines
389389 #define I915_PARAM_MIN_EU_IN_POOL 39
390390 #define I915_PARAM_MMAP_GTT_VERSION 40
391391
392+/* Query whether DRM_I915_GEM_EXECBUFFER2 supports user defined execution
393+ * priorities and the driver will attempt to execute batches in priority order.
394+ */
395+#define I915_PARAM_HAS_SCHEDULER 41
396+
392397 typedef struct drm_i915_getparam {
393398 __s32 param;
394399 /*

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t