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

Commit 5eaba80b authored by Steve Kondik's avatar Steve Kondik
Browse files

surfaceflinger: Fix build for HWC2

 * Properly adjust QCOM extensions when USE_HWC2 is set.

Change-Id: I3c04696cc8085f95a731db182457dc207cd90a08
parent 1ae08f89
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -143,12 +143,14 @@ ifeq ($(TARGET_USES_QCOM_BSP), true)
  LOCAL_SHARED_LIBRARIES += libqdutils
  LOCAL_SHARED_LIBRARIES += libqdMetaData
  LOCAL_CFLAGS += -DQTI_BSP
  ifneq ($(TARGET_USES_HWC2),true)
  LOCAL_SRC_FILES += \
    ExSurfaceFlinger/ExLayer.cpp \
    ExSurfaceFlinger/ExSurfaceFlinger.cpp \
    ExSurfaceFlinger/ExVirtualDisplaySurface.cpp \
    ExSurfaceFlinger/ExHWComposer.cpp
  endif
endif

LOCAL_MODULE := libsurfaceflinger

+15 −11
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@
#include "RenderEngine/RenderEngine.h"
#include "DisplayHardware/FramebufferSurface.h"
#include "DisplayUtils.h"
#if QTI_BSP
#if defined(QTI_BSP) && !defined(USE_HWC2)
#include <ExSurfaceFlinger/ExSurfaceFlinger.h>
#include <ExSurfaceFlinger/ExLayer.h>
#include <ExSurfaceFlinger/ExHWComposer.h>
@@ -57,7 +57,7 @@ DisplayUtils* DisplayUtils::sDisplayUtils = NULL;
bool DisplayUtils::sUseExtendedImpls = false;

DisplayUtils::DisplayUtils() {
#ifdef QTI_BSP
#if defined(QTI_BSP) && !defined(USE_HWC2)
    sUseExtendedImpls = true;
    hasWbNode();
#endif
@@ -71,7 +71,7 @@ DisplayUtils* DisplayUtils::getInstance() {
}

SurfaceFlinger* DisplayUtils::getSFInstance() {
#ifdef QTI_BSP
#if defined(QTI_BSP) && !defined(USE_HWC2)
    if(sUseExtendedImpls) {
        return new ExSurfaceFlinger();
    }
@@ -82,7 +82,7 @@ SurfaceFlinger* DisplayUtils::getSFInstance() {
Layer* DisplayUtils::getLayerInstance(SurfaceFlinger* flinger,
                            const sp<Client>& client, const String8& name,
                            uint32_t w, uint32_t h, uint32_t flags) {
#ifdef QTI_BSP
#if defined(QTI_BSP) && !defined(USE_HWC2)
    if(sUseExtendedImpls) {
        return new ExLayer(flinger, client, name, w, h, flags);
    }
@@ -92,13 +92,16 @@ Layer* DisplayUtils::getLayerInstance(SurfaceFlinger* flinger,

HWComposer* DisplayUtils::getHWCInstance(
                        const sp<SurfaceFlinger>& flinger,
                        HWComposer::EventHandler& handler) {
#ifdef QTI_BSP
                        HWComposer::EventHandler& /* handler */) {
#if defined(QTI_BSP) && !defined(USE_HWC2)
    if(sUseExtendedImpls) {
        return new ExHWComposer(flinger, handler);
    }
#endif
#elif defined(USE_HWC2)
    return new HWComposer(flinger);
#else
    return new HWComposer(flinger, handler);
#endif
}

void DisplayUtils::initVDSInstance(HWComposer* hwc, int32_t hwcDisplayId,
@@ -107,7 +110,7 @@ void DisplayUtils::initVDSInstance(HWComposer* hwc, int32_t hwcDisplayId,
        sp<IGraphicBufferConsumer> bqConsumer, String8 currentStateDisplayName,
        bool currentStateIsSecure, int currentStateType)
{
#ifdef QTI_BSP
#if defined(QTI_BSP) && !defined(USE_HWC2)
    if(sUseExtendedImpls) {
        if(hwc->isVDSEnabled()) {
            VirtualDisplaySurface* vds = new ExVirtualDisplaySurface(*hwc, hwcDisplayId,
@@ -130,7 +133,7 @@ void DisplayUtils::initVDSInstance(HWComposer* hwc, int32_t hwcDisplayId,
                currentStateSurface, bqProducer, bqConsumer, currentStateDisplayName);
        dispSurface = vds;
        producer = vds;
#ifdef QTI_BSP
#if defined(QTI_BSP) && !defined(USE_HWC2)
    }
#endif
}
@@ -163,9 +166,10 @@ bool DisplayUtils::createV4L2BasedVirtualDisplay(HWComposer* hwc, int32_t &hwcDi
        surface = eglCreateWindowSurface(display, config, window, NULL);
        eglQuerySurface(display, surface, EGL_WIDTH, &w);
        eglQuerySurface(display, surface, EGL_HEIGHT, &h);
#if defined(QTI_BSP) && !defined(USE_HWC2)
        if(hwc->setVirtualDisplayProperties(hwcDisplayId, w, h, format) != NO_ERROR)
            return false;

#endif
        dispSurface = new FramebufferSurface(*hwc, currentStateType, bqConsumer);
        producer = bqProducer;
        return true;
@@ -180,7 +184,7 @@ bool DisplayUtils::canAllocateHwcDisplayIdForVDS(int usage) {
    property_get("debug.vds.allow_hwc", value, "0");
    int allowHwcForVDS = atoi(value);

#ifdef QTI_BSP
#if defined(QTI_BSP) && !defined(USE_HWC2)
    // Do not allow hardware acceleration
    flag_mask = GRALLOC_USAGE_PRIVATE_WFD;
#endif
+2 −0
Original line number Diff line number Diff line
@@ -359,6 +359,7 @@ public:
    /* ------------------------------------------------------------------------
     * Extensions
     */
#ifndef USE_HWC2
    virtual bool isExtOnly() const { return false; }
    virtual bool isIntOnly() const { return false; }
    virtual bool isSecureDisplay() const { return false; }
@@ -368,6 +369,7 @@ public:
                             const State& /*state*/) { }
    virtual void setAcquiredFenceIfBlit(int& /*fenceFd */,
                       HWComposer::HWCLayerInterface& /*layer */) { }
#endif
    virtual bool canAllowGPUForProtected() const { return false; }
    virtual void handleOpenGLDraw(const sp<const DisplayDevice>& /*hw*/,
            Mesh& mesh) const;
+2 −0
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ bool LayerDim::isVisible() const {
    return !(s.flags & layer_state_t::eLayerHidden) && s.alpha;
}

#ifndef USE_HWC2
void LayerDim::setPerFrameData(const sp<const DisplayDevice>& hw,
        HWComposer::HWCLayerInterface& layer) {
  HWComposer& hwc = mFlinger->getHwComposer();
@@ -82,6 +83,7 @@ void LayerDim::setPerFrameData(const sp<const DisplayDevice>& hw,
    layer.setDim(rgba_color);
  }
}
#endif

// ---------------------------------------------------------------------------

+2 −0
Original line number Diff line number Diff line
@@ -40,8 +40,10 @@ public:
    virtual bool isSecure() const         { return false; }
    virtual bool isFixedSize() const      { return true; }
    virtual bool isVisible() const;
#ifndef USE_HWC2
    virtual void setPerFrameData(const sp<const DisplayDevice>& hw,
            HWComposer::HWCLayerInterface& layer);
#endif
};

// ---------------------------------------------------------------------------
Loading