Skip to contentSkip to conversation

split render engine batch buffer and BLT engine

PATCH In review Zou Nan hai 2 participants 9 messages Oct 26, 2010 – Oct 27, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 split render engine batch buffer and BLT engine

intel: on gen6, BLT commands stay in a seperate BLT ring
buffer. Split render engine batch and BLT engine batch on gen6.

---
 src/i830_3d.c           |    2 +-
 src/i830_render.c       |   16 +++--
 src/i915_3d.c           |    2 +-
 src/i915_3d.h           |    6 +-
 src/i915_render.c       |   23 +++---
 src/i915_video.c        |    9 ++-
 src/i965_render.c       |   21 +++---
 src/i965_video.c        |   10 ++--
 src/intel.h             |   55 ++++++++-------
 src/intel_batchbuffer.c |  171 +++++++++++++++++++++++++++--------------------
 src/intel_batchbuffer.h |  128 +++++++++++++++++++----------------
 src/intel_display.c     |    4 +-
 src/intel_dri.c         |    3 +-
 src/intel_driver.c      |   18 +++--
 src/intel_uxa.c         |   46 +++++++------
 15 files changed, 285 insertions(+), 229 deletions(-)
src/i830_3d.c +1 -1
index 1043201..e0cfda7 100644
@@ -38,7 +38,7 @@ void I830EmitInvarientState(ScrnInfoPtr scrn)
 {
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 
-	assert(intel->in_batch_atomic);
+	assert(intel->batch[RENDER_BATCH].in_batch_atomic);
 
 	OUT_BATCH(_3DSTATE_MAP_CUBE | MAP_UNIT(0));
 	OUT_BATCH(_3DSTATE_MAP_CUBE | MAP_UNIT(1));
src/i830_render.c +9 -7
index 52646d3..867883a 100644
@@ -302,7 +302,7 @@ static void i830_texture_setup(PicturePtr picture, PixmapPtr pixmap, int unit)
 
 	format = i8xx_get_card_format(intel, picture);
 
-	assert(intel->in_batch_atomic);
+	assert(intel->batch[RENDER_BATCH].in_batch_atomic);
 
 	OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_2 |
 		  LOAD_TEXTURE_MAP(unit) | 4);
@@ -488,7 +488,8 @@ i830_prepare_composite(int op, PicturePtr source_picture,
 	if (!i830_get_dest_format(dest_picture, &intel->render_dest_format))
 		return FALSE;
 
-	if (!intel_get_aperture_space(scrn, bo_table, ARRAY_SIZE(bo_table)))
+	if (!intel_get_aperture_space(scrn, bo_table, ARRAY_SIZE(bo_table), 
+				RENDER_BATCH))
 		return FALSE;
 
 	if (mask) {
@@ -565,7 +566,7 @@ i830_prepare_composite(int op, PicturePtr source_picture,
 
 	if(intel_pixmap_is_dirty(source) ||
 	   (mask && intel_pixmap_is_dirty(mask)))
-		intel_batch_emit_flush(scrn);
+		intel_batch_emit_flush(scrn, RENDER_BATCH);
 
 	intel->needs_render_state_emit = TRUE;
 
@@ -583,7 +584,7 @@ static void i830_emit_composite_state(ScrnInfoPtr scrn)
 	IntelEmitInvarientState(scrn);
 	intel->last_3d = LAST_3D_RENDER;
 
-	assert(intel->in_batch_atomic);
+	assert(intel->batch[RENDER_BATCH].in_batch_atomic);
 
 	if (intel_pixmap_tiled(intel->render_dest)) {
 		tiling_bits = BUF_3D_TILED_SURFACE;
@@ -848,7 +849,8 @@ i830_composite(PixmapPtr dest, int srcX, int srcY, int maskX, int maskY,
 	intel_batch_start_atomic(scrn, 58 +	/* invarient */
 				 22 +	/* setup */
 				 20 +	/* 2 * setup_texture */
-				 1 + 30 /* verts */ );
+				 1 + 30 /* verts */,
+				 RENDER_BATCH);
 
 	if (intel->needs_render_state_emit)
 		i830_emit_composite_state(scrn);
@@ -856,10 +858,10 @@ i830_composite(PixmapPtr dest, int srcX, int srcY, int maskX, int maskY,
 	i830_emit_composite_primitive(dest, srcX, srcY, maskX, maskY, dstX,
 				      dstY, w, h);
 
-	intel_batch_end_atomic(scrn);
+	intel_batch_end_atomic(scrn, RENDER_BATCH);
 }
 
-void i830_batch_flush_notify(ScrnInfoPtr scrn)
+void i830_batch_flush_notify(ScrnInfoPtr scrn, int batch_idx)
 {
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 
src/i915_3d.c +1 -1
index 77db568..a4e386d 100644
@@ -38,7 +38,7 @@ void I915EmitInvarientState(ScrnInfoPtr scrn)
 {
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 
-	assert(intel->in_batch_atomic);
+	assert(intel->batch[RENDER_BATCH].in_batch_atomic);
 
 	OUT_BATCH(_3DSTATE_AA_CMD |
 		  AA_LINE_ECAAR_WIDTH_ENABLE |
src/i915_3d.h +3 -3
index 04531f3..056c961 100644
@@ -608,12 +608,12 @@ enum i915_fs_channel {
 
 #define FS_BEGIN()							\
 	do {									\
-		_shader_offset = intel->batch_used++;				\
+		_shader_offset = intel->batch[RENDER_BATCH].batch_used++;				\
 	} while (0)
 
 #define FS_END()							\
 	do {									\
-		intel->batch_ptr[_shader_offset] =					\
+		intel->batch[RENDER_BATCH].batch_ptr[_shader_offset] =					\
 		_3DSTATE_PIXEL_SHADER_PROGRAM |					\
-		(intel->batch_used - _shader_offset - 2);			\
+		(intel->batch[RENDER_BATCH].batch_used - _shader_offset - 2);			\
 	} while (0);
src/i915_render.c +12 -11
index fafdac5..21a0021 100644
@@ -546,7 +546,7 @@ i915_emit_composite_primitive(PixmapPtr dest,
 {
 	ScrnInfoPtr scrn = xf86Screens[dest->drawable.pScreen->myNum];
 	intel_screen_private *intel = intel_get_screen_private(scrn);
-	Bool is_affine_src, is_affine_mask = TRUE;
+	Bool is_affine_src = FALSE, is_affine_mask = TRUE;
 	int per_vertex, num_floats;
 	int tex_unit = 0;
 	int src_unit = -1, mask_unit = -1;
@@ -780,7 +780,8 @@ i915_prepare_composite(int op, PicturePtr source_picture,
 				  &intel->i915_render_state.dst_format))
 		return FALSE;
 
-	if (!intel_get_aperture_space(scrn, bo_table, ARRAY_SIZE(bo_table)))
+	if (!intel_get_aperture_space(scrn, bo_table, ARRAY_SIZE(bo_table),
+		RENDER_BATCH))
 		return FALSE;
 
 	intel->needs_render_ca_pass = FALSE;
@@ -838,10 +839,10 @@ i915_prepare_composite(int op, PicturePtr source_picture,
 
 	/* BUF_INFO is an implicit flush */
 	if (dest != intel->render_current_dest)
-		intel_batch_do_flush(scrn);
+		intel_batch_do_flush(scrn, RENDER_BATCH);
 	else if((source && intel_pixmap_is_dirty(source)) ||
 		(mask && intel_pixmap_is_dirty(mask)))
-		intel_batch_emit_flush(scrn);
+		intel_batch_emit_flush(scrn, RENDER_BATCH);
 
 	intel->needs_render_state_emit = TRUE;
 
@@ -1007,7 +1008,7 @@ static void i915_emit_composite_setup(ScrnInfoPtr scrn)
 	tex_count += ! is_solid_src;
 	tex_count += mask && ! is_solid_mask;
 
-	assert(intel->in_batch_atomic);
+	assert(intel->batch[RENDER_BATCH].in_batch_atomic);
 
 	if (tex_count != 0) {
 	    OUT_BATCH(_3DSTATE_MAP_STATE | (3 * tex_count));
@@ -1043,7 +1044,7 @@ static void i915_emit_composite_setup(ScrnInfoPtr scrn)
 	if (1 || dest != intel->render_current_dest) {
 		uint32_t tiling_bits;
 
-		intel_batch_do_flush(scrn);
+		intel_batch_do_flush(scrn, RENDER_BATCH);
 
 		if (intel_pixmap_tiled(dest)) {
 			tiling_bits = BUF_3D_TILED_SURFACE;
@@ -1116,7 +1117,7 @@ i915_composite(PixmapPtr dest, int srcX, int srcY, int maskX, int maskY,
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 
 	/* 28 + 16 + 10 + 20 + 32 + 16 */
-	intel_batch_start_atomic(scrn, 150);
+	intel_batch_start_atomic(scrn, 150, RENDER_BATCH);
 
 	if (intel->needs_render_state_emit)
 		i915_emit_composite_setup(scrn);
@@ -1158,7 +1159,7 @@ i915_composite(PixmapPtr dest, int srcX, int srcY, int maskX, int maskY,
 			i915_composite_emit_shader(intel, PictOpOutReverse);
 		}
 
-		intel->prim_offset = intel->batch_used;
+		intel->prim_offset = intel->batch[RENDER_BATCH].batch_used;
 		OUT_BATCH(PRIM3D_RECTLIST | PRIM3D_INDIRECT_SEQUENTIAL);
 		OUT_BATCH(intel->vertex_index);
 	}
@@ -1170,7 +1171,7 @@ i915_composite(PixmapPtr dest, int srcX, int srcY, int maskX, int maskY,
 			 dstX, dstY,
 			 w, h);
 
-	intel_batch_end_atomic(scrn);
+	intel_batch_end_atomic(scrn, RENDER_BATCH);
 }
 
 void
@@ -1179,7 +1180,7 @@ i915_vertex_flush(intel_screen_private *intel)
 	if (intel->prim_offset == 0)
 		return;
 
-	intel->batch_ptr[intel->prim_offset] |= intel->vertex_count;
+	intel->batch[RENDER_BATCH].batch_ptr[intel->prim_offset] |= intel->vertex_count;
 	intel->prim_offset = 0;
 
 	if (intel->needs_render_ca_pass) {
@@ -1197,7 +1198,7 @@ i915_vertex_flush(intel_screen_private *intel)
 }
 
 void
-i915_batch_flush_notify(ScrnInfoPtr scrn)
+i915_batch_flush_notify(ScrnInfoPtr scrn, int batch_idx)
 {
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 
src/i915_video.c +5 -4
index 861bea6..87016a7 100644
@@ -92,7 +92,7 @@ I915DisplayVideoTextured(ScrnInfoPtr scrn,
 
 #define BYTES_FOR_BOXES(n)	((200 + (n) * 20) * 4)
 #define BOXES_IN_BYTES(s)	((((s)/4) - 200) / 20)
-#define BATCH_BYTES(p)		((p)->batch_bo->size - 16)
+#define BATCH_BYTES(p)		((p)->batch[RENDER_BATCH].batch_bo->size - 16)
 
 	while (nbox_total) {
 		nbox_this_time = nbox_total;
@@ -100,7 +100,8 @@ I915DisplayVideoTextured(ScrnInfoPtr scrn,
 			nbox_this_time = BOXES_IN_BYTES(BATCH_BYTES(intel));
 		nbox_total -= nbox_this_time;
 
-		intel_batch_start_atomic(scrn, 200 + 20 * nbox_this_time);
+		intel_batch_start_atomic(scrn, 200 + 20 * nbox_this_time,
+			RENDER_BATCH);
 
 		IntelEmitInvarientState(scrn);
 		intel->last_3d = LAST_3D_VIDEO;
@@ -445,7 +446,7 @@ I915DisplayVideoTextured(ScrnInfoPtr scrn,
 			OUT_BATCH_F((box_y1 - dyo) * src_scale_y);
 		}
 
-		intel_batch_end_atomic(scrn);
+		intel_batch_end_atomic(scrn, RENDER_BATCH);
 	}
 
 	if (target != pixmap) {
@@ -478,5 +479,5 @@ I915DisplayVideoTextured(ScrnInfoPtr scrn,
 		target->drawable.pScreen->DestroyPixmap(target);
 	}
 
-	intel_debug_flush(scrn);
+	intel_debug_flush(scrn, RENDER_BATCH);
 }
src/i965_render.c +11 -10
index c0c5de4..c9c65fb 100644
@@ -1128,7 +1128,7 @@ i965_set_picture_surface_state(intel_screen_private *intel,
 			read_domains = I915_GEM_DOMAIN_SAMPLER;
 		}
 
-		intel_batch_mark_pixmap_domains(intel, priv, read_domains, write_domain);
+		intel_batch_mark_pixmap_domains(intel, priv, read_domains, write_domain, RENDER_BATCH);
 		dri_bo_emit_reloc(ss_bo, read_domains, write_domain,
 				  0,
 				  ss_index * sizeof(*ss) +
@@ -1169,7 +1169,8 @@ static void i965_emit_composite_state(ScrnInfoPtr scrn)
 	intel_batch_mark_pixmap_domains(intel,
 					intel_get_pixmap_private(dest),
 					I915_GEM_DOMAIN_RENDER,
-					I915_GEM_DOMAIN_RENDER);
+					I915_GEM_DOMAIN_RENDER,
+					RENDER_BATCH);
 
 	urb_vs_start = 0;
 	urb_vs_size = URB_VS_ENTRIES * URB_VS_ENTRY_SIZE;
@@ -1195,7 +1196,7 @@ static void i965_emit_composite_state(ScrnInfoPtr scrn)
 	 */
 	ALIGN_BATCH(64);
 
-	assert(intel->in_batch_atomic);
+	assert(intel->batch[RENDER_BATCH].in_batch_atomic);
 	{
 		/* Match Mesa driver setup */
 		OUT_BATCH(MI_FLUSH |
@@ -1473,7 +1474,7 @@ static Bool i965_composite_check_aperture(ScrnInfoPtr scrn)
 	struct gen4_render_state *render_state = intel->gen4_render_state;
 	gen4_composite_op *composite_op = &render_state->composite_op;
 	drm_intel_bo *bo_table[] = {
-		intel->batch_bo,
+		intel->batch[RENDER_BATCH].batch_bo,
 		composite_op->binding_table_bo,
 		render_state->vertex_buffer_bo,
 		render_state->vs_state_bo,
@@ -1558,7 +1559,7 @@ i965_prepare_composite(int op, PicturePtr source_picture,
 	/* Flush any pending writes prior to relocating the textures. */
 	if (intel_pixmap_is_dirty(source) ||
 	    (mask && intel_pixmap_is_dirty(mask)))
-		intel_batch_emit_flush(scrn);
+		intel_batch_emit_flush(scrn, RENDER_BATCH);
 
 
 	/* Set up the surface states. */
@@ -1684,7 +1685,7 @@ i965_prepare_composite(int op, PicturePtr source_picture,
 	}
 
 	if (!i965_composite_check_aperture(scrn)) {
-		intel_batch_submit(scrn, FALSE);
+		intel_batch_submit(scrn, FALSE, RENDER_BATCH);
 		if (!i965_composite_check_aperture(scrn)) {
 			intel_debug_fallback(scrn,
 					     "Couldn't fit render operation "
@@ -1857,9 +1858,9 @@ i965_composite(PixmapPtr dest, int srcX, int srcY, int maskX, int maskY,
 	drm_intel_bo_subdata(vb_bo, render_state->vb_offset * 4, i * 4, vb);
 
 	if (!i965_composite_check_aperture(scrn))
-		intel_batch_submit(scrn, FALSE);
+		intel_batch_submit(scrn, FALSE, RENDER_BATCH);
 
-	intel_batch_start_atomic(scrn, 200);
+	intel_batch_start_atomic(scrn, 200, RENDER_BATCH);
 	if (intel->needs_render_state_emit)
 		i965_emit_composite_state(scrn);
 
@@ -1891,10 +1892,10 @@ i965_composite(PixmapPtr dest, int srcX, int srcY, int maskX, int maskY,
 	render_state->vb_offset += i;
 	drm_intel_bo_unreference(vb_bo);
 
-	intel_batch_end_atomic(scrn);
+	intel_batch_end_atomic(scrn, RENDER_BATCH);
 }
 
-void i965_batch_flush_notify(ScrnInfoPtr scrn)
+void i965_batch_flush_notify(ScrnInfoPtr scrn, int batch_idx)
 {
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 	struct gen4_render_state *render_state = intel->gen4_render_state;
src/i965_video.c +5 -5
index 4ededde..f3e4082 100644
@@ -1154,7 +1154,7 @@ I965DisplayVideoTextured(ScrnInfoPtr scrn,
 		float *vb;
 		drm_intel_bo *bo_table[] = {
 			NULL,	/* vb_bo */
-			intel->batch_bo,
+			intel->batch[RENDER_BATCH].batch_bo,
 			bind_bo,
 			intel->video.gen4_sampler_bo,
 			intel->video.gen4_sip_kernel_bo,
@@ -1199,10 +1199,10 @@ I965DisplayVideoTextured(ScrnInfoPtr scrn,
 		if (drm_intel_bufmgr_check_aperture_space(bo_table,
 							  ARRAY_SIZE(bo_table))
 		    < 0) {
-			intel_batch_submit(scrn, FALSE);
+			intel_batch_submit(scrn, FALSE, RENDER_BATCH);
 		}
 
-		intel_batch_start_atomic(scrn, 100);
+		intel_batch_start_atomic(scrn, 100, RENDER_BATCH);
 
 		i965_emit_video_setup(scrn, bind_bo, n_src_surf);
 
@@ -1228,7 +1228,7 @@ I965DisplayVideoTextured(ScrnInfoPtr scrn,
 		OUT_BATCH(0);	/* index buffer offset, ignored */
 		OUT_BATCH(MI_NOOP);
 
-		intel_batch_end_atomic(scrn);
+		intel_batch_end_atomic(scrn, RENDER_BATCH);
 
 		drm_intel_bo_unreference(vb_bo);
 
@@ -1240,7 +1240,7 @@ I965DisplayVideoTextured(ScrnInfoPtr scrn,
 	/* release reference once we're finished */
 	drm_intel_bo_unreference(bind_bo);
 
-	intel_debug_flush(scrn);
+	intel_debug_flush(scrn, RENDER_BATCH);
 }
 
 void i965_free_video(ScrnInfoPtr scrn)
src/intel.h +30 -25

109 lines not on this page · raw message

src/intel_batchbuffer.c +98 -73

290 lines not on this page · raw message

src/intel_batchbuffer.h +69 -59

228 lines not on this page · raw message

src/intel_display.c +2 -2
index d32224e..78f83aa 100644
@@ -552,7 +552,7 @@ intel_crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
 		return NULL;
 	}
 
-	intel_set_pixmap_bo(rotate_pixmap, intel_crtc->rotate_bo);
+	intel_set_pixmap_bo(rotate_pixmap, intel_crtc->rotate_bo, RENDER_BATCH);
 
 	intel->shadow_present = TRUE;
 
@@ -568,7 +568,7 @@ intel_crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data)
 	struct intel_mode *mode = intel_crtc->mode;
 
 	if (rotate_pixmap) {
-		intel_set_pixmap_bo(rotate_pixmap, NULL);
+		intel_set_pixmap_bo(rotate_pixmap, NULL, RENDER_BATCH);
 		FreeScratchPixmapHeader(rotate_pixmap);
 	}
 
src/intel_dri.c +2 -1
index 67f7be9..b4876c8 100644
@@ -93,7 +93,8 @@ static PixmapPtr get_front_buffer(DrawablePtr drawable)
 						   intel->front_pitch,
 						   intel->front_buffer->virtual);
 
-			intel_set_pixmap_bo(pixmap, intel->front_buffer);
+			intel_set_pixmap_bo(pixmap, intel->front_buffer, 
+				RENDER_BATCH);
 			intel_get_pixmap_private(pixmap)->offscreen = 0;
 			if (WindowDrawable(drawable->type))
 				screen->SetWindowPixmap((WindowPtr)drawable,
src/intel_driver.c +12 -6
index 7e4a4a4..b9fb69d 100644
@@ -431,9 +431,15 @@ static int intel_init_bufmgr(intel_screen_private *intel)
 	drm_intel_bufmgr_gem_enable_reuse(intel->bufmgr);
 	drm_intel_bufmgr_gem_enable_fenced_relocs(intel->bufmgr);
 
-	list_init(&intel->batch_pixmaps);
-	list_init(&intel->flush_pixmaps);
-	list_init(&intel->in_flight);
+	list_init(&intel->batch[RENDER_BATCH].batch_pixmaps);
+	list_init(&intel->batch[RENDER_BATCH].flush_pixmaps);
+	list_init(&intel->batch[RENDER_BATCH].in_flight);
+
+	if (IS_GEN6(intel)) {
+		list_init(&intel->batch[BLT_BATCH].batch_pixmaps);
+		list_init(&intel->batch[BLT_BATCH].flush_pixmaps);
+		list_init(&intel->batch[BLT_BATCH].in_flight);
+	}
 
 	return TRUE;
 }
@@ -801,8 +807,8 @@ intel_flush_callback(CallbackListPtr *list,
 		 * framebuffer until significantly later.
 		 */
 		intel_batch_submit(scrn,
-				   intel->need_mi_flush ||
-				   !list_is_empty(&intel->flush_pixmaps));
+				   intel->batch[RENDER_BATCH].need_mi_flush 
+				   ||!list_is_empty(&intel->batch[RENDER_BATCH].flush_pixmaps), RENDER_BATCH);
 	}
 }
 
@@ -1220,7 +1226,7 @@ static Bool I830CloseScreen(int scrnIndex, ScreenPtr screen)
 	if (intel->front_buffer) {
 		if (!intel->use_shadow)
 			intel_set_pixmap_bo(screen->GetScreenPixmap(screen),
-					    NULL);
+					    NULL, RENDER_BATCH);
 		intel_mode_remove_fb(intel);
 		drm_intel_bo_unreference(intel->front_buffer);
 		intel->front_buffer = NULL;
src/intel_uxa.c +25 -21

150 lines not on this page · raw message

Signature · 1 line
1.7.1
#1 lore raw

PATCH 2/2 use BLT command to accelerate uxa on gen6.

uxa: enable accelerate for uxa_copy and uxa_solid
on gen6.

---
 src/i830_reg.h          |    2 +
 src/intel_batchbuffer.c |   35 ++++++--
 src/intel_batchbuffer.h |   31 ++++++-
 src/intel_driver.c      |    3 +-
 src/intel_uxa.c         |  230 +++++++++++++++++++++++++++++++++++++++--------
 5 files changed, 248 insertions(+), 53 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_batchbuffer.c +27 -8
index 3b72ba1..cde086b 100644
@@ -171,6 +171,12 @@ void intel_batch_emit_flush(ScrnInfoPtr scrn, int batch_idx)
 
 		intel_batch_do_flush(scrn, batch_idx);
 	} else {
+		BEGIN_BATCH_BLT(4);
+		OUT_BATCH_BLT(MI_FLUSH_DW | 2);
+		OUT_BATCH_BLT(0);
+		OUT_BATCH_BLT(0);
+		OUT_BATCH_BLT(0);
+		ADVANCE_BATCH_BLT();
 	}
 }
 
@@ -193,13 +199,22 @@ void intel_batch_submit(ScrnInfoPtr scrn, int flush, int batch_idx)
 
 	if (batch->batch_used == 0)
 		return;
+	
+	if (batch_idx == RENDER_BATCH) {
+		/* Mark the end of the batchbuffer. */
+		OUT_BATCH(MI_BATCH_BUFFER_END);
+		/* Emit a padding dword if we aren't going to be quad-word aligned. */
+		if (batch->batch_used & 1)
+			OUT_BATCH(MI_NOOP);
+	} else {
+		/* Mark the end of the batchbuffer. */
+		OUT_BATCH_BLT(MI_BATCH_BUFFER_END);
+		/* Emit a padding dword if we aren't going to be quad-word aligned. */
+		if (batch->batch_used & 1)
+			OUT_BATCH_BLT(MI_NOOP);
+	}
 
-	/* Mark the end of the batchbuffer. */
-	OUT_BATCH(MI_BATCH_BUFFER_END);
-	/* Emit a padding dword if we aren't going to be quad-word aligned. */
-	if (batch->batch_used & 1)
-		OUT_BATCH(MI_NOOP);
-
+	
 	if (DUMP_BATCHBUFFERS) {
 	    FILE *file = fopen(DUMP_BATCHBUFFERS, "a");
 	    if (file) {
@@ -211,9 +226,13 @@ void intel_batch_submit(ScrnInfoPtr scrn, int flush, int batch_idx)
 	ret = dri_bo_subdata(batch->batch_bo, 0, batch->batch_used*4, batch->batch_ptr);
 	if (ret == 0) {
 		if (batch_idx == RENDER_BATCH) {
-			ret = dri_bo_exec(batch->batch_bo, batch->batch_used*4,
-					NULL, 0, 0xffffffff);
+			 ret = drm_intel_bo_mrb_exec(batch->batch_bo, 
+					 batch->batch_used*4,
+					 NULL, 0, 0xffffffff, I915_EXEC_RENDER);
 		} else {
+			 ret = drm_intel_bo_mrb_exec(batch->batch_bo, 
+					 batch->batch_used*4,
+					 NULL, 0, 0xffffffff, I915_EXEC_BLIT);
 		}
 	}
 	if (ret != 0) {
src/intel_batchbuffer.h +26 -5
index 1ed3ad8..6d1ee15 100644
@@ -156,20 +156,35 @@ intel_batch_emit_reloc_pixmap(intel_screen_private *intel, PixmapPtr pixmap,
 }
 
 #define ALIGN_BATCH(align) intel_batch_align(intel, align, RENDER_BATCH);
+#define ALIGN_BATCH_BLT(align) intel_batch_align(intel, align, BLT_BATCH);
+
 #define OUT_BATCH(dword) intel_batch_emit_dword(intel, dword, RENDER_BATCH)
+#define OUT_BATCH_BLT(dword) intel_batch_emit_dword(intel, dword, BLT_BATCH)
 
 #define OUT_RELOC(bo, read_domains, write_domains, delta) \
 	intel_batch_emit_reloc(intel, bo, read_domains, write_domains, delta, 0,RENDER_BATCH)
 
+#define OUT_RELOC_BLT(bo, read_domains, write_domains, delta) \
+	intel_batch_emit_reloc(intel, bo, read_domains, write_domains, delta, 0,BLT_BATCH)
+
 #define OUT_RELOC_FENCED(bo, read_domains, write_domains, delta) \
 	intel_batch_emit_reloc(intel, bo, read_domains, write_domains, delta, 1,RENDER_BATCH)
 
+#define OUT_RELOC_FENCED_BLT(bo, read_domains, write_domains, delta) \
+	intel_batch_emit_reloc(intel, bo, read_domains, write_domains, delta, 1,BLT_BATCH)
+
 #define OUT_RELOC_PIXMAP(pixmap, reads, write, delta)	\
 	intel_batch_emit_reloc_pixmap(intel, pixmap, reads, write, delta, 0, RENDER_BATCH)
 
+#define OUT_RELOC_PIXMAP_BLT(pixmap, reads, write, delta)	\
+	intel_batch_emit_reloc_pixmap(intel, pixmap, reads, write, delta, 0, BLT_BATCH)
+
 #define OUT_RELOC_PIXMAP_FENCED(pixmap, reads, write, delta)	\
 	intel_batch_emit_reloc_pixmap(intel, pixmap, reads, write, delta, 1, RENDER_BATCH)
 
+#define OUT_RELOC_PIXMAP_FENCED_BLT(pixmap, reads, write, delta)	\
+	intel_batch_emit_reloc_pixmap(intel, pixmap, reads, write, delta, 1, BLT_BATCH)
+
 union intfloat {
 	float f;
 	unsigned int ui;
@@ -181,20 +196,23 @@ union intfloat {
 	OUT_BATCH(tmp.ui);			\
 } while(0)
 
-#define BEGIN_BATCH(n)							\
+#define __BEGIN_BATCH(n,batch_idx)					\
 do {									\
-	struct batch *batch = &intel->batch[RENDER_BATCH];		\
+	struct batch *batch = &intel->batch[batch_idx];			\
 	if (batch->batch_emitting != 0)					\
 		FatalError("%s: BEGIN_BATCH called without closing "	\
 			   "ADVANCE_BATCH\n", __FUNCTION__);		\
 	assert(!batch->in_batch_atomic);				\
-	intel_batch_require_space(scrn, intel, (n) * 4, RENDER_BATCH);	\
+	intel_batch_require_space(scrn, intel, (n) * 4, batch_idx);	\
 	batch->batch_emitting = (n);					\
 	batch->batch_emit_start = batch->batch_used;			\
 } while (0)
 
-#define ADVANCE_BATCH() do {						\
-	struct batch *batch = &intel->batch[RENDER_BATCH];		\
+#define BEGIN_BATCH(n)		__BEGIN_BATCH(n,RENDER_BATCH)
+#define BEGIN_BATCH_BLT(n)	__BEGIN_BATCH(n,BLT_BATCH)
+
+#define __ADVANCE_BATCH(batch_idx) do {					\
+	struct batch *batch = &intel->batch[batch_idx];			\
 	if (batch->batch_emitting == 0)					\
 		FatalError("%s: ADVANCE_BATCH called with no matching "	\
 			   "BEGIN_BATCH\n", __FUNCTION__);		\
@@ -213,6 +231,9 @@ do {									\
 	batch->batch_emitting = 0;					\
 } while (0)
 
+#define ADVANCE_BATCH(batch_idx) __ADVANCE_BATCH(RENDER_BATCH)
+#define ADVANCE_BATCH_BLT(batch_idx) __ADVANCE_BATCH(BLT_BATCH)
+
 void intel_next_vertex(intel_screen_private *intel);
 static inline void intel_vertex_emit(intel_screen_private *intel, float v)
 {
src/intel_driver.c +1 -2
index b9fb69d..051497d 100644
@@ -581,8 +581,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 =
@@ -809,6 +807,7 @@ intel_flush_callback(CallbackListPtr *list,
 		intel_batch_submit(scrn,
 				   intel->batch[RENDER_BATCH].need_mi_flush 
 				   ||!list_is_empty(&intel->batch[RENDER_BATCH].flush_pixmaps), RENDER_BATCH);
+
 	}
 }
 
src/intel_uxa.c +192 -38

315 lines not on this page · raw message

Signature · 1 line
1.7.1
#2 lore raw
In reply to Zou Nan hai
Quoted 3 lines · Zou Nan hai

intel: on gen6, BLT commands stay in a seperate BLT ring
buffer. Split render engine batch and BLT engine batch on gen6.

No. The batch buffer needs to be modal, and upon a context switch flushes the current batch. Otherwise we will not be able to synchronise rendering between rings.

Plus, implementing that is about 20 lines.
-Chris

Quoted 1 line

Chris Wilson, Intel Open Source Technology Centre

#3 lore raw
Quoted 13 lines
Quoted 13 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: 2010年10月26日 16:18
To: Zou, Nanhai; [email protected]
Subject: Re: [Intel-gfx] [PATCH 1/2] split render engine batch buffer and BLT engine

Quoted 3 lines · Zou Nan hai

intel: on gen6, BLT commands stay in a seperate BLT ring
buffer. Split render engine batch and BLT engine batch on gen6.

Quoted 6 lines
Quoted 6 lines

No. The batch buffer needs to be modal, and upon a context switch flushes the current batch. Otherwise we will not be able to synchronise rendering between rings.

Plus, implementing that is about 20 lines.
-Chris

Hi,
I do not quite understand your point.
How can we mix blitter command with render command in a batch buffer?

Thanks
Zou nan hai

Quoted 3 lines
Quoted 3 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

#4 lore raw
Quoted 27 lines
Quoted 27 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Zou, Nanhai
Sent: 2010年10月26日 16:23
To: Chris Wilson; [email protected]
Subject: Re: [Intel-gfx] [PATCH 1/2] split render engine batch buffer and BLT engine

Quoted 5 lines
Quoted 5 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: 2010年10月26日 16:18
To: Zou, Nanhai; [email protected]
Subject: Re: [Intel-gfx] [PATCH 1/2] split render engine batch buffer and

BLT

Quoted 11 lines
Quoted 11 lines

engine

Quoted 3 lines · Zou Nan hai

intel: on gen6, BLT commands stay in a seperate BLT ring
buffer. Split render engine batch and BLT engine batch on gen6.

No. The batch buffer needs to be modal, and upon a context switch flushes the current batch. Otherwise we will not be able to synchronise rendering between rings.

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

Plus, implementing that is about 20 lines.
-Chris

Hi,
I do not quite understand your point.
How can we mix blitter command with render command in a batch buffer?

Thanks
Zou nan hai

Even if we can implement the batch buffer in a modal way. I think it is not the best usage model.
Render engine and BLT engine are separate engines on gen6+. For them to run one by one will not maximum the GPU usage.

Thanks
Zou Nan hai

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 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

#5 lore raw
Quoted 4 lines · Nanhai

Even if we can implement the batch buffer in a modal way. I think it is not the best usage model.
Render engine and BLT engine are separate engines on gen6+. For them to run one by one will not maximum the GPU usage.

What usage pattern are you designing for? The most common pattern I've seen is for short intermixed operations on a connected set of buffers. So just what is the average length of the concurrent batch buffers (with correct inter-ring flushing) versus a much simpler modal approach?

And do you have any x11perf figures yet?
-Chris

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

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: 2010年10月26日 16:38
To: Zou, Nanhai; Zou, Nanhai; [email protected]
Subject: RE: [Intel-gfx] [PATCH 1/2] split render engine batch buffer and BLT engine

Quoted 4 lines · Nanhai

Even if we can implement the batch buffer in a modal way. I think it is not the best usage model.
Render engine and BLT engine are separate engines on gen6+. For them to run one by one will not maximum the GPU usage.

Quoted 7 lines
Quoted 7 lines

What usage pattern are you designing for? The most common pattern I've seen is for short intermixed operations on a connected set of buffers. So just what is the average length of the concurrent batch buffers (with correct inter-ring flushing) versus a much simpler modal approach?

And do you have any x11perf figures yet?
-Chris

I don't have x11perf result yet.
We have also discussed about the cache coherence design on gen6+.
There are 4 kinds of ring on gen6+ used by different engines, also now CPU and GPU share the last level cache. So we may need a better cache synchronize mechanism.

Thanks
Zou Nan hai

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

#7 lore raw
In reply to Zou, Nanhai
Quoted 2 lines · Nanhai

I do not quite understand your point.
How can we mix blitter command with render command in a batch buffer?

We can't. We also can't mix render targets/sources between concurrent batch buffers either, at the moment. (I'd much rather finish the kernel synchronisation before teaching X how to synchronise a pair of interdependent concurrent batch buffers). So in order to get any synchronisation between the rings you have to flush the BLT batch when starting a RENDER operation (if that operation accesses a BLT buffer and vice versa). Hence why I think that a single, modal batch buffer will be no less efficient than maintaining a pair (or more) concurrent batch buffers. X's request model means that we will process many sequential ops from a single client in a single pass which will intermix BLT/RENDER commands (or just use RENDER predominantly). I do not foresee X attaining any great level of parallelism between the rings.
-Chris

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

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: 2010年10月26日 17:13
To: Zou, Nanhai; [email protected]
Subject: RE: [Intel-gfx] [PATCH 1/2] split render engine batch buffer and BLT engine

Quoted 2 lines · Nanhai

I do not quite understand your point.
How can we mix blitter command with render command in a batch buffer?

Quoted 13 lines
Quoted 5 lines

We can't. We also can't mix render targets/sources between concurrent batch buffers either, at the moment. (I'd much rather finish the kernel synchronisation before teaching X how to synchronise a pair of interdependent concurrent batch buffers). So in order to get any synchronisation between the rings you have to flush the BLT batch when

Quoted 8 lines

starting a RENDER operation (if that operation accesses a BLT buffer and vice versa). Hence why I think that a single, modal batch buffer will be no less efficient than maintaining a pair (or more) concurrent batch buffers. X's request model means that we will process many sequential ops from a single client in a single pass which will intermix BLT/RENDER commands (or just use RENDER predominantly). I do not foresee X attaining any great level of parallelism between the rings.
-Chris

Well,
I think I get your point. Will work our patch like that.

Thanks
Zou Nan hai

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