Bug 828731 - Wait for the framebuffer to become ready before trying to open it. r=mwu

This commit is contained in:
Dave Hylands 2013-01-25 17:31:46 -08:00
parent b9f919744f
commit e8edc81a2c

View File

@ -24,8 +24,9 @@
#include <sys/mman.h>
#include <sys/stat.h>
#include <vector>
#include "mozilla/Util.h"
#include "mozilla/FileUtils.h"
#include "mozilla/NullPtr.h"
#include "mozilla/Util.h"
#include "png.h"
#include "android/log.h"
@ -628,6 +629,21 @@ NativeWindow()
// statements.
set_screen_state(1);
// For some devices, it takes a while for the framebuffer to become
// usable. So we wait until the framebuffer has woken up before we
// try to open it.
{
char buf;
int len = 0;
ScopedClose fd(open("/sys/power/wait_for_fb_wake", O_RDONLY, 0));
do {
len = read(fd.get(), &buf, 1);
} while (len < 0 && errno == EINTR);
if (len < 0) {
LOGE("BootAnimation: wait_for_fb_sleep failed errno: %d", errno);
}
}
// We (apparently) don't have a way to tell if allocating the
// fbs succeeded or failed.
gNativeWindow = new FramebufferNativeWindow();