From 77ddb6525b8a9323fcfff54fcbcb62820a8d540d Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Sun, 30 Dec 2012 02:20:21 +0000 Subject: ui/sf: Add support for exynos HDMI Change-Id: I27b34e95c04750e3dd321a2183b6cc1d89f29b5d --- include/ui/FramebufferNativeWindow.h | 10 ++++++++++ libs/ui/Android.mk | 19 +++++++++++++++++++ libs/ui/FramebufferNativeWindow.cpp | 24 ++++++++++++++++++++++++ services/surfaceflinger/Android.mk | 8 ++++++++ services/surfaceflinger/SurfaceFlinger.cpp | 14 +++++++++++++- services/surfaceflinger/SurfaceFlinger.h | 7 +++++++ 6 files changed, 81 insertions(+), 1 deletion(-) diff --git a/include/ui/FramebufferNativeWindow.h b/include/ui/FramebufferNativeWindow.h index 5ec738f..02f3c8b 100644 --- a/include/ui/FramebufferNativeWindow.h +++ b/include/ui/FramebufferNativeWindow.h @@ -31,6 +31,10 @@ #define MIN_NUM_FRAME_BUFFERS 2 #define MAX_NUM_FRAME_BUFFERS 3 +#ifdef SAMSUNG_HDMI_SUPPORT +#include "SecHdmiClient.h" +#endif + extern "C" EGLNativeWindowType android_createDisplaySurface(void); // --------------------------------------------------------------------------- @@ -39,6 +43,9 @@ namespace android { class Surface; class NativeBuffer; +#ifdef SAMSUNG_HDMI_SUPPORT +class SecHdmiClient; +#endif // --------------------------------------------------------------------------- @@ -88,6 +95,9 @@ private: int32_t mBufferHead; int32_t mCurrentBufferIndex; bool mUpdateOnDemand; +#ifdef SAMSUNG_HDMI_SUPPORT + SecHdmiClient *mHdmiClient; +#endif }; // --------------------------------------------------------------------------- diff --git a/libs/ui/Android.mk b/libs/ui/Android.mk index 0d2e44c..5d5e082 100644 --- a/libs/ui/Android.mk +++ b/libs/ui/Android.mk @@ -36,6 +36,25 @@ ifneq ($(BOARD_FRAMEBUFFER_FORCE_FORMAT),) LOCAL_CFLAGS += -DFRAMEBUFFER_FORCE_FORMAT=$(BOARD_FRAMEBUFFER_FORCE_FORMAT) endif +ifeq ($(TARGET_SOC),exynos4210) + LOCAL_CFLAGS += -DSAMSUNG_EXYNOS4210 +endif + +ifeq ($(TARGET_SOC),exynos4x12) + LOCAL_CFLAGS += -DSAMSUNG_EXYNOS4x12 +endif + +ifeq ($(TARGET_SOC),exynos5250) + LOCAL_CFLAGS += -DSAMSUNG_EXYNOS5250 +endif + +ifeq ($(BOARD_USES_SAMSUNG_HDMI),true) +LOCAL_CFLAGS += -DSAMSUNG_HDMI_SUPPORT +LOCAL_SHARED_LIBRARIES += libhdmiclient +LOCAL_C_INCLUDES += hardware/samsung/$(TARGET_BOARD_PLATFORM)/libhdmi/libhdmiservice +LOCAL_C_INCLUDES += hardware/samsung/$(TARGET_BOARD_PLATFORM)/include +endif + LOCAL_MODULE:= libui include $(BUILD_SHARED_LIBRARY) diff --git a/libs/ui/FramebufferNativeWindow.cpp b/libs/ui/FramebufferNativeWindow.cpp index 31a69b2..12c77b8 100644 --- a/libs/ui/FramebufferNativeWindow.cpp +++ b/libs/ui/FramebufferNativeWindow.cpp @@ -76,6 +76,11 @@ FramebufferNativeWindow::FramebufferNativeWindow() : BASE(), fbDev(0), grDev(0), mUpdateOnDemand(false) { hw_module_t const* module; + +#ifdef SAMSUNG_HDMI_SUPPORT + mHdmiClient = android::SecHdmiClient::getInstance(); +#endif + if (hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module) == 0) { int stride; int err; @@ -287,6 +292,25 @@ int FramebufferNativeWindow::queueBuffer(ANativeWindow* window, self->front = static_cast(buffer); self->mNumFreeBuffers++; self->mCondition.broadcast(); +#ifdef SAMSUNG_HDMI_SUPPORT +#if defined(SAMSUNG_EXYNOS4210) || defined(SAMSUNG_EXYNOS4x12) + if (self->mHdmiClient != NULL) + self->mHdmiClient->blit2Hdmi(buffer->width, buffer->height, + HAL_PIXEL_FORMAT_BGRA_8888, + 0, 0, 0, + 0, 0, + android::SecHdmiClient::HDMI_MODE_UI, + 0); +#elif defined(SAMSUNG_EXYNOS5250) + if (self->mHdmiClient != NULL) + self->mHdmiClient->blit2Hdmi(buffer->width, buffer->height, + HAL_PIXEL_FORMAT_BGRA_8888, + 0, 0, 0, + 0, 0, + android::SecHdmiClient::HDMI_MODE_MIRROR, + 0); +#endif +#endif return res; } diff --git a/services/surfaceflinger/Android.mk b/services/surfaceflinger/Android.mk index 69c4e21..dac8467 100644 --- a/services/surfaceflinger/Android.mk +++ b/services/surfaceflinger/Android.mk @@ -57,6 +57,14 @@ LOCAL_SHARED_LIBRARIES := \ libui \ libgui +ifeq ($(BOARD_USES_SAMSUNG_HDMI),true) + LOCAL_CFLAGS += -DSAMSUNG_HDMI_SUPPORT + LOCAL_SHARED_LIBRARIES += libTVOut libhdmiclient + LOCAL_C_INCLUDES += hardware/samsung/$(TARGET_BOARD_PLATFORM)/libhdmi/libhdmiservice + LOCAL_C_INCLUDES += hardware/samsung/$(TARGET_BOARD_PLATFORM)/include +endif + + LOCAL_MODULE:= libsurfaceflinger include $(BUILD_SHARED_LIBRARY) diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index f97bcef..6d8f558 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -68,6 +68,9 @@ #include "DisplayHardware/GraphicBufferAlloc.h" #include "DisplayHardware/HWComposer.h" +#ifdef SAMSUNG_HDMI_SUPPORT +#include "SecTVOutService.h" +#endif #define EGL_VERSION_HW_ANDROID 0x3143 @@ -121,6 +124,16 @@ SurfaceFlinger::SurfaceFlinger() } ALOGI_IF(mDebugRegion, "showupdates enabled"); ALOGI_IF(mDebugDDMS, "DDMS debugging enabled"); + +#ifdef SAMSUNG_HDMI_SUPPORT + ALOGD(">>> Run service"); + android::SecTVOutService::instantiate(); +#if defined(SAMSUNG_EXYNOS5250) + mHdmiClient = SecHdmiClient::getInstance(); + mHdmiClient->setHdmiEnable(1); +#endif +#endif + } void SurfaceFlinger::onFirstRef() @@ -128,7 +141,6 @@ void SurfaceFlinger::onFirstRef() mEventQueue.init(this); run("SurfaceFlinger", PRIORITY_URGENT_DISPLAY); - // Wait for the main thread to be done with its initialization mReadyToRunBarrier.wait(); } diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index b0d3bac..e8c4b9c 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -50,6 +50,10 @@ #include "DisplayHardware/HWComposer.h" +#ifdef SAMSUNG_HDMI_SUPPORT +#include "SecHdmiClient.h" +#endif + namespace android { // --------------------------------------------------------------------------- @@ -458,6 +462,9 @@ private: */ sp mExtDisplayToken; +#if defined(SAMSUNG_HDMI_SUPPORT) && defined(SAMSUNG_EXYNOS5250) + SecHdmiClient * mHdmiClient; +#endif }; // --------------------------------------------------------------------------- -- cgit v1.1