GLX: Add a function to change a clients vendor list.
Add a new function, GlxServerExports::setClientScreenVendor, which will change the vendor that handles GLX requests for a screen, but only for requests from a specific client. v2: Increment the GLXVND minor version number. v3: Note the GLXVND version requirement for setClientScreenVendor. Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
		
							parent
							
								
									8b67ec7cc6
								
							
						
					
					
						commit
						56c0a71fdd
					
				|  | @ -324,6 +324,7 @@ _X_EXPORT const GlxServerExports glxServer = { | ||||||
|     .getContextTagPrivate = GlxGetContextTagPrivate, |     .getContextTagPrivate = GlxGetContextTagPrivate, | ||||||
|     .getVendorForScreen = GlxGetVendorForScreen, |     .getVendorForScreen = GlxGetVendorForScreen, | ||||||
|     .forwardRequest =  GlxForwardRequest, |     .forwardRequest =  GlxForwardRequest, | ||||||
|  |     .setClientScreenVendor = GlxSetClientScreenVendor, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| const GlxServerExports * | const GlxServerExports * | ||||||
|  |  | ||||||
|  | @ -107,6 +107,7 @@ GlxContextTagInfo *GlxLookupContextTag(ClientPtr client, GLXContextTag tag); | ||||||
| void GlxFreeContextTag(GlxContextTagInfo *tagInfo); | void GlxFreeContextTag(GlxContextTagInfo *tagInfo); | ||||||
| 
 | 
 | ||||||
| Bool GlxSetScreenVendor(ScreenPtr screen, GlxServerVendor *vendor); | Bool GlxSetScreenVendor(ScreenPtr screen, GlxServerVendor *vendor); | ||||||
|  | Bool GlxSetClientScreenVendor(ClientPtr client, ScreenPtr screen, GlxServerVendor *vendor); | ||||||
| GlxScreenPriv *GlxGetScreen(ScreenPtr pScreen); | GlxScreenPriv *GlxGetScreen(ScreenPtr pScreen); | ||||||
| GlxServerVendor *GlxGetVendorForScreen(ClientPtr client, ScreenPtr screen); | GlxServerVendor *GlxGetVendorForScreen(ClientPtr client, ScreenPtr screen); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -189,6 +189,27 @@ Bool GlxSetScreenVendor(ScreenPtr screen, GlxServerVendor *vendor) | ||||||
|     return TRUE; |     return TRUE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | Bool GlxSetClientScreenVendor(ClientPtr client, ScreenPtr screen, GlxServerVendor *vendor) | ||||||
|  | { | ||||||
|  |     GlxClientPriv *cl; | ||||||
|  | 
 | ||||||
|  |     if (screen == NULL || screen->isGPU) { | ||||||
|  |         return FALSE; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     cl = GlxGetClientData(client); | ||||||
|  |     if (cl == NULL) { | ||||||
|  |         return FALSE; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     if (vendor != NULL) { | ||||||
|  |         cl->vendors[screen->myNum] = vendor; | ||||||
|  |     } else { | ||||||
|  |         cl->vendors[screen->myNum] = GlxGetVendorForScreen(NULL, screen); | ||||||
|  |     } | ||||||
|  |     return TRUE; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| GlxServerVendor *GlxGetVendorForScreen(ClientPtr client, ScreenPtr screen) | GlxServerVendor *GlxGetVendorForScreen(ClientPtr client, ScreenPtr screen) | ||||||
| { | { | ||||||
|     // Note that the client won't be sending GPU screen numbers, so we don't
 |     // Note that the client won't be sending GPU screen numbers, so we don't
 | ||||||
|  |  | ||||||
|  | @ -75,7 +75,7 @@ | ||||||
|  * will still work. |  * will still work. | ||||||
|  */ |  */ | ||||||
| #define GLXSERVER_VENDOR_ABI_MAJOR_VERSION 0 | #define GLXSERVER_VENDOR_ABI_MAJOR_VERSION 0 | ||||||
| #define GLXSERVER_VENDOR_ABI_MINOR_VERSION 0 | #define GLXSERVER_VENDOR_ABI_MINOR_VERSION 1 | ||||||
| 
 | 
 | ||||||
| #if defined(__cplusplus) | #if defined(__cplusplus) | ||||||
| extern "C" { | extern "C" { | ||||||
|  | @ -236,6 +236,17 @@ typedef struct GlxServerExportsRec { | ||||||
|      * \param client The client. |      * \param client The client. | ||||||
|      */ |      */ | ||||||
|     int (* forwardRequest) (GlxServerVendor *vendor, ClientPtr client); |     int (* forwardRequest) (GlxServerVendor *vendor, ClientPtr client); | ||||||
|  | 
 | ||||||
|  |     /**
 | ||||||
|  |      * Sets the vendor library to use for a screen for a specific client. | ||||||
|  |      * | ||||||
|  |      * This function changes which vendor should handle GLX requests for a | ||||||
|  |      * screen. Unlike \c setScreenVendor, this function can be called at any | ||||||
|  |      * time, and only applies to requests from a single client. | ||||||
|  |      * | ||||||
|  |      * This function is available in GLXVND version 0.1 or later. | ||||||
|  |      */ | ||||||
|  |     Bool (* setClientScreenVendor) (ClientPtr client, ScreenPtr screen, GlxServerVendor *vendor); | ||||||
| } GlxServerExports; | } GlxServerExports; | ||||||
| 
 | 
 | ||||||
| extern _X_EXPORT const GlxServerExports glxServer; | extern _X_EXPORT const GlxServerExports glxServer; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue