From 8529cae3c042f5534ef9445556a9fd5b8880ed07 Mon Sep 17 00:00:00 2001 From: Carl Zhang Date: Thu, 22 Aug 2019 11:28:23 -0400 Subject: [PATCH] add surface hint for recon/reference/raw this surface hint is used to require usage hint for some codec , to optimize the memory footprint reconstruct surface is use another format for example, if input surface is AYUV for encode, it 444 format, backend driver maybe just use YUV to be reference, A is ignored to safe memory. in this scenario, application should not confuse the raw input surface and reconstruct/reference surface. Signed-off-by: Carl Zhang --- va/va.h | 23 ++++++++++++++++++++++- va/va_str.c | 1 + 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/va/va.h b/va/va.h index 5863ac775..9fd584c5e 100755 --- a/va/va.h +++ b/va/va.h @@ -777,6 +777,10 @@ typedef enum * implementation, multiple frames encode/decode can improve HW concurrency */ VAConfigAttribMultipleFrame = 40, + /** \brief this attribute is used to check addtional surface requirement + * the default value is 0, other value need to check /c VAConfigAttribValSurfaceReq + */ + VAConfigAttribSurfaceReq = 41, /**@}*/ VAConfigAttribTypeMax } VAConfigAttribType; @@ -876,6 +880,20 @@ typedef struct _VAConfigAttrib { /** \brief Driver supports base mode for slice decoding */ #define VA_DEC_SLICE_MODE_BASE 0x00000002 +/** @name Attribute values for VAConfigAttribValSurfaceReq */ +/**@{*/ +typedef union _VAConfigAttribValSurfaceReq{ + struct { + /** \brief encode raw input surface and recon surface is with different layout inside backend driver + * default value is zero, when it is 1, application need to set surface usage hint + * /c VA_SURFACE_ATTRIB_USAGE_HINT_RECON & VA_SURFACE_ATTRIB_USAGE_HINT_RAW when call vaCreateSurfaces to create surfaces */ + uint32_t input_recon_diff :1; + /** \brief Reserved for future use. must be zero */ + uint32_t reserved:31; + }bits; + uint32_t value; +}VAConfigAttribValSurfaceReq; + /** @name Attribute values for VAConfigAttribDecJPEG */ /**@{*/ typedef union _VAConfigAttribValDecJPEG { @@ -1431,7 +1449,10 @@ typedef struct _VASurfaceAttribExternalBuffers { /** \brief Surface used for export to third-party APIs, e.g. via * vaExportSurfaceHandle(). */ #define VA_SURFACE_ATTRIB_USAGE_HINT_EXPORT 0x00000020 - +/** \brief Surface used as reconstruct/reference */ +#define VA_SURFACE_ATTRIB_USAGE_HINT_RECON 0x00000100 +/** \brief Surface used for raw input */ +#define VA_SURFACE_ATTRIB_USAGE_HINT_RAW 0X00000200 /**@}*/ /** diff --git a/va/va_str.c b/va/va_str.c index 6b2212585..7942e5c59 100644 --- a/va/va_str.c +++ b/va/va_str.c @@ -126,6 +126,7 @@ const char *vaConfigAttribTypeStr(VAConfigAttribType configAttribType) TOSTR(VAConfigAttribMaxFrameSize); TOSTR(VAConfigAttribPredictionDirection); TOSTR(VAConfigAttribMultipleFrame); + TOSTR(VAConfigAttribSurfaceReq); case VAConfigAttribTypeMax: break; } return "";