From 91deade06b83b95b65f463996e60ea7f91574c59 Mon Sep 17 00:00:00 2001 From: Carl Vanderlip Date: Mon, 19 Dec 2011 16:11:22 -0800 Subject: [PATCH] setVisualParam Overlay API Pass visual parameters such as sharpness, brightness, contrast, hue, and saturation from framework to kernel. Converts floating point to int8_t to represent visual param values. Change-Id: I3dfc7c38d305fb05f080efb624f61c76adb5e023 --- liboverlay/Android.mk | 6 ++ liboverlay/overlayLib.cpp | 142 ++++++++++++++++++++++++++++++++++++++ liboverlay/overlayLib.h | 31 +++++++++ 3 files changed, 179 insertions(+) diff --git a/liboverlay/Android.mk b/liboverlay/Android.mk index 8434fdd..f0c3d6f 100755 --- a/liboverlay/Android.mk +++ b/liboverlay/Android.mk @@ -28,6 +28,12 @@ LOCAL_CFLAGS:= -DLOG_TAG=\"OverlayLib\" ifeq ($(TARGET_USE_HDMI_AS_PRIMARY),true) LOCAL_CFLAGS += -DHDMI_AS_PRIMARY endif +ifeq ($(TARGET_USES_POST_PROCESSING),true) +LOCAL_CFLAGS += -DUSES_POST_PROCESSING +LOCAL_SHARED_LIBRARIES += libmm-abl +LOCAL_C_INCLUDES += vendor/qcom/proprietary/mm-core-noship/display/abl/inc +LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/lib/ +endif LOCAL_MODULE := liboverlay LOCAL_MODULE_TAGS := optional include $(BUILD_SHARED_LIBRARY) diff --git a/liboverlay/overlayLib.cpp b/liboverlay/overlayLib.cpp index 3e26d3a..5578371 100755 --- a/liboverlay/overlayLib.cpp +++ b/liboverlay/overlayLib.cpp @@ -2003,3 +2003,145 @@ bool OverlayDataChannel::setCrop(uint32_t x, uint32_t y, uint32_t w, uint32_t h) return true; } + +/* setVisualParam can be called to set the configuration value of a post + * processing feature (HUE,SATURATION,BRIGHTNESS,CONTRAST,SMOOTHING/SHARPENING) + * for the first 4, the setting will stay set until the parameter is changed + * by another call to setVisualParam with that same paramType */ +void Overlay::setVisualParam(int8_t paramType, float paramValue) { + switch (mState) { + case OV_UI_MIRROR_TV: + case OV_2D_VIDEO_ON_PANEL: + case OV_3D_VIDEO_2D_PANEL: + // set the parameter value for the given parameter type. + if(!objOvCtrlChannel[VG0_PIPE].setVisualParam(paramType, paramValue)) { + LOGE("Failed to set param %d for value %f", paramType, paramValue); + } + break; + case OV_2D_VIDEO_ON_TV: + case OV_3D_VIDEO_3D_PANEL: + case OV_3D_VIDEO_2D_TV: + case OV_3D_VIDEO_3D_TV: + for (int i=0; i #include +#ifdef USES_POST_PROCESSING +#include "lib-postproc.h" +#endif + #define HW_OVERLAY_MAGNIFICATION_LIMIT 8 #define HW_OVERLAY_MINIFICATION_LIMIT HW_OVERLAY_MAGNIFICATION_LIMIT @@ -54,6 +58,16 @@ #define NUM_CHANNELS 2 #define FRAMEBUFFER_0 0 #define FRAMEBUFFER_1 1 +#define NUM_SHARPNESS_VALS 256 +#define SHARPNESS_RANGE 1.0f +#define HUE_RANGE 180 +#define BRIGHTNESS_RANGE 255 +#define CON_SAT_RANGE 1.0f +#define CAP_RANGE(value,max,min) do { if (value - min < -0.0001)\ + {value = min;}\ + else if(value - max > 0.0001)\ + {value = max;}\ + } while(0); enum { HDMI_OFF, @@ -249,6 +263,17 @@ typedef struct mdp_rect overlay_rect; class OverlayControlChannel { +enum { + SET_NONE = 0, + SET_SHARPNESS, +#ifdef USES_POST_PROCESSING + SET_HUE, + SET_BRIGHTNESS, + SET_SATURATION, + SET_CONTRAST, +#endif + RESET_ALL, +}; bool mNoRot; int mFBNum; int mFBWidth; @@ -262,6 +287,9 @@ class OverlayControlChannel { int mOrientation; unsigned int mFormat3D; bool mUIChannel; +#ifdef USES_POST_PROCESSING + struct display_pp_conv_cfg hsic_cfg; +#endif mdp_overlay mOVInfo; msm_rotator_img_info mRotInfo; msmfb_overlay_3d m3DOVInfo; @@ -272,6 +300,7 @@ class OverlayControlChannel { int requestType = NEW_REQUEST); bool startOVRotatorSessions(const overlay_buffer_info& info, int orientation, int requestType); void swapOVRotWidthHeight(); + int commitVisualParam(int8_t paramType, float paramValue); public: OverlayControlChannel(); @@ -303,6 +332,7 @@ public: bool getPositionS3D(int channel, int format, overlay_rect *rect); bool updateOverlaySource(const overlay_buffer_info& info, int orientation, bool waitForVsync); bool getFormat() const { return mFormat; } + bool setVisualParam(int8_t paramType, float paramValue); bool useVirtualFB (); int getOverlayFlags() const { return mOVInfo.flags; } }; @@ -395,6 +425,7 @@ public: bool ignoreFB = false, int numBuffers = 2); bool setCrop(uint32_t x, uint32_t y, uint32_t w, uint32_t h); bool updateWaitForVsyncFlags(bool waitForVsync); + void setVisualParam(int8_t paramType, float paramValue); bool waitForHdmiVsync(int channel); int getChannelStatus() const { return (mChannelUP ? OVERLAY_CHANNEL_UP: OVERLAY_CHANNEL_DOWN); } void setHDMIStatus (bool isHDMIConnected) { mHDMIConnected = isHDMIConnected; mState = -1; }