diff options
Diffstat (limited to 'xorg-server/hw/kdrive/src')
-rw-r--r-- | xorg-server/hw/kdrive/src/kinfo.c | 36 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/src/kinput.c | 85 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/src/kxv.c | 303 |
3 files changed, 207 insertions, 217 deletions
diff --git a/xorg-server/hw/kdrive/src/kinfo.c b/xorg-server/hw/kdrive/src/kinfo.c index 4551fd76b..95afc7963 100644 --- a/xorg-server/hw/kdrive/src/kinfo.c +++ b/xorg-server/hw/kdrive/src/kinfo.c @@ -138,40 +138,28 @@ KdFreePointer(KdPointerInfo *pi) { InputOption *option, *prev = NULL; - if (pi->name) - xfree(pi->name); - if (pi->path) - xfree(pi->path); + xfree(pi->name); + xfree(pi->path); for (option = pi->options; option; option = option->next) { - if (prev) - xfree(prev); - if (option->key) - xfree(option->key); - if (option->value) - xfree(option->value); + xfree(prev); + xfree(option->key); + xfree(option->value); prev = option; } - if (prev) - xfree(prev); - + xfree(prev); xfree(pi); } - + void KdFreeKeyboard(KdKeyboardInfo *ki) { - if (ki->name) - xfree(ki->name); - if (ki->path) - xfree(ki->path); - if (ki->xkbRules) - xfree(ki->xkbRules); - if (ki->xkbModel) - xfree(ki->xkbModel); - if (ki->xkbLayout) - xfree(ki->xkbLayout); + xfree(ki->name); + xfree(ki->path); + xfree(ki->xkbRules); + xfree(ki->xkbModel); + xfree(ki->xkbLayout); ki->next = NULL; xfree(ki); } diff --git a/xorg-server/hw/kdrive/src/kinput.c b/xorg-server/hw/kdrive/src/kinput.c index 65fc75a54..a88f2dc61 100644 --- a/xorg-server/hw/kdrive/src/kinput.c +++ b/xorg-server/hw/kdrive/src/kinput.c @@ -76,7 +76,7 @@ static KdPointerMatrix kdPointerMatrix = { }; void KdResetInputMachine (void); - + #define KD_MAX_INPUT_FDS 8 typedef struct _kdInputFd { @@ -105,7 +105,7 @@ static void KdBlockSigio (void) { sigset_t set; - + sigemptyset (&set); sigaddset (&set, SIGIO); sigprocmask (SIG_BLOCK, &set, 0); @@ -115,7 +115,7 @@ static void KdUnblockSigio (void) { sigset_t set; - + sigemptyset (&set); sigaddset (&set, SIGIO); sigprocmask (SIG_UNBLOCK, &set, 0); @@ -175,7 +175,7 @@ KdAddFd (int fd) { struct sigaction act; sigset_t set; - + kdnFds++; fcntl (fd, F_SETOWN, getpid()); KdNonBlockFd (fd); @@ -196,7 +196,7 @@ KdRemoveFd (int fd) { struct sigaction act; int flags; - + kdnFds--; RemoveEnabledDevice (fd); flags = fcntl (fd, F_GETFL); @@ -324,7 +324,7 @@ KdEnableInput (void) InternalEvent ev; KdKeyboardInfo *ki; KdPointerInfo *pi; - + kdInputEnabled = TRUE; for (ki = kdKeyboards; ki; ki = ki->next) { @@ -352,7 +352,7 @@ KdFindKeyboardDriver (char *name) /* ask a stupid question ... */ if (!name) return NULL; - + for (ret = kdKeyboardDrivers; ret; ret = ret->next) { if (strcmp(ret->name, name) == 0) return ret; @@ -487,11 +487,11 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff) pi->name ? pi->name : "Generic KDrive Pointer"); return Success; - + case DEVICE_ON: if (pDev->on == TRUE) return Success; - + if (!pi->driver->Enable) { ErrorF("no enable function\n"); return BadImplementation; @@ -538,7 +538,7 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff) (*pi->driver->Fini) (pi); KdRemovePointer(pi); - + return Success; } @@ -557,7 +557,7 @@ KdBell (int volume, DeviceIntPtr pDev, pointer arg, int something) { KeybdCtrl *ctrl = arg; KdKeyboardInfo *ki = NULL; - + for (ki = kdKeyboards; ki; ki = ki->next) { if (ki->dixdev && ki->dixdev->id == pDev->id) break; @@ -565,7 +565,7 @@ KdBell (int volume, DeviceIntPtr pDev, pointer arg, int something) if (!ki || !ki->dixdev || ki->dixdev->id != pDev->id || !ki->driver) return; - + KdRingBell(ki, volume, ctrl->bell_pitch, ctrl->bell_duration); } @@ -590,7 +590,7 @@ KdRingBell(KdKeyboardInfo *ki, int volume, int pitch, int duration) { if (!ki || !ki->driver || !ki->driver->Bell) return; - + if (kdInputEnabled) (*ki->driver->Bell) (ki, volume, pitch, duration); } @@ -691,7 +691,7 @@ KdKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl) KdSetLeds(ki, ctrl->leds); ki->bellPitch = ctrl->bell_pitch; - ki->bellDuration = ctrl->bell_duration; + ki->bellDuration = ctrl->bell_duration; } extern KeybdCtrl defaultKeyboardControl; @@ -794,7 +794,7 @@ KdKeyboardProc(DeviceIntPtr pDevice, int onoff) pDev->on = FALSE; return Success; - + break; case DEVICE_CLOSE: @@ -935,7 +935,7 @@ KdAddKeyboard (KdKeyboardInfo *ki) if (!ki) return !Success; - + ki->dixdev = AddInputDevice(serverClient, KdKeyboardProc, TRUE); if (!ki->dixdev) { ErrorF("Couldn't register keyboard device %s\n", @@ -1042,12 +1042,12 @@ KdRemovePointer (KdPointerInfo *pi) KdFreePointer(pi); } -/* +/* * You can call your kdriver server with something like: * $ ./hw/kdrive/yourserver/X :1 -mouse evdev,,device=/dev/input/event4 -keybd - * evdev,,device=/dev/input/event1,xkbmodel=abnt2,xkblayout=br + * evdev,,device=/dev/input/event1,xkbmodel=abnt2,xkblayout=br */ -static Bool +static Bool KdGetOptions (InputOption **options, char *string) { InputOption *newopt = NULL, **tmpo = NULL; @@ -1058,7 +1058,7 @@ KdGetOptions (InputOption **options, char *string) return FALSE; for (tmpo = options; *tmpo; tmpo = &(*tmpo)->next) - ; /* Hello, I'm here */ + ; /* Hello, I'm here */ *tmpo = newopt; if (strchr(string, '=')) @@ -1099,7 +1099,7 @@ KdParseKbdOptions (KdKeyboardInfo *ki) else if (!strcasecmp (option->key, "device")) ki->path = strdup(option->value); else - ErrorF("Kbd option key (%s) of value (%s) not assigned!\n", + ErrorF("Kbd option key (%s) of value (%s) not assigned!\n", option->key, option->value); } } @@ -1160,11 +1160,11 @@ KdParseKeyboard (char *arg) { arg = KdParseFindNext (arg, ",", save, &delim); - if (!KdGetOptions(&options, save)) + if (!KdGetOptions(&options, save)) { KdFreeKeyboard(ki); return NULL; - } + } } if (options) @@ -1196,7 +1196,7 @@ KdParsePointerOptions (KdPointerInfo *pi) else if (!strcasecmp (option->key, "protocol")) pi->protocol = strdup(option->value); else - ErrorF("Pointer option key (%s) of value (%s) not assigned!\n", + ErrorF("Pointer option key (%s) of value (%s) not assigned!\n", option->key, option->value); } } @@ -1448,7 +1448,7 @@ KdInitInput (void) * <> -> (deliver) synthetic_2_down_1 * k -> (deliver) synthetic_2_down_1 */ - + typedef enum _inputClass { down_1, up_1, down_2, up_2, @@ -1628,7 +1628,7 @@ KdInsideEmulationWindow (KdPointerInfo *pi, int x, int y, int z) return (abs (pi->emulationDx) < EMULATION_WINDOW && abs (pi->emulationDy) < EMULATION_WINDOW); } - + static KdInputClass KdClassifyInput (KdPointerInfo *pi, int type, int x, int y, int z, int b) { @@ -1906,7 +1906,7 @@ KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry, if (!pi) return; - + ms = GetTimeInMillis(); /* we don't need to transform z, so we don't. */ @@ -2001,7 +2001,7 @@ KdBlockHandler (int screen, if (pi->timeoutPending) { int ms; - + ms = pi->emulationTimeout - GetTimeInMillis (); if (ms < 1) ms = 1; @@ -2020,7 +2020,7 @@ KdBlockHandler (int screen, } void -KdWakeupHandler (int screen, +KdWakeupHandler (int screen, pointer data, unsigned long lresult, pointer readmask) @@ -2029,7 +2029,7 @@ KdWakeupHandler (int screen, fd_set *pReadmask = (fd_set *) readmask; int i; KdPointerInfo *pi; - + if (kdInputEnabled && result > 0) { for (i = 0; i < kdNumInputFds; i++) @@ -2069,13 +2069,13 @@ KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y) int best_x, best_y; int n_best_x, n_best_y; CARD32 ms; - + if (kdDisableZaphod || screenInfo.numScreens <= 1) return FALSE; if (0 <= *x && *x < pScreen->width && 0 <= *y && *y < pScreen->height) return FALSE; - + ms = GetTimeInMillis (); if (kdOffScreen && (int) (ms - kdOffScreenTime) < 1000) return FALSE; @@ -2088,7 +2088,7 @@ KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y) for (n = 0; n < screenInfo.numScreens; n++) { pNewScreen = screenInfo.screens[n]; - if (pNewScreen == pScreen) + if (pNewScreen == pScreen) continue; dx = KdScreenOrigin(pNewScreen)->x - KdScreenOrigin(pScreen)->x; dy = KdScreenOrigin(pNewScreen)->y - KdScreenOrigin(pScreen)->y; @@ -2130,17 +2130,17 @@ KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y) if (n_best_x == -1) return FALSE; pNewScreen = screenInfo.screens[n_best_x]; - + if (*x < 0) *x += pNewScreen->width; if (*y < 0) *y += pNewScreen->height; - + if (*x >= pScreen->width) *x -= pScreen->width; if (*y >= pScreen->height) *y -= pScreen->height; - + *ppScreen = pNewScreen; return TRUE; } @@ -2167,7 +2167,7 @@ KdWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) KdUnblockSigio (); } -miPointerScreenFuncRec kdPointerScreenFuncs = +miPointerScreenFuncRec kdPointerScreenFuncs = { KdCursorOffScreen, KdCrossScreen, @@ -2249,7 +2249,8 @@ ChangeDeviceControl(register ClientPtr client, DeviceIntPtr pDev, } int -NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev) +NewInputDeviceRequest(InputOption *options, InputAttributes *attrs, + DeviceIntPtr *pdev) { InputOption *option = NULL; KdPointerInfo *pi = NULL; @@ -2280,6 +2281,14 @@ NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev) return BadValue; } #endif +#ifdef CONFIG_UDEV + else if (strcmp(option->key, "_source") == 0 && + strcmp(option->value, "server/udev") == 0) + { + ErrorF("Ignoring device from udev.\n"); + return BadValue; + } +#endif } if (!ki && !pi) { diff --git a/xorg-server/hw/kdrive/src/kxv.c b/xorg-server/hw/kdrive/src/kxv.c index 9a74654af..27ecc5d6c 100644 --- a/xorg-server/hw/kdrive/src/kxv.c +++ b/xorg-server/hw/kdrive/src/kxv.c @@ -1,6 +1,6 @@ -/* +/* - XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com) + XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com) Adapted for KDrive by Pontus Lidman <pontus.lidman@nokia.com> Copyright (C) 2000, 2001 - Nokia Home Communications @@ -67,29 +67,29 @@ static int KdXVQueryAdaptors(ScreenPtr, XvAdaptorPtr *, int *); static int KdXVAllocatePort(unsigned long, XvPortPtr, XvPortPtr*); static int KdXVFreePort(XvPortPtr); static int KdXVPutVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); static int KdXVPutStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); static int KdXVGetVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); static int KdXVGetStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); static int KdXVStopVideo(ClientPtr, XvPortPtr, DrawablePtr); static int KdXVSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32); static int KdXVGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32 *); static int KdXVQueryBestSize(ClientPtr, XvPortPtr, CARD8, - CARD16, CARD16,CARD16, CARD16, + CARD16, CARD16,CARD16, CARD16, unsigned int*, unsigned int*); static int KdXVPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16, XvImagePtr, unsigned char*, Bool, CARD16, CARD16); -static int KdXVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr, +static int KdXVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr, CARD16*, CARD16*, int*, int*); @@ -134,12 +134,12 @@ KdXVRegisterGenericAdaptorDriver( /* fprintf(stderr,"KdXVRegisterGenericAdaptorDriver\n"); */ - newdrivers = xrealloc(GenDrivers, sizeof(KdXVInitGenericAdaptorPtr) * + newdrivers = xrealloc(GenDrivers, sizeof(KdXVInitGenericAdaptorPtr) * (1 + NumGenDrivers)); if (!newdrivers) return 0; GenDrivers = newdrivers; - + GenDrivers[NumGenDrivers++] = InitFunc; return 1; @@ -184,7 +184,7 @@ KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr) Bool KdXVScreenInit( - ScreenPtr pScreen, + ScreenPtr pScreen, KdVideoAdaptorPtr *adaptors, int num ){ @@ -197,7 +197,7 @@ KdXVScreenInit( KdXVGeneration = serverGeneration; if(!XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc) - return FALSE; + return FALSE; if(Success != (*XvScreenInitProc)(pScreen)) return FALSE; @@ -247,20 +247,18 @@ KdXVFreeAdaptor(XvAdaptorPtr pAdaptor) { int i; - if(pAdaptor->name) - xfree(pAdaptor->name); + xfree(pAdaptor->name); if(pAdaptor->pEncodings) { XvEncodingPtr pEncode = pAdaptor->pEncodings; for(i = 0; i < pAdaptor->nEncodings; i++, pEncode++) { - if(pEncode->name) xfree(pEncode->name); + xfree(pEncode->name); } xfree(pAdaptor->pEncodings); } - if(pAdaptor->pFormats) - xfree(pAdaptor->pFormats); + xfree(pAdaptor->pFormats); if(pAdaptor->pPorts) { XvPortPtr pPort = pAdaptor->pPorts; @@ -269,9 +267,9 @@ KdXVFreeAdaptor(XvAdaptorPtr pAdaptor) for(i = 0; i < pAdaptor->nPorts; i++, pPort++) { pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr; if(pPriv) { - if(pPriv->clientClip) + if(pPriv->clientClip) REGION_DESTROY(pAdaptor->pScreen, pPriv->clientClip); - if(pPriv->pCompositeClip && pPriv->FreeCompositeClip) + if(pPriv->pCompositeClip && pPriv->FreeCompositeClip) REGION_DESTROY(pAdaptor->pScreen, pPriv->pCompositeClip); xfree(pPriv); } @@ -283,22 +281,20 @@ KdXVFreeAdaptor(XvAdaptorPtr pAdaptor) XvAttributePtr pAttribute = pAdaptor->pAttributes; for(i = 0; i < pAdaptor->nAttributes; i++, pAttribute++) { - if(pAttribute->name) xfree(pAttribute->name); + xfree(pAttribute->name); } xfree(pAdaptor->pAttributes); } - if(pAdaptor->nImages) - xfree(pAdaptor->pImages); - - if(pAdaptor->devPriv.ptr) - xfree(pAdaptor->devPriv.ptr); + xfree(pAdaptor->pImages); + + xfree(pAdaptor->devPriv.ptr); } static Bool KdXVInitAdaptors( - ScreenPtr pScreen, + ScreenPtr pScreen, KdVideoAdaptorPtr *infoPtr, int number ) { @@ -329,7 +325,7 @@ KdXVInitAdaptors( pxvs->nAdaptors = 0; pxvs->pAdaptors = NULL; - if(!(pAdaptor = xcalloc(number, sizeof(XvAdaptorRec)))) + if(!(pAdaptor = xcalloc(number, sizeof(XvAdaptorRec)))) return FALSE; for(pa = pAdaptor, na = 0, numAdaptor = 0; na < number; na++, adaptorPtr++) { @@ -343,7 +339,7 @@ KdXVInitAdaptors( if(!adaptorPtr->nEncodings || !adaptorPtr->pEncodings) continue; - pa->type = adaptorPtr->type; + pa->type = adaptorPtr->type; if(!adaptorPtr->PutVideo && !adaptorPtr->GetVideo) pa->type &= ~XvVideoMask; @@ -354,19 +350,19 @@ KdXVInitAdaptors( if(!adaptorPtr->PutImage || !adaptorPtr->QueryImageAttributes) pa->type &= ~XvImageMask; - if(!adaptorPtr->PutVideo && !adaptorPtr->PutImage && + if(!adaptorPtr->PutVideo && !adaptorPtr->PutImage && !adaptorPtr->PutStill) pa->type &= ~XvInputMask; if(!adaptorPtr->GetVideo && !adaptorPtr->GetStill) pa->type &= ~XvOutputMask; - - if(!(adaptorPtr->type & (XvPixmapMask | XvWindowMask))) + + if(!(adaptorPtr->type & (XvPixmapMask | XvWindowMask))) continue; - if(!(adaptorPtr->type & (XvImageMask | XvVideoMask | XvStillMask))) + if(!(adaptorPtr->type & (XvImageMask | XvVideoMask | XvStillMask))) continue; - pa->pScreen = pScreen; + pa->pScreen = pScreen; pa->ddAllocatePort = KdXVAllocatePort; pa->ddFreePort = KdXVFreePort; pa->ddPutVideo = KdXVPutVideo; @@ -385,8 +381,8 @@ KdXVInitAdaptors( if(adaptorPtr->nEncodings && (pEncode = xcalloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) { - for(pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0; - i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++) + for(pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0; + i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++) { pe->id = encodingPtr->id; pe->pScreen = pScreen; @@ -398,14 +394,14 @@ KdXVInitAdaptors( pe->rate.denominator = encodingPtr->rate.denominator; } pa->nEncodings = adaptorPtr->nEncodings; - pa->pEncodings = pEncode; - } + pa->pEncodings = pEncode; + } if(adaptorPtr->nImages && (pImage = xcalloc(adaptorPtr->nImages, sizeof(XvImageRec)))) { for(i = 0, pi = pImage, imagePtr = adaptorPtr->pImages; - i < adaptorPtr->nImages; i++, pi++, imagePtr++) + i < adaptorPtr->nImages; i++, pi++, imagePtr++) { pi->id = imagePtr->id; pi->type = imagePtr->type; @@ -437,8 +433,8 @@ KdXVInitAdaptors( if(adaptorPtr->nAttributes && (pAttribute = xcalloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec)))) { - for(pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = 0; - i < adaptorPtr->nAttributes; pat++, i++, attributePtr++) + for(pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = 0; + i < adaptorPtr->nAttributes; pat++, i++, attributePtr++) { pat->flags = attributePtr->flags; pat->min_value = attributePtr->min_value; @@ -447,8 +443,8 @@ KdXVInitAdaptors( strcpy(pat->name, attributePtr->name); } pa->nAttributes = adaptorPtr->nAttributes; - pa->pAttributes = pAttribute; - } + pa->pAttributes = pAttribute; + } totFormat = adaptorPtr->nFormats; @@ -457,8 +453,8 @@ KdXVInitAdaptors( KdXVFreeAdaptor(pa); continue; } - for(pf = pFormat, i = 0, numFormat = 0, formatPtr = adaptorPtr->pFormats; - i < adaptorPtr->nFormats; i++, formatPtr++) + for(pf = pFormat, i = 0, numFormat = 0, formatPtr = adaptorPtr->pFormats; + i < adaptorPtr->nFormats; i++, formatPtr++) { numVisuals = pScreen->numVisuals; pVisual = pScreen->visuals; @@ -468,26 +464,26 @@ KdXVInitAdaptors( (pVisual->nplanes == formatPtr->depth)) { if(numFormat >= totFormat) { - void *moreSpace; + void *moreSpace; totFormat *= 2; - moreSpace = xrealloc(pFormat, + moreSpace = xrealloc(pFormat, totFormat * sizeof(XvFormatRec)); if(!moreSpace) break; pFormat = moreSpace; pf = pFormat + numFormat; } - pf->visual = pVisual->vid; + pf->visual = pVisual->vid; pf->depth = formatPtr->depth; pf++; numFormat++; } pVisual++; - } + } } pa->nFormats = numFormat; - pa->pFormats = pFormat; + pa->pFormats = pFormat; if(!numFormat) { KdXVFreeAdaptor(pa); continue; @@ -517,15 +513,15 @@ KdXVInitAdaptors( KdXVFreeAdaptor(pa); continue; } - for(pp = pPort, i = 0, numPort = 0; + for(pp = pPort, i = 0, numPort = 0; i < adaptorPtr->nPorts; i++) { - if(!(pp->id = FakeClientID(0))) + if(!(pp->id = FakeClientID(0))) continue; - if(!(portPriv = xcalloc(1, sizeof(XvPortRecPrivate)))) + if(!(portPriv = xcalloc(1, sizeof(XvPortRecPrivate)))) continue; - + if(!AddResource(pp->id, PortResource, pp)) { xfree(portPriv); continue; @@ -542,7 +538,7 @@ KdXVInitAdaptors( portPriv->screen = screen; portPriv->AdaptorRec = adaptorPriv; portPriv->DevPriv.ptr = adaptorPtr->pPortPrivates[i].ptr; - + pp++; numPort++; } @@ -554,7 +550,7 @@ KdXVInitAdaptors( } pa->base_id = pPort->id; - + pa++; numAdaptor++; } @@ -580,13 +576,13 @@ KdXVInitAdaptors( the GC and used it's clip list when they needed to reclip the window, even if the client clip was different from the one the video was initialized with. If the original GC was destroyed, they had to stop - the video. I like the new method better (MArk). + the video. I like the new method better (MArk). This function only works for windows. Will need to rewrite when (if) we support pixmap rendering. */ -static void +static void KdXVUpdateCompositeClip(XvPortRecPrivatePtr portPriv) { RegionPtr pregWin, pCompositeClip; @@ -623,7 +619,7 @@ KdXVUpdateCompositeClip(XvPortRecPrivatePtr portPriv) if(freeCompClip) { REGION_DESTROY(pWin->pScreen, pregWin); - } + } } /* Save the current clientClip and update the CompositeClip whenever @@ -631,7 +627,7 @@ KdXVUpdateCompositeClip(XvPortRecPrivatePtr portPriv) static void KdXVCopyClip( - XvPortRecPrivatePtr portPriv, + XvPortRecPrivatePtr portPriv, GCPtr pGC ){ /* copy the new clip if it exists */ @@ -672,12 +668,12 @@ KdXVRegetVideo(XvPortRecPrivatePtr portPriv) WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y; WinBox.x2 = WinBox.x1 + portPriv->drw_w; WinBox.y2 = WinBox.y1 + portPriv->drw_h; - + /* clip to the window composite clip */ REGION_INIT(portPriv->pDraw->pScreen, &WinRegion, &WinBox, 1); REGION_INIT(portPriv->pDraw->pScreen, &ClipRegion, NullBox, 1); - REGION_INTERSECT(portPriv->pDraw->pScreen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); - + REGION_INTERSECT(portPriv->pDraw->pScreen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); + /* that's all if it's totally obscured */ if(!REGION_NOTEMPTY(portPriv->pDraw->pScreen, &ClipRegion)) { clippedAway = TRUE; @@ -689,10 +685,10 @@ KdXVRegetVideo(XvPortRecPrivatePtr portPriv) } ret = (*portPriv->AdaptorRec->GetVideo)(portPriv->screen, portPriv->pDraw, - portPriv->vid_x, portPriv->vid_y, - WinBox.x1, WinBox.y1, - portPriv->vid_w, portPriv->vid_h, - portPriv->drw_w, portPriv->drw_h, + portPriv->vid_x, portPriv->vid_y, + WinBox.x1, WinBox.y1, + portPriv->vid_w, portPriv->vid_h, + portPriv->drw_w, portPriv->drw_h, &ClipRegion, portPriv->DevPriv.ptr); if(ret == Success) @@ -736,11 +732,11 @@ KdXVReputVideo(XvPortRecPrivatePtr portPriv) WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y; WinBox.x2 = WinBox.x1 + portPriv->drw_w; WinBox.y2 = WinBox.y1 + portPriv->drw_h; - + /* clip to the window composite clip */ REGION_INIT(pScreen, &WinRegion, &WinBox, 1); REGION_INIT(pScreen, &ClipRegion, NullBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); + REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); /* clip and translate to the viewport */ if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { @@ -753,10 +749,10 @@ KdXVReputVideo(XvPortRecPrivatePtr portPriv) VPBox.y2 = screen->height; REGION_INIT(pScreen, &VPReg, &VPBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); + REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); REGION_UNINIT(pScreen, &VPReg); } - + /* that's all if it's totally obscured */ if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) { clippedAway = TRUE; @@ -767,8 +763,8 @@ KdXVReputVideo(XvPortRecPrivatePtr portPriv) if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { BoxPtr clipBox = REGION_RECTS(&ClipRegion); if( (REGION_NUM_RECTS(&ClipRegion) != 1) || - (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || - (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) + (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || + (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) { clippedAway = TRUE; goto CLIP_VIDEO_BAILOUT; @@ -780,10 +776,10 @@ KdXVReputVideo(XvPortRecPrivatePtr portPriv) } ret = (*portPriv->AdaptorRec->PutVideo)(portPriv->screen, portPriv->pDraw, - portPriv->vid_x, portPriv->vid_y, + portPriv->vid_x, portPriv->vid_y, WinBox.x1, WinBox.y1, - portPriv->vid_w, portPriv->vid_h, - portPriv->drw_w, portPriv->drw_h, + portPriv->vid_w, portPriv->vid_h, + portPriv->drw_w, portPriv->drw_h, &ClipRegion, portPriv->DevPriv.ptr); if(ret == Success) portPriv->isOn = XV_ON; @@ -825,11 +821,11 @@ KdXVReputImage(XvPortRecPrivatePtr portPriv) WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y; WinBox.x2 = WinBox.x1 + portPriv->drw_w; WinBox.y2 = WinBox.y1 + portPriv->drw_h; - + /* clip to the window composite clip */ REGION_INIT(pScreen, &WinRegion, &WinBox, 1); REGION_INIT(pScreen, &ClipRegion, NullBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); + REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); /* clip and translate to the viewport */ if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { @@ -842,10 +838,10 @@ KdXVReputImage(XvPortRecPrivatePtr portPriv) VPBox.y2 = screen->height; REGION_INIT(pScreen, &VPReg, &VPBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); + REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); REGION_UNINIT(pScreen, &VPReg); } - + /* that's all if it's totally obscured */ if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) { clippedAway = TRUE; @@ -856,8 +852,8 @@ KdXVReputImage(XvPortRecPrivatePtr portPriv) if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { BoxPtr clipBox = REGION_RECTS(&ClipRegion); if( (REGION_NUM_RECTS(&ClipRegion) != 1) || - (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || - (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) + (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || + (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) { clippedAway = TRUE; goto CLIP_VIDEO_BAILOUT; @@ -897,10 +893,10 @@ static int KdXVReputAllVideo(WindowPtr pWin, pointer data) { KdXVWindowPtr WinPriv; - + if (pWin->drawable.type != DRAWABLE_WINDOW) return WT_DONTWALKCHILDREN; - + WinPriv = GET_KDXV_WINDOW(pWin); while(WinPriv) { @@ -917,7 +913,7 @@ KdXVReputAllVideo(WindowPtr pWin, pointer data) static int KdXVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) { - KdXVWindowPtr winPriv, PrivRoot; + KdXVWindowPtr winPriv, PrivRoot; winPriv = PrivRoot = GET_KDXV_WINDOW(pWin); @@ -934,7 +930,7 @@ KdXVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) winPriv->PortRec = portPriv; winPriv->next = PrivRoot; dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv); - } + } return Success; } @@ -948,14 +944,14 @@ KdXVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) while(winPriv) { if(winPriv->PortRec == portPriv) { - if(prevPriv) + if(prevPriv) prevPriv->next = winPriv->next; - else + else dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv->next); xfree(winPriv); break; } - prevPriv = winPriv; + prevPriv = winPriv; winPriv = winPriv->next; } portPriv->pDraw = NULL; @@ -1033,7 +1029,7 @@ KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2) /* filter out XClearWindow/Area */ if (!pWin->valdata) return; - + pPrev = NULL; while(WinPriv) { @@ -1044,10 +1040,10 @@ KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2) switch(pPriv->type) { case XvInputMask: KdXVReputVideo(pPriv); - break; + break; case XvOutputMask: - KdXVRegetVideo(pPriv); - break; + KdXVRegetVideo(pPriv); + break; default: /* overlaid still/image*/ if (pPriv->AdaptorRec->ReputImage) KdXVReputImage(pPriv); @@ -1061,7 +1057,7 @@ KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2) } pPriv->pDraw = NULL; - if(!pPrev) + if(!pPrev) dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, WinPriv->next); else pPrev->next = WinPriv->next; @@ -1078,7 +1074,7 @@ KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2) } -static void +static void KdXVClipNotify(WindowPtr pWin, int dx, int dy) { ScreenPtr pScreen = pWin->drawable.pScreen; @@ -1097,7 +1093,7 @@ KdXVClipNotify(WindowPtr pWin, int dx, int dy) pPriv->pCompositeClip = NULL; - /* Stop everything except images, but stop them too if the + /* Stop everything except images, but stop them too if the window isn't visible. But we only remove the images. */ if(pPriv->type || !visible) { @@ -1110,7 +1106,7 @@ KdXVClipNotify(WindowPtr pWin, int dx, int dy) if(!pPriv->type) { /* overlaid still/image */ pPriv->pDraw = NULL; - if(!pPrev) + if(!pPrev) dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, WinPriv->next); else pPrev->next = WinPriv->next; @@ -1153,16 +1149,13 @@ KdXVCloseScreen(int i, ScreenPtr pScreen) /* fprintf(stderr,"XV: Unwrapping screen funcs\n"); */ - for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) { + for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) { KdXVFreeAdaptor(pa); } - if(pxvs->pAdaptors) - xfree(pxvs->pAdaptors); - + xfree(pxvs->pAdaptors); xfree(ScreenPriv); - return TRUE; } @@ -1193,9 +1186,9 @@ KdXVEnable(ScreenPtr pScreen) { if (!KdXVRunning (pScreen)) return TRUE; - - WalkTree(pScreen, KdXVReputAllVideo, 0); - + + WalkTree(pScreen, KdXVReputAllVideo, 0); + return TRUE; } @@ -1214,7 +1207,7 @@ KdXVDisable(ScreenPtr pScreen) pxvs = GET_XV_SCREEN(pScreen); ScreenPriv = GET_KDXV_SCREEN(pScreen); - + for(i = 0; i < pxvs->nAdaptors; i++) { pAdaptor = &pxvs->pAdaptors[i]; for(j = 0; j < pAdaptor->nPorts; j++) { @@ -1263,8 +1256,8 @@ KdXVPutVideo( DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, - INT16 vid_x, INT16 vid_y, - CARD16 vid_w, CARD16 vid_h, + INT16 vid_x, INT16 vid_y, + CARD16 vid_w, CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h ){ @@ -1277,7 +1270,7 @@ KdXVPutVideo( pPort->pDraw = (DrawablePtr)NULL; return BadAlloc; } - + /* If we are changing windows, unregister our port in the old window */ if(portPriv->pDraw && (portPriv->pDraw != pDraw)) KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv); @@ -1302,7 +1295,7 @@ KdXVPutVideo( pPort->pDraw = pDraw; if (!pScreenPriv->enabled) return Success; - + return(KdXVReputVideo(portPriv)); } @@ -1312,13 +1305,13 @@ KdXVPutStill( DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, - INT16 vid_x, INT16 vid_y, - CARD16 vid_w, CARD16 vid_h, + INT16 vid_x, INT16 vid_y, + CARD16 vid_w, CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h ){ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - ScreenPtr pScreen = pDraw->pScreen; + ScreenPtr pScreen = pDraw->pScreen; KdScreenPriv(pScreen); KdScreenInfo *screen=pScreenPriv->screen; RegionRec WinRegion; @@ -1336,10 +1329,10 @@ KdXVPutStill( WinBox.y1 = pDraw->y + drw_y; WinBox.x2 = WinBox.x1 + drw_w; WinBox.y2 = WinBox.y1 + drw_h; - + REGION_INIT(pScreen, &WinRegion, &WinBox, 1); REGION_INIT(pScreen, &ClipRegion, NullBox, 1); - REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); + REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { RegionRec VPReg; @@ -1351,7 +1344,7 @@ KdXVPutStill( VPBox.y2 = screen->height; REGION_INIT(pScreen, &VPReg, &VPBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); + REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); REGION_UNINIT(pScreen, &VPReg); } @@ -1367,7 +1360,7 @@ KdXVPutStill( if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { BoxPtr clipBox = REGION_RECTS(&ClipRegion); if( (REGION_NUM_RECTS(&ClipRegion) != 1) || - (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || + (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) { clippedAway = TRUE; @@ -1417,8 +1410,8 @@ KdXVGetVideo( DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, - INT16 vid_x, INT16 vid_y, - CARD16 vid_w, CARD16 vid_h, + INT16 vid_x, INT16 vid_y, + CARD16 vid_w, CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h ){ @@ -1431,7 +1424,7 @@ KdXVGetVideo( pPort->pDraw = (DrawablePtr)NULL; return BadAlloc; } - + /* If we are changing windows, unregister our port in the old window */ if(portPriv->pDraw && (portPriv->pDraw != pDraw)) KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv); @@ -1454,7 +1447,7 @@ KdXVGetVideo( /* To indicate to the DI layer that we were successful */ pPort->pDraw = pDraw; - + if(!pScreenPriv->enabled) return Success; return(KdXVRegetVideo(portPriv)); @@ -1466,8 +1459,8 @@ KdXVGetStill( DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, - INT16 vid_x, INT16 vid_y, - CARD16 vid_w, CARD16 vid_h, + INT16 vid_x, INT16 vid_y, + CARD16 vid_w, CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h ){ @@ -1489,10 +1482,10 @@ KdXVGetStill( WinBox.y1 = pDraw->y + drw_y; WinBox.x2 = WinBox.x1 + drw_w; WinBox.y2 = WinBox.y1 + drw_h; - + REGION_INIT(pScreen, &WinRegion, &WinBox, 1); REGION_INIT(pScreen, &ClipRegion, NullBox, 1); - REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); + REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); if(portPriv->pDraw) { KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv); @@ -1526,7 +1519,7 @@ GET_STILL_BAILOUT: return ret; } - + static int KdXVStopVideo( @@ -1539,7 +1532,7 @@ KdXVStopVideo( if(pDraw->type != DRAWABLE_WINDOW) return BadAlloc; - + KdXVRemovePortFromWindow((WindowPtr)pDraw, portPriv); if(!pScreenPriv->enabled) return Success; @@ -1563,8 +1556,8 @@ KdXVSetPortAttribute( INT32 value ){ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - - return((*portPriv->AdaptorRec->SetPortAttribute)(portPriv->screen, + + return((*portPriv->AdaptorRec->SetPortAttribute)(portPriv->screen, attribute, value, portPriv->DevPriv.ptr)); } @@ -1577,8 +1570,8 @@ KdXVGetPortAttribute( INT32 *p_value ){ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - - return((*portPriv->AdaptorRec->GetPortAttribute)(portPriv->screen, + + return((*portPriv->AdaptorRec->GetPortAttribute)(portPriv->screen, attribute, (int *) p_value, portPriv->DevPriv.ptr)); } @@ -1594,8 +1587,8 @@ KdXVQueryBestSize( unsigned int *p_w, unsigned int *p_h ){ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - - (*portPriv->AdaptorRec->QueryBestSize)(portPriv->screen, + + (*portPriv->AdaptorRec->QueryBestSize)(portPriv->screen, (Bool)motion, vid_w, vid_h, drw_w, drw_h, p_w, p_h, portPriv->DevPriv.ptr); @@ -1603,14 +1596,14 @@ KdXVQueryBestSize( } -static int +static int KdXVPutImage( - ClientPtr client, - DrawablePtr pDraw, - XvPortPtr pPort, + ClientPtr client, + DrawablePtr pDraw, + XvPortPtr pPort, GCPtr pGC, - INT16 src_x, INT16 src_y, - CARD16 src_w, CARD16 src_h, + INT16 src_x, INT16 src_y, + CARD16 src_w, CARD16 src_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h, XvImagePtr format, @@ -1636,10 +1629,10 @@ KdXVPutImage( WinBox.y1 = pDraw->y + drw_y; WinBox.x2 = WinBox.x1 + drw_w; WinBox.y2 = WinBox.y1 + drw_h; - + REGION_INIT(pScreen, &WinRegion, &WinBox, 1); REGION_INIT(pScreen, &ClipRegion, NullBox, 1); - REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); + REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { RegionRec VPReg; @@ -1651,7 +1644,7 @@ KdXVPutImage( VPBox.y2 = pScreen->height; REGION_INIT(pScreen, &VPReg, &VPBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); + REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); REGION_UNINIT(pScreen, &VPReg); } @@ -1667,7 +1660,7 @@ KdXVPutImage( if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { BoxPtr clipBox = REGION_RECTS(&ClipRegion); if( (REGION_NUM_RECTS(&ClipRegion) != 1) || - (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || + (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) { clippedAway = TRUE; @@ -1712,19 +1705,19 @@ PUT_IMAGE_BAILOUT: } -static int +static int KdXVQueryImageAttributes( - ClientPtr client, + ClientPtr client, XvPortPtr pPort, - XvImagePtr format, - CARD16 *width, - CARD16 *height, + XvImagePtr format, + CARD16 *width, + CARD16 *height, int *pitches, int *offsets ){ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - return (*portPriv->AdaptorRec->QueryImageAttributes)(portPriv->screen, + return (*portPriv->AdaptorRec->QueryImageAttributes)(portPriv->screen, format->id, width, height, pitches, offsets); } @@ -1878,7 +1871,7 @@ KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg) xRectangle *rects, *r; BoxPtr pBox = REGION_RECTS (pRgn); int nBox = REGION_NUM_RECTS (pRgn); - + rects = xalloc (nBox * sizeof (xRectangle)); if (!rects) goto bail0; @@ -1892,18 +1885,18 @@ KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg) r++; pBox++; } - + pGC = GetScratchGC (pDraw->depth, pDraw->pScreen); if (!pGC) goto bail1; - + val[0] = fg; val[1] = IncludeInferiors; ChangeGC (pGC, GCForeground|GCSubwindowMode, val); - + ValidateGC (pDraw, pGC); - - (*pGC->ops->PolyFillRect) (pDraw, pGC, + + (*pGC->ops->PolyFillRect) (pDraw, pGC, REGION_NUM_RECTS (pRgn), rects); FreeScratchGC (pGC); |