summaryrefslogtreecommitdiff
authorStark Li <stark.li@amlogic.com>2016-06-14 06:23:54 (GMT)
committer Stark Li <stark.li@amlogic.com>2016-06-14 06:23:54 (GMT)
commitc70094739d784cd76eb545cbe0a8a53f19db0585 (patch)
tree8193d7e218696cf072bcf84745876304dce30eee
parent20baf518052aded034ae72e02d68fc91af5e87be (diff)
downloadgralloc-c70094739d784cd76eb545cbe0a8a53f19db0585.zip
gralloc-c70094739d784cd76eb545cbe0a8a53f19db0585.tar.gz
gralloc-c70094739d784cd76eb545cbe0a8a53f19db0585.tar.bz2
PD#126822: fix autoreboot crash on weston platform
Change-Id: Ie0467d73deeed580d98275c3d94948e8fc2dfb8c
Diffstat
-rw-r--r--framebuffer.cpp20
-rw-r--r--framebuffer_device.cpp19
2 files changed, 20 insertions, 19 deletions
diff --git a/framebuffer.cpp b/framebuffer.cpp
index c081343..c003d8f 100644
--- a/framebuffer.cpp
+++ b/framebuffer.cpp
@@ -67,6 +67,20 @@ int bits_per_pixel()
return 16;
}
+#define OSD_AFBCD "/sys/class/graphics/fb0/osd_afbcd"
+
+static void write_sys_int(const char *path, int val)
+{
+ char cmd[16];
+ int fd = open(path, O_RDWR);
+
+ if (fd >= 0) {
+ sprintf(cmd, "%d", val);
+ write(fd, cmd, strlen(cmd));
+ close(fd);
+ }
+}
+
bool osd_afbcd_enable()
{
char osd_afbcd[PROPERTY_VALUE_MAX];
@@ -302,6 +316,12 @@ int init_frame_buffer_locked(struct framebuffer_info_t* fbinfo)
int i = 0;
char name[64];
+ if (osd_afbcd_enable()) {
+ write_sys_int(OSD_AFBCD, 1);
+ } else {
+ write_sys_int(OSD_AFBCD, 0);
+ }
+
while ((fd == -1) && device_template[i])
{
snprintf(name, 64, device_template[i], fbinfo->fbIdx);
diff --git a/framebuffer_device.cpp b/framebuffer_device.cpp
index 25f794f..045dcc6 100644
--- a/framebuffer_device.cpp
+++ b/framebuffer_device.cpp
@@ -37,20 +37,6 @@
#include "gralloc_helper.h"
#include "gralloc_vsync.h"
-#define OSD_AFBCD "/sys/class/graphics/fb0/osd_afbcd"
-
-static void write_sys_int(const char *path, int val)
-{
- char cmd[16];
- int fd = open(path, O_RDWR);
-
- if (fd >= 0) {
- sprintf(cmd, "%d", val);
- write(fd, cmd, strlen(cmd));
- close(fd);
- }
-}
-
static int fb_set_swap_interval(struct framebuffer_device_t* dev, int interval)
{
if (interval < dev->minSwapInterval)
@@ -249,11 +235,6 @@ int framebuffer_device_open(hw_module_t const* module, const char* name, hw_devi
return -ENODEV;
#endif
- if (osd_afbcd_enable()) {
- write_sys_int(OSD_AFBCD, 1);
- } else {
- write_sys_int(OSD_AFBCD, 0);
- }
#if PLATFORM_SDK_VERSION > 22
/* malloc is used instead of 'new' to instantiate the struct framebuffer_device_t
* C++11 spec specifies that if a class/struct has a const member,default constructor