summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Hall <jessehall@google.com>2014-02-13 15:38:56 -0800
committerJesse Hall <jessehall@google.com>2014-03-11 12:02:11 -0700
commit8c79c08578b51a1385759eddf25b0ec5f03e5198 (patch)
treebcf50f553cc2542199fef9abfdbd60d3deaf9ae3
parentd35b818e4f9a7414921eb59539d7f47086cf649d (diff)
downloadhardware_libhardware-8c79c08578b51a1385759eddf25b0ec5f03e5198.zip
hardware_libhardware-8c79c08578b51a1385759eddf25b0ec5f03e5198.tar.gz
hardware_libhardware-8c79c08578b51a1385759eddf25b0ec5f03e5198.tar.bz2
Add HWC 1.4 with support for sideband video layers
Change-Id: Ie40668a8667e26f1d570a2f756f1178d0dcbbf5c
-rw-r--r--include/hardware/hwcomposer.h52
-rw-r--r--include/hardware/hwcomposer_defs.h5
2 files changed, 49 insertions, 8 deletions
diff --git a/include/hardware/hwcomposer.h b/include/hardware/hwcomposer.h
index 82e7671..afb4e99 100644
--- a/include/hardware/hwcomposer.h
+++ b/include/hardware/hwcomposer.h
@@ -121,6 +121,26 @@ typedef struct hwc_layer_1 {
* that the layer will be handled by the HWC (ie: it must not be
* composited with OpenGL ES).
*
+ *
+ * HWC_SIDEBAND
+ * Set by the caller before calling (*prepare)(), this value indicates
+ * the contents of this layer come from a sideband video stream.
+ *
+ * The h/w composer is responsible for receiving new image buffers from
+ * the stream at the appropriate time (e.g. synchronized to a separate
+ * audio stream), compositing them with the current contents of other
+ * layers, and displaying the resulting image. This happens
+ * independently of the normal prepare/set cycle. The prepare/set calls
+ * only happen when other layers change, or when properties of the
+ * sideband layer such as position or size change.
+ *
+ * If the h/w composer can't handle the layer as a sideband stream for
+ * some reason (e.g. unsupported scaling/blending/rotation, or too many
+ * sideband layers) it can set compositionType to HWC_FRAMEBUFFER in
+ * (*prepare)(). However, doing so will result in the layer being shown
+ * as a solid color since the platform is not currently able to composite
+ * sideband layers with the GPU. This may be improved in future
+ * versions of the platform.
*/
int32_t compositionType;
@@ -141,13 +161,21 @@ typedef struct hwc_layer_1 {
hwc_color_t backgroundColor;
struct {
- /* handle of buffer to compose. This handle is guaranteed to have been
- * allocated from gralloc using the GRALLOC_USAGE_HW_COMPOSER usage flag. If
- * the layer's handle is unchanged across two consecutive prepare calls and
- * the HWC_GEOMETRY_CHANGED flag is not set for the second call then the
- * HWComposer implementation may assume that the contents of the buffer have
- * not changed. */
- buffer_handle_t handle;
+ union {
+ /* When compositionType is HWC_FRAMEBUFFER, HWC_OVERLAY,
+ * HWC_FRAMEBUFFER_TARGET, this is the handle of the buffer to
+ * compose. This handle is guaranteed to have been allocated
+ * from gralloc using the GRALLOC_USAGE_HW_COMPOSER usage flag.
+ * If the layer's handle is unchanged across two consecutive
+ * prepare calls and the HWC_GEOMETRY_CHANGED flag is not set
+ * for the second call then the HWComposer implementation may
+ * assume that the contents of the buffer have not changed. */
+ buffer_handle_t handle;
+
+ /* When compositionType is HWC_SIDEBAND, this is the handle
+ * of the sideband video stream to compose. */
+ const native_handle_t* sidebandStream;
+ };
/* transformation to apply to the buffer during composition */
uint32_t transform;
@@ -191,6 +219,10 @@ typedef struct hwc_layer_1 {
* reads from them are complete before the framebuffer is ready for
* display.
*
+ * HWC_SIDEBAND layers will never have an acquire fence, since
+ * synchronization is handled through implementation-defined
+ * sideband mechanisms.
+ *
* The HWC takes ownership of the acquireFenceFd and is responsible
* for closing it when no longer needed.
*/
@@ -214,6 +246,10 @@ typedef struct hwc_layer_1 {
* produce a release fence for them. The releaseFenceFd will be -1
* for these layers when set() is called.
*
+ * Since HWC_SIDEBAND buffers don't pass through the HWC client,
+ * the HWC shouldn't produce a release fence for them. The
+ * releaseFenceFd will be -1 for these layers when set() is called.
+ *
* The HWC client taks ownership of the releaseFenceFd and is
* responsible for closing it when no longer needed.
*/
@@ -262,7 +298,7 @@ typedef struct hwc_layer_1 {
};
/* Allow for expansion w/o breaking binary compatibility.
- * Pad layer to 96 bytes.
+ * Pad layer to 96 bytes, assuming 32-bit pointers.
*/
int32_t reserved[24 - 19];
diff --git a/include/hardware/hwcomposer_defs.h b/include/hardware/hwcomposer_defs.h
index c69a4bc..242e3f6 100644
--- a/include/hardware/hwcomposer_defs.h
+++ b/include/hardware/hwcomposer_defs.h
@@ -36,6 +36,7 @@ __BEGIN_DECLS
#define HWC_DEVICE_API_VERSION_1_1 HARDWARE_DEVICE_API_VERSION_2(1, 1, HWC_HEADER_VERSION)
#define HWC_DEVICE_API_VERSION_1_2 HARDWARE_DEVICE_API_VERSION_2(1, 2, HWC_HEADER_VERSION)
#define HWC_DEVICE_API_VERSION_1_3 HARDWARE_DEVICE_API_VERSION_2(1, 3, HWC_HEADER_VERSION)
+#define HWC_DEVICE_API_VERSION_1_4 HARDWARE_DEVICE_API_VERSION_2(1, 4, HWC_HEADER_VERSION)
enum {
/* hwc_composer_device_t::set failed in EGL */
@@ -95,6 +96,10 @@ enum {
/* this layer holds the result of compositing the HWC_FRAMEBUFFER layers.
* Added in HWC_DEVICE_API_VERSION_1_1. */
HWC_FRAMEBUFFER_TARGET = 3,
+
+ /* this layer's contents are taken from a sideband buffer stream.
+ * Added in HWC_DEVICE_API_VERSION_1_4. */
+ HWC_SIDEBAND = 4,
};
/*