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

Commit a34ed639 authored by Fabien Sanglard's avatar Fabien Sanglard
Browse files

Use forceHwcCopyForVirtualDisplay in configStore

Test: Manual
Change-Id: Ie6f816cf8f48b1cca41d51f40e9f0ae49aef2908
parent bc147ee5
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -65,10 +65,6 @@ else
        DisplayHardware/HWComposer_hwc1.cpp
endif

ifeq ($(TARGET_FORCE_HWC_FOR_VIRTUAL_DISPLAYS),true)
    LOCAL_CFLAGS += -DFORCE_HWC_COPY_FOR_VIRTUAL_DISPLAYS
endif

ifneq ($(NUM_FRAMEBUFFER_SURFACE_BUFFERS),)
    LOCAL_CFLAGS += -DNUM_FRAMEBUFFER_SURFACE_BUFFERS=$(NUM_FRAMEBUFFER_SURFACE_BUFFERS)
endif
+4 −8
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
// #define LOG_NDEBUG 0
#include "VirtualDisplaySurface.h"
#include "HWComposer.h"
#include "SurfaceFlinger.h"

#include <gui/BufferItem.h>
#include <gui/BufferQueue.h>
@@ -26,12 +27,6 @@
namespace android {
// ---------------------------------------------------------------------------

#if defined(FORCE_HWC_COPY_FOR_VIRTUAL_DISPLAYS)
static const bool sForceHwcCopy = true;
#else
static const bool sForceHwcCopy = false;
#endif

#define VDS_LOGE(msg, ...) ALOGE("[%s] " msg, \
        mDisplayName.string(), ##__VA_ARGS__)
#define VDS_LOGW_IF(cond, msg, ...) ALOGW_IF(cond, "[%s] " msg, \
@@ -74,7 +69,8 @@ VirtualDisplaySurface::VirtualDisplaySurface(HWComposer& hwc, int32_t dispId,
    mOutputProducerSlot(BufferQueue::INVALID_BUFFER_SLOT),
    mDbgState(DBG_STATE_IDLE),
    mDbgLastCompositionType(COMPOSITION_UNKNOWN),
    mMustRecompose(false)
    mMustRecompose(false),
    mForceHwcCopy(SurfaceFlinger::useHwcForRgbToYuv)
{
    mSource[SOURCE_SINK] = sink;
    mSource[SOURCE_SCRATCH] = bqProducer;
@@ -137,7 +133,7 @@ status_t VirtualDisplaySurface::prepareFrame(CompositionType compositionType) {
    mDbgState = DBG_STATE_PREPARED;

    mCompositionType = compositionType;
    if (sForceHwcCopy && mCompositionType == COMPOSITION_GLES) {
    if (mForceHwcCopy && mCompositionType == COMPOSITION_GLES) {
        // Some hardware can do RGB->YUV conversion more efficiently in hardware
        // controlled by HWC than in hardware controlled by the video encoder.
        // Forcing GLES-composed frames to go through an extra copy by the HWC
+3 −0
Original line number Diff line number Diff line
@@ -255,6 +255,9 @@ private:
#ifdef USE_HWC2
    HWComposerBufferCache mHwcBufferCache;
#endif


    bool mForceHwcCopy;
};

// ---------------------------------------------------------------------------
+5 −0
Original line number Diff line number Diff line
@@ -114,6 +114,7 @@ int64_t SurfaceFlinger::vsyncPhaseOffsetNs;
int64_t SurfaceFlinger::sfVsyncPhaseOffsetNs;
bool SurfaceFlinger::useContextPriority;
int64_t SurfaceFlinger::dispSyncPresentTimeOffset;
bool SurfaceFlinger::useHwcForRgbToYuv;

SurfaceFlinger::SurfaceFlinger()
    :   BnSurfaceComposer(),
@@ -172,6 +173,9 @@ SurfaceFlinger::SurfaceFlinger()
    dispSyncPresentTimeOffset = getInt64< ISurfaceFlingerConfigs,
            &ISurfaceFlingerConfigs::presentTimeOffsetFromVSyncNs>(0);

    useHwcForRgbToYuv = getBool< ISurfaceFlingerConfigs,
            &ISurfaceFlingerConfigs::useHwcForRGBtoYUV>(false);

    // debugging stuff...
    char value[PROPERTY_VALUE_MAX];

@@ -3238,6 +3242,7 @@ void SurfaceFlinger::appendSfConfigString(String8& result) const
        result.append(" DISABLE_TRIPLE_BUFFERING");

    result.appendFormat(" PRESENT_TIME_OFFSET=%" PRId64 , dispSyncPresentTimeOffset);
    result.appendFormat(" FORCE_HWC_FOR_RBG_TO_YUV=%d", useHwcForRgbToYuv);
    result.append("]");
}

+6 −0
Original line number Diff line number Diff line
@@ -136,6 +136,12 @@ public:
    // signaling time.
    static int64_t dispSyncPresentTimeOffset;

    // Some hardware can do RGB->YUV conversion more efficiently in hardware
    // controlled by HWC than in hardware controlled by the video encoder.
    // This instruct VirtualDisplaySurface to use HWC for such conversion on
    // GL composition.
    static bool useHwcForRgbToYuv;

    static char const* getServiceName() ANDROID_API {
        return "SurfaceFlinger";
    }
Loading