Patchwork [meta-fsl-arm,10/15] xf86-video-imxfb-vivante: Upgrade to 3.5.7-1.0.0

login
register
mail settings
Submitter Otavio Salvador
Date July 23, 2013, 6:43 p.m.
Message ID <1374605026-7933-11-git-send-email-otavio@ossystems.com.br>
Download mbox | patch
Permalink /patch/54239/
State Superseded
Delegated to: Otavio Salvador
Headers show

Comments

Otavio Salvador - July 23, 2013, 6:43 p.m.
The new Xorg driver does not need a DRI library anymore, so we remove
the xf86-dri-vivante recipe, but use the DRI code during the Xorg GPU
driver build.

This change has been based on changes done in meta-fsl-bsp-release,
3.5.7 dylan branch, by Lauren Post <lauren.post@freescale.com> and
Evan Kotara <evan.kotara@freescale.com>.

Change-Id: I3f666da817fb158b201dc169ae7862b199216ddd
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 conf/machine/include/imx-base.inc                  |   2 -
 .../xf86-dri-vivante/fix-libdrm-link.patch         |  33 --
 .../xorg-driver/xf86-dri-vivante_3.0.35-4.0.0.bb   |  48 ---
 .../Makefile-fix-cross-compile.patch               |  23 ++
 .../Port-Xorg-driver-to-new-Xorg-API.patch         | 407 +++++++++++++++++++++
 ...on-t-force-things-decided-by-build-system.patch |  82 +++++
 .../xf86-video-imxfb-vivante_3.0.35-4.0.0.bb       |  54 ---
 .../xf86-video-imxfb-vivante_3.5.7-1.0.0.bb        |  58 +++
 8 files changed, 570 insertions(+), 137 deletions(-)
 delete mode 100644 recipes-graphics/xorg-driver/xf86-dri-vivante/fix-libdrm-link.patch
 delete mode 100644 recipes-graphics/xorg-driver/xf86-dri-vivante_3.0.35-4.0.0.bb
 create mode 100644 recipes-graphics/xorg-driver/xf86-video-imxfb-vivante/Makefile-fix-cross-compile.patch
 create mode 100644 recipes-graphics/xorg-driver/xf86-video-imxfb-vivante/Port-Xorg-driver-to-new-Xorg-API.patch
 create mode 100644 recipes-graphics/xorg-driver/xf86-video-imxfb-vivante/build-Don-t-force-things-decided-by-build-system.patch
 delete mode 100644 recipes-graphics/xorg-driver/xf86-video-imxfb-vivante_3.0.35-4.0.0.bb
 create mode 100644 recipes-graphics/xorg-driver/xf86-video-imxfb-vivante_3.5.7-1.0.0.bb

Patch

diff --git a/conf/machine/include/imx-base.inc b/conf/machine/include/imx-base.inc
index cb58208..5c72855 100644
--- a/conf/machine/include/imx-base.inc
+++ b/conf/machine/include/imx-base.inc
@@ -20,8 +20,6 @@  UBOOT_ENTRYPOINT_mx6  = "0x10008000"
 UBOOT_ENTRYPOINT_mx6sl = "0x80008000"
 UBOOT_ENTRYPOINT_vf60 = "0x80008000"
 
-PREFERRED_VERSION_xserver-xorg_mx6 = "2:1.11.4"
-
 XSERVER_DRIVER = "xf86-video-fbdev"
 XSERVER_DRIVER_mx5 = "xf86-video-imxfb"
 XSERVER_DRIVER_mx6 = "xf86-video-imxfb-vivante"
diff --git a/recipes-graphics/xorg-driver/xf86-dri-vivante/fix-libdrm-link.patch b/recipes-graphics/xorg-driver/xf86-dri-vivante/fix-libdrm-link.patch
deleted file mode 100644
index fe3e610..0000000
--- a/recipes-graphics/xorg-driver/xf86-dri-vivante/fix-libdrm-link.patch
+++ /dev/null
@@ -1,33 +0,0 @@ 
-This adds a missing link dependency on libdrm
-
-Upstream-Status: Pending
-Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
-
-Index: DRI_1.10.4/configure.ac
-===================================================================
---- DRI_1.10.4.orig/configure.ac
-+++ DRI_1.10.4/configure.ac
-@@ -55,6 +55,7 @@ XORG_DRIVER_CHECK_EXT(XV, videoproto)
- 
- # Checks for pkg-config packages
- PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_MODULES])
-+PKG_CHECK_MODULES(LIBDRM, [libdrm >= 2.3.0])
- sdkdir=$(pkg-config --variable=sdkdir xorg-server)
- 
- # Checks for libraries.
-Index: DRI_1.10.4/src/Makefile.am
-===================================================================
---- DRI_1.10.4.orig/src/Makefile.am
-+++ DRI_1.10.4/src/Makefile.am
-@@ -11,9 +11,9 @@
- ##############################################################################
- 
- 
--AM_CFLAGS = @XORG_CFLAGS@
-+AM_CFLAGS = @XORG_CFLAGS@ @LIBDRM_CFLAGS@
- libdri_la_LTLIBRARIES = libdri.la
--libdri_la_LDFLAGS = -module -avoid-version
-+libdri_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@
- libdri_ladir = @moduledir@/extensions
- libdri_la_SOURCES = \
- 	dri.c \
diff --git a/recipes-graphics/xorg-driver/xf86-dri-vivante_3.0.35-4.0.0.bb b/recipes-graphics/xorg-driver/xf86-dri-vivante_3.0.35-4.0.0.bb
deleted file mode 100644
index c116d57..0000000
--- a/recipes-graphics/xorg-driver/xf86-dri-vivante_3.0.35-4.0.0.bb
+++ /dev/null
@@ -1,48 +0,0 @@ 
-# Copyright (C) 2012-2013 Freescale Semiconductor
-# Copyright (C) 2012-2013 O.S. Systems Software LTDA.
-# Released under the MIT license (see COPYING.MIT for the terms)
-
-LICENSE = "MIT"
-SECTION = "x11/base"
-DEPENDS = "virtual/xserver xf86-video-imxfb-vivante"
-LIC_FILES_CHKSUM = "file://src/dri.h;enline=27;md5=1d0d59e1dc96f5197ea3a8b101bf1fcc"
-
-SRC_URI = "${FSL_MIRROR}/xserver-xorg-video-imx-viv-${PV}.tar.gz \
-           file://fix-libdrm-link.patch"
-SRC_URI[md5sum] = "5c5b5be029b077346610518bb729c012"
-SRC_URI[sha256sum] = "c67249e68d4233eb1d0a5f337ded8f121dc61fa26fca102a00f93acc3e37ea0f"
-
-PE = "1"
-PR = "r0"
-
-S = "${WORKDIR}/xserver-xorg-video-imx-viv-${PV}/DRI_1.10.4"
-
-inherit fsl-eula-unpack autotools pkgconfig
-
-EXTRA_OECONF_armv7a = " --enable-neon "
-CFLAGS += " -I${STAGING_INCDIR}/xorg -DXSERVER_LIBPCIACCESS"
-
-do_install_append () {
-    # Install header files
-    install -d ${D}${includedir}/xorg
-    cp -axr ${S}/src/*.h ${D}${includedir}/xorg
-    find ${D}${includedir} -type f -exec chmod 660 {} \;
-
-    # FIXME: don't install libtool (*.la) file
-    rm ${D}${libdir}/xorg/modules/extensions/*.la
-
-    # FIXME: The Xorg driver has a hardcoded library name
-    mv ${D}${libdir}/xorg/modules/extensions/libdri.so \
-       ${D}${libdir}/xorg/modules/extensions/libvivante_dri.so
-}
-
-FILES_${PN}-dev += "${includedir}/xorg/*.h"
-FILES_${PN} += " ${libdir}/xorg/modules/extensions/*.so"
-FILES_${PN}-dbg += " ${libdir}/xorg/modules/extensions/.debug"
-
-RDEPENDS_${PN} += "xserver-xorg-extension-glx \
-                   xserver-xorg-extension-dri \
-                   xserver-xorg-extension-dri2"
-
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-COMPATIBLE_MACHINE = "(mx6)"
diff --git a/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante/Makefile-fix-cross-compile.patch b/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante/Makefile-fix-cross-compile.patch
new file mode 100644
index 0000000..ce3a9ae
--- /dev/null
+++ b/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante/Makefile-fix-cross-compile.patch
@@ -0,0 +1,23 @@ 
+diff --git a/EXA/src/makefile.linux b/EXA/src/makefile.linux
+index 12cb8f3..005b002 100644
+--- a/EXA/src/makefile.linux
++++ b/EXA/src/makefile.linux
+@@ -1,9 +1,6 @@
+ 
+ .PHONY: all clean install
+ 
+-CC  := $(CROSS_COMPILE)gcc
+-LD  := $(CROSS_COMPILE)gcc
+-
+ target := vivante_drv.so
+ 
+ OBJS := vivante_gal/vivante_gal_blit.o \
+@@ -63,7 +60,7 @@ LFLAGS += -L$(sysroot)/usr/lib -lm -ldl -lGAL -Wl,-soname -Wl,vivante_drv.so
+ all: $(target)
+ 
+ $(target): $(OBJS)
+-	$(LD) -shared -fPIC -o $(target) $(OBJS) $(LFLAGS)
++	$(CC) -shared -fPIC -o $(target) $(OBJS) $(LFLAGS)
+ 
+ clean:
+ 	-@rm $(target) $(OBJS)
diff --git a/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante/Port-Xorg-driver-to-new-Xorg-API.patch b/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante/Port-Xorg-driver-to-new-Xorg-API.patch
new file mode 100644
index 0000000..8560f47
--- /dev/null
+++ b/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante/Port-Xorg-driver-to-new-Xorg-API.patch
@@ -0,0 +1,407 @@ 
+From abab0931d4d4db84fb8ef1707d4dcaae303c13cd Mon Sep 17 00:00:00 2001
+From: Otavio Salvador <otavio@ossystems.com.br>
+Date: Sun, 21 Jul 2013 01:40:47 -0300
+Subject: [PATCH] Port Xorg driver to new Xorg API
+
+Upstream-Status: Pending
+
+Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
+---
+ EXA/src/vivante_fbdev/vivante.h              |   6 +-
+ EXA/src/vivante_fbdev/vivante_dri.c          |   6 +-
+ EXA/src/vivante_fbdev/vivante_dri.h          |   2 +-
+ EXA/src/vivante_fbdev/vivante_fbdev_driver.c |  57 ++++++--------
+ EXA/src/vivante_util/compat-api.h            | 106 +++++++++++++++++++++++++++
+ EXA/src/vivante_util/vivante_common.h        |   3 +
+ 6 files changed, 140 insertions(+), 40 deletions(-)
+ create mode 100644 EXA/src/vivante_util/compat-api.h
+
+diff --git a/EXA/src/vivante_fbdev/vivante.h b/EXA/src/vivante_fbdev/vivante.h
+index 8eb384b..39d9400 100644
+--- a/EXA/src/vivante_fbdev/vivante.h
++++ b/EXA/src/vivante_fbdev/vivante.h
+@@ -93,11 +93,11 @@ extern "C" {
+ #define GET_VIV_PTR(p) ((VivPtr)((p)->driverPrivate))
+ 
+ #define VIVPTR_FROM_PIXMAP(x)        \
+-        GET_VIV_PTR(xf86Screens[(x)->drawable.pScreen->myNum])
++        GET_VIV_PTR(xf86ScreenToScrn((x)->drawable.pScreen))
+ #define VIVPTR_FROM_SCREEN(x)        \
+-        GET_VIV_PTR(xf86Screens[(x)->myNum])
++        GET_VIV_PTR(xf86ScreenToScrn((x)))
+ #define VIVPTR_FROM_PICTURE(x)    \
+-        GET_VIV_PTR(xf86Screens[(x)->pDrawable->pScreen->myNum])
++        GET_VIV_PTR(xf86ScreenToScrn((x)->pDrawable->pScreen))
+ 
+     /********************************************************************************
+      *
+diff --git a/EXA/src/vivante_fbdev/vivante_dri.c b/EXA/src/vivante_fbdev/vivante_dri.c
+index 473f107..efc08c9 100644
+--- a/EXA/src/vivante_fbdev/vivante_dri.c
++++ b/EXA/src/vivante_fbdev/vivante_dri.c
+@@ -50,7 +50,7 @@ VivDestroyContext(ScreenPtr pScreen, drm_context_t hwContext,
+ 
+ Bool
+ VivDRIFinishScreenInit(ScreenPtr pScreen) {
+-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
++    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+     VivPtr pViv = GET_VIV_PTR(pScrn);
+     DRIInfoPtr pDRIInfo = (DRIInfoPtr) pViv->pDRIInfo;
+ 
+@@ -80,7 +80,7 @@ VivDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
+ }
+ 
+ Bool VivDRIScreenInit(ScreenPtr pScreen) {
+-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
++    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+     DRIInfoPtr pDRIInfo;
+     VivPtr pViv = GET_VIV_PTR(pScrn);
+ 
+@@ -190,7 +190,7 @@ Bool VivDRIScreenInit(ScreenPtr pScreen) {
+ }
+ 
+ void VivDRICloseScreen(ScreenPtr pScreen) {
+-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
++    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+     VivPtr pViv = GET_VIV_PTR(pScrn);
+ 
+     if (pViv->pDRIInfo) {
+diff --git a/EXA/src/vivante_fbdev/vivante_dri.h b/EXA/src/vivante_fbdev/vivante_dri.h
+index 6cd371e..8f9245c 100644
+--- a/EXA/src/vivante_fbdev/vivante_dri.h
++++ b/EXA/src/vivante_fbdev/vivante_dri.h
+@@ -67,7 +67,7 @@ typedef struct _vvtDeviceInfoRec {
+ } vvtDeviceInfo;
+ 
+ Bool VivDRIScreenInit(ScreenPtr pScreen);
+-void VivDRICloseScreen(ScreenPtr pScreen);
++void VivDRICloseScreen(CLOSE_SCREEN_ARGS_DECL);
+ Bool VivDRIFinishScreenInit(ScreenPtr pScreen);
+ 
+ #endif /* _VIVANTE_DRI_H_ */
+diff --git a/EXA/src/vivante_fbdev/vivante_fbdev_driver.c b/EXA/src/vivante_fbdev/vivante_fbdev_driver.c
+index 548a5fb..ac3eb3c 100644
+--- a/EXA/src/vivante_fbdev/vivante_fbdev_driver.c
++++ b/EXA/src/vivante_fbdev/vivante_fbdev_driver.c
+@@ -59,9 +59,8 @@ static const OptionInfoRec *VivAvailableOptions(int chipid, int busid);
+ static void VivIdentify(int flags);
+ static Bool VivProbe(DriverPtr drv, int flags);
+ static Bool VivPreInit(ScrnInfoPtr pScrn, int flags);
+-static Bool VivScreenInit(int Index, ScreenPtr pScreen, int argc,
+-        char **argv);
+-static Bool VivCloseScreen(int scrnIndex, ScreenPtr pScreen);
++static Bool VivScreenInit(SCREEN_INIT_ARGS_DECL);
++static Bool VivCloseScreen(CLOSE_SCREEN_ARGS_DECL);
+ static Bool VivDriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op,
+         pointer ptr);
+ 
+@@ -197,7 +196,7 @@ VivSetup(pointer module, pointer opts, int *errmaj, int *errmin) {
+ 
+ static Bool InitExaLayer(ScreenPtr pScreen) {
+     ExaDriverPtr pExa;
+-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
++    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+     VivPtr pViv = GET_VIV_PTR(pScrn);
+ 
+     TRACE_ENTER();
+@@ -280,7 +279,7 @@ static Bool InitExaLayer(ScreenPtr pScreen) {
+ }
+ 
+ static Bool DestroyExaLayer(ScreenPtr pScreen) {
+-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
++    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+     VivPtr pViv = GET_VIV_PTR(pScrn);
+     TRACE_ENTER();
+     xf86DrvMsg(pScreen->myNum, X_INFO, "Shutdown EXA\n");
+@@ -594,7 +593,7 @@ VivPreInit(ScrnInfoPtr pScrn, int flags) {
+ static Bool
+ VivCreateScreenResources(ScreenPtr pScreen) {
+     PixmapPtr pPixmap;
+-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
++    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+     VivPtr fPtr = GET_VIV_PTR(pScrn);
+     Bool ret;
+ 
+@@ -616,8 +615,8 @@ VivCreateScreenResources(ScreenPtr pScreen) {
+ }
+ 
+ static Bool
+-VivScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
+-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
++VivScreenInit(SCREEN_INIT_ARGS_DECL) {
++    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+     VivPtr fPtr = GET_VIV_PTR(pScrn);
+     VisualPtr visual;
+     int init_picture = 0;
+@@ -637,7 +636,7 @@ VivScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
+ 
+     /*Mapping the Video memory*/
+     if (NULL == (fPtr->mFB.mFBMemory = fbdevHWMapVidmem(pScrn))) {
+-        xf86DrvMsg(scrnIndex, X_ERROR, "mapping of video memory"
++        xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "mapping of video memory"
+                 " failed\n");
+         TRACE_EXIT(FALSE);
+     }
+@@ -652,21 +651,17 @@ VivScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
+ 
+     /*Init the hardware in current mode*/
+     if (!fbdevHWModeInit(pScrn, pScrn->currentMode)) {
+-        xf86DrvMsg(scrnIndex, X_ERROR, "mode initialization failed\n");
++        xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "mode initialization failed\n");
+         TRACE_EXIT(FALSE);
+     }
+     fbdevHWSaveScreen(pScreen, SCREEN_SAVER_ON);
+-#if defined(NEW_FBDEV_API)
+-    fbdevHWAdjustFrame(scrnIndex, 0, 0);
+-#else
+-    fbdevHWAdjustFrame(scrnIndex, 0, 0, 0);
+-#endif
++    fbdevHWAdjustFrame(FBDEVHWADJUSTFRAME_ARGS(0, 0));
+ 
+     /* mi layer */
+     miClearVisualTypes();
+     if (pScrn->bitsPerPixel > 8) {
+         if (!miSetVisualTypes(pScrn->depth, TrueColorMask, pScrn->rgbBits, TrueColor)) {
+-            xf86DrvMsg(scrnIndex, X_ERROR, "visual type setup failed"
++            xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "visual type setup failed"
+                     " for %d bits per pixel [1]\n",
+                     pScrn->bitsPerPixel);
+             TRACE_EXIT(FALSE);
+@@ -675,14 +670,14 @@ VivScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
+         if (!miSetVisualTypes(pScrn->depth,
+                 miGetDefaultVisualMask(pScrn->depth),
+                 pScrn->rgbBits, pScrn->defaultVisual)) {
+-            xf86DrvMsg(scrnIndex, X_ERROR, "visual type setup failed"
++            xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "visual type setup failed"
+                     " for %d bits per pixel [2]\n",
+                     pScrn->bitsPerPixel);
+             TRACE_EXIT(FALSE);
+         }
+     }
+     if (!miSetPixmapDepths()) {
+-        xf86DrvMsg(scrnIndex, X_ERROR, "pixmap depth setup failed\n");
++        xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "pixmap depth setup failed\n");
+         return FALSE;
+     }
+ 
+@@ -690,14 +685,14 @@ VivScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
+     pScrn->displayWidth = fbdevHWGetLineLength(pScrn) /
+             (pScrn->bitsPerPixel / 8);
+     if (pScrn->displayWidth != pScrn->virtualX) {
+-        xf86DrvMsg(scrnIndex, X_INFO,
++        xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                 "Pitch updated to %d after ModeInit\n",
+                 pScrn->displayWidth);
+     }
+     /*Logical start address*/
+     fPtr->mFB.mFBStart = fPtr->mFB.mFBMemory + fPtr->mFB.mFBOffset;
+ 
+-    xf86DrvMsg(scrnIndex, X_INFO,
++    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+             "FB Start = %p  FB Base = %p  FB Offset = %p\n",
+             fPtr->mFB.mFBStart, fPtr->mFB.mFBMemory, fPtr->mFB.mFBOffset);
+ 
+@@ -714,7 +709,7 @@ VivScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
+             init_picture = 1;
+             break;
+         default:
+-            xf86DrvMsg(scrnIndex, X_ERROR,
++            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                     "internal error: invalid number of bits per"
+                     " pixel (%d) encountered in"
+                     " VivScreenInit()\n", pScrn->bitsPerPixel);
+@@ -746,14 +741,14 @@ VivScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
+     if (fPtr->mFakeExa.mUseExaFlag) {
+         TRACE_INFO("Loading EXA");
+         if (!InitExaLayer(pScreen)) {
+-            xf86DrvMsg(scrnIndex, X_ERROR,
++            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                     "internal error: initExaLayer failed "
+                     "in VivScreenInit()\n");
+         }
+     }
+ 
+     xf86SetBlackWhitePixels(pScreen);
+-    miInitializeBackingStore(pScreen);
++    /*miInitializeBackingStore(pScreen);*/
+     xf86SetBackingStore(pScreen);
+ 
+     pScrn->vtSema = TRUE;
+@@ -763,7 +758,7 @@ VivScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
+ 
+     /* colormap */
+     if (!miCreateDefColormap(pScreen)) {
+-        xf86DrvMsg(scrnIndex, X_ERROR,
++        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                 "internal error: miCreateDefColormap failed "
+                 "in VivScreenInit()\n");
+         TRACE_EXIT(FALSE);
+@@ -805,8 +800,8 @@ VivScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
+ }
+ 
+ static Bool
+-VivCloseScreen(int scrnIndex, ScreenPtr pScreen) {
+-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
++VivCloseScreen(CLOSE_SCREEN_ARGS_DECL) {
++    CLOSE_SCREEN_DECL_ScrnInfoPtr;
+     VivPtr fPtr = GET_VIV_PTR(pScrn);
+     Bool ret = FALSE;
+     TRACE_ENTER();
+@@ -815,13 +810,13 @@ VivCloseScreen(int scrnIndex, ScreenPtr pScreen) {
+     freePixmapQueue();
+ 
+ #ifndef DISABLE_VIVANTE_DRI
+-    VivDRICloseScreen(pScreen);
++    VivDRICloseScreen(CLOSE_SCREEN_ARGS);
+ #endif
+ 
+     if (fPtr->mFakeExa.mUseExaFlag) {
+         LOG("UnLoading EXA");
+         if (fPtr->mFakeExa.mIsInited && !DestroyExaLayer(pScreen)) {
+-            xf86DrvMsg(scrnIndex, X_ERROR,
++            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                     "internal error: DestroyExaLayer failed "
+                     "in VivCloseScreen()\n");
+         }
+@@ -836,11 +831,7 @@ VivCloseScreen(int scrnIndex, ScreenPtr pScreen) {
+ 
+     pScreen->CreateScreenResources = fPtr->CreateScreenResources;
+     pScreen->CloseScreen = fPtr->CloseScreen;
+-#if defined(NEW_FBDEV_API)
+-    ret = (*pScreen->CloseScreen)(pScreen);
+-#else
+-    ret = (*pScreen->CloseScreen)(scrnIndex, pScreen);
+-#endif
++    ret = (*pScreen->CloseScreen)(CLOSE_SCREEN_ARGS);
+     TRACE_EXIT(ret);
+ }
+ 
+diff --git a/EXA/src/vivante_util/compat-api.h b/EXA/src/vivante_util/compat-api.h
+new file mode 100644
+index 0000000..73ac8a2
+--- /dev/null
++++ b/EXA/src/vivante_util/compat-api.h
+@@ -0,0 +1,106 @@
++/*
++ * Copyright 2012 Red Hat, Inc.
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining a
++ * copy of this software and associated documentation files (the "Software"),
++ * to deal in the Software without restriction, including without limitation
++ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
++ * and/or sell copies of the Software, and to permit persons to whom the
++ * Software is furnished to do so, subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice (including the next
++ * paragraph) shall be included in all copies or substantial portions of the
++ * Software.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
++ * DEALINGS IN THE SOFTWARE.
++ *
++ * Author: Dave Airlie <airlied@redhat.com>
++ */
++
++/* this file provides API compat between server post 1.13 and pre it,
++   it should be reused inside as many drivers as possible */
++#ifndef COMPAT_API_H
++#define COMPAT_API_H
++
++#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR
++#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum]
++#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p
++#endif
++
++#ifndef XF86_HAS_SCRN_CONV
++#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum]
++#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex]
++#endif
++
++#ifndef XF86_SCRN_INTERFACE
++
++#define SCRN_ARG_TYPE int
++#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = xf86Screens[(arg1)]
++
++#define SCREEN_ARG_TYPE int
++#define SCREEN_PTR(arg1) ScreenPtr pScreen = screenInfo.screens[(arg1)]
++
++#define SCREEN_INIT_ARGS_DECL int index, ScreenPtr pScreen, int argc, char **argv
++
++#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask
++#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask
++
++#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen
++#define CLOSE_SCREEN_ARGS scrnIndex, pScreen
++#define CLOSE_SCREEN_DECL_ScrnInfoPtr ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
++
++#define FBDEVHWADJUSTFRAME_ARGS(x, y) scrnIndex, (x), (y), 0
++
++#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags
++
++#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags
++
++#define FREE_SCREEN_ARGS_DECL int arg, int flags
++#define FREE_SCREEN_ARGS(x) (x)->scrnIndex, 0
++
++#define VT_FUNC_ARGS_DECL int arg, int flags
++#define VT_FUNC_ARGS(flags) pScrn->scrnIndex, (flags)
++
++#define ENABLE_DISABLE_FB_ACCESS_ARGS(pScrn, b) pScrn->scrnIndex, b
++
++#define XF86_ENABLEDISABLEFB_ARG(x) ((x)->scrnIndex)
++#else
++#define SCRN_ARG_TYPE ScrnInfoPtr
++#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = (arg1)
++
++#define SCREEN_ARG_TYPE ScreenPtr
++#define SCREEN_PTR(arg1) ScreenPtr pScreen = (arg1)
++
++#define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv
++
++#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask
++#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask
++
++#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen
++#define CLOSE_SCREEN_ARGS pScreen
++#define CLOSE_SCREEN_DECL_ScrnInfoPtr ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
++
++#define FBDEVHWADJUSTFRAME_ARGS(x, y) pScrn, (x), (y)
++
++#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y
++#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode
++
++#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg
++#define FREE_SCREEN_ARGS(x) (x)
++
++#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
++#define VT_FUNC_ARGS(flags) pScrn
++
++#define ENABLE_DISABLE_FB_ACCESS_ARGS(pScrn, b) pScrn, b
++
++#define XF86_ENABLEDISABLEFB_ARG(x) (x)
++
++#endif
++
++#endif
+diff --git a/EXA/src/vivante_util/vivante_common.h b/EXA/src/vivante_util/vivante_common.h
+index f84672c..07054b9 100644
+--- a/EXA/src/vivante_util/vivante_common.h
++++ b/EXA/src/vivante_util/vivante_common.h
+@@ -69,6 +69,9 @@ extern "C" {
+ #include "xf86Crtc.h"
+ #include "cursorstr.h"
+ 
++    /* System API compatability */
++#include "compat-api.h"
++
+     /*Debug*/
+ #include "vivante_debug.h"
+ 
+-- 
+1.8.3.2
+
diff --git a/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante/build-Don-t-force-things-decided-by-build-system.patch b/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante/build-Don-t-force-things-decided-by-build-system.patch
new file mode 100644
index 0000000..5fda33c
--- /dev/null
+++ b/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante/build-Don-t-force-things-decided-by-build-system.patch
@@ -0,0 +1,82 @@ 
+From bc46bc886c79246065cf779a7b4e197b80acd9b1 Mon Sep 17 00:00:00 2001
+From: Otavio Salvador <otavio@ossystems.com.br>
+Date: Thu, 18 Jul 2013 19:52:11 -0300
+Subject: [PATCH] build: Don't force things decided by build system
+
+The build system should't enforce build flags and linking flags which
+are not really necessary so it build system can do the "Right Thing"
+automatically.
+
+Upstream-Status: Pending
+
+Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
+---
+ DRI_1.10.4/src/makefile.linux | 20 +-------------------
+ EXA/src/makefile.linux        |  9 +--------
+ 2 files changed, 2 insertions(+), 27 deletions(-)
+
+diff --git a/DRI_1.10.4/src/makefile.linux b/DRI_1.10.4/src/makefile.linux
+index 86aa903..9188432 100644
+--- a/DRI_1.10.4/src/makefile.linux
++++ b/DRI_1.10.4/src/makefile.linux
+@@ -37,29 +37,11 @@ ifeq ($(SWAP_SINGLE_PARAMETER),1)
+ CFLAGS  += -DSWAP_SINGLE_PARAMETER
+ endif
+ 
+-ifeq ($(BUILD_HARD_VFP),1)
+-CFLAGS += -mfpu=neon -mfloat-abi=hard
+-else
+-CFLAGS += -mfpu=vfp -mfloat-abi=softfp
+-endif
+-
+ CFLAGS += -fvisibility=hidden -fPIC -DPIC
+ CFLAGS += -I. -I.. -I$(sysroot)/usr/include -I$(sysroot)/usr/include/xorg -I$(sysroot)/usr/include/$(PIXMAN)
+ CFLAGS += -I../../EXA/src/vivante_gal
+-ifeq ($(YOCTO),1)
+-# Yocto: compile will fail (does not support ldrex/strexeq/...)
+-# specify armv6 to walkaround it
+-# armv7: not supported by the toolchain
+-CFLAGS += -march=armv6
+-else
+-CFLAGS += -marm
+-# -Wa,-mimplicit-it=thumb
+-endif
+-
+ 
+-#LFLAGS += -lGAL -lm -ldl -ldrm -lX11 -module -Wl,-soname -Wl,$(target) -Wl,-rpath,/usr/lib/xorg/modules/extensions
+-#LFLAGS += -lGAL -lm -ldl -ldrm -lX11 -module -Wl,-soname -Wl,$(target)
+-LFLAGS += -L$(sysroot)/usr/lib -lGAL -lm -ldl -ldrm -lX11 -Wl,-soname -Wl,$(target)
++LFLAGS += -lGAL -lm -ldl -ldrm -lX11 -Wl,-soname -Wl,$(target)
+ 
+ all: $(target)
+ 
+diff --git a/EXA/src/makefile.linux b/EXA/src/makefile.linux
+index eb56de5..bfaf314 100644
+--- a/EXA/src/makefile.linux
++++ b/EXA/src/makefile.linux
+@@ -57,12 +57,6 @@ ifeq ($(BUSID_HAS_NUMBER),1)
+ CFLAGS  += -DBUSID_HAS_NUMBER
+ endif
+ 
+-ifeq ($(BUILD_HARD_VFP),1)
+-CFLAGS += -mfpu=neon -mfloat-abi=hard
+-else
+-CFLAGS += -mfpu=vfp -mfloat-abi=softfp
+-endif
+-
+ # macro FREESCALE_EXTENSION is reserved for future use
+ CFLAGS += -fvisibility=hidden -fPIC -DPIC -O2 -DFREESCALE_EXTENSION
+ CFLAGS += -I. -I.. -I$(sysroot)/usr/include -I$(sysroot)/usr/include/xorg -I$(sysroot)/usr/include/$(PIXMAN)
+@@ -73,8 +67,7 @@ CFLAGS += -marm
+ #CFLAGS += -mimplicit-it=thumb
+ 
+ LFLAGS += -fPIC
+-#LFLAGS +=  -Wl,--no-allow-shlib-undefined -lX11
+-LFLAGS += -L$(sysroot)/usr/lib -lm -ldl -lGAL -Wl,-soname -Wl,vivante_drv.so
++LFLAGS += -lm -ldl -lGAL -Wl,-soname -Wl,vivante_drv.so
+ 
+ 
+ all: $(target)
+-- 
+1.8.3.2
+
diff --git a/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante_3.0.35-4.0.0.bb b/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante_3.0.35-4.0.0.bb
deleted file mode 100644
index dbaf2ab..0000000
--- a/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante_3.0.35-4.0.0.bb
+++ /dev/null
@@ -1,54 +0,0 @@ 
-# Copyright (C) 2012-2013 Freescale Semiconductor
-# Copyright (C) 2012-2013 O.S. Systems Software LTDA.
-# Released under the MIT license (see COPYING.MIT for the terms)
-
-require recipes-graphics/xorg-driver/xorg-driver-video.inc
-
-PE = "3"
-PR = "${INC_PR}.3"
-
-DEPENDS += "virtual/xserver virtual/libx11 virtual/libgal-x11 gpu-viv-bin-mx6q"
-
-LIC_FILES_CHKSUM = "file://src/vivante_fbdev/vivante.h;endline=19;md5=641ac6e6d013833e36290797f4d7089c"
-
-SRC_URI = "${FSL_MIRROR}/xserver-xorg-video-imx-viv-${PV}.tar.gz \
-           file://Makefile.am-remove-prefixed-include-path.patch"
-SRC_URI[md5sum] = "5c5b5be029b077346610518bb729c012"
-SRC_URI[sha256sum] = "c67249e68d4233eb1d0a5f337ded8f121dc61fa26fca102a00f93acc3e37ea0f"
-
-EXTRA_OECONF_armv7a = " --enable-neon --disable-static"
-CFLAGS += " -I${STAGING_INCDIR}/xorg -I${STAGING_INCDIR}/drm"
-LDFLAGS += " -lGAL"
-
-S = "${WORKDIR}/xserver-xorg-video-imx-viv-${PV}/EXA/"
-
-do_compile_prepend () {
-    # FIXME: Allow build without depending on xserver-xorg
-    #        as this is the is the only source dependency and
-    #        by default Xorg does not install this header anyway.
-    cp ${S}/../DRI*/src/dri.h ${S}/../DRI*/src/sarea.h ${S}/src/vivante_fbdev/
-}
-
-do_install_append () {
-	install -d ${D}${includedir}
-	cp -axr ${S}/src/vivante_gal/vivante_priv.h ${D}${includedir}
-	cp -axr ${S}/src/vivante_gal/vivante_gal.h ${D}${includedir}
-	find ${D}${includedir} -type f -exec chmod 660 {} \;
-}
-
-RDEPENDS_${PN} += "libvivante-dri-mx6 \
-                   xserver-xorg-module-exa \
-                   mesa-driver-swrast \
-                   xf86-dri-vivante"
-
-# Add the ABI dependency at package generation time, as otherwise bitbake will
-# attempt to find a provider for it (and fail) when it does the parse.
-#
-# This version *must* be kept correct.
-python populate_packages_prepend() {
-    pn = d.getVar("PN", True)
-    d.appendVar("RDEPENDS_" + pn, " xorg-abi-video-11")
-}
-
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-COMPATIBLE_MACHINE = "(mx6)"
diff --git a/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante_3.5.7-1.0.0.bb b/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante_3.5.7-1.0.0.bb
new file mode 100644
index 0000000..46d59a4
--- /dev/null
+++ b/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante_3.5.7-1.0.0.bb
@@ -0,0 +1,58 @@ 
+# Copyright (C) 2012-2013 Freescale Semiconductor
+# Copyright (C) 2012-2013 O.S. Systems Software LTDA.
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+require recipes-graphics/xorg-driver/xorg-driver-video.inc
+
+PE = "3"
+
+DEPENDS += "virtual/xserver virtual/libx11 virtual/libgal-x11 gpu-viv-bin-mx6q pixman"
+
+LIC_FILES_CHKSUM = "file://EXA/src/vivante_fbdev/vivante.h;endline=19;md5=641ac6e6d013833e36290797f4d7089c"
+
+SRC_URI = "${FSL_MIRROR}/xserver-xorg-video-imx-viv-${PV}.tar.gz \
+           file://Makefile-fix-cross-compile.patch \
+           file://build-Don-t-force-things-decided-by-build-system.patch \
+           file://Port-Xorg-driver-to-new-Xorg-API.patch"
+SRC_URI[md5sum] = "e27c5e6e823502d06672808b92f1e008"
+SRC_URI[sha256sum] = "ae4fc547afb6b0e704c191c25c4b6c2752ed04b4ed60c2eb996abafcbc76f004"
+
+EXTRA_OEMAKE += "-C EXA/src -f makefile.linux prefix=${D}/usr SWAP_SINGLE_PARAMETER=1 NEW_FBDEV_API=1"
+
+CFLAGS += "-I${STAGING_INCDIR}/xorg \
+           -I${STAGING_INCDIR}/drm \
+           -I../../DRI_1.10.4/src"
+
+S = "${WORKDIR}/xserver-xorg-video-imx-viv-${PV}/"
+
+# FIXME: The Freescale provided Makefile has hardcodec include paths
+#        and this does not work in case prefix is different than /usr,
+#        sed it.
+do_configure_prepend () {
+    sed -i 's,$(sysroot)/usr/include,${STAGING_INCDIR},g' \
+            ${S}EXA/src/makefile.linux
+}
+
+# FIXME: This is need as Freescale didn't use standard Makefile filename
+#        thus oe_runmame thinks nothing is need to be done, use ln to
+#        workaround it.
+base_do_compile () {
+    oe_runmake || die "make failed"
+}
+
+do_install_append () {
+	install -d ${D}${includedir}
+	cp -axr ${S}/EXA/src/vivante_gal/vivante_priv.h ${D}${includedir}
+	cp -axr ${S}/EXA/src/vivante_gal/vivante_gal.h ${D}${includedir}
+	find ${D}${includedir} -type f -exec chmod 660 {} \;
+}
+
+RDEPENDS_${PN} += "libvivante-dri-mx6 \
+                   xserver-xorg-module-exa \
+                   mesa-driver-swrast \
+                   xserver-xorg-extension-dri \
+                   xserver-xorg-extension-dri2 \
+                   xserver-xorg-extension-glx"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+COMPATIBLE_MACHINE = "(mx6)"