(submit/vrr-driver-api) modesetting: use new VRR mode signaling DDX/driver API
Instead of highjacking core request handlers, use the recently introduced DDX/driver API. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
		
							parent
							
								
									0f38f8c2b6
								
							
						
					
					
						commit
						f79b89241d
					
				|  | @ -62,11 +62,6 @@ SOFTWARE. | ||||||
| #include "swaprep.h" | #include "swaprep.h" | ||||||
| #include "xace.h" | #include "xace.h" | ||||||
| 
 | 
 | ||||||
| #ifdef XINERAMA |  | ||||||
| #include "Xext/panoramiX.h" |  | ||||||
| #include "Xext/panoramiXsrv.h" |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| /*****************************************************************
 | /*****************************************************************
 | ||||||
|  * Property Stuff |  * Property Stuff | ||||||
|  * |  * | ||||||
|  | @ -132,7 +127,7 @@ notifyVRRMode(ClientPtr pClient, WindowPtr pWindow, int state, PropertyPtr pProp | ||||||
| 
 | 
 | ||||||
|     WindowVRRMode mode = (WindowVRRMode)(state == PropertyNewValue ? (*((uint32_t*)pProp->data)) : 0); |     WindowVRRMode mode = (WindowVRRMode)(state == PropertyNewValue ? (*((uint32_t*)pProp->data)) : 0); | ||||||
| 
 | 
 | ||||||
| #ifdef PANORAMIX | #ifdef XINERAMA | ||||||
|     if (!noPanoramiXExtension) { |     if (!noPanoramiXExtension) { | ||||||
|         PanoramiXRes *win; |         PanoramiXRes *win; | ||||||
|         int rc, j; |         int rc, j; | ||||||
|  |  | ||||||
|  | @ -87,14 +87,6 @@ static Bool ms_pci_probe(DriverPtr driver, | ||||||
|                          intptr_t match_data); |                          intptr_t match_data); | ||||||
| static Bool ms_driver_func(ScrnInfoPtr scrn, xorgDriverFuncOp op, void *data); | static Bool ms_driver_func(ScrnInfoPtr scrn, xorgDriverFuncOp op, void *data); | ||||||
| 
 | 
 | ||||||
| /* window wrapper functions used to get the notification when
 |  | ||||||
|  * the window property changes */ |  | ||||||
| static Atom vrr_atom; |  | ||||||
| static Bool property_vectors_wrapped; |  | ||||||
| static Bool restore_property_vector; |  | ||||||
| static int (*saved_change_property) (ClientPtr client); |  | ||||||
| static int (*saved_delete_property) (ClientPtr client); |  | ||||||
| 
 |  | ||||||
| #ifdef XSERVER_LIBPCIACCESS | #ifdef XSERVER_LIBPCIACCESS | ||||||
| static const struct pci_id_match ms_device_match[] = { | static const struct pci_id_match ms_device_match[] = { | ||||||
|     { |     { | ||||||
|  | @ -907,8 +899,9 @@ ms_window_has_variable_refresh(modesettingPtr ms, WindowPtr win) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void | static void | ||||||
| ms_vrr_property_update(WindowPtr window, Bool variable_refresh) | msSetWindowVRRMode(WindowPtr window, WindowVRRMode mode) | ||||||
| { | { | ||||||
|  |     Bool variable_refresh = (mode == WINDOW_VRR_ENABLED); | ||||||
|     ScrnInfoPtr scrn = xf86ScreenToScrn(window->drawable.pScreen); |     ScrnInfoPtr scrn = xf86ScreenToScrn(window->drawable.pScreen); | ||||||
|     modesettingPtr ms = modesettingPTR(scrn); |     modesettingPtr ms = modesettingPTR(scrn); | ||||||
| 
 | 
 | ||||||
|  | @ -920,112 +913,6 @@ ms_vrr_property_update(WindowPtr window, Bool variable_refresh) | ||||||
|         ms_present_set_screen_vrr(scrn, variable_refresh); |         ms_present_set_screen_vrr(scrn, variable_refresh); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /* Wrapper for xserver/dix/property.c:ProcChangeProperty */ |  | ||||||
| static int |  | ||||||
| ms_change_property(ClientPtr client) |  | ||||||
| { |  | ||||||
|     WindowPtr window = NULL; |  | ||||||
|     int ret = 0; |  | ||||||
| 
 |  | ||||||
|     REQUEST(xChangePropertyReq); |  | ||||||
| 
 |  | ||||||
|     client->requestVector[X_ChangeProperty] = saved_change_property; |  | ||||||
|     ret = saved_change_property(client); |  | ||||||
| 
 |  | ||||||
|     if (restore_property_vector) |  | ||||||
|         return ret; |  | ||||||
| 
 |  | ||||||
|     client->requestVector[X_ChangeProperty] = ms_change_property; |  | ||||||
| 
 |  | ||||||
|     if (ret != Success) |  | ||||||
|         return ret; |  | ||||||
| 
 |  | ||||||
|     ret = dixLookupWindow(&window, stuff->window, client, DixSetPropAccess); |  | ||||||
|     if (ret != Success) |  | ||||||
|         return ret; |  | ||||||
| 
 |  | ||||||
|     // Checking for the VRR property change on the window
 |  | ||||||
|     if (stuff->property == vrr_atom && |  | ||||||
|         xf86ScreenToScrn(window->drawable.pScreen)->PreInit == PreInit && |  | ||||||
|         stuff->format == 32 && stuff->nUnits == 1) { |  | ||||||
|         uint32_t *value = (uint32_t *)(stuff + 1); |  | ||||||
|         ms_vrr_property_update(window, *value != 0); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     return ret; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /* Wrapper for xserver/dix/property.c:ProcDeleteProperty */ |  | ||||||
| static int |  | ||||||
| ms_delete_property(ClientPtr client) |  | ||||||
| { |  | ||||||
|     WindowPtr window; |  | ||||||
|     int ret; |  | ||||||
| 
 |  | ||||||
|     REQUEST(xDeletePropertyReq); |  | ||||||
| 
 |  | ||||||
|     client->requestVector[X_DeleteProperty] = saved_delete_property; |  | ||||||
|     ret = saved_delete_property(client); |  | ||||||
| 
 |  | ||||||
|     if (restore_property_vector) |  | ||||||
|         return ret; |  | ||||||
| 
 |  | ||||||
|     client->requestVector[X_DeleteProperty] = ms_delete_property; |  | ||||||
| 
 |  | ||||||
|     if (ret != Success) |  | ||||||
|         return ret; |  | ||||||
| 
 |  | ||||||
|     ret = dixLookupWindow(&window, stuff->window, client, DixSetPropAccess); |  | ||||||
|     if (ret != Success) |  | ||||||
|         return ret; |  | ||||||
| 
 |  | ||||||
|     if (stuff->property == vrr_atom && |  | ||||||
|         xf86ScreenToScrn(window->drawable.pScreen)->PreInit == PreInit) |  | ||||||
|         ms_vrr_property_update(window, FALSE); |  | ||||||
| 
 |  | ||||||
|     return ret; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static void |  | ||||||
| ms_unwrap_property_requests(ScrnInfoPtr scrn) |  | ||||||
| { |  | ||||||
|     int i; |  | ||||||
| 
 |  | ||||||
|     if (!property_vectors_wrapped) |  | ||||||
|         return; |  | ||||||
| 
 |  | ||||||
|     if (ProcVector[X_ChangeProperty] == ms_change_property) |  | ||||||
|         ProcVector[X_ChangeProperty] = saved_change_property; |  | ||||||
|     else |  | ||||||
|         restore_property_vector = TRUE; |  | ||||||
| 
 |  | ||||||
|     if (ProcVector[X_DeleteProperty] == ms_delete_property) |  | ||||||
|         ProcVector[X_DeleteProperty] = saved_delete_property; |  | ||||||
|     else |  | ||||||
|         restore_property_vector = TRUE; |  | ||||||
| 
 |  | ||||||
|     for (i = 0; i < currentMaxClients; i++) { |  | ||||||
|         if (clients[i]->requestVector[X_ChangeProperty] == ms_change_property) { |  | ||||||
|             clients[i]->requestVector[X_ChangeProperty] = saved_change_property; |  | ||||||
|         } else { |  | ||||||
|             restore_property_vector = TRUE; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if (clients[i]->requestVector[X_DeleteProperty] == ms_delete_property) { |  | ||||||
|             clients[i]->requestVector[X_DeleteProperty] = saved_delete_property; |  | ||||||
|         } else { |  | ||||||
|             restore_property_vector = TRUE; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     if (restore_property_vector) { |  | ||||||
|         xf86DrvMsg(scrn->scrnIndex, X_WARNING, |  | ||||||
|                    "Couldn't unwrap some window property request vectors\n"); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     property_vectors_wrapped = FALSE; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static void | static void | ||||||
| FreeScreen(ScrnInfoPtr pScrn) | FreeScreen(ScrnInfoPtr pScrn) | ||||||
| { | { | ||||||
|  | @ -1045,7 +932,6 @@ FreeScreen(ScrnInfoPtr pScrn) | ||||||
|         ms_ent = ms_ent_priv(pScrn); |         ms_ent = ms_ent_priv(pScrn); | ||||||
|         ms_ent->fd_ref--; |         ms_ent->fd_ref--; | ||||||
|         if (!ms_ent->fd_ref) { |         if (!ms_ent->fd_ref) { | ||||||
|             ms_unwrap_property_requests(pScrn); |  | ||||||
|             if (ms->pEnt->location.type == BUS_PCI) |             if (ms->pEnt->location.type == BUS_PCI) | ||||||
|                 ret = drmClose(ms->fd); |                 ret = drmClose(ms->fd); | ||||||
|             else |             else | ||||||
|  | @ -2191,17 +2077,8 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv) | ||||||
| 
 | 
 | ||||||
|     pScrn->vtSema = TRUE; |     pScrn->vtSema = TRUE; | ||||||
| 
 | 
 | ||||||
|     if (ms->vrr_support) { |     if (ms->vrr_support) | ||||||
|         if (!property_vectors_wrapped) { |         pScreen->SetWindowVRRMode = msSetWindowVRRMode; | ||||||
|             saved_change_property = ProcVector[X_ChangeProperty]; |  | ||||||
|             ProcVector[X_ChangeProperty] = ms_change_property; |  | ||||||
|             saved_delete_property = ProcVector[X_DeleteProperty]; |  | ||||||
|             ProcVector[X_DeleteProperty] = ms_delete_property; |  | ||||||
|             property_vectors_wrapped = TRUE; |  | ||||||
|         } |  | ||||||
|         vrr_atom = MakeAtom("_VARIABLE_REFRESH", |  | ||||||
|                              strlen("_VARIABLE_REFRESH"), TRUE); |  | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
|     return TRUE; |     return TRUE; | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue