From 742d31d74018ad40d959db0d740fde08c6c94bbd Mon Sep 17 00:00:00 2001 From: Gary Thomas Date: Fri, 21 Dec 2012 09:25:13 -0700 Subject: xf86-video-imxfb-vivante: Update for new X server API X server 1.13 introduced driver API changes. These patches handle those changes in a backwards compatible way. Signed-off-by: Gary Thomas --- .../fix-vivante-compile.patch | 381 +++++++++++++++++++++ 1 file changed, 381 insertions(+) create mode 100644 recipes-graphics/xorg-driver/xf86-video-imxfb-vivante/fix-vivante-compile.patch (limited to 'recipes-graphics/xorg-driver/xf86-video-imxfb-vivante') diff --git a/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante/fix-vivante-compile.patch b/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante/fix-vivante-compile.patch new file mode 100644 index 0000000..d92acce --- /dev/null +++ b/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante/fix-vivante-compile.patch @@ -0,0 +1,381 @@ +This patch handles changes in the X server API which appeared in version 1.13 +The changes should be backwards compatible so this driver still works in earlier +versions of the X server. + +Upstream-Status: Pending + +Index: xserver-xorg-video-imx-viv-12.09.01/src/vivante_fbdev/vivante_dri.h +=================================================================== +--- xserver-xorg-video-imx-viv-12.09.01.orig/src/vivante_fbdev/vivante_dri.h ++++ xserver-xorg-video-imx-viv-12.09.01/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_ */ +Index: xserver-xorg-video-imx-viv-12.09.01/src/vivante_fbdev/vivante_fbdev_driver.c +=================================================================== +--- xserver-xorg-video-imx-viv-12.09.01.orig/src/vivante_fbdev/vivante_fbdev_driver.c ++++ xserver-xorg-video-imx-viv-12.09.01/src/vivante_fbdev/vivante_fbdev_driver.c +@@ -19,7 +19,6 @@ + *****************************************************************************/ + + +- + #include "vivante_common.h" + #include "vivante.h" + #include "vivante_exa.h" +@@ -54,9 +53,8 @@ static const OptionInfoRec *VivAvailable + 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); + +@@ -178,7 +176,7 @@ VivSetup(pointer module, pointer opts, i + + static Bool InitExaLayer(ScreenPtr pScreen) { + ExaDriverPtr pExa; +- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; ++ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); + VivPtr pViv = GET_VIV_PTR(pScrn); + + TRACE_ENTER(); +@@ -274,7 +272,7 @@ static Bool InitExaLayer(ScreenPtr pScre + } + + 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"); +@@ -590,7 +588,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; + +@@ -612,8 +610,8 @@ VivCreateScreenResources(ScreenPtr pScre + } + + 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; +@@ -631,7 +629,7 @@ VivScreenInit(int scrnIndex, ScreenPtr p + + /*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); + } +@@ -647,11 +645,11 @@ VivScreenInit(int scrnIndex, ScreenPtr p + + /*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); +- fbdevHWAdjustFrame(scrnIndex, 0, 0, 0); ++ fbdevHWAdjustFrame(FBDEVHWADJUSTFRAME_ARGS(0, 0)); + + + +@@ -659,7 +657,7 @@ VivScreenInit(int scrnIndex, ScreenPtr p + 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); +@@ -668,14 +666,14 @@ VivScreenInit(int scrnIndex, ScreenPtr p + 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; + } + +@@ -684,14 +682,14 @@ VivScreenInit(int scrnIndex, ScreenPtr p + 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); + +@@ -708,7 +706,7 @@ VivScreenInit(int scrnIndex, ScreenPtr p + 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); +@@ -740,7 +738,7 @@ VivScreenInit(int scrnIndex, ScreenPtr p + 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"); + } +@@ -759,7 +757,7 @@ VivScreenInit(int scrnIndex, ScreenPtr p + + /* colormap */ + if (!miCreateDefColormap(pScreen)) { +- xf86DrvMsg(scrnIndex, X_ERROR, ++ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "internal error: miCreateDefColormap failed " + "in VivScreenInit()\n"); + TRACE_EXIT(FALSE); +@@ -799,18 +797,18 @@ VivScreenInit(int scrnIndex, ScreenPtr p + } + + 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(); + +- VivDRICloseScreen(pScreen); ++ VivDRICloseScreen(CLOSE_SCREEN_ARGS); + + if (fPtr->mFakeExa.mUseExaFlag) { + DEBUGP("UnLoading EXA"); + if (fPtr->mFakeExa.mIsInited && !DestroyExaLayer(pScreen)) { +- xf86DrvMsg(scrnIndex, X_ERROR, ++ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "internal error: DestroyExaLayer failed " + "in VivCloseScreen()\n"); + } +@@ -823,7 +821,7 @@ VivCloseScreen(int scrnIndex, ScreenPtr + + pScreen->CreateScreenResources = fPtr->CreateScreenResources; + pScreen->CloseScreen = fPtr->CloseScreen; +- ret = (*pScreen->CloseScreen)(scrnIndex, pScreen); ++ ret = (*pScreen->CloseScreen)(CLOSE_SCREEN_ARGS); + TRACE_EXIT(ret); + } + +Index: xserver-xorg-video-imx-viv-12.09.01/src/vivante_util/compat-api.h +=================================================================== +--- /dev/null ++++ xserver-xorg-video-imx-viv-12.09.01/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 ++ */ ++ ++/* 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 +Index: xserver-xorg-video-imx-viv-12.09.01/src/vivante_util/vivante_common.h +=================================================================== +--- xserver-xorg-video-imx-viv-12.09.01.orig/src/vivante_util/vivante_common.h ++++ xserver-xorg-video-imx-viv-12.09.01/src/vivante_util/vivante_common.h +@@ -76,6 +76,9 @@ extern "C" { + #include "xf86Crtc.h" + #include "cursorstr.h" + ++ /* System API compatability */ ++#include "compat-api.h" ++ + /*Debug*/ + #include "vivante_debug.h" + +Index: xserver-xorg-video-imx-viv-12.09.01/src/vivante_fbdev/vivante.h +=================================================================== +--- xserver-xorg-video-imx-viv-12.09.01.orig/src/vivante_fbdev/vivante.h ++++ xserver-xorg-video-imx-viv-12.09.01/src/vivante_fbdev/vivante.h +@@ -99,11 +99,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)) + + /******************************************************************************** + * +Index: xserver-xorg-video-imx-viv-12.09.01/src/vivante_fbdev/vivante_dri.c +=================================================================== +--- xserver-xorg-video-imx-viv-12.09.01.orig/src/vivante_fbdev/vivante_dri.c ++++ xserver-xorg-video-imx-viv-12.09.01/src/vivante_fbdev/vivante_dri.c +@@ -49,7 +49,7 @@ VivDestroyContext(ScreenPtr pScreen, drm + + Bool + VivDRIFinishScreenInit(ScreenPtr pScreen) { +- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; ++ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); + VivPtr pViv = GET_VIV_PTR(pScrn); + DRIInfoPtr pDRIInfo = (DRIInfoPtr) pViv->pDRIInfo; + +@@ -79,7 +79,7 @@ VivDRIMoveBuffers(WindowPtr pParent, DDX + } + + Bool VivDRIScreenInit(ScreenPtr pScreen) { +- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; ++ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); + DRIInfoPtr pDRIInfo; + VivPtr pViv = GET_VIV_PTR(pScrn); + +@@ -185,7 +185,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) { -- cgit v1.2.3-54-g00ecf