frontends/va: Stop reallocating according to JPEG sampling factor
Tested with FFmpeg 7.1, it uses correct formats for each sampling factor, so this has been fixed and is not needed anymore. Reviewed-by: Leo Liu <leo.liu@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32089>
This commit is contained in:
@@ -1185,41 +1185,6 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
|
||||
|
||||
screen = context->decoder->context->screen;
|
||||
|
||||
if (u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_JPEG) {
|
||||
if (surf->buffer->buffer_format == PIPE_FORMAT_NV12 &&
|
||||
context->mjpeg.sampling_factor != MJPEG_SAMPLING_FACTOR_NV12) {
|
||||
/* workaround to reallocate surface buffer with right format
|
||||
* if it doesnt match with sampling_factor. ffmpeg doesnt
|
||||
* use VASurfaceAttribPixelFormat and defaults to NV12.
|
||||
*/
|
||||
switch (context->mjpeg.sampling_factor) {
|
||||
case MJPEG_SAMPLING_FACTOR_YUV422:
|
||||
case MJPEG_SAMPLING_FACTOR_YUY2:
|
||||
surf->templat.buffer_format = PIPE_FORMAT_YUYV;
|
||||
break;
|
||||
case MJPEG_SAMPLING_FACTOR_YUV444:
|
||||
surf->templat.buffer_format = PIPE_FORMAT_Y8_U8_V8_444_UNORM;
|
||||
break;
|
||||
case MJPEG_SAMPLING_FACTOR_YUV400:
|
||||
surf->templat.buffer_format = PIPE_FORMAT_Y8_400_UNORM;
|
||||
break;
|
||||
default:
|
||||
mtx_unlock(&drv->mutex);
|
||||
return VA_STATUS_ERROR_INVALID_SURFACE;
|
||||
}
|
||||
realloc = true;
|
||||
}
|
||||
/* check if format is supported before proceeding with realloc,
|
||||
* also avoid submission if hardware doesnt support the format and
|
||||
* applcation failed to check the supported rt_formats.
|
||||
*/
|
||||
if (!screen->is_video_format_supported(screen, surf->templat.buffer_format,
|
||||
PIPE_VIDEO_PROFILE_JPEG_BASELINE, PIPE_VIDEO_ENTRYPOINT_BITSTREAM)) {
|
||||
mtx_unlock(&drv->mutex);
|
||||
return VA_STATUS_ERROR_INVALID_SURFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((bool)(surf->templat.bind & PIPE_BIND_PROTECTED) != context->desc.base.protected_playback) {
|
||||
mtx_unlock(&drv->mutex);
|
||||
return VA_STATUS_ERROR_INVALID_SURFACE;
|
||||
|
||||
Reference in New Issue
Block a user