Merge "gralloc: In lock use writer info from allocation time"
diff --git a/libgralloc/alloc_controller.cpp b/libgralloc/alloc_controller.cpp
index 4167ae2..cd6d565 100644
--- a/libgralloc/alloc_controller.cpp
+++ b/libgralloc/alloc_controller.cpp
@@ -292,6 +292,11 @@
if (usage & GRALLOC_USAGE_PRIVATE_MM_HEAP) {
ionFlags |= ION_HEAP(ION_CP_MM_HEAP_ID);
ionFlags |= ION_SECURE;
+#ifdef ION_FLAG_ALLOW_NON_CONTIG
+ if (!(usage & GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY)) {
+ ionFlags |= ION_FLAG_ALLOW_NON_CONTIG;
+ }
+#endif
} else {
// for targets/OEMs which do not need HW level protection
// do not set ion secure flag & MM heap. Fallback to IOMMU heap.
diff --git a/libgralloc/ionalloc.cpp b/libgralloc/ionalloc.cpp
index 23e225d..91a930c 100644
--- a/libgralloc/ionalloc.cpp
+++ b/libgralloc/ionalloc.cpp
@@ -77,12 +77,18 @@
ionAllocData.len = data.size;
ionAllocData.align = data.align;
ionAllocData.heap_id_mask = data.flags & ~ION_SECURE;
+#ifdef ION_FLAG_ALLOW_NON_CONTIG
+ ionAllocData.heap_id_mask &= (data.flags & ~ION_FLAG_ALLOW_NON_CONTIG);
+#endif
ionAllocData.flags = data.uncached ? 0 : ION_FLAG_CACHED;
// ToDo: replace usage of alloc data structure with
// ionallocdata structure.
if (data.flags & ION_SECURE)
ionAllocData.flags |= ION_SECURE;
-
+#ifdef ION_FLAG_ALLOW_NON_CONTIG
+ if (data.flags & ION_FLAG_ALLOW_NON_CONTIG)
+ ionAllocData.flags |= ION_FLAG_ALLOW_NON_CONTIG;
+#endif
err = open_device();
if (err)
return err;
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index 975c195..14b9a49 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -26,6 +26,7 @@
#include "hwc_ad.h"
#include <overlayRotator.h>
#include "hwc_copybit.h"
+#include "qd_utils.h"
using namespace overlay;
using namespace qdutils;
@@ -48,6 +49,7 @@
bool MDPComp::sSrcSplitEnabled = false;
int MDPComp::sMaxSecLayers = 1;
bool MDPComp::enablePartialUpdateForMDP3 = false;
+bool MDPComp::sIsPartialUpdateActive = true;
MDPComp* MDPComp::getObject(hwc_context_t *ctx, const int& dpy) {
if(qdutils::MDPVersion::getInstance().isSrcSplit()) {
sSrcSplitEnabled = true;
@@ -131,9 +133,7 @@
qdutils::MDPVersion &mdpVersion = qdutils::MDPVersion::getInstance();
- /* MDSS_MDP_STAGE_UNUSED and MDSS_MDP_STAGE_BASE are not available for MDP
- * composition. */
- sMaxPipesPerMixer = (int)mdpVersion.getBlendStages() - 2;
+ sMaxPipesPerMixer = (int)mdpVersion.getBlendStages();
if(property_get("persist.hwc.mdpcomp.maxpermixer", property, "-1") > 0) {
int val = atoi(property);
if(val >= 0)
@@ -192,6 +192,8 @@
enablePartialUpdateForMDP3 = true;
}
+ sIsPartialUpdateActive = getPartialUpdatePref(ctx);
+
return true;
}
@@ -231,7 +233,7 @@
void MDPComp::setMaxPipesPerMixer(const uint32_t value) {
qdutils::MDPVersion &mdpVersion = qdutils::MDPVersion::getInstance();
- uint32_t maxSupported = (int)mdpVersion.getBlendStages() - 2;
+ uint32_t maxSupported = (int)mdpVersion.getBlendStages();
if(value > maxSupported) {
ALOGW("%s: Input exceeds max value supported. Setting to"
"max value: %d", __FUNCTION__, maxSupported);
@@ -1264,7 +1266,7 @@
hwc_display_contents_1_t* list){
if(!qdutils::MDPVersion::getInstance().isPartialUpdateEnabled() ||
isSkipPresent(ctx, mDpy) || (list->flags & HWC_GEOMETRY_CHANGED) ||
- mDpy ) {
+ !sIsPartialUpdateActive || mDpy ) {
return false;
}
if(ctx->listStats[mDpy].secureUI)
@@ -2737,5 +2739,49 @@
return 0;
}
+bool MDPComp::getPartialUpdatePref(hwc_context_t *ctx) {
+ Locker::Autolock _l(ctx->mDrawLock);
+ const int fbNum = Overlay::getFbForDpy(Overlay::DPY_PRIMARY);
+ char path[MAX_SYSFS_FILE_PATH];
+ snprintf (path, sizeof(path), "sys/class/graphics/fb%d/dyn_pu", fbNum);
+ int fd = open(path, O_RDONLY);
+ if(fd < 0) {
+ ALOGE("%s: Failed to open sysfd node: %s", __FUNCTION__, path);
+ return -1;
+ }
+ char value[4];
+ ssize_t size_read = read(fd, value, sizeof(value)-1);
+ if(size_read <= 0) {
+ ALOGE("%s: Failed to read sysfd node: %s", __FUNCTION__, path);
+ close(fd);
+ return -1;
+ }
+ close(fd);
+ value[size_read] = '\0';
+ return atoi(value);
+}
+
+int MDPComp::setPartialUpdatePref(hwc_context_t *ctx, bool enable) {
+ Locker::Autolock _l(ctx->mDrawLock);
+ const int fbNum = Overlay::getFbForDpy(Overlay::DPY_PRIMARY);
+ char path[MAX_SYSFS_FILE_PATH];
+ snprintf (path, sizeof(path), "sys/class/graphics/fb%d/dyn_pu", fbNum);
+ int fd = open(path, O_WRONLY);
+ if(fd < 0) {
+ ALOGE("%s: Failed to open sysfd node: %s", __FUNCTION__, path);
+ return -1;
+ }
+ char value[4];
+ snprintf(value, sizeof(value), "%d", (int)enable);
+ ssize_t ret = write(fd, value, strlen(value));
+ if(ret <= 0) {
+ ALOGE("%s: Failed to write to sysfd nodes: %s", __FUNCTION__, path);
+ close(fd);
+ return -1;
+ }
+ close(fd);
+ sIsPartialUpdateActive = enable;
+ return 0;
+}
}; //namespace
diff --git a/libhwcomposer/hwc_mdpcomp.h b/libhwcomposer/hwc_mdpcomp.h
index 8929c40..3ce4a64 100644
--- a/libhwcomposer/hwc_mdpcomp.h
+++ b/libhwcomposer/hwc_mdpcomp.h
@@ -56,7 +56,8 @@
static void dynamicDebug(bool enable){ sDebugLogs = enable; }
static void setIdleTimeout(const uint32_t& timeout);
static void setMaxPipesPerMixer(const uint32_t value);
-
+ static int setPartialUpdatePref(hwc_context_t *ctx, bool enable);
+ static bool getPartialUpdatePref(hwc_context_t *ctx);
protected:
enum ePipeType {
MDPCOMP_OV_RGB = ovutils::OV_MDP_PIPE_RGB,
@@ -257,6 +258,7 @@
static bool sSrcSplitEnabled;
static IdleInvalidator *sIdleInvalidator;
static int sMaxSecLayers;
+ static bool sIsPartialUpdateActive;
struct FrameInfo mCurrentFrame;
struct LayerCache mCachedFrame;
//Enable 4kx2k yuv layer split
diff --git a/libhwcomposer/hwc_qclient.cpp b/libhwcomposer/hwc_qclient.cpp
index b0ebb3a..add5dc8 100644
--- a/libhwcomposer/hwc_qclient.cpp
+++ b/libhwcomposer/hwc_qclient.cpp
@@ -306,6 +306,13 @@
}
}
+static status_t setPartialUpdatePref(hwc_context_t *ctx, uint32_t enable) {
+ ALOGD("%s: enable: %d", __FUNCTION__, enable);
+ if(qhwc::MDPComp::setPartialUpdatePref(ctx, (bool)enable) < 0)
+ return NO_INIT;
+ return NO_ERROR;
+}
+
status_t QClient::notifyCallback(uint32_t command, const Parcel* inParcel,
Parcel* outParcel) {
status_t ret = NO_ERROR;
@@ -353,6 +360,8 @@
break;
case IQService::SET_MAX_PIPES_PER_MIXER:
setMaxPipesPerMixer(mHwcContext, inParcel);
+ case IQService::SET_PARTIAL_UPDATE:
+ ret = setPartialUpdatePref(mHwcContext, inParcel->readInt32());
break;
case IQService::TOGGLE_BWC:
toggleBWC(mHwcContext, inParcel);
diff --git a/libqdutils/mdp_version.cpp b/libqdutils/mdp_version.cpp
index f8729a5..8ca0824 100644
--- a/libqdutils/mdp_version.cpp
+++ b/libqdutils/mdp_version.cpp
@@ -101,7 +101,7 @@
mSourceSplitAlways = false;
mRGBHasNoScalar = false;
mRotDownscale = false;
- mBlendStages = 6; //min no. of stages supported by MDP.
+ mBlendStages = 4; //min no. of stages supported by MDP.
// this is the default limit of mixer unless driver reports it.
// For resolutions beyond this, we use dual/split overlay pipes.
diff --git a/libqservice/IQService.h b/libqservice/IQService.h
index 683c93c..a935131 100644
--- a/libqservice/IQService.h
+++ b/libqservice/IQService.h
@@ -55,8 +55,9 @@
DYNAMIC_DEBUG = 15, // Enable more logging on the fly
SET_IDLE_TIMEOUT = 16, // Set idle timeout for GPU fallback
TOGGLE_BWC = 17, // Toggle BWC On/Off on targets that support
+ SET_PARTIAL_UPDATE = 18, // Preference on partial update feature
/* Enable/Disable/Set refresh rate dynamically */
- CONFIGURE_DYN_REFRESH_RATE = 18,
+ CONFIGURE_DYN_REFRESH_RATE = 19,
COMMAND_LIST_END = 400,
};
diff --git a/libqservice/QServiceUtils.h b/libqservice/QServiceUtils.h
index f53d140..5b61c8e 100644
--- a/libqservice/QServiceUtils.h
+++ b/libqservice/QServiceUtils.h
@@ -74,6 +74,10 @@
return sendSingleParam(qService::IQService::SCREEN_REFRESH, 1);
}
+inline android::status_t setPartialUpdate(uint32_t enable) {
+ return sendSingleParam(qService::IQService::SET_PARTIAL_UPDATE, enable);
+}
+
inline android::status_t setExtOrientation(uint32_t orientation) {
return sendSingleParam(qService::IQService::EXTERNAL_ORIENTATION,
orientation);