Set priority among various display devices
* When a non-WFD virtual display device (SSD/
screenrecord) is active along with
non-hybrid WFD solution(WFD faked on
external), give preference to non-hybrid WFD
device over non-WFD virtual display device.
* This is needed only in cases when WFD is
enabled via v4l2 rather than using VDS api's.
Change-Id: I63e53baa214bdcdac19430ca30b939cdd7416cbb
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index bec51d6..9430721 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -188,6 +188,7 @@
ctx->vstate.enable = false;
ctx->vstate.fakevsync = false;
ctx->mExtOrientation = 0;
+ ctx->numActiveDisplays = 1;
//Right now hwc starts the service but anybody could do it, or it could be
//independent process as well.
@@ -1910,6 +1911,32 @@
ctx->layerProp[dpy] = new LayerProp[numAppLayers];
}
+/* Since we fake non-Hybrid WFD solution as external display, this
+ * function helps us in determining the priority between external
+ * (hdmi/non-Hybrid WFD display) and virtual display devices(SSD/
+ * screenrecord). This can be removed once wfd-client migrates to
+ * using virtual-display api's.
+ */
+bool canUseMDPforVirtualDisplay(hwc_context_t* ctx,
+ const hwc_display_contents_1_t *list) {
+
+ /* We rely on the fact that for pure virtual display solution
+ * list->outbuf will be a non-NULL handle.
+ *
+ * If there are three active displays (which means there is one
+ * primary, one external and one virtual active display)
+ * we give mdss/mdp hw resources(pipes,smp,etc) for external
+ * display(hdmi/non-Hybrid WFD display) rather than for virtual
+ * display(SSD/screenrecord)
+ */
+
+ if(list->outbuf and (ctx->numActiveDisplays == HWC_NUM_DISPLAY_TYPES)) {
+ return false;
+ }
+
+ return true;
+}
+
void BwcPM::setBwc(hwc_context_t *ctx, const hwc_rect_t& crop,
const hwc_rect_t& dst, const int& transform,
ovutils::eMdpFlags& mdpFlags) {