[PATCH 7/8] modesetting: Drop use of compat-api.h

Eric Anholt eric at anholt.net
Tue Aug 26 12:19:23 PDT 2014


---
 hw/xfree86/drivers/modesetting/Makefile.am       |  1 -
 hw/xfree86/drivers/modesetting/compat-api.h      | 94 ------------------------
 hw/xfree86/drivers/modesetting/driver.c          | 50 ++++++-------
 hw/xfree86/drivers/modesetting/drmmode_display.c |  1 -
 4 files changed, 21 insertions(+), 125 deletions(-)
 delete mode 100644 hw/xfree86/drivers/modesetting/compat-api.h

diff --git a/hw/xfree86/drivers/modesetting/Makefile.am b/hw/xfree86/drivers/modesetting/Makefile.am
index f6c6041..ca3279e 100644
--- a/hw/xfree86/drivers/modesetting/Makefile.am
+++ b/hw/xfree86/drivers/modesetting/Makefile.am
@@ -41,7 +41,6 @@ modesetting_drv_la_LIBADD = $(UDEV_LIBS) $(DRM_LIBS)
 modesetting_drv_ladir = @moduledir@/drivers
 
 modesetting_drv_la_SOURCES = \
-	 compat-api.h \
 	 driver.c \
 	 driver.h \
 	 drmmode_display.c \
diff --git a/hw/xfree86/drivers/modesetting/compat-api.h b/hw/xfree86/drivers/modesetting/compat-api.h
deleted file mode 100644
index bd7decc..0000000
--- a/hw/xfree86/drivers/modesetting/compat-api.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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 at 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 i, ScreenPtr pScreen, int argc, char **argv
-
-#define BLOCKHANDLER_ARGS_DECL int arg, void * blockData, void * pTimeout, void * 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 SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags
-
-#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_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, void * pTimeout, void * 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 SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode
-
-#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg
-
-#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
-#define VT_FUNC_ARGS pScrn
-
-#define XF86_ENABLEDISABLEFB_ARG(x) (x)
-
-#endif
-
-#endif
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index ccd6ff2..2910826 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -59,20 +59,19 @@
 #include <pciaccess.h>
 #endif
 
-#include "compat-api.h"
 #include "driver.h"
 
-static void AdjustFrame(ADJUST_FRAME_ARGS_DECL);
-static Bool CloseScreen(CLOSE_SCREEN_ARGS_DECL);
-static Bool EnterVT(VT_FUNC_ARGS_DECL);
+static void AdjustFrame(ScrnInfoPtr pScrn, int x, int y);
+static Bool CloseScreen(ScreenPtr pScreen);
+static Bool EnterVT(ScrnInfoPtr pScrn);
 static void Identify(int flags);
 static const OptionInfoRec *AvailableOptions(int chipid, int busid);
-static ModeStatus ValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose,
+static ModeStatus ValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose,
 			    int flags);
-static void FreeScreen(FREE_SCREEN_ARGS_DECL);
-static void LeaveVT(VT_FUNC_ARGS_DECL);
-static Bool SwitchMode(SWITCH_MODE_ARGS_DECL);
-static Bool ScreenInit(SCREEN_INIT_ARGS_DECL);
+static void FreeScreen(ScrnInfoPtr pScrn);
+static void LeaveVT(ScrnInfoPtr pScrn);
+static Bool SwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
+static Bool ScreenInit(ScreenPtr pScreen, int argc, char **argv);
 static Bool PreInit(ScrnInfoPtr pScrn, int flags);
 
 static Bool Probe(DriverPtr drv, int flags);
@@ -535,13 +534,12 @@ static void dispatch_slave_dirty(ScreenPtr pScreen)
     }
 }
 
-static void msBlockHandler(BLOCKHANDLER_ARGS_DECL)
+static void msBlockHandler(ScreenPtr pScreen, void *pTimeout, void *pReadmask)
 {
-    SCREEN_PTR(arg);
     modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(pScreen));
 
     pScreen->BlockHandler = ms->BlockHandler;
-    pScreen->BlockHandler(BLOCKHANDLER_ARGS);
+    pScreen->BlockHandler(pScreen, pTimeout, pReadmask);
     pScreen->BlockHandler = msBlockHandler;
     if (pScreen->isGPU)
         dispatch_slave_dirty(pScreen);
@@ -909,7 +907,7 @@ SetMaster(ScrnInfoPtr pScrn)
 }
 
 static Bool
-ScreenInit(SCREEN_INIT_ARGS_DECL)
+ScreenInit(ScreenPtr pScreen, int argc, char **argv)
 {
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     modesettingPtr ms = modesettingPTR(pScrn);
@@ -1018,29 +1016,26 @@ ScreenInit(SCREEN_INIT_ARGS_DECL)
     if (serverGeneration == 1)
 	xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
 
-    return EnterVT(VT_FUNC_ARGS);
+    return EnterVT(pScrn);
 }
 
 static void
-AdjustFrame(ADJUST_FRAME_ARGS_DECL)
+AdjustFrame(ScrnInfoPtr pScrn, int x, int y)
 {
-    SCRN_INFO_PTR(arg);
     modesettingPtr ms = modesettingPTR(pScrn);
 
     drmmode_adjust_frame(pScrn, &ms->drmmode, x, y);
 }
 
 static void
-FreeScreen(FREE_SCREEN_ARGS_DECL)
+FreeScreen(ScrnInfoPtr pScrn)
 {
-    SCRN_INFO_PTR(arg);
     FreeRec(pScrn);
 }
 
 static void
-LeaveVT(VT_FUNC_ARGS_DECL)
+LeaveVT(ScrnInfoPtr pScrn)
 {
-    SCRN_INFO_PTR(arg);
     modesettingPtr ms = modesettingPTR(pScrn);
     xf86_hide_cursors(pScrn);
 
@@ -1059,9 +1054,8 @@ LeaveVT(VT_FUNC_ARGS_DECL)
  * This gets called when gaining control of the VT, and from ScreenInit().
  */
 static Bool
-EnterVT(VT_FUNC_ARGS_DECL)
+EnterVT(ScrnInfoPtr pScrn)
 {
-    SCRN_INFO_PTR(arg);
     modesettingPtr ms = modesettingPTR(pScrn);
 
     pScrn->vtSema = TRUE;
@@ -1075,15 +1069,13 @@ EnterVT(VT_FUNC_ARGS_DECL)
 }
 
 static Bool
-SwitchMode(SWITCH_MODE_ARGS_DECL)
+SwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
 {
-    SCRN_INFO_PTR(arg);
-
     return xf86SetSingleMode(pScrn, mode, RR_Rotate_0);
 }
 
 static Bool
-CloseScreen(CLOSE_SCREEN_ARGS_DECL)
+CloseScreen(ScreenPtr pScreen)
 {
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     modesettingPtr ms = modesettingPTR(pScrn);
@@ -1104,7 +1096,7 @@ CloseScreen(CLOSE_SCREEN_ARGS_DECL)
     drmmode_free_bos(pScrn, &ms->drmmode);
 
     if (pScrn->vtSema) {
-        LeaveVT(VT_FUNC_ARGS);
+        LeaveVT(pScrn);
     }
 
     pScreen->CreateScreenResources = ms->createScreenResources;
@@ -1112,11 +1104,11 @@ CloseScreen(CLOSE_SCREEN_ARGS_DECL)
 
     pScrn->vtSema = FALSE;
     pScreen->CloseScreen = ms->CloseScreen;
-    return (*pScreen->CloseScreen) (CLOSE_SCREEN_ARGS);
+    return (*pScreen->CloseScreen) (pScreen);
 }
 
 static ModeStatus
-ValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags)
+ValidMode(ScrnInfoPtr arg, DisplayModePtr mode, Bool verbose, int flags)
 {
     return MODE_OK;
 }
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index d55157b..88de97c 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -46,7 +46,6 @@
 #include <cursorstr.h>
 
 #include <X11/extensions/dpmsconst.h>
-#include "compat-api.h"
 
 #include "driver.h"
 
-- 
2.1.0



More information about the xorg-devel mailing list