*/
                value = i915_gem_mmap_gtt_version();
                break;
+       case I915_PARAM_HAS_SCHEDULER:
+               value = dev_priv->engine[RCS] &&
+                       dev_priv->engine[RCS]->schedule;
+               break;
        case I915_PARAM_MMAP_VERSION:
                /* Remember to bump this if the version changes! */
        case I915_PARAM_HAS_GEM:
 
 
        i915_gem_mark_busy(engine);
 
+       /* Let the backend know a new request has arrived that may need
+        * to adjust the existing execution schedule due to a high priority
+        * request - i.e. we may want to preempt the current request in order
+        * to run a high priority dependency chain *before* we can execute this
+        * request.
+        *
+        * This is called before the request is ready to run so that we can
+        * decide whether to preempt the entire chain so that it is ready to
+        * run at the earliest possible convenience.
+        */
+       if (engine->schedule)
+               engine->schedule(request, 0);
+
        local_bh_disable();
        i915_sw_fence_commit(&request->submit);
        local_bh_enable(); /* Kick the execlists tasklet if just scheduled */
 
        engine->mmio_base = info->mmio_base;
        engine->irq_shift = info->irq_shift;
 
+       /* Nothing to do here, execute in order of dependencies */
+       engine->schedule = NULL;
+
        dev_priv->engine[id] = engine;
        return 0;
 }
 
         */
        void            (*submit_request)(struct drm_i915_gem_request *req);
 
+       /* Call when the priority on a request has changed and it and its
+        * dependencies may need rescheduling. Note the request itself may
+        * not be ready to run!
+        *
+        * Called under the struct_mutex.
+        */
+       void            (*schedule)(struct drm_i915_gem_request *request,
+                                   int priority);
+
        /* Some chipsets are not quite as coherent as advertised and need
         * an expensive kick to force a true read of the up-to-date seqno.
         * However, the up-to-date seqno is not always required and the last
 
 #define I915_PARAM_MIN_EU_IN_POOL       39
 #define I915_PARAM_MMAP_GTT_VERSION     40
 
+/* Query whether DRM_I915_GEM_EXECBUFFER2 supports user defined execution
+ * priorities and the driver will attempt to execute batches in priority order.
+ */
+#define I915_PARAM_HAS_SCHEDULER        41
+
 typedef struct drm_i915_getparam {
        __s32 param;
        /*