OSDN Git Service

gralloc: let target configure page flipping ioctl
authorBernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
Tue, 25 Feb 2014 08:20:34 +0000 (13:50 +0530)
committerAmit Pundir <amit.pundir@linaro.org>
Mon, 2 Jun 2014 12:11:36 +0000 (17:41 +0530)
Let vendor choose which framebuffer ioctl (FBIOPUT_VSCREENINFO or
FBIOPAN_DISPLAY) is best suited to do page-flip on its target platform.
Neither API is well documented about their usage and most of the
time it really depends on the respective framebuffer driver implementation.

* Default ioctl to do page-flip is FBIOPUT_VSCREENINFO.
* Set "TARGET_USE_PAN_DISPLAY=true" in board config file to use FBIOPAN_DISPLAY.

Change-Id: Ic3a50bd0f5fe37ac0149e11649c4abdadea85529
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
modules/gralloc/Android.mk
modules/gralloc/framebuffer.cpp

index a4ffd20..092e851 100644 (file)
@@ -29,5 +29,8 @@ LOCAL_SRC_FILES :=    \
 
 LOCAL_MODULE := gralloc.default
 LOCAL_CFLAGS:= -DLOG_TAG=\"gralloc\" -Wno-missing-field-initializers
+ifeq ($(TARGET_USE_PAN_DISPLAY),true)
+LOCAL_CFLAGS += -DUSE_PAN_DISPLAY=1
+endif
 
 include $(BUILD_SHARED_LIBRARY)
index 9d8513a..486e27a 100644 (file)
 
 /*****************************************************************************/
 
+// Set TARGET_USE_PAN_DISPLAY to true at compile time if the
+// board uses FBIOPAN_DISPLAY to setup page flipping, otherwise
+// default ioctl to do page-flipping is FBIOPUT_VSCREENINFO.
+#ifndef USE_PAN_DISPLAY
+#define USE_PAN_DISPLAY 0
+#endif
+
 // numbers of buffers for page flipping
 #define NUM_BUFFERS 2
 
@@ -178,10 +185,15 @@ int mapFrameBufferLocked(struct private_module_t* module)
 
 
     uint32_t flags = PAGE_FLIP;
+#if USE_PAN_DISPLAY
+    if (ioctl(fd, FBIOPAN_DISPLAY, &info) == -1) {
+        ALOGW("FBIOPAN_DISPLAY failed, page flipping not supported");
+#else
     if (ioctl(fd, FBIOPUT_VSCREENINFO, &info) == -1) {
+        ALOGW("FBIOPUT_VSCREENINFO failed, page flipping not supported");
+#endif
         info.yres_virtual = info.yres;
         flags &= ~PAGE_FLIP;
-        ALOGW("FBIOPUT_VSCREENINFO failed, page flipping not supported");
     }
 
     if (info.yres_virtual < info.yres * 2) {