Commit 91a41032 authored by Ben Widawsky's avatar Ben Widawsky Committed by Daniel Vetter

drm/i915: Extract CSB status read

This is a useful thing to have around as a function because the mechanism may
change in the future.

There is a net increase in LOC here, and it will continue to be the case on GEN8
and GEN9 - but future GENs may have an alternate mechanism for doing this.
Signed-off-by: default avatarBen Widawsky <benjamin.widawsky@intel.com>
Reviewed-by: default avatarMichel Thierry <michel.thierry@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452018609-10142-4-git-send-email-benjamin.widawsky@intel.comSigned-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent f764a8b1
...@@ -496,6 +496,19 @@ static bool execlists_check_remove_request(struct intel_engine_cs *ring, ...@@ -496,6 +496,19 @@ static bool execlists_check_remove_request(struct intel_engine_cs *ring,
return false; return false;
} }
static void get_context_status(struct intel_engine_cs *ring,
u8 read_pointer,
u32 *status, u32 *context_id)
{
struct drm_i915_private *dev_priv = ring->dev->dev_private;
if (WARN_ON(read_pointer >= GEN8_CSB_ENTRIES))
return;
*status = I915_READ(RING_CONTEXT_STATUS_BUF_LO(ring, read_pointer));
*context_id = I915_READ(RING_CONTEXT_STATUS_BUF_HI(ring, read_pointer));
}
/** /**
* intel_lrc_irq_handler() - handle Context Switch interrupts * intel_lrc_irq_handler() - handle Context Switch interrupts
* @ring: Engine Command Streamer to handle. * @ring: Engine Command Streamer to handle.
...@@ -523,9 +536,9 @@ void intel_lrc_irq_handler(struct intel_engine_cs *ring) ...@@ -523,9 +536,9 @@ void intel_lrc_irq_handler(struct intel_engine_cs *ring)
spin_lock(&ring->execlist_lock); spin_lock(&ring->execlist_lock);
while (read_pointer < write_pointer) { while (read_pointer < write_pointer) {
read_pointer++;
status = I915_READ(RING_CONTEXT_STATUS_BUF_LO(ring, read_pointer % GEN8_CSB_ENTRIES)); get_context_status(ring, ++read_pointer % GEN8_CSB_ENTRIES,
status_id = I915_READ(RING_CONTEXT_STATUS_BUF_HI(ring, read_pointer % GEN8_CSB_ENTRIES)); &status, &status_id);
if (status & GEN8_CTX_STATUS_IDLE_ACTIVE) if (status & GEN8_CTX_STATUS_IDLE_ACTIVE)
continue; continue;
......
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