(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
a5c42ba050
commit
806f613d18
|
@ -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[] = {
|
||||||
{
|
{
|
||||||
|
@ -905,8 +897,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);
|
||||||
|
|
||||||
|
@ -918,112 +911,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
|
||||||
FreeRec(ScrnInfoPtr pScrn)
|
FreeRec(ScrnInfoPtr pScrn)
|
||||||
{
|
{
|
||||||
|
@ -1043,7 +930,6 @@ FreeRec(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
|
||||||
|
@ -2193,17 +2079,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