diff mbox

[2/4] drm/i915: Clearing buffer objects via blitter engine for Gen8

Message ID 1403258530-12548-3-git-send-email-sourab.gupta@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

sourab.gupta@intel.com June 20, 2014, 10:02 a.m. UTC
From: Deepak S <deepak.s@linux.intel.com>

On Gen8, COLOR BLT commands are different. Add gen8 specific command to clearing
buffer objects via blitter engines.

Signed-off-by: Deepak S <deepak.s@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_gem_exec.c | 39 +++++++++++++++++++++++++++---------
 1 file changed, 29 insertions(+), 10 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_exec.c b/drivers/gpu/drm/i915/i915_gem_exec.c
index 374f1e1..fc9e454 100644
--- a/drivers/gpu/drm/i915/i915_gem_exec.c
+++ b/drivers/gpu/drm/i915/i915_gem_exec.c
@@ -29,6 +29,8 @@ 
 #include <drm/i915_drm.h>
 #include "i915_drv.h"
 
+#define GEN8_COLOR_BLT_CMD (2<<29 | 0x50<<22)
+
 #define COLOR_BLT_CMD (2<<29 | 0x40<<22)
 #define BLT_WRITE_ALPHA (1<<21)
 #define BLT_WRITE_RGB (1<<20)
@@ -100,18 +102,35 @@  int i915_gem_exec_clear_object(struct drm_i915_gem_object *obj)
 	if (ret)
 		goto unpin;
 
-	ret = intel_ring_begin(ring, 6);
-	if (ret)
-		goto unpin;
+	if (IS_GEN8(dev)) {
+		ret = intel_ring_begin(ring, 8);
+		if (ret)
+			goto unpin;
 
-	intel_ring_emit(ring, COLOR_BLT_CMD | BLT_WRITE_RGBA | (5-2));
-	intel_ring_emit(ring, BPP_32 | ROP_FILL_COPY | PAGE_SIZE);
-	intel_ring_emit(ring, obj->base.size >> PAGE_SHIFT << 16 | PAGE_SIZE);
-	intel_ring_emit(ring, i915_gem_obj_ggtt_offset(obj));
-	intel_ring_emit(ring, 0);
-	intel_ring_emit(ring, MI_NOOP);
+		intel_ring_emit(ring, GEN8_COLOR_BLT_CMD | BLT_WRITE_RGBA | (7-2));
+		intel_ring_emit(ring, BPP_32 | ROP_FILL_COPY | PAGE_SIZE);
+		intel_ring_emit(ring, 0);
+		intel_ring_emit(ring, obj->base.size >> PAGE_SHIFT << 16 | PAGE_SIZE / 4);
+		intel_ring_emit(ring, i915_gem_obj_ggtt_offset(obj));
+		intel_ring_emit(ring, 0);
+		intel_ring_emit(ring, 0);
+		intel_ring_emit(ring, MI_NOOP);
+
+		__intel_ring_advance(ring);
+	} else {
+		ret = intel_ring_begin(ring, 6);
+		if (ret)
+			goto unpin;
 
-	__intel_ring_advance(ring);
+		intel_ring_emit(ring, COLOR_BLT_CMD | BLT_WRITE_RGBA | (5-2));
+		intel_ring_emit(ring, BPP_32 | ROP_FILL_COPY | PAGE_SIZE);
+		intel_ring_emit(ring, obj->base.size >> PAGE_SHIFT << 16 | PAGE_SIZE);
+		intel_ring_emit(ring, i915_gem_obj_ggtt_offset(obj));
+		intel_ring_emit(ring, 0);
+		intel_ring_emit(ring, MI_NOOP);
+
+		__intel_ring_advance(ring);
+	}
 	i915_gem_exec_dirty_object(obj, ring);
 
 unpin: