sf: Exclude VDS use of HWC on non-UM platforms
Author: Bruno Martins <bgcngm@gmail.com>
Date: Wed Oct 14 23:45:14 2020 +0100
Edit: Adapt to new omni soong config
Change-Id: Ic0f314f4053628667a921951f610839f36a5079c
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 7e06fa9..776b71e 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -163,11 +163,13 @@
#include "Utils/Dumper.h"
#include "WindowInfosListenerInvoker.h"
+#ifdef QCOM_UM_FAMILY
#if __has_include("QtiGralloc.h")
#include "QtiGralloc.h"
#else
#include "gralloc_priv.h"
#endif
+#endif
#include <aidl/android/hardware/graphics/common/DisplayDecorationSupport.h>
#include <aidl/android/hardware/graphics/composer3/DisplayCapability.h>
@@ -3804,7 +3806,11 @@
void SurfaceFlinger::processDisplayAdded(const wp<IBinder>& displayToken,
const DisplayDeviceState& state) {
+#ifdef QCOM_UM_FAMILY
bool canAllocateHwcForVDS = false;
+#else
+ bool canAllocateHwcForVDS = true;
+#endif
ui::Size resolution(0, 0);
ui::PixelFormat pixelFormat = static_cast<ui::PixelFormat>(PIXEL_FORMAT_UNKNOWN);
if (state.physical) {
@@ -3819,6 +3825,7 @@
status = state.surface->query(NATIVE_WINDOW_FORMAT, &format);
ALOGE_IF(status != NO_ERROR, "Unable to query format (%d)", status);
pixelFormat = static_cast<ui::PixelFormat>(format);
+#ifdef QCOM_UM_FAMILY
// Check if VDS is allowed to use HWC
size_t maxVirtualDisplaySize = getHwComposer().getMaxVirtualDisplayDimension();
if (maxVirtualDisplaySize == 0 || ((uint64_t)resolution.width <= maxVirtualDisplaySize &&
@@ -3831,6 +3838,7 @@
canAllocateHwcForVDS = true;
}
}
+#endif
} else {
// Virtual displays without a surface are dormant:
// they have external state (layer stack, projection,
@@ -8823,6 +8831,7 @@
} // namespace
+#ifdef QCOM_UM_FAMILY
bool SurfaceFlinger::canAllocateHwcDisplayIdForVDS(uint64_t usage) {
uint64_t flag_mask_pvt_wfd = ~0;
uint64_t flag_mask_hw_video = ~0;
@@ -8845,6 +8854,11 @@
return canAllocate;
}
+#else
+bool SurfaceFlinger::canAllocateHwcDisplayIdForVDS(uint64_t) {
+ return true;
+}
+#endif
status_t SurfaceFlinger::setDesiredDisplayModeSpecs(const sp<IBinder>& displayToken,
const gui::DisplayModeSpecs& specs) {