Xext: xv: untwist Xinerama handling
The current way of switching between Xinerama and single-screen handlers is quite complicated and needs call vector tables that are changed on the fly, which in turn makes dispatching more complicated. Reworking this into a simple and straight code flow, where individual request procs just look at a flag to decide whether to call the Xinerama or single screen version. This isn't just much easier to understand (and debug), but also removes the need or the call vectors, thus allowing further simplification of the dispatcher. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
1fb8493498
commit
bee797a348
123
Xext/xvdisp.c
123
Xext/xvdisp.c
|
@ -451,7 +451,7 @@ ProcXvQueryEncodings(ClientPtr client)
|
|||
}
|
||||
|
||||
static int
|
||||
ProcXvPutVideo(ClientPtr client)
|
||||
SingleXvPutVideo(ClientPtr client)
|
||||
{
|
||||
DrawablePtr pDraw;
|
||||
XvPortPtr pPort;
|
||||
|
@ -480,8 +480,20 @@ ProcXvPutVideo(ClientPtr client)
|
|||
stuff->drw_w, stuff->drw_h);
|
||||
}
|
||||
|
||||
static int XineramaXvPutVideo(ClientPtr client);
|
||||
|
||||
static int
|
||||
ProcXvPutStill(ClientPtr client)
|
||||
ProcXvPutVideo(ClientPtr client)
|
||||
{
|
||||
#ifdef XINERAMA
|
||||
if (xvUseXinerama)
|
||||
return XineramaXvPutVideo(client);
|
||||
#endif
|
||||
return SingleXvPutVideo(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SingleXvPutStill(ClientPtr client)
|
||||
{
|
||||
DrawablePtr pDraw;
|
||||
XvPortPtr pPort;
|
||||
|
@ -510,6 +522,18 @@ ProcXvPutStill(ClientPtr client)
|
|||
stuff->drw_w, stuff->drw_h);
|
||||
}
|
||||
|
||||
static int XineramaXvPutStill(ClientPtr client);
|
||||
|
||||
static int
|
||||
ProcXvPutStill(ClientPtr client)
|
||||
{
|
||||
#ifdef XINERAMA
|
||||
if (xvUseXinerama)
|
||||
return XineramaXvPutStill(client);
|
||||
#endif
|
||||
return SingleXvPutStill(client);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcXvGetVideo(ClientPtr client)
|
||||
{
|
||||
|
@ -641,7 +665,7 @@ ProcXvUngrabPort(ClientPtr client)
|
|||
}
|
||||
|
||||
static int
|
||||
ProcXvStopVideo(ClientPtr client)
|
||||
SingleXvStopVideo(ClientPtr client)
|
||||
{
|
||||
int ret;
|
||||
DrawablePtr pDraw;
|
||||
|
@ -659,8 +683,20 @@ ProcXvStopVideo(ClientPtr client)
|
|||
return XvdiStopVideo(client, pPort, pDraw);
|
||||
}
|
||||
|
||||
static int XineramaXvStopVideo(ClientPtr client);
|
||||
|
||||
static int
|
||||
ProcXvSetPortAttribute(ClientPtr client)
|
||||
ProcXvStopVideo(ClientPtr client)
|
||||
{
|
||||
#ifdef XINERAMA
|
||||
if (xvUseXinerama)
|
||||
return XineramaXvStopVideo(client);
|
||||
#endif
|
||||
return SingleXvStopVideo(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SingleXvSetPortAttribute(ClientPtr client)
|
||||
{
|
||||
int status;
|
||||
XvPortPtr pPort;
|
||||
|
@ -686,6 +722,18 @@ ProcXvSetPortAttribute(ClientPtr client)
|
|||
return status;
|
||||
}
|
||||
|
||||
static int XineramaXvSetPortAttribute(ClientPtr client);
|
||||
|
||||
static int
|
||||
ProcXvSetPortAttribute(ClientPtr client)
|
||||
{
|
||||
#ifdef XINERAMA
|
||||
if (xvUseXinerama)
|
||||
return XineramaXvSetPortAttribute(client);
|
||||
#endif
|
||||
return SingleXvSetPortAttribute(client);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcXvGetPortAttribute(ClientPtr client)
|
||||
{
|
||||
|
@ -795,7 +843,7 @@ ProcXvQueryPortAttributes(ClientPtr client)
|
|||
}
|
||||
|
||||
static int
|
||||
ProcXvPutImage(ClientPtr client)
|
||||
SingleXvPutImage(ClientPtr client)
|
||||
{
|
||||
DrawablePtr pDraw;
|
||||
XvPortPtr pPort;
|
||||
|
@ -851,10 +899,23 @@ ProcXvPutImage(ClientPtr client)
|
|||
stuff->width, stuff->height);
|
||||
}
|
||||
|
||||
static int
|
||||
XineramaXvPutImage(ClientPtr client);
|
||||
|
||||
static int
|
||||
ProcXvPutImage(ClientPtr client)
|
||||
{
|
||||
#ifdef XINERAMA
|
||||
if (xvUseXinerama)
|
||||
return XineramaXvPutImage(client);
|
||||
#endif
|
||||
return SingleXvPutImage(client);
|
||||
}
|
||||
|
||||
#ifdef MITSHM
|
||||
|
||||
static int
|
||||
ProcXvShmPutImage(ClientPtr client)
|
||||
SingleXvShmPutImage(ClientPtr client)
|
||||
{
|
||||
ShmDescPtr shmdesc;
|
||||
DrawablePtr pDraw;
|
||||
|
@ -927,13 +988,24 @@ ProcXvShmPutImage(ClientPtr client)
|
|||
|
||||
return status;
|
||||
}
|
||||
#else /* !MITSHM */
|
||||
|
||||
static int XineramaXvShmPutImage(ClientPtr client);
|
||||
|
||||
#endif /* MITSHM */
|
||||
|
||||
static int
|
||||
ProcXvShmPutImage(ClientPtr client)
|
||||
{
|
||||
return BadImplementation;
|
||||
}
|
||||
#ifdef MITSHM
|
||||
#ifdef XINERAMA
|
||||
if (xvUseXinerama)
|
||||
return XineramaXvShmPutImage(client);
|
||||
#endif
|
||||
return SingleXvShmPutImage(client);
|
||||
#else
|
||||
return BadImplementation;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef XvMCExtension
|
||||
#include "xvmcext.h"
|
||||
|
@ -1410,7 +1482,7 @@ XineramaXvStopVideo(ClientPtr client)
|
|||
if (port->info[i].id) {
|
||||
stuff->drawable = draw->info[i].id;
|
||||
stuff->port = port->info[i].id;
|
||||
result = ProcXvStopVideo(client);
|
||||
result = SingleXvStopVideo(client);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1434,7 +1506,7 @@ XineramaXvSetPortAttribute(ClientPtr client)
|
|||
FOR_NSCREENS_BACKWARD(i) {
|
||||
if (port->info[i].id) {
|
||||
stuff->port = port->info[i].id;
|
||||
result = ProcXvSetPortAttribute(client);
|
||||
result = SingleXvSetPortAttribute(client);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -1487,7 +1559,7 @@ XineramaXvShmPutImage(ClientPtr client)
|
|||
}
|
||||
stuff->send_event = (send_event && !i) ? 1 : 0;
|
||||
|
||||
result = ProcXvShmPutImage(client);
|
||||
result = SingleXvShmPutImage(client);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -1538,7 +1610,7 @@ XineramaXvPutImage(ClientPtr client)
|
|||
stuff->drw_y -= screenInfo.screens[i]->y;
|
||||
}
|
||||
|
||||
result = ProcXvPutImage(client);
|
||||
result = SingleXvPutImage(client);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -1586,7 +1658,7 @@ XineramaXvPutVideo(ClientPtr client)
|
|||
stuff->drw_y -= screenInfo.screens[i]->y;
|
||||
}
|
||||
|
||||
result = ProcXvPutVideo(client);
|
||||
result = SingleXvPutVideo(client);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -1634,7 +1706,7 @@ XineramaXvPutStill(ClientPtr client)
|
|||
stuff->drw_y -= screenInfo.screens[i]->y;
|
||||
}
|
||||
|
||||
result = ProcXvPutStill(client);
|
||||
result = SingleXvPutStill(client);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -1741,25 +1813,6 @@ XineramifyXv(void)
|
|||
}
|
||||
}
|
||||
|
||||
/* munge the dispatch vector */
|
||||
XvProcVector[xv_PutVideo] = XineramaXvPutVideo;
|
||||
XvProcVector[xv_PutStill] = XineramaXvPutStill;
|
||||
XvProcVector[xv_StopVideo] = XineramaXvStopVideo;
|
||||
XvProcVector[xv_SetPortAttribute] = XineramaXvSetPortAttribute;
|
||||
XvProcVector[xv_PutImage] = XineramaXvPutImage;
|
||||
XvProcVector[xv_ShmPutImage] = XineramaXvShmPutImage;
|
||||
xvUseXinerama = 1;
|
||||
}
|
||||
#endif /* XINERAMA */
|
||||
|
||||
void
|
||||
XvResetProcVector(void)
|
||||
{
|
||||
#ifdef XINERAMA
|
||||
XvProcVector[xv_PutVideo] = ProcXvPutVideo;
|
||||
XvProcVector[xv_PutStill] = ProcXvPutStill;
|
||||
XvProcVector[xv_StopVideo] = ProcXvStopVideo;
|
||||
XvProcVector[xv_SetPortAttribute] = ProcXvSetPortAttribute;
|
||||
XvProcVector[xv_PutImage] = ProcXvPutImage;
|
||||
XvProcVector[xv_ShmPutImage] = ProcXvShmPutImage;
|
||||
#endif /* XINERAMA */
|
||||
}
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
extern void XineramifyXv(void);
|
||||
extern void XvResetProcVector(void);
|
||||
extern int xvUseXinerama;
|
||||
|
|
|
@ -129,6 +129,8 @@ int XvReqCode;
|
|||
static int XvEventBase;
|
||||
int XvErrorBase;
|
||||
|
||||
int xvUseXinerama = 0;
|
||||
|
||||
RESTYPE XvRTPort;
|
||||
static RESTYPE XvRTEncoding;
|
||||
static RESTYPE XvRTGrab;
|
||||
|
@ -323,7 +325,7 @@ static void XvScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused
|
|||
static void
|
||||
XvResetProc(ExtensionEntry * extEntry)
|
||||
{
|
||||
XvResetProcVector();
|
||||
xvUseXinerama = 0;
|
||||
}
|
||||
|
||||
DevPrivateKey
|
||||
|
|
Loading…
Reference in New Issue