Compare commits
2 Commits
master
...
submit/vrr
Author | SHA1 | Date | |
---|---|---|---|
|
a09884578a | ||
|
b0f305b106 |
|
@ -59,6 +59,11 @@ SOFTWARE.
|
|||
#include "swaprep.h"
|
||||
#include "xace.h"
|
||||
|
||||
#ifdef PANORAMIX
|
||||
#include "Xext/panoramiX.h"
|
||||
#include "Xext/panoramiXsrv.h"
|
||||
#endif
|
||||
|
||||
/*****************************************************************
|
||||
* Property Stuff
|
||||
*
|
||||
|
@ -107,6 +112,46 @@ dixLookupProperty(PropertyPtr *result, WindowPtr pWin, Atom propertyName,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static void
|
||||
setVRRMode(WindowPtr pWin, WindowVRRMode mode)
|
||||
{
|
||||
SetWindowVRRModeProcPtr proc = pWin->drawable.pScreen->SetWindowVRRMode;
|
||||
if (proc != NULL)
|
||||
proc(pWin, mode);
|
||||
}
|
||||
|
||||
static void
|
||||
notifyVRRMode(ClientPtr pClient, WindowPtr pWindow, int state, PropertyPtr pProp)
|
||||
{
|
||||
const char *pName = NameForAtom(pProp->propertyName);
|
||||
if (pName == NULL || strcmp(pName, "_VARIABLE_REFRESH") || pProp->format != 32 || pProp->size != 1)
|
||||
return;
|
||||
|
||||
WindowVRRMode mode = (WindowVRRMode)(state == PropertyNewValue ? (*((uint32_t*)pProp->data)) : 0);
|
||||
|
||||
#ifdef PANORAMIX
|
||||
if (!noPanoramiXExtension) {
|
||||
PanoramiXRes *win;
|
||||
int rc, j;
|
||||
|
||||
rc = dixLookupResourceByType((void **) &win, pWindow->drawable.id, XRT_WINDOW,
|
||||
pClient, DixWriteAccess);
|
||||
if (rc != Success)
|
||||
goto no_panoramix;
|
||||
|
||||
FOR_NSCREENS_BACKWARD(j) {
|
||||
WindowPtr pWin;
|
||||
rc = dixLookupWindow(&pWin, win->info[j].id, pClient, DixSetPropAccess);
|
||||
if (rc == Success)
|
||||
setVRRMode(pWin, mode);
|
||||
}
|
||||
}
|
||||
return;
|
||||
no_panoramix:
|
||||
#endif
|
||||
setVRRMode(pWindow, mode);
|
||||
}
|
||||
|
||||
CallbackListPtr PropertyStateCallback;
|
||||
|
||||
static void
|
||||
|
@ -187,6 +232,7 @@ ProcRotateProperties(ClientPtr client)
|
|||
for (i = 0; i < stuff->nAtoms; i++) {
|
||||
j = (i + delta) % stuff->nAtoms;
|
||||
deliverPropertyNotifyEvent(pWin, PropertyNewValue, props[i]);
|
||||
notifyVRRMode(client, pWin, PropertyNewValue, props[i]);
|
||||
|
||||
/* Preserve name and devPrivates */
|
||||
props[j]->type = saved[i].type;
|
||||
|
@ -366,8 +412,10 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
|
|||
else
|
||||
return rc;
|
||||
|
||||
if (sendevent)
|
||||
if (sendevent) {
|
||||
deliverPropertyNotifyEvent(pWin, PropertyNewValue, pProp);
|
||||
notifyVRRMode(pClient, pWin, PropertyNewValue, pProp);
|
||||
}
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
@ -397,6 +445,7 @@ DeleteProperty(ClientPtr client, WindowPtr pWin, Atom propName)
|
|||
}
|
||||
|
||||
deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp);
|
||||
notifyVRRMode(client, pWin, PropertyDelete, pProp);
|
||||
free(pProp->data);
|
||||
dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
|
||||
}
|
||||
|
@ -533,7 +582,10 @@ ProcGetProperty(ClientPtr client)
|
|||
};
|
||||
|
||||
if (stuff->delete && (reply.bytesAfter == 0))
|
||||
{
|
||||
deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp);
|
||||
notifyVRRMode(client, pWin, PropertyDelete, pProp);
|
||||
}
|
||||
|
||||
WriteReplyToClient(client, sizeof(xGenericReply), &reply);
|
||||
if (len) {
|
||||
|
|
|
@ -85,14 +85,6 @@ static Bool ms_pci_probe(DriverPtr driver,
|
|||
intptr_t match_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
|
||||
static const struct pci_id_match ms_device_match[] = {
|
||||
{
|
||||
|
@ -903,8 +895,9 @@ ms_window_has_variable_refresh(modesettingPtr ms, WindowPtr win) {
|
|||
}
|
||||
|
||||
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);
|
||||
modesettingPtr ms = modesettingPTR(scrn);
|
||||
|
||||
|
@ -916,112 +909,6 @@ ms_vrr_property_update(WindowPtr window, Bool 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
|
||||
FreeScreen(ScrnInfoPtr pScrn)
|
||||
{
|
||||
|
@ -1041,7 +928,6 @@ FreeScreen(ScrnInfoPtr pScrn)
|
|||
ms_ent = ms_ent_priv(pScrn);
|
||||
ms_ent->fd_ref--;
|
||||
if (!ms_ent->fd_ref) {
|
||||
ms_unwrap_property_requests(pScrn);
|
||||
if (ms->pEnt->location.type == BUS_PCI)
|
||||
ret = drmClose(ms->fd);
|
||||
else
|
||||
|
@ -2191,17 +2077,8 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
|
|||
|
||||
pScrn->vtSema = TRUE;
|
||||
|
||||
if (ms->vrr_support) {
|
||||
if (!property_vectors_wrapped) {
|
||||
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);
|
||||
}
|
||||
if (ms->vrr_support)
|
||||
pScreen->SetWindowVRRMode = msSetWindowVRRMode;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -324,6 +324,7 @@ conf_data.set('SYSCONS_SUPPORT', supports_syscons ? '1' : false)
|
|||
conf_data.set('WSCONS_SUPPORT', supports_wscons ? '1' : false)
|
||||
conf_data.set('XSERVER_LIBPCIACCESS', get_option('pciaccess') ? '1' : false)
|
||||
conf_data.set('XSERVER_PLATFORM_BUS', build_udev_kms ? '1' : false)
|
||||
conf_data.set('XSERVER_SCREEN_VRR', '1')
|
||||
|
||||
configure_file(output : 'dix-config.h',
|
||||
configuration : conf_data)
|
||||
|
|
|
@ -90,6 +90,11 @@ typedef struct _ScreenSaverStuff {
|
|||
Bool /*force */ );
|
||||
} ScreenSaverStuffRec;
|
||||
|
||||
typedef enum {
|
||||
WINDOW_VRR_DISABLED = 0,
|
||||
WINDOW_VRR_ENABLED,
|
||||
} WindowVRRMode;
|
||||
|
||||
/*
|
||||
* There is a typedef for each screen function pointer so that code that
|
||||
* needs to declare a screen function pointer (e.g. in a screen private
|
||||
|
@ -177,6 +182,8 @@ typedef void (*ClipNotifyProcPtr) (WindowPtr /*pWindow */ ,
|
|||
int /*dx */ ,
|
||||
int /*dy */ );
|
||||
|
||||
typedef void (*SetWindowVRRModeProcPtr) (WindowPtr pWindow, WindowVRRMode mode);
|
||||
|
||||
/* pixmap will exist only for the duration of the current rendering operation */
|
||||
#define CREATE_PIXMAP_USAGE_SCRATCH 1
|
||||
/* pixmap will be the backing pixmap for a redirected window */
|
||||
|
@ -545,6 +552,7 @@ typedef struct _Screen {
|
|||
ClipNotifyProcPtr ClipNotify;
|
||||
RestackWindowProcPtr RestackWindow;
|
||||
PaintWindowProcPtr PaintWindow;
|
||||
SetWindowVRRModeProcPtr SetWindowVRRMode;
|
||||
|
||||
/* Pixmap procedures */
|
||||
|
||||
|
|
Loading…
Reference in New Issue