Polish up metadata propagation for native window
Allow for native window apis to attempt to apply gralloc4 metadata
whenever a buffer is queued onto a native window for dataspace and
existing apis for HDR metadata.
Motivation:
1. We are attempting to move to Gralloc 4 metadata as the source of
truth for this information, rather than a separate side-channel.
2. ANativeWindow_setBuffersDataspace is a public api, but gralloc4
metadata is not public, so the only way to keep the gralloc4 metadata
in sync for dataspace is to intercept on Surface.
3. HDR Metadata may be applied on eglSurface and vkSwapchain, which must
be propagated to gralloc4 metadata to ensure consistency.
4. None of the plumbing for setting gralloc4 metadata existed, so now's
a good time as any to add the plumbing so that we can start at least
best-effort using this metadata infrastructure in the framework and
so that vendor's don't have to reinvent setting metadata.
Bug: 210498094
Test: builds, boots
Change-Id: I6d19dc4ceca8fa885363faf84f57885e58e88240
diff --git a/libs/ui/GraphicBufferMapper.cpp b/libs/ui/GraphicBufferMapper.cpp
index 82d6cd5..a98e697 100644
--- a/libs/ui/GraphicBufferMapper.cpp
+++ b/libs/ui/GraphicBufferMapper.cpp
@@ -281,6 +281,10 @@
return mMapper->getDataspace(bufferHandle, outDataspace);
}
+status_t GraphicBufferMapper::setDataspace(buffer_handle_t bufferHandle, ui::Dataspace dataspace) {
+ return mMapper->setDataspace(bufferHandle, dataspace);
+}
+
status_t GraphicBufferMapper::getBlendMode(buffer_handle_t bufferHandle,
ui::BlendMode* outBlendMode) {
return mMapper->getBlendMode(bufferHandle, outBlendMode);
@@ -291,21 +295,41 @@
return mMapper->getSmpte2086(bufferHandle, outSmpte2086);
}
+status_t GraphicBufferMapper::setSmpte2086(buffer_handle_t bufferHandle,
+ std::optional<ui::Smpte2086> smpte2086) {
+ return mMapper->setSmpte2086(bufferHandle, smpte2086);
+}
+
status_t GraphicBufferMapper::getCta861_3(buffer_handle_t bufferHandle,
std::optional<ui::Cta861_3>* outCta861_3) {
return mMapper->getCta861_3(bufferHandle, outCta861_3);
}
+status_t GraphicBufferMapper::setCta861_3(buffer_handle_t bufferHandle,
+ std::optional<ui::Cta861_3> cta861_3) {
+ return mMapper->setCta861_3(bufferHandle, cta861_3);
+}
+
status_t GraphicBufferMapper::getSmpte2094_40(
buffer_handle_t bufferHandle, std::optional<std::vector<uint8_t>>* outSmpte2094_40) {
return mMapper->getSmpte2094_40(bufferHandle, outSmpte2094_40);
}
+status_t GraphicBufferMapper::setSmpte2094_40(buffer_handle_t bufferHandle,
+ std::optional<std::vector<uint8_t>> smpte2094_40) {
+ return mMapper->setSmpte2094_40(bufferHandle, smpte2094_40);
+}
+
status_t GraphicBufferMapper::getSmpte2094_10(
buffer_handle_t bufferHandle, std::optional<std::vector<uint8_t>>* outSmpte2094_10) {
return mMapper->getSmpte2094_10(bufferHandle, outSmpte2094_10);
}
+status_t GraphicBufferMapper::setSmpte2094_10(buffer_handle_t bufferHandle,
+ std::optional<std::vector<uint8_t>> smpte2094_10) {
+ return mMapper->setSmpte2094_10(bufferHandle, smpte2094_10);
+}
+
status_t GraphicBufferMapper::getDefaultPixelFormatFourCC(uint32_t width, uint32_t height,
PixelFormat format, uint32_t layerCount,
uint64_t usage,