[Intel-gfx] [PATCH 49/53] drm/i915: Extract render state preparation

oscar.mateo at intel.com oscar.mateo at intel.com
Fri Jun 13 17:38:07 CEST 2014


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

Execlists need a new submission mechanism, so split the preparation
from the submission.

Signed-off-by: Oscar Mateo <oscar.mateo at intel.com>
---
 drivers/gpu/drm/i915/i915_gem_render_state.c | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_render_state.c b/drivers/gpu/drm/i915/i915_gem_render_state.c
index 3521f99..5944c0a 100644
--- a/drivers/gpu/drm/i915/i915_gem_render_state.c
+++ b/drivers/gpu/drm/i915/i915_gem_render_state.c
@@ -159,7 +159,8 @@ static int render_state_setup(const int gen,
 	return 0;
 }
 
-int i915_gem_render_state_init(struct intel_engine_cs *ring)
+static struct i915_render_state *
+render_state_prepare(struct intel_engine_cs *ring)
 {
 	const int gen = INTEL_INFO(ring->dev)->gen;
 	struct i915_render_state *so;
@@ -167,19 +168,33 @@ int i915_gem_render_state_init(struct intel_engine_cs *ring)
 	int ret;
 
 	if (WARN_ON(ring->id != RCS))
-		return -ENOENT;
+		return ERR_PTR(-ENOENT);
 
 	rodata = render_state_get_rodata(ring->dev, gen);
 	if (rodata == NULL)
-		return 0;
+		return NULL;
 
 	so = render_state_alloc(ring->dev);
 	if (IS_ERR(so))
-		return PTR_ERR(so);
+		return so;
 
 	ret = render_state_setup(gen, rodata, so);
-	if (ret)
-		goto out;
+	if (ret) {
+		render_state_free(so);
+		return ERR_PTR(ret);
+	}
+
+	return so;
+}
+
+int i915_gem_render_state_init(struct intel_engine_cs *ring)
+{
+	struct i915_render_state *so;
+	int ret;
+
+	so = render_state_prepare(ring);
+	if (IS_ERR_OR_NULL(so))
+		return PTR_ERR(so);
 
 	ret = ring->dispatch_execbuffer(ring,
 					i915_gem_obj_ggtt_offset(so->obj),
-- 
1.9.0




More information about the Intel-gfx mailing list