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.
Unified · Split
| @@ -323,6 +323,10 @@ static int i915_getparam(struct drm_device *dev, void *data, · 322 unmodified lines | ||
| 323 | 323 | */ |
| 324 | 324 | value = i915_gem_mmap_gtt_version(); |
| 325 | 325 | break; |
| 326 | + case I915_PARAM_HAS_SCHEDULER: | |
| 327 | + value = dev_priv->engine[RCS] && | |
| 328 | + dev_priv->engine[RCS]->schedule; | |
| 329 | + break; | |
| 326 | 330 | case I915_PARAM_MMAP_VERSION: |
| 327 | 331 | /* Remember to bump this if the version changes! */ |
| 328 | 332 | case I915_PARAM_HAS_GEM: |
| @@ -762,6 +762,19 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches) · 761 unmodified lines | ||
| 762 | 762 | |
| 763 | 763 | i915_gem_mark_busy(engine); |
| 764 | 764 | |
| 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 | + | |
| 765 | 778 | local_bh_disable(); |
| 766 | 779 | i915_sw_fence_commit(&request->submit); |
| 767 | 780 | local_bh_enable(); /* Kick the execlists tasklet if just scheduled */ |
| @@ -102,6 +102,9 @@ intel_engine_setup(struct drm_i915_private *dev_priv, · 101 unmodified lines | ||
| 102 | 102 | engine->mmio_base = info->mmio_base; |
| 103 | 103 | engine->irq_shift = info->irq_shift; |
| 104 | 104 | |
| 105 | + /* Nothing to do here, execute in order of dependencies */ | |
| 106 | + engine->schedule = NULL; | |
| 107 | + | |
| 105 | 108 | dev_priv->engine[id] = engine; |
| 106 | 109 | return 0; |
| 107 | 110 | } |
| @@ -267,6 +267,15 @@ struct intel_engine_cs { · 266 unmodified lines | ||
| 267 | 267 | */ |
| 268 | 268 | void (*submit_request)(struct drm_i915_gem_request *req); |
| 269 | 269 | |
| 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 | + | |
| 270 | 279 | /* Some chipsets are not quite as coherent as advertised and need |
| 271 | 280 | * an expensive kick to force a true read of the up-to-date seqno. |
| 272 | 281 | * However, the up-to-date seqno is not always required and the last |
| @@ -389,6 +389,11 @@ typedef struct drm_i915_irq_wait { · 388 unmodified lines | ||
| 389 | 389 | #define I915_PARAM_MIN_EU_IN_POOL 39 |
| 390 | 390 | #define I915_PARAM_MMAP_GTT_VERSION 40 |
| 391 | 391 | |
| 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 | + | |
| 392 | 397 | typedef struct drm_i915_getparam { |
| 393 | 398 | __s32 param; |
| 394 | 399 | /* |