mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-03 16:28:08 +02:00
frontends/va: use va interface for jpeg partial decode
add support to check jpeg crop decode cap and to set the crop rectangle. the interface is avialble on libva 1.21.0 and higher. v2: (Ruijing) enclose the entire case block within VA_CHECK_VERSION if attr unsupported set the return value to VA_ATTRIB_NOT_SUPPORTED Signed-off-by: Sathishkumar S <sathishkumar.sundararaju@amd.com> Reviewed-by: Leo Liu <leo.liu@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26588>
This commit is contained in:
parent
2f205caea4
commit
cd8ccba814
4 changed files with 33 additions and 0 deletions
|
|
@ -982,6 +982,11 @@ static int si_get_video_param(struct pipe_screen *screen, enum pipe_video_profil
|
|||
}
|
||||
case PIPE_VIDEO_CAP_SUPPORTS_CONTIGUOUS_PLANES_MAP:
|
||||
return true;
|
||||
case PIPE_VIDEO_CAP_ROI_CROP_DEC:
|
||||
if (codec == PIPE_VIDEO_FORMAT_JPEG &&
|
||||
sscreen->info.vcn_ip_version == VCN_4_0_3)
|
||||
return true;
|
||||
return false;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,6 +221,23 @@ vlVaGetConfigAttributes(VADriverContextP ctx, VAProfile profile, VAEntrypoint en
|
|||
PIPE_VIDEO_CAP_MAX_HEIGHT);
|
||||
value = value ? value : VA_ATTRIB_NOT_SUPPORTED;
|
||||
} break;
|
||||
#if VA_CHECK_VERSION(1, 21, 0)
|
||||
case VAConfigAttribDecJPEG:
|
||||
{
|
||||
VAConfigAttribValDecJPEG attr_jpeg = { .value = 0 };
|
||||
/* Check if ROI Decode is supported */
|
||||
int supportsCropDec =
|
||||
pscreen->get_video_param(pscreen, ProfileToPipe(profile),
|
||||
PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
|
||||
PIPE_VIDEO_CAP_ROI_CROP_DEC);
|
||||
if (supportsCropDec <= 0)
|
||||
value = VA_ATTRIB_NOT_SUPPORTED;
|
||||
else {
|
||||
attr_jpeg.bits.crop = 1;
|
||||
value = attr_jpeg.value;
|
||||
}
|
||||
} break;
|
||||
#endif
|
||||
default:
|
||||
value = VA_ATTRIB_NOT_SUPPORTED;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -57,10 +57,17 @@ void vlVaHandlePictureParameterBufferMJPEG(vlVaDriver *drv, vlVaContext *context
|
|||
|
||||
context->desc.mjpeg.picture_parameter.num_components = mjpeg->num_components;
|
||||
|
||||
#if VA_CHECK_VERSION(1, 21, 0)
|
||||
context->desc.mjpeg.picture_parameter.crop_x = mjpeg->crop_rectangle.x;
|
||||
context->desc.mjpeg.picture_parameter.crop_y = mjpeg->crop_rectangle.y;
|
||||
context->desc.mjpeg.picture_parameter.crop_width = mjpeg->crop_rectangle.width;
|
||||
context->desc.mjpeg.picture_parameter.crop_height = mjpeg->crop_rectangle.height;
|
||||
#else
|
||||
context->desc.mjpeg.picture_parameter.crop_x = mjpeg->va_reserved[0] & 0xffff;
|
||||
context->desc.mjpeg.picture_parameter.crop_y = (mjpeg->va_reserved[0] >> 16) & 0xffff;
|
||||
context->desc.mjpeg.picture_parameter.crop_width = mjpeg->va_reserved[1] & 0xffff;
|
||||
context->desc.mjpeg.picture_parameter.crop_height = (mjpeg->va_reserved[1] >> 16) & 0xffff;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -153,6 +153,10 @@ enum pipe_video_cap
|
|||
*/
|
||||
PIPE_VIDEO_CAP_ENC_INTRA_REFRESH_MAX_DURATION = 46,
|
||||
PIPE_VIDEO_CAP_ENC_H264_SUPPORTS_CABAC_ENCODE = 47,
|
||||
/*
|
||||
crop and partial decode support
|
||||
*/
|
||||
PIPE_VIDEO_CAP_ROI_CROP_DEC = 48,
|
||||
};
|
||||
|
||||
enum pipe_video_h264_enc_dbk_filter_mode_flags
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue