Merge "gralloc: Allow non-contiguous allocations for secure buffers"
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index ba7793e..14b9a49 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -192,6 +192,8 @@
enablePartialUpdateForMDP3 = true;
}
+ sIsPartialUpdateActive = getPartialUpdatePref(ctx);
+
return true;
}
@@ -2737,6 +2739,28 @@
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);
@@ -2744,14 +2768,14 @@
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", __FUNCTION__);
+ 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", __FUNCTION__);
+ ALOGE("%s: Failed to write to sysfd nodes: %s", __FUNCTION__, path);
close(fd);
return -1;
}
diff --git a/libhwcomposer/hwc_mdpcomp.h b/libhwcomposer/hwc_mdpcomp.h
index 4ae7aa7..3ce4a64 100644
--- a/libhwcomposer/hwc_mdpcomp.h
+++ b/libhwcomposer/hwc_mdpcomp.h
@@ -57,7 +57,7 @@
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,