summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2013-10-29 14:51:48 +0100
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2015-12-15 15:16:07 +0100
commitf70bcf58e675cd2b6bf81dd3d51ed017e51c2b00 (patch)
tree0ee1289e86f7dcc87441aa661d945050edf2b517
parentc20f2cc6ed871459a6e0b4ebbeaeffb7675290b3 (diff)
downloadhardware_libhardware-f70bcf58e675cd2b6bf81dd3d51ed017e51c2b00.zip
hardware_libhardware-f70bcf58e675cd2b6bf81dd3d51ed017e51c2b00.tar.gz
hardware_libhardware-f70bcf58e675cd2b6bf81dd3d51ed017e51c2b00.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 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;