diff options
author | Will Thompson <will@willthompson.co.uk> | 2012-04-24 16:54:18 +0100 |
---|---|---|
committer | Will Thompson <will@willthompson.co.uk> | 2012-04-25 15:08:27 +0100 |
commit | 65d48c9a0362c00537cd26668b68334c3ab0e769 (patch) | |
tree | ff27cacdcd3e339a6ba06e0080be23469f0843c5 | |
parent | 18cbc9d9f635bee9d6e20f1de59b065ae10cede8 (diff) |
Forward-declare main struct in a header
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/videocore.c | 29 | ||||
-rw-r--r-- | src/videocore.h | 32 |
3 files changed, 47 insertions, 15 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 994caba..0fe614c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -30,6 +30,7 @@ videocore_drv_ladir = @moduledir@/drivers videocore_drv_la_SOURCES = \ videocore.c \ + videocore.h \ videocore-debug.h # vim: set et : diff --git a/src/videocore.c b/src/videocore.c index 379c2e8..2738978 100644 --- a/src/videocore.c +++ b/src/videocore.c @@ -37,6 +37,7 @@ #include <pciaccess.h> #endif +#include "videocore.h" #include "videocore-debug.h" Bool videoCoreDebug = 0; @@ -172,7 +173,7 @@ VideoCoreSetup(pointer module, pointer opts, int *errmaj, int *errmin) /* -------------------------------------------------------------------- */ /* our private data, and two functions to allocate/free this */ -typedef struct { +struct _VideoCoreRec { unsigned char* fbstart; unsigned char* fbmem; int fboff; @@ -188,9 +189,7 @@ typedef struct { DGAModePtr pDGAMode; int nDGAMode; OptionInfoPtr Options; -} FBDevRec, *FBDevPtr; - -#define FBDEVPTR(p) ((FBDevPtr)((p)->driverPrivate)) +}; static Bool FBDevGetRec(ScrnInfoPtr pScrn) @@ -198,7 +197,7 @@ FBDevGetRec(ScrnInfoPtr pScrn) if (pScrn->driverPrivate != NULL) return TRUE; - pScrn->driverPrivate = xnfcalloc(sizeof(FBDevRec), 1); + pScrn->driverPrivate = xnfcalloc(sizeof(VideoCoreRec), 1); return TRUE; } @@ -386,7 +385,7 @@ FBDevProbe(DriverPtr drv, int flags) static Bool FBDevPreInit(ScrnInfoPtr pScrn, int flags) { - FBDevPtr fPtr; + VideoCorePtr fPtr; int default_depth, fbbpp; const char *s; int type; @@ -402,7 +401,7 @@ FBDevPreInit(ScrnInfoPtr pScrn, int flags) pScrn->monitor = pScrn->confScreen->monitor; FBDevGetRec(pScrn); - fPtr = FBDEVPTR(pScrn); + fPtr = VIDEOCOREPTR(pScrn); fPtr->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); @@ -607,7 +606,7 @@ FBDevCreateScreenResources(ScreenPtr pScreen) { PixmapPtr pPixmap; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - FBDevPtr fPtr = FBDEVPTR(pScrn); + VideoCorePtr fPtr = VIDEOCOREPTR(pScrn); Bool ret; pScreen->CreateScreenResources = fPtr->CreateScreenResources; @@ -632,7 +631,7 @@ static Bool FBDevShadowInit(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - FBDevPtr fPtr = FBDEVPTR(pScrn); + VideoCorePtr fPtr = VIDEOCOREPTR(pScrn); if (!shadowSetup(pScreen)) { return FALSE; @@ -649,7 +648,7 @@ static Bool FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - FBDevPtr fPtr = FBDEVPTR(pScrn); + VideoCorePtr fPtr = VIDEOCOREPTR(pScrn); VisualPtr visual; int init_picture = 0; int ret, flags; @@ -911,7 +910,7 @@ static Bool FBDevCloseScreen(int scrnIndex, ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - FBDevPtr fPtr = FBDEVPTR(pScrn); + VideoCorePtr fPtr = VIDEOCOREPTR(pScrn); fbdevHWRestore(pScrn); fbdevHWUnmapVidmem(pScrn); @@ -943,7 +942,7 @@ FBDevWindowLinear(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, CARD32 *size, void *closure) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - FBDevPtr fPtr = FBDEVPTR(pScrn); + VideoCorePtr fPtr = VIDEOCOREPTR(pScrn); if (!pScrn->vtSema) return NULL; @@ -960,7 +959,7 @@ static void FBDevPointerMoved(int index, int x, int y) { ScrnInfoPtr pScrn = xf86Screens[index]; - FBDevPtr fPtr = FBDEVPTR(pScrn); + VideoCorePtr fPtr = VIDEOCOREPTR(pScrn); int newX, newY; switch (fPtr->rotate) @@ -1073,7 +1072,7 @@ static DGAFunctionRec FBDevDGAFunctions = static void FBDevDGAAddModes(ScrnInfoPtr pScrn) { - FBDevPtr fPtr = FBDEVPTR(pScrn); + VideoCorePtr fPtr = VIDEOCOREPTR(pScrn); DisplayModePtr pMode = pScrn->modes; DGAModePtr pDGAMode; @@ -1127,7 +1126,7 @@ static Bool FBDevDGAInit(ScrnInfoPtr pScrn, ScreenPtr pScreen) { #ifdef XFreeXDGA - FBDevPtr fPtr = FBDEVPTR(pScrn); + VideoCorePtr fPtr = VIDEOCOREPTR(pScrn); if (pScrn->depth < 8) return FALSE; diff --git a/src/videocore.h b/src/videocore.h new file mode 100644 index 0000000..c67b62d --- /dev/null +++ b/src/videocore.h @@ -0,0 +1,32 @@ +/* vim: set noet sw=8 sts=8 cino=:0,t0,(0 : + * + * Copyright © 2012 Collabora Ltd. + * + * 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 fur- + * nished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice 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, FIT- + * NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- + * NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef VIDEOCORE_H +#define VIDEOCORE_H + +typedef struct _VideoCoreRec VideoCoreRec, *VideoCorePtr; + +/* @p: a ScrnInfoPtr + */ +#define VIDEOCOREPTR(p) ((VideoCorePtr)((p)->driverPrivate)) + +#endif /* VIDEOCORE_H */ |