1
/* $XdotOrg: xserver/xorg/Xext/xvmain.c,v 1.6 2005/07/03 08:53:36 daniels Exp $ */
2
/***********************************************************
3
Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
4
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
8
Permission to use, copy, modify, and distribute this software and its
9
documentation for any purpose and without fee is hereby granted,
10
provided that the above copyright notice appear in all copies and that
11
both that copyright notice and this permission notice appear in
12
supporting documentation, and that the names of Digital or MIT not be
13
used in advertising or publicity pertaining to distribution of the
14
software without specific, written prior permission.
16
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
17
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
18
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
19
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
20
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
21
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
24
******************************************************************/
25
/* $XFree86: xc/programs/Xserver/Xext/xvmain.c,v 1.15tsi Exp $ */
30
** xvmain.c --- Xv server extension main device independent module.
34
** David Carver (Digital Workstation Engineering/Project Athena)
39
** - change: stop video always generates an event even when video
43
** - change: unrealizing windows no longer preempts video
46
** - changed SetPortControl to SetPortAttribute
47
** - changed GetPortControl to GetPortAttribute
48
** - changed QueryBestSize
51
** - fixed Put and Get requests to not preempt operations to same drawable
54
** - version 2.0 upgrade
57
** - fixed Put and Get requests to honor grabbed ports.
58
** - fixed Video requests to update di structure with new drawable, and
59
** client after calling ddx.
62
** - version 1.4 upgrade
66
** Port structures reference client structures in a two different
67
** ways: when grabs, or video is active. Each reference is encoded
68
** as fake client resources and thus when the client is goes away so
69
** does the reference (it is zeroed). No other action is taken, so
70
** video doesn't necessarily stop. It probably will as a result of
71
** other resources going away, but if a client starts video using
72
** none of its own resources, then the video will continue to play
73
** after the client disappears.
78
#ifdef HAVE_DIX_CONFIG_H
79
#include <dix-config.h>
83
#include <X11/Xproto.h>
86
#include "scrnintstr.h"
87
#include "windowstr.h"
88
#include "pixmapstr.h"
90
#include "extnsionst.h"
91
#include "dixstruct.h"
98
#include <X11/extensions/Xv.h>
99
#include <X11/extensions/Xvproto.h>
103
#include "xf86_ansic.h"
107
#include "panoramiX.h"
108
#include "panoramiXsrv.h"
112
int XvScreenIndex = -1;
113
unsigned long XvExtensionGeneration = 0;
114
unsigned long XvScreenGeneration = 0;
115
unsigned long XvResourceGeneration = 0;
121
unsigned long XvRTPort;
122
unsigned long XvRTEncoding;
123
unsigned long XvRTGrab;
124
unsigned long XvRTVideoNotify;
125
unsigned long XvRTVideoNotifyList;
126
unsigned long XvRTPortNotify;
132
extern XID clientErrorValue;
134
static void WriteSwappedVideoNotifyEvent(xvEvent *, xvEvent *);
135
static void WriteSwappedPortNotifyEvent(xvEvent *, xvEvent *);
136
static Bool CreateResourceTypes(void);
138
static Bool XvCloseScreen(int, ScreenPtr);
139
static Bool XvDestroyPixmap(PixmapPtr);
140
static Bool XvDestroyWindow(WindowPtr);
141
static void XvResetProc(ExtensionEntry*);
142
static int XvdiDestroyGrab(pointer, XID);
143
static int XvdiDestroyEncoding(pointer, XID);
144
static int XvdiDestroyVideoNotify(pointer, XID);
145
static int XvdiDestroyPortNotify(pointer, XID);
146
static int XvdiDestroyVideoNotifyList(pointer, XID);
147
static int XvdiDestroyPort(pointer, XID);
148
static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int);
162
ExtensionEntry *extEntry;
164
/* LOOK TO SEE IF ANY SCREENS WERE INITIALIZED; IF NOT THEN
165
INIT GLOBAL VARIABLES SO THE EXTENSION CAN FUNCTION */
166
if (XvScreenGeneration != serverGeneration)
168
if (!CreateResourceTypes())
170
ErrorF("XvExtensionInit: Unable to allocate resource types\n");
173
XvScreenIndex = AllocateScreenPrivateIndex ();
174
if (XvScreenIndex < 0)
176
ErrorF("XvExtensionInit: Unable to allocate screen private index\n");
180
XineramaRegisterConnectionBlockCallback(XineramifyXv);
182
XvScreenGeneration = serverGeneration;
185
if (XvExtensionGeneration != serverGeneration)
187
XvExtensionGeneration = serverGeneration;
189
extEntry = AddExtension(XvName, XvNumEvents, XvNumErrors,
190
ProcXvDispatch, SProcXvDispatch,
191
XvResetProc, StandardMinorOpcode);
194
FatalError("XvExtensionInit: AddExtensions failed\n");
197
XvReqCode = extEntry->base;
198
XvEventBase = extEntry->eventBase;
199
XvErrorBase = extEntry->errorBase;
201
EventSwapVector[XvEventBase+XvVideoNotify] =
202
(EventSwapPtr)WriteSwappedVideoNotifyEvent;
203
EventSwapVector[XvEventBase+XvPortNotify] =
204
(EventSwapPtr)WriteSwappedPortNotifyEvent;
206
(void)MakeAtom(XvName, strlen(XvName), xTrue);
212
CreateResourceTypes()
216
if (XvResourceGeneration == serverGeneration) return TRUE;
218
XvResourceGeneration = serverGeneration;
220
if (!(XvRTPort = CreateNewResourceType(XvdiDestroyPort)))
222
ErrorF("CreateResourceTypes: failed to allocate port resource.\n");
226
if (!(XvRTGrab = CreateNewResourceType(XvdiDestroyGrab)))
228
ErrorF("CreateResourceTypes: failed to allocate grab resource.\n");
232
if (!(XvRTEncoding = CreateNewResourceType(XvdiDestroyEncoding)))
234
ErrorF("CreateResourceTypes: failed to allocate encoding resource.\n");
238
if (!(XvRTVideoNotify = CreateNewResourceType(XvdiDestroyVideoNotify)))
240
ErrorF("CreateResourceTypes: failed to allocate video notify resource.\n");
244
if (!(XvRTVideoNotifyList = CreateNewResourceType(XvdiDestroyVideoNotifyList)))
246
ErrorF("CreateResourceTypes: failed to allocate video notify list resource.\n");
250
if (!(XvRTPortNotify = CreateNewResourceType(XvdiDestroyPortNotify)))
252
ErrorF("CreateResourceTypes: failed to allocate port notify resource.\n");
261
XvScreenInit(ScreenPtr pScreen)
265
if (XvScreenGeneration != serverGeneration)
267
if (!CreateResourceTypes())
269
ErrorF("XvScreenInit: Unable to allocate resource types\n");
272
XvScreenIndex = AllocateScreenPrivateIndex ();
273
if (XvScreenIndex < 0)
275
ErrorF("XvScreenInit: Unable to allocate screen private index\n");
279
XineramaRegisterConnectionBlockCallback(XineramifyXv);
281
XvScreenGeneration = serverGeneration;
284
if (pScreen->devPrivates[XvScreenIndex].ptr)
286
ErrorF("XvScreenInit: screen devPrivates ptr non-NULL before init\n");
289
/* ALLOCATE SCREEN PRIVATE RECORD */
291
pxvs = (XvScreenPtr) xalloc (sizeof (XvScreenRec));
294
ErrorF("XvScreenInit: Unable to allocate screen private structure\n");
298
pScreen->devPrivates[XvScreenIndex].ptr = (pointer)pxvs;
301
pxvs->DestroyPixmap = pScreen->DestroyPixmap;
302
pxvs->DestroyWindow = pScreen->DestroyWindow;
303
pxvs->CloseScreen = pScreen->CloseScreen;
305
pScreen->DestroyPixmap = XvDestroyPixmap;
306
pScreen->DestroyWindow = XvDestroyWindow;
307
pScreen->CloseScreen = XvCloseScreen;
320
pxvs = (XvScreenPtr) pScreen->devPrivates[XvScreenIndex].ptr;
322
pScreen->DestroyPixmap = pxvs->DestroyPixmap;
323
pScreen->DestroyWindow = pxvs->DestroyWindow;
324
pScreen->CloseScreen = pxvs->CloseScreen;
326
(* pxvs->ddCloseScreen)(ii, pScreen);
330
pScreen->devPrivates[XvScreenIndex].ptr = (pointer)NULL;
332
return (*pScreen->CloseScreen)(ii, pScreen);
337
XvResetProc(ExtensionEntry* extEntry)
344
return XvScreenIndex;
354
XvDestroyPixmap(PixmapPtr pPix)
364
pScreen = pPix->drawable.pScreen;
366
SCREEN_PROLOGUE(pScreen, DestroyPixmap);
368
pxvs = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr;
370
/* CHECK TO SEE IF THIS PORT IS IN USE */
372
pa = pxvs->pAdaptors;
373
na = pxvs->nAdaptors;
381
if (pp->pDraw == (DrawablePtr)pPix)
383
XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
385
(void)(* pp->pAdaptor->ddStopVideo)((ClientPtr)NULL, pp,
388
pp->pDraw = (DrawablePtr)NULL;
389
pp->client = (ClientPtr)NULL;
390
pp->time = currentTime;
397
status = (* pScreen->DestroyPixmap)(pPix);
399
SCREEN_EPILOGUE(pScreen, DestroyPixmap, XvDestroyPixmap);
406
XvDestroyWindow(WindowPtr pWin)
416
pScreen = pWin->drawable.pScreen;
418
SCREEN_PROLOGUE(pScreen, DestroyWindow);
420
pxvs = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr;
422
/* CHECK TO SEE IF THIS PORT IS IN USE */
424
pa = pxvs->pAdaptors;
425
na = pxvs->nAdaptors;
433
if (pp->pDraw == (DrawablePtr)pWin)
435
XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
437
(void)(* pp->pAdaptor->ddStopVideo)((ClientPtr)NULL, pp,
440
pp->pDraw = (DrawablePtr)NULL;
441
pp->client = (ClientPtr)NULL;
442
pp->time = currentTime;
450
status = (* pScreen->DestroyWindow)(pWin);
452
SCREEN_EPILOGUE(pScreen, DestroyWindow, XvDestroyWindow);
458
/* The XvdiVideoStopped procedure is a hook for the device dependent layer.
459
It provides a way for the dd layer to inform the di layer that video has
460
stopped in a port for reasons that the di layer had no control over; note
461
that it doesn't call back into the dd layer */
464
XvdiVideoStopped(XvPortPtr pPort, int reason)
467
/* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
469
if (!pPort->pDraw) return Success;
471
XvdiSendVideoNotify(pPort, pPort->pDraw, reason);
473
pPort->pDraw = (DrawablePtr)NULL;
474
pPort->client = (ClientPtr)NULL;
475
pPort->time = currentTime;
482
XvdiDestroyPort(pointer pPort, XID id)
484
return (* ((XvPortPtr)pPort)->pAdaptor->ddFreePort)(pPort);
488
XvdiDestroyGrab(pointer pGrab, XID id)
490
((XvGrabPtr)pGrab)->client = (ClientPtr)NULL;
495
XvdiDestroyVideoNotify(pointer pn, XID id)
497
/* JUST CLEAR OUT THE client POINTER FIELD */
499
((XvVideoNotifyPtr)pn)->client = (ClientPtr)NULL;
504
XvdiDestroyPortNotify(pointer pn, XID id)
506
/* JUST CLEAR OUT THE client POINTER FIELD */
508
((XvPortNotifyPtr)pn)->client = (ClientPtr)NULL;
513
XvdiDestroyVideoNotifyList(pointer pn, XID id)
515
XvVideoNotifyPtr npn,cpn;
517
/* ACTUALLY DESTROY THE NOTITY LIST */
519
cpn = (XvVideoNotifyPtr)pn;
524
if (cpn->client) FreeResource(cpn->id, XvRTVideoNotify);
532
XvdiDestroyEncoding(pointer value, XID id)
538
XvdiSendVideoNotify(pPort, pDraw, reason)
548
pn = (XvVideoNotifyPtr)LookupIDByType(pDraw->id, XvRTVideoNotifyList);
554
event.u.u.type = XvEventBase + XvVideoNotify;
555
event.u.u.sequenceNumber = pn->client->sequence;
556
event.u.videoNotify.time = currentTime.milliseconds;
557
event.u.videoNotify.drawable = pDraw->id;
558
event.u.videoNotify.port = pPort->id;
559
event.u.videoNotify.reason = reason;
560
(void) TryClientEvents(pn->client, (xEventPtr)&event, 1, NoEventMask,
561
NoEventMask, NullGrab);
586
event.u.u.type = XvEventBase + XvPortNotify;
587
event.u.u.sequenceNumber = pn->client->sequence;
588
event.u.portNotify.time = currentTime.milliseconds;
589
event.u.portNotify.port = pPort->id;
590
event.u.portNotify.attribute = attribute;
591
event.u.portNotify.value = value;
592
(void) TryClientEvents(pn->client, (xEventPtr)&event, 1, NoEventMask,
593
NoEventMask, NullGrab);
603
#define CHECK_SIZE(dw, dh, sw, sh) { \
604
if(!dw || !dh || !sw || !sh) return Success; \
605
/* The region code will break these if they are too large */ \
606
if((dw > 32767) || (dh > 32767) || (sw > 32767) || (sh > 32767)) \
617
INT16 vid_x, INT16 vid_y,
618
CARD16 vid_w, CARD16 vid_h,
619
INT16 drw_x, INT16 drw_y,
620
CARD16 drw_w, CARD16 drw_h
622
DrawablePtr pOldDraw;
624
CHECK_SIZE(drw_w, drw_h, vid_w, vid_h);
626
/* UPDATE TIME VARIABLES FOR USE IN EVENTS */
630
/* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
631
INFORM CLIENT OF ITS FAILURE */
633
if (pPort->grab.client && (pPort->grab.client != client))
635
XvdiSendVideoNotify(pPort, pDraw, XvBusy);
639
/* CHECK TO SEE IF PORT IS IN USE; IF SO THEN WE MUST DELIVER INTERRUPTED
640
EVENTS TO ANY CLIENTS WHO WANT THEM */
642
pOldDraw = pPort->pDraw;
643
if ((pOldDraw) && (pOldDraw != pDraw))
645
XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
648
(void) (* pPort->pAdaptor->ddPutVideo)(client, pDraw, pPort, pGC,
649
vid_x, vid_y, vid_w, vid_h,
650
drw_x, drw_y, drw_w, drw_h);
652
if ((pPort->pDraw) && (pOldDraw != pDraw))
654
pPort->client = client;
655
XvdiSendVideoNotify(pPort, pPort->pDraw, XvStarted);
658
pPort->time = currentTime;
670
INT16 vid_x, INT16 vid_y,
671
CARD16 vid_w, CARD16 vid_h,
672
INT16 drw_x, INT16 drw_y,
673
CARD16 drw_w, CARD16 drw_h
677
CHECK_SIZE(drw_w, drw_h, vid_w, vid_h);
679
/* UPDATE TIME VARIABLES FOR USE IN EVENTS */
683
/* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
684
INFORM CLIENT OF ITS FAILURE */
686
if (pPort->grab.client && (pPort->grab.client != client))
688
XvdiSendVideoNotify(pPort, pDraw, XvBusy);
692
pPort->time = currentTime;
694
status = (* pPort->pAdaptor->ddPutStill)(client, pDraw, pPort, pGC,
695
vid_x, vid_y, vid_w, vid_h,
696
drw_x, drw_y, drw_w, drw_h);
708
INT16 src_x, INT16 src_y,
709
CARD16 src_w, CARD16 src_h,
710
INT16 drw_x, INT16 drw_y,
711
CARD16 drw_w, CARD16 drw_h,
715
CARD16 width, CARD16 height
717
CHECK_SIZE(drw_w, drw_h, src_w, src_h);
719
/* UPDATE TIME VARIABLES FOR USE IN EVENTS */
723
/* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
724
INFORM CLIENT OF ITS FAILURE */
726
if (pPort->grab.client && (pPort->grab.client != client))
728
XvdiSendVideoNotify(pPort, pDraw, XvBusy);
732
pPort->time = currentTime;
734
return (* pPort->pAdaptor->ddPutImage)(client, pDraw, pPort, pGC,
735
src_x, src_y, src_w, src_h,
736
drw_x, drw_y, drw_w, drw_h,
737
image, data, sync, width, height);
747
INT16 vid_x, INT16 vid_y,
748
CARD16 vid_w, CARD16 vid_h,
749
INT16 drw_x, INT16 drw_y,
750
CARD16 drw_w, CARD16 drw_h
752
DrawablePtr pOldDraw;
754
CHECK_SIZE(drw_w, drw_h, vid_w, vid_h);
756
/* UPDATE TIME VARIABLES FOR USE IN EVENTS */
760
/* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
761
INFORM CLIENT OF ITS FAILURE */
763
if (pPort->grab.client && (pPort->grab.client != client))
765
XvdiSendVideoNotify(pPort, pDraw, XvBusy);
769
/* CHECK TO SEE IF PORT IS IN USE; IF SO THEN WE MUST DELIVER INTERRUPTED
770
EVENTS TO ANY CLIENTS WHO WANT THEM */
772
pOldDraw = pPort->pDraw;
773
if ((pOldDraw) && (pOldDraw != pDraw))
775
XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
778
(void) (* pPort->pAdaptor->ddGetVideo)(client, pDraw, pPort, pGC,
779
vid_x, vid_y, vid_w, vid_h,
780
drw_x, drw_y, drw_w, drw_h);
782
if ((pPort->pDraw) && (pOldDraw != pDraw))
784
pPort->client = client;
785
XvdiSendVideoNotify(pPort, pPort->pDraw, XvStarted);
788
pPort->time = currentTime;
800
INT16 vid_x, INT16 vid_y,
801
CARD16 vid_w, CARD16 vid_h,
802
INT16 drw_x, INT16 drw_y,
803
CARD16 drw_w, CARD16 drw_h
807
CHECK_SIZE(drw_w, drw_h, vid_w, vid_h);
809
/* UPDATE TIME VARIABLES FOR USE IN EVENTS */
813
/* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
814
INFORM CLIENT OF ITS FAILURE */
816
if (pPort->grab.client && (pPort->grab.client != client))
818
XvdiSendVideoNotify(pPort, pDraw, XvBusy);
822
status = (* pPort->pAdaptor->ddGetStill)(client, pDraw, pPort, pGC,
823
vid_x, vid_y, vid_w, vid_h,
824
drw_x, drw_y, drw_w, drw_h);
826
pPort->time = currentTime;
843
time = ClientTimeToServerTime(ctime);
845
if (pPort->grab.client && (client != pPort->grab.client))
847
*p_result = XvAlreadyGrabbed;
851
if ((CompareTimeStamps(time, currentTime) == LATER) ||
852
(CompareTimeStamps(time, pPort->time) == EARLIER))
854
*p_result = XvInvalidTime;
858
if (client == pPort->grab.client)
864
id = FakeClientID(client->index);
866
if (!AddResource(id, XvRTGrab, &pPort->grab))
871
/* IF THERE IS ACTIVE VIDEO THEN STOP IT */
873
if ((pPort->pDraw) && (client != pPort->client))
875
XVCALL(diStopVideo)((ClientPtr)NULL, pPort, pPort->pDraw);
878
pPort->grab.client = client;
881
pPort->time = currentTime;
898
time = ClientTimeToServerTime(ctime);
900
if ((!pPort->grab.client) || (client != pPort->grab.client))
905
if ((CompareTimeStamps(time, currentTime) == LATER) ||
906
(CompareTimeStamps(time, pPort->time) == EARLIER))
911
/* FREE THE GRAB RESOURCE; AND SET THE GRAB CLIENT TO NULL */
913
FreeResource(pPort->grab.id, XvRTGrab);
914
pPort->grab.client = (ClientPtr)NULL;
916
pPort->time = currentTime;
924
XvdiSelectVideoNotify(
929
XvVideoNotifyPtr pn,tpn,fpn;
931
/* FIND VideoNotify LIST */
933
pn = (XvVideoNotifyPtr)LookupIDByType(pDraw->id, XvRTVideoNotifyList);
935
/* IF ONE DONES'T EXIST AND NO MASK, THEN JUST RETURN */
937
if (!onoff && !pn) return Success;
939
/* IF ONE DOESN'T EXIST CREATE IT AND ADD A RESOURCE SO THAT THE LIST
940
WILL BE DELETED WHEN THE DRAWABLE IS DESTROYED */
944
if (!(tpn = (XvVideoNotifyPtr)xalloc(sizeof(XvVideoNotifyRec))))
946
tpn->next = (XvVideoNotifyPtr)NULL;
947
if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn))
955
/* LOOK TO SEE IF ENTRY ALREADY EXISTS */
957
fpn = (XvVideoNotifyPtr)NULL;
961
if (tpn->client == client)
963
if (!onoff) tpn->client = (ClientPtr)NULL;
966
if (!tpn->client) fpn = tpn; /* TAKE NOTE OF FREE ENTRY */
970
/* IF TUNNING OFF, THEN JUST RETURN */
972
if (!onoff) return Success;
974
/* IF ONE ISN'T FOUND THEN ALLOCATE ONE AND LINK IT INTO THE LIST */
982
if (!(tpn = (XvVideoNotifyPtr)xalloc(sizeof(XvVideoNotifyRec))))
984
tpn->next = pn->next;
989
/* INIT CLIENT PTR IN CASE WE CAN'T ADD RESOURCE */
990
/* ADD RESOURCE SO THAT IF CLIENT EXITS THE CLIENT PTR WILL BE CLEARED */
992
tpn->client = (ClientPtr)NULL;
993
tpn->id = FakeClientID(client->index);
994
AddResource(tpn->id, XvRTVideoNotify, tpn);
996
tpn->client = client;
1002
XvdiSelectPortNotify(
1007
XvPortNotifyPtr pn,tpn;
1009
/* SEE IF CLIENT IS ALREADY IN LIST */
1011
tpn = (XvPortNotifyPtr)NULL;
1012
pn = pPort->pNotify;
1015
if (!pn->client) tpn = pn; /* TAKE NOTE OF FREE ENTRY */
1016
if (pn->client == client) break;
1020
/* IS THE CLIENT ALREADY ON THE LIST? */
1028
pn->client = (ClientPtr)NULL;
1029
FreeResource(pn->id, XvRTPortNotify);
1035
/* DIDN'T FIND IT; SO REUSE LIST ELEMENT IF ONE IS FREE OTHERWISE
1036
CREATE A NEW ONE AND ADD IT TO THE BEGINNING OF THE LIST */
1040
if (!(tpn = (XvPortNotifyPtr)xalloc(sizeof(XvPortNotifyRec))))
1042
tpn->next = pPort->pNotify;
1043
pPort->pNotify = tpn;
1046
tpn->client = client;
1047
tpn->id = FakeClientID(client->index);
1048
AddResource(tpn->id, XvRTPortNotify, tpn);
1062
/* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
1064
if (!pPort->pDraw || (pPort->pDraw != pDraw))
1066
XvdiSendVideoNotify(pPort, pDraw, XvStopped);
1070
/* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
1071
INFORM CLIENT OF ITS FAILURE */
1073
if ((client) && (pPort->grab.client) && (pPort->grab.client != client))
1075
XvdiSendVideoNotify(pPort, pDraw, XvBusy);
1079
XvdiSendVideoNotify(pPort, pDraw, XvStopped);
1081
status = (* pPort->pAdaptor->ddStopVideo)(client, pPort, pDraw);
1083
pPort->pDraw = (DrawablePtr)NULL;
1084
pPort->client = (ClientPtr)client;
1085
pPort->time = currentTime;
1099
/* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
1101
if (!pPort->pDraw || (pPort->pDraw != pDraw)) return Success;
1103
XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
1105
status = (* pPort->pAdaptor->ddStopVideo)(client, pPort, pPort->pDraw);
1107
pPort->pDraw = (DrawablePtr)NULL;
1108
pPort->client = (ClientPtr)client;
1109
pPort->time = currentTime;
1125
pa = pPort->pAdaptor;
1127
if (pa->pScreen != pDraw->pScreen) return BadMatch;
1134
if ((pf->depth == pDraw->depth)
1136
&& ((pDraw->type == DRAWABLE_PIXMAP) ||
1137
(wVisual(((WindowPtr)pDraw)) == pf->visual))
1149
XvdiSetPortAttribute(
1156
XvdiSendPortNotify(pPort, attribute, value);
1159
(* pPort->pAdaptor->ddSetPortAttribute)(client, pPort, attribute, value);
1164
XvdiGetPortAttribute(
1172
(* pPort->pAdaptor->ddGetPortAttribute)(client, pPort, attribute, p_value);
1177
WriteSwappedVideoNotifyEvent(xvEvent *from, xvEvent *to)
1181
to->u.u.type = from->u.u.type;
1182
to->u.u.detail = from->u.u.detail;
1183
cpswaps(from->u.videoNotify.sequenceNumber,
1184
to->u.videoNotify.sequenceNumber);
1185
cpswapl(from->u.videoNotify.time, to->u.videoNotify.time);
1186
cpswapl(from->u.videoNotify.drawable, to->u.videoNotify.drawable);
1187
cpswapl(from->u.videoNotify.port, to->u.videoNotify.port);
1192
WriteSwappedPortNotifyEvent(xvEvent *from, xvEvent *to)
1196
to->u.u.type = from->u.u.type;
1197
to->u.u.detail = from->u.u.detail;
1198
cpswaps(from->u.portNotify.sequenceNumber, to->u.portNotify.sequenceNumber);
1199
cpswapl(from->u.portNotify.time, to->u.portNotify.time);
1200
cpswapl(from->u.portNotify.port, to->u.portNotify.port);
1201
cpswapl(from->u.portNotify.value, to->u.portNotify.value);