diff options
-rw-r--r-- | src/compat-api.h | 30 | ||||
-rw-r--r-- | src/radeon.h | 10 | ||||
-rw-r--r-- | src/radeon_dri.c | 4 | ||||
-rw-r--r-- | src/radeon_driver.c | 67 | ||||
-rw-r--r-- | src/radeon_kms.c | 47 | ||||
-rw-r--r-- | src/radeon_probe.h | 27 |
6 files changed, 107 insertions, 78 deletions
diff --git a/src/compat-api.h b/src/compat-api.h index 1bb77241..2356250d 100644 --- a/src/compat-api.h +++ b/src/compat-api.h @@ -38,4 +38,34 @@ #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 int i, ScreenPtr pScreen, int argc, char **argv + +#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen +#define CLOSE_SCREEN_ARGS scrnIndex, pScreen + +#define VTFUNC_ARGS(flags) pScrn->scrnIndex, (flags) +#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 ScreenPtr pScreen, int argc, char **argv + +#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen +#define CLOSE_SCREEN_ARGS pScreen + +#define VTFUNC_ARGS(flags) pScrn, (flags) + +#endif + #endif diff --git a/src/radeon.h b/src/radeon.h index 4fdfca6c..c7c7252b 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -67,8 +67,6 @@ /* Xv support */ #include "xf86xv.h" -#include "compat-api.h" - #include "radeon_probe.h" #include "radeon_tv.h" @@ -104,6 +102,8 @@ #include "picturestr.h" #endif +#include "compat-api.h" + #include "simple_list.h" #include "atipcirename.h" @@ -515,7 +515,7 @@ struct radeon_dri { int numVisualConfigs; __GLXvisualConfig *pVisualConfigs; RADEONConfigPrivPtr pVisualConfigsPriv; - Bool (*DRICloseScreen)(int, ScreenPtr); + Bool (*DRICloseScreen)(CLOSE_SCREEN_ARGS_DECL); drm_handle_t fbHandle; @@ -865,9 +865,9 @@ typedef struct { RADEONSavePtr SavedReg; /* Original (text) mode */ RADEONSavePtr ModeReg; /* Current mode */ - Bool (*CloseScreen)(int, ScreenPtr); + Bool (*CloseScreen)(CLOSE_SCREEN_ARGS_DECL); - void (*BlockHandler)(int, pointer, pointer, pointer); + void (*BlockHandler)(SCREEN_ARG_TYPE, pointer, pointer, pointer); Bool PaletteSavedOnVT; /* Palette saved on last VT switch */ diff --git a/src/radeon_dri.c b/src/radeon_dri.c index 035556d6..f180f3a2 100644 --- a/src/radeon_dri.c +++ b/src/radeon_dri.c @@ -1716,7 +1716,7 @@ Bool RADEONDRIScreenInit(ScreenPtr pScreen) return TRUE; } -static Bool RADEONDRIDoCloseScreen(int scrnIndex, ScreenPtr pScreen) +static Bool RADEONDRIDoCloseScreen(CLOSE_SCREEN_ARGS_DECL) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); RADEONInfoPtr info = RADEONPTR(pScrn); @@ -1724,7 +1724,7 @@ static Bool RADEONDRIDoCloseScreen(int scrnIndex, ScreenPtr pScreen) RADEONDRICloseScreen(pScreen); pScreen->CloseScreen = info->dri->DRICloseScreen; - return (*pScreen->CloseScreen)(scrnIndex, pScreen); + return (*pScreen->CloseScreen)(CLOSE_SCREEN_ARGS); } /* Finish initializing the device-dependent DRI state, and call diff --git a/src/radeon_driver.c b/src/radeon_driver.c index e79ddba0..611d7364 100644 --- a/src/radeon_driver.c +++ b/src/radeon_driver.c @@ -121,7 +121,7 @@ #include "radeon_chipinfo_gen.h" /* Forward definitions for driver functions */ -static Bool RADEONCloseScreen(int scrnIndex, ScreenPtr pScreen); +static Bool RADEONCloseScreen(CLOSE_SCREEN_ARGS_DECL); static Bool RADEONSaveScreen(ScreenPtr pScreen, int mode); static void RADEONSave(ScrnInfoPtr pScrn); @@ -3373,15 +3373,15 @@ static void RADEONLoadPalette(ScrnInfoPtr pScrn, int numColors, #endif } -static void RADEONBlockHandler(int i, pointer blockData, +static void RADEONBlockHandler(SCREEN_ARG_TYPE arg, pointer blockData, pointer pTimeout, pointer pReadmask) { - ScreenPtr pScreen = screenInfo.screens[i]; - ScrnInfoPtr pScrn = xf86Screens[i]; + SCREEN_PTR(arg); + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); RADEONInfoPtr info = RADEONPTR(pScrn); pScreen->BlockHandler = info->BlockHandler; - (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); + (*pScreen->BlockHandler) (arg, blockData, pTimeout, pReadmask); pScreen->BlockHandler = RADEONBlockHandler; if (info->VideoTimerCallback) @@ -3448,8 +3448,7 @@ RADEONInitBIOSRegisters(ScrnInfoPtr pScrn) /* Called at the start of each server generation. */ -Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, - int argc, char **argv) +Bool RADEONScreenInit(SCREEN_INIT_ARGS) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); RADEONInfoPtr info = RADEONPTR(pScrn); @@ -3665,9 +3664,9 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, int maxy = info->FbMapSize / width_bytes; if (maxy <= pScrn->virtualY * 3) { - xf86DrvMsg(scrnIndex, X_ERROR, + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Static buffer allocation failed. Disabling DRI.\n"); - xf86DrvMsg(scrnIndex, X_ERROR, + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "At least %d kB of video memory needed at this " "resolution and depth.\n", (pScrn->displayWidth * pScrn->virtualY * @@ -3816,16 +3815,16 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, "Initializing Acceleration\n"); if (RADEONAccelInit(pScreen)) { - xf86DrvMsg(scrnIndex, X_INFO, "Acceleration enabled\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Acceleration enabled\n"); info->accelOn = TRUE; } else { - xf86DrvMsg(scrnIndex, X_ERROR, + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Acceleration initialization failed\n"); - xf86DrvMsg(scrnIndex, X_INFO, "Acceleration disabled\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Acceleration disabled\n"); info->accelOn = FALSE; } } else { - xf86DrvMsg(scrnIndex, X_INFO, "Acceleration disabled\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Acceleration disabled\n"); info->accelOn = FALSE; } @@ -3852,19 +3851,19 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, if (xf86QueryLargestOffscreenArea(pScreen, &width, &height, 0, 0, 0)) { - xf86DrvMsg(scrnIndex, X_INFO, + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Largest offscreen area available: %d x %d\n", width, height); } } #endif /* USE_XAA */ } else { - xf86DrvMsg(scrnIndex, X_ERROR, + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Hardware cursor initialization failed\n"); - xf86DrvMsg(scrnIndex, X_INFO, "Using software cursor\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using software cursor\n"); } } else { - xf86DrvMsg(scrnIndex, X_INFO, "Using software cursor\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using software cursor\n"); } /* DGA setup */ @@ -5954,9 +5953,9 @@ static Bool RADEONSaveScreen(ScreenPtr pScreen, int mode) return TRUE; } -Bool RADEONSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) +Bool RADEONSwitchMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, int flags) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SCRN_INFO_PTR(arg); RADEONInfoPtr info = RADEONPTR(pScrn); Bool tilingOld = info->tilingEnabled; Bool ret; @@ -5993,9 +5992,9 @@ Bool RADEONSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) if (info->tilingEnabled != tilingOld) { /* need to redraw front buffer, I guess this can be considered a hack ? */ - xf86EnableDisableFBAccess(scrnIndex, FALSE); + xf86EnableDisableFBAccess(arg, FALSE); RADEONChangeSurfaces(pScrn); - xf86EnableDisableFBAccess(scrnIndex, TRUE); + xf86EnableDisableFBAccess(arg, TRUE); /* xf86SetRootClip would do, but can't access that here */ } @@ -6050,10 +6049,10 @@ xf86ModeBandwidth(DisplayModePtr mode, int depth) #endif /* Used to disallow modes that are not supported by the hardware */ -ModeStatus RADEONValidMode(int scrnIndex, DisplayModePtr mode, +ModeStatus RADEONValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flag) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SCRN_INFO_PTR(arg); RADEONInfoPtr info = RADEONPTR(pScrn); RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); @@ -6188,9 +6187,9 @@ void RADEONDoAdjustFrame(ScrnInfoPtr pScrn, int x, int y, Bool crtc2) OUTREG(reg, Base); } -void RADEONAdjustFrame(int scrnIndex, int x, int y, int flags) +void RADEONAdjustFrame(SCRN_ARG_TYPE arg, int x, int y, int flags) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SCRN_INFO_PTR(arg); RADEONInfoPtr info = RADEONPTR(pScrn); RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); @@ -6226,9 +6225,9 @@ void RADEONAdjustFrame(int scrnIndex, int x, int y, int flags) /* Called when VT switching back to the X server. Reinitialize the * video mode. */ -Bool RADEONEnterVT(int scrnIndex, int flags) +Bool RADEONEnterVT(SCRN_ARG_TYPE arg, int flags) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SCRN_INFO_PTR(arg); RADEONInfoPtr info = RADEONPTR(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); int i; @@ -6326,9 +6325,9 @@ Bool RADEONEnterVT(int scrnIndex, int flags) /* Called when VT switching away from the X server. Restore the * original text mode. */ -void RADEONLeaveVT(int scrnIndex, int flags) +void RADEONLeaveVT(SCRN_ARG_TYPE arg, int flags) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SCRN_INFO_PTR(arg); RADEONInfoPtr info = RADEONPTR(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); int i; @@ -6413,9 +6412,9 @@ void RADEONLeaveVT(int scrnIndex, int flags) * text mode, unmap video memory, and unwrap and call the saved * CloseScreen function. */ -static Bool RADEONCloseScreen(int scrnIndex, ScreenPtr pScreen) +static Bool RADEONCloseScreen(CLOSE_SCREEN_ARGS_DECL) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); RADEONInfoPtr info = RADEONPTR(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); int i; @@ -6498,12 +6497,12 @@ static Bool RADEONCloseScreen(int scrnIndex, ScreenPtr pScreen) pScreen->BlockHandler = info->BlockHandler; pScreen->CloseScreen = info->CloseScreen; - return (*pScreen->CloseScreen)(scrnIndex, pScreen); + return (*pScreen->CloseScreen)(CLOSE_SCREEN_ARGS); } -void RADEONFreeScreen(int scrnIndex, int flags) +void RADEONFreeScreen(SCRN_ARG_TYPE arg, int flags) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SCRN_INFO_PTR(arg); RADEONInfoPtr info = RADEONPTR(pScrn); xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, diff --git a/src/radeon_kms.c b/src/radeon_kms.c index cf446ab9..2df2d256 100644 --- a/src/radeon_kms.c +++ b/src/radeon_kms.c @@ -192,15 +192,15 @@ static Bool RADEONCreateScreenResources_KMS(ScreenPtr pScreen) return TRUE; } -static void RADEONBlockHandler_KMS(int i, pointer blockData, +static void RADEONBlockHandler_KMS(SCREEN_ARG_TYPE arg, pointer blockData, pointer pTimeout, pointer pReadmask) { - ScreenPtr pScreen = screenInfo.screens[i]; - ScrnInfoPtr pScrn = xf86Screens[i]; + SCREEN_PTR(arg); + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); RADEONInfoPtr info = RADEONPTR(pScrn); pScreen->BlockHandler = info->BlockHandler; - (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); + (*pScreen->BlockHandler) (arg, blockData, pTimeout, pReadmask); pScreen->BlockHandler = RADEONBlockHandler_KMS; if (info->VideoTimerCallback) @@ -863,9 +863,9 @@ static Bool RADEONSaveScreen_KMS(ScreenPtr pScreen, int mode) * text mode, unmap video memory, and unwrap and call the saved * CloseScreen function. */ -static Bool RADEONCloseScreen_KMS(int scrnIndex, ScreenPtr pScreen) +static Bool RADEONCloseScreen_KMS(CLOSE_SCREEN_ARGS_DECL) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); RADEONInfoPtr info = RADEONPTR(pScrn); xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, @@ -898,13 +898,13 @@ static Bool RADEONCloseScreen_KMS(int scrnIndex, ScreenPtr pScreen) xf86ClearPrimInitDone(info->pEnt->index); pScreen->BlockHandler = info->BlockHandler; pScreen->CloseScreen = info->CloseScreen; - return (*pScreen->CloseScreen)(scrnIndex, pScreen); + return (*pScreen->CloseScreen)(CLOSE_SCREEN_ARGS); } -void RADEONFreeScreen_KMS(int scrnIndex, int flags) +void RADEONFreeScreen_KMS(SCRN_ARG_TYPE arg, int flags) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SCRN_INFO_PTR(arg); RADEONInfoPtr info = RADEONPTR(pScrn); xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, @@ -916,8 +916,7 @@ void RADEONFreeScreen_KMS(int scrnIndex, int flags) RADEONFreeRec(pScrn); } -Bool RADEONScreenInit_KMS(int scrnIndex, ScreenPtr pScreen, - int argc, char **argv) +Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); RADEONInfoPtr info = RADEONPTR(pScrn); @@ -1053,18 +1052,18 @@ Bool RADEONScreenInit_KMS(int scrnIndex, ScreenPtr pScreen, } if (info->r600_shadow_fb) { - xf86DrvMsg(scrnIndex, X_INFO, "Acceleration disabled\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Acceleration disabled\n"); info->accelOn = FALSE; } else { xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, "Initializing Acceleration\n"); if (RADEONAccelInit(pScreen)) { - xf86DrvMsg(scrnIndex, X_INFO, "Acceleration enabled\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Acceleration enabled\n"); info->accelOn = TRUE; } else { - xf86DrvMsg(scrnIndex, X_ERROR, + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Acceleration initialization failed\n"); - xf86DrvMsg(scrnIndex, X_INFO, "Acceleration disabled\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Acceleration disabled\n"); info->accelOn = FALSE; } } @@ -1104,7 +1103,7 @@ Bool RADEONScreenInit_KMS(int scrnIndex, ScreenPtr pScreen, if (info->r600_shadow_fb == TRUE) { if (!shadowSetup(pScreen)) { - xf86DrvMsg(scrnIndex, X_ERROR, + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Shadowfb initialization failed\n"); return FALSE; } @@ -1150,9 +1149,9 @@ Bool RADEONScreenInit_KMS(int scrnIndex, ScreenPtr pScreen, return TRUE; } -Bool RADEONEnterVT_KMS(int scrnIndex, int flags) +Bool RADEONEnterVT_KMS(SCRN_ARG_TYPE arg, int flags) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SCRN_INFO_PTR(arg); RADEONInfoPtr info = RADEONPTR(pScrn); int ret; @@ -1178,9 +1177,9 @@ Bool RADEONEnterVT_KMS(int scrnIndex, int flags) } -void RADEONLeaveVT_KMS(int scrnIndex, int flags) +void RADEONLeaveVT_KMS(SCRN_ARG_TYPE arg, int flags) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SCRN_INFO_PTR(arg); RADEONInfoPtr info = RADEONPTR(pScrn); xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, @@ -1201,18 +1200,18 @@ void RADEONLeaveVT_KMS(int scrnIndex, int flags) } -Bool RADEONSwitchMode_KMS(int scrnIndex, DisplayModePtr mode, int flags) +Bool RADEONSwitchMode_KMS(SCRN_ARG_TYPE arg, DisplayModePtr mode, int flags) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SCRN_INFO_PTR(arg); Bool ret; ret = xf86SetSingleMode (pScrn, mode, RR_Rotate_0); return ret; } -void RADEONAdjustFrame_KMS(int scrnIndex, int x, int y, int flags) +void RADEONAdjustFrame_KMS(SCRN_ARG_TYPE arg, int x, int y, int flags) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SCRN_INFO_PTR(arg); RADEONInfoPtr info = RADEONPTR(pScrn); drmmode_adjust_frame(pScrn, &info->drmmode, x, y, flags); return; diff --git a/src/radeon_probe.h b/src/radeon_probe.h index 66905022..40dc5433 100644 --- a/src/radeon_probe.h +++ b/src/radeon_probe.h @@ -43,6 +43,7 @@ #include "xf86Crtc.h" +#include "compat-api.h" #ifdef USE_EXA #include "exa.h" #endif @@ -760,28 +761,28 @@ extern PciChipsets RADEONPciChipsets[]; /* radeon_driver.c */ extern Bool RADEONPreInit(ScrnInfoPtr, int); -extern Bool RADEONScreenInit(int, ScreenPtr, int, char **); -extern Bool RADEONSwitchMode(int, DisplayModePtr, int); +extern Bool RADEONScreenInit(SCREEN_INIT_ARGS); +extern Bool RADEONSwitchMode(SCRN_ARG_TYPE, DisplayModePtr, int); #ifdef X_XF86MiscPassMessage extern Bool RADEONHandleMessage(int, const char*, const char*, char**); #endif -extern void RADEONAdjustFrame(int, int, int, int); -extern Bool RADEONEnterVT(int, int); -extern void RADEONLeaveVT(int, int); -extern void RADEONFreeScreen(int, int); -extern ModeStatus RADEONValidMode(int, DisplayModePtr, Bool, int); +extern void RADEONAdjustFrame(SCRN_ARG_TYPE, int, int, int); +extern Bool RADEONEnterVT(SCRN_ARG_TYPE, int); +extern void RADEONLeaveVT(SCRN_ARG_TYPE, int); +extern void RADEONFreeScreen(SCRN_ARG_TYPE, int); +extern ModeStatus RADEONValidMode(SCRN_ARG_TYPE, DisplayModePtr, Bool, int); extern const OptionInfoRec *RADEONOptionsWeak(void); #ifdef XF86DRM_MODE extern Bool RADEONPreInit_KMS(ScrnInfoPtr, int); -extern Bool RADEONScreenInit_KMS(int, ScreenPtr, int, char **); -extern Bool RADEONSwitchMode_KMS(int, DisplayModePtr, int); -extern void RADEONAdjustFrame_KMS(int, int, int, int); -extern Bool RADEONEnterVT_KMS(int, int); -extern void RADEONLeaveVT_KMS(int, int); -extern void RADEONFreeScreen_KMS(int scrnIndex, int flags); +extern Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS); +extern Bool RADEONSwitchMode_KMS(SCRN_ARG_TYPE, DisplayModePtr, int); +extern void RADEONAdjustFrame_KMS(SCRN_ARG_TYPE, int, int, int); +extern Bool RADEONEnterVT_KMS(SCRN_ARG_TYPE, int); +extern void RADEONLeaveVT_KMS(SCRN_ARG_TYPE, int); +extern void RADEONFreeScreen_KMS(SCRN_ARG_TYPE, int flags); #endif #endif /* _RADEON_PROBE_H_ */ |