Mesa (pipe-video): [g3dvl] respect maximum instruction for idct render targets

Christian König deathsimple at kemper.freedesktop.org
Wed Jun 1 12:52:30 PDT 2011


Module: Mesa
Branch: pipe-video
Commit: ded2a9a628c58c2c8bfaaf6b8dd213e68de1dd20
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ded2a9a628c58c2c8bfaaf6b8dd213e68de1dd20

Author: Christian König <deathsimple at vodafone.de>
Date:   Wed Jun  1 20:37:57 2011 +0200

[g3dvl] respect maximum instruction for idct render targets

---

 src/gallium/auxiliary/vl/vl_mpeg12_decoder.c |   11 ++++++++---
 1 files 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 30fdc75..35bf792 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,



More information about the mesa-commit mailing list