hwc: featurize using QCOM_BSP

- Use QCOM_BSP for HWC_BLIT and GPUHint features
- These are not avaliable on all platforms

Change-Id: Ied0c60246093c868ac708f2f8897f08cec1e8878
This commit is contained in:
Saurabh Shah
2014-03-28 16:33:13 -07:00
parent dc1e961855
commit 74eff4debf
3 changed files with 19 additions and 3 deletions

View File

@@ -27,6 +27,8 @@
#include "cb_utils.h" #include "cb_utils.h"
#include "cb_swap_rect.h" #include "cb_swap_rect.h"
#include "math.h" #include "math.h"
#include "sync/sync.h"
using namespace qdutils; using namespace qdutils;
namespace qhwc { namespace qhwc {
@@ -230,9 +232,11 @@ bool CopyBit::prepare(hwc_context_t *ctx, hwc_display_contents_1_t *list,
// Mark all layers to be drawn by copybit // Mark all layers to be drawn by copybit
for (int i = ctx->listStats[dpy].numAppLayers-1; i >= 0 ; i--) { for (int i = ctx->listStats[dpy].numAppLayers-1; i >= 0 ; i--) {
layerProp[i].mFlags |= HWC_COPYBIT; layerProp[i].mFlags |= HWC_COPYBIT;
#ifdef QCOM_BSP
if (ctx->mMDP.version == qdutils::MDP_V3_0_4) if (ctx->mMDP.version == qdutils::MDP_V3_0_4)
list->hwLayers[i].compositionType = HWC_BLIT; list->hwLayers[i].compositionType = HWC_BLIT;
else else
#endif
list->hwLayers[i].compositionType = HWC_OVERLAY; list->hwLayers[i].compositionType = HWC_OVERLAY;
} }
} }

View File

@@ -52,6 +52,7 @@ using namespace overlay;
using namespace overlay::utils; using namespace overlay::utils;
namespace ovutils = overlay::utils; namespace ovutils = overlay::utils;
#ifdef QCOM_BSP
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@@ -71,6 +72,7 @@ EGLAPI EGLBoolean eglGpuPerfHintQCOM(EGLDisplay dpy, EGLContext ctx,
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif
namespace qhwc { namespace qhwc {
@@ -268,13 +270,14 @@ void initContext(hwc_context_t *ctx)
// Initialize gpu perfomance hint related parameters // Initialize gpu perfomance hint related parameters
property_get("sys.hwc.gpu_perf_mode", value, "0"); property_get("sys.hwc.gpu_perf_mode", value, "0");
#ifdef QCOM_BSP
ctx->mGPUHintInfo.mGpuPerfModeEnable = atoi(value)? true : false; ctx->mGPUHintInfo.mGpuPerfModeEnable = atoi(value)? true : false;
ctx->mGPUHintInfo.mEGLDisplay = NULL; ctx->mGPUHintInfo.mEGLDisplay = NULL;
ctx->mGPUHintInfo.mEGLContext = NULL; ctx->mGPUHintInfo.mEGLContext = NULL;
ctx->mGPUHintInfo.mPrevCompositionGLES = false; ctx->mGPUHintInfo.mPrevCompositionGLES = false;
ctx->mGPUHintInfo.mCurrGPUPerfMode = EGL_GPU_LEVEL_0; ctx->mGPUHintInfo.mCurrGPUPerfMode = EGL_GPU_LEVEL_0;
#endif
ALOGI("Initializing Qualcomm Hardware Composer"); ALOGI("Initializing Qualcomm Hardware Composer");
ALOGI("MDP version: %d", ctx->mMDP.version); ALOGI("MDP version: %d", ctx->mMDP.version);
} }
@@ -1331,7 +1334,9 @@ int hwc_sync(hwc_context_t *ctx, hwc_display_contents_1_t* list, int dpy,
for(uint32_t i = 0; i < list->numHwLayers; i++) { for(uint32_t i = 0; i < list->numHwLayers; i++) {
if(list->hwLayers[i].compositionType == HWC_OVERLAY || if(list->hwLayers[i].compositionType == HWC_OVERLAY ||
#ifdef QCOM_BSP
list->hwLayers[i].compositionType == HWC_BLIT || list->hwLayers[i].compositionType == HWC_BLIT ||
#endif
list->hwLayers[i].compositionType == HWC_FRAMEBUFFER_TARGET) { list->hwLayers[i].compositionType == HWC_FRAMEBUFFER_TARGET) {
//Populate releaseFenceFds. //Populate releaseFenceFds.
if(UNLIKELY(swapzero)) { if(UNLIKELY(swapzero)) {
@@ -1341,12 +1346,15 @@ int hwc_sync(hwc_context_t *ctx, hwc_display_contents_1_t* list, int dpy,
// if animation is in progress. // if animation is in progress.
list->hwLayers[i].releaseFenceFd = -1; list->hwLayers[i].releaseFenceFd = -1;
} else if(list->hwLayers[i].releaseFenceFd < 0 ) { } else if(list->hwLayers[i].releaseFenceFd < 0 ) {
#ifdef QCOM_BSP
//If rotator has not already populated this field //If rotator has not already populated this field
if(list->hwLayers[i].compositionType == HWC_BLIT) { if(list->hwLayers[i].compositionType == HWC_BLIT) {
//For Blit, the app layers should be released when the Blit is //For Blit, the app layers should be released when the Blit is
//complete. This fd was passed from copybit->draw //complete. This fd was passed from copybit->draw
list->hwLayers[i].releaseFenceFd = dup(fd); list->hwLayers[i].releaseFenceFd = dup(fd);
} else { } else
#endif
{
list->hwLayers[i].releaseFenceFd = dup(releaseFd); list->hwLayers[i].releaseFenceFd = dup(releaseFd);
} }
} }
@@ -2017,8 +2025,10 @@ bool isGLESComp(hwc_context_t *ctx,
void setGPUHint(hwc_context_t* ctx, hwc_display_contents_1_t* list) { void setGPUHint(hwc_context_t* ctx, hwc_display_contents_1_t* list) {
struct gpu_hint_info *gpuHint = &ctx->mGPUHintInfo; struct gpu_hint_info *gpuHint = &ctx->mGPUHintInfo;
if(!gpuHint->mGpuPerfModeEnable) if(!gpuHint->mGpuPerfModeEnable || !ctx || !list)
return; return;
#ifdef QCOM_BSP
/* Set the GPU hint flag to high for MIXED/GPU composition only for /* Set the GPU hint flag to high for MIXED/GPU composition only for
first frame after MDP -> GPU/MIXED mode transition. Set the GPU first frame after MDP -> GPU/MIXED mode transition. Set the GPU
hint to default if the previous composition is GPU or current GPU hint to default if the previous composition is GPU or current GPU
@@ -2074,6 +2084,7 @@ void setGPUHint(hwc_context_t* ctx, hwc_display_contents_1_t* list) {
} }
gpuHint->mPrevCompositionGLES = false; gpuHint->mPrevCompositionGLES = false;
} }
#endif
} }
void BwcPM::setBwc(const hwc_rect_t& crop, void BwcPM::setBwc(const hwc_rect_t& crop,

View File

@@ -35,6 +35,7 @@
#include "mdpWrapper.h" #include "mdpWrapper.h"
#include "overlayUtils.h" #include "overlayUtils.h"
#include "overlayMem.h" #include "overlayMem.h"
#include "sync/sync.h"
namespace overlay { namespace overlay {