mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
frontends/va: pass in film_grain_target as new output
In av1 film grain case, to use the film_grain_target
as the output, instead of target buffer, which is kept
as the input for DPB processing in film_grain output
scenario.
CC: 22.3
Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20139>
(cherry picked from commit af695149e9)
This commit is contained in:
parent
df124acd48
commit
13872b0434
2 changed files with 39 additions and 4 deletions
|
|
@ -5836,7 +5836,7 @@
|
|||
"description": "frontends/va: pass in film_grain_target as new output",
|
||||
"nominated": false,
|
||||
"nomination_type": null,
|
||||
"resolution": 4,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null
|
||||
},
|
||||
|
|
|
|||
|
|
@ -795,6 +795,25 @@ vlVaRenderPicture(VADriverContextP ctx, VAContextID context_id, VABufferID *buff
|
|||
return vaStatus;
|
||||
}
|
||||
|
||||
static bool vlVaQueryApplyFilmGrainAV1(vlVaContext *context,
|
||||
int *output_id,
|
||||
struct pipe_video_buffer ***out_target)
|
||||
{
|
||||
struct pipe_av1_picture_desc *av1 = NULL;
|
||||
|
||||
if (u_reduce_video_profile(context->templat.profile) != PIPE_VIDEO_FORMAT_AV1 ||
|
||||
context->decoder->entrypoint != PIPE_VIDEO_ENTRYPOINT_BITSTREAM)
|
||||
return false;
|
||||
|
||||
av1 = &context->desc.av1;
|
||||
if (!av1->picture_parameter.film_grain_info.film_grain_info_fields.apply_grain)
|
||||
return false;
|
||||
|
||||
*output_id = av1->picture_parameter.current_frame_id;
|
||||
*out_target = &av1->film_grain_target;
|
||||
return true;
|
||||
}
|
||||
|
||||
VAStatus
|
||||
vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
|
||||
{
|
||||
|
|
@ -806,7 +825,10 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
|
|||
struct pipe_screen *screen;
|
||||
bool supported;
|
||||
bool realloc = false;
|
||||
bool apply_av1_fg = false;
|
||||
enum pipe_format format;
|
||||
struct pipe_video_buffer **out_target;
|
||||
int output_id;
|
||||
|
||||
if (!ctx)
|
||||
return VA_STATUS_ERROR_INVALID_CONTEXT;
|
||||
|
|
@ -829,8 +851,20 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
|
|||
return VA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
output_id = context->target_id;
|
||||
out_target = &context->target;
|
||||
apply_av1_fg = vlVaQueryApplyFilmGrainAV1(context, &output_id, &out_target);
|
||||
|
||||
mtx_lock(&drv->mutex);
|
||||
surf = handle_table_get(drv->htab, context->target_id);
|
||||
surf = handle_table_get(drv->htab, output_id);
|
||||
if (!surf || !surf->buffer)
|
||||
return VA_STATUS_ERROR_INVALID_SURFACE;
|
||||
|
||||
if (apply_av1_fg) {
|
||||
surf->ctx = context_id;
|
||||
*out_target = surf->buffer;
|
||||
}
|
||||
|
||||
context->mpeg4.frame_num++;
|
||||
|
||||
screen = context->decoder->context->screen;
|
||||
|
|
@ -904,7 +938,8 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
|
|||
}
|
||||
|
||||
if (u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_AV1 &&
|
||||
surf->buffer->buffer_format == PIPE_FORMAT_NV12) {
|
||||
surf->buffer->buffer_format == PIPE_FORMAT_NV12 &&
|
||||
context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_BITSTREAM) {
|
||||
if (context->desc.av1.picture_parameter.bit_depth_idx == 1) {
|
||||
surf->templat.buffer_format = PIPE_FORMAT_P010;
|
||||
realloc = true;
|
||||
|
|
@ -938,7 +973,7 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
|
|||
}
|
||||
|
||||
old_buf->destroy(old_buf);
|
||||
context->target = surf->buffer;
|
||||
*out_target = surf->buffer;
|
||||
}
|
||||
|
||||
if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue