Commit 9242f974 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Stop passing caller's num_dwords to engine->semaphore.signal()

Rather than pass in the num_dwords that the caller wishes to use after
the signal command packet, split the breadcrumb emission into two phases
and have both the signal and breadcrumb individiually acquire space on
the ring. This makes the interface simpler for the reader, and will
simplify for patches.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1469432687-22756-25-git-send-email-chris@chris-wilson.co.ukReviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1470174640-18242-16-git-send-email-chris@chris-wilson.co.uk
parent f4ea6bdd
...@@ -1309,10 +1309,8 @@ static void render_ring_cleanup(struct intel_engine_cs *engine) ...@@ -1309,10 +1309,8 @@ static void render_ring_cleanup(struct intel_engine_cs *engine)
intel_fini_pipe_control(engine); intel_fini_pipe_control(engine);
} }
static int gen8_rcs_signal(struct drm_i915_gem_request *signaller_req, static int gen8_rcs_signal(struct drm_i915_gem_request *signaller_req)
unsigned int num_dwords)
{ {
#define MBOX_UPDATE_DWORDS 8
struct intel_ring *signaller = signaller_req->ring; struct intel_ring *signaller = signaller_req->ring;
struct drm_i915_private *dev_priv = signaller_req->i915; struct drm_i915_private *dev_priv = signaller_req->i915;
struct intel_engine_cs *waiter; struct intel_engine_cs *waiter;
...@@ -1320,10 +1318,7 @@ static int gen8_rcs_signal(struct drm_i915_gem_request *signaller_req, ...@@ -1320,10 +1318,7 @@ static int gen8_rcs_signal(struct drm_i915_gem_request *signaller_req,
int ret, num_rings; int ret, num_rings;
num_rings = hweight32(INTEL_INFO(dev_priv)->ring_mask); num_rings = hweight32(INTEL_INFO(dev_priv)->ring_mask);
num_dwords += (num_rings-1) * MBOX_UPDATE_DWORDS; ret = intel_ring_begin(signaller_req, (num_rings-1) * 8);
#undef MBOX_UPDATE_DWORDS
ret = intel_ring_begin(signaller_req, num_dwords);
if (ret) if (ret)
return ret; return ret;
...@@ -1347,14 +1342,13 @@ static int gen8_rcs_signal(struct drm_i915_gem_request *signaller_req, ...@@ -1347,14 +1342,13 @@ static int gen8_rcs_signal(struct drm_i915_gem_request *signaller_req,
MI_SEMAPHORE_TARGET(waiter->hw_id)); MI_SEMAPHORE_TARGET(waiter->hw_id));
intel_ring_emit(signaller, 0); intel_ring_emit(signaller, 0);
} }
intel_ring_advance(signaller);
return 0; return 0;
} }
static int gen8_xcs_signal(struct drm_i915_gem_request *signaller_req, static int gen8_xcs_signal(struct drm_i915_gem_request *signaller_req)
unsigned int num_dwords)
{ {
#define MBOX_UPDATE_DWORDS 6
struct intel_ring *signaller = signaller_req->ring; struct intel_ring *signaller = signaller_req->ring;
struct drm_i915_private *dev_priv = signaller_req->i915; struct drm_i915_private *dev_priv = signaller_req->i915;
struct intel_engine_cs *waiter; struct intel_engine_cs *waiter;
...@@ -1362,10 +1356,7 @@ static int gen8_xcs_signal(struct drm_i915_gem_request *signaller_req, ...@@ -1362,10 +1356,7 @@ static int gen8_xcs_signal(struct drm_i915_gem_request *signaller_req,
int ret, num_rings; int ret, num_rings;
num_rings = hweight32(INTEL_INFO(dev_priv)->ring_mask); num_rings = hweight32(INTEL_INFO(dev_priv)->ring_mask);
num_dwords += (num_rings-1) * MBOX_UPDATE_DWORDS; ret = intel_ring_begin(signaller_req, (num_rings-1) * 6);
#undef MBOX_UPDATE_DWORDS
ret = intel_ring_begin(signaller_req, num_dwords);
if (ret) if (ret)
return ret; return ret;
...@@ -1387,12 +1378,12 @@ static int gen8_xcs_signal(struct drm_i915_gem_request *signaller_req, ...@@ -1387,12 +1378,12 @@ static int gen8_xcs_signal(struct drm_i915_gem_request *signaller_req,
MI_SEMAPHORE_TARGET(waiter->hw_id)); MI_SEMAPHORE_TARGET(waiter->hw_id));
intel_ring_emit(signaller, 0); intel_ring_emit(signaller, 0);
} }
intel_ring_advance(signaller);
return 0; return 0;
} }
static int gen6_signal(struct drm_i915_gem_request *signaller_req, static int gen6_signal(struct drm_i915_gem_request *signaller_req)
unsigned int num_dwords)
{ {
struct intel_ring *signaller = signaller_req->ring; struct intel_ring *signaller = signaller_req->ring;
struct drm_i915_private *dev_priv = signaller_req->i915; struct drm_i915_private *dev_priv = signaller_req->i915;
...@@ -1400,12 +1391,8 @@ static int gen6_signal(struct drm_i915_gem_request *signaller_req, ...@@ -1400,12 +1391,8 @@ static int gen6_signal(struct drm_i915_gem_request *signaller_req,
enum intel_engine_id id; enum intel_engine_id id;
int ret, num_rings; int ret, num_rings;
#define MBOX_UPDATE_DWORDS 3
num_rings = hweight32(INTEL_INFO(dev_priv)->ring_mask); num_rings = hweight32(INTEL_INFO(dev_priv)->ring_mask);
num_dwords += round_up((num_rings-1) * MBOX_UPDATE_DWORDS, 2); ret = intel_ring_begin(signaller_req, round_up((num_rings-1) * 3, 2));
#undef MBOX_UPDATE_DWORDS
ret = intel_ring_begin(signaller_req, num_dwords);
if (ret) if (ret)
return ret; return ret;
...@@ -1423,6 +1410,7 @@ static int gen6_signal(struct drm_i915_gem_request *signaller_req, ...@@ -1423,6 +1410,7 @@ static int gen6_signal(struct drm_i915_gem_request *signaller_req,
/* If num_dwords was rounded, make sure the tail pointer is correct */ /* If num_dwords was rounded, make sure the tail pointer is correct */
if (num_rings % 2 == 0) if (num_rings % 2 == 0)
intel_ring_emit(signaller, MI_NOOP); intel_ring_emit(signaller, MI_NOOP);
intel_ring_advance(signaller);
return 0; return 0;
} }
...@@ -1441,11 +1429,13 @@ static int gen6_emit_request(struct drm_i915_gem_request *req) ...@@ -1441,11 +1429,13 @@ static int gen6_emit_request(struct drm_i915_gem_request *req)
struct intel_ring *ring = req->ring; struct intel_ring *ring = req->ring;
int ret; int ret;
if (engine->semaphore.signal) if (engine->semaphore.signal) {
ret = engine->semaphore.signal(req, 4); ret = engine->semaphore.signal(req);
else if (ret)
ret = intel_ring_begin(req, 4); return ret;
}
ret = intel_ring_begin(req, 4);
if (ret) if (ret)
return ret; return ret;
...@@ -1466,10 +1456,13 @@ static int gen8_render_emit_request(struct drm_i915_gem_request *req) ...@@ -1466,10 +1456,13 @@ static int gen8_render_emit_request(struct drm_i915_gem_request *req)
struct intel_ring *ring = req->ring; struct intel_ring *ring = req->ring;
int ret; int ret;
if (engine->semaphore.signal) if (engine->semaphore.signal) {
ret = engine->semaphore.signal(req, 8); ret = engine->semaphore.signal(req);
else if (ret)
ret = intel_ring_begin(req, 8); return ret;
}
ret = intel_ring_begin(req, 8);
if (ret) if (ret)
return ret; return ret;
......
...@@ -280,9 +280,7 @@ struct intel_engine_cs { ...@@ -280,9 +280,7 @@ struct intel_engine_cs {
int (*sync_to)(struct drm_i915_gem_request *to_req, int (*sync_to)(struct drm_i915_gem_request *to_req,
struct intel_engine_cs *from, struct intel_engine_cs *from,
u32 seqno); u32 seqno);
int (*signal)(struct drm_i915_gem_request *signaller_req, int (*signal)(struct drm_i915_gem_request *signaller_req);
/* num_dwords needed by caller */
unsigned int num_dwords);
} semaphore; } semaphore;
/* Execlists */ /* Execlists */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment