radeon/uvd: use more sane defaults for bitstream buffer size
authorChristian König <christian.koenig@amd.com>
Sat, 7 Sep 2013 17:40:34 +0000 (11:40 -0600)
committerChristian König <christian.koenig@amd.com>
Thu, 12 Sep 2013 13:16:06 +0000 (15:16 +0200)
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
src/gallium/drivers/radeon/radeon_uvd.c

index 5e7eedbc70fbd8b6c2b12bb7f66534f719353afb..981d5c5f3264356270ca2ad87a7933fdcfd45649 100644 (file)
@@ -823,6 +823,7 @@ struct pipe_video_codec *ruvd_create_decoder(struct pipe_context *context,
 {
        unsigned dpb_size = calc_dpb_size(templ);
        unsigned width = templ->width, height = templ->height;
+       unsigned bs_buf_size;
        struct radeon_info info;
        struct ruvd_decoder *dec;
        struct ruvd_msg msg;
@@ -873,6 +874,7 @@ struct pipe_video_codec *ruvd_create_decoder(struct pipe_context *context,
                goto error;
        }
 
+       bs_buf_size = width * height * 512 / (16 * 16);
        for (i = 0; i < NUM_BUFFERS; ++i) {
                unsigned msg_fb_size = align(sizeof(struct ruvd_msg), 0x1000) + 0x1000;
                if (!create_buffer(dec, &dec->msg_fb_buffers[i], msg_fb_size)) {
@@ -880,7 +882,7 @@ struct pipe_video_codec *ruvd_create_decoder(struct pipe_context *context,
                        goto error;
                }
 
-               if (!create_buffer(dec, &dec->bs_buffers[i], 4096)) {
+               if (!create_buffer(dec, &dec->bs_buffers[i], bs_buf_size)) {
                        RUVD_ERR("Can't allocated bitstream buffers.\n");
                        goto error;
                }