drm/i915: Move golden context init into ->init_context
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 2 Dec 2014 15:19:07 +0000 (16:19 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 8 Dec 2014 14:19:02 +0000 (15:19 +0100)
Similar to a patch from Thomas Daniel for lrc contexts. This keeps
both sides somewhat in sync and should make Dave Gordon happy.

Note that both the wa and the golden context init code suffer a bit
from an inssuficient split into driver load and hw init code. Which
means we have a bunch of tests all over the place to check whether the
one-time initialization has been done already or not.

All that one-tim code should be moved into the one-time ring setup
code, but that's work for later.

Cc: Dave Gordon <david.s.gordon@intel.com>
Cc: Thomas Daniel <thomas.daniel@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Reviewed-by: Dave Gordon <david.s.gordon@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_gem_context.c
drivers/gpu/drm/i915/intel_ringbuffer.c

index 5cd2b97aa76e532d4d988148af9fd92444943869..2acf5803cf3221d85e946b6e22b36a1f1d015b5a 100644 (file)
@@ -651,10 +651,6 @@ done:
                        if (ret)
                                DRM_ERROR("ring init context: %d\n", ret);
                }
-
-               ret = i915_gem_render_state_init(ring);
-               if (ret)
-                       DRM_ERROR("init render state: %d\n", ret);
        }
 
        return 0;
index 3887f1aaf057ff813378593293eb0596e923e82c..a8dc158f33be9006e1783d81786933bd9fb27488 100644 (file)
@@ -710,6 +710,22 @@ static int intel_ring_workarounds_emit(struct intel_engine_cs *ring,
        return 0;
 }
 
+static int intel_rcs_ctx_init(struct intel_engine_cs *ring,
+                             struct intel_context *ctx)
+{
+       int ret;
+
+       ret = intel_ring_workarounds_emit(ring, ctx);
+       if (ret != 0)
+               return ret;
+
+       ret = i915_gem_render_state_init(ring);
+       if (ret)
+               DRM_ERROR("init render state: %d\n", ret);
+
+       return ret;
+}
+
 static int wa_add(struct drm_i915_private *dev_priv,
                  const u32 addr, const u32 val, const u32 mask)
 {
@@ -2345,7 +2361,7 @@ int intel_init_render_ring_buffer(struct drm_device *dev)
                        }
                }
 
-               ring->init_context = intel_ring_workarounds_emit;
+               ring->init_context = intel_rcs_ctx_init;
                ring->add_request = gen6_add_request;
                ring->flush = gen8_render_ring_flush;
                ring->irq_get = gen8_ring_get_irq;