From e406936b9ec46f1b8a41d02edd15f384bb739e32 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20K=C3=B6nig?= Date: Thu, 11 Nov 2010 12:49:47 +0100 Subject: [PATCH] [g3dvl] remove empty block handling for now Maybe this isn't going into the right direction, but it makes handling the code easier for now. --- .../auxiliary/vl/vl_mpeg12_mc_renderer.c | 58 +------------------ .../auxiliary/vl/vl_mpeg12_mc_renderer.h | 10 ---- src/gallium/drivers/nv40/nv40_video_context.c | 1 - src/gallium/drivers/nvfx/nvfx_video_context.c | 1 - src/gallium/drivers/r300/r300_video_context.c | 1 - src/gallium/drivers/r600/r600_video_context.c | 1 - .../drivers/softpipe/sp_video_context.c | 8 +-- .../drivers/softpipe/sp_video_context.h | 1 - 8 files changed, 5 insertions(+), 76 deletions(-) diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index a6fe0661200..4616e483f74 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -42,8 +42,6 @@ #define MACROBLOCK_HEIGHT 16 #define BLOCK_WIDTH 8 #define BLOCK_HEIGHT 8 -#define ZERO_BLOCK_NIL -1.0f -#define ZERO_BLOCK_IS_NIL(zb) ((zb).x < 0.0f) #define SCALE_FACTOR_16_TO_9 (32767.0f / 255.0f) struct vertex_shader_consts @@ -512,8 +510,7 @@ init_pipe_state(struct vl_mpeg12_mc_renderer *r) /* Luma filter */ filters[0] = PIPE_TEX_FILTER_NEAREST; /* Chroma filters */ - if (r->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_444 || - r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE) { + if (r->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_444 || true) { //TODO filters[1] = PIPE_TEX_FILTER_NEAREST; filters[2] = PIPE_TEX_FILTER_NEAREST; } @@ -1199,10 +1196,6 @@ flush(struct vl_mpeg12_mc_renderer *r) r->pipe->flush(r->pipe, PIPE_FLUSH_RENDER_CACHE, r->fence); - if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE) - for (i = 0; i < 3; ++i) - r->zero_block[i].x = ZERO_BLOCK_NIL; - r->num_macroblocks = 0; } @@ -1230,17 +1223,6 @@ grab_field_coded_block(short *src, short *dst, unsigned dst_pitch) memcpy(dst + y * dst_pitch * 2, src + y * BLOCK_WIDTH, BLOCK_WIDTH * 2); } -static void -fill_frame_zero_block(short *dst, unsigned dst_pitch) -{ - //unsigned y; - // - //assert(dst); - - //for (y = 0; y < BLOCK_HEIGHT; ++y) - // memset(dst + y * dst_pitch, 0, BLOCK_WIDTH * 2); -} - static void fill_field_zero_block(short *dst, unsigned dst_pitch) { @@ -1284,23 +1266,8 @@ grab_blocks(struct vl_mpeg12_mc_renderer *r, unsigned mbx, unsigned mby, ++sb; } - else if (r->eb_handling != VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_NONE) { - if(dct_type == PIPE_MPEG12_DCT_TYPE_FRAME) { - - if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ALL || - ZERO_BLOCK_IS_NIL(r->zero_block[0])) { - - fill_frame_zero_block(texels + y * tex_pitch * BLOCK_WIDTH + x * BLOCK_WIDTH, tex_pitch); - if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE) { - r->zero_block[0].x = (mbx + x * 0.5f); - r->zero_block[0].y = (mby + y * 0.5f); - } - } - } - else { - - fill_field_zero_block(texels + y * tex_pitch + x * BLOCK_WIDTH, tex_pitch); - } + else if(dct_type == PIPE_MPEG12_DCT_TYPE_FIELD) { + fill_field_zero_block(texels + y * tex_pitch + x * BLOCK_WIDTH, tex_pitch); } } } @@ -1319,16 +1286,6 @@ grab_blocks(struct vl_mpeg12_mc_renderer *r, unsigned mbx, unsigned mby, grab_frame_coded_block(blocks + sb * BLOCK_WIDTH * BLOCK_HEIGHT, texels, tex_pitch); ++sb; } - else if (r->eb_handling != VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_NONE) { - if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ALL || - ZERO_BLOCK_IS_NIL(r->zero_block[tb + 1])) { - fill_frame_zero_block(texels, tex_pitch); - if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE) { - r->zero_block[tb + 1].x = mbx; - r->zero_block[tb + 1].y = mby; - } - } - } } } @@ -1371,18 +1328,12 @@ vl_mpeg12_mc_renderer_init(struct vl_mpeg12_mc_renderer *renderer, unsigned picture_height, enum pipe_video_chroma_format chroma_format, enum VL_MPEG12_MC_RENDERER_BUFFER_MODE bufmode, - enum VL_MPEG12_MC_RENDERER_EMPTY_BLOCK eb_handling, bool pot_buffers) { - unsigned i; - assert(renderer); assert(pipe); /* TODO: Implement other policies */ assert(bufmode == VL_MPEG12_MC_RENDERER_BUFFER_PICTURE); - /* TODO: Implement this */ - /* XXX: XFER_ALL sampling issue at block edges when using bilinear filtering */ - assert(eb_handling != VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_NONE); /* TODO: Non-pot buffers untested, probably doesn't work without changes to texcoord generation, vert shader, etc */ assert(pot_buffers); @@ -1393,7 +1344,6 @@ vl_mpeg12_mc_renderer_init(struct vl_mpeg12_mc_renderer *renderer, renderer->picture_height = picture_height; renderer->chroma_format = chroma_format; renderer->bufmode = bufmode; - renderer->eb_handling = eb_handling; renderer->pot_buffers = pot_buffers; renderer->texview_map = util_new_keymap(sizeof(struct pipe_surface*), -1, @@ -1420,8 +1370,6 @@ vl_mpeg12_mc_renderer_init(struct vl_mpeg12_mc_renderer *renderer, renderer->surface = NULL; renderer->past = NULL; renderer->future = NULL; - for (i = 0; i < 3; ++i) - renderer->zero_block[i].x = ZERO_BLOCK_NIL; renderer->num_macroblocks = 0; xfer_buffers_map(renderer); diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h index 55441591988..50c38f9ff10 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h @@ -44,13 +44,6 @@ enum VL_MPEG12_MC_RENDERER_BUFFER_MODE VL_MPEG12_MC_RENDERER_BUFFER_PICTURE /* Larger batches, more memory */ }; -enum VL_MPEG12_MC_RENDERER_EMPTY_BLOCK -{ - VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ALL, /* Waste of memory bandwidth */ - VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE, /* Can only do point-filtering when interpolating subsampled chroma channels */ - VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_NONE /* Needs conditional texel fetch! */ -}; - struct vl_mpeg12_mc_renderer { struct pipe_context *pipe; @@ -58,7 +51,6 @@ struct vl_mpeg12_mc_renderer unsigned picture_height; enum pipe_video_chroma_format chroma_format; enum VL_MPEG12_MC_RENDERER_BUFFER_MODE bufmode; - enum VL_MPEG12_MC_RENDERER_EMPTY_BLOCK eb_handling; bool pot_buffers; unsigned macroblocks_per_batch; @@ -104,7 +96,6 @@ struct vl_mpeg12_mc_renderer struct pipe_mpeg12_macroblock *macroblock_buf; struct pipe_transfer *tex_transfer[3]; short *texels[3]; - struct vertex2f zero_block[3]; struct keymap *texview_map; }; @@ -115,7 +106,6 @@ bool vl_mpeg12_mc_renderer_init(struct vl_mpeg12_mc_renderer *renderer, unsigned picture_height, enum pipe_video_chroma_format chroma_format, enum VL_MPEG12_MC_RENDERER_BUFFER_MODE bufmode, - enum VL_MPEG12_MC_RENDERER_EMPTY_BLOCK eb_handling, bool pot_buffers); void vl_mpeg12_mc_renderer_cleanup(struct vl_mpeg12_mc_renderer *renderer); diff --git a/src/gallium/drivers/nv40/nv40_video_context.c b/src/gallium/drivers/nv40/nv40_video_context.c index 15a26ea3b3b..e6e57ee787c 100644 --- a/src/gallium/drivers/nv40/nv40_video_context.c +++ b/src/gallium/drivers/nv40/nv40_video_context.c @@ -43,6 +43,5 @@ nv40_video_create(struct pipe_screen *screen, enum pipe_video_profile profile, return sp_video_create_ex(pipe, profile, chroma_format, width, height, VL_MPEG12_MC_RENDERER_BUFFER_PICTURE, - VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE, true); } diff --git a/src/gallium/drivers/nvfx/nvfx_video_context.c b/src/gallium/drivers/nvfx/nvfx_video_context.c index 9212ae57fc0..58e1c0baa27 100644 --- a/src/gallium/drivers/nvfx/nvfx_video_context.c +++ b/src/gallium/drivers/nvfx/nvfx_video_context.c @@ -43,7 +43,6 @@ nvfx_video_create(struct pipe_screen *screen, enum pipe_video_profile profile, return sp_video_create_ex(pipe, profile, chroma_format, width, height, VL_MPEG12_MC_RENDERER_BUFFER_PICTURE, - VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE, true, PIPE_FORMAT_VUYX); } diff --git a/src/gallium/drivers/r300/r300_video_context.c b/src/gallium/drivers/r300/r300_video_context.c index 622f1b8820b..9fe6d6fcf25 100644 --- a/src/gallium/drivers/r300/r300_video_context.c +++ b/src/gallium/drivers/r300/r300_video_context.c @@ -267,7 +267,6 @@ r300_mpeg12_context_create(struct pipe_screen *screen, if (!vl_mpeg12_mc_renderer_init(&ctx->mc_renderer, ctx->pipe, width, height, chroma_format, VL_MPEG12_MC_RENDERER_BUFFER_PICTURE, - VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE, true)) { ctx->pipe->destroy(ctx->pipe); diff --git a/src/gallium/drivers/r600/r600_video_context.c b/src/gallium/drivers/r600/r600_video_context.c index 2bbf622052b..b3885db0f55 100644 --- a/src/gallium/drivers/r600/r600_video_context.c +++ b/src/gallium/drivers/r600/r600_video_context.c @@ -16,7 +16,6 @@ r600_video_create(struct pipe_screen *screen, enum pipe_video_profile profile, return sp_video_create_ex(pipe, profile, chroma_format, width, height, VL_MPEG12_MC_RENDERER_BUFFER_PICTURE, - VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE, true, PIPE_FORMAT_VUYX); } diff --git a/src/gallium/drivers/softpipe/sp_video_context.c b/src/gallium/drivers/softpipe/sp_video_context.c index ff217d66c85..3edab823677 100644 --- a/src/gallium/drivers/softpipe/sp_video_context.c +++ b/src/gallium/drivers/softpipe/sp_video_context.c @@ -423,7 +423,6 @@ sp_mpeg12_create(struct pipe_context *pipe, enum pipe_video_profile profile, enum pipe_video_chroma_format chroma_format, unsigned width, unsigned height, enum VL_MPEG12_MC_RENDERER_BUFFER_MODE bufmode, - enum VL_MPEG12_MC_RENDERER_EMPTY_BLOCK eb_handling, bool pot_buffers, enum pipe_format decode_format) { @@ -466,7 +465,7 @@ sp_mpeg12_create(struct pipe_context *pipe, enum pipe_video_profile profile, if (!vl_mpeg12_mc_renderer_init(&ctx->mc_renderer, ctx->pipe, width, height, chroma_format, - bufmode, eb_handling, pot_buffers)) { + bufmode, pot_buffers)) { ctx->pipe->destroy(ctx->pipe); FREE(ctx); return NULL; @@ -505,12 +504,10 @@ sp_video_create(struct pipe_screen *screen, enum pipe_video_profile profile, return NULL; /* TODO: Use slice buffering for softpipe when implemented, no advantage to buffering an entire picture with softpipe */ - /* TODO: Use XFER_NONE when implemented */ return sp_video_create_ex(pipe, profile, chroma_format, width, height, VL_MPEG12_MC_RENDERER_BUFFER_PICTURE, - VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE, true, PIPE_FORMAT_XYUV); } @@ -520,7 +517,6 @@ sp_video_create_ex(struct pipe_context *pipe, enum pipe_video_profile profile, enum pipe_video_chroma_format chroma_format, unsigned width, unsigned height, enum VL_MPEG12_MC_RENDERER_BUFFER_MODE bufmode, - enum VL_MPEG12_MC_RENDERER_EMPTY_BLOCK eb_handling, bool pot_buffers, enum pipe_format decode_format) { @@ -532,7 +528,7 @@ sp_video_create_ex(struct pipe_context *pipe, enum pipe_video_profile profile, return sp_mpeg12_create(pipe, profile, chroma_format, width, height, - bufmode, eb_handling, + bufmode, pot_buffers, decode_format); default: diff --git a/src/gallium/drivers/softpipe/sp_video_context.h b/src/gallium/drivers/softpipe/sp_video_context.h index 0fe48d7a872..dbf1bc1d8dd 100644 --- a/src/gallium/drivers/softpipe/sp_video_context.h +++ b/src/gallium/drivers/softpipe/sp_video_context.h @@ -62,7 +62,6 @@ sp_video_create_ex(struct pipe_context *pipe, enum pipe_video_profile profile, enum pipe_video_chroma_format chroma_format, unsigned width, unsigned height, enum VL_MPEG12_MC_RENDERER_BUFFER_MODE bufmode, - enum VL_MPEG12_MC_RENDERER_EMPTY_BLOCK eb_handling, bool pot_buffers, enum pipe_format decode_format); -- 2.30.2