display: Add QC Display utils
* Rename qcomui directory to qdutils
* Avoid inclusion of qcom_ui header
* Add class to get MDP version
* Add namespace for qdutils to prevent collison
Change-Id: I9a3f440e6b0fea1cfcc478ddca90af5df3bbb897
diff --git a/Android.mk b/Android.mk
index 0166031..9a17e5f 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,8 +1,7 @@
ifneq ($(filter msm8960,$(TARGET_BOARD_PLATFORM)),)
-display-hals := libqcomui
-display-hals += libgralloc libgenlock libcopybit libhwcomposer liboverlay liblight
+display-hals := libgralloc libgenlock libcopybit liblight
+display-hals +=libhwcomposer liboverlay libqdutils
include $(call all-named-subdir-makefiles,$(display-hals))
-
endif
diff --git a/libgralloc/Android.mk b/libgralloc/Android.mk
index e3ca6f9..fd4cacb 100644
--- a/libgralloc/Android.mk
+++ b/libgralloc/Android.mk
@@ -19,10 +19,10 @@
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_SHARED_LIBRARIES := liblog libcutils libutils libmemalloc
-LOCAL_SHARED_LIBRARIES += libgenlock libQcomUI libGLESv1_CM
+LOCAL_SHARED_LIBRARIES += libgenlock libqdutils libGLESv1_CM
LOCAL_C_INCLUDES := hardware/qcom/display/liboverlay/
LOCAL_C_INCLUDES += hardware/qcom/display/libgenlock
-LOCAL_C_INCLUDES += hardware/qcom/display/libqcomui
+LOCAL_C_INCLUDES += hardware/qcom/display/libqdutils
LOCAL_MODULE := gralloc.$(TARGET_BOARD_PLATFORM)
LOCAL_MODULE_TAGS := optional
LOCAL_CFLAGS := -DLOG_TAG=\"$(TARGET_BOARD_PLATFORM).gralloc\" \
@@ -48,7 +48,7 @@
include $(CLEAR_VARS)
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)
-LOCAL_C_INCLUDES := hardware/qcom/display/libqcomui
+LOCAL_C_INCLUDES := hardware/qcom/display/libqdutils
LOCAL_SHARED_LIBRARIES := liblog libcutils libutils
LOCAL_SRC_FILES := ionalloc.cpp alloc_controller.cpp
LOCAL_CFLAGS:= -DLOG_TAG=\"memalloc\"
diff --git a/libgralloc/alloc_controller.cpp b/libgralloc/alloc_controller.cpp
index 1356b2f..5d0cf2b 100644
--- a/libgralloc/alloc_controller.cpp
+++ b/libgralloc/alloc_controller.cpp
@@ -37,9 +37,10 @@
#include "pmemalloc.h"
#include "ashmemalloc.h"
#include "gr.h"
-#include "qcomutils/comptype.h"
+#include "comptype.h"
using namespace gralloc;
+using namespace qdutils;
using android::sp;
const int GRALLOC_HEAP_MASK = GRALLOC_USAGE_PRIVATE_ADSP_HEAP |
@@ -62,7 +63,8 @@
// 4. The heap type is protected
// 5. The buffer is meant for external display only
- if(QCCompositionType::getInstance().getCompositionType() & COMPOSITION_TYPE_MDP)
+ if(QCCompositionType::getInstance().getCompositionType() &
+ COMPOSITION_TYPE_MDP)
return false;
if(triedSystem)
return false;
diff --git a/libgralloc/framebuffer.cpp b/libgralloc/framebuffer.cpp
index c3a6b93..97295a3 100644
--- a/libgralloc/framebuffer.cpp
+++ b/libgralloc/framebuffer.cpp
@@ -40,7 +40,7 @@
#include "fb_priv.h"
#include "gr.h"
#include <cutils/properties.h>
-#include <qcomutils/profiler.h>
+#include <profiler.h>
#include "overlay.h"
namespace ovutils = overlay::utils;
diff --git a/libhwcomposer/Android.mk b/libhwcomposer/Android.mk
index 7cb5c6f..018de6c 100644
--- a/libhwcomposer/Android.mk
+++ b/libhwcomposer/Android.mk
@@ -3,7 +3,7 @@
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_SHARED_LIBRARIES := liblog libcutils libhardware libutils
-LOCAL_SHARED_LIBRARIES += libEGL liboverlay libgenlock
+LOCAL_SHARED_LIBRARIES += libEGL liboverlay libgenlock libqdutils
LOCAL_SRC_FILES := hwc.cpp \
hwc_overlay.cpp \
hwc_utils.cpp
@@ -11,7 +11,7 @@
LOCAL_C_INCLUDES := hardware/qcom/display/libgralloc
LOCAL_C_INCLUDES += hardware/qcom/display/libgenlock
LOCAL_C_INCLUDES += hardware/qcom/display/liboverlay
-LOCAL_C_INCLUDES += hardware/qcom/display/libqcomui
+LOCAL_C_INCLUDES += hardware/qcom/display/libqdutils
LOCAL_CFLAGS:= -DLOG_TAG=\"$(TARGET_BOARD_PLATFORM).hwcomposer\"
LOCAL_MODULE_TAGS := optional
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index afd2aa9..a5e31ef 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -94,7 +94,7 @@
for (size_t i=0; i<list->numHwLayers; i++) {
if (list->hwLayers[i].flags & HWC_SKIP_LAYER) {
continue;
- } else if (list->hwLayers[i].compositionType == HWC_USE_OVERLAY) {
+ } else if (list->hwLayers[i].compositionType == HWC_OVERLAY) {
drawLayerUsingOverlay(ctx, &(list->hwLayers[i]));
}
}
diff --git a/libhwcomposer/hwc_overlay.cpp b/libhwcomposer/hwc_overlay.cpp
index 00f53e9..77402cc 100644
--- a/libhwcomposer/hwc_overlay.cpp
+++ b/libhwcomposer/hwc_overlay.cpp
@@ -16,6 +16,7 @@
*/
#include "hwc_utils.h"
+#define FINAL_TRANSFORM_MASK 0x000F
namespace qhwc {
// Determine overlay state based on decoded video info
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 13873f8..79e09f7 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -16,6 +16,7 @@
*/
#include "hwc_utils.h"
+#include "mdp_version.h"
namespace qhwc {
void initContext(hwc_context_t *ctx)
@@ -24,6 +25,9 @@
openFramebufferDevice(ctx);
ctx->mOverlay = overlay::Overlay::getInstance();
ctx->qbuf = new QueuedBufferStore();
+ ctx->mdpVersion = qdutils::MDPVersion::getInstance().getMDPVersion();
+ ctx->hasOverlay = qdutils::MDPVersion::getInstance().hasOverlay();
+ ALOGI("MDP version: %d",ctx->mdpVersion);
}
@@ -89,7 +93,7 @@
(private_handle_t *)layer->handle;
//XXX: Handle targets not using overlay
if(prepareOverlay(ctx, layer)) {
- layer->compositionType = HWC_USE_OVERLAY;
+ layer->compositionType = HWC_OVERLAY;
layer->hints |= HWC_HINT_CLEAR_FB;
}
}
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index b1c7871..94a4edb 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -26,7 +26,6 @@
#include <string.h>
#include <fb_priv.h>
#include <overlay.h>
-#include <qcom_ui.h>
#include <genlock.h>
#include "hwc_qbuf.h"
@@ -37,6 +36,13 @@
struct hwc_context_t;
namespace qhwc {
+enum external_display_type {
+ EXT_TYPE_NONE,
+ EXT_TYPE_HDMI,
+ EXT_TYPE_WIFI
+};
+
+
// -----------------------------------------------------------------------------
// Utility functions - implemented in hwc_utils.cpp
void dumpLayer(hwc_layer_t const* l);
@@ -93,6 +99,8 @@
int yuvBufferCount;
int hdmiEnabled;
int numHwLayers;
+ int mdpVersion;
+ bool hasOverlay;
bool skipComposition;
//Framebuffer device
diff --git a/libqcomui/Android.mk b/libqcomui/Android.mk
deleted file mode 100644
index d79929e..0000000
--- a/libqcomui/Android.mk
+++ /dev/null
@@ -1,34 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-#Headers to export
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := qcomutils/profiler.cpp \
- qcomutils/IdleInvalidator.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libutils \
- libcutils \
- libui \
- libEGL \
-
-LOCAL_C_INCLUDES := hardware/qcom/display/libgralloc \
- frameworks/base/services/surfaceflinger \
-
-LOCAL_CFLAGS := -DLOG_TAG=\"libQcomUI\"
-
-ifneq ($(call is-vendor-board-platform,QCOM),true)
- LOCAL_CFLAGS += -DNON_QCOM_TARGET
-else
- LOCAL_SHARED_LIBRARIES += libmemalloc
-endif
-
-ifeq ($(TARGET_USES_MDP3), true)
- LOCAL_CFLAGS += -DUSE_MDP3
-endif
-
-LOCAL_CFLAGS += -DDEBUG_CALC_FPS
-
-LOCAL_MODULE := libQcomUI
-LOCAL_MODULE_TAGS := optional
-include $(BUILD_SHARED_LIBRARY)
diff --git a/libqdutils/Android.mk b/libqdutils/Android.mk
new file mode 100644
index 0000000..178ce39
--- /dev/null
+++ b/libqdutils/Android.mk
@@ -0,0 +1,11 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := profiler.cpp mdp_version.cpp
+LOCAL_SHARED_LIBRARIES := libutils libcutils
+LOCAL_C_INCLUDES := hardware/qcom/display/libgralloc
+
+LOCAL_CFLAGS += -DDEBUG_CALC_FPS
+LOCAL_MODULE := libqdutils
+LOCAL_MODULE_TAGS := optional
+include $(BUILD_SHARED_LIBRARY)
diff --git a/libqcomui/qcomutils/comptype.h b/libqdutils/comptype.h
similarity index 96%
rename from libqcomui/qcomutils/comptype.h
rename to libqdutils/comptype.h
index 603e143..a90f957 100644
--- a/libqcomui/qcomutils/comptype.h
+++ b/libqdutils/comptype.h
@@ -35,7 +35,7 @@
#include <cutils/properties.h>
using namespace android;
-
+namespace qdutils {
// Enum containing the supported composition types
enum {
COMPOSITION_TYPE_GPU = 0,
@@ -58,7 +58,6 @@
};
-ANDROID_SINGLETON_STATIC_INSTANCE(QCCompositionType);
inline QCCompositionType::QCCompositionType()
{
char property[PROPERTY_VALUE_MAX];
@@ -89,4 +88,6 @@
}
}
+}; //namespace qdutils
+ANDROID_SINGLETON_STATIC_INSTANCE(qdutils::QCCompositionType);
#endif //INCLUDE_LIBQCOM_COMPTYPES
diff --git a/libqcomui/qcomutils/IdleInvalidator.cpp b/libqdutils/idle_invalidator.cpp
old mode 100755
new mode 100644
similarity index 100%
rename from libqcomui/qcomutils/IdleInvalidator.cpp
rename to libqdutils/idle_invalidator.cpp
diff --git a/libqcomui/qcomutils/IdleInvalidator.h b/libqdutils/idle_invalidator.h
old mode 100755
new mode 100644
similarity index 100%
rename from libqcomui/qcomutils/IdleInvalidator.h
rename to libqdutils/idle_invalidator.h
diff --git a/libqdutils/mdp_version.cpp b/libqdutils/mdp_version.cpp
new file mode 100644
index 0000000..25f1142
--- /dev/null
+++ b/libqdutils/mdp_version.cpp
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <cutils/log.h>
+#include <fcntl.h>
+#include <linux/fb.h>
+#include "mdp_version.h"
+
+ANDROID_SINGLETON_STATIC_INSTANCE(qdutils::MDPVersion);
+namespace qdutils {
+
+static int getMDPVersionFromFB()
+{
+ int fb_fd = open("/dev/graphics/fb0", O_RDWR);
+ int mdp_version = MDP_V_UNKNOWN;
+ struct fb_fix_screeninfo fb_finfo;
+ if (ioctl(fb_fd, FBIOGET_FSCREENINFO, &fb_finfo) < 0) {
+ ALOGE("FBIOGET_FSCREENINFO failed");
+ mdp_version = MDP_V_UNKNOWN;
+ } else {
+ if(!strncmp(fb_finfo.id, "msmfb", 5)) {
+ char str_ver[4] = { 0 };
+ memcpy(str_ver, &fb_finfo.id[5], 3);
+ str_ver[3] = '\0';
+ mdp_version = atoi(str_ver);
+
+ //Normalize MDP version to ease comparison.
+ //This is needed only because
+ //MDP 3.0.3 reports value as 303 which
+ //is more than all the others
+ if (mdp_version < 100)
+ mdp_version *= 10;
+
+ } else if (!strncmp(fb_finfo.id, "mdssfb", 6)) {
+ mdp_version = MDSS_V5;
+ } else {
+ mdp_version = MDP_V_UNKNOWN;
+ }
+ }
+ close(fb_fd);
+ return mdp_version;
+}
+
+MDPVersion::MDPVersion()
+{
+ mMDPVersion = getMDPVersionFromFB();
+ if((mMDPVersion >= MDP_V4_0) || (mMDPVersion == MDP_V_UNKNOWN))
+ mHasOverlay = true;
+ else
+ mHasOverlay = false;
+}
+}; //namespace qdutils
+
diff --git a/libqdutils/mdp_version.h b/libqdutils/mdp_version.h
new file mode 100644
index 0000000..5ec0c67
--- /dev/null
+++ b/libqdutils/mdp_version.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef INCLUDE_LIBQCOMUTILS_MDPVER
+#define INCLUDE_LIBQCOMUTILS_MDPVER
+
+#include <stdint.h>
+#include <utils/Singleton.h>
+#include <cutils/properties.h>
+
+/* This class gets the MSM type from the soc info
+*/
+using namespace android;
+namespace qdutils {
+enum mdp_version {
+ MDP_V_UNKNOWN = 0,
+ MDP_V2_2 = 220,
+ MDP_V3_0 = 300,
+ MDP_V3_0_3 = 303,
+ MDP_V3_1 = 310,
+ MDP_V4_0 = 400,
+ MDP_V4_1 = 410,
+ MDP_V4_2 = 420,
+ MDP_V4_3 = 430,
+ MDP_V4_4 = 440,
+ MDSS_V5 = 500,
+};
+
+class MDPVersion : public Singleton <MDPVersion>
+{
+public:
+ MDPVersion();
+ ~MDPVersion() { }
+ int getMDPVersion() {return mMDPVersion;}
+ bool hasOverlay() {return mHasOverlay;}
+private:
+ int mMDPVersion;
+ bool mHasOverlay;
+};
+}; //namespace qdutils
+#endif //INCLUDE_LIBQCOMUTILS_MDPVER
diff --git a/libqcomui/qcomutils/profiler.cpp b/libqdutils/profiler.cpp
old mode 100755
new mode 100644
similarity index 98%
rename from libqcomui/qcomutils/profiler.cpp
rename to libqdutils/profiler.cpp
index 73854bc..a06ec4d
--- a/libqcomui/qcomutils/profiler.cpp
+++ b/libqdutils/profiler.cpp
@@ -27,14 +27,16 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#define LOG_TAG "CALCFPS"
+#define LOG_NDDEBUG 0
#include "profiler.h"
#ifdef DEBUG_CALC_FPS
-#define LOG_TAG "CALCFPS"
-#define LOG_NDDEBUG 0
-ANDROID_SINGLETON_STATIC_INSTANCE(CalcFps) ;
+ANDROID_SINGLETON_STATIC_INSTANCE(qdutils::CalcFps) ;
+
+namespace qdutils {
CalcFps::CalcFps() {
debug_fps_level = 0;
@@ -185,4 +187,5 @@
}
return;
}
+};//namespace qomutils
#endif
diff --git a/libqcomui/qcomutils/profiler.h b/libqdutils/profiler.h
old mode 100755
new mode 100644
similarity index 95%
rename from libqcomui/qcomutils/profiler.h
rename to libqdutils/profiler.h
index 394f490..6e74d04
--- a/libqcomui/qcomutils/profiler.h
+++ b/libqdutils/profiler.h
@@ -34,15 +34,15 @@
#include <utils/Singleton.h>
#include <cutils/properties.h>
#include <cutils/log.h>
-using namespace android;
#ifndef DEBUG_CALC_FPS
#define CALC_FPS() ((void)0)
#define CALC_INIT() ((void)0)
#else
-#define CALC_FPS() CalcFps::getInstance().Fps()
-#define CALC_INIT() CalcFps::getInstance().Init()
-
+#define CALC_FPS() qdutils::CalcFps::getInstance().Fps()
+#define CALC_INIT() qdutils::CalcFps::getInstance().Init()
+using namespace android;
+namespace qdutils {
class CalcFps : public Singleton<CalcFps> {
public:
CalcFps();
@@ -102,6 +102,7 @@
debug_fps_metadata_t debug_fps_metadata;
unsigned int debug_fps_level;
};
+};//namespace qdutils
#endif
#endif // INCLUDE_PROFILER
diff --git a/libqcomui/qcom_ui.cpp b/libqdutils/qcom_ui.cpp
similarity index 100%
rename from libqcomui/qcom_ui.cpp
rename to libqdutils/qcom_ui.cpp
diff --git a/libqcomui/qcom_ui.h b/libqdutils/qcom_ui.h
similarity index 96%
rename from libqcomui/qcom_ui.h
rename to libqdutils/qcom_ui.h
index 89974bd..6a96978 100644
--- a/libqcomui/qcom_ui.h
+++ b/libqdutils/qcom_ui.h
@@ -93,18 +93,6 @@
HWC_BYPASS_RESERVE_1 = 0x00000020,
};
-enum HWCCompositionType {
- HWC_USE_GPU = HWC_FRAMEBUFFER, // This layer is to be handled by Surfaceflinger
- HWC_USE_OVERLAY = HWC_OVERLAY, // This layer is to be handled by the overlay
- HWC_USE_COPYBIT // This layer is to be handled by copybit
-};
-
-enum external_display_type {
- EXT_TYPE_NONE,
- EXT_TYPE_HDMI,
- EXT_TYPE_WIFI
-};
-
/* Events to the Display HAL perform function
As of now used for external display related such as
connect, disconnect, orientation, video started etc.,