sf: Allow WFD to use hwc in vendor frozen targets
Change-Id: Iecd2be3eb8775855d82763f069a38bb70fe53d4e
CRs-Fixed: 3229968
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index f3c807b..7e06fa9 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -914,6 +914,7 @@
mAllowHwcForWFD = base::GetBoolProperty("vendor.display.vds_allow_hwc"s, false);
mAllowHwcForVDS = mAllowHwcForWFD && base::GetBoolProperty("debug.sf.enable_hwc_vds"s, false);
+ mFirstApiLevel = android::base::GetIntProperty("ro.product.first_api_level", 0);
// Process hotplug for displays connected at boot.
LOG_ALWAYS_FATAL_IF(!configureLocked(),
@@ -8829,11 +8830,13 @@
// GRALLOC_USAGE_PRIVATE_WFD + GRALLOC_USAGE_HW_VIDEO_ENCODER = WFD using HW composer.
flag_mask_pvt_wfd = GRALLOC_USAGE_PRIVATE_WFD;
flag_mask_hw_video = GRALLOC_USAGE_HW_VIDEO_ENCODER;
+ bool isWfd = (usage & flag_mask_pvt_wfd) && (usage & flag_mask_hw_video);
// Enabling only the vendor property would allow WFD to use HWC
// Enabling both the aosp and vendor properties would allow all other VDS to use HWC
// Disabling both would set all virtual displays to fall back to GPU
- bool canAllocate = mAllowHwcForVDS || (mAllowHwcForWFD && (usage & flag_mask_pvt_wfd) &&
- (usage & flag_mask_hw_video));
+ // In vendor frozen targets, allow WFD to use HWC without any property settings.
+ bool canAllocate = mAllowHwcForVDS || (isWfd && mAllowHwcForWFD) || (isWfd &&
+ mFirstApiLevel < __ANDROID_API_T__);
if (canAllocate) {
enableHalVirtualDisplays(true);