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

Ilia Mirkin imirkin at alum.mit.edu
Sat Sep 12 00:41:44 PDT 2015


On Sat, Sep 12, 2015 at 3:35 AM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> On Mon, Sep 7, 2015 at 8:15 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 | 8 ++++++++
>>  2 files changed, 11 insertions(+)
>>
>> diff --git a/src/gallium/drivers/nouveau/nouveau_vp3_video.h b/src/gallium/drivers/nouveau/nouveau_vp3_video.h
>> index 43b9556..87ae012 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 c1d70ea..7776e4e 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);
>>  }
>>
>> @@ -196,6 +198,8 @@ nouveau_vp3_fill_picparm_h264_bsp(struct nouveau_vp3_decoder *dec,
>>     struct h264_picparm_bsp stub_h = {}, *h = &stub_h;
>>     uint32_t caps = (d->slice_count << 4)&0xfff0;
>>
>> +   d->slice_count = dec->nb_slices;
>
> But caps above is already set based on d->slice_count. With this diff,
> vaapi works *much* better:
>
> diff --git a/src/gallium/drivers/nouveau/nouveau_vp3_video_bsp.c
> b/src/gallium/drivers/nouveau/nouveau_vp3_video_bsp.c
> index 7776e4e..7aa70e2 100644
> --- a/src/gallium/drivers/nouveau/nouveau_vp3_video_bsp.c
> +++ b/src/gallium/drivers/nouveau/nouveau_vp3_video_bsp.c
> @@ -196,11 +196,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;
>
> -   d->slice_count = dec->nb_slices;
> +   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;
>
>
> I'm not sure about the += -- can you investigate what the proper way
> of handling this is? Also note that you appear to have forgotten to do
> this for vc1.
>
> Very interesting by the way -- the vaapi decode does not have the same
> problem as the vdpau decode on that simpsons trailer. (About 28s in,
> when the sleigh is flying over the ravine.)

Errrr... nevermind. This in no way fixes the vaapi situation. I just
had a stale makefile. But the issue I point out above still seems
relevant.

>
>> +
>>     assert(!(d->slice_count & ~0xfff));
>>     if (d->slice_count & 0x1000)
>>        caps |= 1 << 20;
>> @@ -239,6 +243,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 +271,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 +338,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
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list