[Mesa-dev] [PATCH v5 3/4] nouveau: fix chunk decoding by updating number of slices

Ilia Mirkin imirkin at alum.mit.edu
Wed Dec 16 20:16:06 PST 2015


Is there any guarantee that bsp_next is called a number of times equal
to the number of slices? Seems like it's just for appending on more
data, which may or may not be equal to the number of slices... Why is
the value in the descriptor wrong?

On Wed, Dec 16, 2015 at 9:40 AM, Julien Isorce <j.isorce at samsung.com> wrote:
> https://bugs.freedesktop.org/show_bug.cgi?id=89969
>
> Signed-off-by: Julien Isorce <j.isorce at samsung.com>
> ---
>  src/gallium/drivers/nouveau/nouveau_vp3_video.h     |  3 +++
>  src/gallium/drivers/nouveau/nouveau_vp3_video_bsp.c | 17 +++++++++++++++--
>  2 files changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/nouveau_vp3_video.h b/src/gallium/drivers/nouveau/nouveau_vp3_video.h
> index 1e10693..a826532 100644
> --- a/src/gallium/drivers/nouveau/nouveau_vp3_video.h
> +++ b/src/gallium/drivers/nouveau/nouveau_vp3_video.h
> @@ -121,6 +121,9 @@ struct nouveau_vp3_decoder {
>
>     /* Total data appended so far after last begin frame. */
>     unsigned bsp_size;
> +
> +   /* Number of slices so far since last begin frame */
> +   unsigned int nb_slices;
>  };
>
>  struct comm {
> diff --git a/src/gallium/drivers/nouveau/nouveau_vp3_video_bsp.c b/src/gallium/drivers/nouveau/nouveau_vp3_video_bsp.c
> index aab8e25..7a1dc8c 100644
> --- a/src/gallium/drivers/nouveau/nouveau_vp3_video_bsp.c
> +++ b/src/gallium/drivers/nouveau/nouveau_vp3_video_bsp.c
> @@ -128,6 +128,8 @@ nouveau_vp3_fill_picparm_mpeg12_bsp(struct nouveau_vp3_decoder *dec,
>     for (i = 0; i < 4; ++i)
>        pic_bsp->f_code[i/2][i%2] = desc->f_code[i/2][i%2] + 1; // FU
>
> +   desc->num_slices = dec->nb_slices;
> +
>     return (desc->num_slices << 4) | (dec->base.profile != PIPE_VIDEO_PROFILE_MPEG1);
>  }
>
> @@ -162,7 +164,11 @@ nouveau_vp3_fill_picparm_vc1_bsp(struct nouveau_vp3_decoder *dec,
>                                   char *map)
>  {
>     struct vc1_picparm_bsp *vc = (struct vc1_picparm_bsp *)map;
> -   uint32_t caps = (d->slice_count << 4)&0xfff0;
> +   uint32_t caps = 0;
> +
> +   d->slice_count = dec->nb_slices;
> +   caps = (d->slice_count << 4)&0xfff0;
> +
>     vc->width = dec->base.width;
>     vc->height = dec->base.height;
>     vc->profile = dec->base.profile - PIPE_VIDEO_PROFILE_VC1_SIMPLE; // 04
> @@ -194,9 +200,12 @@ nouveau_vp3_fill_picparm_h264_bsp(struct nouveau_vp3_decoder *dec,
>                                    char *map)
>  {
>     struct h264_picparm_bsp stub_h = {}, *h = &stub_h;
> -   uint32_t caps = (d->slice_count << 4)&0xfff0;
> +   uint32_t caps = 0;
> +
> +   d->slice_count = dec->nb_slices;
>
>     assert(!(d->slice_count & ~0xfff));
> +   caps = (d->slice_count << 4)&0xfff0;
>     if (d->slice_count & 0x1000)
>        caps |= 1 << 20;
>
> @@ -239,6 +248,7 @@ nouveau_vp3_bsp_begin(struct nouveau_vp3_decoder *dec)
>
>     dec->bsp_ptr = bsp_bo->map;
>     dec->bsp_size = NOUVEAU_VP3_BSP_RESERVED_SIZE;
> +   dec->nb_slices = 0;
>
>     dec->bsp_ptr += 0x100;
>
> @@ -266,6 +276,8 @@ nouveau_vp3_bsp_next(struct nouveau_vp3_decoder *dec, unsigned num_buffers,
>     struct strparm_bsp *str_bsp = NULL;
>     int i = 0;
>
> +   ++dec->nb_slices;
> +
>     bsp_origin += 0x100;
>     str_bsp = (struct strparm_bsp *)bsp_origin;
>
> @@ -331,6 +343,7 @@ nouveau_vp3_bsp_end(struct nouveau_vp3_decoder *dec, union pipe_desc desc)
>
>     dec->bsp_ptr = NULL;
>     dec->bsp_size = 0;
> +   dec->nb_slices = 0;
>
>     return caps;
>  }
> --
> 1.9.1
>


More information about the mesa-dev mailing list