enable blt acceleration on gen6
PATCH 1/1 enable blt acceleration on gen6
uxa: enable blt acceleration on gen6 hardware.
--- 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 | 71 +++++++++++++++++++++++++--------------------- 6 files changed, 80 insertions(+), 46 deletions(-)
src/i830_reg.h +2 -0
@@ -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
@@ -289,6 +289,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
@@ -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_BLIT ); + } +if (ret !=0 ) {if (ret == -EIO ) {static int once;
src/intel_batchbuffer.h +9 -1
@@ -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
@@ -575,8 +575,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 +39 -32
158 lines not on this page · raw message
Signature · 1 line
1.7.1
Quoted 1 line · Zou Nan hai
uxa: enable blt acceleration on gen6 hardware.
That's pretty close to what I had in mind. I thought adding intel_batch_set_mode(BLT), intel_batch_set_mode(RENDER) etc a bit more explicit. That gives us a single point at which we can detect a context switch and perform workarounds, rather than just continuing to add them ad hoc.
e.g.
static inline voidintel_batch_set_mode(struct intel_screen_private *intel, int mode) {
if (mode == intel->batch.mode)
return;
intel->batch.context_switch(intel, mode);
intel->batch.mode = mode;
}
static void
gen6_batch_context_switch(struct intel_screen_private *intel,
int mode)
{
intel_batch_flush(intel);
intel->batch.ring = mode;
}
static void
gen5_batch_context_switch(struct intel_screen_private *intel,
int mode)
{
if (intel->batch.mode == BLT) {
OUT_BATCH(3D_NP); /* 2D->3D non-pipeling workaround */ }
intel_batch_flush(intel);
}
void intel_batch_submit(struct intel_screen_private *intel) {
execbuf.flags |= intel->batch.ring;
...
intel->batch.mode = NONE;
}
etc. [Forgive me the bit of poetic licence in those snippets.] The only nasty side-effect of that is that you need to perform the intel_batch_set_mode() in both the prepare and done routines (in case the batch is emitted before done()).
Btw, why the 32 NOOP workaround? I haven't stumbled across the reason for that yet.
Your patch works as advertised with just a s/I915_EXEC_BLIT/I915_EXEC_BLT/. -Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 53 lines
Quoted 53 lines
-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: 2010年10月27日 17:08
To: Zou, Nanhai; [email protected]
Subject: Re: [Intel-gfx] [PATCH] enable blt acceleration on gen6Quoted 1 line · Zou Nan hai
uxa: enable blt acceleration on gen6 hardware.
That's pretty close to what I had in mind. I thought adding
intel_batch_set_mode(BLT),intel_batch_set_mode(RENDER)etc a bit more explicit. That gives us a single point at which we can detect a context switch and perform workarounds, rather than just continuing to add them ad hoc.e.g.
static inline voidintel_batch_set_mode(struct intel_screen_private *intel, int mode){
if (mode ==intel->batch.mode)
return;
intel->batch.context_switch(intel, mode);
intel->batch.mode= mode;
}static void
gen6_batch_context_switch(structintel_screen_private*intel,
int mode)
{
intel_batch_flush(intel);
intel->batch.ring= mode;
}static void
gen5_batch_context_switch(structintel_screen_private*intel,
int mode)
{if (intel->batch.mode == BLT) { OUT_BATCH(3D_NP); /* 2D->3D non-pipeling workaround */}
intel_batch_flush(intel);
}void
intel_batch_submit(struct intel_screen_private *intel){
execbuf.flags |=intel->batch.ring;
...
intel->batch.mode= NONE;
}
Quoted 7 lines
Quoted 7 lines
etc. [Forgive me the bit of poetic licence in those snippets.] The only nasty side-effect of that is that you need to perform the
intel_batch_set_mode()in both the prepare and done routines (in case the batch is emitted beforedone()).Btw, why the 32 NOOP workaround? I haven't stumbled across the reason for that yet.
I see in doc the 32 NOOP workaround but it does not tell the reason. Without this some heavy workload like x11perf may hang.
Zou Nan hai
Quoted 3 lines
Quoted 3 lines
Your patch works as advertised with just a s/I915_EXEC_BLIT/I915_EXEC_BLT/. -Chris
Thanks
Quoted 3 lines
Quoted 3 lines
--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 72 lines
Quoted 72 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Zou, Nanhai
Sent: 2010年10月28日 9:02
To: Chris Wilson; [email protected]
Subject: Re: [Intel-gfx] [PATCH] enable blt acceleration on gen6Quoted 51 lines
Quoted 51 lines
-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: 2010年10月27日 17:08
To: Zou, Nanhai; [email protected]
Subject: Re: [Intel-gfx] [PATCH] enable blt acceleration on gen6Quoted 1 line · Zou Nan hai
uxa: enable blt acceleration on gen6 hardware.
That's pretty close to what I had in mind. I thought adding
intel_batch_set_mode(BLT),intel_batch_set_mode(RENDER)etc a bit more explicit. That gives us a single point at which we can detect a context switch and perform workarounds, rather than just continuing to add them ad hoc.e.g.
static inline voidintel_batch_set_mode(struct intel_screen_private *intel, int mode){
if (mode ==intel->batch.mode)
return;
intel->batch.context_switch(intel, mode);
intel->batch.mode= mode;
}static void
gen6_batch_context_switch(structintel_screen_private*intel,
int mode)
{
intel_batch_flush(intel);
intel->batch.ring= mode;
}static void
gen5_batch_context_switch(structintel_screen_private*intel,
int mode)
{if (intel->batch.mode == BLT) { OUT_BATCH(3D_NP); /* 2D->3D non-pipeling workaround */}
intel_batch_flush(intel);
}void
intel_batch_submit(struct intel_screen_private *intel){
execbuf.flags |=intel->batch.ring;
...
intel->batch.mode= NONE;
}Quoted 7 lines
Quoted 7 lines
etc. [Forgive me the bit of poetic licence in those snippets.] The only nasty side-effect of that is that you need to perform the
intel_batch_set_mode()in both the prepare and done routines (in case the batch is emitted beforedone()).Btw, why the 32 NOOP workaround? I haven't stumbled across the reason for that yet.
I see in doc the 32 NOOP workaround but it does not tell the reason. Without this some heavy workload like x11perf may hang.
Quoted 7 lines
Quoted 7 lines
Zou Nan hai
Quoted 3 lines
Quoted 3 lines
Your patch works as advertised with just a s/I915_EXEC_BLIT/I915_EXEC_BLT/. -Chris
Thanks
Quoted 1 line
Quoted 1 line
I found we should set the walkaround in kernel
(every time ring tail is moved, the first command in ring is MI_BATCH_BUFFER_START) So I have removed the walkaround code and resent the patch.
We will sent another patch to add the walkaround in kernel.
Thanks
Zou nan hai
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
--
Chris Wilson, Intel Open Source Technology Centre_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx