Add plumbing for HDR metadata
Allow a ANativeWindow client to send HDR metadata to SurfaceFlinger.
The metadata can be queried with
BufferLayerConsumer::getCurrentHdrMetadata.
Written by Courtney. Updated by olv@.
Bug: 63710530
Test: builds
Change-Id: I23192d4750950664b57863a533bffd72397255b4
diff --git a/libs/nativewindow/include/system/window.h b/libs/nativewindow/include/system/window.h
index 6490804..69e0951 100644
--- a/libs/nativewindow/include/system/window.h
+++ b/libs/nativewindow/include/system/window.h
@@ -225,6 +225,8 @@
NATIVE_WINDOW_GET_HDR_SUPPORT = 29,
NATIVE_WINDOW_SET_USAGE64 = 30,
NATIVE_WINDOW_GET_CONSUMER_USAGE64 = 31,
+ NATIVE_WINDOW_SET_BUFFERS_SMPTE2086_METADATA = 32,
+ NATIVE_WINDOW_SET_BUFFERS_CTA861_3_METADATA = 33,
// clang-format on
};
@@ -700,6 +702,42 @@
}
/*
+ * native_window_set_buffers_smpte2086_metadata(..., metadata)
+ * All buffers queued after this call will be associated with the SMPTE
+ * ST.2086 metadata specified.
+ *
+ * metadata specifies additional information about the contents of the buffer
+ * that may affect how it's displayed. When it is nullptr, it means no such
+ * information is available. No SMPTE ST.2086 metadata is associated with the
+ * buffers by default.
+ */
+static inline int native_window_set_buffers_smpte2086_metadata(
+ struct ANativeWindow* window,
+ const struct android_smpte2086_metadata* metadata)
+{
+ return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_SMPTE2086_METADATA,
+ metadata);
+}
+
+/*
+ * native_window_set_buffers_cta861_3_metadata(..., metadata)
+ * All buffers queued after this call will be associated with the CTA-861.3
+ * metadata specified.
+ *
+ * metadata specifies additional information about the contents of the buffer
+ * that may affect how it's displayed. When it is nullptr, it means no such
+ * information is available. No CTA-861.3 metadata is associated with the
+ * buffers by default.
+ */
+static inline int native_window_set_buffers_cta861_3_metadata(
+ struct ANativeWindow* window,
+ const struct android_cta861_3_metadata* metadata)
+{
+ return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_CTA861_3_METADATA,
+ metadata);
+}
+
+/*
* native_window_set_buffers_transform(..., int transform)
* All buffers queued after this call will be displayed transformed according
* to the transform parameter specified.