diff options
-rw-r--r-- | modules/gralloc/framebuffer.cpp | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/modules/gralloc/framebuffer.cpp b/modules/gralloc/framebuffer.cpp index 486e27a..a75faf0 100644 --- a/modules/gralloc/framebuffer.cpp +++ b/modules/gralloc/framebuffer.cpp @@ -50,7 +50,7 @@ #endif // numbers of buffers for page flipping -#define NUM_BUFFERS 2 +#define NUM_BUFFERS 1 enum { @@ -139,6 +139,39 @@ static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer) /*****************************************************************************/ +void configFrameBuffer(int fd) +{ + struct fb_var_screeninfo info; + + if (ioctl(fd, FBIOGET_VSCREENINFO, &info) < 0) { + ALOGE("failed to get fb info"); + return; + } + + info.xoffset = 0; + info.yoffset = 0; + + info.xres_virtual = info.xres; + info.yres_virtual = info.yres; + + info.nonstd = 0; + + info.red.offset = 0; + info.red.length = 5; + info.green.offset = 5; + info.green.length = 6; + info.blue.offset = 11; + info.blue.length = 5; + info.transp.offset = 0; + info.transp.length = 0; + info.bits_per_pixel = 16; + + if (ioctl(fd, FBIOPUT_VSCREENINFO, &info) < 0) { + ALOGE("failed to put fb info"); + return; + } +} + int mapFrameBufferLocked(struct private_module_t* module) { // already initialized... @@ -163,6 +196,8 @@ int mapFrameBufferLocked(struct private_module_t* module) if (fd < 0) return -errno; + configFrameBuffer(fd); + struct fb_fix_screeninfo finfo; if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo) == -1) return -errno; |