[Intel-gfx] [PATCH 02/18] XvMC: kill dead code in i915_xvmc.c

Daniel Vetter daniel.vetter at ffwll.ch
Tue Mar 2 21:53:12 CET 2010


WIP code that hasn't changed for over two years is unlikely to
suddenly start progressing. Drop it. After all, git can easily
resurect it in cases it's needed.

Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 src/xvmc/i915_xvmc.c | 1032 --------------------------------------------------
 1 files changed, 0 insertions(+), 1032 deletions(-)

diff --git a/src/xvmc/i915_xvmc.c b/src/xvmc/i915_xvmc.c
index 84bdaf2..8063c5a 100644
--- a/src/xvmc/i915_xvmc.c
+++ b/src/xvmc/i915_xvmc.c
@@ -43,44 +43,6 @@ typedef union {
 	int32_t v;
 } vector_t;
 
-#if 0
-static int findOverlap(unsigned int width, unsigned int height,
-		       short *dstX, short *dstY,
-		       short *srcX, short *srcY,
-		       unsigned short *areaW, unsigned short *areaH)
-{
-	int w, h;
-	unsigned int mWidth, mHeight;
-
-	w = *areaW;
-	h = *areaH;
-
-	if ((*dstX >= width) || (*dstY >= height))
-		return 1;
-
-	if (*dstX < 0) {
-		w += *dstX;
-		*srcX -= *dstX;
-		*dstX = 0;
-	}
-
-	if (*dstY < 0) {
-		h += *dstY;
-		*srcY -= *dstY;
-		*dstY = 0;
-	}
-
-	if ((w <= 0) || ((h <= 0)))
-		return 1;
-
-	mWidth = width - *dstX;
-	mHeight = height - *dstY;
-	*areaW = (w <= mWidth) ? w : mWidth;
-	*areaH = (h <= mHeight) ? h : mHeight;
-	return 0;
-}
-#endif
-
 static void i915_inst_arith(unsigned int *inst,
 			    unsigned int op,
 			    unsigned int dest,
@@ -841,38 +803,6 @@ static void i915_mc_mpeg_macroblock_ipicture(XvMCContext * context,
 			     0);
 }
 
-#if 0
-static void i915_mc_mpeg_macroblock_0mv(XvMCContext * context,
-					XvMCMacroBlock * mb)
-{
-	struct i915_3dmpeg_macroblock_0mv macroblock_0mv;
-
-	/* 3DMPEG_MACROBLOCK(0mv) */
-	memset(&macroblock_0mv, 0, sizeof(macroblock_0mv));
-	macroblock_0mv.header.dw0.type = CMD_3D;
-	macroblock_0mv.header.dw0.opcode = OPC_3DMPEG_MACROBLOCK;
-	macroblock_0mv.header.dw0.length = 0;
-	macroblock_0mv.header.dw1.mb_intra = 1;	/* should be 1 */
-	macroblock_0mv.header.dw1.forward = 0;	/* should be 0 */
-	macroblock_0mv.header.dw1.backward = 0;	/* should be 0 */
-	macroblock_0mv.header.dw1.h263_4mv = 0;	/* should be 0 */
-	macroblock_0mv.header.dw1.dct_type =
-	    (mb->dct_type == XVMC_DCT_TYPE_FIELD);
-
-/*
-    if (!mb->coded_block_pattern)
-        macroblock_0mv.header.dw1.dct_type = XVMC_DCT_TYPE_FRAME;
-*/
-
-	macroblock_0mv.header.dw1.motion_type = 0;	// (mb->motion_type & 0x3);
-	macroblock_0mv.header.dw1.vertical_field_select = 0;	// mb->motion_vertical_field_select & 0xf;
-	macroblock_0mv.header.dw1.coded_block_pattern = mb->coded_block_pattern;
-	macroblock_0mv.header.dw1.skipped_macroblocks = 0;
-
-	intelBatchbufferData(&macroblock_0mv, sizeof(macroblock_0mv), 0);
-}
-#endif
-
 static void i915_mc_mpeg_macroblock_1fbmv(XvMCContext * context,
 					  XvMCMacroBlock * mb)
 {
@@ -976,117 +906,6 @@ static void i915_mc_mpeg_macroblock_2fbmv(XvMCContext * context,
 	intelBatchbufferData(&macroblock_2fbmv, sizeof(macroblock_2fbmv), 0);
 }
 
-#if 0
-static void i915_mc_invalidate_subcontext_buffers(XvMCContext * context,
-						  unsigned int mask)
-{
-	struct i915_3dstate_load_indirect *load_indirect = NULL;
-	sis_state *sis = NULL;
-	dis_state *dis = NULL;
-	ssb_state *ssb = NULL;
-	msb_state *msb = NULL;
-	psp_state *psp = NULL;
-	psc_state *psc = NULL;
-	i915XvMCContext *pI915XvMC = (i915XvMCContext *) context->privData;
-	unsigned int size;
-	void *base = NULL, *ptr = NULL;
-
-	size = sizeof(*load_indirect);
-	if (mask & BLOCK_SIS)
-		size += sizeof(*sis);
-	if (mask & BLOCK_DIS)
-		size += sizeof(*dis);
-	if (mask & BLOCK_SSB)
-		size += sizeof(*ssb);
-	if (mask & BLOCK_MSB)
-		size += sizeof(*msb);
-	if (mask & BLOCK_PSP)
-		size += sizeof(*psp);
-	if (mask & BLOCK_PSC)
-		size += sizeof(*psc);
-
-	if (size == sizeof(*load_indirect)) {
-		XVMC_ERR("There must be at least one bit set\n");
-		return;
-	}
-
-	/* 3DSTATE_LOAD_INDIRECT */
-	base = calloc(1, size);
-	load_indirect = (struct i915_3dstate_load_indirect *)base;
-	load_indirect->dw0.type = CMD_3D;
-	load_indirect->dw0.opcode = OPC_3DSTATE_LOAD_INDIRECT;
-
-	if (pI915XvMC->deviceID == PCI_CHIP_I915_G ||
-	    pI915XvMC->deviceID == PCI_CHIP_I915_GM ||
-	    pI915XvMC->deviceID == PCI_CHIP_I945_G ||
-	    pI915XvMC->deviceID == PCI_CHIP_I945_GM)
-		load_indirect->dw0.mem_select = 0;
-	else
-		load_indirect->dw0.mem_select = 1;
-
-	load_indirect->dw0.block_mask = mask;
-	load_indirect->dw0.length = (size >> 2) - 2;
-	ptr = ++load_indirect;
-
-	/* SIS */
-	if (mask & BLOCK_SIS) {
-		sis = (sis_state *) ptr;
-		sis->dw0.valid = 0;
-		sis->dw0.buffer_address = 0;
-		sis->dw1.length = 0;
-		ptr = ++sis;
-	}
-
-	/* DIS */
-	if (mask & BLOCK_DIS) {
-		dis = (dis_state *) ptr;
-		dis->dw0.valid = 0;
-		dis->dw0.reset = 0;
-		dis->dw0.buffer_address = 0;
-		ptr = ++dis;
-	}
-
-	/* SSB */
-	if (mask & BLOCK_SSB) {
-		ssb = (ssb_state *) ptr;
-		ssb->dw0.valid = 0;
-		ssb->dw0.buffer_address = 0;
-		ssb->dw1.length = 0;
-		ptr = ++ssb;
-	}
-
-	/* MSB */
-	if (mask & BLOCK_MSB) {
-		msb = (msb_state *) ptr;
-		msb->dw0.valid = 0;
-		msb->dw0.buffer_address = 0;
-		msb->dw1.length = 0;
-		ptr = ++msb;
-	}
-
-	/* PSP */
-	if (mask & BLOCK_PSP) {
-		psp = (psp_state *) ptr;
-		psp->dw0.valid = 0;
-		psp->dw0.buffer_address = 0;
-		psp->dw1.length = 0;
-		ptr = ++psp;
-	}
-
-	/* PSC */
-	if (mask & BLOCK_PSC) {
-		psc = (psc_state *) ptr;
-		psc->dw0.valid = 0;
-		psc->dw0.buffer_address = 0;
-		psc->dw1.length = 0;
-		ptr = ++psc;
-	}
-
-	intelBatchbufferData(base, size, 0);
-	free(base);
-}
-#endif
-
 static int i915_xvmc_map_buffers(i915XvMCContext * pI915XvMC)
 {
 	if (drmMap(xvmc_driver->fd,
@@ -1167,444 +986,6 @@ static void i915_xvmc_unmap_buffers(i915XvMCContext * pI915XvMC)
 	}
 }
 
-#if 0
-/*
- * Video post processing
- */
-static void i915_yuv2rgb_map_state_buffer(XvMCSurface * target_surface)
-{
-	struct i915_3dstate_map_state *map_state;
-	struct texture_map *tm;
-	i915XvMCSurface *privTarget = NULL;
-	i915XvMCContext *pI915XvMC = NULL;
-	unsigned int w = target_surface->width, h = target_surface->height;
-
-	privTarget = (i915XvMCSurface *) target_surface->privData;
-	pI915XvMC = (i915XvMCContext *) privTarget->privContext;
-	/* 3DSATE_MAP_STATE */
-	map_state = (struct i915_3dstate_map_state *)pI915XvMC->msb.map;
-	memset(map_state, 0, sizeof(*map_state));
-	map_state->dw0.type = CMD_3D;
-	map_state->dw0.opcode = OPC_3DSTATE_MAP_STATE;
-	map_state->dw0.retain = 0;
-	map_state->dw0.length = 9;
-	map_state->dw1.map_mask = MAP_MAP0 | MAP_MAP1 | MAP_MAP2;
-
-	/* texture map 0: V Plane */
-	tm = (struct texture_map *)(++map_state);
-	memset(tm, 0, sizeof(*tm));
-	tm->tm0.v_ls_offset = 0;
-	tm->tm0.v_ls = 0;
-	tm->tm0.base_address = VOFFSET(privTarget);
-	tm->tm1.tile_walk = TILEWALK_XMAJOR;
-	tm->tm1.tiled_surface = 0;
-	tm->tm1.utilize_fence_regs = 1;
-	tm->tm1.texel_fmt = 0;
-	tm->tm1.surface_fmt = 1;
-	tm->tm1.width = (w >> 1) - 1;
-	tm->tm1.height = (h >> 1) - 1;
-	tm->tm2.depth = 0;
-	tm->tm2.max_lod = 0;
-	tm->tm2.cube_face = 0;
-	tm->tm2.pitch = (privTarget->uvStride >> 2) - 1;	/* in DWords - 1 */
-
-	/* texture map 1: Y Plane */
-	++tm;
-	memset(tm, 0, sizeof(*tm));
-	tm->tm0.v_ls_offset = 0;
-	tm->tm0.v_ls = 0;
-	tm->tm0.base_address = YOFFSET(privTarget);
-	tm->tm1.tile_walk = TILEWALK_XMAJOR;
-	tm->tm1.tiled_surface = 0;
-	tm->tm1.utilize_fence_regs = 1;
-	tm->tm1.texel_fmt = 0;
-	tm->tm1.surface_fmt = 1;
-	tm->tm1.width = w - 1;
-	tm->tm1.height = h - 1;
-	tm->tm2.depth = 0;
-	tm->tm2.max_lod = 0;
-	tm->tm2.cube_face = 0;
-	tm->tm2.pitch = (privTarget->yStride >> 2) - 1;	/* in DWords - 1 */
-
-	/* texture map 2: U Plane */
-	++tm;
-	memset(tm, 0, sizeof(*tm));
-	tm->tm0.v_ls_offset = 0;
-	tm->tm0.v_ls = 0;
-	tm->tm0.base_address = UOFFSET(privTarget);
-	tm->tm1.tile_walk = TILEWALK_XMAJOR;
-	tm->tm1.tiled_surface = 0;
-	tm->tm1.utilize_fence_regs = 1;
-	tm->tm1.texel_fmt = 0;
-	tm->tm1.surface_fmt = 1;
-	tm->tm1.width = (w >> 1) - 1;
-	tm->tm1.height = (h >> 1) - 1;
-	tm->tm2.depth = 0;
-	tm->tm2.max_lod = 0;
-	tm->tm2.cube_face = 0;
-	tm->tm2.pitch = (privTarget->uvStride >> 2) - 1;	/* in DWords - 1 */
-}
-#endif
-
-#if 0
-static void i915_yuv2rgb_sampler_state_buffer(XvMCSurface * surface)
-{
-	struct i915_3dstate_sampler_state *sampler_state;
-	struct texture_sampler *ts;
-	i915XvMCSurface *privSurface = (i915XvMCSurface *) surface->privData;
-	i915XvMCContext *pI915XvMC =
-	    (i915XvMCContext *) privSurface->privContext;
-
-	/* 3DSATE_SAMPLER_STATE */
-	sampler_state = (struct i915_3dstate_sampler_state *)pI915XvMC->ssb.map;
-	memset(sampler_state, 0, sizeof(*sampler_state));
-	sampler_state->dw0.type = CMD_3D;
-	sampler_state->dw0.opcode = OPC_3DSTATE_SAMPLER_STATE;
-	sampler_state->dw0.length = 9;
-	sampler_state->dw1.sampler_masker =
-	    SAMPLER_SAMPLER0 | SAMPLER_SAMPLER1 | SAMPLER_SAMPLER2;
-
-	/* Sampler 0 */
-	ts = (struct texture_sampler *)(++sampler_state);
-	memset(ts, 0, sizeof(*ts));
-	ts->ts0.reverse_gamma = 0;
-	ts->ts0.planar2packet = 1;
-	ts->ts0.color_conversion = 1;
-	ts->ts0.chromakey_index = 0;
-	ts->ts0.base_level = 0;
-	ts->ts0.mip_filter = MIPFILTER_NONE;	/* NONE */
-	ts->ts0.mag_filter = MAPFILTER_LINEAR;	/* LINEAR */
-	ts->ts0.min_filter = MAPFILTER_LINEAR;	/* LINEAR */
-	ts->ts0.lod_bias = 0;
-	ts->ts0.shadow_enable = 0;
-	ts->ts0.max_anisotropy = ANISORATIO_2;
-	ts->ts0.shadow_function = PREFILTEROP_ALWAYS;
-	ts->ts1.min_lod = 0;	/* Maximum Mip Level */
-	ts->ts1.kill_pixel = 0;
-	ts->ts1.keyed_texture_filter = 0;
-	ts->ts1.chromakey_enable = 0;
-	ts->ts1.tcx_control = TEXCOORDMODE_CLAMP;
-	ts->ts1.tcy_control = TEXCOORDMODE_CLAMP;
-	ts->ts1.tcz_control = TEXCOORDMODE_CLAMP;
-	ts->ts1.normalized_coor = 0;
-	ts->ts1.map_index = 0;
-	ts->ts1.east_deinterlacer = 0;
-	ts->ts2.default_color = 0;
-
-	/* Sampler 1 */
-	++ts;
-	memset(ts, 0, sizeof(*ts));
-	ts->ts0.reverse_gamma = 0;
-	ts->ts0.planar2packet = 1;
-	ts->ts0.color_conversion = 1;
-	ts->ts0.chromakey_index = 0;
-	ts->ts0.base_level = 0;
-	ts->ts0.mip_filter = MIPFILTER_NONE;	/* NONE */
-	ts->ts0.mag_filter = MAPFILTER_LINEAR;	/* LINEAR */
-	ts->ts0.min_filter = MAPFILTER_LINEAR;	/* LINEAR */
-	ts->ts0.lod_bias = 0;
-	ts->ts0.shadow_enable = 0;
-	ts->ts0.max_anisotropy = ANISORATIO_2;
-	ts->ts0.shadow_function = PREFILTEROP_ALWAYS;
-	ts->ts1.min_lod = 0;	/* Maximum Mip Level */
-	ts->ts1.kill_pixel = 0;
-	ts->ts1.keyed_texture_filter = 0;
-	ts->ts1.chromakey_enable = 0;
-	ts->ts1.tcx_control = TEXCOORDMODE_CLAMP;
-	ts->ts1.tcy_control = TEXCOORDMODE_CLAMP;
-	ts->ts1.tcz_control = TEXCOORDMODE_CLAMP;
-	ts->ts1.normalized_coor = 0;
-	ts->ts1.map_index = 1;
-	ts->ts1.east_deinterlacer = 0;
-	ts->ts2.default_color = 0;
-
-	/* Sampler 2 */
-	++ts;
-	memset(ts, 0, sizeof(*ts));
-	ts->ts0.reverse_gamma = 0;
-	ts->ts0.planar2packet = 1;
-	ts->ts0.color_conversion = 1;
-	ts->ts0.chromakey_index = 0;
-	ts->ts0.base_level = 0;
-	ts->ts0.mip_filter = MIPFILTER_NONE;	/* NONE */
-	ts->ts0.mag_filter = MAPFILTER_LINEAR;	/* LINEAR */
-	ts->ts0.min_filter = MAPFILTER_LINEAR;	/* LINEAR */
-	ts->ts0.lod_bias = 0;
-	ts->ts0.shadow_enable = 0;
-	ts->ts0.max_anisotropy = ANISORATIO_2;
-	ts->ts0.shadow_function = PREFILTEROP_ALWAYS;
-	ts->ts1.min_lod = 0;	/* Maximum Mip Level */
-	ts->ts1.kill_pixel = 0;
-	ts->ts1.keyed_texture_filter = 0;
-	ts->ts1.chromakey_enable = 0;
-	ts->ts1.tcx_control = TEXCOORDMODE_CLAMP;
-	ts->ts1.tcy_control = TEXCOORDMODE_CLAMP;
-	ts->ts1.tcz_control = TEXCOORDMODE_CLAMP;
-	ts->ts1.normalized_coor = 0;
-	ts->ts1.map_index = 2;
-	ts->ts1.east_deinterlacer = 0;
-	ts->ts2.default_color = 0;
-}
-#endif
-
-#if 0
-static void i915_yuv2rgb_static_indirect_state_buffer(XvMCSurface * surface,
-						      unsigned int dstaddr,
-						      int dstpitch)
-{
-	struct i915_3dstate_buffer_info *buffer_info;
-	struct i915_3dstate_dest_buffer_variables *dest_buffer_variables;
-	i915XvMCSurface *privSurface = (i915XvMCSurface *) surface->privData;
-	i915XvMCContext *pI915XvMC =
-	    (i915XvMCContext *) privSurface->privContext;
-
-	/* 3DSTATE_BUFFER_INFO */
-	buffer_info = (struct i915_3dstate_buffer_info *)pI915XvMC->sis.map;
-	memset(buffer_info, 0, sizeof(*buffer_info));
-	buffer_info->dw0.type = CMD_3D;
-	buffer_info->dw0.opcode = OPC_3DSTATE_BUFFER_INFO;
-	buffer_info->dw0.length = 1;
-	buffer_info->dw1.aux_id = 0;
-	buffer_info->dw1.buffer_id = BUFFERID_COLOR_BACK;
-	buffer_info->dw1.fence_regs = 1;
-	buffer_info->dw1.tiled_surface = 0;	/* linear */
-	buffer_info->dw1.walk = TILEWALK_XMAJOR;
-	buffer_info->dw1.pitch = dstpitch;
-	buffer_info->dw2.base_address = dstaddr;
-
-	/* 3DSTATE_DEST_BUFFER_VARIABLES */
-	dest_buffer_variables =
-	    (struct i915_3dstate_dest_buffer_variables *)(++buffer_info);
-	memset(dest_buffer_variables, 0, sizeof(*dest_buffer_variables));
-	dest_buffer_variables->dw0.type = CMD_3D;
-	dest_buffer_variables->dw0.opcode = OPC_3DSTATE_DEST_BUFFER_VARIABLES;
-	dest_buffer_variables->dw0.length = 0;
-	dest_buffer_variables->dw1.dest_v_bias = 8;	/* FIXME 0x1000 .5 ??? */
-	dest_buffer_variables->dw1.dest_h_bias = 8;
-	dest_buffer_variables->dw1.color_fmt = COLORBUFFER_A8R8G8B8;	/* FIXME */
-}
-#endif
-
-#if 0
-static void i915_yuv2rgb_pixel_shader_program_buffer(XvMCSurface * surface)
-{
-	struct i915_3dstate_pixel_shader_program *pixel_shader_program;
-	i915XvMCSurface *privSurface = (i915XvMCSurface *) surface->privData;
-	i915XvMCContext *pI915XvMC =
-	    (i915XvMCContext *) privSurface->privContext;
-	unsigned int *inst;
-	unsigned int dest, src0, src1;
-
-	/* Shader 0 */
-	pixel_shader_program =
-	    (struct i915_3dstate_pixel_shader_program *)pI915XvMC->psp.map;
-	memset(pixel_shader_program, 0, sizeof(*pixel_shader_program));
-	pixel_shader_program->dw0.type = CMD_3D;
-	pixel_shader_program->dw0.opcode = OPC_3DSTATE_PIXEL_SHADER_PROGRAM;
-	pixel_shader_program->dw0.retain = 0;
-	pixel_shader_program->dw0.length = 23;
-	/* dcl      t0.xy */
-	inst = (unsigned int *)(++pixel_shader_program);
-	i915_inst_decl(inst, REG_TYPE_T, T_TEX0, D0_CHANNEL_XY);
-	/* dcl         t1.xy */
-	inst += 3;
-	i915_inst_decl(inst, REG_TYPE_T, T_TEX1, D0_CHANNEL_XY);
-	/* dcl_2D   s0 */
-	inst += 3;
-	i915_inst_decl(inst, REG_TYPE_S, 0, D0_SAMPLE_TYPE_2D);
-	/* dcl_2D   s1 */
-	inst += 3;
-	i915_inst_decl(inst, REG_TYPE_S, 1, D0_SAMPLE_TYPE_2D);
-	/* dcl_2D   s2 */
-	inst += 3;
-	i915_inst_decl(inst, REG_TYPE_S, 2, D0_SAMPLE_TYPE_2D);
-	/* texld    r0 t1 s0 */
-	inst += 3;
-	dest = UREG(REG_TYPE_R, 0);
-	src0 = UREG(REG_TYPE_T, 1);	/* COORD */
-	src1 = UREG(REG_TYPE_S, 0);	/* SAMPLER */
-	i915_inst_texld(inst, T0_TEXLD, dest, src0, src1);
-	/* texld    r0 t0 s1 */
-	inst += 3;
-	dest = UREG(REG_TYPE_R, 0);
-	src0 = UREG(REG_TYPE_T, 0);	/* COORD */
-	src1 = UREG(REG_TYPE_S, 1);	/* SAMPLER */
-	i915_inst_texld(inst, T0_TEXLD, dest, src0, src1);
-	/* texld    oC t1 s2 */
-	inst += 3;
-	dest = UREG(REG_TYPE_OC, 0);
-	src0 = UREG(REG_TYPE_T, 1);	/* COORD */
-	src1 = UREG(REG_TYPE_S, 2);	/* SAMPLER */
-	i915_inst_texld(inst, T0_TEXLD, dest, src0, src1);
-}
-#endif
-
-#if 0
-static void i915_yuv2rgb_proc(XvMCSurface * surface)
-{
-	i915XvMCSurface *privSurface = (i915XvMCSurface *) surface->privData;
-	i915XvMCContext *pI915XvMC =
-	    (i915XvMCContext *) privSurface->privContext;
-	struct i915_3dstate_load_state_immediate_1 *load_state_immediate_1 =
-	    NULL;
-	struct s2_dword *s2 = NULL;
-	struct s3_dword *s3 = NULL;
-	struct s4_dword *s4 = NULL;
-	struct s5_dword *s5 = NULL;
-	struct s6_dword *s6 = NULL;
-	struct s7_dword *s7 = NULL;
-	struct i915_3dstate_scissor_rectangle scissor_rectangle;
-	struct i915_3dstate_load_indirect *load_indirect = NULL;
-	sis_state *sis = NULL;
-	ssb_state *ssb = NULL;
-	msb_state *msb = NULL;
-	psp_state *psp = NULL;
-	struct i915_3dprimitive *_3dprimitive = NULL;
-	struct vertex_data *vd = NULL;
-	unsigned int size;
-	void *base = NULL;
-
-	/* 3DSTATE_LOAD_STATE_IMMEDIATE_1 */
-	size = sizeof(*load_state_immediate_1) + sizeof(*s2) + sizeof(*s3) +
-	    sizeof(*s4) + sizeof(*s5) + sizeof(*s6) + sizeof(*s7);
-	base = calloc(1, size);
-	load_state_immediate_1 =
-	    (struct i915_3dstate_load_state_immediate_1 *)base;
-	load_state_immediate_1->dw0.type = CMD_3D;
-	load_state_immediate_1->dw0.opcode = OPC_3DSTATE_LOAD_STATE_IMMEDIATE_1;
-	load_state_immediate_1->dw0.load_s2 = 1;
-	load_state_immediate_1->dw0.load_s3 = 1;
-	load_state_immediate_1->dw0.load_s4 = 1;
-	load_state_immediate_1->dw0.load_s5 = 1;
-	load_state_immediate_1->dw0.load_s6 = 1;
-	load_state_immediate_1->dw0.load_s7 = 1;
-	load_state_immediate_1->dw0.length = 5;
-
-	s2 = (struct s2_dword *)(++load_state_immediate_1);
-	s2->set0_texcoord_fmt = TEXCOORDFMT_2FP;
-	s2->set1_texcoord_fmt = TEXCOORDFMT_2FP;
-	s2->set2_texcoord_fmt = TEXCOORDFMT_NOT_PRESENT;
-	s2->set3_texcoord_fmt = TEXCOORDFMT_NOT_PRESENT;
-	s2->set4_texcoord_fmt = TEXCOORDFMT_NOT_PRESENT;
-	s2->set5_texcoord_fmt = TEXCOORDFMT_NOT_PRESENT;
-	s2->set6_texcoord_fmt = TEXCOORDFMT_NOT_PRESENT;
-	s2->set7_texcoord_fmt = TEXCOORDFMT_NOT_PRESENT;
-
-	s3 = (struct s3_dword *)(++s2);
-	s4 = (struct s4_dword *)(++s3);
-	s4->position_mask = VERTEXHAS_XY;
-	s4->cull_mode = CULLMODE_NONE;
-	s4->color_shade_mode = SHADEMODE_FLAT;
-	s4->specular_shade_mode = SHADEMODE_FLAT;
-	s4->fog_shade_mode = SHADEMODE_FLAT;
-	s4->alpha_shade_mode = SHADEMODE_FLAT;
-	s4->line_width = 0x2;	/* FIXME: 1.0??? */
-	s4->point_width = 0x1;
-
-	s5 = (struct s5_dword *)(++s4);
-	s6 = (struct s6_dword *)(++s5);
-	s6->src_blend_factor = 1;
-	s6->dest_blend_factor = 1;
-	s6->color_buffer_write = 1;
-
-	s7 = (struct s7_dword *)(++s6);
-	intelBatchbufferData(base, size, 0);
-	free(base);
-
-	/* 3DSTATE_3DSTATE_SCISSOR_RECTANGLE */
-	scissor_rectangle.dw0.type = CMD_3D;
-	scissor_rectangle.dw0.opcode = OPC_3DSTATE_SCISSOR_RECTANGLE;
-	scissor_rectangle.dw0.length = 1;
-	scissor_rectangle.dw1.min_x = 0;
-	scissor_rectangle.dw1.min_y = 0;
-	scissor_rectangle.dw2.max_x = 2047;
-	scissor_rectangle.dw2.max_y = 2047;
-	intelBatchbufferData(&scissor_rectangle, sizeof(scissor_rectangle), 0);
-
-	/* 3DSTATE_LOAD_INDIRECT */
-	size =
-	    sizeof(*load_indirect) + sizeof(*sis) + sizeof(*ssb) +
-	    sizeof(*msb) + sizeof(*psp);
-	base = calloc(1, size);
-	load_indirect = (struct i915_3dstate_load_indirect *)base;
-	load_indirect->dw0.type = CMD_3D;
-	load_indirect->dw0.opcode = OPC_3DSTATE_LOAD_INDIRECT;
-	load_indirect->dw0.mem_select = 1;	/* Bearlake only */
-	load_indirect->dw0.block_mask =
-	    BLOCK_SIS | BLOCK_SSB | BLOCK_MSB | BLOCK_PSP;
-	load_indirect->dw0.length = 7;
-
-	/* SIS */
-	sis = (sis_state *) (++load_indirect);
-	sis->dw0.valid = 1;
-	sis->dw0.buffer_address = pI915XvMC->sis.offset;
-	sis->dw1.length = ((sizeof(struct i915_3dstate_buffer_info) +
-			    sizeof(struct i915_3dstate_dest_buffer_variables))
-			   >> 2) - 1;
-
-	/* SSB */
-	ssb = (ssb_state *) (++sis);
-	ssb->dw0.valid = 1;
-	ssb->dw0.buffer_address = pI915XvMC->ssb.offset;
-	ssb->dw1.length = ((sizeof(struct i915_3dstate_sampler_state) +
-			    sizeof(struct texture_sampler) * 3) >> 2) - 1;
-
-	/* MSB */
-	msb = (msb_state *) (++ssb);
-	msb->dw0.valid = 1;
-	msb->dw0.buffer_address = pI915XvMC->msb.offset;
-	msb->dw1.length = ((sizeof(struct i915_3dstate_map_state) +
-			    sizeof(struct texture_map) * 3) >> 2) - 1;
-
-	/* PSP */
-	psp = (psp_state *) (++msb);
-	psp->dw0.valid = 1;
-	psp->dw0.buffer_address = pI915XvMC->psp.offset;
-	psp->dw1.length = ((sizeof(struct i915_3dstate_pixel_shader_program) +
-			    sizeof(union shader_inst)) >> 2) - 1;
-
-	intelBatchbufferData(base, size, 0);
-	free(base);
-
-	/* 3DPRIMITIVE */
-	size = sizeof(*_3dprimitive) + sizeof(*vd) * 3;
-	base = calloc(1, size);
-	_3dprimitive = (struct i915_3dprimitive *)base;
-	_3dprimitive->dw0.inline_prim.type = CMD_3D;
-	_3dprimitive->dw0.inline_prim.opcode = OPC_3DPRIMITIVE;
-	_3dprimitive->dw0.inline_prim.vertex_location = VERTEX_INLINE;
-	_3dprimitive->dw0.inline_prim.prim = PRIM_RECTLIST;
-	_3dprimitive->dw0.inline_prim.length = size - 2;
-
-	vd = (struct vertex_data *)(++_3dprimitive);
-	vd->x = 0;		/* FIXME!!! */
-	vd->x = 0;		/* FIXME */
-	vd->tc0.tcx = 0;
-	vd->tc0.tcy = 0;
-	vd->tc1.tcx = 0;
-	vd->tc1.tcy = 0;
-
-	++vd;
-	vd->x = 0;		/* FIXME!!! */
-	vd->x = 0;		/* FIXME */
-	vd->tc0.tcx = 0;
-	vd->tc0.tcy = 0;
-	vd->tc1.tcx = 0;
-	vd->tc1.tcy = 0;
-
-	++vd;
-	vd->x = 0;		/* FIXME!!! */
-	vd->x = 0;		/* FIXME */
-	vd->tc0.tcx = 0;
-	vd->tc0.tcy = 0;
-	vd->tc1.tcx = 0;
-	vd->tc1.tcy = 0;
-
-	intelBatchbufferData(base, size, 0);
-	free(base);
-}
-#endif
-
 /*
  * Function: i915_release_resource
  */
@@ -2127,419 +1508,6 @@ static int i915_xvmc_mc_get_surface_status(Display * display,
 	return 0;
 }
 
-/* XXX WIP code */
-#if 0
-Status XvMCHideSurface(Display * display, XvMCSurface * surface)
-{
-	i915XvMCSurface *pI915Surface;
-	i915XvMCContext *pI915XvMC;
-	int stat = 0, ret;
-
-	if (!display || !surface)
-		return BadValue;
-
-	if (!(pI915Surface = surface->privData))
-		return XvMCBadSurface;
-
-	/* Get the associated context pointer */
-	if (!(pI915XvMC = pI915Surface->privContext))
-		return XvMCBadSurface;
-
-	XvMCSyncSurface(display, surface);
-
-	/*
-	   Get the status of the surface, if it is not currently displayed
-	   we don't need to worry about it.
-	 */
-	if ((ret = XvMCGetSurfaceStatus(display, surface, &stat)) != Success)
-		return ret;
-
-	if (!(stat & XVMC_DISPLAYING))
-		return Success;
-
-	/* FIXME: */
-	return Success;
-}
-
-Status i915_xvmc_create_subpict(Display * display, XvMCContext * context,
-				XvMCSubpicture * subpicture,
-				unsigned short width, unsigned short height,
-				int xvimage_id)
-{
-	Status ret;
-	i915XvMCContext *pI915XvMC;
-	i915XvMCSubpicture *pI915Subpicture;
-	I915XvMCCreateSurfaceRec *tmpComm = NULL;
-	int priv_count;
-	uint *priv_data;
-
-	if (!subpicture || !context || !display)
-		return BadValue;
-
-	pI915XvMC = (i915XvMCContext *) context->privData;
-
-	if (!pI915XvMC)
-		return XvMCBadContext;
-
-	subpicture->privData =
-	    (i915XvMCSubpicture *) malloc(sizeof(i915XvMCSubpicture));
-
-	if (!subpicture->privData)
-		return BadAlloc;
-
-	PPTHREAD_MUTEX_LOCK();
-	subpicture->context_id = context->context_id;
-	subpicture->xvimage_id = xvimage_id;
-	subpicture->width = width;
-	subpicture->height = height;
-	pI915Subpicture = (i915XvMCSubpicture *) subpicture->privData;
-
-	XLockDisplay(display);
-	if ((ret = _xvmc_create_subpicture(display, context, subpicture,
-					   &priv_count, &priv_data))) {
-		XUnlockDisplay(display);
-		XVMC_ERR("Unable to create XvMCSubpicture.");
-		free(pI915Subpicture);
-		subpicture->privData = NULL;
-		PPTHREAD_MUTEX_UNLOCK();
-		return ret;
-	}
-	XUnlockDisplay(display);
-
-	if (priv_count != (sizeof(I915XvMCCreateSurfaceRec) >> 2)) {
-		XVMC_ERR
-		    ("_xvmc_create_subpicture() returned incorrect data size!");
-		XVMC_INFO("\tExpected %d, got %d",
-			  (int)(sizeof(I915XvMCCreateSurfaceRec) >> 2),
-			  priv_count);
-		XLockDisplay(display);
-		_xvmc_destroy_subpicture(display, subpicture);
-		XUnlockDisplay(display);
-		XFree(priv_data);
-		free(pI915Subpicture);
-		subpicture->privData = NULL;
-		PPTHREAD_MUTEX_UNLOCK();
-		return BadAlloc;
-	}
-
-	tmpComm = (I915XvMCCreateSurfaceRec *) priv_data;
-	pI915Subpicture->srfNo = tmpComm->srfno;
-	pI915Subpicture->srf.handle = tmpComm->srf.handle;
-	pI915Subpicture->srf.offset = tmpComm->srf.offset;
-	pI915Subpicture->srf.size = tmpComm->srf.size;
-	XFree(priv_data);
-
-	if (drmMap(pI915XvMC->fd,
-		   pI915Subpicture->srf.handle,
-		   pI915Subpicture->srf.size,
-		   (drmAddress *) & pI915Subpicture->srf.map) != 0) {
-		XLockDisplay(display);
-		_xvmc_destroy_subpicture(display, subpicture);
-		XUnlockDisplay(display);
-		free(pI915Subpicture);
-		subpicture->privData = NULL;
-		PPTHREAD_MUTEX_UNLOCK();
-		return BadAlloc;
-	}
-
-	/* subpicture */
-	subpicture->num_palette_entries = I915_SUBPIC_PALETTE_SIZE;
-	subpicture->entry_bytes = 3;
-	strncpy(subpicture->component_order, "YUV", 4);
-
-	/* Initialize private values */
-	pI915Subpicture->privContext = pI915XvMC;
-	pI915Subpicture->last_render = 0;
-	pI915Subpicture->last_flip = 0;
-	pI915Subpicture->pitch = ((subpicture->width + 3) & ~3);
-
-	switch (subpicture->xvimage_id) {
-	case FOURCC_IA44:
-	case FOURCC_AI44:
-		break;
-
-	default:
-		drmUnmap(pI915Subpicture->srf.map, pI915Subpicture->srf.size);
-		XLockDisplay(display);
-		_xvmc_destroy_subpicture(display, subpicture);
-		XUnlockDisplay(display);
-		free(pI915Subpicture);
-		subpicture->privData = NULL;
-		PPTHREAD_MUTEX_UNLOCK();
-		return BadMatch;
-	}
-
-	pI915XvMC->ref++;
-	PPTHREAD_MUTEX_UNLOCK();
-	return Success;
-}
-
-Status i915_xvmc_clear_subpict(Display * display, XvMCSubpicture * subpicture,
-			       short x, short y,
-			       unsigned short width, unsigned short height,
-			       unsigned int color)
-{
-	i915XvMCContext *pI915XvMC;
-	i915XvMCSubpicture *pI915Subpicture;
-
-	if (!display || !subpicture)
-		return BadValue;
-
-	if (!(pI915Subpicture = subpicture->privData))
-		return XvMCBadSubpicture;
-
-	if (!(pI915XvMC = pI915Subpicture->privContext))
-		return XvMCBadSubpicture;
-
-	if ((x < 0) || (x + width) > subpicture->width)
-		return BadValue;
-
-	if ((y < 0) || (y + height) > subpicture->height)
-		return BadValue;
-
-	/* FIXME: clear the area */
-
-	return Success;
-}
-
-Status i915_xvmc_composite_subpict(Display * display,
-				   XvMCSubpicture * subpicture, XvImage * image,
-				   short srcx, short srcy, unsigned short width,
-				   unsigned short height, short dstx,
-				   short dsty)
-{
-	i915XvMCContext *pI915XvMC;
-	i915XvMCSubpicture *pI915Subpicture;
-
-	if (!display || !subpicture)
-		return BadValue;
-
-	if (!(pI915Subpicture = subpicture->privData))
-		return XvMCBadSubpicture;
-
-	if (!(pI915XvMC = pI915Subpicture->privContext))
-		return XvMCBadSubpicture;
-
-	if ((srcx < 0) || (srcx + width) > subpicture->width)
-		return BadValue;
-
-	if ((srcy < 0) || (srcy + height) > subpicture->height)
-		return BadValue;
-
-	if ((dstx < 0) || (dstx + width) > subpicture->width)
-		return BadValue;
-
-	if ((dsty < 0) || (dsty + width) > subpicture->height)
-		return BadValue;
-
-	if (image->id != subpicture->xvimage_id)
-		return BadMatch;
-
-	/* FIXME */
-	return Success;
-}
-
-Status i915_xvmc_destroy_subpict(Display * display, XvMCSubpicture * subpicture)
-{
-	i915XvMCSubpicture *pI915Subpicture;
-	i915XvMCContext *pI915XvMC;
-
-	if (!display || !subpicture)
-		return BadValue;
-
-	if (!(pI915Subpicture = subpicture->privData))
-		return XvMCBadSubpicture;
-
-	if (!(pI915XvMC = pI915Subpicture->privContext))
-		return XvMCBadSubpicture;
-
-	if (pI915Subpicture->last_render)
-		XvMCSyncSubpicture(display, subpicture);
-
-	if (pI915Subpicture->srf.map)
-		drmUnmap(pI915Subpicture->srf.map, pI915Subpicture->srf.size);
-
-	PPTHREAD_MUTEX_LOCK();
-	XLockDisplay(display);
-	_xvmc_destroy_subpicture(display, subpicture);
-	XUnlockDisplay(display);
-
-	free(pI915Subpicture);
-	subpicture->privData = NULL;
-	pI915XvMC->ref--;
-	PPTHREAD_MUTEX_UNLOCK();
-
-	return Success;
-}
-
-Status i915_xvmc_set_subpict_palette(Display * display,
-				     XvMCSubpicture * subpicture,
-				     unsigned char *palette)
-{
-	i915XvMCSubpicture *pI915Subpicture;
-	int i, j;
-
-	if (!display || !subpicture)
-		return BadValue;
-
-	if (!(pI915Subpicture = subpicture->privData))
-		return XvMCBadSubpicture;
-
-	j = 0;
-	for (i = 0; i < 16; i++) {
-		pI915Subpicture->palette[0][i] = palette[j++];
-		pI915Subpicture->palette[1][i] = palette[j++];
-		pI915Subpicture->palette[2][i] = palette[j++];
-	}
-
-	/* FIXME: Update the subpicture with the new palette */
-	return Success;
-}
-
-Status i915_xvmc_blend_subpict(Display * display, XvMCSurface * target_surface,
-			       XvMCSubpicture * subpicture,
-			       short subx, short suby,
-			       unsigned short subw, unsigned short subh,
-			       short surfx, short surfy,
-			       unsigned short surfw, unsigned short surfh)
-{
-	i915XvMCSubpicture *pI915Subpicture;
-	i915XvMCSurface *privTargetSurface;
-
-	if (!display || !target_surface)
-		return BadValue;
-
-	if (!(privTargetSurface = target_surface->privData))
-		return XvMCBadSurface;
-
-	if (subpicture) {
-		if (!(pI915Subpicture = subpicture->privData))
-			return XvMCBadSubpicture;
-
-		if ((FOURCC_AI44 != subpicture->xvimage_id) &&
-		    (FOURCC_IA44 != subpicture->xvimage_id))
-			return XvMCBadSubpicture;
-
-		privTargetSurface->privSubPic = pI915Subpicture;
-	} else {
-		privTargetSurface->privSubPic = NULL;
-	}
-
-	return Success;
-}
-
-Status i915_xvmc_blend_subpict2(Display * display,
-				XvMCSurface * source_surface,
-				XvMCSurface * target_surface,
-				XvMCSubpicture * subpicture,
-				short subx, short suby,
-				unsigned short subw, unsigned short subh,
-				short surfx, short surfy,
-				unsigned short surfw, unsigned short surfh)
-{
-	i915XvMCContext *pI915XvMC;
-	i915XvMCSubpicture *pI915Subpicture;
-	i915XvMCSurface *privSourceSurface;
-	i915XvMCSurface *privTargetSurface;
-
-	if (!display || !source_surface || !target_surface)
-		return BadValue;
-
-	if (!(privSourceSurface = source_surface->privData))
-		return XvMCBadSurface;
-
-	if (!(privTargetSurface = target_surface->privData))
-		return XvMCBadSurface;
-
-	if (!(pI915XvMC = privTargetSurface->privContext))
-		return XvMCBadSurface;
-
-	if (((surfx + surfw) > privTargetSurface->width) ||
-	    ((surfy + surfh) > privTargetSurface->height))
-		return BadValue;
-
-	if ((privSourceSurface->width != privTargetSurface->width) ||
-	    (privTargetSurface->height != privTargetSurface->height))
-		return BadValue;
-
-	if (XvMCSyncSurface(display, source_surface))
-		return BadValue;
-
-	/* FIXME: update Target Surface */
-
-	if (subpicture) {
-		if (((subx + subw) > subpicture->width) ||
-		    ((suby + subh) > subpicture->height))
-			return BadValue;
-
-		if (!(pI915Subpicture = subpicture->privData))
-			return XvMCBadSubpicture;
-
-		if ((FOURCC_AI44 != subpicture->xvimage_id) &&
-		    (FOURCC_IA44 != subpicture->xvimage_id))
-			return XvMCBadSubpicture;
-
-		privTargetSurface->privSubPic = pI915Subpicture;
-	} else {
-		privTargetSurface->privSubPic = NULL;
-	}
-
-	return Success;
-}
-
-Status i915_xvmc_sync_subpict(Display * display, XvMCSubpicture * subpicture)
-{
-	Status ret;
-	int stat = 0;
-
-	if (!display || !subpicture)
-		return BadValue;
-
-	do {
-		ret = XvMCGetSubpictureStatus(display, subpicture, &stat);
-	} while (!ret && (stat & XVMC_RENDERING));
-
-	return ret;
-}
-
-Status i915_xvmc_flush_subpict(Display * display, XvMCSubpicture * subpicture)
-{
-	i915XvMCSubpicture *pI915Subpicture;
-
-	if (!display || !subpicture)
-		return BadValue;
-
-	if (!(pI915Subpicture = subpicture->privData))
-		return XvMCBadSubpicture;
-
-	return Success;
-}
-
-Status i915_xvmc_get_subpict_status(Display * display,
-				    XvMCSubpicture * subpicture, int *stat)
-{
-	i915XvMCSubpicture *pI915Subpicture;
-	i915XvMCContext *pI915XvMC;
-
-	if (!display || !subpicture || stat)
-		return BadValue;
-
-	*stat = 0;
-
-	if (!(pI915Subpicture = subpicture->privData))
-		return XvMCBadSubpicture;
-
-	if (!(pI915XvMC = pI915Subpicture->privContext))
-		return XvMCBadSubpicture;
-
-	PPTHREAD_MUTEX_LOCK();
-
-	PPTHREAD_MUTEX_UNLOCK();
-	return Success;
-}
-
-#endif
-
 struct _intel_xvmc_driver i915_xvmc_mc_driver = {
 	.type = XVMC_I915_MPEG2_MC,
 	.num_ctx = 0,
-- 
1.6.6.1




More information about the Intel-gfx mailing list