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

Commit 3131841b authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

surfaceflinger: Add support for LGE's HDMI rotation

Use BOARD_USES_LGE_HDMI_ROTATION to align the HDMI output orientation
with the device's, on LGE phones (p990/p999, at least)

Change-Id: I4aefa9b13bf9ca3e51e944818838a3954d6cbcb5
parent 297468b0
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -63,6 +63,12 @@ LOCAL_SHARED_LIBRARIES := \
	libui \
	libsurfaceflinger_client

ifeq ($(BOARD_USES_LGE_HDMI_ROTATION),true)
LOCAL_CFLAGS += -DUSE_LGE_HDMI
LOCAL_SHARED_LIBRARIES += \
	libnvdispmgr_d
endif

LOCAL_C_INCLUDES := \
	$(call include-path-for, corecg graphics)

+21 −0
Original line number Diff line number Diff line
@@ -67,6 +67,13 @@

#define DISPLAY_COUNT       1

#ifdef USE_LGE_HDMI
extern "C" void MainRegisterHPD();
extern "C" void MainUnRegisterHPD();
extern "C" void NvDispMgrPreAutoOrientation(int rotation);
extern "C" void NvDispMgrAutoOrientation(int rotation);
#endif

namespace android {
// ---------------------------------------------------------------------------

@@ -103,6 +110,9 @@ SurfaceFlinger::SurfaceFlinger()
        mUseDithering(true)
{
    init();
#ifdef USE_LGE_HDMI
    MainRegisterHPD();
#endif
}

void SurfaceFlinger::init()
@@ -136,6 +146,9 @@ void SurfaceFlinger::init()
SurfaceFlinger::~SurfaceFlinger()
{
    glDeleteTextures(1, &mWormholeTexName);
#ifdef USE_LGE_HDMI
    MainUnRegisterHPD();
#endif
}

overlay_control_device_t* SurfaceFlinger::getOverlayEngine() const
@@ -414,9 +427,17 @@ bool SurfaceFlinger::threadLoop()
        logger.log(GraphicLog::SF_COMPOSITION_COMPLETE, index);
        hw.compositionComplete();

#ifdef USE_LGE_HDMI
        NvDispMgrPreAutoOrientation(mCurrentState.orientation);
#endif

        logger.log(GraphicLog::SF_SWAP_BUFFERS, index);
        postFramebuffer();

#ifdef USE_LGE_HDMI
        NvDispMgrAutoOrientation(mCurrentState.orientation);
#endif

        logger.log(GraphicLog::SF_REPAINT_DONE, index);
    } else {
        // pretend we did the post