Merge "Camera: Add camera module support for stream combination query"
diff --git a/include/hardware/hwcomposer2.h b/include/hardware/hwcomposer2.h
index ec0ef60..3255167 100644
--- a/include/hardware/hwcomposer2.h
+++ b/include/hardware/hwcomposer2.h
@@ -274,6 +274,7 @@
// composer 2.3
HWC2_FUNCTION_GET_DISPLAY_IDENTIFICATION_DATA,
+ HWC2_FUNCTION_GET_DISPLAY_CAPABILITIES,
HWC2_FUNCTION_SET_LAYER_COLOR_TRANSFORM,
HWC2_FUNCTION_GET_DISPLAYED_CONTENT_SAMPLING_ATTRIBUTES,
HWC2_FUNCTION_SET_DISPLAYED_CONTENT_SAMPLING_ENABLED,
@@ -372,6 +373,39 @@
HWC2_FORMAT_COMPONENT_3 = 1 << 3, /* The fourth component (eg, for RGBA_8888, this is A) */
} hwc2_format_color_component_t;
+/* Optional display capabilities which may be supported by some displays.
+ * The particular set of supported capabilities for a given display may be
+ * retrieved using getDisplayCapabilities. */
+typedef enum {
+ HWC2_DISPLAY_CAPABILITY_INVALID = 0,
+
+ /**
+ * Specifies that the display must apply a color transform even when either
+ * the client or the device has chosen that all layers should be composed by
+ * the client. This prevents the client from applying the color transform
+ * during its composition step.
+ * If getDisplayCapabilities is supported, the global capability
+ * HWC2_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM is ignored.
+ * If getDisplayCapabilities is not supported, and the global capability
+ * HWC2_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM is returned by getCapabilities,
+ * then all displays must be treated as having
+ * HWC2_DISPLAY_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM.
+ */
+ HWC2_DISPLAY_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM = 1,
+
+ /**
+ * Specifies that the display supports PowerMode::DOZE and
+ * PowerMode::DOZE_SUSPEND. DOZE_SUSPEND may not provide any benefit
+ * over DOZE (see the definition of PowerMode for more information),
+ * but if both DOZE and DOZE_SUSPEND are no different from
+ * PowerMode::ON, the device must not claim support.
+ * HWC2_DISPLAY_CAPABILITY_DOZE must be returned by getDisplayCapabilities
+ * when getDozeSupport indicates the display supports PowerMode::DOZE and
+ * PowerMode::DOZE_SUSPEND.
+ */
+ HWC2_DISPLAY_CAPABILITY_DOZE = 2,
+} hwc2_display_capability_t;
+
/*
* Stringification Functions
*/
@@ -552,6 +586,7 @@
// composer 2.3
case HWC2_FUNCTION_GET_DISPLAY_IDENTIFICATION_DATA: return "GetDisplayIdentificationData";
+ case HWC2_FUNCTION_GET_DISPLAY_CAPABILITIES: return "GetDisplayCapabilities";
case HWC2_FUNCTION_SET_LAYER_COLOR_TRANSFORM: return "SetLayerColorTransform";
case HWC2_FUNCTION_GET_DISPLAYED_CONTENT_SAMPLING_ATTRIBUTES: return "GetDisplayedContentSamplingAttributes";
case HWC2_FUNCTION_SET_DISPLAYED_CONTENT_SAMPLING_ENABLED: return "SetDisplayedContentSamplingEnabled";
@@ -621,6 +656,18 @@
}
}
+static inline const char* getDisplayCapabilityName(hwc2_display_capability_t capability) {
+ switch (capability) {
+ case HWC2_DISPLAY_CAPABILITY_INVALID: return "Invalid";
+ case HWC2_DISPLAY_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM:
+ return "SkipClientColorTransform";
+ case HWC2_DISPLAY_CAPABILITY_DOZE:
+ return "Doze";
+ default:
+ return "Unknown";
+ }
+}
+
#define TO_STRING(E, T, printer) \
inline std::string to_string(E value) { return printer(value); } \
inline std::string to_string(T value) { return to_string(static_cast<E>(value)); }
@@ -777,6 +824,7 @@
// composer 2.3
GetDisplayIdentificationData = HWC2_FUNCTION_GET_DISPLAY_IDENTIFICATION_DATA,
+ GetDisplayCapabilities = HWC2_FUNCTION_GET_DISPLAY_CAPABILITIES,
SetLayerColorTransform = HWC2_FUNCTION_SET_LAYER_COLOR_TRANSFORM,
GetDisplayedContentSamplingAttributes = HWC2_FUNCTION_GET_DISPLAYED_CONTENT_SAMPLING_ATTRIBUTES,
SetDisplayedContentSamplingEnabled = HWC2_FUNCTION_SET_DISPLAYED_CONTENT_SAMPLING_ENABLED,
@@ -817,6 +865,13 @@
};
TO_STRING(hwc2_vsync_t, Vsync, getVsyncName)
+enum class DisplayCapability : int32_t {
+ Invalid = HWC2_DISPLAY_CAPABILITY_INVALID,
+ SkipClientColorTransform = HWC2_DISPLAY_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM,
+ Doze = HWC2_DISPLAY_CAPABILITY_DOZE,
+};
+TO_STRING(hwc2_display_capability_t, DisplayCapability, getDisplayCapabilityName)
+
} // namespace HWC2
__BEGIN_DECLS
@@ -2556,6 +2611,29 @@
uint64_t max_frames, uint64_t timestamp,
uint64_t* frame_count, int32_t samples_size[4], uint64_t* samples[4]);
+/* getDisplayCapabilities(..., outCapabilities)
+ * Descriptor: HWC2_FUNCTION_GET_DISPLAY_CAPABILITIES
+ * Required for HWC2 devices for composer 2.3
+ * Optional for HWC2 devices for composer 2.1 and 2.2
+ *
+ * getDisplayCapabilities returns a list of supported capabilities
+ * (as described in the definition of Capability above).
+ * This list must not change after initialization.
+ *
+ * Parameters:
+ * outNumCapabilities - if outCapabilities was nullptr, returns the number of capabilities
+ * if outCapabilities was not nullptr, returns the number of capabilities stored in
+ * outCapabilities, which must not exceed the value stored in outNumCapabilities prior
+ * to the call; pointer will be non-NULL
+ * outCapabilities - a list of supported capabilities.
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in
+ */
+typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_DISPLAY_CAPABILITIES)(
+ hwc2_device_t* device, hwc2_display_t display, uint32_t* outNumCapabilities,
+ uint32_t* outCapabilities);
+
__END_DECLS
#endif
diff --git a/include/hardware/sound_trigger.h b/include/hardware/sound_trigger.h
index 696b634..99346ef 100644
--- a/include/hardware/sound_trigger.h
+++ b/include/hardware/sound_trigger.h
@@ -117,13 +117,12 @@
int (*stop_all_recognitions)(const struct sound_trigger_hw_device* dev);
/* Get the current state of a given model.
- * The state is returned as a recognition event, or null if not implemented or on error.
- * Caller takes ownership of the returned event memory.
+ * The state will be returned as a recognition event, via the callback that was registered
+ * in the start_recognition method.
* Only supported for device api versions SOUND_TRIGGER_DEVICE_API_VERSION_1_2 or above.
*/
- struct sound_trigger_recognition_event* (*get_model_state)(
- const struct sound_trigger_hw_device *dev,
- sound_model_handle_t sound_model_handle);
+ int (*get_model_state)(const struct sound_trigger_hw_device *dev,
+ sound_model_handle_t sound_model_handle);
};
typedef struct sound_trigger_hw_device sound_trigger_hw_device_t;
diff --git a/modules/sensors/OWNERS b/modules/sensors/OWNERS
index d4393d6..81099e8 100644
--- a/modules/sensors/OWNERS
+++ b/modules/sensors/OWNERS
@@ -1,2 +1,3 @@
arthuri@google.com
bduddie@google.com
+bstack@google.com
diff --git a/modules/soundtrigger/sound_trigger_hw.c b/modules/soundtrigger/sound_trigger_hw.c
index 25d4813..38212c4 100644
--- a/modules/soundtrigger/sound_trigger_hw.c
+++ b/modules/soundtrigger/sound_trigger_hw.c
@@ -811,10 +811,9 @@
return 0;
}
-// Caller is responsible for freeing the memory
-static struct sound_trigger_recognition_event * stdev_get_model_state(
- const struct sound_trigger_hw_device *dev,
- sound_model_handle_t handle) {
+static int stdev_get_model_state(const struct sound_trigger_hw_device *dev,
+ sound_model_handle_t handle) {
+ int ret = 0;
struct stub_sound_trigger_device *stdev = (struct stub_sound_trigger_device *)dev;
ALOGI("%s", __func__);
pthread_mutex_lock(&stdev->lock);
@@ -822,26 +821,29 @@
struct recognition_context *model_context = get_model_context(stdev, handle);
if (!model_context) {
ALOGW("Can't find sound model handle %d in registered list", handle);
- pthread_mutex_unlock(&stdev->lock);
- return NULL;
+ ret = -ENOSYS;
+ goto exit;
}
- struct sound_trigger_recognition_event *event = NULL;
- if (model_context->model_type == SOUND_MODEL_TYPE_GENERIC) {
- // TODO(mdooley): define a new status for this use case?
- int status = RECOGNITION_STATUS_SUCCESS;
- event = (struct sound_trigger_recognition_event *)
- sound_trigger_generic_event_alloc(model_context->model_handle,
- model_context->config, status);
- } else {
- ALOGI("Unsupported sound model type: %d, state not available.",
- model_context->model_type);
+ if (!model_context->model_started) {
+ ALOGW("Sound model %d not started", handle);
+ ret = -ENOSYS;
+ goto exit;
}
+ if (model_context->recognition_callback == NULL) {
+ ALOGW("Sound model %d not initialized", handle);
+ ret = -ENOSYS;
+ goto exit;
+ }
+
+ // TODO(mdooley): trigger recognition event
+
+exit:
pthread_mutex_unlock(&stdev->lock);
ALOGI("%s done for handle %d", __func__, handle);
- return event;
+ return ret;
}
__attribute__ ((visibility ("default")))