Re: [Mesa-dev] [PATCH] st/va: move YUV content to deinterlaced buffer when reallocated for encoder
Leo Liu wrote: + } Should we bail out with an error here when it's the other way around? Although I cannot think of any of case that to get buffer Interlaced now, It's still a good idea to bail out here when it happnens Will add it in v4. It's not a error when case like buffer is deinterlaced, and interlaced result from query. What we need to do is to do nothing, just ignores. I have sent out v4, please ignore it, it won't work. Well that's not correct either. When the buffer is allocated as progressive and the codec doesn't supports that we should certainly do something. Either bail out as an error when we encode because we can't convert progressive->interlaced (just the other way around) and/or reallocate for decoding. Here is current situation for transcode Decoder allocate I buffers as preferred, then encoder prefers as P buffers , so re-allocated them to P buffers. and then next frame, decoder take P buffer, but not as preferred. 3 possible ways for decoder to go: 1. ignores the the Preferred, and keep buffer as P, and pipe goes. V3 2. go for Preferred, and then do endless alloc/dealloc frame by frame. V2 3. Bailout as error, the pipeline stops. V4 Won't have time to test till tomorrow but just getting one of the cases I thought may work with this, that couldn't work with the env, out. ffmpeg can (in theory anyway) do - hwdec -> hw deinterlace -> hw encode. Possible? Not sure about FFMpeg. Have you tried that before? I always use gstreamer for encode/transcode. The env existed before ffmpeg vaapi could do it, so I expected and got failiure. IIRC with the env = 0 hwdec -> hw deint -> copy back raw nv12 worked, but trying to get encode failed as expected without env = 1. It was a while ago I tried, IIRC it was possible to hang GPU. I guess the deint I don't know how, so haven't tried a gstreamer command that would do the same. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/va: move YUV content to deinterlaced buffer when reallocated for encoder
+ } Should we bail out with an error here when it's the other way around? Although I cannot think of any of case that to get buffer Interlaced now, It's still a good idea to bail out here when it happnens Will add it in v4. It's not a error when case like buffer is deinterlaced, and interlaced result from query. What we need to do is to do nothing, just ignores. I have sent out v4, please ignore it, it won't work. Well that's not correct either. When the buffer is allocated as progressive and the codec doesn't supports that we should certainly do something. Either bail out as an error when we encode because we can't convert progressive->interlaced (just the other way around) and/or reallocate for decoding. Here is current situation for transcode Decoder allocate I buffers as preferred, then encoder prefers as P buffers , so re-allocated them to P buffers. and then next frame, decoder take P buffer, but not as preferred. 3 possible ways for decoder to go: 1. ignores the the Preferred, and keep buffer as P, and pipe goes. V3 2. go for Preferred, and then do endless alloc/dealloc frame by frame. V2 3. Bailout as error, the pipeline stops. V4 Won't have time to test till tomorrow but just getting one of the cases I thought may work with this, that couldn't work with the env, out. ffmpeg can (in theory anyway) do - hwdec -> hw deinterlace -> hw encode. Possible? Not sure about FFMpeg. Have you tried that before? I always use gstreamer for encode/transcode. Regards, Leo ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/va: move YUV content to deinterlaced buffer when reallocated for encoder
Leo Liu wrote: On 08/25/2017 03:16 PM, Christian König wrote: Am 25.08.2017 um 17:15 schrieb Leo Liu: On 08/25/2017 10:53 AM, Leo Liu wrote: On 08/25/2017 02:57 AM, Christian König wrote: Am 24.08.2017 um 20:49 schrieb Leo Liu: v2: use deinterlace common function v3: make sure deinterlace only Signed-off-by: Leo Liu--- src/gallium/state_trackers/va/picture.c | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c index 6c3c4fe..aa4062d 100644 --- a/src/gallium/state_trackers/va/picture.c +++ b/src/gallium/state_trackers/va/picture.c @@ -613,17 +613,22 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) mtx_lock(>mutex); surf = handle_table_get(drv->htab, context->target_id); context->mpeg4.frame_num++; - screen = context->decoder->context->screen; interlaced = screen->get_video_param(screen, context->decoder->profile, context->decoder->entrypoint, PIPE_VIDEO_CAP_SUPPORTS_INTERLACED); if (surf->buffer->interlaced != interlaced) { - surf->templat.interlaced = screen->get_video_param(screen, context->decoder->profile, - PIPE_VIDEO_ENTRYPOINT_BITSTREAM, - PIPE_VIDEO_CAP_PREFERS_INTERLACED); - realloc = true; + interlaced = screen->get_video_param(screen, context->decoder->profile, + context->decoder->entrypoint, + PIPE_VIDEO_CAP_PREFERS_INTERLACED); + if (!interlaced) { + /* The current cases for buffer reallocation are +all from the interlaced to the deinterlaced, +and there is no case for the other way around */ + surf->templat.interlaced = false; + realloc = true; + } Should we bail out with an error here when it's the other way around? Although I cannot think of any of case that to get buffer Interlaced now, It's still a good idea to bail out here when it happnens Will add it in v4. It's not a error when case like buffer is deinterlaced, and interlaced result from query. What we need to do is to do nothing, just ignores. I have sent out v4, please ignore it, it won't work. Well that's not correct either. When the buffer is allocated as progressive and the codec doesn't supports that we should certainly do something. Either bail out as an error when we encode because we can't convert progressive->interlaced (just the other way around) and/or reallocate for decoding. Here is current situation for transcode Decoder allocate I buffers as preferred, then encoder prefers as P buffers , so re-allocated them to P buffers. and then next frame, decoder take P buffer, but not as preferred. 3 possible ways for decoder to go: 1. ignores the the Preferred, and keep buffer as P, and pipe goes. V3 2. go for Preferred, and then do endless alloc/dealloc frame by frame. V2 3. Bailout as error, the pipeline stops. V4 Won't have time to test till tomorrow but just getting one of the cases I thought may work with this, that couldn't work with the env, out. ffmpeg can (in theory anyway) do - hwdec -> hw deinterlace -> hw encode. Possible? ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/va: move YUV content to deinterlaced buffer when reallocated for encoder
On 08/25/2017 03:16 PM, Christian König wrote: Am 25.08.2017 um 17:15 schrieb Leo Liu: On 08/25/2017 10:53 AM, Leo Liu wrote: On 08/25/2017 02:57 AM, Christian König wrote: Am 24.08.2017 um 20:49 schrieb Leo Liu: v2: use deinterlace common function v3: make sure deinterlace only Signed-off-by: Leo Liu--- src/gallium/state_trackers/va/picture.c | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c index 6c3c4fe..aa4062d 100644 --- a/src/gallium/state_trackers/va/picture.c +++ b/src/gallium/state_trackers/va/picture.c @@ -613,17 +613,22 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) mtx_lock(>mutex); surf = handle_table_get(drv->htab, context->target_id); context->mpeg4.frame_num++; - screen = context->decoder->context->screen; interlaced = screen->get_video_param(screen, context->decoder->profile, context->decoder->entrypoint, PIPE_VIDEO_CAP_SUPPORTS_INTERLACED); if (surf->buffer->interlaced != interlaced) { - surf->templat.interlaced = screen->get_video_param(screen, context->decoder->profile, - PIPE_VIDEO_ENTRYPOINT_BITSTREAM, - PIPE_VIDEO_CAP_PREFERS_INTERLACED); - realloc = true; + interlaced = screen->get_video_param(screen, context->decoder->profile, + context->decoder->entrypoint, + PIPE_VIDEO_CAP_PREFERS_INTERLACED); + if (!interlaced) { + /* The current cases for buffer reallocation are +all from the interlaced to the deinterlaced, +and there is no case for the other way around */ + surf->templat.interlaced = false; + realloc = true; + } Should we bail out with an error here when it's the other way around? Although I cannot think of any of case that to get buffer Interlaced now, It's still a good idea to bail out here when it happnens Will add it in v4. It's not a error when case like buffer is deinterlaced, and interlaced result from query. What we need to do is to do nothing, just ignores. I have sent out v4, please ignore it, it won't work. Well that's not correct either. When the buffer is allocated as progressive and the codec doesn't supports that we should certainly do something. Either bail out as an error when we encode because we can't convert progressive->interlaced (just the other way around) and/or reallocate for decoding. Here is current situation for transcode Decoder allocate I buffers as preferred, then encoder prefers as P buffers , so re-allocated them to P buffers. and then next frame, decoder take P buffer, but not as preferred. 3 possible ways for decoder to go: 1. ignores the the Preferred, and keep buffer as P, and pipe goes. V3 2. go for Preferred, and then do endless alloc/dealloc frame by frame. V2 3. Bailout as error, the pipeline stops. V4 Regards, Leo Christian. Leo Thanks, Leo Would be nice if we could at least sanely handle that case. Apart from that it looks good to me, Christian. } if (u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_JPEG && @@ -640,13 +645,18 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) } if (realloc) { - surf->buffer->destroy(surf->buffer); + struct pipe_video_buffer *old_buf = surf->buffer; if (vlVaHandleSurfaceAllocate(ctx, surf, >templat) != VA_STATUS_SUCCESS) { + old_buf->destroy(old_buf); mtx_unlock(>mutex); return VA_STATUS_ERROR_ALLOCATION_FAILED; } + if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) + vl_compositor_yuv_deint(>cstate, >compositor, old_buf, surf->buffer); + + old_buf->destroy(old_buf); context->target = surf->buffer; } ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/va: move YUV content to deinterlaced buffer when reallocated for encoder
Am 25.08.2017 um 17:15 schrieb Leo Liu: On 08/25/2017 10:53 AM, Leo Liu wrote: On 08/25/2017 02:57 AM, Christian König wrote: Am 24.08.2017 um 20:49 schrieb Leo Liu: v2: use deinterlace common function v3: make sure deinterlace only Signed-off-by: Leo Liu--- src/gallium/state_trackers/va/picture.c | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c index 6c3c4fe..aa4062d 100644 --- a/src/gallium/state_trackers/va/picture.c +++ b/src/gallium/state_trackers/va/picture.c @@ -613,17 +613,22 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) mtx_lock(>mutex); surf = handle_table_get(drv->htab, context->target_id); context->mpeg4.frame_num++; - screen = context->decoder->context->screen; interlaced = screen->get_video_param(screen, context->decoder->profile, context->decoder->entrypoint, PIPE_VIDEO_CAP_SUPPORTS_INTERLACED); if (surf->buffer->interlaced != interlaced) { - surf->templat.interlaced = screen->get_video_param(screen, context->decoder->profile, - PIPE_VIDEO_ENTRYPOINT_BITSTREAM, - PIPE_VIDEO_CAP_PREFERS_INTERLACED); - realloc = true; + interlaced = screen->get_video_param(screen, context->decoder->profile, + context->decoder->entrypoint, + PIPE_VIDEO_CAP_PREFERS_INTERLACED); + if (!interlaced) { + /* The current cases for buffer reallocation are +all from the interlaced to the deinterlaced, +and there is no case for the other way around */ + surf->templat.interlaced = false; + realloc = true; + } Should we bail out with an error here when it's the other way around? Although I cannot think of any of case that to get buffer Interlaced now, It's still a good idea to bail out here when it happnens Will add it in v4. It's not a error when case like buffer is deinterlaced, and interlaced result from query. What we need to do is to do nothing, just ignores. I have sent out v4, please ignore it, it won't work. Well that's not correct either. When the buffer is allocated as progressive and the codec doesn't supports that we should certainly do something. Either bail out as an error when we encode because we can't convert progressive->interlaced (just the other way around) and/or reallocate for decoding. Christian. Leo Thanks, Leo Would be nice if we could at least sanely handle that case. Apart from that it looks good to me, Christian. } if (u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_JPEG && @@ -640,13 +645,18 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) } if (realloc) { - surf->buffer->destroy(surf->buffer); + struct pipe_video_buffer *old_buf = surf->buffer; if (vlVaHandleSurfaceAllocate(ctx, surf, >templat) != VA_STATUS_SUCCESS) { + old_buf->destroy(old_buf); mtx_unlock(>mutex); return VA_STATUS_ERROR_ALLOCATION_FAILED; } + if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) + vl_compositor_yuv_deint(>cstate, >compositor, old_buf, surf->buffer); + + old_buf->destroy(old_buf); context->target = surf->buffer; } ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/va: move YUV content to deinterlaced buffer when reallocated for encoder
On 08/25/2017 12:42 PM, Andy Furniss wrote: Leo Liu wrote: v2: use deinterlace common function v3: make sure deinterlace only Doesn't apply to master with git. I will attach you another one. should be good. Too much patches on the fly. Thanks, Leo patch was less fussy patch -p 1 < ~/Leo-va-interl-patches/02-3 patching file src/gallium/state_trackers/va/picture.c Hunk #1 succeeded at 619 with fuzz 1 (offset 6 lines). Hunk #2 succeeded at 662 (offset 17 lines). Signed-off-by: Leo Liu--- src/gallium/state_trackers/va/picture.c | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c index 6c3c4fe..aa4062d 100644 --- a/src/gallium/state_trackers/va/picture.c +++ b/src/gallium/state_trackers/va/picture.c @@ -613,17 +613,22 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) mtx_lock(>mutex); surf = handle_table_get(drv->htab, context->target_id); context->mpeg4.frame_num++; - screen = context->decoder->context->screen; interlaced = screen->get_video_param(screen, context->decoder->profile, context->decoder->entrypoint, PIPE_VIDEO_CAP_SUPPORTS_INTERLACED); if (surf->buffer->interlaced != interlaced) { - surf->templat.interlaced = screen->get_video_param(screen, context->decoder->profile, - PIPE_VIDEO_ENTRYPOINT_BITSTREAM, - PIPE_VIDEO_CAP_PREFERS_INTERLACED); - realloc = true; + interlaced = screen->get_video_param(screen, context->decoder->profile, + context->decoder->entrypoint, + PIPE_VIDEO_CAP_PREFERS_INTERLACED); + if (!interlaced) { + /* The current cases for buffer reallocation are +all from the interlaced to the deinterlaced, +and there is no case for the other way around */ + surf->templat.interlaced = false; + realloc = true; + } } if (u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_JPEG && @@ -640,13 +645,18 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) } if (realloc) { - surf->buffer->destroy(surf->buffer); + struct pipe_video_buffer *old_buf = surf->buffer; if (vlVaHandleSurfaceAllocate(ctx, surf, >templat) != VA_STATUS_SUCCESS) { + old_buf->destroy(old_buf); mtx_unlock(>mutex); return VA_STATUS_ERROR_ALLOCATION_FAILED; } + if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) + vl_compositor_yuv_deint(>cstate, >compositor, old_buf, surf->buffer); + + old_buf->destroy(old_buf); context->target = surf->buffer; } >From 0979afc77528557ed0e713b20c79ba91d142a889 Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Fri, 25 Aug 2017 10:49:43 -0400 Subject: [PATCH 2/3] st/va move YUV content to deinterlaced buffer When reallocation for encoder v2: use deinterlace common function v3: make sure deinterlace only Signed-off-by: Leo Liu --- src/gallium/state_trackers/va/picture.c | 21 - 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c index 47e63d3b30..74d741f91a 100644 --- a/src/gallium/state_trackers/va/picture.c +++ b/src/gallium/state_trackers/va/picture.c @@ -626,10 +626,16 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) PIPE_VIDEO_CAP_SUPPORTS_INTERLACED); if (surf->buffer->interlaced != interlaced) { - surf->templat.interlaced = screen->get_video_param(screen, context->decoder->profile, - PIPE_VIDEO_ENTRYPOINT_BITSTREAM, - PIPE_VIDEO_CAP_PREFERS_INTERLACED); - realloc = true; + interlaced = screen->get_video_param(screen, context->decoder->profile, + context->decoder->entrypoint, + PIPE_VIDEO_CAP_PREFERS_INTERLACED); + if (!interlaced) { + /* The current cases for buffer reallocation are +all from the interlaced to the deinterlaced, +and there is no case for the other way around */ + surf->templat.interlaced = false; + realloc = true; + } } format = screen->get_video_param(screen, context->decoder->profile, @@ -657,13 +663,18 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) } if (realloc) { - surf->buffer->destroy(surf->buffer); + struct pipe_video_buffer *old_buf = surf->buffer; if (vlVaHandleSurfaceAllocate(ctx, surf, >templat) != VA_STATUS_SUCCESS) { + old_buf->destroy(old_buf); mtx_unlock(>mutex); return VA_STATUS_ERROR_ALLOCATION_FAILED; } + if (context->decoder->entrypoint ==
Re: [Mesa-dev] [PATCH] st/va: move YUV content to deinterlaced buffer when reallocated for encoder
Leo Liu wrote: v2: use deinterlace common function v3: make sure deinterlace only Doesn't apply to master with git. patch was less fussy patch -p 1 < ~/Leo-va-interl-patches/02-3 patching file src/gallium/state_trackers/va/picture.c Hunk #1 succeeded at 619 with fuzz 1 (offset 6 lines). Hunk #2 succeeded at 662 (offset 17 lines). Signed-off-by: Leo Liu--- src/gallium/state_trackers/va/picture.c | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c index 6c3c4fe..aa4062d 100644 --- a/src/gallium/state_trackers/va/picture.c +++ b/src/gallium/state_trackers/va/picture.c @@ -613,17 +613,22 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) mtx_lock(>mutex); surf = handle_table_get(drv->htab, context->target_id); context->mpeg4.frame_num++; - screen = context->decoder->context->screen; interlaced = screen->get_video_param(screen, context->decoder->profile, context->decoder->entrypoint, PIPE_VIDEO_CAP_SUPPORTS_INTERLACED); if (surf->buffer->interlaced != interlaced) { - surf->templat.interlaced = screen->get_video_param(screen, context->decoder->profile, - PIPE_VIDEO_ENTRYPOINT_BITSTREAM, - PIPE_VIDEO_CAP_PREFERS_INTERLACED); - realloc = true; + interlaced = screen->get_video_param(screen, context->decoder->profile, + context->decoder->entrypoint, + PIPE_VIDEO_CAP_PREFERS_INTERLACED); + if (!interlaced) { + /* The current cases for buffer reallocation are +all from the interlaced to the deinterlaced, +and there is no case for the other way around */ + surf->templat.interlaced = false; + realloc = true; + } } if (u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_JPEG && @@ -640,13 +645,18 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) } if (realloc) { - surf->buffer->destroy(surf->buffer); + struct pipe_video_buffer *old_buf = surf->buffer; if (vlVaHandleSurfaceAllocate(ctx, surf, >templat) != VA_STATUS_SUCCESS) { + old_buf->destroy(old_buf); mtx_unlock(>mutex); return VA_STATUS_ERROR_ALLOCATION_FAILED; } + if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) + vl_compositor_yuv_deint(>cstate, >compositor, old_buf, surf->buffer); + + old_buf->destroy(old_buf); context->target = surf->buffer; } ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/va: move YUV content to deinterlaced buffer when reallocated for encoder
On 08/25/2017 10:53 AM, Leo Liu wrote: On 08/25/2017 02:57 AM, Christian König wrote: Am 24.08.2017 um 20:49 schrieb Leo Liu: v2: use deinterlace common function v3: make sure deinterlace only Signed-off-by: Leo Liu--- src/gallium/state_trackers/va/picture.c | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c index 6c3c4fe..aa4062d 100644 --- a/src/gallium/state_trackers/va/picture.c +++ b/src/gallium/state_trackers/va/picture.c @@ -613,17 +613,22 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) mtx_lock(>mutex); surf = handle_table_get(drv->htab, context->target_id); context->mpeg4.frame_num++; - screen = context->decoder->context->screen; interlaced = screen->get_video_param(screen, context->decoder->profile, context->decoder->entrypoint, PIPE_VIDEO_CAP_SUPPORTS_INTERLACED); if (surf->buffer->interlaced != interlaced) { - surf->templat.interlaced = screen->get_video_param(screen, context->decoder->profile, - PIPE_VIDEO_ENTRYPOINT_BITSTREAM, - PIPE_VIDEO_CAP_PREFERS_INTERLACED); - realloc = true; + interlaced = screen->get_video_param(screen, context->decoder->profile, + context->decoder->entrypoint, + PIPE_VIDEO_CAP_PREFERS_INTERLACED); + if (!interlaced) { + /* The current cases for buffer reallocation are +all from the interlaced to the deinterlaced, +and there is no case for the other way around */ + surf->templat.interlaced = false; + realloc = true; + } Should we bail out with an error here when it's the other way around? Although I cannot think of any of case that to get buffer Interlaced now, It's still a good idea to bail out here when it happnens Will add it in v4. It's not a error when case like buffer is deinterlaced, and interlaced result from query. What we need to do is to do nothing, just ignores. I have sent out v4, please ignore it, it won't work. Leo Thanks, Leo Would be nice if we could at least sanely handle that case. Apart from that it looks good to me, Christian. } if (u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_JPEG && @@ -640,13 +645,18 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) } if (realloc) { - surf->buffer->destroy(surf->buffer); + struct pipe_video_buffer *old_buf = surf->buffer; if (vlVaHandleSurfaceAllocate(ctx, surf, >templat) != VA_STATUS_SUCCESS) { + old_buf->destroy(old_buf); mtx_unlock(>mutex); return VA_STATUS_ERROR_ALLOCATION_FAILED; } + if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) + vl_compositor_yuv_deint(>cstate, >compositor, old_buf, surf->buffer); + + old_buf->destroy(old_buf); context->target = surf->buffer; } ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/va: move YUV content to deinterlaced buffer when reallocated for encoder
On 08/25/2017 02:57 AM, Christian König wrote: Am 24.08.2017 um 20:49 schrieb Leo Liu: v2: use deinterlace common function v3: make sure deinterlace only Signed-off-by: Leo Liu--- src/gallium/state_trackers/va/picture.c | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c index 6c3c4fe..aa4062d 100644 --- a/src/gallium/state_trackers/va/picture.c +++ b/src/gallium/state_trackers/va/picture.c @@ -613,17 +613,22 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) mtx_lock(>mutex); surf = handle_table_get(drv->htab, context->target_id); context->mpeg4.frame_num++; - screen = context->decoder->context->screen; interlaced = screen->get_video_param(screen, context->decoder->profile, context->decoder->entrypoint, PIPE_VIDEO_CAP_SUPPORTS_INTERLACED); if (surf->buffer->interlaced != interlaced) { - surf->templat.interlaced = screen->get_video_param(screen, context->decoder->profile, - PIPE_VIDEO_ENTRYPOINT_BITSTREAM, - PIPE_VIDEO_CAP_PREFERS_INTERLACED); - realloc = true; + interlaced = screen->get_video_param(screen, context->decoder->profile, + context->decoder->entrypoint, + PIPE_VIDEO_CAP_PREFERS_INTERLACED); + if (!interlaced) { + /* The current cases for buffer reallocation are +all from the interlaced to the deinterlaced, +and there is no case for the other way around */ + surf->templat.interlaced = false; + realloc = true; + } Should we bail out with an error here when it's the other way around? Although I cannot think of any of case that to get buffer Interlaced now, It's still a good idea to bail out here when it happnens Will add it in v4. Thanks, Leo Would be nice if we could at least sanely handle that case. Apart from that it looks good to me, Christian. } if (u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_JPEG && @@ -640,13 +645,18 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) } if (realloc) { - surf->buffer->destroy(surf->buffer); + struct pipe_video_buffer *old_buf = surf->buffer; if (vlVaHandleSurfaceAllocate(ctx, surf, >templat) != VA_STATUS_SUCCESS) { + old_buf->destroy(old_buf); mtx_unlock(>mutex); return VA_STATUS_ERROR_ALLOCATION_FAILED; } + if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) + vl_compositor_yuv_deint(>cstate, >compositor, old_buf, surf->buffer); + + old_buf->destroy(old_buf); context->target = surf->buffer; } ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/va: move YUV content to deinterlaced buffer when reallocated for encoder
Am 24.08.2017 um 20:49 schrieb Leo Liu: v2: use deinterlace common function v3: make sure deinterlace only Signed-off-by: Leo Liu--- src/gallium/state_trackers/va/picture.c | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c index 6c3c4fe..aa4062d 100644 --- a/src/gallium/state_trackers/va/picture.c +++ b/src/gallium/state_trackers/va/picture.c @@ -613,17 +613,22 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) mtx_lock(>mutex); surf = handle_table_get(drv->htab, context->target_id); context->mpeg4.frame_num++; - screen = context->decoder->context->screen; interlaced = screen->get_video_param(screen, context->decoder->profile, context->decoder->entrypoint, PIPE_VIDEO_CAP_SUPPORTS_INTERLACED); if (surf->buffer->interlaced != interlaced) { - surf->templat.interlaced = screen->get_video_param(screen, context->decoder->profile, - PIPE_VIDEO_ENTRYPOINT_BITSTREAM, - PIPE_VIDEO_CAP_PREFERS_INTERLACED); - realloc = true; + interlaced = screen->get_video_param(screen, context->decoder->profile, + context->decoder->entrypoint, + PIPE_VIDEO_CAP_PREFERS_INTERLACED); + if (!interlaced) { + /* The current cases for buffer reallocation are +all from the interlaced to the deinterlaced, +and there is no case for the other way around */ + surf->templat.interlaced = false; + realloc = true; + } Should we bail out with an error here when it's the other way around? Would be nice if we could at least sanely handle that case. Apart from that it looks good to me, Christian. } if (u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_JPEG && @@ -640,13 +645,18 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) } if (realloc) { - surf->buffer->destroy(surf->buffer); + struct pipe_video_buffer *old_buf = surf->buffer; if (vlVaHandleSurfaceAllocate(ctx, surf, >templat) != VA_STATUS_SUCCESS) { + old_buf->destroy(old_buf); mtx_unlock(>mutex); return VA_STATUS_ERROR_ALLOCATION_FAILED; } + if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) + vl_compositor_yuv_deint(>cstate, >compositor, old_buf, surf->buffer); + + old_buf->destroy(old_buf); context->target = surf->buffer; } ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] st/va: move YUV content to deinterlaced buffer when reallocated for encoder
v2: use deinterlace common function v3: make sure deinterlace only Signed-off-by: Leo Liu--- src/gallium/state_trackers/va/picture.c | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c index 6c3c4fe..aa4062d 100644 --- a/src/gallium/state_trackers/va/picture.c +++ b/src/gallium/state_trackers/va/picture.c @@ -613,17 +613,22 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) mtx_lock(>mutex); surf = handle_table_get(drv->htab, context->target_id); context->mpeg4.frame_num++; - screen = context->decoder->context->screen; interlaced = screen->get_video_param(screen, context->decoder->profile, context->decoder->entrypoint, PIPE_VIDEO_CAP_SUPPORTS_INTERLACED); if (surf->buffer->interlaced != interlaced) { - surf->templat.interlaced = screen->get_video_param(screen, context->decoder->profile, - PIPE_VIDEO_ENTRYPOINT_BITSTREAM, - PIPE_VIDEO_CAP_PREFERS_INTERLACED); - realloc = true; + interlaced = screen->get_video_param(screen, context->decoder->profile, + context->decoder->entrypoint, + PIPE_VIDEO_CAP_PREFERS_INTERLACED); + if (!interlaced) { + /* The current cases for buffer reallocation are +all from the interlaced to the deinterlaced, +and there is no case for the other way around */ + surf->templat.interlaced = false; + realloc = true; + } } if (u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_JPEG && @@ -640,13 +645,18 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) } if (realloc) { - surf->buffer->destroy(surf->buffer); + struct pipe_video_buffer *old_buf = surf->buffer; if (vlVaHandleSurfaceAllocate(ctx, surf, >templat) != VA_STATUS_SUCCESS) { + old_buf->destroy(old_buf); mtx_unlock(>mutex); return VA_STATUS_ERROR_ALLOCATION_FAILED; } + if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) + vl_compositor_yuv_deint(>cstate, >compositor, old_buf, surf->buffer); + + old_buf->destroy(old_buf); context->target = surf->buffer; } -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev