diff options
author | Jamey Sharp <jamey@minilop.net> | 2010-04-24 20:17:51 -0700 |
---|---|---|
committer | Jamey Sharp <jamey@minilop.net> | 2010-04-26 21:09:04 -0700 |
commit | 661323893cafcc6907336d9d775f14a5ecddd494 (patch) | |
tree | 04112d8a967f4775f17134793b1405dd8bce607f | |
parent | 3f934963d9e6fba969319cab0d73604dc07d977f (diff) |
WIP: Use Xinerama wrapper helpers in Xv.xinerama-rework
FIXME: These requests didn't stop at first error, and now some of them
do. Bug or feature?
Signed-off-by: Jamey Sharp <jamey@minilop.net>
-rw-r--r-- | Xext/xvdisp.c | 223 |
1 files changed, 67 insertions, 156 deletions
diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c index 8f20c39ef..74a55e73f 100644 --- a/Xext/xvdisp.c +++ b/Xext/xvdisp.c @@ -1600,55 +1600,44 @@ SProcXvDispatch(ClientPtr client) #ifdef PANORAMIX static int +StopVideoIfSupported(ClientPtr client) +{ + REQUEST(xvStopVideoReq); + if (!stuff->port) + return Success; + return ProcXvStopVideo(client); +} + +static int XineramaXvStopVideo(ClientPtr client) { - int result, i; - PanoramiXRes *draw, *port; - REQUEST(xvStopVideoReq); - REQUEST_SIZE_MATCH(xvStopVideoReq); - - result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable, - XRC_DRAWABLE, client, DixWriteAccess); - if (result != Success) - return (result == BadValue) ? BadDrawable : result; - - result = dixLookupResourceByType((pointer *)&port, stuff->port, - XvXRTPort, client, DixReadAccess); - if (result != Success) - return result; - - FOR_NSCREENS_BACKWARD(i) { - if(port->info[i].id) { - stuff->drawable = draw->info[i].id; - stuff->port = port->info[i].id; - result = ProcXvStopVideo(client); - } - } + struct XIDOffset offsets[2]; + REQUEST(xvStopVideoReq); + REQUEST_SIZE_MATCH(xvStopVideoReq); - return result; + XineramaAddFixedOffset(&offsets[0], XRC_DRAWABLE, DixWriteAccess, &stuff->drawable); + XineramaAddFixedOffset(&offsets[1], XvXRTPort, DixReadAccess, &stuff->port); + return XineramaOnEachScreenSkipErrors(StopVideoIfSupported, client, offsets, 2); } static int -XineramaXvSetPortAttribute(ClientPtr client) +SetPortAttributeIfSupported(ClientPtr client) { REQUEST(xvSetPortAttributeReq); - PanoramiXRes *port; - int result, i; + if (!stuff->port) + return Success; + return ProcXvSetPortAttribute(client); +} +static int +XineramaXvSetPortAttribute(ClientPtr client) +{ + struct XIDOffset offset; + REQUEST(xvSetPortAttributeReq); REQUEST_SIZE_MATCH(xvSetPortAttributeReq); - result = dixLookupResourceByType((pointer *)&port, stuff->port, - XvXRTPort, client, DixReadAccess); - if (result != Success) - return result; - - FOR_NSCREENS_BACKWARD(i) { - if(port->info[i].id) { - stuff->port = port->info[i].id; - result = ProcXvSetPortAttribute(client); - } - } - return result; + XineramaAddFixedOffset(&offset, XvXRTPort, DixReadAccess, &stuff->port); + return XineramaOnEachScreenSkipErrors(SetPortAttributeIfSupported, client, &offset, 1); } #ifdef MITSHM @@ -1705,148 +1694,70 @@ XineramaXvShmPutImage(ClientPtr client) #define XineramaXvShmPutImage ProcXvShmPutImage #endif +static int +PutImageIfSupported(ClientPtr client) +{ + REQUEST(xvPutImageReq); + if (!stuff->port) + return Success; + return ProcXvPutImage(client); +} + static int XineramaXvPutImage(ClientPtr client) { + struct XIDOffset offsets[3]; REQUEST(xvPutImageReq); - PanoramiXRes *draw, *gc, *port; - Bool isRoot; - int result, i, x, y; - REQUEST_AT_LEAST_SIZE(xvPutImageReq); - result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable, - XRC_DRAWABLE, client, DixWriteAccess); - if (result != Success) - return (result == BadValue) ? BadDrawable : result; - - result = dixLookupResourceByType((pointer *)&gc, stuff->gc, - XRT_GC, client, DixReadAccess); - if (result != Success) - return result; - - result = dixLookupResourceByType((pointer *)&port, stuff->port, - XvXRTPort, client, DixReadAccess); - if (result != Success) - return result; - - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; - - x = stuff->drw_x; - y = stuff->drw_y; - - FOR_NSCREENS_BACKWARD(i) { - if(port->info[i].id) { - stuff->drawable = draw->info[i].id; - stuff->port = port->info[i].id; - stuff->gc = gc->info[i].id; - stuff->drw_x = x; - stuff->drw_y = y; - if(isRoot) { - stuff->drw_x -= panoramiXdataPtr[i].x; - stuff->drw_y -= panoramiXdataPtr[i].y; - } + XineramaAddFixedOffset(&offsets[0], XRC_DRAWABLE, DixWriteAccess, &stuff->drawable); + XineramaAddFixedOffset(&offsets[1], XRT_GC, DixReadAccess, &stuff->gc); + XineramaAddFixedOffset(&offsets[2], XvXRTPort, DixReadAccess, &stuff->port); + return XineramaOnEachScreenAdjustRoot(PutImageIfSupported, client, offsets, 3, &stuff->drw_x, 1, 0); +} - result = ProcXvPutImage(client); - } - } - return result; +static int +PutVideoIfSupported(ClientPtr client) +{ + REQUEST(xvPutImageReq); + if (!stuff->port) + return Success; + return ProcXvPutVideo(client); } static int XineramaXvPutVideo(ClientPtr client) { + struct XIDOffset offsets[3]; REQUEST(xvPutImageReq); - PanoramiXRes *draw, *gc, *port; - Bool isRoot; - int result, i, x, y; - REQUEST_AT_LEAST_SIZE(xvPutVideoReq); - result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable, - XRC_DRAWABLE, client, DixWriteAccess); - if (result != Success) - return (result == BadValue) ? BadDrawable : result; - - result = dixLookupResourceByType((pointer *)&gc, stuff->gc, - XRT_GC, client, DixReadAccess); - if (result != Success) - return result; - - result = dixLookupResourceByType((pointer *)&port, stuff->port, - XvXRTPort, client, DixReadAccess); - if (result != Success) - return result; - - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; - - x = stuff->drw_x; - y = stuff->drw_y; + XineramaAddFixedOffset(&offsets[0], XRC_DRAWABLE, DixWriteAccess, &stuff->drawable); + XineramaAddFixedOffset(&offsets[1], XRT_GC, DixReadAccess, &stuff->gc); + XineramaAddFixedOffset(&offsets[2], XvXRTPort, DixReadAccess, &stuff->port); + return XineramaOnEachScreenAdjustRoot(PutVideoIfSupported, client, offsets, 3, &stuff->drw_x, 1, 0); +} - FOR_NSCREENS_BACKWARD(i) { - if(port->info[i].id) { - stuff->drawable = draw->info[i].id; - stuff->port = port->info[i].id; - stuff->gc = gc->info[i].id; - stuff->drw_x = x; - stuff->drw_y = y; - if(isRoot) { - stuff->drw_x -= panoramiXdataPtr[i].x; - stuff->drw_y -= panoramiXdataPtr[i].y; - } - - result = ProcXvPutVideo(client); - } - } - return result; +static int +PutStillIfSupported(ClientPtr client) +{ + REQUEST(xvPutImageReq); + if (!stuff->port) + return Success; + return ProcXvPutStill(client); } static int XineramaXvPutStill(ClientPtr client) { + struct XIDOffset offsets[3]; REQUEST(xvPutImageReq); - PanoramiXRes *draw, *gc, *port; - Bool isRoot; - int result, i, x, y; - REQUEST_AT_LEAST_SIZE(xvPutImageReq); - result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable, - XRC_DRAWABLE, client, DixWriteAccess); - if (result != Success) - return (result == BadValue) ? BadDrawable : result; - - result = dixLookupResourceByType((pointer *)&gc, stuff->gc, - XRT_GC, client, DixReadAccess); - if (result != Success) - return result; - - result = dixLookupResourceByType((pointer *)&port, stuff->port, - XvXRTPort, client, DixReadAccess); - if (result != Success) - return result; - - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; - - x = stuff->drw_x; - y = stuff->drw_y; - - FOR_NSCREENS_BACKWARD(i) { - if(port->info[i].id) { - stuff->drawable = draw->info[i].id; - stuff->port = port->info[i].id; - stuff->gc = gc->info[i].id; - stuff->drw_x = x; - stuff->drw_y = y; - if(isRoot) { - stuff->drw_x -= panoramiXdataPtr[i].x; - stuff->drw_y -= panoramiXdataPtr[i].y; - } - - result = ProcXvPutStill(client); - } - } - return result; + XineramaAddFixedOffset(&offsets[0], XRC_DRAWABLE, DixWriteAccess, &stuff->drawable); + XineramaAddFixedOffset(&offsets[1], XRT_GC, DixReadAccess, &stuff->gc); + XineramaAddFixedOffset(&offsets[2], XvXRTPort, DixReadAccess, &stuff->port); + return XineramaOnEachScreenAdjustRoot(PutStillIfSupported, client, offsets, 3, &stuff->drw_x, 1, 0); } void XineramifyXv(void) |