From ded2a9a628c58c2c8bfaaf6b8dd213e68de1dd20 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20K=C3=B6nig?= Date: Wed, 1 Jun 2011 20:37:57 +0200 Subject: [PATCH] [g3dvl] respect maximum instruction for idct render targets --- src/gallium/auxiliary/vl/vl_mpeg12_decoder.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c index 30fdc758db8..35bf79261d3 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c @@ -709,15 +709,20 @@ init_zscan(struct vl_mpeg12_decoder *dec, const struct format_config* format_con static bool init_idct(struct vl_mpeg12_decoder *dec, const struct format_config* format_config) { - unsigned nr_of_idct_render_targets; + unsigned nr_of_idct_render_targets, max_inst; enum pipe_format formats[3]; struct pipe_sampler_view *matrix = NULL; nr_of_idct_render_targets = dec->pipe->screen->get_param(dec->pipe->screen, PIPE_CAP_MAX_RENDER_TARGETS); + max_inst = dec->pipe->screen->get_shader_param(dec->pipe->screen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_MAX_INSTRUCTIONS); - // more than 4 render targets usually doesn't makes any seens - nr_of_idct_render_targets = MIN2(nr_of_idct_render_targets, 4); + // Just assume we need 32 inst per render target, not 100% true, but should work in most cases + if (nr_of_idct_render_targets >= 4 && max_inst >= 32*4) + // more than 4 render targets usually doesn't makes any seens + nr_of_idct_render_targets = 4; + else + nr_of_idct_render_targets = 1; formats[0] = formats[1] = formats[2] = format_config->idct_source_format; dec->idct_source = vl_video_buffer_init(dec->base.context, dec->pipe, -- 2.30.2