diff options
author | Ramkumar Radhakrishnan <ramkumar@codeaurora.org> | 2012-09-07 13:37:49 -0700 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2012-11-08 12:53:03 -0800 |
commit | 5b1f9478ffcd40c35b40c816fe5e55f902e5bac1 (patch) | |
tree | 587f6df0cdd0b41318d8322d7207cee1f4c19c29 | |
parent | bdce8066528e702191f2059836509b52efa9a2f8 (diff) | |
download | android_hardware_qcom_display-jellybean-stable.tar.gz android_hardware_qcom_display-jellybean-stable.tar.bz2 android_hardware_qcom_display-jellybean-stable.zip |
liboverlay: close all the opened pipes after framework reboot.jellybean-stable
Add initOverlay() function to close all the opened pipes when
Surfaceflinger process gets killed.
Change-Id: I9c65a61c81f9c81198f1076d6cbd27933b164c05
CRs-Fixed: 412954
(cherry picked from commit c20f1810dd07c9097ba4c066ec86a677399ae47f)
-rw-r--r-- | liboverlay/overlay.cpp | 6 | ||||
-rw-r--r-- | liboverlay/overlayUtils.cpp | 45 | ||||
-rw-r--r-- | liboverlay/overlayUtils.h | 5 |
3 files changed, 55 insertions, 1 deletions
diff --git a/liboverlay/overlay.cpp b/liboverlay/overlay.cpp index 09871da89..c01f00985 100644 --- a/liboverlay/overlay.cpp +++ b/liboverlay/overlay.cpp @@ -191,8 +191,12 @@ utils::eOverlayState Overlay::getState() const { Overlay *Overlay::sInstance = 0; Overlay* Overlay::getInstance() { - if(sInstance == NULL) + if(sInstance == NULL) { + if(utils::initOverlay() == -1) { + ALOGE("utils::initOverlay() ERROR!!"); + } sInstance = new Overlay(); + } return sInstance; } diff --git a/liboverlay/overlayUtils.cpp b/liboverlay/overlayUtils.cpp index 280b21461..a22802bcb 100644 --- a/liboverlay/overlayUtils.cpp +++ b/liboverlay/overlayUtils.cpp @@ -151,6 +151,51 @@ bool FrameBufferInfo::supportTrueMirroring() const { return (trueMirroringSupported && mBorderFillSupported); } +/* clears any VG pipes allocated to the fb devices */ +int initOverlay() { + msmfb_mixer_info_req req; + mdp_mixer_info *minfo = NULL; + char fb_dev_name[PATH_MAX]; + int fd = -1; + // loop upto FB_MAX devices + for(int i = 0; i < FB_MAX; i++) { + snprintf(fb_dev_name, PATH_MAX, Res::fbPath, i); + ALOGD("initoverlay:: opening the device:: %s", fb_dev_name); + fd = ::open(fb_dev_name, O_RDWR, 0); + if(fd < 0) { + // break out of this loop when there is no framebuffer node exists + break; + } + //Get the mixer configuration */ + req.mixer_num = i; + if (ioctl(fd, MSMFB_MIXER_INFO, &req) == -1) { + ALOGE("ERROR: MSMFB_MIXER_INFO ioctl failed"); + close(fd); + continue; + } + minfo = req.info; + for (int j = 0; j < req.cnt; j++) { + ALOGD("ndx=%d num=%d z_order=%d", minfo->pndx, minfo->pnum, + minfo->z_order); + // except the RGB base layer with z_order of -1, clear any + // other pipes connected to mixer. + if((minfo->z_order) != -1) { + int index = minfo->pndx; + ALOGD("Unset overlay with index: %d at mixer %d", index, i); + if(ioctl(fd, MSMFB_OVERLAY_UNSET, &index) == -1) { + ALOGE("ERROR: MSMFB_OVERLAY_UNSET failed"); + close(fd); + return -1; + } + } + minfo++; + } + close(fd); + fd = -1; + } + return 0; +} + //-------------------------------------------------------- //Refer to graphics.h, gralloc_priv.h, msm_mdp.h int getMdpFormat(int format) { diff --git a/liboverlay/overlayUtils.h b/liboverlay/overlayUtils.h index 50e6f14b1..afdef41e9 100644 --- a/liboverlay/overlayUtils.h +++ b/liboverlay/overlayUtils.h @@ -141,6 +141,11 @@ enum { INPUT_3D_MASK = 0xFFFF0000, enum { BARRIER_LAND = 1, BARRIER_PORT = 2 }; +/* if SurfaceFlinger process gets killed in bypass mode, In initOverlay() + * close all the pipes if it is opened after reboot. + */ +int initOverlay(void); + inline uint32_t format3D(uint32_t x) { return x & 0xFF000; } inline uint32_t colorFormat(uint32_t fmt) { /*TODO enable this block only if format has interlace / 3D info in top bits. |