summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2013-10-29 14:51:48 +0100
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2019-07-22 00:13:33 +0200
commit3e9160f602fb2a819a046ecb5e1320369e2a7b7e (patch)
tree2da9f93706b47420fe7a4be6c36133a3ddfe289c
parent35627b0cf253faa03b5f7e3980ae422325cc22f4 (diff)
downloadhardware_libhardware-3e9160f602fb2a819a046ecb5e1320369e2a7b7e.tar.gz
hardware_libhardware-3e9160f602fb2a819a046ecb5e1320369e2a7b7e.tar.bz2
hardware_libhardware-3e9160f602fb2a819a046ecb5e1320369e2a7b7e.zip
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;