uxa: Don't emit PIPE_CONTROLs in an empty batch.
PATCH 1/3 uxa: Don't emit PIPE_CONTROLs in an empty batch.
The first call to BEGIN_BATCH or BEGIN_BATCH_BLT will set current_batch to RENDER_BATCH or BLT_BATCH. If it's zero, that means the batch is empty, so there's no point in flushing.
Previously, we would just go ahead and do a RENDER_RING flush, though more by accident than intentional design.
--- src/uxa/intel_batchbuffer.c | 4 ++++ 1 file changed, 4 insertions(+)
src/uxa/intel_batchbuffer.c +4 -0
@@ -184,6 +184,10 @@ void intel_batch_emit_flush(ScrnInfoPtr scrn)assert (!intel->in_batch_atomic); +/* No point in flushing an empty batch. */ +if (intel->current_batch ==0 ) +return ; +/* Big hammer, look to the pipelined flushes in future. */ if ((INTEL_INFO (intel)->gen >=060 )) {if (intel->current_batch ==BLT_BATCH ) {
Signature · 1 line
1.8.4.2
PATCH 2/3 uxa: Remove implicit length from BLT command #defines.
These command packets grew on Gen8.
--- src/uxa/i830_reg.h | 12 ++++++------ src/uxa/intel_uxa.c | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-)
src/uxa/i830_reg.h +6 -6
@@ -70,32 +70,32 @@#define COLOR_BLT_WRITE_ALPHA (1<<21)#define COLOR_BLT_WRITE_RGB (1<<20) -#define XY_COLOR_BLT_CMD ((2<<29)|(0x50<<22)|(0x4)) +#define XY_COLOR_BLT_CMD ((2<<29)|(0x50<<22))#define XY_COLOR_BLT_WRITE_ALPHA (1<<21)#define XY_COLOR_BLT_WRITE_RGB (1<<20)#define XY_COLOR_BLT_TILED (1<<11) -#define XY_SETUP_CLIP_BLT_CMD ((2<<29)|(3<<22)|1) +#define XY_SETUP_CLIP_BLT_CMD ((2<<29)|(3<<22)) -#define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6) +#define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22))#define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21)#define XY_SRC_COPY_BLT_WRITE_RGB (1<<20)#define XY_SRC_COPY_BLT_SRC_TILED (1<<15)#define XY_SRC_COPY_BLT_DST_TILED (1<<11) -#define SRC_COPY_BLT_CMD ((2<<29)|(0x43<<22)|0x4) +#define SRC_COPY_BLT_CMD ((2<<29)|(0x43<<22))#define SRC_COPY_BLT_WRITE_ALPHA (1<<21)#define SRC_COPY_BLT_WRITE_RGB (1<<20)#define XY_PAT_BLT_IMMEDIATE ((2<<29)|(0x72<<22)) -#define XY_MONO_PAT_BLT_CMD ((0x2<<29)|(0x52<<22)|0x7) +#define XY_MONO_PAT_BLT_CMD ((0x2<<29)|(0x52<<22))#define XY_MONO_PAT_VERT_SEED ((1<<10)|(1<<9)|(1<<8))#define XY_MONO_PAT_HORT_SEED ((1<<14)|(1<<13)|(1<<12))#define XY_MONO_PAT_BLT_WRITE_ALPHA (1<<21)#define XY_MONO_PAT_BLT_WRITE_RGB (1<<20) -#define XY_MONO_SRC_BLT_CMD ((0x2<<29)|(0x54<<22)|(0x6)) +#define XY_MONO_SRC_BLT_CMD ((0x2<<29)|(0x54<<22))#define XY_MONO_SRC_BLT_WRITE_ALPHA (1<<21)#define XY_MONO_SRC_BLT_WRITE_RGB (1<<20)
src/uxa/intel_uxa.c +2 -2
@@ -326,7 +326,7 @@ static void intel_uxa_solid(PixmapPtr pixmap, int x1, int y1, int x2, int y2) {BEGIN_BATCH_BLT (6 ); - cmd =XY_COLOR_BLT_CMD ; + cmd =XY_COLOR_BLT_CMD | (6 -2 );if (pixmap->drawable.bitsPerPixel ==32 ) cmd |=
@@ -464,7 +464,7 @@ intel_uxa_copy(PixmapPtr dest, int src_x1, int src_y1, int dst_x1, {BEGIN_BATCH_BLT (8 ); - cmd =XY_SRC_COPY_BLT_CMD ; + cmd =XY_SRC_COPY_BLT_CMD | (8 -2 );if (dest->drawable.bitsPerPixel ==32 ) cmd |=
Signature · 1 line
1.8.4.2
Re: [PATCH 2/3] uxa: Remove implicit length from BLT command #defines.
Quoted 14 lines · Kenneth Graunke
These command packets grew on Gen8.
Signed-off-by Kenneth Graunke <[email protected]>--- src/uxa/i830_reg.h | 12 ++++++------ src/uxa/intel_uxa.c | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-)src/uxa/i830_reg.h +0
-0@@ -70,32 +70,32 @@#define COLOR_BLT_WRITE_ALPHA (1<<21)
src/uxa/i830_reg.h line 78
Quoted 10 lines
src/uxa/i830_reg.h +2
-2#define COLOR_BLT_WRITE_RGB (1<<20) -#define XY_COLOR_BLT_CMD ((2<<29)|(0x50<<22)|(0x4)) +#define XY_COLOR_BLT_CMD ((2<<29)|(0x50<<22))#define XY_COLOR_BLT_WRITE_ALPHA (1<<21)#define XY_COLOR_BLT_WRITE_RGB (1<<20)#define XY_COLOR_BLT_TILED (1<<11) -#define XY_SETUP_CLIP_BLT_CMD ((2<<29)|(3<<22)|1) +#define XY_SETUP_CLIP_BLT_CMD ((2<<29)|(3<<22))
We use this command in a snb+ w/a; fixed.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
PATCH 3/3 uxa: Enable BLT acceleration on Broadwell.
In reply to Kenneth GraunkeThis supports solid, copy, put_image, and get_image acceleration via the BLT engine. RENDER acceleration (composite) would be piles of work, which is not worth doing since SNA exists, and Glamor is coming.
--- src/uxa/intel_batchbuffer.h | 8 +++++++- src/uxa/intel_driver.c | 7 ++----- src/uxa/intel_uxa.c | 12 +++++++----- 3 files changed, 16 insertions(+), 11 deletions(-)
src/uxa/intel_batchbuffer.h +7 -1
@@ -108,6 +108,8 @@ intel_batch_emit_reloc(intel_screen_private *intel,uint32_t read_domains, uint32_t write_domains, uint32_t delta, int needs_fence) { + uint64_t offset; + if (needs_fence) drm_intel_bo_emit_reloc_fence(intel->batch_bo, intel->batch_used * 4,
@@ -118,7 +120,11 @@ intel_batch_emit_reloc(intel_screen_private *intel, bo, delta, read_domains, write_domains); -intel_batch_emit_dword (intel, bo->offset + delta); + offset = bo->offset64 + delta; + +intel_batch_emit_dword (intel, offset); +if (INTEL_INFO (intel)->gen >=0100 ) +intel_batch_emit_dword (intel, offset >>32 ); } static inline void
src/uxa/intel_driver.c +2 -5
@@ -405,9 +405,6 @@ static Bool can_accelerate_blt(struct intel_screen_private *intel)if (INTEL_INFO (intel)->gen ==-1 )return FALSE; -if (INTEL_INFO (intel)->gen >=0100 ) -return FALSE; -if (xf86ReturnOptValBool (intel->Options,OPTION_ACCEL_DISABLE , FALSE) || !intel_option_cast_string_to_bool (intel,OPTION_ACCEL_METHOD , TRUE)) { xf86DrvMsg(intel->scrn->scrnIndex, X_CONFIG,
@@ -938,7 +935,7 @@ I830ScreenInit(SCREEN_INIT_ARGS_DECL)intel_batch_init (scrn); -if (INTEL_INFO (intel)->gen >=040 ) +if (INTEL_INFO (intel)->gen >=040 &&INTEL_INFO (intel)->gen <0100 )gen4_render_state_init (scrn);miClearVisualTypes ();
@@ -1193,7 +1190,7 @@ static Bool I830CloseScreen(CLOSE_SCREEN_ARGS_DECL)intel_batch_teardown (scrn); -if (INTEL_INFO (intel)->gen >=040 ) +if (INTEL_INFO (intel)->gen >=040 &&INTEL_INFO (intel)->gen <0100 )gen4_render_state_cleanup (scrn);xf86_cursors_fini (screen);
src/uxa/intel_uxa.c +7 -5
@@ -324,9 +324,10 @@ static void intel_uxa_solid(PixmapPtr pixmap, int x1, int y1, int x2, int y2) pitch =intel_pixmap_pitch (pixmap); { -BEGIN_BATCH_BLT (6 ); +int len =INTEL_INFO (intel)->gen >=0100 ?7 :6 ; +BEGIN_BATCH_BLT (len); - cmd =XY_COLOR_BLT_CMD | (6 -2 ); + cmd =XY_COLOR_BLT_CMD | (len -2 );if (pixmap->drawable.bitsPerPixel ==32 ) cmd |=
@@ -462,9 +463,10 @@ intel_uxa_copy(PixmapPtr dest, int src_x1, int src_y1, int dst_x1, src_pitch =intel_pixmap_pitch (intel->render_source); { -BEGIN_BATCH_BLT (8 ); +int len =INTEL_INFO (intel)->gen >=0100 ?10 :8 ; +BEGIN_BATCH_BLT (len); - cmd =XY_SRC_COPY_BLT_CMD | (8 -2 ); + cmd =XY_SRC_COPY_BLT_CMD | (len -2 );if (dest->drawable.bitsPerPixel ==32 ) cmd |=
@@ -1353,7 +1355,7 @@ Bool intel_uxa_init(ScreenPtr screen) intel->uxa_driver->done_copy = intel_uxa_done;/* Composite */ -if (intel_option_accel_blt (intel)) { +if (intel_option_accel_blt (intel) ||INTEL_INFO (intel)->gen >=0100 ) { }else if (IS_GEN2 (intel)) { intel->uxa_driver->check_composite = i830_check_composite; intel->uxa_driver->check_composite_target = i830_check_composite_target;
Signature · 1 line
1.8.4.2
Re: [PATCH 3/3] uxa: Enable BLT acceleration on Broadwell.
Quoted 3 lines · Kenneth Graunke
This supports solid, copy,
put_image, andget_imageacceleration via the BLT engine. RENDER acceleration (composite) would be piles of work, which is not worth doing since SNA exists, and Glamor is coming.
Only thing I spotted was a need to disable Xv. Pushed with those two minor fixes. Thanks for the patches.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 6 lines · Kenneth Graunke
The first call to
BEGIN_BATCHorBEGIN_BATCH_BLTwill setcurrent_batchtoRENDER_BATCHorBLT_BATCH. If it's zero, that means the batch is empty, so there's no point in flushing.Previously, we would just go ahead and do a
RENDER_RINGflush, though more by accident than intentional design.
It was intentional. One code path required us to emit an empty batch - except that we don't allow such and so had to emit a flush instead. -Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre