Merge "Fix camera.v4l2 module build error" am: 2e88e2d003 am: 2e5ebdc287 am: cfb9a10ba2
Change-Id: If6351c622598606031c9f40e9d1690be3cb2749f
diff --git a/include/hardware/audio.h b/include/hardware/audio.h
index feebd23..b047fa0 100644
--- a/include/hardware/audio.h
+++ b/include/hardware/audio.h
@@ -56,7 +56,8 @@
#define AUDIO_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0)
#define AUDIO_DEVICE_API_VERSION_2_0 HARDWARE_DEVICE_API_VERSION(2, 0)
#define AUDIO_DEVICE_API_VERSION_3_0 HARDWARE_DEVICE_API_VERSION(3, 0)
-#define AUDIO_DEVICE_API_VERSION_CURRENT AUDIO_DEVICE_API_VERSION_3_0
+#define AUDIO_DEVICE_API_VERSION_3_1 HARDWARE_DEVICE_API_VERSION(3, 1)
+#define AUDIO_DEVICE_API_VERSION_CURRENT AUDIO_DEVICE_API_VERSION_3_1
/* Minimal audio HAL version supported by the audio framework */
#define AUDIO_DEVICE_API_VERSION_MIN AUDIO_DEVICE_API_VERSION_2_0
@@ -825,6 +826,31 @@
int (*set_audio_port_config)(struct audio_hw_device *dev,
const struct audio_port_config *config);
+ /**
+ * Applies an audio effect to an audio device.
+ *
+ * @param dev the audio HAL device context.
+ * @param device identifies the sink or source device the effect must be applied to.
+ * "device" is the audio_port_handle_t indicated for the device when
+ * the audio patch connecting that device was created.
+ * @param effect effect interface handle corresponding to the effect being added.
+ * @return retval operation completion status.
+ */
+ int (*add_device_effect)(struct audio_hw_device *dev,
+ audio_port_handle_t device, effect_handle_t effect);
+
+ /**
+ * Stops applying an audio effect to an audio device.
+ *
+ * @param dev the audio HAL device context.
+ * @param device identifies the sink or source device this effect was applied to.
+ * "device" is the audio_port_handle_t indicated for the device when
+ * the audio patch is created.
+ * @param effect effect interface handle corresponding to the effect being removed.
+ * @return retval operation completion status.
+ */
+ int (*remove_device_effect)(struct audio_hw_device *dev,
+ audio_port_handle_t device, effect_handle_t effect);
};
typedef struct audio_hw_device audio_hw_device_t;
diff --git a/include/hardware/audio_effect.h b/include/hardware/audio_effect.h
index 3366e17..a2809ba 100644
--- a/include/hardware/audio_effect.h
+++ b/include/hardware/audio_effect.h
@@ -207,6 +207,8 @@
// Note that EffectsFactory.c only checks the major version component, so changes to the minor
// number can only be used for fully backwards compatible changes
#define EFFECT_LIBRARY_API_VERSION EFFECT_MAKE_API_VERSION(3,0)
+#define EFFECT_LIBRARY_API_VERSION_3_0 EFFECT_MAKE_API_VERSION(3,0)
+#define EFFECT_LIBRARY_API_VERSION_3_1 EFFECT_MAKE_API_VERSION(3,1)
#define AUDIO_EFFECT_LIBRARY_TAG ((('A') << 24) | (('E') << 16) | (('L') << 8) | ('T'))
@@ -297,6 +299,48 @@
////////////////////////////////////////////////////////////////////////////////
int32_t (*get_descriptor)(const effect_uuid_t *uuid,
effect_descriptor_t *pDescriptor);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ //
+ // Function: create_effect_3_1
+ //
+ // Description: Creates an effect engine of the specified implementation uuid and
+ // returns an effect control interface on this engine. The function will allocate the
+ // resources for an instance of the requested effect engine and return
+ // a handle on the effect control interface.
+ //
+ // Input:
+ // uuid: pointer to the effect uuid.
+ // sessionId: audio session to which this effect instance will be attached.
+ // All effects created with the same session ID are connected in series and process
+ // the same signal stream. Knowing that two effects are part of the same effect
+ // chain can help the library implement some kind of optimizations.
+ // ioId: identifies the output or input stream this effect is directed to in
+ // audio HAL.
+ // For future use especially with tunneled HW accelerated effects
+ // deviceId: identifies the sink or source device this effect is directed to in
+ // audio HAL. Must be specified if sessionId is AUDIO_SESSION_DEVICE and is
+ // ignored otherwise.
+ // deviceId is the audio_port_handle_t used for the device when the audio
+ // patch is created at the audio HAL.
+ //
+ // Input/Output:
+ // pHandle: address where to return the effect interface handle.
+ //
+ // Output:
+ // returned value: 0 successful operation.
+ // -ENODEV library failed to initialize
+ // -EINVAL invalid pEffectUuid or pHandle
+ // -ENOENT no effect with this uuid found
+ // *pHandle: updated with the effect interface handle.
+ //
+ ////////////////////////////////////////////////////////////////////////////////
+ int32_t (*create_effect_3_1)(const effect_uuid_t *uuid,
+ int32_t sessionId,
+ int32_t ioId,
+ int32_t deviceId,
+ effect_handle_t *pHandle);
+
} audio_effect_library_t;
// Name of the hal_module_info
diff --git a/include/hardware/hwcomposer2.h b/include/hardware/hwcomposer2.h
index c70aef6..182b30c 100644
--- a/include/hardware/hwcomposer2.h
+++ b/include/hardware/hwcomposer2.h
@@ -50,6 +50,11 @@
* the device may return -1 instead */
HWC2_ATTRIBUTE_DPI_X = 4,
HWC2_ATTRIBUTE_DPI_Y = 5,
+
+ /* The configuration group this config is associated to.
+ * Switching between configurations within the same group may be done seamlessly
+ * in some conditions via setActiveConfigWithConstraints. */
+ HWC2_ATTRIBUTE_CONFIG_GROUP = 7,
} hwc2_attribute_t;
/* Blend modes, settable per layer */
@@ -73,6 +78,8 @@
HWC2_CALLBACK_HOTPLUG = 1,
HWC2_CALLBACK_REFRESH = 2,
HWC2_CALLBACK_VSYNC = 3,
+ HWC2_CALLBACK_VSYNC_2_4 = 4,
+ HWC2_CALLBACK_VSYNC_PERIOD_TIMING_CHANGED = 5,
} hwc2_callback_descriptor_t;
/* Optional capabilities which may be supported by some devices. The particular
@@ -203,6 +210,12 @@
HWC2_DISPLAY_TYPE_VIRTUAL = 2,
} hwc2_display_type_t;
+/* Physical display types returned by getDisplayConnectionType */
+typedef enum {
+ HWC2_DISPLAY_CONNECTION_TYPE_INTERNAL = 0,
+ HWC2_DISPLAY_CONNECTION_TYPE_EXTERNAL = 1,
+} hwc2_display_connection_type_t;
+
/* Return codes from all functions */
typedef enum {
HWC2_ERROR_NONE = 0,
@@ -214,6 +227,8 @@
HWC2_ERROR_NO_RESOURCES,
HWC2_ERROR_NOT_VALIDATED,
HWC2_ERROR_UNSUPPORTED,
+ HWC2_ERROR_SEAMLESS_NOT_ALLOWED,
+ HWC2_ERROR_SEAMLESS_NOT_POSSIBLE,
} hwc2_error_t;
/* Function descriptors for use with getFunction */
@@ -282,6 +297,14 @@
HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA_BLOBS,
HWC2_FUNCTION_GET_DISPLAY_BRIGHTNESS_SUPPORT,
HWC2_FUNCTION_SET_DISPLAY_BRIGHTNESS,
+
+ // composer 2.4
+ HWC2_FUNCTION_GET_DISPLAY_CONNECTION_TYPE,
+ HWC2_FUNCTION_GET_DISPLAY_VSYNC_PERIOD,
+ HWC2_FUNCTION_SET_ACTIVE_CONFIG_WITH_CONSTRAINTS,
+ HWC2_FUNCTION_SET_AUTO_LOW_LATENCY_MODE,
+ HWC2_FUNCTION_GET_SUPPORTED_CONTENT_TYPES,
+ HWC2_FUNCTION_SET_CONTENT_TYPE,
} hwc2_function_descriptor_t;
/* Layer requests returned from getDisplayRequests */
@@ -320,6 +343,14 @@
HWC2_POWER_MODE_ON = 2,
} hwc2_power_mode_t;
+typedef enum {
+ HWC2_CONTENT_TYPE_NONE = 0,
+ HWC2_CONTENT_TYPE_GRAPHICS = 1,
+ HWC2_CONTENT_TYPE_PHOTO = 2,
+ HWC2_CONTENT_TYPE_CINEMA = 3,
+ HWC2_CONTENT_TYPE_GAME = 4,
+} hwc2_content_type_t;
+
/* Vsync values passed to setVsyncEnabled */
typedef enum {
HWC2_VSYNC_INVALID = 0,
@@ -412,6 +443,15 @@
* Specified that the display supports brightness operations.
*/
HWC2_DISPLAY_CAPABILITY_BRIGHTNESS = 3,
+
+ /**
+ * Specifies that the display supports a low latency mode. If the connection
+ * to the display is via HDMI, this specifies whether Auto Low Latency Mode
+ * is supported. If, instead, there is an internal connection to the display,
+ * then this specifies that the display has some other custom low latency
+ * mode.
+ */
+ HWC2_DISPLAY_CAPABILITY_AUTO_LOW_LATENCY_MODE = 5,
} hwc2_display_capability_t;
/*
@@ -428,6 +468,7 @@
case HWC2_ATTRIBUTE_VSYNC_PERIOD: return "VsyncPeriod";
case HWC2_ATTRIBUTE_DPI_X: return "DpiX";
case HWC2_ATTRIBUTE_DPI_Y: return "DpiY";
+ case HWC2_ATTRIBUTE_CONFIG_GROUP: return "ConfigGroup";
default: return "Unknown";
}
}
@@ -449,6 +490,8 @@
case HWC2_CALLBACK_HOTPLUG: return "Hotplug";
case HWC2_CALLBACK_REFRESH: return "Refresh";
case HWC2_CALLBACK_VSYNC: return "Vsync";
+ case HWC2_CALLBACK_VSYNC_2_4: return "Vsync2.4";
+ case HWC2_CALLBACK_VSYNC_PERIOD_TIMING_CHANGED: return "VsyncPeriodTimingChanged";
default: return "Unknown";
}
}
@@ -509,6 +552,14 @@
}
}
+static inline const char* getDisplayConnectionTypeName(hwc2_display_connection_type_t type) {
+ switch (type) {
+ case HWC2_DISPLAY_CONNECTION_TYPE_INTERNAL: return "Internal";
+ case HWC2_DISPLAY_CONNECTION_TYPE_EXTERNAL: return "External";
+ default: return "Unknown";
+ }
+}
+
static inline const char* getErrorName(hwc2_error_t error) {
switch (error) {
case HWC2_ERROR_NONE: return "None";
@@ -520,6 +571,8 @@
case HWC2_ERROR_NO_RESOURCES: return "NoResources";
case HWC2_ERROR_NOT_VALIDATED: return "NotValidated";
case HWC2_ERROR_UNSUPPORTED: return "Unsupported";
+ case HWC2_ERROR_SEAMLESS_NOT_ALLOWED: return "SeamlessNotAllowed";
+ case HWC2_ERROR_SEAMLESS_NOT_POSSIBLE: return "SeamlessNotPossible";
default: return "Unknown";
}
}
@@ -602,6 +655,15 @@
case HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA_BLOBS: return "SetLayerPerFrameMetadataBlobs";
case HWC2_FUNCTION_GET_DISPLAY_BRIGHTNESS_SUPPORT: return "GetDisplayBrightnessSupport";
case HWC2_FUNCTION_SET_DISPLAY_BRIGHTNESS: return "SetDisplayBrightness";
+
+ // composer 2.4
+ case HWC2_FUNCTION_GET_DISPLAY_CONNECTION_TYPE: return "GetDisplayConnectionType";
+ case HWC2_FUNCTION_GET_DISPLAY_VSYNC_PERIOD: return "GetDisplayVsyncPeriod";
+ case HWC2_FUNCTION_SET_ACTIVE_CONFIG_WITH_CONSTRAINTS: return "SetActiveConfigWithConstraints";
+ case HWC2_FUNCTION_SET_AUTO_LOW_LATENCY_MODE: return "SetAutoLowLatencyMode";
+ case HWC2_FUNCTION_GET_SUPPORTED_CONTENT_TYPES: return "GetSupportedContentTypes";
+ case HWC2_FUNCTION_SET_CONTENT_TYPE: return "SetContentType";
+
default: return "Unknown";
}
}
@@ -624,6 +686,17 @@
}
}
+static inline const char* getContentTypeName(hwc2_content_type_t contentType) {
+ switch(contentType) {
+ case HWC2_CONTENT_TYPE_NONE: return "None";
+ case HWC2_CONTENT_TYPE_GRAPHICS: return "Graphics";
+ case HWC2_CONTENT_TYPE_PHOTO: return "Photo";
+ case HWC2_CONTENT_TYPE_CINEMA: return "Cinema";
+ case HWC2_CONTENT_TYPE_GAME: return "Game";
+ default: return "Unknown";
+ }
+}
+
static inline const char* getTransformName(hwc_transform_t transform) {
switch (__BIONIC_CAST(static_cast, int, transform)) {
case 0: return "None";
@@ -676,6 +749,8 @@
return "Doze";
case HWC2_DISPLAY_CAPABILITY_BRIGHTNESS:
return "Brightness";
+ case HWC2_DISPLAY_CAPABILITY_AUTO_LOW_LATENCY_MODE:
+ return "AutoLowLatencyMode";
default:
return "Unknown";
}
@@ -708,6 +783,7 @@
VsyncPeriod = HWC2_ATTRIBUTE_VSYNC_PERIOD,
DpiX = HWC2_ATTRIBUTE_DPI_X,
DpiY = HWC2_ATTRIBUTE_DPI_Y,
+ ConfigGroup = HWC2_ATTRIBUTE_CONFIG_GROUP,
};
TO_STRING(hwc2_attribute_t, Attribute, getAttributeName)
@@ -724,6 +800,8 @@
Hotplug = HWC2_CALLBACK_HOTPLUG,
Refresh = HWC2_CALLBACK_REFRESH,
Vsync = HWC2_CALLBACK_VSYNC,
+ Vsync_2_4 = HWC2_CALLBACK_VSYNC_2_4,
+ VsyncPeriodTimingChanged = HWC2_CALLBACK_VSYNC_PERIOD_TIMING_CHANGED,
};
TO_STRING(hwc2_callback_descriptor_t, Callback, getCallbackDescriptorName)
@@ -767,6 +845,12 @@
};
TO_STRING(hwc2_display_type_t, DisplayType, getDisplayTypeName)
+enum class DisplayConnectionType : uint32_t {
+ Internal = HWC2_DISPLAY_CONNECTION_TYPE_INTERNAL,
+ External = HWC2_DISPLAY_CONNECTION_TYPE_EXTERNAL,
+};
+TO_STRING(hwc2_display_connection_type_t, DisplayConnectionType, getDisplayConnectionTypeName)
+
enum class Error : int32_t {
None = HWC2_ERROR_NONE,
BadConfig = HWC2_ERROR_BAD_CONFIG,
@@ -777,6 +861,8 @@
NoResources = HWC2_ERROR_NO_RESOURCES,
NotValidated = HWC2_ERROR_NOT_VALIDATED,
Unsupported = HWC2_ERROR_UNSUPPORTED,
+ SeamlessNotAllowed = HWC2_ERROR_SEAMLESS_NOT_ALLOWED,
+ SeamlessNotPossible = HWC2_ERROR_SEAMLESS_NOT_POSSIBLE,
};
TO_STRING(hwc2_error_t, Error, getErrorName)
@@ -845,6 +931,14 @@
SetLayerPerFrameMetadataBlobs = HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA_BLOBS,
GetDisplayBrightnessSupport = HWC2_FUNCTION_GET_DISPLAY_BRIGHTNESS_SUPPORT,
SetDisplayBrightness = HWC2_FUNCTION_SET_DISPLAY_BRIGHTNESS,
+
+ // composer 2.4
+ GetDisplayConnectionType = HWC2_FUNCTION_GET_DISPLAY_CONNECTION_TYPE,
+ GetDisplayVsyncPeriod = HWC2_FUNCTION_GET_DISPLAY_VSYNC_PERIOD,
+ SetActiveConfigWithConstraints = HWC2_FUNCTION_SET_ACTIVE_CONFIG_WITH_CONSTRAINTS,
+ SetAutoLowLatencyMode = HWC2_FUNCTION_SET_AUTO_LOW_LATENCY_MODE,
+ GetSupportedContentTypes = HWC2_FUNCTION_GET_SUPPORTED_CONTENT_TYPES,
+ SetContentType = HWC2_FUNCTION_SET_CONTENT_TYPE,
};
TO_STRING(hwc2_function_descriptor_t, FunctionDescriptor,
getFunctionDescriptorName)
@@ -862,6 +956,15 @@
};
TO_STRING(hwc2_power_mode_t, PowerMode, getPowerModeName)
+enum class ContentType : int32_t {
+ None = HWC2_CONTENT_TYPE_NONE,
+ Graphics = HWC2_CONTENT_TYPE_GRAPHICS,
+ Photo = HWC2_CONTENT_TYPE_PHOTO,
+ Cinema = HWC2_CONTENT_TYPE_CINEMA,
+ Game = HWC2_CONTENT_TYPE_GAME,
+};
+TO_STRING(hwc2_content_type_t, ContentType, getContentTypeName)
+
enum class Transform : int32_t {
None = 0,
FlipH = HWC_TRANSFORM_FLIP_H,
@@ -886,6 +989,7 @@
SkipClientColorTransform = HWC2_DISPLAY_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM,
Doze = HWC2_DISPLAY_CAPABILITY_DOZE,
Brightness = HWC2_DISPLAY_CAPABILITY_BRIGHTNESS,
+ AutoLowLatencyMode = HWC2_DISPLAY_CAPABILITY_AUTO_LOW_LATENCY_MODE,
};
TO_STRING(hwc2_display_capability_t, DisplayCapability, getDisplayCapabilityName)
@@ -904,6 +1008,7 @@
typedef uint32_t hwc2_config_t;
typedef uint64_t hwc2_display_t;
typedef uint64_t hwc2_layer_t;
+typedef uint32_t hwc2_vsync_period_t;
/*
* Device Struct
@@ -1030,6 +1135,47 @@
typedef void (*HWC2_PFN_VSYNC)(hwc2_callback_data_t callbackData,
hwc2_display_t display, int64_t timestamp);
+/* vsync_2_4(..., display, timestamp, vsyncPeriodNanos)
+ * Descriptor: HWC2_CALLBACK_VSYNC_2_4
+ * Required for HWC2 devices for composer 2.4
+ *
+ * Notifies the client that a vsync event has occurred. This callback must
+ * only be triggered when vsync is enabled for this display (through
+ * setVsyncEnabled).
+ *
+ * This callback should be triggered from a thread of at least
+ * HAL_PRIORITY_URGENT_DISPLAY with as little latency as possible, typically
+ * less than 0.5 ms. This thread is guaranteed not to call back into the device.
+ *
+ * Parameters:
+ * display - the display which has received a vsync event
+ * timestamp - the CLOCK_MONOTONIC time at which the vsync event occurred, in
+ * nanoseconds
+ * vsyncPeriodNanos - the display vsync period in nanoseconds i.e. the next onVsync2_4 is
+ * expected to be called vsyncPeriod nanoseconds after this call.
+ */
+typedef void (*HWC2_PFN_VSYNC_2_4)(hwc2_callback_data_t callbackData,
+ hwc2_display_t display, int64_t timestamp, hwc2_vsync_period_t vsyncPeriodNanos);
+
+/* vsyncPeriodTimingChanged(..., display, updated_timeline)
+ * Descriptor: HWC2_CALLBACK_VSYNC_PERIOD_TIMING_CHANGED
+ * Optional for HWC2 devices for composer 2.4
+ *
+ * Notifies the client that the previously reported timing for vsync period change has been
+ * updated. This may occur if the composer missed the deadline for changing the vsync period
+ * or the client submitted a refresh frame too late.
+ *
+ * This callback should be triggered from a thread of at least
+ * HAL_PRIORITY_URGENT_DISPLAY with as little latency as possible, typically
+ * less than 0.5 ms. This thread is guaranteed not to call back into the device.
+ *
+ * Parameters:
+ * display - the display which has received a vsync event
+ * updated_timeline - new timeline for the vsync period change
+ */
+typedef void (*HWC2_PFN_VSYNC_PERIOD_TIMING_CHANGED)(hwc2_callback_data_t callbackData,
+ hwc2_display_t display, hwc_vsync_period_change_timeline_t* updated_timeline);
+
/*
* Device Functions
*
@@ -2727,6 +2873,147 @@
typedef int32_t /*hwc_error_t*/ (*HWC2_PFN_SET_DISPLAY_BRIGHTNESS)(hwc2_device_t* device,
hwc2_display_t display, float brightness);
+/* getDisplayConnectionType(..., outType)
+ * Descriptor: HWC2_FUNCTION_GET_DISPLAY_CONNECTION_TYPE
+ * Optional for all HWC2 devices
+ *
+ * Returns whether the given physical display is internal or external.
+ *
+ * Parameters:
+ * outType - the connection type of the display; pointer will be non-NULL
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ * HWC2_ERROR_BAD_DISPLAY when the display is invalid or virtual.
+ */
+typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_DISPLAY_CONNECTION_TYPE)(
+ hwc2_device_t* device, hwc2_display_t display,
+ uint32_t* /*hwc2_display_connection_type_t*/ outType);
+
+/* getDisplayVsyncPeriod(..., outVsyncPeriods)
+ * Descriptor: HWC2_FUNCTION_GET_DISPLAY_VSYNC_PERIOD
+ * Required for HWC2 devices for composer 2.4
+ *
+ * Retrieves which vsync period the display is currently using.
+ *
+ * If no display configuration is currently active, this function must
+ * return BAD_CONFIG. If a vsync period is about to change due to a
+ * setActiveConfigWithConstraints call, this function must return the current vsync period
+ * until the change has taken place.
+ *
+ * Parameters:
+ * outVsyncPeriod - the current vsync period of the display.
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in
+ * HWC2_ERROR_BAD_CONFIG - no configuration is currently active
+ */
+typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_DISPLAY_VSYNC_PERIOD)(
+ hwc2_device_t* device, hwc2_display_t display, hwc2_vsync_period_t* outVsyncPeriod);
+
+/* setActiveConfigWithConstraints(...,
+ * config,
+ * vsyncPeriodChangeConstraints,
+ * outTimeline)
+ * Descriptor: HWC2_FUNCTION_SET_ACTIVE_CONFIG_WITH_CONSTRAINTS
+ * Required for HWC2 devices for composer 2.4
+ *
+ * Sets the active configuration and the refresh rate for this display.
+ * If the new config shares the same config group as the current config,
+ * only the vsync period shall change.
+ * Upon returning, the given display configuration, except vsync period, must be active and
+ * remain so until either this function is called again or the display is disconnected.
+ * When the display starts to refresh at the new vsync period, onVsync_2_4 callback must be
+ * called with the new vsync period.
+ *
+ * Parameters:
+ * config - the new display configuration.
+ * vsyncPeriodChangeConstraints - constraints required for changing vsync period:
+ * desiredTimeNanos - the time in CLOCK_MONOTONIC after
+ * which the vsync period may change
+ * (i.e., the vsync period must not change
+ * before this time).
+ * seamlessRequired - if true, requires that the vsync period
+ * change must happen seamlessly without
+ * a noticeable visual artifact.
+ * outTimeline - the timeline for the vsync period change.
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in.
+ * HWC2_ERROR_BAD_CONFIG - an invalid configuration handle passed in.
+ * HWC2_ERROR_SEAMLESS_NOT_ALLOWED - when seamlessRequired was true but config provided doesn't
+ * share the same config group as the current config.
+ * HWC2_ERROR_SEAMLESS_NOT_POSSIBLE - when seamlessRequired was true but the display cannot
+ * achieve the vsync period change without a noticeable
+ * visual artifact.
+ */
+typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_ACTIVE_CONFIG_WITH_CONSTRAINTS)(
+ hwc2_device_t* device, hwc2_display_t display, hwc2_config_t config,
+ hwc_vsync_period_change_constraints_t* vsyncPeriodChangeConstraints,
+ hwc_vsync_period_change_timeline_t* outTimeline);
+
+/* setAutoLowLatencyMode(displayToken, on)
+ * Descriptor: HWC2_FUNCTION_SET_AUTO_LOW_LATENCY_MODE
+ * Required for HWC2 devices for composer 2.4, connected to a display via HDMI 2.1
+ * Optional for internally connected devices and HDMI <2.1 display connections
+ *
+ * setAutoLowLatencyMode requests that the display goes into low latency mode. If the display
+ * is connected via HDMI 2.1, then Auto Low Latency Mode should be triggered. If the display is
+ * internally connected, then a custom low latency mode should be triggered (if available).
+ *
+ * Parameters:
+ * on - indicates whether to turn low latency mode on (=true) or off (=false)
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ * HWC2_ERROR_BAD_DISPLAY - when the display is invalid, or
+ * HWC2_ERROR_UNSUPPORTED - when the display does not support any low latency mode
+ */
+typedef int32_t /*hwc_error_t*/ (*HWC2_PFN_SET_AUTO_LOW_LATENCY_MODE)(hwc2_device_t* device,
+ hwc2_display_t display, bool on);
+
+/* getSupportedContentTypes(..., outSupportedContentTypes)
+ * Descriptor: HWC2_FUNCTION_GET_SUPPORTED_CONTENT_TYPES
+ * Required for HWC2 devices for composer 2.4
+ *
+ * getSupportedContentTypes returns a list of supported content types
+ * (as described in the definition of ContentType above).
+ * This list must not change after initialization.
+ *
+ * Parameters:
+ * outNumSupportedContentTypes - if outSupportedContentTypes was nullptr, returns the number
+ * of supported content types; if outSupportedContentTypes was not nullptr, returns the
+ * number of capabilities stored in outSupportedContentTypes, which must not exceed the
+ * value stored in outNumSupportedContentTypes prior to the call; pointer will be non-NULL
+ * outSupportedContentTypes - a list of supported content types.
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in
+ */
+typedef int32_t /*hwc_error_t*/ (*HWC2_PFN_GET_SUPPORTED_CONTENT_TYPES)(hwc2_device_t* device,
+ hwc2_display_t display, uint32_t* outNumSupportedContentTypes, uint32_t* outSupportedContentTypes);
+
+/* setContentType(displayToken, contentType)
+ * Descriptor: HWC2_FUNCTION_SET_CONTENT_TYPE
+ * Required for HWC2 devices for composer 2.4
+ * Optional for HWC2 devices for composer 2.1, 2.2, 2.3
+ *
+ * setContentType instructs the display that the content being shown is of the given contentType
+ * (one of GRAPHICS, PHOTO, CINEMA, GAME).
+ *
+ * According to the HDMI 1.4 specification, supporting all content types is optional. Whether
+ * the display supports a given content type is reported by getSupportedContentTypes.
+ *
+ * Parameters:
+ * contentType - the type of content that is currently being shown on the display
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ * HWC2_ERROR_BAD_DISPLAY - when the display is invalid, or
+ * HWC2_ERROR_UNSUPPORTED - when the given content type is a valid content type, but is not
+ * supported on this display, or
+ * HWC2_ERROR_BAD_PARAMETER - when the given content type is invalid
+ */
+typedef int32_t /*hwc_error_t*/ (*HWC2_PFN_SET_CONTENT_TYPE)(hwc2_device_t* device,
+ hwc2_display_t display, int32_t /* hwc2_content_type_t */ contentType);
+
__END_DECLS
#endif
diff --git a/include/hardware/hwcomposer_defs.h b/include/hardware/hwcomposer_defs.h
index fd373e3..db81c51 100644
--- a/include/hardware/hwcomposer_defs.h
+++ b/include/hardware/hwcomposer_defs.h
@@ -250,6 +250,11 @@
/* Indicates which of the vendor-defined color transforms is provided by
* this configuration. */
HWC_DISPLAY_COLOR_TRANSFORM = 6,
+
+ /* The configuration group this config is associated to. The groups are defined
+ * to mark certain configs as similar and changing configs within a certain group
+ * may be done seamlessly in some conditions. setActiveConfigWithConstraints. */
+ HWC_DISPLAY_CONFIG_GROUP = 7,
};
/* Allowed events for hwc_methods::eventControl() */
@@ -299,6 +304,32 @@
HWC_POWER_MODE_DOZE_SUSPEND = 3,
};
+/* Constraints for changing vsync period */
+typedef struct hwc_vsync_period_change_constraints {
+ /* Time in CLOCK_MONOTONIC after which the vsync period may change
+ * (i.e., the vsync period must not change before this time). */
+ int64_t desiredTimeNanos;
+ /*
+ * If true, requires that the vsync period change must happen seamlessly without
+ * a noticeable visual artifact. */
+ uint8_t seamlessRequired;
+} hwc_vsync_period_change_constraints_t;
+
+/* Timing for a vsync period change. */
+typedef struct hwc_vsync_period_change_timeline {
+ /* The time in CLOCK_MONOTONIC when the new display will start to refresh at
+ * the new vsync period. */
+ int64_t newVsyncAppliedTimeNanos;
+
+ /* Set to true if the client is required to sent a frame to be displayed before
+ * the change can take place. */
+ uint8_t refreshRequired;
+
+ /* The time in CLOCK_MONOTONIC when the client is expected to send the new frame.
+ * Should be ignored if refreshRequired is false. */
+ int64_t refreshTimeNanos;
+} hwc_vsync_period_change_timeline_t;
+
/*****************************************************************************/
__END_DECLS
diff --git a/include/hardware/sound_trigger.h b/include/hardware/sound_trigger.h
index 99346ef..573ada8 100644
--- a/include/hardware/sound_trigger.h
+++ b/include/hardware/sound_trigger.h
@@ -41,7 +41,8 @@
#define SOUND_TRIGGER_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0)
#define SOUND_TRIGGER_DEVICE_API_VERSION_1_1 HARDWARE_DEVICE_API_VERSION(1, 1)
#define SOUND_TRIGGER_DEVICE_API_VERSION_1_2 HARDWARE_DEVICE_API_VERSION(1, 2)
-#define SOUND_TRIGGER_DEVICE_API_VERSION_CURRENT SOUND_TRIGGER_DEVICE_API_VERSION_1_2
+#define SOUND_TRIGGER_DEVICE_API_VERSION_1_3 HARDWARE_DEVICE_API_VERSION(1, 3)
+#define SOUND_TRIGGER_DEVICE_API_VERSION_CURRENT SOUND_TRIGGER_DEVICE_API_VERSION_1_3
/**
* List of known sound trigger HAL modules. This is the base name of the sound_trigger HAL
@@ -123,6 +124,37 @@
*/
int (*get_model_state)(const struct sound_trigger_hw_device *dev,
sound_model_handle_t sound_model_handle);
+
+ /* Set a model specific ModelParameter with the given value. This parameter
+ * will keep its value for the duration the model is loaded regardless of starting and stopping
+ * recognition. Once the model is unloaded, the value will be lost.
+ * Returns 0 or an error code.
+ * Only supported for device api versions SOUND_TRIGGER_DEVICE_API_VERSION_1_3 or above.
+ */
+ int (*set_parameter)(const struct sound_trigger_hw_device *dev,
+ sound_model_handle_t sound_model_handle,
+ sound_trigger_model_parameter_t model_param, int32_t value);
+
+ /* Get a model specific ModelParameter. This parameter will keep its value
+ * for the duration the model is loaded regardless of starting and stopping recognition.
+ * Once the model is unloaded, the value will be lost. If the value is not set, a default
+ * value is returned. See sound_trigger_model_parameter_t for parameter default values.
+ * Returns 0 or an error code. On return 0, value pointer will be set.
+ * Only supported for device api versions SOUND_TRIGGER_DEVICE_API_VERSION_1_3 or above.
+ */
+ int (*get_parameter)(const struct sound_trigger_hw_device *dev,
+ sound_model_handle_t sound_model_handle,
+ sound_trigger_model_parameter_t model_param, int32_t* value);
+
+ /* Get supported parameter attributes with respect to the provided model
+ * handle. Along with determining the valid range, this API is also used
+ * to determine if a given parameter ID is supported at all by the
+ * modelHandle for use with getParameter and setParameter APIs.
+ */
+ int (*query_parameter)(const struct sound_trigger_hw_device *dev,
+ sound_model_handle_t sound_model_handle,
+ sound_trigger_model_parameter_t model_param,
+ sound_trigger_model_parameter_range_t* param_range);
};
typedef struct sound_trigger_hw_device sound_trigger_hw_device_t;
diff --git a/modules/audio_remote_submix/audio_hw.cpp b/modules/audio_remote_submix/audio_hw.cpp
index dda0d0e..103f57d 100644
--- a/modules/audio_remote_submix/audio_hw.cpp
+++ b/modules/audio_remote_submix/audio_hw.cpp
@@ -821,12 +821,22 @@
return 0;
}
- // If the write to the sink would block when no input stream is present, flush enough frames
+ // If the write to the sink would block, flush enough frames
// from the pipe to make space to write the most recent data.
+ // We DO NOT block if:
+ // - no peer input stream is present
+ // - the peer input is in standby AFTER having been active.
+ // We DO block if:
+ // - the input was never activated to avoid discarding first frames
+ // in the pipe in case capture start was delayed
{
const size_t availableToWrite = sink->availableToWrite();
+ // NOTE: rsxSink has been checked above and sink and source life cycles are synchronized
sp<MonoPipeReader> source = rsxadev->routes[out->route_handle].rsxSource;
- if (rsxadev->routes[out->route_handle].input == NULL && availableToWrite < frames) {
+ const struct submix_stream_in *in = rsxadev->routes[out->route_handle].input;
+ const bool dont_block = (in == NULL)
+ || (in->input_standby && (in->read_counter_frames != 0));
+ if (dont_block && availableToWrite < frames) {
static uint8_t flush_buffer[64];
const size_t flushBufferSizeFrames = sizeof(flush_buffer) / frame_size;
size_t frames_to_flush_from_source = frames - availableToWrite;
@@ -896,8 +906,14 @@
int ret = -EWOULDBLOCK;
pthread_mutex_lock(&rsxadev->lock);
- const ssize_t frames_in_pipe =
- rsxadev->routes[out->route_handle].rsxSource->availableToRead();
+ sp<MonoPipeReader> source = rsxadev->routes[out->route_handle].rsxSource;
+ if (source == NULL) {
+ ALOGW("%s called on released output", __FUNCTION__);
+ pthread_mutex_unlock(&rsxadev->lock);
+ return -ENODEV;
+ }
+
+ const ssize_t frames_in_pipe = source->availableToRead();
if (CC_UNLIKELY(frames_in_pipe < 0)) {
*frames = out->frames_written;
ret = 0;
@@ -930,8 +946,14 @@
struct submix_audio_device * const rsxadev = out->dev;
pthread_mutex_lock(&rsxadev->lock);
- const ssize_t frames_in_pipe =
- rsxadev->routes[out->route_handle].rsxSource->availableToRead();
+ sp<MonoPipeReader> source = rsxadev->routes[out->route_handle].rsxSource;
+ if (source == NULL) {
+ ALOGW("%s called on released output", __FUNCTION__);
+ pthread_mutex_unlock(&rsxadev->lock);
+ return -ENODEV;
+ }
+
+ const ssize_t frames_in_pipe = source->availableToRead();
if (CC_UNLIKELY(frames_in_pipe < 0)) {
*dsp_frames = (uint32_t)out->frames_written_since_standby;
} else {