frontends/va: function process_frame has return value

if the video post-processing is failed with some reason, the flow can
fall back to use shader/gfx to perform the processing.

Signed-off-by: Peyton Lee <peytolee@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32106>
This commit is contained in:
Peyton Lee
2024-11-13 16:42:24 +08:00
committed by Marge Bot
parent efe62ee03f
commit 8ee52b5e23
6 changed files with 16 additions and 12 deletions

View File

@@ -202,7 +202,7 @@ trace_video_codec_encode_bitstream(struct pipe_video_codec *_codec,
codec->encode_bitstream(codec, source, destination, feedback);
}
static void
static int
trace_video_codec_process_frame(struct pipe_video_codec *_codec,
struct pipe_video_buffer *_source,
const struct pipe_vpp_desc *process_properties)
@@ -219,6 +219,7 @@ trace_video_codec_process_frame(struct pipe_video_codec *_codec,
trace_dump_call_end();
codec->process_frame(codec, source, process_properties);
return 0;
}
static int

View File

@@ -185,7 +185,7 @@ d3d12_video_processor_end_frame(struct pipe_video_codec * codec,
return 0;
}
void
int
d3d12_video_processor_process_frame(struct pipe_video_codec *codec,
struct pipe_video_buffer *input_texture,
const struct pipe_vpp_desc *process_properties)
@@ -284,6 +284,7 @@ d3d12_video_processor_process_frame(struct pipe_video_codec *codec,
/// Flush work to the GPU and blocking wait until GPU finishes
///
pD3D12Proc->m_needsGPUFlush = true;
return 0;
}
void

View File

@@ -53,7 +53,7 @@ d3d12_video_processor_begin_frame(struct pipe_video_codec * codec,
/**
* Perform post-process effect
*/
void
int
d3d12_video_processor_process_frame(struct pipe_video_codec *codec,
struct pipe_video_buffer *input_texture,
const struct pipe_vpp_desc *process_properties);

View File

@@ -726,7 +726,7 @@ si_vpe_cs_add_surface_buffer(struct vpe_video_processor *vpeproc,
}
}
static void
static int
si_vpe_processor_process_frame(struct pipe_video_codec *codec,
struct pipe_video_buffer *input_texture,
const struct pipe_vpp_desc *process_properties)
@@ -747,7 +747,7 @@ si_vpe_processor_process_frame(struct pipe_video_codec *codec,
src_surfaces = input_texture->get_surfaces(input_texture);
if (!src_surfaces || !src_surfaces[0]) {
SIVPE_ERR("Get source surface failed\n");
return;
return 1;
}
vpeproc->src_surfaces = src_surfaces;
@@ -756,12 +756,12 @@ si_vpe_processor_process_frame(struct pipe_video_codec *codec,
build_param->num_streams = 1;
if (build_param->num_streams > VPE_STREAM_MAX_NUM) {
SIVPE_ERR("Can only suppport %d stream(s) now\n", VPE_STREAM_MAX_NUM);
return;
return 1;
}
if (!build_param->streams) {
SIVPE_ERR("Streams structure is not allocated\n");
return;
return 1;
}
si_vpe_set_surface_info(vpeproc,
@@ -854,7 +854,7 @@ si_vpe_processor_process_frame(struct pipe_video_codec *codec,
PIPE_MAP_WRITE | RADEON_MAP_TEMPORARY);
if (!vpe_ptr) {
SIVPE_ERR("Mapping Embbuf failed\n");
return;
return 1;
}
vpeproc->vpe_build_bufs->emb_buf.cpu_va = (uintptr_t)vpe_ptr;
vpeproc->vpe_build_bufs->emb_buf.gpu_va = vpeproc->ws->buffer_get_virtual_address(emb_buf->res->buf);
@@ -990,12 +990,12 @@ si_vpe_processor_process_frame(struct pipe_video_codec *codec,
si_vpe_cs_add_surface_buffer(vpeproc, vpeproc->dst_surfaces, RADEON_USAGE_WRITE);
SIVPE_DBG(vpeproc->log_level, "Success\n");
return;
return 0;
fail:
vpeproc->ws->buffer_unmap(vpeproc->ws, emb_buf->res->buf);
SIVPE_ERR("Failed\n");
return;
return 1;
}
static int

View File

@@ -341,7 +341,9 @@ static VAStatus vlVaVidEngineBlit(vlVaDriver *drv, vlVaContext *context,
&context->desc.base);
context->needs_begin_frame = false;
}
context->decoder->process_frame(context->decoder, src, &context->desc.vidproc);
if (context->decoder->process_frame(context->decoder, src, &context->desc.vidproc))
return VA_STATUS_ERROR_OPERATION_FAILED;
return VA_STATUS_SUCCESS;
}

View File

@@ -98,7 +98,7 @@ struct pipe_video_codec
/**
* Perform post-process effect
*/
void (*process_frame)(struct pipe_video_codec *codec,
int (*process_frame)(struct pipe_video_codec *codec,
struct pipe_video_buffer *source,
const struct pipe_vpp_desc *process_properties);