Skip to content

Display caps for vaCopy #1187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions media_driver/linux/common/ddi/media_libva.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5734,15 +5734,16 @@ VAStatus DdiMedia_QueryDisplayAttributes(
VADisplayAttribute *attr_list,
int32_t *num_attributes)
{
DDI_UNUSED(ctx);
DDI_UNUSED(attr_list);

DDI_FUNCTION_ENTER();

if (num_attributes)
*num_attributes = 0;
PDDI_MEDIA_CONTEXT mediaCtx = DdiMedia_GetMediaContext(ctx);
DDI_CHK_NULL(mediaCtx, "nullptr mediaCtx", VA_STATUS_ERROR_INVALID_CONTEXT);
DDI_CHK_NULL(mediaCtx->m_caps, "nullptr m_caps", VA_STATUS_ERROR_INVALID_CONTEXT);

return VA_STATUS_SUCCESS;
DDI_CHK_NULL(attr_list, "nullptr attr_list", VA_STATUS_ERROR_INVALID_PARAMETER);
DDI_CHK_NULL(num_attributes, "nullptr num_attributes", VA_STATUS_ERROR_INVALID_PARAMETER);

return mediaCtx->m_caps->QueryDisplayAttributes(attr_list, num_attributes);
}

//!
Expand All @@ -5766,13 +5767,15 @@ VAStatus DdiMedia_GetDisplayAttributes(
VADisplayAttribute *attr_list,
int32_t num_attributes)
{
DDI_UNUSED(ctx);
DDI_UNUSED(attr_list);
DDI_UNUSED(num_attributes);

DDI_FUNCTION_ENTER();

return VA_STATUS_ERROR_UNIMPLEMENTED;
PDDI_MEDIA_CONTEXT mediaCtx = DdiMedia_GetMediaContext(ctx);
DDI_CHK_NULL(mediaCtx, "nullptr mediaCtx", VA_STATUS_ERROR_INVALID_CONTEXT);
DDI_CHK_NULL(mediaCtx->m_caps, "nullptr m_caps", VA_STATUS_ERROR_INVALID_CONTEXT);

DDI_CHK_NULL(attr_list, "nullptr attr_list", VA_STATUS_ERROR_INVALID_PARAMETER);

return mediaCtx->m_caps->GetDisplayAttributes(attr_list, num_attributes);
}

//!
Expand Down
4 changes: 2 additions & 2 deletions media_driver/linux/common/ddi/media_libva.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
#define DDI_CODEC_GEN_MAX_IMAGE_FORMATS 2 // NV12 and P010
#define DDI_CODEC_GEN_MAX_SUBPIC_FORMATS 4 // no sub-pic blending support, still set to 4 for further implementation
#if VA_MAJOR_VERSION < 1
#define DDI_CODEC_GEN_MAX_DISPLAY_ATTRIBUTES 4
#define DDI_MEDIA_GEN_MAX_DISPLAY_ATTRIBUTES 4
#else
#define DDI_CODEC_GEN_MAX_DISPLAY_ATTRIBUTES 0 // set it to zero, unsupported.
#define DDI_MEDIA_GEN_MAX_DISPLAY_ATTRIBUTES 1
#endif
#define DDI_CODEC_GEN_MAX_ATTRIBS_TYPE 4 //VAConfigAttribRTFormat, VAConfigAttribRateControl, VAConfigAttribDecSliceMode, VAConfigAttribEncPackedHeaders

Expand Down
39 changes: 39 additions & 0 deletions media_driver/linux/common/ddi/media_libva_caps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3073,6 +3073,45 @@ VAStatus MediaLibvaCaps::QuerySurfaceAttributes(
MOS_FreeMemory(attribs);
return status;
}

VAStatus MediaLibvaCaps::QueryDisplayAttributes(
VADisplayAttribute *attribList,
int32_t *numAttribs)
{
DDI_CHK_NULL(attribList, "Null attribList", VA_STATUS_ERROR_INVALID_PARAMETER);
DDI_CHK_NULL(numAttribs, "Null num_attribs", VA_STATUS_ERROR_INVALID_PARAMETER);
*numAttribs = 0;

attribList->type = VADisplayAttribCopy;
(*numAttribs) ++;

return GetDisplayAttributes(attribList, *numAttribs);
}

VAStatus MediaLibvaCaps::GetDisplayAttributes(
VADisplayAttribute *attribList,
int32_t numAttribs)
{
DDI_CHK_NULL(attribList, "Null attribList", VA_STATUS_ERROR_INVALID_PARAMETER);
for(auto i = 0; i < numAttribs; i ++)
{
switch(attribList->type)
{
case VADisplayAttribCopy:
attribList->min_value = attribList->value = attribList->max_value = 0;
attribList->flags = VA_DISPLAY_ATTRIB_GETTABLE;
break;
default:
attribList->min_value = VA_ATTRIB_NOT_SUPPORTED;
attribList->max_value = VA_ATTRIB_NOT_SUPPORTED;
attribList->value = VA_ATTRIB_NOT_SUPPORTED;
attribList->flags = VA_DISPLAY_ATTRIB_NOT_SUPPORTED;
break;
}
attribList ++;
}
return VA_STATUS_SUCCESS;
}

bool MediaLibvaCaps::IsVc1Profile(VAProfile profile)
{
Expand Down
37 changes: 37 additions & 0 deletions media_driver/linux/common/ddi/media_libva_caps.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,43 @@ class MediaLibvaCaps
VASurfaceAttrib *attribList,
uint32_t *numAttribs);

//!
//! \brief Query display attributes
//!
//! \param [in, out] attribList
//! it returns the supported display attributes
//!
//!
//! \param [in, out] numAttribs
//! it returns the actual number of supported attributes
//!
//! \return VAStatus
//! VA_STATUS_SUCCESS if success
//! VA_STATUS_ERROR_MAX_NUM_EXCEEDED if size of attribList is too small
//!
virtual VAStatus QueryDisplayAttributes(
VADisplayAttribute *attribList,
int32_t *numAttribs);

//!
//! \brief Get display attributes
//! returns the current attributes values in "attribList"
//!
//! \param [in, out] attribList
//! the attrib type should be filled.
//! returns the supported display attributes
//!
//! \param [in] numAttribs
//! the number of supported attributes
//!
//! \return VAStatus
//! VA_STATUS_SUCCESS if success
//! VA_STATUS_ERROR_MAX_NUM_EXCEEDED if size of attribList is too small
//!
virtual VAStatus GetDisplayAttributes(
VADisplayAttribute *attribList,
int32_t numAttribs);

//!
//! \brief Check if the resolution is valid for a given decode codec mode
//!
Expand Down
2 changes: 1 addition & 1 deletion media_driver/linux/common/ddi/media_libva_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ VAStatus MediaLibvaInterface::LoadFunction(VADriverContextP ctx)
ctx->max_entrypoints = DDI_CODEC_GEN_MAX_ENTRYPOINTS;
ctx->max_attributes = (int32_t)VAConfigAttribTypeMax;
ctx->max_subpic_formats = DDI_CODEC_GEN_MAX_SUBPIC_FORMATS;
ctx->max_display_attributes = DDI_CODEC_GEN_MAX_DISPLAY_ATTRIBUTES ;
ctx->max_display_attributes = DDI_MEDIA_GEN_MAX_DISPLAY_ATTRIBUTES ;
ctx->str_vendor = DDI_CODEC_GEN_STR_VENDOR;
ctx->vtable_tpi = nullptr;

Expand Down
27 changes: 27 additions & 0 deletions media_driver/linux/gen12/ddi/media_libva_caps_g12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2599,6 +2599,33 @@ GMM_RESOURCE_FORMAT MediaLibvaCapsG12::ConvertMediaFmtToGmmFmt(
}
}

VAStatus MediaLibvaCapsG12::GetDisplayAttributes(
VADisplayAttribute *attribList,
int32_t numAttribs)
{
DDI_CHK_NULL(attribList, "Null attribList", VA_STATUS_ERROR_INVALID_PARAMETER);
for(auto i = 0; i < numAttribs; i ++)
{
switch(attribList->type)
{
case VADisplayAttribCopy:
attribList->min_value = attribList->value = attribList->max_value = (1 << VA_EXEC_MODE_DEFAULT);
attribList->flags = VA_DISPLAY_ATTRIB_GETTABLE;
break;
default:
attribList->min_value = VA_ATTRIB_NOT_SUPPORTED;
attribList->max_value = VA_ATTRIB_NOT_SUPPORTED;
attribList->value = VA_ATTRIB_NOT_SUPPORTED;
attribList->flags = VA_DISPLAY_ATTRIB_NOT_SUPPORTED;
break;
}
attribList ++;
}
return VA_STATUS_SUCCESS;
}



extern template class MediaLibvaCapsFactory<MediaLibvaCaps, DDI_MEDIA_CONTEXT>;

static bool tglLPRegistered = MediaLibvaCapsFactory<MediaLibvaCaps, DDI_MEDIA_CONTEXT>::
Expand Down
21 changes: 21 additions & 0 deletions media_driver/linux/gen12/ddi/media_libva_caps_g12.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,5 +280,26 @@ class MediaLibvaCapsG12 : public MediaLibvaCaps
//! if call succeeds
//!
VAStatus QueryAVCROIMaxNum(uint32_t rcMode, bool isVdenc, uint32_t *maxNum, bool *isRoiInDeltaQP) override;

//!
//! \brief Get display attributes
//! returns the current attributes values in "attribList"
//!
//! \param [in, out] attribList
//! the attrib type should be filled.
//! returns the supported display attributes
//!
//! \param [in] numAttribs
//! the number of supported attributes
//!
//! \return VAStatus
//! VA_STATUS_SUCCESS if success
//! VA_STATUS_ERROR_MAX_NUM_EXCEEDED if size of attribList is too small
//!
virtual VAStatus GetDisplayAttributes(
VADisplayAttribute *attribList,
int32_t numAttribs) override;


};
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ VAStatus MediaLibvaInterfaceNext::LoadFunction(VADriverContextP ctx)
ctx->max_entrypoints = DDI_CODEC_GEN_MAX_ENTRYPOINTS;
ctx->max_attributes = (int32_t)VAConfigAttribTypeMax;
ctx->max_subpic_formats = DDI_CODEC_GEN_MAX_SUBPIC_FORMATS;
ctx->max_display_attributes = DDI_CODEC_GEN_MAX_DISPLAY_ATTRIBUTES ;
ctx->max_display_attributes = DDI_MEDIA_GEN_MAX_DISPLAY_ATTRIBUTES ;
ctx->str_vendor = DDI_CODEC_GEN_STR_VENDOR;
ctx->vtable_tpi = nullptr;

Expand Down