hwc: featurize using QCOM_BSP
- Use QCOM_BSP for HWC_BLIT and GPUHint features
- These are not avaliable on all platforms
Change-Id: Ied0c60246093c868ac708f2f8897f08cec1e8878
diff --git a/libhwcomposer/hwc_copybit.cpp b/libhwcomposer/hwc_copybit.cpp
index dc9a813..92aeca2 100644
--- a/libhwcomposer/hwc_copybit.cpp
+++ b/libhwcomposer/hwc_copybit.cpp
@@ -27,6 +27,8 @@
#include "cb_utils.h"
#include "cb_swap_rect.h"
#include "math.h"
+#include "sync/sync.h"
+
using namespace qdutils;
namespace qhwc {
@@ -230,9 +232,11 @@
// Mark all layers to be drawn by copybit
for (int i = ctx->listStats[dpy].numAppLayers-1; i >= 0 ; i--) {
layerProp[i].mFlags |= HWC_COPYBIT;
+#ifdef QCOM_BSP
if (ctx->mMDP.version == qdutils::MDP_V3_0_4)
list->hwLayers[i].compositionType = HWC_BLIT;
else
+#endif
list->hwLayers[i].compositionType = HWC_OVERLAY;
}
}
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 3f5d77a..5a6c154 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -52,6 +52,7 @@
using namespace overlay::utils;
namespace ovutils = overlay::utils;
+#ifdef QCOM_BSP
#ifdef __cplusplus
extern "C" {
#endif
@@ -71,6 +72,7 @@
#ifdef __cplusplus
}
#endif
+#endif
namespace qhwc {
@@ -268,13 +270,14 @@
// Initialize gpu perfomance hint related parameters
property_get("sys.hwc.gpu_perf_mode", value, "0");
+#ifdef QCOM_BSP
ctx->mGPUHintInfo.mGpuPerfModeEnable = atoi(value)? true : false;
ctx->mGPUHintInfo.mEGLDisplay = NULL;
ctx->mGPUHintInfo.mEGLContext = NULL;
ctx->mGPUHintInfo.mPrevCompositionGLES = false;
ctx->mGPUHintInfo.mCurrGPUPerfMode = EGL_GPU_LEVEL_0;
-
+#endif
ALOGI("Initializing Qualcomm Hardware Composer");
ALOGI("MDP version: %d", ctx->mMDP.version);
}
@@ -1331,7 +1334,9 @@
for(uint32_t i = 0; i < list->numHwLayers; i++) {
if(list->hwLayers[i].compositionType == HWC_OVERLAY ||
+#ifdef QCOM_BSP
list->hwLayers[i].compositionType == HWC_BLIT ||
+#endif
list->hwLayers[i].compositionType == HWC_FRAMEBUFFER_TARGET) {
//Populate releaseFenceFds.
if(UNLIKELY(swapzero)) {
@@ -1341,12 +1346,15 @@
// if animation is in progress.
list->hwLayers[i].releaseFenceFd = -1;
} else if(list->hwLayers[i].releaseFenceFd < 0 ) {
+#ifdef QCOM_BSP
//If rotator has not already populated this field
if(list->hwLayers[i].compositionType == HWC_BLIT) {
//For Blit, the app layers should be released when the Blit is
//complete. This fd was passed from copybit->draw
list->hwLayers[i].releaseFenceFd = dup(fd);
- } else {
+ } else
+#endif
+ {
list->hwLayers[i].releaseFenceFd = dup(releaseFd);
}
}
@@ -2017,8 +2025,10 @@
void setGPUHint(hwc_context_t* ctx, hwc_display_contents_1_t* list) {
struct gpu_hint_info *gpuHint = &ctx->mGPUHintInfo;
- if(!gpuHint->mGpuPerfModeEnable)
+ if(!gpuHint->mGpuPerfModeEnable || !ctx || !list)
return;
+
+#ifdef QCOM_BSP
/* Set the GPU hint flag to high for MIXED/GPU composition only for
first frame after MDP -> GPU/MIXED mode transition. Set the GPU
hint to default if the previous composition is GPU or current GPU
@@ -2074,6 +2084,7 @@
}
gpuHint->mPrevCompositionGLES = false;
}
+#endif
}
void BwcPM::setBwc(const hwc_rect_t& crop,
diff --git a/liboverlay/overlayRotator.h b/liboverlay/overlayRotator.h
index be0c8bd..53c54e6 100644
--- a/liboverlay/overlayRotator.h
+++ b/liboverlay/overlayRotator.h
@@ -35,6 +35,7 @@
#include "mdpWrapper.h"
#include "overlayUtils.h"
#include "overlayMem.h"
+#include "sync/sync.h"
namespace overlay {