(submit/cleanup-xv-dispatch) Xext: xv: simplify dispatcher
These dispatcher functions are much more complex than they're usually are (just switch/case statement). Bring them in line with the standard scheme used in the Xserver, so further steps become easier. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
		
							parent
							
								
									eda3da370e
								
							
						
					
					
						commit
						012d1c0ccd
					
				
							
								
								
									
										172
									
								
								Xext/xvdisp.c
								
								
								
								
							
							
						
						
									
										172
									
								
								Xext/xvdisp.c
								
								
								
								
							|  | @ -1132,26 +1132,6 @@ ProcXvListImageFormats(ClientPtr client) | ||||||
|     return Success; |     return Success; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int (*XvProcVector[xvNumRequests]) (ClientPtr) = { |  | ||||||
| ProcXvQueryExtension, |  | ||||||
|         ProcXvQueryAdaptors, |  | ||||||
|         ProcXvQueryEncodings, |  | ||||||
|         ProcXvGrabPort, |  | ||||||
|         ProcXvUngrabPort, |  | ||||||
|         ProcXvPutVideo, |  | ||||||
|         ProcXvPutStill, |  | ||||||
|         ProcXvGetVideo, |  | ||||||
|         ProcXvGetStill, |  | ||||||
|         ProcXvStopVideo, |  | ||||||
|         ProcXvSelectVideoNotify, |  | ||||||
|         ProcXvSelectPortNotify, |  | ||||||
|         ProcXvQueryBestSize, |  | ||||||
|         ProcXvSetPortAttribute, |  | ||||||
|         ProcXvGetPortAttribute, |  | ||||||
|         ProcXvQueryPortAttributes, |  | ||||||
|         ProcXvListImageFormats, |  | ||||||
|         ProcXvQueryImageAttributes, ProcXvPutImage, ProcXvShmPutImage,}; |  | ||||||
| 
 |  | ||||||
| int | int | ||||||
| ProcXvDispatch(ClientPtr client) | ProcXvDispatch(ClientPtr client) | ||||||
| { | { | ||||||
|  | @ -1159,11 +1139,50 @@ ProcXvDispatch(ClientPtr client) | ||||||
| 
 | 
 | ||||||
|     UpdateCurrentTime(); |     UpdateCurrentTime(); | ||||||
| 
 | 
 | ||||||
|     if (stuff->data >= xvNumRequests) { |     switch (stuff->data) { | ||||||
|         return BadRequest; |         case xv_QueryExtension: | ||||||
|  |             return ProcXvQueryExtension(client); | ||||||
|  |         case xv_QueryAdaptors: | ||||||
|  |             return ProcXvQueryAdaptors(client); | ||||||
|  |         case xv_QueryEncodings: | ||||||
|  |             return ProcXvQueryEncodings(client); | ||||||
|  |         case xv_GrabPort: | ||||||
|  |             return ProcXvGrabPort(client); | ||||||
|  |         case xv_UngrabPort: | ||||||
|  |             return ProcXvUngrabPort(client); | ||||||
|  |         case xv_PutVideo: | ||||||
|  |             return ProcXvPutVideo(client); | ||||||
|  |         case xv_PutStill: | ||||||
|  |             return ProcXvPutStill(client); | ||||||
|  |         case xv_GetVideo: | ||||||
|  |             return ProcXvGetVideo(client); | ||||||
|  |         case xv_GetStill: | ||||||
|  |             return ProcXvGetStill(client); | ||||||
|  |         case xv_StopVideo: | ||||||
|  |             return ProcXvStopVideo(client); | ||||||
|  |         case xv_SelectVideoNotify: | ||||||
|  |             return ProcXvSelectVideoNotify(client); | ||||||
|  |         case xv_SelectPortNotify: | ||||||
|  |             return ProcXvSelectPortNotify(client); | ||||||
|  |         case xv_QueryBestSize: | ||||||
|  |             return ProcXvQueryBestSize(client); | ||||||
|  |         case xv_SetPortAttribute: | ||||||
|  |             return ProcXvSetPortAttribute(client); | ||||||
|  |         case xv_GetPortAttribute: | ||||||
|  |             return ProcXvGetPortAttribute(client); | ||||||
|  |         case xv_QueryPortAttributes: | ||||||
|  |             return ProcXvQueryPortAttributes(client); | ||||||
|  |         case xv_ListImageFormats: | ||||||
|  |             return ProcXvListImageFormats(client); | ||||||
|  |         case xv_QueryImageAttributes: | ||||||
|  |             return ProcXvQueryImageAttributes(client); | ||||||
|  |         case xv_PutImage: | ||||||
|  |             return ProcXvPutImage(client); | ||||||
|  |         case xv_ShmPutImage: | ||||||
|  |             return ProcXvShmPutImage(client); | ||||||
|  |         default: | ||||||
|  |             return BadRequest; | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
|     return XvProcVector[stuff->data] (client); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /* Swapped Procs */ | /* Swapped Procs */ | ||||||
|  | @ -1174,7 +1193,7 @@ SProcXvQueryAdaptors(ClientPtr client) | ||||||
|     REQUEST(xvQueryAdaptorsReq); |     REQUEST(xvQueryAdaptorsReq); | ||||||
|     REQUEST_SIZE_MATCH(xvQueryAdaptorsReq); |     REQUEST_SIZE_MATCH(xvQueryAdaptorsReq); | ||||||
|     swapl(&stuff->window); |     swapl(&stuff->window); | ||||||
|     return XvProcVector[xv_QueryAdaptors] (client); |     return ProcXvQueryAdaptors(client); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int _X_COLD | static int _X_COLD | ||||||
|  | @ -1183,7 +1202,7 @@ SProcXvQueryEncodings(ClientPtr client) | ||||||
|     REQUEST(xvQueryEncodingsReq); |     REQUEST(xvQueryEncodingsReq); | ||||||
|     REQUEST_SIZE_MATCH(xvQueryEncodingsReq); |     REQUEST_SIZE_MATCH(xvQueryEncodingsReq); | ||||||
|     swapl(&stuff->port); |     swapl(&stuff->port); | ||||||
|     return XvProcVector[xv_QueryEncodings] (client); |     return ProcXvQueryEncodings(client); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int _X_COLD | static int _X_COLD | ||||||
|  | @ -1193,7 +1212,7 @@ SProcXvGrabPort(ClientPtr client) | ||||||
|     REQUEST_SIZE_MATCH(xvGrabPortReq); |     REQUEST_SIZE_MATCH(xvGrabPortReq); | ||||||
|     swapl(&stuff->port); |     swapl(&stuff->port); | ||||||
|     swapl(&stuff->time); |     swapl(&stuff->time); | ||||||
|     return XvProcVector[xv_GrabPort] (client); |     return ProcXvGrabPort(client); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int _X_COLD | static int _X_COLD | ||||||
|  | @ -1203,7 +1222,7 @@ SProcXvUngrabPort(ClientPtr client) | ||||||
|     REQUEST_SIZE_MATCH(xvUngrabPortReq); |     REQUEST_SIZE_MATCH(xvUngrabPortReq); | ||||||
|     swapl(&stuff->port); |     swapl(&stuff->port); | ||||||
|     swapl(&stuff->time); |     swapl(&stuff->time); | ||||||
|     return XvProcVector[xv_UngrabPort] (client); |     return ProcXvUngrabPort(client); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int _X_COLD | static int _X_COLD | ||||||
|  | @ -1222,7 +1241,7 @@ SProcXvPutVideo(ClientPtr client) | ||||||
|     swaps(&stuff->drw_y); |     swaps(&stuff->drw_y); | ||||||
|     swaps(&stuff->drw_w); |     swaps(&stuff->drw_w); | ||||||
|     swaps(&stuff->drw_h); |     swaps(&stuff->drw_h); | ||||||
|     return XvProcVector[xv_PutVideo] (client); |     return ProcXvPutVideo(client); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int _X_COLD | static int _X_COLD | ||||||
|  | @ -1241,7 +1260,7 @@ SProcXvPutStill(ClientPtr client) | ||||||
|     swaps(&stuff->drw_y); |     swaps(&stuff->drw_y); | ||||||
|     swaps(&stuff->drw_w); |     swaps(&stuff->drw_w); | ||||||
|     swaps(&stuff->drw_h); |     swaps(&stuff->drw_h); | ||||||
|     return XvProcVector[xv_PutStill] (client); |     return ProcXvPutStill(client); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int _X_COLD | static int _X_COLD | ||||||
|  | @ -1260,7 +1279,7 @@ SProcXvGetVideo(ClientPtr client) | ||||||
|     swaps(&stuff->drw_y); |     swaps(&stuff->drw_y); | ||||||
|     swaps(&stuff->drw_w); |     swaps(&stuff->drw_w); | ||||||
|     swaps(&stuff->drw_h); |     swaps(&stuff->drw_h); | ||||||
|     return XvProcVector[xv_GetVideo] (client); |     return ProcXvGetVideo(client); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int _X_COLD | static int _X_COLD | ||||||
|  | @ -1279,7 +1298,7 @@ SProcXvGetStill(ClientPtr client) | ||||||
|     swaps(&stuff->drw_y); |     swaps(&stuff->drw_y); | ||||||
|     swaps(&stuff->drw_w); |     swaps(&stuff->drw_w); | ||||||
|     swaps(&stuff->drw_h); |     swaps(&stuff->drw_h); | ||||||
|     return XvProcVector[xv_GetStill] (client); |     return ProcXvGetStill(client); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int _X_COLD | static int _X_COLD | ||||||
|  | @ -1301,7 +1320,7 @@ SProcXvPutImage(ClientPtr client) | ||||||
|     swaps(&stuff->drw_h); |     swaps(&stuff->drw_h); | ||||||
|     swaps(&stuff->width); |     swaps(&stuff->width); | ||||||
|     swaps(&stuff->height); |     swaps(&stuff->height); | ||||||
|     return XvProcVector[xv_PutImage] (client); |     return ProcXvPutImage(client); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #ifdef MITSHM | #ifdef MITSHM | ||||||
|  | @ -1326,7 +1345,7 @@ SProcXvShmPutImage(ClientPtr client) | ||||||
|     swaps(&stuff->drw_h); |     swaps(&stuff->drw_h); | ||||||
|     swaps(&stuff->width); |     swaps(&stuff->width); | ||||||
|     swaps(&stuff->height); |     swaps(&stuff->height); | ||||||
|     return XvProcVector[xv_ShmPutImage] (client); |     return ProcXvShmPutImage(client); | ||||||
| } | } | ||||||
| #else                           /* MITSHM */ | #else                           /* MITSHM */ | ||||||
| #define SProcXvShmPutImage ProcXvShmPutImage | #define SProcXvShmPutImage ProcXvShmPutImage | ||||||
|  | @ -1338,7 +1357,7 @@ SProcXvSelectVideoNotify(ClientPtr client) | ||||||
|     REQUEST(xvSelectVideoNotifyReq); |     REQUEST(xvSelectVideoNotifyReq); | ||||||
|     REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq); |     REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq); | ||||||
|     swapl(&stuff->drawable); |     swapl(&stuff->drawable); | ||||||
|     return XvProcVector[xv_SelectVideoNotify] (client); |     return ProcXvSelectVideoNotify(client); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int _X_COLD | static int _X_COLD | ||||||
|  | @ -1347,7 +1366,7 @@ SProcXvSelectPortNotify(ClientPtr client) | ||||||
|     REQUEST(xvSelectPortNotifyReq); |     REQUEST(xvSelectPortNotifyReq); | ||||||
|     REQUEST_SIZE_MATCH(xvSelectPortNotifyReq); |     REQUEST_SIZE_MATCH(xvSelectPortNotifyReq); | ||||||
|     swapl(&stuff->port); |     swapl(&stuff->port); | ||||||
|     return XvProcVector[xv_SelectPortNotify] (client); |     return ProcXvSelectPortNotify(client); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int _X_COLD | static int _X_COLD | ||||||
|  | @ -1357,7 +1376,7 @@ SProcXvStopVideo(ClientPtr client) | ||||||
|     REQUEST_SIZE_MATCH(xvStopVideoReq); |     REQUEST_SIZE_MATCH(xvStopVideoReq); | ||||||
|     swapl(&stuff->port); |     swapl(&stuff->port); | ||||||
|     swapl(&stuff->drawable); |     swapl(&stuff->drawable); | ||||||
|     return XvProcVector[xv_StopVideo] (client); |     return ProcXvStopVideo(client); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int _X_COLD | static int _X_COLD | ||||||
|  | @ -1368,7 +1387,7 @@ SProcXvSetPortAttribute(ClientPtr client) | ||||||
|     swapl(&stuff->port); |     swapl(&stuff->port); | ||||||
|     swapl(&stuff->attribute); |     swapl(&stuff->attribute); | ||||||
|     swapl(&stuff->value); |     swapl(&stuff->value); | ||||||
|     return XvProcVector[xv_SetPortAttribute] (client); |     return ProcXvSetPortAttribute(client); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int _X_COLD | static int _X_COLD | ||||||
|  | @ -1378,7 +1397,7 @@ SProcXvGetPortAttribute(ClientPtr client) | ||||||
|     REQUEST_SIZE_MATCH(xvGetPortAttributeReq); |     REQUEST_SIZE_MATCH(xvGetPortAttributeReq); | ||||||
|     swapl(&stuff->port); |     swapl(&stuff->port); | ||||||
|     swapl(&stuff->attribute); |     swapl(&stuff->attribute); | ||||||
|     return XvProcVector[xv_GetPortAttribute] (client); |     return ProcXvGetPortAttribute(client); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int _X_COLD | static int _X_COLD | ||||||
|  | @ -1391,7 +1410,7 @@ SProcXvQueryBestSize(ClientPtr client) | ||||||
|     swaps(&stuff->vid_h); |     swaps(&stuff->vid_h); | ||||||
|     swaps(&stuff->drw_w); |     swaps(&stuff->drw_w); | ||||||
|     swaps(&stuff->drw_h); |     swaps(&stuff->drw_h); | ||||||
|     return XvProcVector[xv_QueryBestSize] (client); |     return ProcXvQueryBestSize(client); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int _X_COLD | static int _X_COLD | ||||||
|  | @ -1400,7 +1419,7 @@ SProcXvQueryPortAttributes(ClientPtr client) | ||||||
|     REQUEST(xvQueryPortAttributesReq); |     REQUEST(xvQueryPortAttributesReq); | ||||||
|     REQUEST_SIZE_MATCH(xvQueryPortAttributesReq); |     REQUEST_SIZE_MATCH(xvQueryPortAttributesReq); | ||||||
|     swapl(&stuff->port); |     swapl(&stuff->port); | ||||||
|     return XvProcVector[xv_QueryPortAttributes] (client); |     return ProcXvQueryPortAttributes(client); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int _X_COLD | static int _X_COLD | ||||||
|  | @ -1412,7 +1431,7 @@ SProcXvQueryImageAttributes(ClientPtr client) | ||||||
|     swapl(&stuff->id); |     swapl(&stuff->id); | ||||||
|     swaps(&stuff->width); |     swaps(&stuff->width); | ||||||
|     swaps(&stuff->height); |     swaps(&stuff->height); | ||||||
|     return XvProcVector[xv_QueryImageAttributes] (client); |     return ProcXvQueryImageAttributes(client); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int _X_COLD | static int _X_COLD | ||||||
|  | @ -1421,29 +1440,9 @@ SProcXvListImageFormats(ClientPtr client) | ||||||
|     REQUEST(xvListImageFormatsReq); |     REQUEST(xvListImageFormatsReq); | ||||||
|     REQUEST_SIZE_MATCH(xvListImageFormatsReq); |     REQUEST_SIZE_MATCH(xvListImageFormatsReq); | ||||||
|     swapl(&stuff->port); |     swapl(&stuff->port); | ||||||
|     return XvProcVector[xv_ListImageFormats] (client); |     return ProcXvListImageFormats(client); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int (*SXvProcVector[xvNumRequests]) (ClientPtr) = { |  | ||||||
|         ProcXvQueryExtension, |  | ||||||
|         SProcXvQueryAdaptors, |  | ||||||
|         SProcXvQueryEncodings, |  | ||||||
|         SProcXvGrabPort, |  | ||||||
|         SProcXvUngrabPort, |  | ||||||
|         SProcXvPutVideo, |  | ||||||
|         SProcXvPutStill, |  | ||||||
|         SProcXvGetVideo, |  | ||||||
|         SProcXvGetStill, |  | ||||||
|         SProcXvStopVideo, |  | ||||||
|         SProcXvSelectVideoNotify, |  | ||||||
|         SProcXvSelectPortNotify, |  | ||||||
|         SProcXvQueryBestSize, |  | ||||||
|         SProcXvSetPortAttribute, |  | ||||||
|         SProcXvGetPortAttribute, |  | ||||||
|         SProcXvQueryPortAttributes, |  | ||||||
|         SProcXvListImageFormats, |  | ||||||
|         SProcXvQueryImageAttributes, SProcXvPutImage, SProcXvShmPutImage,}; |  | ||||||
| 
 |  | ||||||
| int _X_COLD | int _X_COLD | ||||||
| SProcXvDispatch(ClientPtr client) | SProcXvDispatch(ClientPtr client) | ||||||
| { | { | ||||||
|  | @ -1451,11 +1450,50 @@ SProcXvDispatch(ClientPtr client) | ||||||
| 
 | 
 | ||||||
|     UpdateCurrentTime(); |     UpdateCurrentTime(); | ||||||
| 
 | 
 | ||||||
|     if (stuff->data >= xvNumRequests) { |     switch (stuff->data) { | ||||||
|         return BadRequest; |         case xv_QueryExtension: | ||||||
|  |             return ProcXvQueryExtension(client); | ||||||
|  |         case xv_QueryAdaptors: | ||||||
|  |             return SProcXvQueryAdaptors(client); | ||||||
|  |         case xv_QueryEncodings: | ||||||
|  |             return SProcXvQueryEncodings(client); | ||||||
|  |         case xv_GrabPort: | ||||||
|  |             return SProcXvGrabPort(client); | ||||||
|  |         case xv_UngrabPort: | ||||||
|  |             return SProcXvUngrabPort(client); | ||||||
|  |         case xv_PutVideo: | ||||||
|  |             return SProcXvPutVideo(client); | ||||||
|  |         case xv_PutStill: | ||||||
|  |             return SProcXvPutStill(client); | ||||||
|  |         case xv_GetVideo: | ||||||
|  |             return SProcXvGetVideo(client); | ||||||
|  |         case xv_GetStill: | ||||||
|  |             return SProcXvGetStill(client); | ||||||
|  |         case xv_StopVideo: | ||||||
|  |             return SProcXvStopVideo(client); | ||||||
|  |         case xv_SelectVideoNotify: | ||||||
|  |             return SProcXvSelectVideoNotify(client); | ||||||
|  |         case xv_SelectPortNotify: | ||||||
|  |             return SProcXvSelectPortNotify(client); | ||||||
|  |         case xv_QueryBestSize: | ||||||
|  |             return SProcXvQueryBestSize(client); | ||||||
|  |         case xv_SetPortAttribute: | ||||||
|  |             return SProcXvSetPortAttribute(client); | ||||||
|  |         case xv_GetPortAttribute: | ||||||
|  |             return SProcXvGetPortAttribute(client); | ||||||
|  |         case xv_QueryPortAttributes: | ||||||
|  |             return SProcXvQueryPortAttributes(client); | ||||||
|  |         case xv_ListImageFormats: | ||||||
|  |             return SProcXvListImageFormats(client); | ||||||
|  |         case xv_QueryImageAttributes: | ||||||
|  |             return SProcXvQueryImageAttributes(client); | ||||||
|  |         case xv_PutImage: | ||||||
|  |             return SProcXvPutImage(client); | ||||||
|  |         case xv_ShmPutImage: | ||||||
|  |             return SProcXvShmPutImage(client); | ||||||
|  |         default: | ||||||
|  |             return BadRequest; | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
|     return SXvProcVector[stuff->data] (client); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #ifdef PANORAMIX | #ifdef PANORAMIX | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue