On Tue, Sep 17, 2013 at 21:37:52 +0100, Ian Campbell wrote:

> On Tue, 2013-09-17 at 21:27 +0200, Julien Cristau wrote:
> > Hi all,
> > 
> > the X Strike Force is getting ready to upload a newer xserver to
> > unstable.  The current plan is to do that once systemd 204 reaches
> > testing, so probably in a week or two.  Please let us know for each
> > non-XSF-maintained driver whether you'll want to make a new source
> > upload for the transition or if it should be handled by binNMUs.
> 
> I've not seen a new upstream release of the ivtv driver in forever. A
> binNMU is the way to go I think, unless it doesn't build or something in
> which case let me know...
> 
It doesn't build.  The attached patch fixes that (and hopefully still
builds against 1.12), but I don't know if that's enough to make it run.

Cheers,
Julien
diff --git a/src/compat-api.h b/src/compat-api.h
new file mode 100644
index 0000000..205ac59
--- /dev/null
+++ b/src/compat-api.h
@@ -0,0 +1,99 @@
+/*
+ * 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 <airl...@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 scrnIndex, 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 ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags
+#define ADJUST_FRAME_ARGS(arg, x, y) (arg)->scrnIndex, x, y, 0
+
+#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags
+#define SWITCH_MODE_ARGS(arg, m) (arg)->scrnIndex, m, 0
+
+#define FREE_SCREEN_ARGS_DECL int arg, int flags
+
+#define VT_FUNC_ARGS_DECL int arg, int flags
+#define VT_FUNC_ARGS pScrn->scrnIndex, 0
+
+#define XF86_SCRN_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 ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y
+#define ADJUST_FRAME_ARGS(arg, x, y) arg, x, y
+
+#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode
+#define SWITCH_MODE_ARGS(arg, m) arg, m
+
+#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg
+
+#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
+#define VT_FUNC_ARGS pScrn
+
+#define XF86_SCRN_ARG(x) (x)
+
+#endif
+
+#endif
diff --git a/src/ivtv.c b/src/ivtv.c
index ede9c87..4cb1839 100644
--- a/src/ivtv.c
+++ b/src/ivtv.c
@@ -42,7 +42,6 @@ in this Software without prior written authorization from the XFree86 Project.
 #include "xf86_OSproc.h"
 
 #include "mipointer.h"
-#include "mibstore.h"
 #include "micmap.h"
 #include "colormapst.h"
 #include "xf86cmap.h"
@@ -97,9 +96,8 @@ static const OptionInfoRec *IVTVDevAvailableOptions(int chipid, int busid);
 static void IVTVDevIdentify(int flags);
 static Bool IVTVDevProbe(DriverPtr drv, int flags);
 static Bool IVTVDevPreInit(ScrnInfoPtr pScrn, int flags);
-static Bool IVTVDevScreenInit(int Index, ScreenPtr pScreen, int argc,
-    char **argv);
-static Bool IVTVDevCloseScreen(int scrnIndex, ScreenPtr pScreen);
+static Bool IVTVDevScreenInit(SCREEN_INIT_ARGS_DECL);
+static Bool IVTVDevCloseScreen(CLOSE_SCREEN_ARGS_DECL);
 
 /* -------------------------------------------------------------------- */
 
@@ -588,9 +586,9 @@ IVTVDevShadowInit(ScreenPtr pScreen)
 }
 
 static Bool
-IVTVDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+IVTVDevScreenInit(SCREEN_INIT_ARGS_DECL)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     IVTVDevPtr devPtr = IVTVDEVPTR(pScrn);
     VisualPtr visual;
     int ret, flags, width, height;
@@ -613,30 +611,30 @@ IVTVDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
     ivtvHWSave(pScrn);
 
     if (!ivtvHWModeInit(pScrn, pScrn->currentMode)) {
-	xf86DrvMsg(scrnIndex, X_ERROR, "DevScreenInit: Mode init failed\n");
+	xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "DevScreenInit: Mode init failed\n");
 	return FALSE;
     }
     ivtvHWSaveScreen(pScreen, SCREEN_SAVER_ON);
-    ivtvHWAdjustFrame(scrnIndex, 0, 0, 0);
+    ivtvHWAdjustFrame(ADJUST_FRAME_ARGS(pScrn, 0, 0));
 
     /* mi layer */
     miClearVisualTypes();
     if (pScrn->bitsPerPixel > 8) {
 	if (!miSetVisualTypes
 	    (pScrn->depth, TrueColorMask, pScrn->rgbBits, TrueColor)) {
-	    xf86DrvMsg(scrnIndex, X_ERROR,
+	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 			"DevScreenInit: Set >8bpp visual types failed\n");
 	    return FALSE;
 	}
     } else if (!miSetVisualTypes(pScrn->depth,
 		miGetDefaultVisualMask(pScrn->depth),
 		pScrn->rgbBits, pScrn->defaultVisual)) {
-	xf86DrvMsg(scrnIndex, X_ERROR,
+	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		    "DevScreenInit: Set visual types failed\n");
 	return FALSE;
     }
     if (!miSetPixmapDepths()) {
-	xf86DrvMsg(scrnIndex, X_ERROR,
+	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		    "DevScreenInit: Set pixmap depths failed\n");
 	return FALSE;
     }
@@ -647,7 +645,7 @@ IVTVDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
     /* shadowfb */
     if ((devPtr->shadowmem = calloc(1, pScrn->virtualX * pScrn->virtualY *
 		pScrn->bitsPerPixel)) == NULL) {
-	xf86DrvMsg(scrnIndex, X_ERROR,
+	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 	    "DevScreenInit: Allocation of shadow memory failed\n");
 	return FALSE;
     }
@@ -682,17 +680,16 @@ IVTVDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 	    "RENDER extension initialisation failed.\n");
 
     if (devPtr->shadowmem && !IVTVDevShadowInit(pScreen)) {
-	xf86DrvMsg(scrnIndex, X_ERROR,
+	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 	    "DevScreenInit: Shadow framebuffer initialization failed.\n");
 	return FALSE;
     }
 
     if (pScrn->bitsPerPixel == 24)
-	xf86DrvMsg(scrnIndex, X_WARNING,
+	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 	    "Rotation might be broken in 24 bpp\n");
 
     xf86SetBlackWhitePixels(pScreen);
-    miInitializeBackingStore(pScreen);
     xf86SetBackingStore(pScreen);
 
     /* software cursor */
@@ -731,9 +728,9 @@ IVTVDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 }
 
 static Bool
-IVTVDevCloseScreen(int scrnIndex, ScreenPtr pScreen)
+IVTVDevCloseScreen(CLOSE_SCREEN_ARGS_DECL)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     IVTVDevPtr devPtr = IVTVDEVPTR(pScrn);
 
     /* Before we go, wipe the screen. If there is no console
@@ -756,5 +753,5 @@ IVTVDevCloseScreen(int scrnIndex, ScreenPtr pScreen)
     }
 
     pScreen->CloseScreen = devPtr->CloseScreen;
-    return (*pScreen->CloseScreen) (scrnIndex, pScreen);
+    return (*pScreen->CloseScreen) (CLOSE_SCREEN_ARGS);
 }
diff --git a/src/ivtv_hw.c b/src/ivtv_hw.c
index b50c2b0..fad3354 100644
--- a/src/ivtv_hw.c
+++ b/src/ivtv_hw.c
@@ -709,16 +709,16 @@ ivtvHWValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
 }
 
 Bool
-ivtvHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
+ivtvHWSwitchMode(SWITCH_MODE_ARGS_DECL)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+    SCRN_INFO_PTR(arg);
     IVTVDevPtr devPtr = IVTVDEVPTR(pScrn);
 
     TRACE_ENTER("SwitchMode");
     xfree2ivtv_timing(mode, &devPtr->var);
     xfree2ivtv_fblayout(pScrn, &devPtr->var);
     if (0 != ioctl(devPtr->fd, FBIOPUT_VSCREENINFO, (void *)(&devPtr->var))) {
-	xf86DrvMsg(scrnIndex, X_ERROR,
+	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 	    "SwitchMode: FBIOPUT_VSCREENINFO failed (%s)\n", strerror(errno));
 	return FALSE;
     }
@@ -726,35 +726,35 @@ ivtvHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
 }
 
 void
-ivtvHWAdjustFrame(int scrnIndex, int x, int y, int flags)
+ivtvHWAdjustFrame(ADJUST_FRAME_ARGS_DECL)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+    SCRN_INFO_PTR(arg);
     IVTVDevPtr devPtr = IVTVDEVPTR(pScrn);
 
     devPtr->var.xoffset = x;
     devPtr->var.yoffset = y;
     if (-1 == ioctl(devPtr->fd, FBIOPAN_DISPLAY, (void *)&devPtr->var)) {
-	xf86DrvMsgVerb(scrnIndex, 5, X_WARNING,
+	xf86DrvMsgVerb(pScrn->scrnIndex, 5, X_WARNING,
 	    "AdjustFrame: FBIOPAN_DISPLAY failed (%s)\n", strerror(errno));
     }
 }
 
 Bool
-ivtvHWEnterVT(int scrnIndex, int flags)
+ivtvHWEnterVT(VT_FUNC_ARGS_DECL)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+    SCRN_INFO_PTR(arg);
 
     TRACE_ENTER("EnterVT");
     if (!ivtvHWModeInit(pScrn, pScrn->currentMode))
 	return FALSE;
-    ivtvHWAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+    ivtvHWAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
     return TRUE;
 }
 
 void
-ivtvHWLeaveVT(int scrnIndex, int flags)
+ivtvHWLeaveVT(VT_FUNC_ARGS_DECL)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+    SCRN_INFO_PTR(arg);
 
     TRACE_ENTER("LeaveVT");
     ivtvHWRestore(pScrn);
diff --git a/src/ivtv_hw.h b/src/ivtv_hw.h
index 352d5d8..238a42c 100644
--- a/src/ivtv_hw.h
+++ b/src/ivtv_hw.h
@@ -31,7 +31,9 @@ in this Software without prior written authorization from the XFree86 Project.
 #ifndef _IVTV_HW_H_
 #define _IVTV_HW_H_
 
+#include "xf86.h"
 #include "xf86str.h"
+#include "shadow.h"
 #include "colormapst.h"
 #include <asm/ioctl.h>
 #undef __STRICT_ANSI__
@@ -40,6 +42,8 @@ in this Software without prior written authorization from the XFree86 Project.
 #include "ivtv_compat.h"
 #include <linux/fb.h>
 
+#include "compat-api.h"
+
 #ifdef XORG_VERSION_CURRENT
 # include "xorgVersion.h"
 #endif
@@ -83,10 +87,10 @@ void ivtvHWRestore(ScrnInfoPtr pScrn);
 void ivtvHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
     LOCO * colors, VisualPtr pVisual);
 int ivtvHWValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags);
-Bool ivtvHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
-void ivtvHWAdjustFrame(int scrnIndex, int x, int y, int flags);
-Bool ivtvHWEnterVT(int scrnIndex, int flags);
-void ivtvHWLeaveVT(int scrnIndex, int flags);
+Bool ivtvHWSwitchMode(SWITCH_MODE_ARGS_DECL);
+void ivtvHWAdjustFrame(ADJUST_FRAME_ARGS_DECL);
+Bool ivtvHWEnterVT(VT_FUNC_ARGS_DECL);
+void ivtvHWLeaveVT(VT_FUNC_ARGS_DECL);
 void ivtvHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags);
 Bool ivtvHWSaveScreen(ScreenPtr pScreen, int mode);
 Bool ivtvHWSendDMA(ScrnInfoPtr pScrn, void *ptr, int x1, int x2, int y1, int y2);

Attachment: signature.asc
Description: Digital signature

Reply via email to