Skip to contentSkip to conversation

Xv on Sandybridge

PATCH Superseded Xiang, Haihao 2 participants 9 messages Oct 21, 2010 – Oct 22, 2010

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

Here is the set of patches to enable texture adaptor on Sandybridge. Currently you need to turn off shadow in /etc/xorg.conf to use texture video on Sandybridge

#1 lore raw

PATCH 1/6 Xv: set the surface state base address

To prepare for Xv on Sandybridge. It is easy to fill the binding table without relocation and make sure that the pointer to binding table only uses bits[15:0].

---
 src/i965_video.c |  141 +++++++++++++++++++++++++----------------------------
 1 files changed, 67 insertions(+), 74 deletions(-)
src/i965_video.c +67 -74
index 4ededde..aaf10fa 100644
@@ -360,17 +360,20 @@ intel_alloc_and_map(intel_screen_private *intel, char *name, int size,
 	return 0;
 }
 
-static drm_intel_bo *i965_create_dst_surface_state(ScrnInfoPtr scrn,
-						   PixmapPtr pixmap)
+static void i965_create_dst_surface_state(ScrnInfoPtr scrn,
+					PixmapPtr pixmap,
+					drm_intel_bo *surf_bo,
+					uint32_t offset)
 {
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 	struct brw_surface_state *dest_surf_state;
 	drm_intel_bo *pixmap_bo = intel_get_pixmap_bo(pixmap);
-	drm_intel_bo *surf_bo;
 
-	if (intel_alloc_and_map(intel, "textured video surface state", 4096,
-				&surf_bo, &dest_surf_state) != 0)
-		return NULL;
+	if (drm_intel_bo_map(surf_bo, TRUE) != 0)
+		return;
+
+	dest_surf_state = (struct brw_surface_state *)((char *)surf_bo->virtual + offset);
+	memset(dest_surf_state, 0, sizeof(*dest_surf_state));
 
 	dest_surf_state->ss0.surface_type = BRW_SURFACE_2D;
 	dest_surf_state->ss0.data_return_format =
@@ -393,7 +396,7 @@ static drm_intel_bo *i965_create_dst_surface_state(ScrnInfoPtr scrn,
 	dest_surf_state->ss0.render_cache_read_mode = 0;
 
 	dest_surf_state->ss1.base_addr =
-	    intel_emit_reloc(surf_bo, offsetof(struct brw_surface_state, ss1),
+	    intel_emit_reloc(surf_bo, offset + offsetof(struct brw_surface_state, ss1),
 			     pixmap_bo, 0, I915_GEM_DOMAIN_SAMPLER, 0);
 
 	dest_surf_state->ss2.height = scrn->virtualY - 1;
@@ -405,24 +408,25 @@ static drm_intel_bo *i965_create_dst_surface_state(ScrnInfoPtr scrn,
 	dest_surf_state->ss3.tile_walk = 0;	/* TileX */
 
 	drm_intel_bo_unmap(surf_bo);
-	return surf_bo;
 }
 
-static drm_intel_bo *i965_create_src_surface_state(ScrnInfoPtr scrn,
-						   drm_intel_bo * src_bo,
-						   uint32_t src_offset,
-						   int src_width,
-						   int src_height,
-						   int src_pitch,
-						   uint32_t src_surf_format)
+static void i965_create_src_surface_state(ScrnInfoPtr scrn,
+					drm_intel_bo * src_bo,
+					uint32_t src_offset,
+					int src_width,
+					int src_height,
+					int src_pitch,
+					uint32_t src_surf_format,
+					drm_intel_bo *surface_bo,
+					uint32_t offset)
 {
-	intel_screen_private *intel = intel_get_screen_private(scrn);
-	drm_intel_bo *surface_bo;
 	struct brw_surface_state *src_surf_state;
 
-	if (intel_alloc_and_map(intel, "textured video surface state", 4096,
-				&surface_bo, &src_surf_state) != 0)
-		return NULL;
+	if (drm_intel_bo_map(surface_bo, TRUE) != 0)
+		return;
+
+	src_surf_state = (struct brw_surface_state *)((char *)surface_bo->virtual + offset);
+	memset(src_surf_state, 0, sizeof(*src_surf_state));
 
 	/* Set up the source surface state buffer */
 	src_surf_state->ss0.surface_type = BRW_SURFACE_2D;
@@ -446,7 +450,7 @@ static drm_intel_bo *i965_create_src_surface_state(ScrnInfoPtr scrn,
 	if (src_bo) {
 		src_surf_state->ss1.base_addr =
 		    intel_emit_reloc(surface_bo,
-				     offsetof(struct brw_surface_state, ss1),
+				     offset + offsetof(struct brw_surface_state, ss1),
 				     src_bo, src_offset,
 				     I915_GEM_DOMAIN_SAMPLER, 0);
 	} else {
@@ -454,31 +458,25 @@ static drm_intel_bo *i965_create_src_surface_state(ScrnInfoPtr scrn,
 	}
 
 	drm_intel_bo_unmap(surface_bo);
-	return surface_bo;
 }
 
-static drm_intel_bo *i965_create_binding_table(ScrnInfoPtr scrn,
-					       drm_intel_bo ** surf_bos,
-					       int n_surf)
+static void i965_create_binding_table(ScrnInfoPtr scrn,
+				drm_intel_bo *bind_bo,
+				int n_surf)
 {
-	intel_screen_private *intel = intel_get_screen_private(scrn);
-	drm_intel_bo *bind_bo;
 	uint32_t *binding_table;
 	int i;
 
 	/* Set up a binding table for our surfaces.  Only the PS will use it */
+	if (drm_intel_bo_map(bind_bo, TRUE) != 0)
+		return;
 
-	if (intel_alloc_and_map(intel, "textured video binding table", 4096,
-				&bind_bo, &binding_table) != 0)
-		return NULL;
+	binding_table = (uint32_t*)((char *)bind_bo->virtual + n_surf * ALIGN(sizeof(struct brw_surface_state), 32));
 
 	for (i = 0; i < n_surf; i++)
-		binding_table[i] =
-		    intel_emit_reloc(bind_bo, i * sizeof(uint32_t), surf_bos[i],
-				     0, I915_GEM_DOMAIN_INSTRUCTION, 0);
+		binding_table[i] = i * ALIGN(sizeof(struct brw_surface_state), 32);
 
 	drm_intel_bo_unmap(bind_bo);
-	return bind_bo;
 }
 
 static drm_intel_bo *i965_create_sampler_state(ScrnInfoPtr scrn)
@@ -757,7 +755,7 @@ static drm_intel_bo *i965_create_cc_state(ScrnInfoPtr scrn)
 }
 
 static void
-i965_emit_video_setup(ScrnInfoPtr scrn, drm_intel_bo * bind_bo, int n_src_surf)
+i965_emit_video_setup(ScrnInfoPtr scrn, drm_intel_bo * surface_state_binding_table_bo, int n_src_surf)
 {
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 	int urb_vs_start, urb_vs_size;
@@ -804,7 +802,7 @@ i965_emit_video_setup(ScrnInfoPtr scrn, drm_intel_bo * bind_bo, int n_src_surf)
 	if (IS_GEN5(intel)) {
 		OUT_BATCH(BRW_STATE_BASE_ADDRESS | 6);
 		OUT_BATCH(0 | BASE_ADDRESS_MODIFY);	/* Generate state base address */
-		OUT_BATCH(0 | BASE_ADDRESS_MODIFY);	/* Surface state base address */
+		OUT_RELOC(surface_state_binding_table_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, BASE_ADDRESS_MODIFY); /* Surface state base address */
 		OUT_BATCH(0 | BASE_ADDRESS_MODIFY);	/* media base addr, don't care */
 		OUT_BATCH(0 | BASE_ADDRESS_MODIFY);	/* Instruction base address */
 		/* general state max addr, disabled */
@@ -816,7 +814,7 @@ i965_emit_video_setup(ScrnInfoPtr scrn, drm_intel_bo * bind_bo, int n_src_surf)
 	} else {
 		OUT_BATCH(BRW_STATE_BASE_ADDRESS | 4);
 		OUT_BATCH(0 | BASE_ADDRESS_MODIFY);	/* Generate state base address */
-		OUT_BATCH(0 | BASE_ADDRESS_MODIFY);	/* Surface state base address */
+		OUT_RELOC(surface_state_binding_table_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, BASE_ADDRESS_MODIFY); /* Surface state base address */
 		OUT_BATCH(0 | BASE_ADDRESS_MODIFY);	/* media base addr, don't care */
 		/* general state max addr, disabled */
 		OUT_BATCH(0x10000000 | BASE_ADDRESS_MODIFY);
@@ -850,7 +848,7 @@ i965_emit_video_setup(ScrnInfoPtr scrn, drm_intel_bo * bind_bo, int n_src_surf)
 	OUT_BATCH(0);		/* clip */
 	OUT_BATCH(0);		/* sf */
 	/* Only the PS uses the binding table */
-	OUT_RELOC(bind_bo, I915_GEM_DOMAIN_SAMPLER, 0, 0);
+	OUT_BATCH((n_src_surf + 1) * ALIGN(sizeof(struct brw_surface_state), 32));
 
 	/* Blend constant color (magenta is fun) */
 	OUT_BATCH(BRW_3DSTATE_CONSTANT_COLOR | 3);
@@ -975,14 +973,14 @@ I965DisplayVideoTextured(ScrnInfoPtr scrn,
 	BoxPtr pbox;
 	int nbox, dxo, dyo, pix_xoff, pix_yoff;
 	float src_scale_x, src_scale_y;
-	int src_surf, i;
+	int src_surf;
 	int n_src_surf;
 	uint32_t src_surf_format;
 	uint32_t src_surf_base[6];
 	int src_width[6];
 	int src_height[6];
 	int src_pitch[6];
-	drm_intel_bo *bind_bo, *surf_bos[7];
+	drm_intel_bo *surface_state_binding_table_bo;
 
 #if 0
 	ErrorF("BroadwaterDisplayVideoTextured: %dx%d (pitch %d)\n", width,
@@ -1040,35 +1038,30 @@ I965DisplayVideoTextured(ScrnInfoPtr scrn,
 	 * I830PutImage.
 	 */
 
-	/* Upload kernels */
-	surf_bos[0] = i965_create_dst_surface_state(scrn, pixmap);
-	if (!surf_bos[0])
+	surface_state_binding_table_bo = 
+		drm_intel_bo_alloc(intel->bufmgr,
+				"surface state & binding table",
+				(n_src_surf + 1) * (ALIGN(sizeof(struct brw_surface_state), 32) + sizeof(uint32_t)),
+				4096);
+
+	if (!surface_state_binding_table_bo)
 		return;
+				
+	i965_create_dst_surface_state(scrn, pixmap, surface_state_binding_table_bo, 0);
 
 	for (src_surf = 0; src_surf < n_src_surf; src_surf++) {
-		drm_intel_bo *surf_bo =
-			i965_create_src_surface_state(scrn,
-						      adaptor_priv->buf,
-						      src_surf_base[src_surf],
-						      src_width[src_surf],
-						      src_height[src_surf],
-						      src_pitch[src_surf],
-						      src_surf_format);
-		if (!surf_bo) {
-			int q;
-			for (q = 0; q < src_surf + 1; q++)
-				drm_intel_bo_unreference(surf_bos[q]);
-			return;
-		}
-		surf_bos[src_surf + 1] = surf_bo;
-	}
-	bind_bo = i965_create_binding_table(scrn, surf_bos, n_src_surf + 1);
-	for (i = 0; i < n_src_surf + 1; i++) {
-		drm_intel_bo_unreference(surf_bos[i]);
-		surf_bos[i] = NULL;
+		i965_create_src_surface_state(scrn,
+					adaptor_priv->buf,
+					src_surf_base[src_surf],
+					src_width[src_surf],
+					src_height[src_surf],
+					src_pitch[src_surf],
+					src_surf_format,
+					surface_state_binding_table_bo,
+					(src_surf + 1) * ALIGN(sizeof(struct brw_surface_state), 32));
 	}
-	if (!bind_bo)
-		return;
+
+	i965_create_binding_table(scrn, surface_state_binding_table_bo, n_src_surf + 1);
 
 	if (intel->video.gen4_sampler_bo == NULL)
 		intel->video.gen4_sampler_bo = i965_create_sampler_state(scrn);
@@ -1077,7 +1070,7 @@ I965DisplayVideoTextured(ScrnInfoPtr scrn,
 		    i965_create_program(scrn, &sip_kernel_static[0][0],
 					sizeof(sip_kernel_static));
 		if (!intel->video.gen4_sip_kernel_bo) {
-			drm_intel_bo_unreference(bind_bo);
+			drm_intel_bo_unreference(surface_state_binding_table_bo);
 			return;
 		}
 	}
@@ -1085,14 +1078,14 @@ I965DisplayVideoTextured(ScrnInfoPtr scrn,
 	if (intel->video.gen4_vs_bo == NULL) {
 		intel->video.gen4_vs_bo = i965_create_vs_state(scrn);
 		if (!intel->video.gen4_vs_bo) {
-			drm_intel_bo_unreference(bind_bo);
+			drm_intel_bo_unreference(surface_state_binding_table_bo);
 			return;
 		}
 	}
 	if (intel->video.gen4_sf_bo == NULL) {
 		intel->video.gen4_sf_bo = i965_create_sf_state(scrn);
 		if (!intel->video.gen4_sf_bo) {
-			drm_intel_bo_unreference(bind_bo);
+			drm_intel_bo_unreference(surface_state_binding_table_bo);
 			return;
 		}
 	}
@@ -1101,7 +1094,7 @@ I965DisplayVideoTextured(ScrnInfoPtr scrn,
 		    i965_create_wm_state(scrn, intel->video.gen4_sampler_bo,
 					 TRUE);
 		if (!intel->video.gen4_wm_packed_bo) {
-			drm_intel_bo_unreference(bind_bo);
+			drm_intel_bo_unreference(surface_state_binding_table_bo);
 			return;
 		}
 	}
@@ -1111,7 +1104,7 @@ I965DisplayVideoTextured(ScrnInfoPtr scrn,
 		    i965_create_wm_state(scrn, intel->video.gen4_sampler_bo,
 					 FALSE);
 		if (!intel->video.gen4_wm_planar_bo) {
-			drm_intel_bo_unreference(bind_bo);
+			drm_intel_bo_unreference(surface_state_binding_table_bo);
 			return;
 		}
 	}
@@ -1119,7 +1112,7 @@ I965DisplayVideoTextured(ScrnInfoPtr scrn,
 	if (intel->video.gen4_cc_bo == NULL) {
 		intel->video.gen4_cc_bo = i965_create_cc_state(scrn);
 		if (!intel->video.gen4_cc_bo) {
-			drm_intel_bo_unreference(bind_bo);
+			drm_intel_bo_unreference(surface_state_binding_table_bo);
 			return;
 		}
 	}
@@ -1155,7 +1148,7 @@ I965DisplayVideoTextured(ScrnInfoPtr scrn,
 		drm_intel_bo *bo_table[] = {
 			NULL,	/* vb_bo */
 			intel->batch_bo,
-			bind_bo,
+			surface_state_binding_table_bo,
 			intel->video.gen4_sampler_bo,
 			intel->video.gen4_sip_kernel_bo,
 			intel->video.gen4_vs_bo,
@@ -1204,7 +1197,7 @@ I965DisplayVideoTextured(ScrnInfoPtr scrn,
 
 		intel_batch_start_atomic(scrn, 100);
 
-		i965_emit_video_setup(scrn, bind_bo, n_src_surf);
+		i965_emit_video_setup(scrn, surface_state_binding_table_bo, n_src_surf);
 
 		/* Set up the pointer to our vertex buffer */
 		OUT_BATCH(BRW_3DSTATE_VERTEX_BUFFERS | 3);
@@ -1238,7 +1231,7 @@ I965DisplayVideoTextured(ScrnInfoPtr scrn,
 	}
 
 	/* release reference once we're finished */
-	drm_intel_bo_unreference(bind_bo);
+	drm_intel_bo_unreference(surface_state_binding_table_bo);
 
 	intel_debug_flush(scrn);
 }
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 2/6 Xv: Send instruction doesn't use implied move when sampling YUV surface

In reply to Xiang, Haihao

The two fragments will be reused for sampling YUV surface and send doesn't have implied move on Sandybridge

---
 src/render_program/exa_wm_src_sample_argb.g4a      |    3 ++-
 src/render_program/exa_wm_src_sample_argb.g4b      |    3 ++-
 src/render_program/exa_wm_src_sample_argb.g4b.gen5 |    3 ++-
 src/render_program/exa_wm_src_sample_planar.g4a    |    7 ++++---
 src/render_program/exa_wm_src_sample_planar.g4b    |    7 ++++---
 .../exa_wm_src_sample_planar.g4b.gen5              |    7 ++++---
 6 files changed, 18 insertions(+), 12 deletions(-)
src/render_program/exa_wm_src_sample_argb.g4a +2 -1
index c20f53f..384fe26 100644
@@ -36,12 +36,13 @@ include(`exa_wm.g4i')
 
 /* load argb */
 mov (1) g0.8<1>UD	0x00000000UD { align1 mask_disable };
+mov (8) src_msg<1>UD g0<8,8,1>UD { align1 }; /* copy to msg start reg*/
 
 /* src_msg will be copied with g0, as it contains send desc */
 /* emit sampler 'send' cmd */
 send (16) src_msg_ind		/* msg reg index */
 	src_sample_base<1>UW 	/* readback */
-	g0<8,8,1>UW		/* copy to msg start reg*/
+	null
 	sampler (1,0,F)		/* sampler message description, (binding_table,sampler_index,datatype)
 				/* here(src->dst) we should use src_sampler and src_surface */
 	mlen 5 rlen 8 { align1 };   /* required message len 5, readback len 8 */
src/render_program/exa_wm_src_sample_argb.g4b +2 -1
index c5b9274..a15e40a 100644
@@ -1,2 +1,3 @@
    { 0x00000201, 0x20080061, 0x00000000, 0x00000000 },
-   { 0x01800031, 0x21c01d29, 0x008d0000, 0x02580001 },
+   { 0x00600001, 0x20200022, 0x008d0000, 0x00000000 },
+   { 0x01800031, 0x21c01c09, 0x00000000, 0x02580001 },
src/render_program/exa_wm_src_sample_argb.g4b.gen5 +2 -1
index f8cb41e..42039af 100644
@@ -1,2 +1,3 @@
    { 0x00000201, 0x20080061, 0x00000000, 0x00000000 },
-   { 0x01800031, 0x21c01d29, 0x208d0000, 0x0a8a0001 },
+   { 0x00600001, 0x20200022, 0x008d0000, 0x00000000 },
+   { 0x01800031, 0x21c01c09, 0x20000000, 0x0a8a0001 },
src/render_program/exa_wm_src_sample_planar.g4a +4 -3
index ad33350..5f5520b 100644
@@ -41,9 +41,10 @@ mov (1) g0.8<1>UD	0x0000e000UD { align1 mask_disable };
 /* emit sampler 'send' cmd */
 
 /* sample Y */
+mov (8) src_msg<1>UD g0<8,8,1>UD { align1 }; /* copy to msg start reg*/
 send (16) src_msg_ind		/* msg reg index */
 	src_sample_g<1>UW 	/* readback */
-	g0<8,8,1>UW		/* copy to msg start reg*/
+	null
 	sampler (1,0,F)		/* sampler message description, (binding_table,sampler_index,datatype)
 				/* here(src->dst) we should use src_sampler and src_surface */
 	mlen 5 rlen 2 { align1 };   /* required message len 5, readback len 8 */
@@ -51,7 +52,7 @@ send (16) src_msg_ind		/* msg reg index */
 /* sample U (Cr) */
 send (16) src_msg_ind		/* msg reg index */
 	src_sample_r<1>UW 	/* readback */
-	g0<8,8,1>UW		/* copy to msg start reg*/
+	null
 	sampler (3,0,F)		/* sampler message description, (binding_table,sampler_index,datatype)
 				/* here(src->dst) we should use src_sampler and src_surface */
 	mlen 5 rlen 2 { align1 };   /* required message len 5, readback len 8 */
@@ -59,7 +60,7 @@ send (16) src_msg_ind		/* msg reg index */
 /* sample V (Cb) */
 send (16) src_msg_ind		/* msg reg index */
 	src_sample_b<1>UW 	/* readback */
-	g0<8,8,1>UW		/* copy to msg start reg*/
+	null
 	sampler (5,0,F)		/* sampler message description, (binding_table,sampler_index,datatype)
 				/* here(src->dst) we should use src_sampler and src_surface */
 	mlen 5 rlen 2 { align1 };   /* required message len 5, readback len 8 */
src/render_program/exa_wm_src_sample_planar.g4b +4 -3
index 23e5e0d..c8dc47d 100644
@@ -1,4 +1,5 @@
    { 0x00000201, 0x20080061, 0x00000000, 0x0000e000 },
-   { 0x01800031, 0x22001d29, 0x008d0000, 0x02520001 },
-   { 0x01800031, 0x21c01d29, 0x008d0000, 0x02520003 },
-   { 0x01800031, 0x22401d29, 0x008d0000, 0x02520005 },
+   { 0x00600001, 0x20200022, 0x008d0000, 0x00000000 },
+   { 0x01800031, 0x22001c09, 0x00000000, 0x02520001 },
+   { 0x01800031, 0x21c01c09, 0x00000000, 0x02520003 },
+   { 0x01800031, 0x22401c09, 0x00000000, 0x02520005 },
src/render_program/exa_wm_src_sample_planar.g4b.gen5 +4 -3
index 71068d9..ce3670b 100644
@@ -1,4 +1,5 @@
    { 0x00000201, 0x20080061, 0x00000000, 0x0000e000 },
-   { 0x01800031, 0x22001d29, 0x208d0000, 0x0a2a0001 },
-   { 0x01800031, 0x21c01d29, 0x208d0000, 0x0a2a0003 },
-   { 0x01800031, 0x22401d29, 0x208d0000, 0x0a2a0005 },
+   { 0x00600001, 0x20200022, 0x008d0000, 0x00000000 },
+   { 0x01800031, 0x22001c09, 0x20000000, 0x0a2a0001 },
+   { 0x01800031, 0x21c01c09, 0x20000000, 0x0a2a0003 },
+   { 0x01800031, 0x22401c09, 0x20000000, 0x0a2a0005 },
Signature · 1 line
1.7.0.4
#3 lore raw

PATCH 3/6 Xv: fragments for xv on Sandybridge.

In reply to Xiang, Haihao

Need to update intel-gen4asm to build these fragments

---
 configure.ac                                    |    2 +-
 src/render_program/Makefile.am                  |   27 +++++++-
 src/render_program/exa_wm_src_affine.g6a        |   47 +++++++++++++
 src/render_program/exa_wm_src_affine.g6b        |    4 +
 src/render_program/exa_wm_src_sample_argb.g6a   |    1 +
 src/render_program/exa_wm_src_sample_argb.g6b   |    3 +
 src/render_program/exa_wm_src_sample_planar.g6a |    1 +
 src/render_program/exa_wm_src_sample_planar.g6b |    5 ++
 src/render_program/exa_wm_write.g6a             |   79 +++++++++++++++++++++++
 src/render_program/exa_wm_write.g6b             |   19 ++++++
 src/render_program/exa_wm_yuv_rgb.g6a           |    1 +
 src/render_program/exa_wm_yuv_rgb.g6b           |   12 ++++
 12 files changed, 197 insertions(+), 4 deletions(-)
 create mode 100644 src/render_program/exa_wm_src_affine.g6a
 create mode 100644 src/render_program/exa_wm_src_affine.g6b
 create mode 120000 src/render_program/exa_wm_src_sample_argb.g6a
 create mode 100644 src/render_program/exa_wm_src_sample_argb.g6b
 create mode 120000 src/render_program/exa_wm_src_sample_planar.g6a
 create mode 100644 src/render_program/exa_wm_src_sample_planar.g6b
 create mode 100644 src/render_program/exa_wm_write.g6a
 create mode 100644 src/render_program/exa_wm_write.g6b
 create mode 120000 src/render_program/exa_wm_yuv_rgb.g6a
 create mode 100644 src/render_program/exa_wm_yuv_rgb.g6b
configure.ac +1 -1
index e066b3d..6021dfa 100644
@@ -44,7 +44,7 @@ XORG_DEFAULT_OPTIONS
 AC_DISABLE_STATIC
 AC_PROG_LIBTOOL
 
-PKG_CHECK_MODULES(GEN4ASM, [intel-gen4asm >= 1.0], [gen4asm=yes], [gen4asm=no])
+PKG_CHECK_MODULES(GEN4ASM, [intel-gen4asm >= 1.1], [gen4asm=yes], [gen4asm=no])
 AM_CONDITIONAL(HAVE_GEN4ASM, test x$gen4asm = xyes)
 
 AH_TOP([#include "xorg-server.h"])
src/render_program/Makefile.am +24 -3
index c9a0bfc..5229ef5 100644
@@ -61,22 +61,43 @@ INTEL_G4B_GEN5 = 				\
 	exa_wm_yuv_rgb.g4b.gen5			\
 	exa_wm_xy.g4b.gen5
 
+INTEL_G6A =				\
+	exa_wm_src_affine.g6a 		\
+	exa_wm_src_sample_argb.g6a 	\
+	exa_wm_src_sample_planar.g6a 	\
+	exa_wm_write.g6a 		\
+	exa_wm_yuv_rgb.g6a
+
+INTEL_G6B =				\
+	exa_wm_src_affine.g6b 		\
+	exa_wm_src_sample_argb.g6b 	\
+	exa_wm_src_sample_planar.g6b 	\
+	exa_wm_write.g6b 		\
+	exa_wm_yuv_rgb.g6b
+
 EXTRA_DIST = 		\
 	$(INTEL_G4A)	\
 	$(INTEL_G4I)	\
 	$(INTEL_G4B)	\
-	$(INTEL_G4B_GEN5)
+	$(INTEL_G4B_GEN5)\
+	$(INTEL_G6A)	\
+	$(INTEL_G6B)
 
 if HAVE_GEN4ASM
 
-SUFFIXES = .g4a .g4b
+SUFFIXES = .g4a .g4b .g6a .g6b
 .g4a.g4b:
 	m4 -I$(srcdir) -s $< > $*.g4m && intel-gen4asm -o $@ $*.g4m && intel-gen4asm -g 5 -o [email protected] $*.g4m && rm $*.g4m
 
+.g6a.g6b:
+	m4 -I$(srcdir) -s $< > $*.g6m && intel-gen4asm -g 6 -o $@ $*.g6m && rm $*.g6m
+
 $(INTEL_G4B): $(INTEL_G4I)
+$(INTEL_G6B): $(INTEL_G4I)
 
-BUILT_SOURCES= $(INTEL_G4B)
+BUILT_SOURCES= $(INTEL_G4B) $(INTEL_G6B)
 
 clean-local:
 	-rm -f $(INTEL_G4B) $(INTEL_G4B_GEN5)
+	-rm -f $(INTEL_G6B)
 endif
src/render_program/exa_wm_src_affine.g6a new file +47 -0

47 lines not on this page · raw message

src/render_program/exa_wm_src_affine.g6b new file +4 -0
new file mode 100644
index 0000000..7035e6a
@@ -0,0 +1,4 @@
+   { 0x0060005a, 0x204077be, 0x000000c0, 0x008d0040 },
+   { 0x0060005a, 0x206077be, 0x000000c0, 0x008d0080 },
+   { 0x0060005a, 0x208077be, 0x000000d0, 0x008d0040 },
+   { 0x0060005a, 0x20a077be, 0x000000d0, 0x008d0080 },
src/render_program/exa_wm_src_sample_argb.g6a new file +1 -0
new file mode 120000
index 0000000..2684089
@@ -0,0 +1 @@
+exa_wm_src_sample_argb.g4a
\ No newline at end of file
src/render_program/exa_wm_src_sample_argb.g6b new file +3 -0
new file mode 100644
index 0000000..8bfe849
@@ -0,0 +1,3 @@
+   { 0x00000201, 0x20080061, 0x00000000, 0x00000000 },
+   { 0x00600001, 0x20200022, 0x008d0000, 0x00000000 },
+   { 0x02800031, 0x21c01cc9, 0x00000020, 0x0a8a0001 },
src/render_program/exa_wm_src_sample_planar.g6a new file +1 -0
new file mode 120000
index 0000000..d4e34a1
@@ -0,0 +1 @@
+exa_wm_src_sample_planar.g4a
\ No newline at end of file
src/render_program/exa_wm_src_sample_planar.g6b new file +5 -0
new file mode 100644
index 0000000..0a22827
@@ -0,0 +1,5 @@
+   { 0x00000201, 0x20080061, 0x00000000, 0x0000e000 },
+   { 0x00600001, 0x20200022, 0x008d0000, 0x00000000 },
+   { 0x02800031, 0x22001cc9, 0x00000020, 0x0a2a0001 },
+   { 0x02800031, 0x21c01cc9, 0x00000020, 0x0a2a0003 },
+   { 0x02800031, 0x22401cc9, 0x00000020, 0x0a2a0005 },
src/render_program/exa_wm_write.g6a new file +79 -0

79 lines not on this page · raw message

src/render_program/exa_wm_write.g6b new file +19 -0
new file mode 100644
index 0000000..9db2129
@@ -0,0 +1,19 @@
+   { 0x00600001, 0x204003be, 0x008d01c0, 0x00000000 },
+   { 0x00600001, 0x206003be, 0x008d01e0, 0x00000000 },
+   { 0x00600001, 0x208003be, 0x008d0200, 0x00000000 },
+   { 0x00600001, 0x20a003be, 0x008d0220, 0x00000000 },
+   { 0x00600001, 0x20c003be, 0x008d0240, 0x00000000 },
+   { 0x00600001, 0x20e003be, 0x008d0260, 0x00000000 },
+   { 0x00600001, 0x210003be, 0x008d0280, 0x00000000 },
+   { 0x00600001, 0x212003be, 0x008d02a0, 0x00000000 },
+   { 0x00600001, 0x20000022, 0x008d0000, 0x00000000 },
+   { 0x00600001, 0x20200022, 0x008d0020, 0x00000000 },
+   { 0x05800031, 0x24001cc8, 0x00000000, 0x94099000 },
+   { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
+   { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
+   { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
+   { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
+   { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
+   { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
+   { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
+   { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
src/render_program/exa_wm_yuv_rgb.g6a new file +1 -0
new file mode 120000
index 0000000..d34d246
@@ -0,0 +1 @@
+exa_wm_yuv_rgb.g4a
\ No newline at end of file
src/render_program/exa_wm_yuv_rgb.g6b new file +12 -0
new file mode 100644
index 0000000..01ec5e5
@@ -0,0 +1,12 @@
+   { 0x00800040, 0x23007fbd, 0x008d0200, 0xbd808081 },
+   { 0x00800041, 0x23007fbd, 0x008d0300, 0x3f94fdf4 },
+   { 0x00800040, 0x22c07fbd, 0x008d01c0, 0xbf008084 },
+   { 0x00800040, 0x23407fbd, 0x008d0240, 0xbf008084 },
+   { 0x00800001, 0x240003bc, 0x008d0300, 0x00000000 },
+   { 0x80800048, 0x21c07fbd, 0x008d02c0, 0x3fcc49ba },
+   { 0x00800001, 0x240003bc, 0x008d0300, 0x00000000 },
+   { 0x00800048, 0x24007fbc, 0x008d02c0, 0xbf5020c5 },
+   { 0x80800048, 0x22007fbd, 0x008d0340, 0xbec8b439 },
+   { 0x00800001, 0x240003bc, 0x008d0300, 0x00000000 },
+   { 0x80800048, 0x22407fbd, 0x008d0340, 0x40011687 },
+   { 0x00800001, 0x228003fd, 0x00000000, 0x3f800000 },
Signature · 1 line
1.7.0.4

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

#4 lore raw

PATCH 4/6 Xv: setup pipeline for Xv on Sandybridge

In reply to Xiang, Haihao
---
 src/brw_structs.h       |  100 ++++++++
 src/i965_reg.h          |   98 ++++++++
 src/i965_video.c        |  624 +++++++++++++++++++++++++++++++++++++++++++++++
 src/intel.h             |    4 +
 src/intel_batchbuffer.c |   25 ++-
 src/intel_video.h       |    7 +
 6 files changed, 852 insertions(+), 6 deletions(-)
src/brw_structs.h +100 -0
index 1cee5bd..d089ba1 100644
@@ -1487,4 +1487,104 @@ struct brw_interface_descriptor {
     } desc3;
 };
 
+struct gen6_blend_state
+{
+	struct {
+		unsigned int dest_blend_factor:5;
+		unsigned int source_blend_factor:5;
+		unsigned int pad3:1;
+		unsigned int blend_func:3;
+		unsigned int pad2:1;
+		unsigned int ia_dest_blend_factor:5;
+		unsigned int ia_source_blend_factor:5;
+		unsigned int pad1:1;
+		unsigned int ia_blend_func:3;
+		unsigned int pad0:1;
+		unsigned int ia_blend_enable:1;
+		unsigned int blend_enable:1;
+	} blend0;
+
+	struct {
+		unsigned int post_blend_clamp_enable:1;
+		unsigned int pre_blend_clamp_enable:1;
+		unsigned int clamp_range:2;
+		unsigned int pad0:4;
+		unsigned int x_dither_offset:2;
+		unsigned int y_dither_offset:2;
+		unsigned int dither_enable:1;
+		unsigned int alpha_test_func:3;
+		unsigned int alpha_test_enable:1;
+		unsigned int pad1:1;
+		unsigned int logic_op_func:4;
+		unsigned int logic_op_enable:1;
+		unsigned int pad2:1;
+		unsigned int write_disable_b:1;
+		unsigned int write_disable_g:1;
+		unsigned int write_disable_r:1;
+		unsigned int write_disable_a:1;
+		unsigned int pad3:1;
+		unsigned int alpha_to_coverage_dither:1;
+		unsigned int alpha_to_one:1;
+		unsigned int alpha_to_coverage:1;
+	} blend1;
+};
+
+struct gen6_color_calc_state
+{
+	struct {
+		unsigned int alpha_test_format:1;
+		unsigned int pad0:14;
+		unsigned int round_disable:1;
+		unsigned int bf_stencil_ref:8;
+		unsigned int stencil_ref:8;
+	} cc0;
+
+	union {
+		float alpha_ref_f;
+		struct {
+			unsigned int ui:8;
+			unsigned int pad0:24;
+		} alpha_ref_fi;
+	} cc1;
+
+	float constant_r;
+	float constant_g;
+	float constant_b;
+	float constant_a;
+};
+
+struct gen6_depth_stencil_state
+{
+	struct {
+		unsigned int pad0:3;
+		unsigned int bf_stencil_pass_depth_pass_op:3;
+		unsigned int bf_stencil_pass_depth_fail_op:3;
+		unsigned int bf_stencil_fail_op:3;
+		unsigned int bf_stencil_func:3;
+		unsigned int bf_stencil_enable:1;
+		unsigned int pad1:2;
+		unsigned int stencil_write_enable:1;
+		unsigned int stencil_pass_depth_pass_op:3;
+		unsigned int stencil_pass_depth_fail_op:3;
+		unsigned int stencil_fail_op:3;
+		unsigned int stencil_func:3;
+		unsigned int stencil_enable:1;
+	} ds0;
+
+	struct {
+		unsigned int bf_stencil_write_mask:8;
+		unsigned int bf_stencil_test_mask:8;
+		unsigned int stencil_write_mask:8;
+		unsigned int stencil_test_mask:8;
+	} ds1;
+
+	struct {
+		unsigned int pad0:26;
+		unsigned int depth_write_enable:1;
+		unsigned int depth_test_func:3;
+		unsigned int pad1:1;
+		unsigned int depth_test_enable:1;
+	} ds2;
+};
+
 #endif
src/i965_reg.h +98 -0

132 lines not on this page · raw message

src/i965_video.c +624 -0

634 lines not on this page · raw message

src/intel.h +4 -0
index 6b05997..c748a41 100644
@@ -369,6 +369,10 @@ typedef struct intel_screen_private {
 		drm_intel_bo *gen4_cc_vp_bo;
 		drm_intel_bo *gen4_sampler_bo;
 		drm_intel_bo *gen4_sip_kernel_bo;
+		drm_intel_bo *wm_prog_packed_bo;
+		drm_intel_bo *wm_prog_planar_bo;
+		drm_intel_bo *gen6_blend_bo;
+		drm_intel_bo *gen6_depth_stencil_bo;
 	} video;
 
 	/* Render accel state */
src/intel_batchbuffer.c +19 -6
index e7ca69d..01cb193 100644
@@ -38,6 +38,7 @@
 #include "intel.h"
 #include "i830_reg.h"
 #include "i915_drm.h"
+#include "i965_reg.h"
 
 #define DUMP_BATCHBUFFERS NULL /* "/tmp/i915-batchbuffers.dump" */
 
@@ -146,14 +147,26 @@ 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)
+	if ((INTEL_INFO(intel)->gen >= 60)) {
+	    BEGIN_BATCH(4);
+	    OUT_BATCH(BRW_PIPE_CONTROL | (4 - 2));
+	    OUT_BATCH(BRW_PIPE_CONTROL_IS_FLUSH |
+		    BRW_PIPE_CONTROL_WC_FLUSH |
+		    BRW_PIPE_CONTROL_DEPTH_CACHE_FLUSH |
+		    BRW_PIPE_CONTROL_NOWRITE);
+	    OUT_BATCH(0); /* write address */
+	    OUT_BATCH(0); /* write data */
+	    ADVANCE_BATCH();
+	} else {
+	    /* 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();
+	    BEGIN_BATCH(1);
+	    OUT_BATCH(MI_FLUSH | flags);
+	    ADVANCE_BATCH();
+	}
 
 	intel_batch_do_flush(scrn);
 }
src/intel_video.h +7 -0
index 5920d30..f405d40 100644
@@ -81,6 +81,13 @@ void I965DisplayVideoTextured(ScrnInfoPtr scrn,
 			      short src_w, short src_h,
 			      short drw_w, short drw_h, PixmapPtr pixmap);
 
+void Gen6DisplayVideoTextured(ScrnInfoPtr scrn,
+			      intel_adaptor_private *adaptor_priv,
+			      int id, RegionPtr dstRegion, short width,
+			      short height, int video_pitch, int video_pitch2,
+			      short src_w, short src_h,
+			      short drw_w, short drw_h, PixmapPtr pixmap);
+
 void i965_free_video(ScrnInfoPtr scrn);
 
 int is_planar_fourcc(int id);
Signature · 1 line
1.7.0.4
#5 lore raw

PATCH 5/6 Xv: enable TextureAdaptor for Sandybridge

In reply to Xiang, Haihao
---
 src/intel_video.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
src/intel_video.c +6 -2
index 5d16778..afc2405 100644
@@ -364,7 +364,6 @@ void I830InitVideo(ScreenPtr screen)
 	 */
 	if (scrn->bitsPerPixel >= 16 &&
 	    INTEL_INFO(intel)->gen >= 30 &&
-	    INTEL_INFO(intel)->gen < 60 &&
 	    !intel->use_shadow) {
 		texturedAdaptor = I830SetupImageVideoTextured(screen);
 		if (texturedAdaptor != NULL) {
@@ -1583,7 +1582,12 @@ I830PutImageTextured(ScrnInfoPtr scrn,
 		intel_wait_for_scanline(scrn, pixmap, crtc, clipBoxes);
 	}
 
-	if (INTEL_INFO(intel)->gen >= 40) {
+	if (INTEL_INFO(intel)->gen >= 60) {
+		Gen6DisplayVideoTextured(scrn, adaptor_priv, id, clipBoxes,
+					 width, height, dstPitch, dstPitch2,
+					 src_w, src_h,
+					 drw_w, drw_h, pixmap);
+	} else if (INTEL_INFO(intel)->gen >= 40) {
 		I965DisplayVideoTextured(scrn, adaptor_priv, id, clipBoxes,
 					 width, height, dstPitch, dstPitch2,
 					 src_w, src_h,
Signature · 1 line
1.7.0.4
#6 lore raw

PATCH 6/6 Xv: don't call intel_wait_for_scanline on Sandybridge

In reply to Xiang, Haihao

MI_LOAD_SCAN_LINE_INCL command is not available on sandybridge.

---
 src/intel_video.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
src/intel_video.c +1 -1
index afc2405..cdff149 100644
@@ -1578,7 +1578,7 @@ I830PutImageTextured(ScrnInfoPtr scrn,
 			return BadAlloc;
 	}
 
-	if (crtc && adaptor_priv->SyncToVblank != 0) {
+	if (crtc && adaptor_priv->SyncToVblank != 0 && INTEL_INFO(intel)->gen < 60) {
 		intel_wait_for_scanline(scrn, pixmap, crtc, clipBoxes);
 	}
 
Signature · 1 line
1.7.0.4
#7 lore raw
In reply to Xiang, Haihao
Quoted 3 lines · Haihao

Here is the set of patches to enable texture adaptor on Sandybridge. Currently you need to turn off shadow in /etc/xorg.conf to use texture video on Sandybridge

So the remaining issue is mixing the TexturedAdaptor with shadow, which requires some similar trickery as dri2 in order to render directly to the front-buffer?

Or perhaps a better pixmap migration to supersede shadow, which is coming along but a much larger task. So back to the hacks for the short term. -Chris

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

Here is the set of patches to enable texture adaptor on Sandybridge. Currently you need to turn off shadow in /etc/xorg.conf to use texture video on Sandybridge

So the remaining issue is mixing the TexturedAdaptor with shadow, which requires some similar trickery as dri2 in order to render directly to the front-buffer?

Currently we are adding support for 2D HW acceleration (BLT + composite) on Sandybridge. Once it is done, we can disable shadow by default on Sandybridge.

As for TexturedAdaptor+shadow, we may add support for it if we have time.

Thanks
Haihao

Quoted 4 lines

Or perhaps a better pixmap migration to supersede shadow, which is coming along but a much larger task. So back to the hacks for the short term. -Chris