diff --git a/drm/1.1/IDrmPlugin.hal b/drm/1.1/IDrmPlugin.hal index f14b983ef8..c32d2b52c2 100644 --- a/drm/1.1/IDrmPlugin.hal +++ b/drm/1.1/IDrmPlugin.hal @@ -20,6 +20,7 @@ import @1.0::IDrmPluginListener; import @1.0::KeyedVector; import @1.0::KeyType; import @1.0::Status; +import @1.1::DrmMetricGroup; import @1.1::HdcpLevel; import @1.1::KeyRequestType; import @1.1::SecurityLevel; @@ -162,4 +163,17 @@ interface IDrmPlugin extends @1.0::IDrmPlugin { */ setSecurityLevel(vec sessionId, SecurityLevel level) generates(Status status); + + /** + * Returns the plugin-specific metrics. Multiple metric groups may be + * returned in one call to getMetrics(). The scope and definition of the + * metrics is defined by the plugin. + * + * @return status the status of the call. The status must be OK or + * ERROR_DRM_INVALID_STATE if the metrics are not available to be + * returned. + * @return metric_groups the collection of metric groups provided by the + * plugin. + */ + getMetrics() generates (Status status, vec metric_groups); }; diff --git a/drm/1.1/types.hal b/drm/1.1/types.hal index a132dccfeb..94a6e667b4 100644 --- a/drm/1.1/types.hal +++ b/drm/1.1/types.hal @@ -18,6 +18,103 @@ package android.hardware.drm@1.1; import @1.0::KeyRequestType; +/** + * This message contains plugin-specific metrics made available to the client. + * The message is used for making vendor-specific metrics available to an + * application. The framework is not consuming any of the information. + * + * Metrics are grouped in instances of DrmMetricGroup. Each group contains + * multiple instances of Metric. + * + * Example: + * + * Capture the timing information of a buffer copy event, "buf_copy", broken + * out by the "size" of the buffer. + * + * DrmMetricGroup { + * metrics[0] { + * name: "buf_copy" + * attributes[0] { + * name: "size" + * type: INT64_TYPE + * int64Value: 1024 + * } + * values[0] { + * componentName: "operation_count" + * type: INT64_TYPE + * int64Value: 75 + * } + * values[1] { + * component_name: "average_time_seconds" + * type: DOUBLE_TYPE + * doubleValue: 0.00000042 + * } + * } + * } + */ +struct DrmMetricGroup { + /** + * Used to discriminate the type of value being stored in the structs + * below. + */ + enum ValueType : uint8_t { + INT64_TYPE, + DOUBLE_TYPE, + STRING_TYPE, + }; + + /** + * A detail about the metric being captured. The fields of an Attribute + * are opaque to the framework. + */ + struct Attribute { + string name; + /** + * The type field indicates which of the following values is used. + */ + ValueType type; + int64_t int64Value; + double doubleValue; + string stringValue; + }; + + /** + * A value of the metric. A metric may have multiple values. The + * component name may be left empty if there is only supposed to be + * one value for the given metric. The fields of the Value are + * opaque to the framework. + */ + struct Value { + string componentName; + /** + * The type field indicates which of the following values is used. + */ + ValueType type; + int64_t int64Value; + double doubleValue; + string stringValue; + }; + + /** + * The metric being captured. A metric must have a name and at least one + * value. A metric may have 0 or more attributes. The fields of a Metric + * are opaque to the framework. + */ + struct Metric { + string name; + vec attributes; + // A Metric may have one or more values. Multiple values are useful + // for capturing different aspects of the same metric. E.g. capture + // the min, max, average, count, and stdev of a particular metric. + vec values; + }; + + /** + * The list of metrics to be captured. + */ + vec metrics; +}; + /** * HDCP specifications are defined by Digital Content Protection LLC (DCP). * "HDCP Specification Rev. 2.2 Interface Independent Adaptation" @@ -112,3 +209,4 @@ enum SecurityLevel : uint32_t { */ HW_SECURE_ALL, }; +