[PATCH 46/49] drm/i915/bdw: Start queueing contexts to be submitted

oscar.mateo
2014-03-27T17:09:05Z

From: Oscar Mateo <oscar.mateo@intel.com>

Finally, start queueing request on write_tail. Also, remove remaining
legacy context switches.

Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
---
drivers/gpu/drm/i915/i915_gem.c | 9 ++++++---
drivers/gpu/drm/i915/i915_gem_context.c | 10 ++++++----
drivers/gpu/drm/i915/i915_gem_execbuffer.c | 8 +++++---
drivers/gpu/drm/i915/intel_ringbuffer.c | 5 ++++-
4 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 10bb50f..6b8be10 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2798,9 +2798,12 @@ int i915_gpu_idle(struct drm_device *dev)

/* Flush everything onto the inactive list. */
for_each_active_ring(ring, dev_priv, i) {
- ret = i915_switch_context(ring, NULL, ring->default_context);
- if (ret)
- return ret;
+ if (!dev_priv->lrc_enabled) {
+ ret = i915_switch_context(ring, NULL,
+ ring->default_context);
+ if (ret)
+ return ret;
+ }

ret = intel_ring_idle(ring);
if (ret)
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 1322e00..828c2a4 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -501,10 +501,12 @@ int i915_gem_context_enable(struct drm_i915_private *dev_priv)

BUG_ON(!dev_priv->ring[RCS].default_context);

- for_each_active_ring(ring, dev_priv, i) {
- ret = do_switch(ring, ring->default_context);
- if (ret)
- return ret;
+ if (!dev_priv->lrc_enabled) {
+ for_each_active_ring(ring, dev_priv, i) {
+ ret = do_switch(ring, ring->default_context);
+ if (ret)
+ return ret;
+ }
}

return 0;
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 72bda74..fae55c1 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -1228,9 +1228,11 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
if (ret)
goto err;

- ret = i915_switch_context(ring, file, ctx);
- if (ret)
- goto err;
+ if (!dev_priv->lrc_enabled) {
+ ret = i915_switch_context(ring, file, ctx);
+ if (ret)
+ goto err;
+ }

if (ring == &dev_priv->ring[RCS] &&
mode != dev_priv->relative_constants_mode) {
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index ee5a220..9a6775d 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -422,7 +422,10 @@ static void gen8_write_tail_lrc(struct intel_engine *ring,
struct i915_hw_context *ctx,
u32 value)
{
- DRM_ERROR("Execlists still not ready!\n");
+ if (WARN_ON(ctx == NULL))
+ ctx = ring->default_context;
+
+ gen8_switch_context_queue(ring, ctx, value);
}

u32 intel_ring_get_active_head(struct intel_engine *ring)
--
1.9.0