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: Ib8b083ecfa071bbf9f72bfbfb8ecd6b202e87847
This commit is contained in:
Naseer Ahmed 2012-07-01 23:54:19 -07:00 committed by Gohulan Balachandran
parent f3095241bc
commit 6e75c3d61a
20 changed files with 201 additions and 71 deletions

View File

@ -1,9 +1,9 @@
#Enables the listed display HAL modules
display-hals := libqcomui
#libs to be built for QCOM targets only
#ifeq ($(call is-vendor-board-platform,QCOM),true)
display-hals += libgralloc libgenlock libcopybit libhwcomposer liboverlay
#endif
ifeq ($(call is-vendor-board-platform,QCOM),true)
display-hals := libgralloc libgenlock libcopybit
display-hals +=libhwcomposer liboverlay libqdutils
endif
include $(call all-named-subdir-makefiles,$(display-hals))

View File

@ -19,10 +19,10 @@ include $(CLEAR_VARS)
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 $(BUILD_SHARED_LIBRARY)
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\"

View File

@ -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 @@ static bool canFallback(int usage, bool triedSystem)
// 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;

View File

@ -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;

View File

@ -3,7 +3,7 @@ include $(CLEAR_VARS)
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_MODULE := hwcomposer.$(TARGET_BOARD_PLATFORM)
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

View File

@ -94,7 +94,7 @@ static int hwc_set(hwc_composer_device_t *dev,
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]));
}
}

View File

@ -16,6 +16,7 @@
*/
#include "hwc_utils.h"
#define FINAL_TRANSFORM_MASK 0x000F
namespace qhwc {
// Determine overlay state based on decoded video info

View File

@ -16,6 +16,7 @@
*/
#include "hwc_utils.h"
#include "mdp_version.h"
namespace qhwc {
void initContext(hwc_context_t *ctx)
@ -24,6 +25,9 @@ void initContext(hwc_context_t *ctx)
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 @@ void handleYUV(hwc_context_t *ctx, hwc_layer_t *layer)
(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;
}
}

View File

@ -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 @@ struct hwc_context_t {
int yuvBufferCount;
int hdmiEnabled;
int numHwLayers;
int mdpVersion;
bool hasOverlay;
bool skipComposition;
//Framebuffer device

View File

@ -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)

11
libqdutils/Android.mk Normal file
View File

@ -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)

View File

@ -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 @@ class QCCompositionType : public Singleton <QCCompositionType>
};
ANDROID_SINGLETON_STATIC_INSTANCE(QCCompositionType);
inline QCCompositionType::QCCompositionType()
{
char property[PROPERTY_VALUE_MAX];
@ -89,4 +88,6 @@ inline QCCompositionType::QCCompositionType()
}
}
}; //namespace qdutils
ANDROID_SINGLETON_STATIC_INSTANCE(qdutils::QCCompositionType);
#endif //INCLUDE_LIBQCOM_COMPTYPES

View File

@ -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

67
libqdutils/mdp_version.h Normal file
View File

@ -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

View File

@ -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 @@ void CalcFps::calc_fps(nsecs_t currtime_us)
}
return;
}
};//namespace qomutils
#endif

View File

@ -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 @@ class CalcFps : public Singleton<CalcFps> {
debug_fps_metadata_t debug_fps_metadata;
unsigned int debug_fps_level;
};
};//namespace qdutils
#endif
#endif // INCLUDE_PROFILER

View File

@ -93,18 +93,6 @@ enum {
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.,