diff options
Diffstat (limited to 'xorg-server/hw/kdrive/src')
-rw-r--r-- | xorg-server/hw/kdrive/src/kdrive.c | 4 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/src/kdrive.h | 1 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/src/kxv.c | 81 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/src/kxv.h | 23 |
4 files changed, 26 insertions, 83 deletions
diff --git a/xorg-server/hw/kdrive/src/kdrive.c b/xorg-server/hw/kdrive/src/kdrive.c index 7b082d322..bd2238fda 100644 --- a/xorg-server/hw/kdrive/src/kdrive.c +++ b/xorg-server/hw/kdrive/src/kdrive.c @@ -623,8 +623,12 @@ KdCloseScreen(ScreenPtr pScreen) KdCardInfo *card = pScreenPriv->card; Bool ret; + if (card->cfuncs->closeScreen) + (*card->cfuncs->closeScreen)(pScreen); + pScreenPriv->closed = TRUE; pScreen->CloseScreen = pScreenPriv->CloseScreen; + if (pScreen->CloseScreen) ret = (*pScreen->CloseScreen) (pScreen); else diff --git a/xorg-server/hw/kdrive/src/kdrive.h b/xorg-server/hw/kdrive/src/kdrive.h index 5b2f3378b..5f5e50b29 100644 --- a/xorg-server/hw/kdrive/src/kdrive.h +++ b/xorg-server/hw/kdrive/src/kdrive.h @@ -130,6 +130,7 @@ typedef struct _KdCardFuncs { void (*getColors) (ScreenPtr, int, xColorItem *); void (*putColors) (ScreenPtr, int, xColorItem *); + void (*closeScreen) (ScreenPtr); /* close ScreenRec */ } KdCardFuncs; #define KD_MAX_PSEUDO_DEPTH 8 diff --git a/xorg-server/hw/kdrive/src/kxv.c b/xorg-server/hw/kdrive/src/kxv.c index 9cc0edd8a..60a83458c 100644 --- a/xorg-server/hw/kdrive/src/kxv.c +++ b/xorg-server/hw/kdrive/src/kxv.c @@ -98,7 +98,7 @@ static void KdXVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2); static void KdXVClipNotify(WindowPtr pWin, int dx, int dy); /* misc */ -static Bool KdXVInitAdaptors(ScreenPtr, KdVideoAdaptorPtr *, int); +static Bool KdXVInitAdaptors(ScreenPtr, KdVideoAdaptorPtr, int); static DevPrivateKeyRec KdXVWindowKeyRec; @@ -116,49 +116,6 @@ static unsigned long PortResource = 0; #define GET_KDXV_WINDOW(pWin) ((KdXVWindowPtr) \ dixLookupPrivate(&(pWin)->devPrivates, KdXVWindowKey)) -static KdXVInitGenericAdaptorPtr *GenDrivers = NULL; -static int NumGenDrivers = 0; - -int -KdXVRegisterGenericAdaptorDriver(KdXVInitGenericAdaptorPtr InitFunc) -{ - KdXVInitGenericAdaptorPtr *newdrivers; - -/* fprintf(stderr,"KdXVRegisterGenericAdaptorDriver\n"); */ - - newdrivers = realloc(GenDrivers, sizeof(KdXVInitGenericAdaptorPtr) * - (1 + NumGenDrivers)); - if (!newdrivers) - return 0; - GenDrivers = newdrivers; - - GenDrivers[NumGenDrivers++] = InitFunc; - - return 1; -} - -int -KdXVListGenericAdaptors(KdScreenInfo * screen, KdVideoAdaptorPtr ** adaptors) -{ - int i, j, n, num; - KdVideoAdaptorPtr *DrivAdap, *new; - - num = 0; - *adaptors = NULL; - for (i = 0; i < NumGenDrivers; i++) { - n = GenDrivers[i] (screen, &DrivAdap); - if (0 == n) - continue; - new = realloc(*adaptors, sizeof(KdVideoAdaptorPtr) * (num + n)); - if (NULL == new) - continue; - *adaptors = new; - for (j = 0; j < n; j++, num++) - (*adaptors)[num] = DrivAdap[j]; - } - return num; -} - KdVideoAdaptorPtr KdXVAllocateVideoAdaptorRec(KdScreenInfo * screen) { @@ -172,7 +129,7 @@ KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr) } Bool -KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr * adaptors, int num) +KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num) { KdXVScreenPtr ScreenPriv; XvScreenPtr pxvs; @@ -282,7 +239,7 @@ KdXVFreeAdaptor(XvAdaptorPtr pAdaptor) } static Bool -KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr * infoPtr, int number) +KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr infoPtr, int number) { KdScreenPriv(pScreen); KdScreenInfo *screen = pScreenPriv->screen; @@ -295,15 +252,11 @@ KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr * infoPtr, int number) XvPortRecPrivatePtr portPriv; XvPortPtr pPort, pp; int numPort; - KdAttributePtr attributePtr; - XvAttributePtr pAttribute, pat; KdVideoFormatPtr formatPtr; XvFormatPtr pFormat, pf; int numFormat, totFormat; KdVideoEncodingPtr encodingPtr; XvEncodingPtr pEncode, pe; - KdImagePtr imagePtr; - XvImagePtr pImage, pi; int numVisuals; VisualPtr pVisual; int i; @@ -315,7 +268,7 @@ KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr * infoPtr, int number) return FALSE; for (pa = pAdaptor, na = 0, numAdaptor = 0; na < number; na++, adaptorPtr++) { - adaptorPtr = infoPtr[na]; + adaptorPtr = &infoPtr[na]; if (!adaptorPtr->StopVideo || !adaptorPtr->SetPortAttribute || !adaptorPtr->GetPortAttribute || !adaptorPtr->QueryBestSize) @@ -381,26 +334,24 @@ KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr * infoPtr, int number) } if (adaptorPtr->nImages && - (pImage = calloc(adaptorPtr->nImages, sizeof(XvImageRec)))) { - - for (i = 0, pi = pImage, imagePtr = adaptorPtr->pImages; - i < adaptorPtr->nImages; i++, pi++, imagePtr++) { - memcpy(pi, imagePtr, sizeof(*pi)); - } + (pa->pImages = calloc(adaptorPtr->nImages, sizeof(XvImageRec)))) { + memcpy(pa->pImages, adaptorPtr->pImages, + adaptorPtr->nImages * sizeof(XvImageRec)); pa->nImages = adaptorPtr->nImages; - pa->pImages = pImage; } if (adaptorPtr->nAttributes && - (pAttribute = - calloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec)))) { - for (pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = - 0; i < adaptorPtr->nAttributes; pat++, i++, attributePtr++) { - memcpy(pat, attributePtr, sizeof(*pat)); - pat->name = strdup(attributePtr->name); + (pa->pAttributes = calloc(adaptorPtr->nAttributes, + sizeof(XvAttributeRec)))) { + memcpy(pa->pAttributes, adaptorPtr->pAttributes, + adaptorPtr->nAttributes * sizeof(XvAttributeRec)); + + for (i = 0; i < adaptorPtr->nAttributes; i++) { + pa->pAttributes[i].name = + strdup(adaptorPtr->pAttributes[i].name); } + pa->nAttributes = adaptorPtr->nAttributes; - pa->pAttributes = pAttribute; } totFormat = adaptorPtr->nFormats; diff --git a/xorg-server/hw/kdrive/src/kxv.h b/xorg-server/hw/kdrive/src/kxv.h index 85a030ee9..3a49a659f 100644 --- a/xorg-server/hw/kdrive/src/kxv.h +++ b/xorg-server/hw/kdrive/src/kxv.h @@ -56,8 +56,6 @@ of the copyright holder. #define VIDEO_OVERLAID_STILLS 0x00000008 #define VIDEO_CLIP_TO_VIEWPORT 0x00000010 -typedef XvImageRec KdImageRec, *KdImagePtr; - typedef struct { KdScreenInfo *screen; int id; @@ -121,7 +119,7 @@ typedef enum { typedef struct { int id; - char *name; + const char *name; unsigned short width, height; XvRationalRec rate; } KdVideoEncodingRec, *KdVideoEncodingPtr; @@ -131,12 +129,10 @@ typedef struct { short class; } KdVideoFormatRec, *KdVideoFormatPtr; -typedef XvAttributeRec KdAttributeRec, *KdAttributePtr; - typedef struct { unsigned int type; int flags; - char *name; + const char *name; int nEncodings; KdVideoEncodingPtr pEncodings; int nFormats; @@ -144,9 +140,9 @@ typedef struct { int nPorts; DevUnion *pPortPrivates; int nAttributes; - KdAttributePtr pAttributes; + XvAttributePtr pAttributes; int nImages; - KdImagePtr pImages; + XvImagePtr pImages; PutVideoFuncPtr PutVideo; PutStillFuncPtr PutStill; GetVideoFuncPtr GetVideo; @@ -161,16 +157,7 @@ typedef struct { } KdVideoAdaptorRec, *KdVideoAdaptorPtr; Bool - KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr * Adaptors, int num); - -typedef int (*KdXVInitGenericAdaptorPtr) (KdScreenInfo * screen, - KdVideoAdaptorPtr ** Adaptors); - -int - KdXVRegisterGenericAdaptorDriver(KdXVInitGenericAdaptorPtr InitFunc); - -int - KdXVListGenericAdaptors(KdScreenInfo * screen, KdVideoAdaptorPtr ** Adaptors); + KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr Adaptors, int num); void |