From f70bcf58e675cd2b6bf81dd3d51ed017e51c2b00 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Tue, 29 Oct 2013 14:51:48 +0100 Subject: gralloc: RGB565 framebuffer format Change-Id: I17dcc28b8bb78a74f227d5e1edcf82e6f69ba242 Signed-off-by: Paul Kocialkowski --- modules/gralloc/framebuffer.cpp | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) 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; -- cgit v1.1