diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gralloc/Android.mk | 4 | ||||
-rw-r--r-- | modules/gralloc/framebuffer.cpp | 37 | ||||
-rw-r--r-- | modules/gralloc/gralloc.cpp | 9 |
3 files changed, 49 insertions, 1 deletions
diff --git a/modules/gralloc/Android.mk b/modules/gralloc/Android.mk index 092e851..727c99a 100644 --- a/modules/gralloc/Android.mk +++ b/modules/gralloc/Android.mk @@ -33,4 +33,8 @@ ifeq ($(TARGET_USE_PAN_DISPLAY),true) LOCAL_CFLAGS += -DUSE_PAN_DISPLAY=1 endif +ifeq ($(TARGET_DEVICE),maguro) + LOCAL_CFLAGS += -DTARGET_DEVICE_MAGURO +endif + include $(BUILD_SHARED_LIBRARY) 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; diff --git a/modules/gralloc/gralloc.cpp b/modules/gralloc/gralloc.cpp index a9fbc80..892265c 100644 --- a/modules/gralloc/gralloc.cpp +++ b/modules/gralloc/gralloc.cpp @@ -230,6 +230,15 @@ static int gralloc_alloc(alloc_device_t* dev, int err; if (usage & GRALLOC_USAGE_HW_FB) { err = gralloc_alloc_framebuffer(dev, size, usage, pHandle); + +#ifdef TARGET_DEVICE_MAGURO + // PVR requires stride to be a multiple of 32 + // omap kernel drivers set line_length accordingly + // so we need to correct the stride here + // in case framebuffer width is not a multiple of 32 + stride += (31); + stride &= ~(31); +#endif } else { err = gralloc_alloc_buffer(dev, size, usage, pHandle); } |