[Intel-gfx] [RFC 20/44] drm/i915: Redirect execbuffer_final() via scheduler

John.C.Harrison at Intel.com John.C.Harrison at Intel.com
Thu Jun 26 19:24:11 CEST 2014


From: John Harrison <John.C.Harrison at Intel.com>

Updated the execbuffer() code to pass the packaged up batch buffer information
to the scheduler rather than calling execbuffer_final() directly. The scheduler
queue() code is currently a stub which simply chains on to _final() immediately.
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |    6 +-----
 drivers/gpu/drm/i915/i915_scheduler.c      |   23 +++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_scheduler.h      |    2 ++
 3 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 334e8c6..f73c936 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -1348,14 +1348,10 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
 
 	i915_gem_execbuffer_move_to_active(&eb->vmas, ring);
 
-	ret = i915_gem_do_execbuffer_final(&qe.params);
+	ret = i915_scheduler_queue_execbuffer(&qe);
 	if (ret)
 		goto err;
 
-	/* Free everything that was stored in the QE structure (until the
-	 * scheduler arrives and does it instead): */
-	kfree(qe.params.cliprects);
-
 	/* The eb list is no longer required. The scheduler has extracted all
 	 * the information than needs to persist. */
 	eb_destroy(eb);
diff --git a/drivers/gpu/drm/i915/i915_scheduler.c b/drivers/gpu/drm/i915/i915_scheduler.c
index 37f8a98..d95c789 100644
--- a/drivers/gpu/drm/i915/i915_scheduler.c
+++ b/drivers/gpu/drm/i915/i915_scheduler.c
@@ -58,6 +58,24 @@ int i915_scheduler_init(struct drm_device *dev)
 	return 0;
 }
 
+int i915_scheduler_queue_execbuffer(struct i915_scheduler_queue_entry *qe)
+{
+	struct drm_i915_private     *dev_priv = qe->params.dev->dev_private;
+	struct i915_scheduler       *scheduler = dev_priv->scheduler;
+	int ret;
+
+	BUG_ON(!scheduler);
+
+	qe->params.scheduler_index = scheduler->index++;
+
+	ret = i915_gem_do_execbuffer_final(&qe->params);
+
+	/* Free everything that is owned by the QE structure: */
+	kfree(qe->params.cliprects);
+
+	return ret;
+}
+
 int i915_scheduler_remove(struct intel_engine_cs *ring)
 {
 	/* Do stuff... */
@@ -110,4 +128,9 @@ int i915_scheduler_closefile(struct drm_device *dev, struct drm_file *file)
 	return 0;
 }
 
+int i915_scheduler_queue_execbuffer(struct i915_scheduler_queue_entry *qe)
+{
+	return i915_gem_do_execbuffer_final(&qe->params);
+}
+
 #endif  /* CONFIG_DRM_I915_SCHEDULER */
diff --git a/drivers/gpu/drm/i915/i915_scheduler.h b/drivers/gpu/drm/i915/i915_scheduler.h
index 68a9543..4c3e081 100644
--- a/drivers/gpu/drm/i915/i915_scheduler.h
+++ b/drivers/gpu/drm/i915/i915_scheduler.h
@@ -42,6 +42,7 @@ struct i915_execbuffer_params {
 	uint32_t                        mask;
 	int                             mode;
 	struct intel_context            *ctx;
+	uint32_t                        scheduler_index;
 };
 
 struct i915_scheduler_queue_entry {
@@ -52,6 +53,7 @@ bool        i915_scheduler_is_enabled(struct drm_device *dev);
 int         i915_scheduler_init(struct drm_device *dev);
 int         i915_scheduler_closefile(struct drm_device *dev,
 				     struct drm_file *file);
+int         i915_scheduler_queue_execbuffer(struct i915_scheduler_queue_entry *qe);
 
 #ifdef CONFIG_DRM_I915_SCHEDULER
 
-- 
1.7.9.5




More information about the Intel-gfx mailing list