diff options
author | Christian König <[email protected]> | 2011-04-10 19:08:11 +0200 |
---|---|---|
committer | Christian König <[email protected]> | 2011-04-10 19:08:11 +0200 |
commit | fcf765620d803b376582afb618b1f643242b641b (patch) | |
tree | 930a7dd2416352e15b7d31dd26316400b8035130 /src | |
parent | 31109e1be20d7c94521879c3221a9f77bacbdb8d (diff) |
[g3dvl] make number of idct render targets configurable
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/auxiliary/vl/vl_idct.c | 22 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_idct.h | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_mpeg12_decoder.c | 10 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_mpeg12_decoder.h | 1 |
4 files changed, 21 insertions, 14 deletions
diff --git a/src/gallium/auxiliary/vl/vl_idct.c b/src/gallium/auxiliary/vl/vl_idct.c index 5d5ead31f7d..3502f4c1eaa 100644 --- a/src/gallium/auxiliary/vl/vl_idct.c +++ b/src/gallium/auxiliary/vl/vl_idct.c @@ -38,8 +38,6 @@ #include <tgsi/tgsi_ureg.h> #include "vl_types.h" -#define NR_RENDER_TARGETS 4 - enum VS_OUTPUT { VS_O_VPOS, @@ -171,7 +169,7 @@ create_vert_shader(struct vl_idct *idct, bool matrix_stage) ureg_MUL(shader, ureg_writemask(t_tex, TGSI_WRITEMASK_XY), ureg_src(t_tex), scale); ureg_MUL(shader, ureg_writemask(t_tex, TGSI_WRITEMASK_Z), ureg_scalar(vrect, TGSI_SWIZZLE_X), - ureg_imm1f(shader, BLOCK_WIDTH / NR_RENDER_TARGETS)); + ureg_imm1f(shader, BLOCK_WIDTH / idct->nr_of_render_targets)); ureg_MOV(shader, ureg_writemask(o_vpos, TGSI_WRITEMASK_XY), ureg_src(t_tex)); @@ -250,7 +248,7 @@ create_matrix_frag_shader(struct vl_idct *idct) struct ureg_src l_addr[2], r_addr[2]; struct ureg_dst l[4][2], r[2]; - struct ureg_dst fragment[NR_RENDER_TARGETS]; + struct ureg_dst fragment[idct->nr_of_render_targets]; unsigned i, j; @@ -264,7 +262,7 @@ create_matrix_frag_shader(struct vl_idct *idct) r_addr[0] = ureg_DECL_fs_input(shader, TGSI_SEMANTIC_GENERIC, VS_O_R_ADDR0, TGSI_INTERPOLATE_LINEAR); r_addr[1] = ureg_DECL_fs_input(shader, TGSI_SEMANTIC_GENERIC, VS_O_R_ADDR1, TGSI_INTERPOLATE_LINEAR); - for (i = 0; i < NR_RENDER_TARGETS; ++i) + for (i = 0; i < idct->nr_of_render_targets; ++i) fragment[i] = ureg_DECL_output(shader, TGSI_SEMANTIC_COLOR, i); for (i = 0; i < 4; ++i) { @@ -286,7 +284,7 @@ create_matrix_frag_shader(struct vl_idct *idct) fetch_four(shader, l[i], s_addr, ureg_DECL_sampler(shader, 1)); } - for (i = 0; i < NR_RENDER_TARGETS; ++i) { + for (i = 0; i < idct->nr_of_render_targets; ++i) { if(i > 0) increment_addr(shader, r, r_addr, true, true, i, BLOCK_HEIGHT); @@ -465,8 +463,8 @@ init_intermediate(struct vl_idct *idct, struct vl_idct_buffer *buffer) buffer->fb_state[0].width = tex->width0; buffer->fb_state[0].height = tex->height0; - buffer->fb_state[0].nr_cbufs = NR_RENDER_TARGETS; - for(i = 0; i < NR_RENDER_TARGETS; ++i) { + buffer->fb_state[0].nr_cbufs = idct->nr_of_render_targets; + for(i = 0; i < idct->nr_of_render_targets; ++i) { memset(&surf_templ, 0, sizeof(surf_templ)); surf_templ.format = tex->format; surf_templ.u.tex.first_layer = i; @@ -485,7 +483,7 @@ init_intermediate(struct vl_idct *idct, struct vl_idct_buffer *buffer) return true; error_surfaces: - for(i = 0; i < NR_RENDER_TARGETS; ++i) + for(i = 0; i < idct->nr_of_render_targets; ++i) pipe_surface_reference(&buffer->fb_state[0].cbufs[i], NULL); return false; @@ -498,7 +496,7 @@ cleanup_intermediate(struct vl_idct *idct, struct vl_idct_buffer *buffer) assert(idct && buffer); - for(i = 0; i < NR_RENDER_TARGETS; ++i) + for(i = 0; i < idct->nr_of_render_targets; ++i) pipe_surface_reference(&buffer->fb_state[0].cbufs[i], NULL); pipe_sampler_view_reference(&buffer->sampler_views.individual.intermediate, NULL); @@ -584,6 +582,7 @@ error_matrix: bool vl_idct_init(struct vl_idct *idct, struct pipe_context *pipe, unsigned buffer_width, unsigned buffer_height, unsigned blocks_x, unsigned blocks_y, + unsigned nr_of_render_targets, struct pipe_sampler_view *matrix) { assert(idct && pipe && matrix); @@ -593,6 +592,7 @@ bool vl_idct_init(struct vl_idct *idct, struct pipe_context *pipe, idct->buffer_height = buffer_height; idct->blocks_x = blocks_x; idct->blocks_y = blocks_y; + idct->nr_of_render_targets = nr_of_render_targets; pipe_sampler_view_reference(&idct->matrix, matrix); if(!init_shaders(idct)) @@ -666,7 +666,7 @@ vl_idct_cleanup_buffer(struct vl_idct *idct, struct vl_idct_buffer *buffer) assert(idct && buffer); - for(i = 0; i < NR_RENDER_TARGETS; ++i) + for(i = 0; i < idct->nr_of_render_targets; ++i) pipe_surface_reference(&buffer->fb_state[0].cbufs[i], NULL); pipe_surface_reference(&buffer->fb_state[1].cbufs[0], NULL); diff --git a/src/gallium/auxiliary/vl/vl_idct.h b/src/gallium/auxiliary/vl/vl_idct.h index 4ad798a855b..e695e32efe3 100644 --- a/src/gallium/auxiliary/vl/vl_idct.h +++ b/src/gallium/auxiliary/vl/vl_idct.h @@ -40,6 +40,7 @@ struct vl_idct unsigned buffer_width; unsigned buffer_height; unsigned blocks_x, blocks_y; + unsigned nr_of_render_targets; void *rs_state; @@ -75,6 +76,7 @@ struct pipe_sampler_view *vl_idct_upload_matrix(struct pipe_context *pipe, float bool vl_idct_init(struct vl_idct *idct, struct pipe_context *pipe, unsigned buffer_width, unsigned buffer_height, unsigned blocks_x, unsigned blocks_y, + unsigned nr_of_render_targets, struct pipe_sampler_view *matrix); /* destroy an idct instance */ diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c index afb69e9c3bf..6d0d132db20 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c @@ -311,7 +311,8 @@ vl_mpeg12_create_buffer(struct pipe_video_decoder *decoder) goto error_idct_source; buffer->idct_intermediate = vl_video_buffer_init(dec->base.context, dec->pipe, - dec->base.width / 4, dec->base.height / 4, 4, + dec->base.width / dec->nr_of_idct_render_targets, + dec->base.height / 4, dec->nr_of_idct_render_targets, dec->base.chroma_format, 3, idct_source_formats, PIPE_USAGE_STATIC); @@ -550,11 +551,13 @@ init_idct(struct vl_mpeg12_decoder *dec, unsigned buffer_width, unsigned buffer_ unsigned chroma_width, chroma_height, chroma_blocks_x, chroma_blocks_y; struct pipe_sampler_view *idct_matrix; + dec->nr_of_idct_render_targets = 4; + if (!(idct_matrix = vl_idct_upload_matrix(dec->pipe, sqrt(SCALE_FACTOR_16_TO_9)))) goto error_idct_matrix; if (!vl_idct_init(&dec->idct_y, dec->pipe, buffer_width, buffer_height, - 2, 2, idct_matrix)) + 2, 2, dec->nr_of_idct_render_targets, idct_matrix)) goto error_idct_y; if (dec->base.chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420) { @@ -575,7 +578,8 @@ init_idct(struct vl_mpeg12_decoder *dec, unsigned buffer_width, unsigned buffer_ } if(!vl_idct_init(&dec->idct_c, dec->pipe, chroma_width, chroma_height, - chroma_blocks_x, chroma_blocks_y, idct_matrix)) + chroma_blocks_x, chroma_blocks_y, + dec->nr_of_idct_render_targets, idct_matrix)) goto error_idct_c; pipe_sampler_view_reference(&idct_matrix, NULL); diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.h b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.h index 9be807198fe..c2eb7dd17de 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.h +++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.h @@ -45,6 +45,7 @@ struct vl_mpeg12_decoder struct pipe_context *pipe; const unsigned (*empty_block_mask)[3][2][2]; + unsigned nr_of_idct_render_targets; struct pipe_vertex_buffer quads; void *ves[VL_MAX_PLANES]; |