gallium/vl: wrap codec support checks in a common function.
This just is an initial wrapping of all calls into the driver to check for codec support. The idea is to add more to this function to support the meson level disables. Acked-by: Christian König <christian.koenig@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15258>
This commit is contained in:
parent
de99a11172
commit
20dfdcde71
|
@ -426,6 +426,8 @@ endif
|
|||
files_libgalliumvl = files(
|
||||
'vl/vl_bicubic_filter.c',
|
||||
'vl/vl_bicubic_filter.h',
|
||||
'vl/vl_codec.c',
|
||||
'vl/vl_codec.h',
|
||||
'vl/vl_compositor.c',
|
||||
'vl/vl_compositor.h',
|
||||
'vl/vl_compositor_gfx.c',
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2022 Red Hat
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
**************************************************************************/
|
||||
#include "pipe/p_video_codec.h"
|
||||
|
||||
#include "vl_codec.h"
|
||||
|
||||
bool vl_codec_supported(struct pipe_screen *screen,
|
||||
enum pipe_video_profile profile,
|
||||
bool encode)
|
||||
{
|
||||
return screen->get_video_param(screen, profile, encode ? PIPE_VIDEO_ENTRYPOINT_ENCODE : PIPE_VIDEO_ENTRYPOINT_BITSTREAM, PIPE_VIDEO_CAP_SUPPORTED);
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2022 Red Hat
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
**************************************************************************/
|
||||
#ifndef VL_CODEC_H
|
||||
#define VL_CODEC_H
|
||||
|
||||
struct pipe_screen;
|
||||
|
||||
bool vl_codec_supported(struct pipe_screen *pscreen,
|
||||
enum pipe_video_profile profile,
|
||||
bool encode);
|
||||
|
||||
#endif
|
|
@ -30,6 +30,8 @@
|
|||
#include "util/u_video.h"
|
||||
#include "vl/vl_video_buffer.h"
|
||||
|
||||
#include "vl/vl_codec.h"
|
||||
|
||||
#include "entrypoint.h"
|
||||
#include "vid_dec.h"
|
||||
#include "vid_dec_av1.h"
|
||||
|
@ -2133,8 +2135,7 @@ static struct dec_av1_task *dec_av1_BeginFrame(vid_dec_PrivateType *priv)
|
|||
pscreen = omx_screen->pscreen;
|
||||
assert(pscreen);
|
||||
|
||||
supported = pscreen->get_video_param(pscreen, priv->profile,
|
||||
PIPE_VIDEO_ENTRYPOINT_BITSTREAM, PIPE_VIDEO_CAP_SUPPORTED);
|
||||
supported = vl_codec_supported(pscreen, priv->profile, false);
|
||||
assert(supported && "AV1 is not supported");
|
||||
|
||||
templat.profile = priv->profile;
|
||||
|
|
|
@ -50,6 +50,8 @@
|
|||
#include "pipe/p_video_codec.h"
|
||||
#include "util/u_memory.h"
|
||||
|
||||
#include "vl/vl_codec.h"
|
||||
|
||||
#include "entrypoint.h"
|
||||
#include "vid_enc.h"
|
||||
#include "vid_omx_common.h"
|
||||
|
@ -153,8 +155,7 @@ static OMX_ERRORTYPE vid_enc_Constructor(OMX_COMPONENTTYPE *comp, OMX_STRING nam
|
|||
return OMX_ErrorInsufficientResources;
|
||||
|
||||
screen = priv->screen->pscreen;
|
||||
if (!screen->get_video_param(screen, PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH,
|
||||
PIPE_VIDEO_ENTRYPOINT_ENCODE, PIPE_VIDEO_CAP_SUPPORTED))
|
||||
if (!vl_codec_supported(screen, PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH, true))
|
||||
return OMX_ErrorBadParameter;
|
||||
|
||||
priv->s_pipe = pipe_create_multimedia_context(screen);
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include "pipe/p_video_codec.h"
|
||||
#include "util/u_memory.h"
|
||||
|
||||
#include "vl/vl_codec.h"
|
||||
|
||||
#include "entrypoint.h"
|
||||
#include "h264e.h"
|
||||
#include "h264eprc.h"
|
||||
|
@ -399,8 +401,7 @@ static OMX_ERRORTYPE h264e_prc_create_encoder(void *ap_obj)
|
|||
return OMX_ErrorInsufficientResources;
|
||||
|
||||
screen = priv->screen->pscreen;
|
||||
if (!screen->get_video_param(screen, PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH,
|
||||
PIPE_VIDEO_ENTRYPOINT_ENCODE, PIPE_VIDEO_CAP_SUPPORTED))
|
||||
if (!vl_codec_supported(screen, PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH, true))
|
||||
return OMX_ErrorBadParameter;
|
||||
|
||||
priv->s_pipe = pipe_create_multimedia_context(screen);
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "util/u_memory.h"
|
||||
|
||||
#include "vl/vl_winsys.h"
|
||||
#include "vl/vl_codec.h"
|
||||
|
||||
#include "va_private.h"
|
||||
|
||||
|
@ -56,8 +57,8 @@ vlVaQueryConfigProfiles(VADriverContextP ctx, VAProfile *profile_list, int *num_
|
|||
if (u_reduce_video_profile(p) == PIPE_VIDEO_FORMAT_MPEG4 && !debug_get_option_mpeg4())
|
||||
continue;
|
||||
|
||||
if (pscreen->get_video_param(pscreen, p, PIPE_VIDEO_ENTRYPOINT_BITSTREAM, PIPE_VIDEO_CAP_SUPPORTED) ||
|
||||
pscreen->get_video_param(pscreen, p, PIPE_VIDEO_ENTRYPOINT_ENCODE, PIPE_VIDEO_CAP_SUPPORTED)) {
|
||||
if (vl_codec_supported(pscreen, p, false) ||
|
||||
vl_codec_supported(pscreen, p, true)) {
|
||||
vap = PipeToProfile(p);
|
||||
if (vap != VAProfileNone)
|
||||
profile_list[(*num_profiles)++] = vap;
|
||||
|
@ -94,12 +95,10 @@ vlVaQueryConfigEntrypoints(VADriverContextP ctx, VAProfile profile,
|
|||
return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
|
||||
|
||||
pscreen = VL_VA_PSCREEN(ctx);
|
||||
if (pscreen->get_video_param(pscreen, p, PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
|
||||
PIPE_VIDEO_CAP_SUPPORTED))
|
||||
if (vl_codec_supported(pscreen, p, false))
|
||||
entrypoint_list[(*num_entrypoints)++] = VAEntrypointVLD;
|
||||
|
||||
if (pscreen->get_video_param(pscreen, p, PIPE_VIDEO_ENTRYPOINT_ENCODE,
|
||||
PIPE_VIDEO_CAP_SUPPORTED))
|
||||
if (vl_codec_supported(pscreen, p, true))
|
||||
entrypoint_list[(*num_entrypoints)++] = VAEntrypointEncSlice;
|
||||
|
||||
if (*num_entrypoints == 0)
|
||||
|
@ -125,8 +124,7 @@ vlVaGetConfigAttributes(VADriverContextP ctx, VAProfile profile, VAEntrypoint en
|
|||
for (i = 0; i < num_attribs; ++i) {
|
||||
unsigned int value;
|
||||
if ((entrypoint == VAEntrypointVLD) &&
|
||||
(pscreen->get_video_param(pscreen, ProfileToPipe(profile),
|
||||
PIPE_VIDEO_ENTRYPOINT_BITSTREAM, PIPE_VIDEO_CAP_SUPPORTED))) {
|
||||
(vl_codec_supported(pscreen, ProfileToPipe(profile), false))) {
|
||||
switch (attrib_list[i].type) {
|
||||
case VAConfigAttribRTFormat:
|
||||
value = VA_RT_FORMAT_YUV420 | VA_RT_FORMAT_YUV422;
|
||||
|
@ -143,8 +141,7 @@ vlVaGetConfigAttributes(VADriverContextP ctx, VAProfile profile, VAEntrypoint en
|
|||
break;
|
||||
}
|
||||
} else if ((entrypoint == VAEntrypointEncSlice) &&
|
||||
(pscreen->get_video_param(pscreen, ProfileToPipe(profile),
|
||||
PIPE_VIDEO_ENTRYPOINT_ENCODE, PIPE_VIDEO_CAP_SUPPORTED))) {
|
||||
(vl_codec_supported(pscreen, ProfileToPipe(profile), true))) {
|
||||
switch (attrib_list[i].type) {
|
||||
case VAConfigAttribRTFormat:
|
||||
value = VA_RT_FORMAT_YUV420;
|
||||
|
@ -271,8 +268,7 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoin
|
|||
switch (entrypoint) {
|
||||
case VAEntrypointVLD:
|
||||
supported_rt_formats = VA_RT_FORMAT_YUV420 | VA_RT_FORMAT_YUV422;
|
||||
if (!pscreen->get_video_param(pscreen, p, PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
|
||||
PIPE_VIDEO_CAP_SUPPORTED)) {
|
||||
if (!vl_codec_supported(pscreen, p, false)) {
|
||||
FREE(config);
|
||||
return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
|
||||
}
|
||||
|
@ -282,8 +278,7 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoin
|
|||
|
||||
case VAEntrypointEncSlice:
|
||||
supported_rt_formats = VA_RT_FORMAT_YUV420;
|
||||
if (!pscreen->get_video_param(pscreen, p, PIPE_VIDEO_ENTRYPOINT_ENCODE,
|
||||
PIPE_VIDEO_CAP_SUPPORTED)) {
|
||||
if (!vl_codec_supported(pscreen, p, true)) {
|
||||
FREE(config);
|
||||
return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include "util/vl_vlc.h"
|
||||
|
||||
#include "vl/vl_codec.h"
|
||||
#include "vdpau_private.h"
|
||||
|
||||
/**
|
||||
|
@ -73,13 +74,7 @@ vlVdpDecoderCreate(VdpDevice device,
|
|||
|
||||
mtx_lock(&dev->mutex);
|
||||
|
||||
supported = screen->get_video_param
|
||||
(
|
||||
screen,
|
||||
templat.profile,
|
||||
PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
|
||||
PIPE_VIDEO_CAP_SUPPORTED
|
||||
);
|
||||
supported = vl_codec_supported(screen, templat.profile, false);
|
||||
if (!supported) {
|
||||
mtx_unlock(&dev->mutex);
|
||||
return VDP_STATUS_INVALID_DECODER_PROFILE;
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include "pipe/p_defines.h"
|
||||
#include "util/u_debug.h"
|
||||
|
||||
#include "vl/vl_codec.h"
|
||||
|
||||
/**
|
||||
* Retrieve the VDPAU version implemented by the backend.
|
||||
*/
|
||||
|
@ -196,8 +198,7 @@ vlVdpDecoderQueryCapabilities(VdpDevice device, VdpDecoderProfile profile,
|
|||
}
|
||||
|
||||
mtx_lock(&dev->mutex);
|
||||
*is_supported = pscreen->get_video_param(pscreen, p_profile, PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
|
||||
PIPE_VIDEO_CAP_SUPPORTED);
|
||||
*is_supported = vl_codec_supported(pscreen, p_profile, false);
|
||||
if (*is_supported) {
|
||||
*max_width = pscreen->get_video_param(pscreen, p_profile, PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
|
||||
PIPE_VIDEO_CAP_MAX_WIDTH);
|
||||
|
|
Loading…
Reference in New Issue