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 <leo....@amd.com>
---
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(&drv->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, &surf->templat) !=
VA_STATUS_SUCCESS) {
+ old_buf->destroy(old_buf);
mtx_unlock(&drv->mutex);
return VA_STATUS_ERROR_ALLOCATION_FAILED;
}
+ if (context->decoder->entrypoint ==
PIPE_VIDEO_ENTRYPOINT_ENCODE)
+ vl_compositor_yuv_deint(&drv->cstate, &drv->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 <leo....@amd.com>
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 <leo....@amd.com>
---
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, &surf->templat) != VA_STATUS_SUCCESS) {
+ old_buf->destroy(old_buf);
mtx_unlock(&drv->mutex);
return VA_STATUS_ERROR_ALLOCATION_FAILED;
}
+ if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE)
+ vl_compositor_yuv_deint(&drv->cstate, &drv->compositor, old_buf, surf->buffer);
+
+ old_buf->destroy(old_buf);
context->target = surf->buffer;
}
--
2.11.0
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev