diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2012-09-09 17:51:31 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2012-09-09 17:51:31 +0000 |
commit | eb90cd12689f97ce459f6b867bc17e8adc599379 (patch) | |
tree | 219c445a5eb183e2074426935d479c2c40f73f64 /driver/xf86-video-radeonold | |
parent | 297f54032cb46f390e53a8169a6f53845ab1452e (diff) |
Convert radeonold to compat-api.h (compatibility with xserver 1.13)
Diffstat (limited to 'driver/xf86-video-radeonold')
-rw-r--r-- | driver/xf86-video-radeonold/src/atombios_crtc.c | 4 | ||||
-rw-r--r-- | driver/xf86-video-radeonold/src/compat-api.h | 99 | ||||
-rw-r--r-- | driver/xf86-video-radeonold/src/legacy_crtc.c | 4 | ||||
-rw-r--r-- | driver/xf86-video-radeonold/src/radeon.h | 14 | ||||
-rw-r--r-- | driver/xf86-video-radeonold/src/radeon_accel.c | 36 | ||||
-rw-r--r-- | driver/xf86-video-radeonold/src/radeon_dga.c | 14 | ||||
-rw-r--r-- | driver/xf86-video-radeonold/src/radeon_dri.c | 6 | ||||
-rw-r--r-- | driver/xf86-video-radeonold/src/radeon_driver.c | 80 | ||||
-rw-r--r-- | driver/xf86-video-radeonold/src/radeon_probe.h | 15 |
9 files changed, 186 insertions, 86 deletions
diff --git a/driver/xf86-video-radeonold/src/atombios_crtc.c b/driver/xf86-video-radeonold/src/atombios_crtc.c index 9bc1ad2f0..bcbc7c032 100644 --- a/driver/xf86-video-radeonold/src/atombios_crtc.c +++ b/driver/xf86-video-radeonold/src/atombios_crtc.c @@ -656,10 +656,10 @@ atombios_crtc_mode_set(xf86CrtcPtr crtc, /* need to redraw front buffer, I guess this can be considered a hack ? */ /* if this is called during ScreenInit() we don't have pScrn->pScreen yet */ if (pScrn->pScreen) - xf86EnableDisableFBAccess(pScrn->scrnIndex, FALSE); + xf86EnableDisableFBAccess(XF86_ENABLEDISABLEFB_ARG(pScrn), FALSE); RADEONChangeSurfaces(pScrn); if (pScrn->pScreen) - xf86EnableDisableFBAccess(pScrn->scrnIndex, TRUE); + xf86EnableDisableFBAccess(XF86_ENABLEDISABLEFB_ARG(pScrn), TRUE); /* xf86SetRootClip would do, but can't access that here */ } diff --git a/driver/xf86-video-radeonold/src/compat-api.h b/driver/xf86-video-radeonold/src/compat-api.h new file mode 100644 index 000000000..28cdbebc2 --- /dev/null +++ b/driver/xf86-video-radeonold/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 <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 i, 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(flags) pScrn->scrnIndex, (flags) + +#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 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(flags) pScrn + +#define XF86_ENABLEDISABLEFB_ARG(x) (x) + +#endif + +#endif diff --git a/driver/xf86-video-radeonold/src/legacy_crtc.c b/driver/xf86-video-radeonold/src/legacy_crtc.c index 829b453e8..36d7494ec 100644 --- a/driver/xf86-video-radeonold/src/legacy_crtc.c +++ b/driver/xf86-video-radeonold/src/legacy_crtc.c @@ -1840,10 +1840,10 @@ legacy_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode, /* need to redraw front buffer, I guess this can be considered a hack ? */ /* if this is called during ScreenInit() we don't have pScrn->pScreen yet */ if (pScrn->pScreen) - xf86EnableDisableFBAccess(pScrn->scrnIndex, FALSE); + xf86EnableDisableFBAccess(XF86_ENABLEDISABLEFB_ARG(pScrn), FALSE); RADEONChangeSurfaces(pScrn); if (pScrn->pScreen) - xf86EnableDisableFBAccess(pScrn->scrnIndex, TRUE); + xf86EnableDisableFBAccess(XF86_ENABLEDISABLEFB_ARG(pScrn), TRUE); /* xf86SetRootClip would do, but can't access that here */ } diff --git a/driver/xf86-video-radeonold/src/radeon.h b/driver/xf86-video-radeonold/src/radeon.h index 342cf1c57..0c1c01b1e 100644 --- a/driver/xf86-video-radeonold/src/radeon.h +++ b/driver/xf86-video-radeonold/src/radeon.h @@ -90,6 +90,8 @@ #include "picturestr.h" #endif +#include "compat-api.h" + #include "atipcirename.h" #ifndef MAX @@ -471,7 +473,7 @@ struct radeon_dri { int numVisualConfigs; __GLXvisualConfig *pVisualConfigs; RADEONConfigPrivPtr pVisualConfigsPriv; - Bool (*DRICloseScreen)(int, ScreenPtr); + Bool (*DRICloseScreen)(CLOSE_SCREEN_ARGS_DECL); drm_handle_t fbHandle; @@ -758,9 +760,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)(BLOCKHANDLER_ARGS_DECL); Bool PaletteSavedOnVT; /* Palette saved on last VT switch */ @@ -871,7 +873,7 @@ typedef struct { unsigned char* BIOSCopy; Rotation rotation; - void (*PointerMoved)(int, int, int); + void (*PointerMoved)(SCRN_ARG_TYPE, int, int); CreateScreenResourcesProcPtr CreateScreenResources; /* if no devices are connected at server startup */ @@ -970,14 +972,14 @@ extern void RADEONCPFlushIndirect(ScrnInfoPtr pScrn, int discard); extern void RADEONCPReleaseIndirect(ScrnInfoPtr pScrn); extern int RADEONCPStop(ScrnInfoPtr pScrn, RADEONInfoPtr info); # ifdef USE_XAA -extern Bool RADEONSetupMemXAA_DRI(int scrnIndex, ScreenPtr pScreen); +extern Bool RADEONSetupMemXAA_DRI(ScreenPtr pScreen); # endif #endif #ifdef USE_XAA /* radeon_accelfuncs.c */ extern void RADEONAccelInitMMIO(ScreenPtr pScreen, XAAInfoRecPtr a); -extern Bool RADEONSetupMemXAA(int scrnIndex, ScreenPtr pScreen); +extern Bool RADEONSetupMemXAA(ScreenPtr pScreen); #endif /* radeon_bios.c */ diff --git a/driver/xf86-video-radeonold/src/radeon_accel.c b/driver/xf86-video-radeonold/src/radeon_accel.c index a9a484808..992f9241c 100644 --- a/driver/xf86-video-radeonold/src/radeon_accel.c +++ b/driver/xf86-video-radeonold/src/radeon_accel.c @@ -1085,7 +1085,7 @@ void RADEONInit3DEngine(ScrnInfoPtr pScrn) #ifdef USE_XAA #ifdef XF86DRI Bool -RADEONSetupMemXAA_DRI(int scrnIndex, ScreenPtr pScreen) +RADEONSetupMemXAA_DRI(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; RADEONInfoPtr info = RADEONPTR(pScrn); @@ -1262,7 +1262,7 @@ RADEONSetupMemXAA_DRI(int scrnIndex, ScreenPtr pScreen) MemBox.y2 = scanlines; if (!xf86InitFBManager(pScreen, &MemBox)) { - xf86DrvMsg(scrnIndex, X_ERROR, + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Memory manager initialization to " "(%d,%d) (%d,%d) failed\n", MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2); @@ -1270,7 +1270,7 @@ RADEONSetupMemXAA_DRI(int scrnIndex, ScreenPtr pScreen) } else { int width, height; - xf86DrvMsg(scrnIndex, X_INFO, + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Memory manager initialized to (%d,%d) (%d,%d)\n", MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2); /* why oh why can't we just request modes which are guaranteed to be 16 lines @@ -1282,19 +1282,19 @@ RADEONSetupMemXAA_DRI(int scrnIndex, ScreenPtr pScreen) - pScrn->virtualY + 2 : 2, 0, NULL, NULL, NULL))) { - xf86DrvMsg(scrnIndex, X_INFO, + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Reserved area from (%d,%d) to (%d,%d)\n", fbarea->box.x1, fbarea->box.y1, fbarea->box.x2, fbarea->box.y2); } else { - xf86DrvMsg(scrnIndex, X_ERROR, "Unable to reserve area\n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unable to reserve area\n"); } RADEONDRIAllocatePCIGARTTable(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); @@ -1308,28 +1308,28 @@ RADEONSetupMemXAA_DRI(int scrnIndex, ScreenPtr pScreen) - info->dri->depthTexLines); info->dri->backArea = NULL; } else { - xf86DrvMsg(scrnIndex, X_ERROR, + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unable to determine largest offscreen area " "available\n"); return FALSE; } } - xf86DrvMsg(scrnIndex, X_INFO, + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Will use front buffer at offset 0x%x\n", info->dri->frontOffset); - xf86DrvMsg(scrnIndex, X_INFO, + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Will use back buffer at offset 0x%x\n", info->dri->backOffset); - xf86DrvMsg(scrnIndex, X_INFO, + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Will use depth buffer at offset 0x%x\n", info->dri->depthOffset); if (info->cardType==CARD_PCIE) - xf86DrvMsg(scrnIndex, X_INFO, + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Will use %d kb for PCI GART table at offset 0x%x\n", info->dri->pciGartSize/1024, (unsigned)info->dri->pciGartOffset); - xf86DrvMsg(scrnIndex, X_INFO, + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Will use %d kb for textures at offset 0x%x\n", info->dri->textureSize/1024, info->dri->textureOffset); @@ -1346,7 +1346,7 @@ RADEONSetupMemXAA_DRI(int scrnIndex, ScreenPtr pScreen) #endif /* XF86DRI */ Bool -RADEONSetupMemXAA(int scrnIndex, ScreenPtr pScreen) +RADEONSetupMemXAA(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; RADEONInfoPtr info = RADEONPTR(pScrn); @@ -1371,7 +1371,7 @@ RADEONSetupMemXAA(int scrnIndex, ScreenPtr pScreen) MemBox.y2 = 8191; if (!xf86InitFBManager(pScreen, &MemBox)) { - xf86DrvMsg(scrnIndex, X_ERROR, + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Memory manager initialization to " "(%d,%d) (%d,%d) failed\n", MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2); @@ -1380,7 +1380,7 @@ RADEONSetupMemXAA(int scrnIndex, ScreenPtr pScreen) int width, height; FBAreaPtr fbarea; - xf86DrvMsg(scrnIndex, X_INFO, + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Memory manager initialized to (%d,%d) (%d,%d)\n", MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2); if ((fbarea = xf86AllocateOffscreenArea(pScreen, @@ -1390,16 +1390,16 @@ RADEONSetupMemXAA(int scrnIndex, ScreenPtr pScreen) - pScrn->virtualY + 2 : 2, 0, NULL, NULL, NULL))) { - xf86DrvMsg(scrnIndex, X_INFO, + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Reserved area from (%d,%d) to (%d,%d)\n", fbarea->box.x1, fbarea->box.y1, fbarea->box.x2, fbarea->box.y2); } else { - xf86DrvMsg(scrnIndex, X_ERROR, "Unable to reserve area\n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unable to reserve area\n"); } 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); } diff --git a/driver/xf86-video-radeonold/src/radeon_dga.c b/driver/xf86-video-radeonold/src/radeon_dga.c index 6b0fabea9..97ffdb838 100644 --- a/driver/xf86-video-radeonold/src/radeon_dga.c +++ b/driver/xf86-video-radeonold/src/radeon_dga.c @@ -105,7 +105,7 @@ SECOND_PASS: if (secondPitch) pitch = secondPitch; - if (!(newmodes = xrealloc(modes, (*num + 1) * sizeof(DGAModeRec)))) + if (!(newmodes = realloc(modes, (*num + 1) * sizeof(DGAModeRec)))) break; modes = newmodes; @@ -161,7 +161,7 @@ SECOND_PASS: currentMode->yViewportStep = 1; currentMode->viewportFlags = DGA_FLIP_RETRACE; currentMode->offset = 0; - currentMode->address = (unsigned char*)info->LinearAddr; + currentMode->address = (unsigned char*)(uintptr_t)info->LinearAddr; currentMode->bytesPerScanline = pitch * Bpp; currentMode->imageWidth = pitch; currentMode->imageHeight = (info->FbMapSize @@ -298,7 +298,7 @@ static Bool RADEON_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode) pScrn->currentMode = info->CurrentLayout.mode; - RADEONSwitchMode(indx, pScrn->currentMode, 0); + RADEONSwitchMode(SWITCH_MODE_ARGS(pScrn, pScrn->currentMode)); #ifdef XF86DRI if (info->directRenderingEnabled) { RADEONCP_STOP(pScrn, info); @@ -311,7 +311,7 @@ static Bool RADEON_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode) RADEONCP_START(pScrn, info); } #endif - RADEONAdjustFrame(indx, 0, 0, 0); + RADEONAdjustFrame(ADJUST_FRAME_ARGS(pScrn, 0, 0)); info->DGAactive = FALSE; } else { if (!info->DGAactive) { /* save the old parameters */ @@ -330,7 +330,7 @@ static Bool RADEON_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode) : pMode->depth); /* RADEONModeInit() will set the mode field */ - RADEONSwitchMode(indx, pMode->mode, 0); + RADEONSwitchMode(SWITCH_MODE_ARGS(pScrn, pMode->mode)); #ifdef XF86DRI if (info->directRenderingEnabled) { @@ -360,7 +360,7 @@ static void RADEON_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags) { RADEONInfoPtr info = RADEONPTR(pScrn); - RADEONAdjustFrame(pScrn->pScreen->myNum, x, y, flags); + RADEONAdjustFrame(ADJUST_FRAME_ARGS(pScrn, x, y)); info->DGAViewportStatus = 0; /* FIXME */ } @@ -457,7 +457,7 @@ static Bool RADEON_OpenFramebuffer(ScrnInfoPtr pScrn, RADEONInfoPtr info = RADEONPTR(pScrn); *name = NULL; /* no special device */ - *mem = (unsigned char*)info->LinearAddr; + *mem = (unsigned char*)(uintptr_t)info->LinearAddr; *size = info->FbMapSize; *offset = 0; *flags = 0; /* DGA_NEED_ROOT; -- don't need root, just /dev/mem access */ diff --git a/driver/xf86-video-radeonold/src/radeon_dri.c b/driver/xf86-video-radeonold/src/radeon_dri.c index 1d96ca48c..c20c88751 100644 --- a/driver/xf86-video-radeonold/src/radeon_dri.c +++ b/driver/xf86-video-radeonold/src/radeon_dri.c @@ -1560,7 +1560,7 @@ Bool RADEONDRIScreenInit(ScreenPtr pScreen) pDRIInfo->ddxDriverMajorVersion = info->allowColorTiling ? 5 : 4; pDRIInfo->ddxDriverMinorVersion = 3; pDRIInfo->ddxDriverPatchVersion = 0; - pDRIInfo->frameBufferPhysicalAddress = (void *)info->LinearAddr + info->dri->frontOffset; + pDRIInfo->frameBufferPhysicalAddress = (void *)(uintptr_t)info->LinearAddr + info->dri->frontOffset; pDRIInfo->frameBufferSize = info->FbMapSize - info->FbSecureSize; pDRIInfo->frameBufferStride = (pScrn->displayWidth * info->CurrentLayout.pixel_bytes); @@ -1691,7 +1691,7 @@ Bool RADEONDRIScreenInit(ScreenPtr pScreen) return TRUE; } -static Bool RADEONDRIDoCloseScreen(int scrnIndex, ScreenPtr pScreen) +static Bool RADEONDRIDoCloseScreen(CLOSE_SCREEN_ARGS_DECL) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; RADEONInfoPtr info = RADEONPTR(pScrn); @@ -1699,7 +1699,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/driver/xf86-video-radeonold/src/radeon_driver.c b/driver/xf86-video-radeonold/src/radeon_driver.c index bf3e64dd5..4c34863ed 100644 --- a/driver/xf86-video-radeonold/src/radeon_driver.c +++ b/driver/xf86-video-radeonold/src/radeon_driver.c @@ -122,7 +122,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); @@ -3233,15 +3233,14 @@ static void RADEONLoadPalette(ScrnInfoPtr pScrn, int numColors, #endif } -static void RADEONBlockHandler(int i, pointer blockData, - pointer pTimeout, pointer pReadmask) +static void RADEONBlockHandler(BLOCKHANDLER_ARGS_DECL) { - 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) (BLOCKHANDLER_ARGS); pScreen->BlockHandler = RADEONBlockHandler; if (info->VideoTimerCallback) @@ -3258,9 +3257,9 @@ static void RADEONBlockHandler(int i, pointer blockData, } static void -RADEONPointerMoved(int index, int x, int y) +RADEONPointerMoved(SCRN_ARG_TYPE arg, int x, int y) { - ScrnInfoPtr pScrn = xf86Screens[index]; + SCRN_INFO_PTR(arg); RADEONInfoPtr info = RADEONPTR(pScrn); int newX = x, newY = y; @@ -3281,7 +3280,7 @@ RADEONPointerMoved(int index, int x, int y) break; } - (*info->PointerMoved)(index, newX, newY); + (*info->PointerMoved)(arg, newX, newY); } static void @@ -3332,10 +3331,9 @@ 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_DECL) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); RADEONInfoPtr info = RADEONPTR(pScrn); int hasDRI = 0; #ifdef RENDER @@ -3533,14 +3531,14 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, info->dri->textureSize = -1; } } - if (!RADEONSetupMemXAA_DRI(scrnIndex, pScreen)) + if (!RADEONSetupMemXAA_DRI(pScreen)) return FALSE; pScrn->fbOffset = info->dri->frontOffset; } #endif #ifdef USE_XAA - if (!info->useEXA && !hasDRI && !RADEONSetupMemXAA(scrnIndex, pScreen)) + if (!info->useEXA && !hasDRI && !RADEONSetupMemXAA(pScreen)) return FALSE; #endif @@ -3562,9 +3560,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 * @@ -3713,16 +3711,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; } @@ -3749,19 +3747,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 */ @@ -5347,9 +5345,9 @@ static Bool RADEONSaveScreen(ScreenPtr pScreen, int mode) return TRUE; } -Bool RADEONSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) +Bool RADEONSwitchMode(SWITCH_MODE_ARGS_DECL) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SCRN_INFO_PTR(arg); RADEONInfoPtr info = RADEONPTR(pScrn); Bool tilingOld = info->tilingEnabled; Bool ret; @@ -5386,9 +5384,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 */ } @@ -5443,10 +5441,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); @@ -5590,9 +5588,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(ADJUST_FRAME_ARGS_DECL) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SCRN_INFO_PTR(arg); RADEONInfoPtr info = RADEONPTR(pScrn); RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); @@ -5628,9 +5626,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(VT_FUNC_ARGS_DECL) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SCRN_INFO_PTR(arg); RADEONInfoPtr info = RADEONPTR(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); int i; @@ -5736,9 +5734,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(VT_FUNC_ARGS_DECL) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SCRN_INFO_PTR(arg); RADEONInfoPtr info = RADEONPTR(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); int i; @@ -5821,9 +5819,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; @@ -5908,12 +5906,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(FREE_SCREEN_ARGS_DECL) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SCRN_INFO_PTR(arg); RADEONInfoPtr info = RADEONPTR(pScrn); xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, diff --git a/driver/xf86-video-radeonold/src/radeon_probe.h b/driver/xf86-video-radeonold/src/radeon_probe.h index 0dd34cfcf..02b2bac81 100644 --- a/driver/xf86-video-radeonold/src/radeon_probe.h +++ b/driver/xf86-video-radeonold/src/radeon_probe.h @@ -43,6 +43,7 @@ #include "xf86Crtc.h" +#include "compat-api.h" #ifdef USE_EXA #include "exa.h" #endif @@ -619,17 +620,17 @@ 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_DECL); +extern Bool RADEONSwitchMode(SWITCH_MODE_ARGS_DECL); #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(ADJUST_FRAME_ARGS_DECL); +extern Bool RADEONEnterVT(VT_FUNC_ARGS_DECL); +extern void RADEONLeaveVT(VT_FUNC_ARGS_DECL); +extern void RADEONFreeScreen(FREE_SCREEN_ARGS_DECL); +extern ModeStatus RADEONValidMode(SCRN_ARG_TYPE, DisplayModePtr, Bool, int); extern const OptionInfoRec *RADEONOptionsWeak(void); |