VR: Update VR HWC to use buffer metadata passed by SurfaceFlinger
Without gralloc1 support, need to pass buffer metadata in order to
import native buffers and used them as graphic buffers.
Bug: 36481301
Test: Compiled and ran on device; Verified VR Window Manager properly
displays SurfaceFlinger buffers.
Change-Id: I8426be1d79dcc2fbd631c399427ae03cb2afc21d
diff --git a/services/surfaceflinger/DisplayHardware/ComposerHal.h b/services/surfaceflinger/DisplayHardware/ComposerHal.h
index 18af9dd..37b7766 100644
--- a/services/surfaceflinger/DisplayHardware/ComposerHal.h
+++ b/services/surfaceflinger/DisplayHardware/ComposerHal.h
@@ -23,6 +23,7 @@
#include <utility>
#include <vector>
+#include <android/frameworks/vr/composer/1.0/IVrComposerClient.h>
#include <android/hardware/graphics/composer/2.1/IComposer.h>
#include <utils/StrongPointer.h>
#include <IComposerCommandBuffer.h>
@@ -31,6 +32,8 @@
namespace Hwc2 {
+using android::frameworks::vr::composer::V1_0::IVrComposerClient;
+
using android::hardware::graphics::common::V1_0::ColorMode;
using android::hardware::graphics::common::V1_0::ColorTransform;
using android::hardware::graphics::common::V1_0::Dataspace;
@@ -179,7 +182,7 @@
* When target is not nullptr, the cache is updated with the new target.
*/
Error setClientTarget(Display display, uint32_t slot,
- const native_handle_t* target,
+ const sp<GraphicBuffer>& target,
int acquireFence, Dataspace dataspace,
const std::vector<IComposerClient::Rect>& damage);
Error setColorMode(Display display, ColorMode mode);
@@ -199,7 +202,7 @@
int32_t x, int32_t y);
/* see setClientTarget for the purpose of slot */
Error setLayerBuffer(Display display, Layer layer, uint32_t slot,
- const native_handle_t* buffer, int acquireFence);
+ const sp<GraphicBuffer>& buffer, int acquireFence);
Error setLayerSurfaceDamage(Display display, Layer layer,
const std::vector<IComposerClient::Rect>& damage);
Error setLayerBlendMode(Display display, Layer layer,
@@ -232,6 +235,14 @@
~CommandWriter() override;
void setLayerInfo(uint32_t type, uint32_t appId);
+ void setClientTargetMetadata(
+ const IVrComposerClient::BufferMetadata& metadata);
+ void setLayerBufferMetadata(
+ const IVrComposerClient::BufferMetadata& metadata);
+
+ private:
+ void writeBufferMetadata(
+ const IVrComposerClient::BufferMetadata& metadata);
};
// Many public functions above simply write a command into the command