Skip to contentSkip to conversation

enable BLT acceleate on gen6

PATCH In review Zou Nan hai 2 participants 5 messages Oct 29, 2010 – Nov 1, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 enable BLT acceleate on gen6

uxa: enable BLT command on gen6,
BLT command will goto BLT ring buffer
on gen6.

---
 src/i830_reg.h          |    2 +
 src/intel.h             |    4 +++
 src/intel_batchbuffer.c |   37 +++++++++++++++++++++---------
 src/intel_batchbuffer.h |   10 +++++++-
 src/intel_driver.c      |    2 -
 src/intel_uxa.c         |   56 ++++++++++++++++++++--------------------------
 6 files changed, 65 insertions(+), 46 deletions(-)
src/i830_reg.h +2 -0
index 4080896..93d03cf 100644
@@ -32,6 +32,8 @@
 
 /* Flush */
 #define MI_FLUSH			(0x04<<23)
+#define MI_FLUSH_DW			(0x26<<23)
+
 #define MI_WRITE_DIRTY_STATE		(1<<4)
 #define MI_END_SCENE			(1<<3)
 #define MI_GLOBAL_SNAPSHOT_COUNT_RESET	(1<<3)
src/intel.h +4 -0
index b74a061..26f4a18 100644
@@ -276,6 +276,10 @@ typedef struct intel_screen_private {
 	unsigned char *MMIOBase;
 	int cpp;
 
+#define RENDER_BATCH			0
+#define BLT_BATCH			1	
+	unsigned int current_batch;
+
 	unsigned int bufferOffset;	/* for I830SelectBuffer */
 
 	/* These are set in PreInit and never changed. */
src/intel_batchbuffer.c +26 -11
index e7ca69d..584910b 100644
@@ -147,14 +147,22 @@ void intel_batch_emit_flush(ScrnInfoPtr scrn)
 	assert (!intel->in_batch_atomic);
 
 	/* Big hammer, look to the pipelined flushes in future. */
-	flags = MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE;
-	if (INTEL_INFO(intel)->gen >= 40)
-		flags = 0;
-
-	BEGIN_BATCH(1);
-	OUT_BATCH(MI_FLUSH | flags);
-	ADVANCE_BATCH();
-
+	if (intel->current_batch == BLT_BATCH) {
+		BEGIN_BATCH_BLT(4);
+		OUT_BATCH(MI_FLUSH_DW | 2);
+		OUT_BATCH(0);
+		OUT_BATCH(0);
+		OUT_BATCH(0);
+		ADVANCE_BATCH();
+	} else {
+		flags = MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE;
+		if (INTEL_INFO(intel)->gen >= 40)
+			flags = 0;
+
+		BEGIN_BATCH(1);
+		OUT_BATCH(MI_FLUSH | flags);
+		ADVANCE_BATCH();
+	}
 	intel_batch_do_flush(scrn);
 }
 
@@ -190,9 +198,16 @@ void intel_batch_submit(ScrnInfoPtr scrn, int flush)
 	}
 
 	ret = dri_bo_subdata(intel->batch_bo, 0, intel->batch_used*4, intel->batch_ptr);
-	if (ret == 0)
-		ret = dri_bo_exec(intel->batch_bo, intel->batch_used*4,
-				  NULL, 0, 0xffffffff);
+	if (ret == 0) {
+		if (intel->current_batch == RENDER_BATCH)
+			ret = dri_bo_exec(intel->batch_bo, intel->batch_used*4,
+					NULL, 0, 0xffffffff);
+		else
+			ret = drm_intel_bo_mrb_exec(intel->batch_bo, 
+					intel->batch_used*4,
+					NULL, 0, 0xffffffff, I915_EXEC_BLT);
+	}
+
 	if (ret != 0) {
 		if (ret == -EIO) {
 			static int once;
src/intel_batchbuffer.h +9 -1
index bf7a5d9..607fb9b 100644
@@ -63,7 +63,9 @@ static inline void intel_batch_start_atomic(ScrnInfoPtr scrn, unsigned int sz)
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 
 	assert(!intel->in_batch_atomic);
+
 	intel_batch_require_space(scrn, intel, sz * 4);
+	intel->current_batch = RENDER_BATCH;				\
 
 	intel->in_batch_atomic = TRUE;
 	intel->batch_atomic_limit = intel->batch_used + sz;
@@ -173,17 +175,23 @@ union intfloat {
 	OUT_BATCH(tmp.ui);			\
 } while(0)
 
-#define BEGIN_BATCH(n)							\
+#define __BEGIN_BATCH(n,batch_idx)					\
 do {									\
 	if (intel->batch_emitting != 0)					\
 		FatalError("%s: BEGIN_BATCH called without closing "	\
 			   "ADVANCE_BATCH\n", __FUNCTION__);		\
 	assert(!intel->in_batch_atomic);				\
+	if (intel->current_batch != batch_idx)				\
+		intel_batch_submit(scrn, TRUE);				\
 	intel_batch_require_space(scrn, intel, (n) * 4);		\
+	intel->current_batch = batch_idx;				\
 	intel->batch_emitting = (n);					\
 	intel->batch_emit_start = intel->batch_used;			\
 } while (0)
 
+#define BEGIN_BATCH(n) 	__BEGIN_BATCH(n,RENDER_BATCH)
+#define BEGIN_BATCH_BLT(n) 	__BEGIN_BATCH(n,BLT_BATCH)
+
 #define ADVANCE_BATCH() do {						\
 	if (intel->batch_emitting == 0)					\
 		FatalError("%s: ADVANCE_BATCH called with no matching "	\
src/intel_driver.c +0 -2
index b16913b..160d08d 100644
@@ -573,8 +573,6 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags)
 	}
 
 	intel->use_shadow = FALSE;
-	if (IS_GEN6(intel))
-		intel->use_shadow = TRUE;
 
 	if (xf86IsOptionSet(intel->Options, OPTION_SHADOW)) {
 		intel->use_shadow =
src/intel_uxa.c +24 -32

129 lines not on this page · raw message

Signature · 1 line
1.7.1
#1 lore raw
Quoted 3 lines · Zou Nan hai

uxa: enable BLT command on gen6,
BLT command will goto BLT ring buffer
on gen6.

Can we break this down into two patches?

1. enable BLT batches.
2. re-enable snb 2d.
[3. renaming i830_uxa]

src/intel.h typedef struct intel_screen_private { · line 281

Quoted 3 lines
src/intel.h +3 -0
+#define RENDER_BATCH			0
+#define BLT_BATCH			1	
+	unsigned int current_batch;

If you use RENDER_BATCH=1, and BLT_BATCH=3, then...

src/intel_batchbuffer.c void intel_batch_submit(ScrnInfoPtr scrn, int flush) · line 209

Quoted 12 lines
src/intel_batchbuffer.c +9 -3
-	if (ret == 0)
-		ret = dri_bo_exec(intel->batch_bo, intel->batch_used*4,
-				  NULL, 0, 0xffffffff);
+	if (ret == 0) {
+		if (intel->current_batch == RENDER_BATCH)
+			ret = dri_bo_exec(intel->batch_bo, intel->batch_used*4,
+					NULL, 0, 0xffffffff);
+		else
+			ret = drm_intel_bo_mrb_exec(intel->batch_bo, 
+					intel->batch_used*4,
+					NULL, 0, 0xffffffff, I915_EXEC_BLT);
+	}

just becomes:

	if (ret == 0)
		ret = drm_intel_bo_mrb_exec(intel->batch_bo, 
					intel->batch_used*4,
					NULL, 0, 0xffffffff,
					intel->current_batch)

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#2 lore raw
In reply to Zou Nan hai
Quoted 3 lines · Zou Nan hai

uxa: enable BLT command on gen6,
BLT command will goto BLT ring buffer
on gen6.

Just spotted one little fix required, and a couple of other suggestions (as before). Splitting it up into 3 little patches would be best.

src/intel.h typedef struct intel_screen_private { · line 280

Quoted 12 lines

---

src/intel.h +2 -0
index b74a061..26f4a18 100644
@@ -276,6 +276,10 @@ typedef struct intel_screen_private {
 	unsigned char *MMIOBase;
 	int cpp;
 
+#define RENDER_BATCH			0
+#define BLT_BATCH			1	

#define RENDER_BATCH I915_EXEC_RENDER
#define BLT_BATCH I915_EXEC_BLT

src/intel.h typedef struct intel_screen_private {

Quoted 9 lines
src/intel.h +9 -0
+	if (ret == 0) {
+		if (intel->current_batch == RENDER_BATCH)
+			ret = dri_bo_exec(intel->batch_bo, intel->batch_used*4,
+					NULL, 0, 0xffffffff);
+		else
+			ret = drm_intel_bo_mrb_exec(intel->batch_bo, 
+					intel->batch_used*4,
+					NULL, 0, 0xffffffff, I915_EXEC_BLT);
+	}

if (ret == 0)

	ret = drm_intel_bo_mrb_exec(intel->batch_bo, 
				    intel->batch_used*4,
				    NULL, 0, 0xffffffff,
				    intel->current_batch);

src/intel.h

Quoted 8 lines
src/intel.h +3 -0
+#define __BEGIN_BATCH(n,batch_idx)					\
 do {									\
 	if (intel->batch_emitting != 0)					\
 		FatalError("%s: BEGIN_BATCH called without closing "	\
 			   "ADVANCE_BATCH\n", __FUNCTION__);		\
 	assert(!intel->in_batch_atomic);				\
+	if (intel->current_batch != batch_idx)				\
+		intel_batch_submit(scrn, TRUE);				\

intel_batch_submit(scrn, FALSE); \

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#3 lore raw
Quoted 43 lines
Quoted 43 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: 2010年10月30日 3:14
To: Zou, Nanhai; [email protected]
Subject: Re: [Intel-gfx] [PATCH] enable BLT acceleate on gen6

Quoted 3 lines · Zou Nan hai

uxa: enable BLT command on gen6,
BLT command will goto BLT ring buffer
on gen6.

Just spotted one little fix required, and a couple of other suggestions (as before). Splitting it up into 3 little patches would be best.

src/intel.h typedef struct intel_screen_private { · line 280

Quoted 12 lines

---

src/intel.h +2 -0
index b74a061..26f4a18 100644
@@ -276,6 +276,10 @@ typedef struct intel_screen_private {
 	unsigned char *MMIOBase;
 	int cpp;
 
+#define RENDER_BATCH			0
+#define BLT_BATCH			1

#define RENDER_BATCH I915_EXEC_RENDER
#define BLT_BATCH I915_EXEC_BLT

src/intel.h typedef struct intel_screen_private {

Quoted 9 lines
src/intel.h +9 -0
+	if (ret == 0) {
+		if (intel->current_batch == RENDER_BATCH)
+			ret = dri_bo_exec(intel->batch_bo, intel->batch_used*4,
+					NULL, 0, 0xffffffff);
+		else
+			ret = drm_intel_bo_mrb_exec(intel->batch_bo,
+					intel->batch_used*4,
+					NULL, 0, 0xffffffff, I915_EXEC_BLT);
+	}

if (ret == 0)

	ret = drm_intel_bo_mrb_exec(intel->batch_bo,
				    intel->batch_used*4,
				    NULL, 0, 0xffffffff,
				    intel->current_batch);
Quoted 10 lines
Quoted 10 lines

src/intel.h

Quoted 8 lines
src/intel.h +3 -0
+#define __BEGIN_BATCH(n,batch_idx)					\
 do {									\
 	if (intel->batch_emitting != 0)					\
 		FatalError("%s: BEGIN_BATCH called without closing "	\
 			   "ADVANCE_BATCH\n", __FUNCTION__);		\
 	assert(!intel->in_batch_atomic);				\
+	if (intel->current_batch != batch_idx)				\
+		intel_batch_submit(scrn, TRUE);				\

intel_batch_submit(scrn, FALSE); \

Shouldn't we have a flush here?
We are switching from 1 batch to another batch.

Thanks
Zou Nanhai

Quoted 4 lines
Quoted 4 lines

-Chris

--
Chris Wilson, Intel Open Source Technology Centre

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw
In reply to Chris Wilson
Quoted 60 lines
Quoted 60 lines

-----Original Message-----
From: Zou, Nanhai
Sent: 2010年11月1日 8:56
To: 'Chris Wilson'; [email protected]
Subject: RE: [Intel-gfx] [PATCH] enable BLT acceleate on gen6

Quoted 53 lines
Quoted 53 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: 2010年10月30日 3:14
To: Zou, Nanhai; [email protected]
Subject: Re: [Intel-gfx] [PATCH] enable BLT acceleate on gen6

Quoted 3 lines · Zou Nan hai

uxa: enable BLT command on gen6,
BLT command will goto BLT ring buffer
on gen6.

Just spotted one little fix required, and a couple of other suggestions (as before). Splitting it up into 3 little patches would be best.

src/intel.h typedef struct intel_screen_private { · line 280

Quoted 12 lines

---

src/intel.h +2 -0
index b74a061..26f4a18 100644
@@ -276,6 +276,10 @@ typedef struct intel_screen_private {
 	unsigned char *MMIOBase;
 	int cpp;
 
+#define RENDER_BATCH			0
+#define BLT_BATCH			1

#define RENDER_BATCH I915_EXEC_RENDER
#define BLT_BATCH I915_EXEC_BLT

src/intel.h typedef struct intel_screen_private {

Quoted 9 lines
src/intel.h +9 -0
+	if (ret == 0) {
+		if (intel->current_batch == RENDER_BATCH)
+			ret = dri_bo_exec(intel->batch_bo, intel->batch_used*4,
+					NULL, 0, 0xffffffff);
+		else
+			ret = drm_intel_bo_mrb_exec(intel->batch_bo,
+					intel->batch_used*4,
+					NULL, 0, 0xffffffff, I915_EXEC_BLT);
+	}

if (ret == 0)

	ret = drm_intel_bo_mrb_exec(intel->batch_bo,
				    intel->batch_used*4,
				    NULL, 0, 0xffffffff,
				    intel->current_batch);

src/intel.h

Quoted 8 lines
src/intel.h +3 -0
+#define __BEGIN_BATCH(n,batch_idx)					\
 do {									\
 	if (intel->batch_emitting != 0)					\
 		FatalError("%s: BEGIN_BATCH called without closing "	\
 			   "ADVANCE_BATCH\n", __FUNCTION__);		\
 	assert(!intel->in_batch_atomic);				\
+	if (intel->current_batch != batch_idx)				\
+		intel_batch_submit(scrn, TRUE);				\

intel_batch_submit(scrn, FALSE); \

Quoted 3 lines
Quoted 3 lines

Shouldn't we have a flush here?
We are switching from 1 batch to another batch.

Just realize it doesn't matter.
kernel will flush the ring at bo_exec anyway.

Quoted 7 lines
Quoted 7 lines

Thanks
Zou Nanhai

Quoted 4 lines
Quoted 4 lines

-Chris

--
Chris Wilson, Intel Open Source Technology Centre

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx