Re: [Mesa-dev] [PATCH] st/va: remove assert for single slice
On Sat, Feb 11, 2017 at 12:00 AM, Andy Furnisswrote: > Nayan Deshmukh wrote: >> >> Hi Andy, >> >> I am attaching the patches. >> Does it cause any difference in the corruption in this video? >> >> https://drive.google.com/drive/folders/0BxP5-S1t9VEEbkR4dWhTUFozV2s >> > > Hi, it seems mpv and ffmpeg have been changing their vaapi code recently. > > With an old mpv the corruption is the same as without the patches. > > With git mpv the patches cause a segfault - > I will the see the changes in the code to see what's the problem. Christian, please push the patch that you reviewed. Regards, Nayan > Program received signal SIGSEGV, Segmentation fault. > 0x710bbe8e in __memcpy_sse2_unaligned () from /lib/libc.so.6 > (gdb) bt > #0 0x710bbe8e in __memcpy_sse2_unaligned () from /lib/libc.so.6 > #1 0x7fffe423f4e0 in ruvd_decode_bitstream (decoder=0x226dcb0, > target=, picture=, num_buffers= out>, buffers=, sizes=) at radeon_uvd.c:1029 > #2 0x7fffe40f37cb in handleVASliceDataBufferType (buf=, > context=0x2236290) at picture.c:323 > #3 vlVaRenderPicture (ctx=, context_id=, > buffers=, num_buffers=) at picture.c:518 > #4 0x00cba28e in ff_vaapi_decode_issue () > #5 0x008f8dac in vaapi_mpeg2_end_frame () > #6 0x007635cc in decode_chunks () > #7 0x007648e7 in mpeg_decode_frame () > #8 0x008daa53 in avcodec_decode_video2 () > #9 0x008db780 in do_decode () > #10 0x008dc650 in avcodec_send_packet () > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/va: remove assert for single slice
Nayan Deshmukh wrote: Hi Andy, I am attaching the patches. Does it cause any difference in the corruption in this video? https://drive.google.com/drive/folders/0BxP5-S1t9VEEbkR4dWhTUFozV2s Hi, it seems mpv and ffmpeg have been changing their vaapi code recently. With an old mpv the corruption is the same as without the patches. With git mpv the patches cause a segfault - Program received signal SIGSEGV, Segmentation fault. 0x710bbe8e in __memcpy_sse2_unaligned () from /lib/libc.so.6 (gdb) bt #0 0x710bbe8e in __memcpy_sse2_unaligned () from /lib/libc.so.6 #1 0x7fffe423f4e0 in ruvd_decode_bitstream (decoder=0x226dcb0, target=, picture=, num_buffers=out>, buffers=, sizes=) at radeon_uvd.c:1029 #2 0x7fffe40f37cb in handleVASliceDataBufferType (buf=out>, context=0x2236290) at picture.c:323 #3 vlVaRenderPicture (ctx=, context_id=, buffers=, num_buffers=) at picture.c:518 #4 0x00cba28e in ff_vaapi_decode_issue () #5 0x008f8dac in vaapi_mpeg2_end_frame () #6 0x007635cc in decode_chunks () #7 0x007648e7 in mpeg_decode_frame () #8 0x008daa53 in avcodec_decode_video2 () #9 0x008db780 in do_decode () #10 0x008dc650 in avcodec_send_packet () ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/va: remove assert for single slice
Hi Andy, I am attaching the patches. Does it cause any difference in the corruption in this video? https://drive.google.com/drive/folders/0BxP5-S1t9VEEbkR4dWhTUFozV2s Regards, Nayan On Fri, Feb 10, 2017 at 11:15 PM, Andy Furnisswrote: > Nayan Deshmukh wrote: > Any ideas why? I am attaching the diff for reference. >>> >>> >>> >>> Could be that the shader based decoder has a bug with multiple slices as >>> well. >>> >> It could be. Andy can you test it with your hardware decoder to see if >> its specific >> to shader decoder. > > > Can you re-send or attach anything you want me to try to the bug. > > The diff in here is too corrupt to apply. > > It's a long time since I used shader decode (on rv790 before it got uvd). > > IIRC there were samples that were a bit wrong - but then that was > testing with vdpau. > > From 4e99ae5a79c60ceae8d1942fc6a9b66704221452 Mon Sep 17 00:00:00 2001 From: Nayan Deshmukh Date: Tue, 31 Jan 2017 10:45:20 +0530 Subject: [PATCH 1/2] st/va: remove assert for single slice we anyway allow for multiple slices v2: do not remove assert to check for buf->size Signed-off-by: Nayan Deshmukh --- src/gallium/state_trackers/va/picture_mpeg12.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/va/picture_mpeg12.c b/src/gallium/state_trackers/va/picture_mpeg12.c index 812e9e5..1e5a9c7 100644 --- a/src/gallium/state_trackers/va/picture_mpeg12.c +++ b/src/gallium/state_trackers/va/picture_mpeg12.c @@ -81,6 +81,6 @@ void vlVaHandleIQMatrixBufferMPEG12(vlVaContext *context, vlVaBuffer *buf) void vlVaHandleSliceParameterBufferMPEG12(vlVaContext *context, vlVaBuffer *buf) { - assert(buf->size >= sizeof(VASliceParameterBufferMPEG2) && buf->num_elements == 1); + assert(buf->size >= sizeof(VASliceParameterBufferMPEG2)); context->desc.mpeg12.num_slices += buf->num_elements; } -- 2.9.3 From 516c54ed7ab608f69fb50b554a28cc59015ddba7 Mon Sep 17 00:00:00 2001 From: Nayan Deshmukh Date: Mon, 6 Feb 2017 00:37:03 +0530 Subject: [PATCH 2/2] st/va: use the slice size provided in VASliceParameterBuffer Signed-off-by: Nayan Deshmukh --- src/gallium/state_trackers/va/picture.c| 19 +-- src/gallium/state_trackers/va/picture_mpeg12.c | 11 +++ src/gallium/state_trackers/va/va_private.h | 1 + 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c index 82584ea..8e68e35 100644 --- a/src/gallium/state_trackers/va/picture.c +++ b/src/gallium/state_trackers/va/picture.c @@ -262,8 +262,10 @@ handleVASliceDataBufferType(vlVaContext *context, vlVaBuffer *buf) { enum pipe_video_format format; unsigned num_buffers = 0; - void * const *buffers[2]; - unsigned sizes[2]; + void * const *buffers[context->desc.mpeg12.num_slices + 1]; + unsigned sizes[context->desc.mpeg12.num_slices + 1]; + char *cur; + int i; static const uint8_t start_code_h264[] = { 0x00, 0x00, 0x01 }; static const uint8_t start_code_h265[] = { 0x00, 0x00, 0x01 }; static const uint8_t start_code_vc1[] = { 0x00, 0x00, 0x01, 0x0d }; @@ -306,9 +308,12 @@ handleVASliceDataBufferType(vlVaContext *context, vlVaBuffer *buf) break; } - buffers[num_buffers] = buf->data; - sizes[num_buffers] = buf->size; - ++num_buffers; + cur = buf->data; + for (i = 0; i < context->desc.mpeg12.num_slices; ++i) { + buffers[i] = cur; + cur = cur + context->sizes[i]; + } + if (context->needs_begin_frame) { context->decoder->begin_frame(context->decoder, context->target, @@ -316,7 +321,8 @@ handleVASliceDataBufferType(vlVaContext *context, vlVaBuffer *buf) context->needs_begin_frame = false; } context->decoder->decode_bitstream(context->decoder, context->target, >desc.base, - num_buffers, (const void * const*)buffers, sizes); + context->desc.mpeg12.num_slices, (const void * const*)buffers, context->sizes); + } static VAStatus @@ -586,6 +592,7 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) } context->decoder->end_frame(context->decoder, context->target, >desc.base); + FREE(context->sizes); if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) { int idr_period = context->desc.h264enc.gop_size / context->gop_coeff; int p_remain_in_idr = idr_period - context->desc.h264enc.frame_num; diff --git a/src/gallium/state_trackers/va/picture_mpeg12.c b/src/gallium/state_trackers/va/picture_mpeg12.c index 1e5a9c7..b9d8667 100644 --- a/src/gallium/state_trackers/va/picture_mpeg12.c +++ b/src/gallium/state_trackers/va/picture_mpeg12.c @@ -82,5 +82,16 @@ void vlVaHandleIQMatrixBufferMPEG12(vlVaContext *context, vlVaBuffer *buf) void vlVaHandleSliceParameterBufferMPEG12(vlVaContext *context, vlVaBuffer *buf)
Re: [Mesa-dev] [PATCH] st/va: remove assert for single slice
Nayan Deshmukh wrote: Any ideas why? I am attaching the diff for reference. Could be that the shader based decoder has a bug with multiple slices as well. It could be. Andy can you test it with your hardware decoder to see if its specific to shader decoder. Can you re-send or attach anything you want me to try to the bug. The diff in here is too corrupt to apply. It's a long time since I used shader decode (on rv790 before it got uvd). IIRC there were samples that were a bit wrong - but then that was testing with vdpau. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/va: remove assert for single slice
On Fri, Feb 10, 2017 at 5:09 PM, Christian Königwrote: > Sorry for the delay, as noted in the other mail I was on sick leave for a > while. > > > Am 03.02.2017 um 05:52 schrieb Nayan Deshmukh: >> >> On Thu, Feb 2, 2017 at 3:34 PM, Christian König >> wrote: >>> >>> Am 01.02.2017 um 13:59 schrieb Nayan Deshmukh: we anyway allow for multiple slices Signed-off-by: Nayan Deshmukh --- src/gallium/state_trackers/va/picture_mpeg12.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gallium/state_trackers/va/picture_mpeg12.c b/src/gallium/state_trackers/va/picture_mpeg12.c index 812e9e5..4d9c45f 100644 --- a/src/gallium/state_trackers/va/picture_mpeg12.c +++ b/src/gallium/state_trackers/va/picture_mpeg12.c @@ -81,6 +81,5 @@ void vlVaHandleIQMatrixBufferMPEG12(vlVaContext *context, vlVaBuffer *buf) void vlVaHandleSliceParameterBufferMPEG12(vlVaContext *context, vlVaBuffer *buf) { - assert(buf->size >= sizeof(VASliceParameterBufferMPEG2) && buf->num_elements == 1); >>> >>> >>> NAK, we can lower the requirements here, but we shouldn't completely >>> remove >>> the assert. >>> >>> Especially since we ignore all of the fields from the >>> VASliceParameterBufferMPEG2 structure and so won't catch errors. >>> >> I agree, we should have some assert here. >> >>> Please test something like the following: >>> >>> assert(buf->size >= (sizeof(VASliceParameterBufferMPEG2) * >>> buf->num_elements)); >>> >> buf->size represents the size of a single buffer element and hence it >> will be equal to sizeof(VASliceParameterBufferMPEG2). So we can have >> something like >> >> assert(buf->size >= sizeof(VASliceParameterBufferMPEG2)) > > > Sounds like a good idea to me, please send that out as a patch. > >> >> I also tried using the fields of the VASliceParameterBufferMPEG2. I >> misunderstood >> the code first, as mpv sends all the slices at ones and buf->data points >> to >> num_elements number of VASliceParameterBuffers. I tried using this >> size fields with the slice data buffers, but surprisingly it leads to no >> change. >> Any ideas why? I am attaching the diff for reference. > > > Could be that the shader based decoder has a bug with multiple slices as > well. > It could be. Andy can you test it with your hardware decoder to see if its specific to shader decoder. > Another possibility is that the other slices are missing the start code. Do we need to add any specific start code for MPEG2 vids as we don't add anything in the va state tracker? > > Do you have a screenshoot of the problem? And maybe a dump of what is in the > VASliceParameterBufferMPEG2 buffers and in your bitstream buffer? > Here is the link for the video that I am using; https://drive.google.com/drive/folders/0BxP5-S1t9VEEbkR4dWhTUFozV2s Regards, Nayan > Regards, > Christian. > > >> >> Which means that bug https://bugs.freedesktop.org/show_bug.cgi?id=93760 >> is still open. >> >> Regards, >> Nayan >> >> diff --git a/src/gallium/state_trackers/va/picture.c >> b/src/gallium/state_trackers/va/picture.c >> index 82584ea..8e68e35 100644 >> --- a/src/gallium/state_trackers/va/picture.c >> +++ b/src/gallium/state_trackers/va/picture.c >> @@ -262,8 +262,10 @@ handleVASliceDataBufferType(vlVaContext *context, >> vlVaBuffer *buf) >> { >> enum pipe_video_format format; >> unsigned num_buffers = 0; >> - void * const *buffers[2]; >> - unsigned sizes[2]; >> + void * const *buffers[context->desc.mpeg12.num_slices + 1]; >> + unsigned sizes[context->desc.mpeg12.num_slices + 1]; >> + char *cur; >> + int i; >> static const uint8_t start_code_h264[] = { 0x00, 0x00, 0x01 }; >> static const uint8_t start_code_h265[] = { 0x00, 0x00, 0x01 }; >> static const uint8_t start_code_vc1[] = { 0x00, 0x00, 0x01, 0x0d }; >> @@ -306,9 +308,12 @@ handleVASliceDataBufferType(vlVaContext *context, >> vlVaBuffer *buf) >> break; >> } >> >> - buffers[num_buffers] = buf->data; >> - sizes[num_buffers] = buf->size; >> - ++num_buffers; >> + cur = buf->data; >> + for (i = 0; i < context->desc.mpeg12.num_slices; ++i) { >> + buffers[i] = cur; >> + cur = cur + context->sizes[i]; >> + } >> + >> >> if (context->needs_begin_frame) { >> context->decoder->begin_frame(context->decoder, context->target, >> @@ -316,7 +321,8 @@ handleVASliceDataBufferType(vlVaContext *context, >> vlVaBuffer *buf) >> context->needs_begin_frame = false; >> } >> context->decoder->decode_bitstream(context->decoder, >> context->target, >desc.base, >> - num_buffers, (const void * const*)buffers, sizes); >> + context->desc.mpeg12.num_slices, (const void * const*)buffers, >> context->sizes); >> + >> } >> >> static VAStatus >> @@ -586,6 +592,7 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID >> context_id) >> } >> >>
Re: [Mesa-dev] [PATCH] st/va: remove assert for single slice
Sorry for the delay, as noted in the other mail I was on sick leave for a while. Am 03.02.2017 um 05:52 schrieb Nayan Deshmukh: On Thu, Feb 2, 2017 at 3:34 PM, Christian Königwrote: Am 01.02.2017 um 13:59 schrieb Nayan Deshmukh: we anyway allow for multiple slices Signed-off-by: Nayan Deshmukh --- src/gallium/state_trackers/va/picture_mpeg12.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gallium/state_trackers/va/picture_mpeg12.c b/src/gallium/state_trackers/va/picture_mpeg12.c index 812e9e5..4d9c45f 100644 --- a/src/gallium/state_trackers/va/picture_mpeg12.c +++ b/src/gallium/state_trackers/va/picture_mpeg12.c @@ -81,6 +81,5 @@ void vlVaHandleIQMatrixBufferMPEG12(vlVaContext *context, vlVaBuffer *buf) void vlVaHandleSliceParameterBufferMPEG12(vlVaContext *context, vlVaBuffer *buf) { - assert(buf->size >= sizeof(VASliceParameterBufferMPEG2) && buf->num_elements == 1); NAK, we can lower the requirements here, but we shouldn't completely remove the assert. Especially since we ignore all of the fields from the VASliceParameterBufferMPEG2 structure and so won't catch errors. I agree, we should have some assert here. Please test something like the following: assert(buf->size >= (sizeof(VASliceParameterBufferMPEG2) * buf->num_elements)); buf->size represents the size of a single buffer element and hence it will be equal to sizeof(VASliceParameterBufferMPEG2). So we can have something like assert(buf->size >= sizeof(VASliceParameterBufferMPEG2)) Sounds like a good idea to me, please send that out as a patch. I also tried using the fields of the VASliceParameterBufferMPEG2. I misunderstood the code first, as mpv sends all the slices at ones and buf->data points to num_elements number of VASliceParameterBuffers. I tried using this size fields with the slice data buffers, but surprisingly it leads to no change. Any ideas why? I am attaching the diff for reference. Could be that the shader based decoder has a bug with multiple slices as well. Another possibility is that the other slices are missing the start code. Do you have a screenshoot of the problem? And maybe a dump of what is in the VASliceParameterBufferMPEG2 buffers and in your bitstream buffer? Regards, Christian. Which means that bug https://bugs.freedesktop.org/show_bug.cgi?id=93760 is still open. Regards, Nayan diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c index 82584ea..8e68e35 100644 --- a/src/gallium/state_trackers/va/picture.c +++ b/src/gallium/state_trackers/va/picture.c @@ -262,8 +262,10 @@ handleVASliceDataBufferType(vlVaContext *context, vlVaBuffer *buf) { enum pipe_video_format format; unsigned num_buffers = 0; - void * const *buffers[2]; - unsigned sizes[2]; + void * const *buffers[context->desc.mpeg12.num_slices + 1]; + unsigned sizes[context->desc.mpeg12.num_slices + 1]; + char *cur; + int i; static const uint8_t start_code_h264[] = { 0x00, 0x00, 0x01 }; static const uint8_t start_code_h265[] = { 0x00, 0x00, 0x01 }; static const uint8_t start_code_vc1[] = { 0x00, 0x00, 0x01, 0x0d }; @@ -306,9 +308,12 @@ handleVASliceDataBufferType(vlVaContext *context, vlVaBuffer *buf) break; } - buffers[num_buffers] = buf->data; - sizes[num_buffers] = buf->size; - ++num_buffers; + cur = buf->data; + for (i = 0; i < context->desc.mpeg12.num_slices; ++i) { + buffers[i] = cur; + cur = cur + context->sizes[i]; + } + if (context->needs_begin_frame) { context->decoder->begin_frame(context->decoder, context->target, @@ -316,7 +321,8 @@ handleVASliceDataBufferType(vlVaContext *context, vlVaBuffer *buf) context->needs_begin_frame = false; } context->decoder->decode_bitstream(context->decoder, context->target, >desc.base, - num_buffers, (const void * const*)buffers, sizes); + context->desc.mpeg12.num_slices, (const void * const*)buffers, context->sizes); + } static VAStatus @@ -586,6 +592,7 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) } context->decoder->end_frame(context->decoder, context->target, >desc.base); + FREE(context->sizes); if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) { int idr_period = context->desc.h264enc.gop_size / context->gop_coeff; int p_remain_in_idr = idr_period - context->desc.h264enc.frame_num; diff --git a/src/gallium/state_trackers/va/picture_mpeg12.c b/src/gallium/state_trackers/va/picture_mpeg12.c index 4d9c45f..9e51274 100644 --- a/src/gallium/state_trackers/va/picture_mpeg12.c +++ b/src/gallium/state_trackers/va/picture_mpeg12.c @@ -81,5 +81,16 @@ void vlVaHandleIQMatrixBufferMPEG12(vlVaContext *context, vlVaBuffer *buf) void vlVaHandleSliceParameterBufferMPEG12(vlVaContext *context, vlVaBuffer *buf) { + VASliceParameterBufferMPEG2 *mpeg2 = buf->data; + unsigned *sizes =
Re: [Mesa-dev] [PATCH] st/va: remove assert for single slice
On Thu, Feb 2, 2017 at 3:34 PM, Christian Königwrote: > Am 01.02.2017 um 13:59 schrieb Nayan Deshmukh: >> >> we anyway allow for multiple slices >> >> Signed-off-by: Nayan Deshmukh >> --- >> src/gallium/state_trackers/va/picture_mpeg12.c | 1 - >> 1 file changed, 1 deletion(-) >> >> diff --git a/src/gallium/state_trackers/va/picture_mpeg12.c >> b/src/gallium/state_trackers/va/picture_mpeg12.c >> index 812e9e5..4d9c45f 100644 >> --- a/src/gallium/state_trackers/va/picture_mpeg12.c >> +++ b/src/gallium/state_trackers/va/picture_mpeg12.c >> @@ -81,6 +81,5 @@ void vlVaHandleIQMatrixBufferMPEG12(vlVaContext >> *context, vlVaBuffer *buf) >> void vlVaHandleSliceParameterBufferMPEG12(vlVaContext *context, >> vlVaBuffer *buf) >> { >> - assert(buf->size >= sizeof(VASliceParameterBufferMPEG2) && >> buf->num_elements == 1); > > > NAK, we can lower the requirements here, but we shouldn't completely remove > the assert. > > Especially since we ignore all of the fields from the > VASliceParameterBufferMPEG2 structure and so won't catch errors. > I agree, we should have some assert here. > Please test something like the following: > > assert(buf->size >= (sizeof(VASliceParameterBufferMPEG2) * > buf->num_elements)); > buf->size represents the size of a single buffer element and hence it will be equal to sizeof(VASliceParameterBufferMPEG2). So we can have something like assert(buf->size >= sizeof(VASliceParameterBufferMPEG2)) I also tried using the fields of the VASliceParameterBufferMPEG2. I misunderstood the code first, as mpv sends all the slices at ones and buf->data points to num_elements number of VASliceParameterBuffers. I tried using this size fields with the slice data buffers, but surprisingly it leads to no change. Any ideas why? I am attaching the diff for reference. Which means that bug https://bugs.freedesktop.org/show_bug.cgi?id=93760 is still open. Regards, Nayan diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c index 82584ea..8e68e35 100644 --- a/src/gallium/state_trackers/va/picture.c +++ b/src/gallium/state_trackers/va/picture.c @@ -262,8 +262,10 @@ handleVASliceDataBufferType(vlVaContext *context, vlVaBuffer *buf) { enum pipe_video_format format; unsigned num_buffers = 0; - void * const *buffers[2]; - unsigned sizes[2]; + void * const *buffers[context->desc.mpeg12.num_slices + 1]; + unsigned sizes[context->desc.mpeg12.num_slices + 1]; + char *cur; + int i; static const uint8_t start_code_h264[] = { 0x00, 0x00, 0x01 }; static const uint8_t start_code_h265[] = { 0x00, 0x00, 0x01 }; static const uint8_t start_code_vc1[] = { 0x00, 0x00, 0x01, 0x0d }; @@ -306,9 +308,12 @@ handleVASliceDataBufferType(vlVaContext *context, vlVaBuffer *buf) break; } - buffers[num_buffers] = buf->data; - sizes[num_buffers] = buf->size; - ++num_buffers; + cur = buf->data; + for (i = 0; i < context->desc.mpeg12.num_slices; ++i) { + buffers[i] = cur; + cur = cur + context->sizes[i]; + } + if (context->needs_begin_frame) { context->decoder->begin_frame(context->decoder, context->target, @@ -316,7 +321,8 @@ handleVASliceDataBufferType(vlVaContext *context, vlVaBuffer *buf) context->needs_begin_frame = false; } context->decoder->decode_bitstream(context->decoder, context->target, >desc.base, - num_buffers, (const void * const*)buffers, sizes); + context->desc.mpeg12.num_slices, (const void * const*)buffers, context->sizes); + } static VAStatus @@ -586,6 +592,7 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) } context->decoder->end_frame(context->decoder, context->target, >desc.base); + FREE(context->sizes); if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) { int idr_period = context->desc.h264enc.gop_size / context->gop_coeff; int p_remain_in_idr = idr_period - context->desc.h264enc.frame_num; diff --git a/src/gallium/state_trackers/va/picture_mpeg12.c b/src/gallium/state_trackers/va/picture_mpeg12.c index 4d9c45f..9e51274 100644 --- a/src/gallium/state_trackers/va/picture_mpeg12.c +++ b/src/gallium/state_trackers/va/picture_mpeg12.c @@ -81,5 +81,16 @@ void vlVaHandleIQMatrixBufferMPEG12(vlVaContext *context, vlVaBuffer *buf) void vlVaHandleSliceParameterBufferMPEG12(vlVaContext *context, vlVaBuffer *buf) { + VASliceParameterBufferMPEG2 *mpeg2 = buf->data; + unsigned *sizes = MALLOC(buf->num_elements * sizeof(unsigned)); + int i; + context->desc.mpeg12.num_slices += buf->num_elements; + + for(i = 0; i < buf->num_elements; ++i) { + sizes[i] = mpeg2->slice_data_size; + mpeg2 = mpeg2 + 1; + } + + context->sizes = sizes; } diff --git a/src/gallium/state_trackers/va/va_private.h b/src/gallium/state_trackers/va/va_private.h index a744461..47cb65e 100644 --- a/src/gallium/state_trackers/va/va_private.h +++
Re: [Mesa-dev] [PATCH] st/va: remove assert for single slice
Am 01.02.2017 um 13:59 schrieb Nayan Deshmukh: we anyway allow for multiple slices Signed-off-by: Nayan Deshmukh--- src/gallium/state_trackers/va/picture_mpeg12.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gallium/state_trackers/va/picture_mpeg12.c b/src/gallium/state_trackers/va/picture_mpeg12.c index 812e9e5..4d9c45f 100644 --- a/src/gallium/state_trackers/va/picture_mpeg12.c +++ b/src/gallium/state_trackers/va/picture_mpeg12.c @@ -81,6 +81,5 @@ void vlVaHandleIQMatrixBufferMPEG12(vlVaContext *context, vlVaBuffer *buf) void vlVaHandleSliceParameterBufferMPEG12(vlVaContext *context, vlVaBuffer *buf) { - assert(buf->size >= sizeof(VASliceParameterBufferMPEG2) && buf->num_elements == 1); NAK, we can lower the requirements here, but we shouldn't completely remove the assert. Especially since we ignore all of the fields from the VASliceParameterBufferMPEG2 structure and so won't catch errors. Please test something like the following: assert(buf->size >= (sizeof(VASliceParameterBufferMPEG2) * buf->num_elements)); Regards, Christian. context->desc.mpeg12.num_slices += buf->num_elements; } ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] st/va: remove assert for single slice
we anyway allow for multiple slices Signed-off-by: Nayan Deshmukh--- src/gallium/state_trackers/va/picture_mpeg12.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gallium/state_trackers/va/picture_mpeg12.c b/src/gallium/state_trackers/va/picture_mpeg12.c index 812e9e5..4d9c45f 100644 --- a/src/gallium/state_trackers/va/picture_mpeg12.c +++ b/src/gallium/state_trackers/va/picture_mpeg12.c @@ -81,6 +81,5 @@ void vlVaHandleIQMatrixBufferMPEG12(vlVaContext *context, vlVaBuffer *buf) void vlVaHandleSliceParameterBufferMPEG12(vlVaContext *context, vlVaBuffer *buf) { - assert(buf->size >= sizeof(VASliceParameterBufferMPEG2) && buf->num_elements == 1); context->desc.mpeg12.num_slices += buf->num_elements; } -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev