Merge "audio effects: add audio source indication" into jb-mr1-dev
diff --git a/include/hardware/camera2.h b/include/hardware/camera2.h
index 8209985..8b789ec 100644
--- a/include/hardware/camera2.h
+++ b/include/hardware/camera2.h
@@ -667,6 +667,48 @@
uint32_t *max_buffers);
/**
+ * allocate_reprocess_stream_from_stream:
+ *
+ * Allocate a new input stream for use, which will use the buffers allocated
+ * for an existing output stream. That is, after the HAL enqueues a buffer
+ * onto the output stream, it may see that same buffer handed to it from
+ * this input reprocessing stream. After the HAL releases the buffer back to
+ * the reprocessing stream, it will be returned to the output queue for
+ * reuse.
+ *
+ * Error conditions:
+ *
+ * - Using an output stream of unsuitable size/format for the basis of the
+ * reprocessing stream.
+ *
+ * - Attempting to allocatee too many reprocessing streams at once.
+ *
+ * Input parameters:
+ *
+ * - output_stream_id: The ID of an existing output stream which has
+ * a size and format suitable for reprocessing.
+ *
+ * - reprocess_stream_ops: A structure of function pointers for acquiring
+ * and releasing buffers for this stream. The underlying stream will use
+ * the same graphics buffer handles as the output stream uses.
+ *
+ * Output parameters:
+ *
+ * - stream_id: An unsigned integer identifying this stream. This value is
+ * used in incoming requests to identify the stream, and in releasing the
+ * stream. These ids are numbered separately from the input stream ids.
+ *
+ * The HAL client must always release the reprocessing stream before it
+ * releases the output stream it is based on.
+ *
+ */
+ int (*allocate_reprocess_stream_from_stream)(const struct camera2_device *,
+ uint32_t output_stream_id,
+ const camera2_stream_in_ops_t *reprocess_stream_ops,
+ // outputs
+ uint32_t *stream_id);
+
+ /**
* Release a reprocessing stream. Returns an error if called when
* get_in_progress_count is non-zero, or if the stream id is not
* valid.
diff --git a/include/hardware/gralloc.h b/include/hardware/gralloc.h
index 4fdd2e6..7c819f0 100644
--- a/include/hardware/gralloc.h
+++ b/include/hardware/gralloc.h
@@ -81,7 +81,9 @@
/* buffer will be read by the HW camera pipeline */
GRALLOC_USAGE_HW_CAMERA_READ = 0x00040000,
/* buffer will be used as part of zero-shutter-lag queue */
- GRALLOC_USAGE_HW_CAMERA_ZSL = 0x00080000,
+ GRALLOC_USAGE_HW_CAMERA_ZSL = 0x00060000,
+ /* mask for the camera access values */
+ GRALLOC_USAGE_HW_CAMERA_MASK = 0x00060000,
/* mask for the software usage bit-mask */
GRALLOC_USAGE_HW_MASK = 0x00071F00,
diff --git a/include/hardware/hwcomposer.h b/include/hardware/hwcomposer.h
index 29ea54c..0a4d40d 100644
--- a/include/hardware/hwcomposer.h
+++ b/include/hardware/hwcomposer.h
@@ -270,7 +270,7 @@
* received and HWC_EVENT_VSYNC is enabled on a display
* (see: hwc_event_control).
*
- * the "dpy" parameter indicates which display the vsync event is for.
+ * the "disp" parameter indicates which display the vsync event is for.
* the "timestamp" parameter is the system monotonic clock timestamp in
* nanosecond of when the vsync event happened.
*
@@ -285,7 +285,27 @@
* can either stop or continue to process VSYNC events, but must not
* crash or cause other problems.
*/
- void (*vsync)(const struct hwc_procs* procs, int dpy, int64_t timestamp);
+ void (*vsync)(const struct hwc_procs* procs, int disp, int64_t timestamp);
+
+ /*
+ * (*hotplug)() is called by the h/w composer HAL when a display is
+ * connected or disconnected. The PRIMARY display is always connected and
+ * the hotplug callback should not be called for it.
+ *
+ * The disp parameter indicates which display type this event is for.
+ * The connected parameter indicates whether the display has just been
+ * connected (1) or disconnected (0).
+ *
+ * The hotplug() callback may call back into the h/w composer on the same
+ * thread to query refresh rate and dpi for the display. Additionally,
+ * other threads may be calling into the h/w composer while the callback
+ * is in progress.
+ *
+ * This callback will be NULL if the h/w composer is using
+ * HWC_DEVICE_API_VERSION_1_0.
+ */
+ void (*hotplug)(const struct hwc_procs* procs, int disp, int connected);
+
} hwc_procs_t;
@@ -384,7 +404,7 @@
* returns -EINVAL if the "event" parameter is not one of the value above
* or if the "enabled" parameter is not 0 or 1.
*/
- int (*eventControl)(struct hwc_composer_device_1* dev, int dpy,
+ int (*eventControl)(struct hwc_composer_device_1* dev, int disp,
int event, int enabled);
/*
@@ -398,7 +418,7 @@
*
* returns 0 on success, negative on error.
*/
- int (*blank)(struct hwc_composer_device_1* dev, int dpy, int blank);
+ int (*blank)(struct hwc_composer_device_1* dev, int disp, int blank);
/*
* Used to retrieve information about the h/w composer
@@ -425,6 +445,47 @@
void (*dump)(struct hwc_composer_device_1* dev, char *buff, int buff_len);
/*
+ * (*getDisplayConfigs)() returns handles for the configurations available
+ * on the connected display. These handles must remain valid as long as the
+ * display is connected.
+ *
+ * Configuration handles are written to configs. The number of entries
+ * allocated by the caller is passed in *numConfigs; getDisplayConfigs must
+ * not try to write more than this number of config handles. On return, the
+ * total number of configurations available for the display is returned in
+ * *numConfigs. If *numConfigs is zero on entry, then configs may be NULL.
+ *
+ * HWC_DEVICE_API_VERSION_1_1 does not provide a way to choose a config.
+ * For displays that support multiple configurations, the h/w composer
+ * implementation should choose one and report it as the first config in
+ * the list. Reporting the not-chosen configs is not required.
+ *
+ * Returns 0 on success or -errno on error.
+ *
+ * This field is REQUIRED for HWC_DEVICE_API_VERSION_1_1 and later.
+ * It should be NULL for previous versions.
+ */
+ int (*getDisplayConfigs)(struct hwc_composer_device_1* dev, int disp,
+ uint32_t* configs, size_t* numConfigs);
+
+ /*
+ * (*getDisplayAttributes)() returns attributes for a specific config of a
+ * connected display. The config parameter is one of the config handles
+ * returned by getDisplayConfigs.
+ *
+ * The list of attributes to return is provided in the attributes
+ * parameter, terminated by HWC_DISPLAY_NO_ATTRIBUTE. The value for each
+ * requested attribute is written in order to the values array. The
+ * HWC_DISPLAY_NO_ATTRIBUTE attribute does not have a value, so the values
+ * array will have one less value than the attributes array.
+ *
+ * This field is REQUIRED for HWC_DEVICE_API_VERSION_1_1 and later.
+ * It should be NULL for previous versions.
+ */
+ void (*getDisplayAttributes)(struct hwc_composer_device_1* dev, int disp,
+ uint32_t config, const uint32_t* attributes, int32_t* values);
+
+ /*
* Reserved for future use. Must be NULL.
*/
void* reserved_proc[4];
diff --git a/include/hardware/hwcomposer_defs.h b/include/hardware/hwcomposer_defs.h
index bd9f41c..60cf827 100644
--- a/include/hardware/hwcomposer_defs.h
+++ b/include/hardware/hwcomposer_defs.h
@@ -30,7 +30,7 @@
#define HWC_HEADER_VERSION 1
-#define HWC_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION_2(0, 1, HWC_HEADER_VERSION)
+#define HWC_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION(0, 1)
#define HWC_DEVICE_API_VERSION_0_1 HARDWARE_DEVICE_API_VERSION_2(0, 1, HWC_HEADER_VERSION)
#define HWC_DEVICE_API_VERSION_0_2 HARDWARE_DEVICE_API_VERSION_2(0, 2, HWC_HEADER_VERSION)
@@ -132,24 +132,51 @@
/* attributes queriable with query() */
enum {
/*
- * availability: HWC_DEVICE_API_VERSION_0_2
- * must return 1 if the background layer is supported, 0 otherwise
+ * Availability: HWC_DEVICE_API_VERSION_0_2
+ * Must return 1 if the background layer is supported, 0 otherwise.
*/
HWC_BACKGROUND_LAYER_SUPPORTED = 0,
/*
- * availability: HWC_DEVICE_API_VERSION_0_3
- * returns the vsync period in nanosecond
+ * Availability: HWC_DEVICE_API_VERSION_0_3
+ * Returns the vsync period in nanoseconds.
+ *
+ * This query is not used for HWC_DEVICE_API_VERSION_1_1 and later.
+ * Instead, the per-display attribute HWC_DISPLAY_VSYNC_PERIOD is used.
*/
HWC_VSYNC_PERIOD = 1,
/*
- * availability: HWC_DEVICE_API_VERSION_1_1
- * returns a mask of supported display types
+ * Availability: HWC_DEVICE_API_VERSION_1_1
+ * Returns a mask of supported display types.
*/
HWC_DISPLAY_TYPES_SUPPORTED = 2,
};
+/* display attributes returned by getDisplayAttributes() */
+enum {
+ /* Indicates the end of an attribute list */
+ HWC_DISPLAY_NO_ATTRIBUTE = 0,
+
+ /* The vsync period in nanoseconds */
+ HWC_DISPLAY_VSYNC_PERIOD = 1,
+
+ /* The number of pixels in the horizontal and vertical directions. */
+ HWC_DISPLAY_RESOLUTION_X = 2,
+ HWC_DISPLAY_RESOLUTION_Y = 3,
+
+ /* The number of pixels per thousand inches of this configuration.
+ *
+ * Scaling DPI by 1000 allows it to be stored in an int without losing
+ * too much precision.
+ *
+ * If the DPI for a configuration is unavailable or the HWC implementation
+ * considers it unreliable, it should set these attributes to zero.
+ */
+ HWC_DISPLAY_DPI_X = 4,
+ HWC_DISPLAY_DPI_Y = 5,
+};
+
/* Allowed events for hwc_methods::eventControl() */
enum {
HWC_EVENT_VSYNC = 0