Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 30cf9015 authored by dianlujitao's avatar dianlujitao Committed by Michael Bestas
Browse files

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 lineage soong config

Change-Id: Ic0f314f4053628667a921951f610839f36a5079c
parent f1b7fc4a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ cc_defaults {
    defaults: [
        "surfaceflinger_defaults",
        "skia_renderengine_deps",
        "surfaceflinger_qcom_ext_defaults",
    ],
    cflags: [
        "-DLOG_TAG=\"SurfaceFlinger\"",
@@ -80,7 +81,6 @@ cc_defaults {
        "android.hardware.graphics.composer@2.2-command-buffer",
        "android.hardware.graphics.composer@2.3-command-buffer",
        "android.hardware.graphics.composer@2.4-command-buffer",
        "display_intf_headers",
    ],
    export_static_lib_headers: [
        "libcompositionengine",
+14 −1
Original line number Diff line number Diff line
@@ -138,11 +138,13 @@
#include "android-base/stringprintf.h"
#include "android-base/strings.h"

#ifdef QCOM_UM_FAMILY
#if __has_include("QtiGralloc.h")
#include "QtiGralloc.h"
#else
#include "gralloc_priv.h"
#endif
#endif

#define MAIN_THREAD ACQUIRE(mStateLock) RELEASE(mStateLock)

@@ -2768,7 +2770,11 @@ sp<DisplayDevice> SurfaceFlinger::setupNewDisplayDeviceInternal(

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) {
@@ -2783,6 +2789,7 @@ void SurfaceFlinger::processDisplayAdded(const wp<IBinder>& displayToken,
        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
        if (mVirtualDisplayIdGenerators.hal) {
            size_t maxVirtualDisplaySize = getHwComposer().getMaxVirtualDisplayDimension();
            if (maxVirtualDisplaySize == 0 ||
@@ -2797,7 +2804,7 @@ void SurfaceFlinger::processDisplayAdded(const wp<IBinder>& displayToken,
               }
            }
        }

#endif
    } else {
        // Virtual displays without a surface are dormant:
        // they have external state (layer stack, projection,
@@ -6634,6 +6641,7 @@ status_t SurfaceFlinger::setDesiredDisplayModeSpecsInternal(
    return NO_ERROR;
}

#ifdef QCOM_UM_FAMILY
bool SurfaceFlinger::canAllocateHwcDisplayIdForVDS(uint64_t usage) {
    uint64_t flag_mask_pvt_wfd = ~0;
    uint64_t flag_mask_hw_video = ~0;
@@ -6647,6 +6655,11 @@ bool SurfaceFlinger::canAllocateHwcDisplayIdForVDS(uint64_t usage) {
    return (allowHwcForVDS || ((usage & flag_mask_pvt_wfd) &&
            (usage & flag_mask_hw_video)));
}
#else
bool SurfaceFlinger::canAllocateHwcDisplayIdForVDS(uint64_t) {
    return true;
}
#endif

status_t SurfaceFlinger::setDesiredDisplayModeSpecs(
        const sp<IBinder>& displayToken, ui::DisplayModeId defaultMode, bool allowGroupSwitching,