gallium: add new variable for video frame statistics
Video encoder previously reuses the associated_data variable to output
encoding statistics, but it ended up breaking when transcoding. This
commit adds a new variable just for statistics.
Fixes: 2d1bd619df ("frontends/va: add ability for encoder to output statistics")
Signed-off-by: Thong Thai <thong.thai@amd.com>
Reviewed-by: Boyuan Zhang <Boyuan.Zhang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20190>
This commit is contained in:
@@ -620,13 +620,13 @@ static void radeon_enc_encode_bitstream(struct pipe_video_codec *encoder,
|
||||
return;
|
||||
}
|
||||
|
||||
if (vid_buf->base.associated_data) {
|
||||
enc->get_buffer(vid_buf->base.associated_data, &enc->stats, NULL);
|
||||
if (vid_buf->base.statistics_data) {
|
||||
enc->get_buffer(vid_buf->base.statistics_data, &enc->stats, NULL);
|
||||
if (enc->stats->size < sizeof(rvcn_encode_stats_type_0_t)) {
|
||||
RVID_ERR("Encoder statistics output buffer is too small.\n");
|
||||
enc->stats = NULL;
|
||||
}
|
||||
vid_buf->base.associated_data = NULL;
|
||||
vid_buf->base.statistics_data = NULL;
|
||||
}
|
||||
else
|
||||
enc->stats = NULL;
|
||||
|
||||
@@ -702,7 +702,7 @@ handleVAStatsStatisticsBufferType(VADriverContextP ctx, vlVaContext *context, vl
|
||||
buf->derived_surface.resource = pipe_buffer_create(drv->pipe->screen, PIPE_BIND_VERTEX_BUFFER,
|
||||
PIPE_USAGE_STREAM, buf->size);
|
||||
|
||||
context->target->associated_data = buf->derived_surface.resource;
|
||||
context->target->statistics_data = buf->derived_surface.resource;
|
||||
|
||||
return VA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -168,6 +168,11 @@ struct pipe_video_buffer
|
||||
* destroy the associated data
|
||||
*/
|
||||
void (*destroy_associated_data)(void *associated_data);
|
||||
|
||||
/*
|
||||
* encoded frame statistics for this particular picture
|
||||
*/
|
||||
void *statistics_data;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user