diff mbox

intel: new blitter ring support from Sandybridge

Message ID 1286871232-1560-2-git-send-email-zhenyuw@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Zhenyu Wang Oct. 12, 2010, 8:13 a.m. UTC
None
diff mbox

Patch

diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 7594413..694fb24 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -276,6 +276,7 @@  typedef struct drm_i915_irq_wait {
 #define I915_PARAM_HAS_PAGEFLIPPING	 8
 #define I915_PARAM_HAS_EXECBUF2          9
 #define I915_PARAM_HAS_BSD		 10
+#define I915_PARAM_HAS_BLIT_SPLIT	 11
 
 typedef struct drm_i915_getparam {
 	int param;
@@ -619,6 +620,7 @@  struct drm_i915_gem_execbuffer2 {
 	__u64 cliprects_ptr;
 #define I915_EXEC_RENDER                 (1<<0)
 #define I915_EXEC_BSD                    (1<<1)
+#define I915_EXEC_BLIT                   (1<<2)
 	__u64 flags;
 	__u64 rsvd1;
 	__u64 rsvd2;
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 60174e1..57229e9 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -1545,7 +1545,8 @@  drm_intel_gem_bo_mrb_exec2(drm_intel_bo *bo, int used,
 	struct drm_i915_gem_execbuffer2 execbuf;
 	int ret, i;
 
-	if ((ring_flag != I915_EXEC_RENDER) && (ring_flag != I915_EXEC_BSD))
+	if ((ring_flag != I915_EXEC_RENDER) && (ring_flag != I915_EXEC_BSD) &&
+	    (ring_flag != I915_EXEC_BLIT))
 		return -EINVAL;
 
 	pthread_mutex_lock(&bufmgr_gem->lock);
@@ -2054,7 +2055,7 @@  drm_intel_bufmgr_gem_init(int fd, int batch_size)
 	struct drm_i915_gem_get_aperture aperture;
 	drm_i915_getparam_t gp;
 	int ret;
-	int exec2 = 0, has_bsd = 0;
+	int exec2 = 0, has_bsd = 0, blit_split = 0;
 
 	bufmgr_gem = calloc(1, sizeof(*bufmgr_gem));
 	if (bufmgr_gem == NULL)
@@ -2110,6 +2111,11 @@  drm_intel_bufmgr_gem_init(int fd, int batch_size)
 	if (!ret)
 		has_bsd = 1;
 
+	gp.param = I915_PARAM_HAS_BLIT_SPLIT;
+	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
+	if (!ret)
+		blit_split = *gp.value;
+
 	if (bufmgr_gem->gen < 4) {
 		gp.param = I915_PARAM_NUM_FENCES_AVAIL;
 		gp.value = &bufmgr_gem->available_fences;
@@ -2165,7 +2171,7 @@  drm_intel_bufmgr_gem_init(int fd, int batch_size)
 	/* Use the new one if available */
 	if (exec2) {
 		bufmgr_gem->bufmgr.bo_exec = drm_intel_gem_bo_exec2;
-		if (has_bsd)
+		if (has_bsd || blit_split)
 			bufmgr_gem->bufmgr.bo_mrb_exec = drm_intel_gem_bo_mrb_exec2;
 	} else
 		bufmgr_gem->bufmgr.bo_exec = drm_intel_gem_bo_exec;