hwc: Replace redundant display_commit with Overlay displayCommit
1. As part of Writeback class implementation, display commit is
implemented in Overlay class.
Replace display_commit function with Overlay::displayCommit
function.
2. Fix return value of hwc_blank function
Change-Id: Ie54fa9876495608a60216025e57cf4de7f6cb03c
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index 6c7f26d..b9b62a9 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -141,18 +141,6 @@
}
}
-static int display_commit(hwc_context_t *ctx, int dpy) {
- struct mdp_display_commit commit_info;
- memset(&commit_info, 0, sizeof(struct mdp_display_commit));
- commit_info.flags = MDP_DISPLAY_COMMIT_OVERLAY;
- if(ioctl(ctx->dpyAttr[dpy].fd, MSMFB_DISPLAY_COMMIT, &commit_info) < 0){
- ALOGE("%s: MSMFB_DISPLAY_COMMIT for dpy %d failed", __FUNCTION__,
- dpy);
- return -errno;
- }
- return 0;
-}
-
static int hwc_prepare_primary(hwc_composer_device_1 *dev,
hwc_display_contents_1_t *list) {
hwc_context_t* ctx = (hwc_context_t*)(dev);
@@ -373,14 +361,22 @@
* activate/deactive VIRTUAL DISPLAY */
if(ctx->dpyAttr[HWC_DISPLAY_VIRTUAL].connected) {
- if(blank)
- display_commit(ctx, HWC_DISPLAY_VIRTUAL);
+ if(blank) {
+ int dpy = HWC_DISPLAY_VIRTUAL;
+ if(!Overlay::displayCommit(ctx->dpyAttr[dpy].fd)) {
+ ALOGE("%s: display commit fail for virtual!", __FUNCTION__);
+ ret = -1;
+ }
+ }
ctx->dpyAttr[HWC_DISPLAY_VIRTUAL].isActive = !blank;
}
break;
case HWC_DISPLAY_EXTERNAL:
if(blank) {
- display_commit(ctx, HWC_DISPLAY_EXTERNAL);
+ if(!Overlay::displayCommit(ctx->dpyAttr[dpy].fd)) {
+ ALOGE("%s: display commit fail for external!", __FUNCTION__);
+ ret = -1;
+ }
}
break;
default:
@@ -391,7 +387,7 @@
ALOGD_IF(BLANK_DEBUG, "%s: Done %s display: %d", __FUNCTION__,
blank ? "blanking":"unblanking", dpy);
- return 0;
+ return ret;
}
static int hwc_query(struct hwc_composer_device_1* dev,
@@ -455,8 +451,8 @@
}
}
- if (display_commit(ctx, dpy) < 0) {
- ALOGE("%s: display commit fail!", __FUNCTION__);
+ if(!Overlay::displayCommit(ctx->dpyAttr[dpy].fd)) {
+ ALOGE("%s: display commit fail for %d dpy!", __FUNCTION__, dpy);
ret = -1;
}
}
@@ -516,8 +512,8 @@
}
}
- if (display_commit(ctx, dpy) < 0) {
- ALOGE("%s: display commit fail!", __FUNCTION__);
+ if(!Overlay::displayCommit(ctx->dpyAttr[dpy].fd)) {
+ ALOGE("%s: display commit fail for %d dpy!", __FUNCTION__, dpy);
ret = -1;
}
}
@@ -574,8 +570,8 @@
}
}
- if (display_commit(ctx, dpy) < 0) {
- ALOGE("%s: display commit fail!", __FUNCTION__);
+ if(!Overlay::displayCommit(ctx->dpyAttr[dpy].fd)) {
+ ALOGE("%s: display commit fail for %d dpy!", __FUNCTION__, dpy);
ret = -1;
}
}