summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPing Liu <ping.liu@intel.com>2017-06-13 22:49:00 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2017-11-21 23:27:31 -0800
commit51be39ce71047b324e447fec3151144f891f996c (patch)
tree049eaf23e2369ada3126b12f0ac57d16be586cb2
parentff38adf28db801c5ded012a1ff8a5b3c0f4754dc (diff)
downloadlibva-51be39ce71047b324e447fec3151144f891f996c.tar.gz
add support for processing rate
application can query/get attribute of processing rate by VAConfigAttribProcessingRate and query the processing rate of driver by vaQueryProcessingRate Signed-off-by: Carl.Zhang <carl.zhang@intel.com>
-rw-r--r--va/va.c15
-rw-r--r--va/va.h82
-rw-r--r--va/va_backend.h9
-rw-r--r--va/va_str.c1
4 files changed, 106 insertions, 1 deletions
diff --git a/va/va.c b/va/va.c
index 3af3ea1..86ca317 100644
--- a/va/va.c
+++ b/va/va.c
@@ -919,6 +919,21 @@ VAStatus vaQueryConfigAttributes (
return ctx->vtable->vaQueryConfigAttributes( ctx, config_id, profile, entrypoint, attrib_list, num_attribs);
}
+VAStatus vaQueryProcessingRate (
+ VADisplay dpy,
+ VAConfigID config_id,
+ VAProcessingRateParameter *proc_buf,
+ unsigned int *processing_rate /* out */
+)
+{
+ VADriverContextP ctx;
+ CHECK_DISPLAY(dpy);
+ ctx = CTX(dpy);
+ if(!ctx->vtable->vaQueryProcessingRate)
+ return VA_STATUS_ERROR_UNIMPLEMENTED;
+ return ctx->vtable->vaQueryProcessingRate( ctx, config_id, proc_buf, processing_rate);
+}
+
/* XXX: this is a slow implementation that will be removed */
static VAStatus
va_impl_query_surface_attributes(
diff --git a/va/va.h b/va/va.h
index dae3981..e8dbef8 100644
--- a/va/va.h
+++ b/va/va.h
@@ -577,6 +577,17 @@ typedef enum
* VAConfigAttribValEncRateControlExt union.
*/
VAConfigAttribEncRateControlExt = 26,
+ /**
+ * \brief Processing rate reporting attribute. Read-only.
+ *
+ * This attribute conveys whether the driver supports reporting of
+ * encode/decode processing rate based on certain set of parameters
+ * (i.e. levels, I frame internvals) for a given configuration.
+ * If this is supported, vaQueryProcessingRate() can be used to get
+ * encode or decode processing rate.
+ * See \c VA_PROCESSING_RATE_xxx for encode/decode processing rate
+ */
+ VAConfigAttribProcessingRate = 27,
/**
* \brief Encode function type for FEI.
@@ -855,6 +866,15 @@ typedef union _VAConfigAttribValEncRateControlExt {
uint32_t value;
} VAConfigAttribValEncRateControlExt;
+/** @name Attribute values for VAConfigAttribProcessingRate. */
+/**@{*/
+/** \brief Driver does not support processing rate report */
+#define VA_PROCESSING_RATE_NONE 0x00000000
+/** \brief Driver supports encode processing rate report */
+#define VA_PROCESSING_RATE_ENCODE 0x00000001
+/** \brief Driver supports decode processing rate report */
+#define VA_PROCESSING_RATE_DECODE 0x00000002
+/**@}*/
/**
* if an attribute is not applicable for a given
* profile/entrypoint pair, then set the value to the following
@@ -1413,6 +1433,68 @@ typedef enum
VABufferTypeMax
} VABufferType;
+/**
+ * Processing rate parameter for encode.
+ */
+typedef struct _VAProcessingRateParameterEnc {
+ /** \brief Profile level */
+ uint8_t level_idc;
+ uint8_t reserved[3];
+ /** \brief quality level. When set to 0, default quality
+ * level is used.
+ */
+ uint32_t quality_level;
+ /** \brief Period between I frames. */
+ uint32_t intra_period;
+ /** \brief Period between I/P frames. */
+ uint32_t ip_period;
+} VAProcessingRateParameterEnc;
+
+/**
+ * Processing rate parameter for decode.
+ */
+typedef struct _VAProcessingRateParameterDec {
+ /** \brief Profile level */
+ uint8_t level_idc;
+ uint8_t reserved0[3];
+ uint32_t reserved;
+} VAProcessingRateParameterDec;
+
+typedef struct _VAProcessingRateParameter {
+ union {
+ VAProcessingRateParameterEnc proc_buf_enc;
+ VAProcessingRateParameterDec proc_buf_dec;
+ };
+} VAProcessingRateParameter;
+
+/**
+ * \brief Queries processing rate for the supplied config.
+ *
+ * This function queries the processing rate based on parameters in
+ * \c proc_buf for the given \c config. Upon successful return, the processing
+ * rate value will be stored in \c processing_rate. Processing rate is
+ * specified as the number of macroblocks per second.
+ *
+ * If NULL is passed to the \c proc_buf, the default processing rate for the
+ * given configuration will be returned.
+ *
+ * @param[in] dpy the VA display
+ * @param[in] config the config identifying a codec or a video
+ * processing pipeline
+ * @param[in] proc_buf the buffer that contains the parameters for
+ either the encode or decode processing rate
+ * @param[out] processing_rate processing rate in number of macroblocks per
+ second constrained by parameters specified in proc_buf
+ *
+ */
+VAStatus
+vaQueryProcessingRate(
+ VADisplay dpy,
+ VAConfigID config,
+ VAProcessingRateParameter *proc_buf,
+ unsigned int *processing_rate
+);
+
typedef enum
{
VAEncMiscParameterTypeFrameRate = 0,
diff --git a/va/va_backend.h b/va/va_backend.h
index 2a0c363..f095c83 100644
--- a/va/va_backend.h
+++ b/va/va_backend.h
@@ -470,7 +470,14 @@ struct VADriverVTable
VABufferID *buf_id /* out */
);
- unsigned long reserved[59];
+ VAStatus (*vaQueryProcessingRate) (
+ VADriverContextP ctx, /* in */
+ VAConfigID config_id, /* in */
+ VAProcessingRateParameter *proc_buf,/* in */
+ unsigned int *processing_rate /* out */
+ );
+ /** \brief Reserved bytes for future use, must be zero */
+ unsigned long reserved[58];
};
struct VADriverContext
diff --git a/va/va_str.c b/va/va_str.c
index 480ee1c..1f3e375 100644
--- a/va/va_str.c
+++ b/va/va_str.c
@@ -103,6 +103,7 @@ const char *vaConfigAttribTypeStr(VAConfigAttribType configAttribType)
TOSTR(VAConfigAttribMaxPictureHeight);
TOSTR(VAConfigAttribEncQuantization);
TOSTR(VAConfigAttribEncIntraRefresh);
+ TOSTR(VAConfigAttribProcessingRate);
case VAConfigAttribTypeMax: break;
}
return "<unknown config attribute type>";