As gen6_emit_request() only differs from i9xx_emit_request() when
semaphores are enabled, only use the specialised vfunc in that scenario.

v2: Reorder semaphore init so as to keep engine->emit_request default
vfunc selection compact.

Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
Link: 
http://patchwork.freedesktop.org/patch/msgid/1469432687-22756-27-git-send-email-ch...@chris-wilson.co.uk
Reviewed-by: Joonas Lahtinen <joonas.lahti...@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c 
b/drivers/gpu/drm/i915/intel_ringbuffer.c
index df87bb7aefbd..3471e19fc784 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -1457,22 +1457,20 @@ static int i9xx_emit_request(struct 
drm_i915_gem_request *req)
 }
 
 /**
- * gen6_emit_request - Update the semaphore mailbox registers
+ * gen6_sema_emit_request - Update the semaphore mailbox registers
  *
  * @request - request to write to the ring
  *
  * Update the mailbox registers in the *other* rings with the current seqno.
  * This acts like a signal in the canonical semaphore.
  */
-static int gen6_emit_request(struct drm_i915_gem_request *req)
+static int gen6_sema_emit_request(struct drm_i915_gem_request *req)
 {
-       if (req->engine->semaphore.signal) {
-               int ret;
+       int ret;
 
-               ret = req->engine->semaphore.signal(req);
-               if (ret)
-                       return ret;
-       }
+       ret = req->engine->semaphore.signal(req);
+       if (ret)
+               return ret;
 
        return i9xx_emit_request(req);
 }
@@ -2802,12 +2800,15 @@ static void intel_ring_init_irq(struct drm_i915_private 
*dev_priv,
 static void intel_ring_default_vfuncs(struct drm_i915_private *dev_priv,
                                      struct intel_engine_cs *engine)
 {
+       intel_ring_init_irq(dev_priv, engine);
+       intel_ring_init_semaphores(dev_priv, engine);
+
        engine->init_hw = init_ring_common;
 
        engine->emit_request = i9xx_emit_request;
-       if (INTEL_GEN(dev_priv) >= 6)
-               engine->emit_request = gen6_emit_request;
        engine->submit_request = i9xx_submit_request;
+       if (i915.semaphores)
+               engine->emit_request = gen6_sema_emit_request;
 
        if (INTEL_GEN(dev_priv) >= 8)
                engine->emit_bb_start = gen8_emit_bb_start;
@@ -2819,9 +2820,6 @@ static void intel_ring_default_vfuncs(struct 
drm_i915_private *dev_priv,
                engine->emit_bb_start = i830_emit_bb_start;
        else
                engine->emit_bb_start = i915_emit_bb_start;
-
-       intel_ring_init_irq(dev_priv, engine);
-       intel_ring_init_semaphores(dev_priv, engine);
 }
 
 int intel_init_render_ring_buffer(struct intel_engine_cs *engine)
-- 
2.8.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to