sf: Allocate displayId based on usage flags for VD devices
Allocate hwcDisplayId for VirtualDisplayDevices based on
the usage flags set by the client.
Change-Id: I373a31e26709590301a7a83cf8b85853d8aa4c70
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 7bed78e..e21b936 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -77,6 +77,9 @@
#include "RenderEngine/RenderEngine.h"
#include <cutils/compiler.h>
+#ifdef QCOM_BSP
+#include <gralloc_priv.h>
+#endif
#ifdef QCOM_BSP
#include <display_config.h>
@@ -1309,7 +1312,13 @@
// so the GLES driver can pass buffers directly to the sink.
producer = state.surface;
} else {
- hwcDisplayId = allocateHwcDisplayId(state.type);
+ int sinkUsage = -1;
+ state.surface->query(NATIVE_WINDOW_CONSUMER_USAGE_BITS, &sinkUsage);
+#ifdef QCOM_BSP
+ if(sinkUsage & GRALLOC_USAGE_PRIVATE_WFD)
+#endif
+ hwcDisplayId = allocateHwcDisplayId(state.type);
+
if (hwcDisplayId >= 0) {
// This is for WFD virtual display scenario.
// Read virtual display properties and create a