]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Swap if(enable_execlists) in i915_gem_request_alloc for a vfunc
authorChris Wilson <chris@chris-wilson.co.uk>
Sun, 18 Dec 2016 15:37:24 +0000 (15:37 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Sun, 18 Dec 2016 16:18:56 +0000 (16:18 +0000)
A fairly trivial move of a matching pair of routines (for preparing a
request for construction) onto an engine vfunc. The ulterior motive is
to be able to create a mock request implementation.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161218153724.8439-7-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_gem_request.c
drivers/gpu/drm/i915/intel_lrc.c
drivers/gpu/drm/i915/intel_lrc.h
drivers/gpu/drm/i915/intel_ringbuffer.c
drivers/gpu/drm/i915/intel_ringbuffer.h

index 475d557f2301ffd3dc37006241d9e351b373105c..7427aac749236d3c86e0b62a82c6f57b5fd74354 100644 (file)
@@ -622,10 +622,7 @@ i915_gem_request_alloc(struct intel_engine_cs *engine,
        req->reserved_space = MIN_SPACE_FOR_ADD_REQUEST;
        GEM_BUG_ON(req->reserved_space < engine->emit_breadcrumb_sz);
 
-       if (i915.enable_execlists)
-               ret = intel_logical_ring_alloc_request_extras(req);
-       else
-               ret = intel_ring_alloc_request_extras(req);
+       ret = engine->request_alloc(req);
        if (ret)
                goto err_ctx;
 
index 1f8f35a94157e1674595af3a4bb561f67f1d5036..d322d3c11201d1ee044c92bcc1d74c90199d2367 100644 (file)
@@ -845,7 +845,7 @@ static void execlists_context_unpin(struct intel_engine_cs *engine,
        i915_gem_context_put(ctx);
 }
 
-int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request)
+static int execlists_request_alloc(struct drm_i915_gem_request *request)
 {
        struct intel_engine_cs *engine = request->engine;
        struct intel_context *ce = &request->ctx->engine[engine->id];
@@ -1816,6 +1816,8 @@ logical_ring_default_vfuncs(struct intel_engine_cs *engine)
        engine->context_pin = execlists_context_pin;
        engine->context_unpin = execlists_context_unpin;
 
+       engine->request_alloc = execlists_request_alloc;
+
        engine->emit_flush = gen8_emit_flush;
        engine->emit_breadcrumb = gen8_emit_breadcrumb;
        engine->emit_breadcrumb_sz = gen8_emit_breadcrumb_sz;
index b5630331086ae61c1f7c5ef00e72a4a85896fc7a..01ba36ea125e439a7d457c3a74d94c843d34cf49 100644 (file)
@@ -63,8 +63,6 @@ enum {
 };
 
 /* Logical Rings */
-int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request);
-int intel_logical_ring_reserve_space(struct drm_i915_gem_request *request);
 void intel_logical_ring_stop(struct intel_engine_cs *engine);
 void intel_logical_ring_cleanup(struct intel_engine_cs *engine);
 int logical_render_ring_init(struct intel_engine_cs *engine);
index 00ff572541b64a5b50cf84bdda11b42b9d94354b..69ccf4fd22f0c7958519df6abe060f6182e8d1c5 100644 (file)
@@ -2103,7 +2103,7 @@ void intel_legacy_submission_resume(struct drm_i915_private *dev_priv)
        }
 }
 
-int intel_ring_alloc_request_extras(struct drm_i915_gem_request *request)
+static int ring_request_alloc(struct drm_i915_gem_request *request)
 {
        int ret;
 
@@ -2598,6 +2598,8 @@ static void intel_ring_default_vfuncs(struct drm_i915_private *dev_priv,
        engine->context_pin = intel_ring_context_pin;
        engine->context_unpin = intel_ring_context_unpin;
 
+       engine->request_alloc = ring_request_alloc;
+
        engine->emit_breadcrumb = i9xx_emit_breadcrumb;
        engine->emit_breadcrumb_sz = i9xx_emit_breadcrumb_sz;
        if (i915.semaphores) {
index 4f1271821fa9f9c18e0906852bf6347fcb1dda5c..0969de7d5ab737f93c76c6d247edd47e373811c3 100644 (file)
@@ -270,6 +270,7 @@ struct intel_engine_cs {
                                       struct i915_gem_context *ctx);
        void            (*context_unpin)(struct intel_engine_cs *engine,
                                         struct i915_gem_context *ctx);
+       int             (*request_alloc)(struct drm_i915_gem_request *req);
        int             (*init_context)(struct drm_i915_gem_request *req);
 
        int             (*emit_flush)(struct drm_i915_gem_request *request,
@@ -491,8 +492,6 @@ void intel_engine_cleanup(struct intel_engine_cs *engine);
 
 void intel_legacy_submission_resume(struct drm_i915_private *dev_priv);
 
-int intel_ring_alloc_request_extras(struct drm_i915_gem_request *request);
-
 int __must_check intel_ring_begin(struct drm_i915_gem_request *req, int n);
 int __must_check intel_ring_cacheline_align(struct drm_i915_gem_request *req);