summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/SurfaceFlinger.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'services/surfaceflinger/SurfaceFlinger.cpp')
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp155
1 files changed, 154 insertions, 1 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 0da75c4cacc6..192d257b294c 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -57,6 +57,9 @@
#include "DisplayHardware/HWComposer.h"
#include <private/surfaceflinger/SharedBufferStack.h>
+#ifdef SAMSUNG_HDMI_SUPPORT
+#include "SecHdmi.h"
+#endif
/* ideally AID_GRAPHICS would be in a semi-public header
* or there would be a way to map a user/group name to its id
@@ -131,6 +134,12 @@ void SurfaceFlinger::init()
SurfaceFlinger::~SurfaceFlinger()
{
glDeleteTextures(1, &mWormholeTexName);
+#ifdef SAMSUNG_HDMI_SUPPORT
+ if(SecHdmi_destroy() == false)
+ {
+ LOGE("%s::mSecHdmi.destroy() fail \n", __func__);
+ }
+#endif
}
sp<IMemoryHeap> SurfaceFlinger::getCblk() const
@@ -295,6 +304,16 @@ status_t SurfaceFlinger::readyToRun()
// put the origin in the left-bottom corner
glOrthof(0, w, 0, h, 0, 1); // l=0, r=w ; b=0, t=h
+#ifdef SAMSUNG_HDMI_SUPPORT
+ SecHdmi();
+ if(SecHdmi_create() == 0)
+ LOGE("%s::mSecHdmi.create() fail \n", __func__);
+ else
+ {
+ // for it to connect
+ setHdmiStatus(1);
+ }
+#endif
mReadyToRunBarrier.open();
/*
@@ -398,7 +417,10 @@ status_t SurfaceFlinger::postMessageSync(const sp<MessageBase>& msg,
bool SurfaceFlinger::threadLoop()
{
waitForEvent();
-
+#ifdef SAMSUNG_HDMI_SUPPORT
+ //Check For HDMI Detection
+ setHdmiStatus(true);
+#endif
// check for transactions
if (UNLIKELY(mConsoleSignals)) {
handleConsoleEvents();
@@ -462,6 +484,12 @@ void SurfaceFlinger::postFramebuffer()
mLastSwapBufferTime = systemTime() - now;
mDebugInSwapBuffers = 0;
mSwapRegion.clear();
+#ifdef SAMSUNG_HDMI_SUPPORT
+ if(mHdmiCableInserted) {
+ blit2Hdmi(hw.getWidth(), hw.getHeight(), 0, HDMI_MODE_UI, 0, 0);
+ }
+#endif
+
}
void SurfaceFlinger::handleConsoleEvents()
@@ -1269,7 +1297,132 @@ int SurfaceFlinger::setOrientation(DisplayID dpy,
}
return orientation;
}
+#ifdef SAMSUNG_HDMI_SUPPORT
+void setHdmiStatus(uint32_t status)
+{
+
+ bool hdmiCableInserted = (bool)status;
+
+ if(mHdmiCableInserted == hdmiCableInserted)
+ return;
+
+ if(hdmiCableInserted == true)
+ {
+ if(SecHdmi_connect() == 0)
+ {
+ hdmiCableInserted = false;
+ }
+ }
+ else // if(hdmiCableInserted == false)
+ {
+ if(SecHdmi_disconnect() == 0)
+ {
+ LOGE("%s::mSecHdmi.disconnect() fail\n", __func__);
+ }
+ }
+
+ mHdmiCableInserted = hdmiCableInserted;
+}
+void setHdmiMode(uint32_t mode)
+{
+}
+void setHdmiResolution(uint32_t resolution)
+{
+}
+void setHdmiHdcp(uint32_t hdcp_en)
+{
+}
+bool blit2Hdmi(int w, int h,
+ int colorFormat,
+ int hdmiMode,
+ unsigned int pPhyYAddr, unsigned int pPhyCAddr)
+{
+ //LOGD("%s HDMI layer buffer mNumberOfLayerBuffer: %d, flagOn = %d, colorFormat = %d",
+ // __func__, (unsigned int)mNumberOfLayerBuffer, flagOn, colorFormat);
+
+ //Mutex::Autolock _l(mStateLock);
+ if(mHdmiCableInserted == false)
+ {
+ LOGE("mHdmiCableInserted == false fail");
+ return false;
+ }
+
+ mUIMode = hdmiMode;
+
+ int hdmiLayer = HDMI_LAYER_VIDEO;
+
+ switch(hdmiMode)
+ {
+ case HDMI_MODE_UI :
+ {
+ // kcoolsw
+ //LOGD("HDMI UI layer...");
+
+ ///////////////////////////////////////////////
+ // sw5771.park(100908)
+ // if NumOfLayer is = 0
+ // draw with video layer (high quality)
+ // else NumOfLayer is 1, 2, 3
+ // draw with graphic layer (low quality)
+ if(mNumberOfLayerBuffer == 1)
+ {
+ #ifdef BOARD_USES_HDMI_SUBTITLES
+ hdmiLayer = HDMI_LAYER_GRAPHIC_0;
+ #else
+ return true;
+ #endif
+ }
+ else // if(mNumberOfLayerBuffer == 0, 2, 3..)
+ {
+ #ifdef BOARD_USES_HDMI_SUBTITLES
+ {
+ // we change from LayerGraphics to LayerVideo for UI..
+ if( mUILayerMode == HDMI_LAYER_GRAPHIC_0
+ && hdmiLayer == HDMI_LAYER_VIDEO)
+ {
+ if(mSecHdmi.clear(mUILayerMode) == false)
+ {
+ LOGE("%s::mSecHdmi.clear(%d) fail\n", __func__, mUILayerMode);
+ }
+ }
+ }
+ #endif
+ }
+
+ #ifdef BOARD_USES_HDMI_SUBTITLES
+ mUILayerMode = hdmiLayer;
+ #endif
+
+ break;
+ }
+ case HDMI_MODE_VIDEO :
+ {
+ //LOGD("HDMI Video layer..");
+
+ // expect UI send video layer also..
+ if(2 <= mNumberOfLayerBuffer)
+ return true;
+
+ break;
+ }
+ default:
+ {
+ LOGE("unmatched HDMI_MODE : %d", hdmiMode);
+ return false;
+ break;
+ }
+ }
+
+ if(SecHdmi_flush(w, h, colorFormat, hdmiLayer,
+ pPhyYAddr, pPhyCAddr) == false)
+ {
+ LOGE("%s::mSecHdmi.flush() fail\n", __func__);
+ }
+
+ return true;
+}
+#endif
sp<ISurface> SurfaceFlinger::createSurface(
ISurfaceComposerClient::surface_data_t* params,
const String8& name,