summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2013-10-29 14:51:48 +0100
committerPaul Kocialkowski <contact@paulk.fr>2013-10-29 14:51:48 +0100
commit9e5b89e2de3eab473bcab0133c969493c42e5c11 (patch)
treec49474c2652d007455138127ae755d91f6267e5f
parentc41a16b2333418e0925b9b413fc4406e77954af4 (diff)
downloadhardware_libhardware-9e5b89e2de3eab473bcab0133c969493c42e5c11.zip
hardware_libhardware-9e5b89e2de3eab473bcab0133c969493c42e5c11.tar.gz
hardware_libhardware-9e5b89e2de3eab473bcab0133c969493c42e5c11.tar.bz2
gralloc: RGB565 framebuffer format
Change-Id: I17dcc28b8bb78a74f227d5e1edcf82e6f69ba242 Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rw-r--r--modules/gralloc/framebuffer.cpp37
1 files changed, 36 insertions, 1 deletions
diff --git a/modules/gralloc/framebuffer.cpp b/modules/gralloc/framebuffer.cpp
index 326f2ae..4de1145 100644
--- a/modules/gralloc/framebuffer.cpp
+++ b/modules/gralloc/framebuffer.cpp
@@ -43,7 +43,7 @@
/*****************************************************************************/
// numbers of buffers for page flipping
-#define NUM_BUFFERS 2
+#define NUM_BUFFERS 1
enum {
@@ -132,6 +132,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...
@@ -156,6 +189,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;