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

Commit 4fd75c0a authored by Ramakant Singh's avatar Ramakant Singh Committed by Steve Kondik
Browse files

SF: Add flag for swaprect status in HAL

We need to check in HAL whether swap rect
is enable or disable to calculate wormhole region.

Change-Id: I4fbff4119856e41694e2065141b40fdd7a15f375
parent 0438f810
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -109,9 +109,12 @@ endif
ifeq ($(TARGET_USES_QCOM_BSP), true)
ifneq ($(TARGET_QCOM_DISPLAY_VARIANT),)
    LOCAL_C_INCLUDES += hardware/qcom/display-$(TARGET_QCOM_DISPLAY_VARIANT)/libgralloc
    LOCAL_C_INCLUDES += hardware/qcom/display-$(TARGET_QCOM_DISPLAY_VARIANT)/libqdutils
else
    LOCAL_C_INCLUDES += hardware/qcom/display/$(TARGET_BOARD_PLATFORM)/libgralloc
    LOCAL_C_INCLUDES += hardware/qcom/display/$(TARGET_BOARD_PLATFORM)/libqdutils
endif
    LOCAL_SHARED_LIBRARIES += libqdutils
    LOCAL_CFLAGS += -DQCOM_BSP
endif

+12 −9
Original line number Diff line number Diff line
@@ -46,6 +46,9 @@
#include "../Layer.h"           // needed only for debugging
#include "../SurfaceFlinger.h"

#ifdef QCOM_BSP
#include "cb_swap_rect.h"
#endif
namespace android {

#define MIN_HWC_HEADER_VERSION HWC_HEADER_VERSION
@@ -188,7 +191,8 @@ HWComposer::HWComposer(
      mFbDev(0), mHwc(0), mNumDisplays(1),
      mCBContext(new cb_context),
      mEventHandler(handler),
      mDebugForceFakeVSync(false)
      mDebugForceFakeVSync(false),
      mSwapRectOn(false)
{
    for (size_t i =0 ; i<MAX_HWC_DISPLAYS ; i++) {
        mLists[i] = 0;
@@ -1345,22 +1349,21 @@ void HWComposer::setSwapRect(Rect dirtyRect)
               l.displayFrame.right  = dirtyRect.right;
               l.displayFrame.bottom = dirtyRect.bottom;
          } else {
               l.sourceCropf.left   = 0;
               l.sourceCropf.top    = 0;
               l.sourceCropf.right  = 0;
               l.sourceCrop.bottom = 0;
               l.displayFrame.left   = 0;
               l.displayFrame.top    = 0;
               l.displayFrame.right  = 0;
               l.displayFrame.bottom = 0;
#ifdef QCOM_BSP
               l.flags |= qdutils::HWC_SKIP_HWC_COMPOSITION;
#endif
          }
     }
}

void HWComposer::setSwapRectOn(bool enable){
    mSwapRectOn = enable;
}
void HWComposer::dump(String8& result) const {
    if (mHwc) {
        result.appendFormat("Hardware Composer state (version %8x):\n", hwcApiVersion(mHwc));
        result.appendFormat("  mDebugForceFakeVSync=%d\n", mDebugForceFakeVSync);
        result.appendFormat("  mSwapRectOn=%d\n",mSwapRectOn);
        for (size_t i=0 ; i<mNumDisplays ; i++) {
            const DisplayData& disp(mDisplayData[i]);
            if (!disp.connected)
+2 −1
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ public:
    // create a work list for numLayers layer. sets HWC_GEOMETRY_CHANGED.
    status_t createWorkList(int32_t id, size_t numLayers);

    void setSwapRectOn(bool);
    void setSwapRect(Rect);

    bool supportsFramebufferTarget() const;
@@ -343,7 +344,7 @@ private:
    struct hwc_display_contents_1*  mLists[MAX_HWC_DISPLAYS];
    DisplayData                     mDisplayData[MAX_HWC_DISPLAYS];
    size_t                          mNumDisplays;

    bool                            mSwapRectOn;
    cb_context*                     mCBContext;
    EventHandler&                   mEventHandler;
    size_t                          mVSyncCounts[HWC_NUM_PHYSICAL_DISPLAY_TYPES];
+14 −3
Original line number Diff line number Diff line
@@ -77,6 +77,9 @@

#include "RenderEngine/RenderEngine.h"
#include <cutils/compiler.h>
#ifdef QCOM_BSP
#include "cb_swap_rect.h"
#endif

#ifdef SAMSUNG_HDMI_SUPPORT
#include "SecTVOutService.h"
@@ -3423,6 +3426,10 @@ void SurfaceFlinger::setupSwapRect()
    HWComposer& hwc(getHwComposer());
    const LayerVector& currentLayers(mDrawingState.layersSortedByZ);
    size_t count = currentLayers.size();
#ifdef QCOM_BSP
    qdutils::cb_swap_rect::getInstance().setSwapRectFeature_on(false);
#endif
    hwc.setSwapRectOn(false);

    if (mSwapRectEnable && hwc.hasHwcComposition(HWC_DISPLAY_PRIMARY)) {
        int  totalDirtyRects = 0;
@@ -3460,6 +3467,10 @@ void SurfaceFlinger::setupSwapRect()
             * Create dirty layer work list to be used by HWComposer instead of
             * visible layer work list
             */
#ifdef QCOM_BSP
           qdutils::cb_swap_rect::getInstance().setSwapRectFeature_on(true);
#endif
            hwc.setSwapRectOn(true);
            hwc.setSwapRect(swapDirtyRect);
            invalidateHwcGeometry();
        }