From 25b68b5c24e443c326af73a33cea6dc45e845254 Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Sun, 16 Jan 2011 19:52:22 +0100 Subject: [PATCH] gralloc: Add support for 32-bit framebuffers. Note: The code under hardware/libhardware/modules/gralloc/ is only used when running the system under the emulator. Change-Id: I022978aeaacc5137c9917cd2ef6952dd3897ece4 --- modules/gralloc/framebuffer.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/modules/gralloc/framebuffer.cpp b/modules/gralloc/framebuffer.cpp index 59c5001f..e1323c2f 100644 --- a/modules/gralloc/framebuffer.cpp +++ b/modules/gralloc/framebuffer.cpp @@ -176,19 +176,6 @@ int mapFrameBufferLocked(struct private_module_t* module) info.yoffset = 0; info.activate = FB_ACTIVATE_NOW; - /* - * Explicitly request 5/6/5 - */ - info.bits_per_pixel = 16; - info.red.offset = 11; - info.red.length = 5; - info.green.offset = 5; - info.green.length = 6; - info.blue.offset = 0; - info.blue.length = 5; - info.transp.offset = 0; - info.transp.length = 0; - /* * Request NUM_BUFFERS screens (at lest 2 for page flipping) */ @@ -352,11 +339,14 @@ int fb_device_open(hw_module_t const* module, const char* name, status = mapFrameBuffer(m); if (status >= 0) { int stride = m->finfo.line_length / (m->info.bits_per_pixel >> 3); + int format = (m->info.bits_per_pixel == 32) + ? HAL_PIXEL_FORMAT_RGBX_8888 + : HAL_PIXEL_FORMAT_RGB_565; const_cast(dev->device.flags) = 0; const_cast(dev->device.width) = m->info.xres; const_cast(dev->device.height) = m->info.yres; const_cast(dev->device.stride) = stride; - const_cast(dev->device.format) = HAL_PIXEL_FORMAT_RGB_565; + const_cast(dev->device.format) = format; const_cast(dev->device.xdpi) = m->xdpi; const_cast(dev->device.ydpi) = m->ydpi; const_cast(dev->device.fps) = m->fps;