aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/randr/randr.c
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-06-21 04:12:07 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-06-21 04:12:07 +0200
commit17f3e3bc5157eeb6018ddaa6d862ca94f4b02b2b (patch)
tree38cc2874f114bc6a564c9aa518196da93b1f67dc /nx-X11/programs/Xserver/randr/randr.c
parent9013a24da1830b445c03ba273e80774fd1d68fd7 (diff)
parent4c8fc6be8f530d3bc84d1097bd2cb6a4af6c77fc (diff)
downloadnx-libs-17f3e3bc5157eeb6018ddaa6d862ca94f4b02b2b.tar.gz
nx-libs-17f3e3bc5157eeb6018ddaa6d862ca94f4b02b2b.tar.bz2
nx-libs-17f3e3bc5157eeb6018ddaa6d862ca94f4b02b2b.zip
Merge branch 'sunweaver-pr/xrandr-extension-upgrade-1.5' into 3.6.x
Attributes GH PR #137: https://github.com/ArcticaProject/nx-libs/pull/137 Reviewed by: Ulrich Sibiller <uli42@gmx.de> -- Mon, 20 Jun 2016 12:40:52 -0700
Diffstat (limited to 'nx-X11/programs/Xserver/randr/randr.c')
-rw-r--r--nx-X11/programs/Xserver/randr/randr.c715
1 files changed, 486 insertions, 229 deletions
diff --git a/nx-X11/programs/Xserver/randr/randr.c b/nx-X11/programs/Xserver/randr/randr.c
index eb50aeb3d..b78a947c8 100644
--- a/nx-X11/programs/Xserver/randr/randr.c
+++ b/nx-X11/programs/Xserver/randr/randr.c
@@ -50,91 +50,97 @@
#include "randrstr.h"
+#ifndef NXAGENT_SERVER
+#include "extinit.h"
+#endif
+
/* From render.h */
#ifndef SubPixelUnknown
#define SubPixelUnknown 0
#endif
#define RR_VALIDATE
-static int RRNScreens;
+static int RRNScreens;
#define wrap(priv,real,mem,func) {\
- priv->mem = real->mem; \
- real->mem = func; \
+ ((ScreenPtr)priv)->mem = ((ScreenPtr)real)->mem; \
+ ((ScreenPtr)real)->mem = func; \
}
#define unwrap(priv,real,mem) {\
- real->mem = priv->mem; \
+ ((ScreenPtr)real)->mem = ((ScreenPtr)priv)->mem; \
}
-static int ProcRRDispatch (ClientPtr pClient);
-static int SProcRRDispatch (ClientPtr pClient);
+static int ProcRRDispatch(ClientPtr pClient);
+static int SProcRRDispatch(ClientPtr pClient);
-int RREventBase;
-int RRErrorBase;
-RESTYPE RRClientType, RREventType; /* resource types for event masks */
+int RREventBase;
+int RRErrorBase;
+RESTYPE RRClientType, RREventType; /* resource types for event masks */
#ifndef NXAGENT_SERVER
DevPrivateKey RRClientPrivateKey = &RRClientPrivateKey;
DevPrivateKey rrPrivKey = &rrPrivKey;
#else
-int RRClientPrivateIndex;
-int rrPrivIndex = -1;
+int RRClientPrivateIndex;
+int rrPrivIndex = -1;
#endif
static void
-RRClientCallback (CallbackListPtr *list,
- void * closure,
- void * data)
+RRClientCallback(CallbackListPtr *list, void *closure, void *data)
{
- NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
- ClientPtr pClient = clientinfo->client;
+ NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
+ ClientPtr pClient = clientinfo->client;
+
rrClientPriv(pClient);
- RRTimesPtr pTimes = (RRTimesPtr) (pRRClient + 1);
- int i;
+ RRTimesPtr pTimes = (RRTimesPtr) (pRRClient + 1);
+ int i;
pRRClient->major_version = 0;
pRRClient->minor_version = 0;
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- ScreenPtr pScreen = screenInfo.screens[i];
- rrScrPriv(pScreen);
-
- if (pScrPriv)
- {
- pTimes[i].setTime = pScrPriv->lastSetTime;
- pTimes[i].configTime = pScrPriv->lastConfigTime;
- }
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+
+ rrScrPriv(pScreen);
+
+ if (pScrPriv) {
+ pTimes[i].setTime = pScrPriv->lastSetTime;
+ pTimes[i].configTime = pScrPriv->lastConfigTime;
+ }
}
}
-static void
-RRResetProc (ExtensionEntry *extEntry)
-{
-}
-
static Bool
-RRCloseScreen (int i, ScreenPtr pScreen)
+RRCloseScreen(
+#ifdef NXAGENT_SERVER
+ int i,
+#endif
+ ScreenPtr pScreen)
{
rrScrPriv(pScreen);
- int j;
+ int j;
- unwrap (pScrPriv, pScreen, CloseScreen);
+ unwrap(pScrPriv, pScreen, CloseScreen);
for (j = pScrPriv->numCrtcs - 1; j >= 0; j--)
- RRCrtcDestroy (pScrPriv->crtcs[j]);
+ RRCrtcDestroy(pScrPriv->crtcs[j]);
for (j = pScrPriv->numOutputs - 1; j >= 0; j--)
- RROutputDestroy (pScrPriv->outputs[j]);
-
- xfree (pScrPriv->crtcs);
- xfree (pScrPriv->outputs);
- xfree (pScrPriv);
- RRNScreens -= 1; /* ok, one fewer screen with RandR running */
- return (*pScreen->CloseScreen) (i, pScreen);
+ RROutputDestroy(pScrPriv->outputs[j]);
+
+ if (pScrPriv->provider)
+ RRProviderDestroy(pScrPriv->provider);
+
+ RRMonitorClose(pScreen);
+
+ xfree(pScrPriv->crtcs);
+ xfree(pScrPriv->outputs);
+ xfree(pScrPriv);
+ RRNScreens -= 1; /* ok, one fewer screen with RandR running */
+ return (*pScreen->CloseScreen) (i, pScreen);
}
static void
-SRRScreenChangeNotifyEvent(xRRScreenChangeNotifyEvent *from,
- xRRScreenChangeNotifyEvent *to)
+SRRScreenChangeNotifyEvent(xRRScreenChangeNotifyEvent * from,
+ xRRScreenChangeNotifyEvent * to)
{
to->type = from->type;
to->rotation = from->rotation;
@@ -144,16 +150,16 @@ SRRScreenChangeNotifyEvent(xRRScreenChangeNotifyEvent *from,
cpswapl(from->root, to->root);
cpswapl(from->window, to->window);
cpswaps(from->sizeID, to->sizeID);
+ cpswaps(from->subpixelOrder, to->subpixelOrder);
cpswaps(from->widthInPixels, to->widthInPixels);
cpswaps(from->heightInPixels, to->heightInPixels);
cpswaps(from->widthInMillimeters, to->widthInMillimeters);
cpswaps(from->heightInMillimeters, to->heightInMillimeters);
- cpswaps(from->subpixelOrder, to->subpixelOrder);
}
static void
-SRRCrtcChangeNotifyEvent(xRRCrtcChangeNotifyEvent *from,
- xRRCrtcChangeNotifyEvent *to)
+SRRCrtcChangeNotifyEvent(xRRCrtcChangeNotifyEvent * from,
+ xRRCrtcChangeNotifyEvent * to)
{
to->type = from->type;
to->subCode = from->subCode;
@@ -162,8 +168,8 @@ SRRCrtcChangeNotifyEvent(xRRCrtcChangeNotifyEvent *from,
cpswapl(from->window, to->window);
cpswapl(from->crtc, to->crtc);
cpswapl(from->mode, to->mode);
- cpswapl(from->window, to->window);
cpswaps(from->rotation, to->rotation);
+ /* pad1 */
cpswaps(from->x, to->x);
cpswaps(from->y, to->y);
cpswaps(from->width, to->width);
@@ -171,8 +177,8 @@ SRRCrtcChangeNotifyEvent(xRRCrtcChangeNotifyEvent *from,
}
static void
-SRROutputChangeNotifyEvent(xRROutputChangeNotifyEvent *from,
- xRROutputChangeNotifyEvent *to)
+SRROutputChangeNotifyEvent(xRROutputChangeNotifyEvent * from,
+ xRROutputChangeNotifyEvent * to)
{
to->type = from->type;
to->subCode = from->subCode;
@@ -184,11 +190,13 @@ SRROutputChangeNotifyEvent(xRROutputChangeNotifyEvent *from,
cpswapl(from->crtc, to->crtc);
cpswapl(from->mode, to->mode);
cpswaps(from->rotation, to->rotation);
+ to->connection = from->connection;
+ to->subpixelOrder = from->subpixelOrder;
}
static void
-SRROutputPropertyNotifyEvent(xRROutputPropertyNotifyEvent *from,
- xRROutputPropertyNotifyEvent *to)
+SRROutputPropertyNotifyEvent(xRROutputPropertyNotifyEvent * from,
+ xRROutputPropertyNotifyEvent * to)
{
to->type = from->type;
to->subCode = from->subCode;
@@ -197,61 +205,125 @@ SRROutputPropertyNotifyEvent(xRROutputPropertyNotifyEvent *from,
cpswapl(from->output, to->output);
cpswapl(from->atom, to->atom);
cpswapl(from->timestamp, to->timestamp);
+ to->state = from->state;
+ /* pad1 */
+ /* pad2 */
+ /* pad3 */
+ /* pad4 */
}
static void
-SRRNotifyEvent (xEvent *from,
- xEvent *to)
+SRRProviderChangeNotifyEvent(xRRProviderChangeNotifyEvent * from,
+ xRRProviderChangeNotifyEvent * to)
+{
+ to->type = from->type;
+ to->subCode = from->subCode;
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->timestamp, to->timestamp);
+ cpswapl(from->window, to->window);
+ cpswapl(from->provider, to->provider);
+}
+
+static void
+SRRProviderPropertyNotifyEvent(xRRProviderPropertyNotifyEvent * from,
+ xRRProviderPropertyNotifyEvent * to)
+{
+ to->type = from->type;
+ to->subCode = from->subCode;
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->window, to->window);
+ cpswapl(from->provider, to->provider);
+ cpswapl(from->atom, to->atom);
+ cpswapl(from->timestamp, to->timestamp);
+ to->state = from->state;
+ /* pad1 */
+ /* pad2 */
+ /* pad3 */
+ /* pad4 */
+}
+
+static void
+SRRResourceChangeNotifyEvent(xRRResourceChangeNotifyEvent * from,
+ xRRResourceChangeNotifyEvent * to)
+{
+ to->type = from->type;
+ to->subCode = from->subCode;
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->timestamp, to->timestamp);
+ cpswapl(from->window, to->window);
+}
+
+static void
+SRRNotifyEvent(xEvent *from, xEvent *to)
{
switch (from->u.u.detail) {
case RRNotify_CrtcChange:
- SRRCrtcChangeNotifyEvent ((xRRCrtcChangeNotifyEvent *) from,
- (xRRCrtcChangeNotifyEvent *) to);
- break;
+ SRRCrtcChangeNotifyEvent((xRRCrtcChangeNotifyEvent *) from,
+ (xRRCrtcChangeNotifyEvent *) to);
+ break;
case RRNotify_OutputChange:
- SRROutputChangeNotifyEvent ((xRROutputChangeNotifyEvent *) from,
- (xRROutputChangeNotifyEvent *) to);
- break;
+ SRROutputChangeNotifyEvent((xRROutputChangeNotifyEvent *) from,
+ (xRROutputChangeNotifyEvent *) to);
+ break;
case RRNotify_OutputProperty:
- SRROutputPropertyNotifyEvent ((xRROutputPropertyNotifyEvent *) from,
- (xRROutputPropertyNotifyEvent *) to);
- break;
+ SRROutputPropertyNotifyEvent((xRROutputPropertyNotifyEvent *) from,
+ (xRROutputPropertyNotifyEvent *) to);
+ break;
+ case RRNotify_ProviderChange:
+ SRRProviderChangeNotifyEvent((xRRProviderChangeNotifyEvent *) from,
+ (xRRProviderChangeNotifyEvent *) to);
+ break;
+ case RRNotify_ProviderProperty:
+ SRRProviderPropertyNotifyEvent((xRRProviderPropertyNotifyEvent *) from,
+ (xRRProviderPropertyNotifyEvent *) to);
+ break;
+ case RRNotify_ResourceChange:
+ SRRResourceChangeNotifyEvent((xRRResourceChangeNotifyEvent *) from,
+ (xRRResourceChangeNotifyEvent *) to);
default:
- break;
+ break;
}
}
static int RRGeneration;
-Bool RRInit (void)
+Bool
+RRInit(void)
{
- if (RRGeneration != serverGeneration)
- {
- #ifdef NXAGENT_SERVER
- if ((rrPrivIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
- #endif
- if (!RRModeInit ())
- return FALSE;
- if (!RRCrtcInit ())
- return FALSE;
- if (!RROutputInit ())
- return FALSE;
- RRGeneration = serverGeneration;
+ if (RRGeneration != serverGeneration) {
+#ifdef NXAGENT_SERVER
+ if ((rrPrivIndex = AllocateScreenPrivateIndex()) < 0)
+ return FALSE;
+#endif
+ if (!RRModeInit())
+ return FALSE;
+ if (!RRCrtcInit())
+ return FALSE;
+ if (!RROutputInit())
+ return FALSE;
+ if (!RRProviderInit())
+ return FALSE;
+ RRGeneration = serverGeneration;
}
+#ifndef NXAGENT_SERVER
+ if (!dixRegisterPrivateKey(&rrPrivKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+#endif /* !defined(NXAGENT_SERVER) */
+
return TRUE;
}
-Bool RRScreenInit(ScreenPtr pScreen)
+Bool
+RRScreenInit(ScreenPtr pScreen)
{
- rrScrPrivPtr pScrPriv;
+ rrScrPrivPtr pScrPriv;
- if (!RRInit ())
- return FALSE;
+ if (!RRInit())
+ return FALSE;
- pScrPriv = (rrScrPrivPtr) xcalloc (1, sizeof (rrScrPrivRec));
+ pScrPriv = (rrScrPrivPtr) xcalloc(1, sizeof(rrScrPrivRec));
if (!pScrPriv)
- return FALSE;
+ return FALSE;
SetRRScreen(pScreen, pScrPriv);
@@ -261,7 +333,7 @@ Bool RRScreenInit(ScreenPtr pScreen)
pScrPriv->rrGetInfo = 0;
pScrPriv->maxWidth = pScrPriv->minWidth = pScreen->width;
pScrPriv->maxHeight = pScrPriv->minHeight = pScreen->height;
-
+
pScrPriv->width = pScreen->width;
pScrPriv->height = pScreen->height;
pScrPriv->mmWidth = pScreen->mmWidth;
@@ -271,7 +343,7 @@ Bool RRScreenInit(ScreenPtr pScreen)
pScrPriv->rrCrtcSet = NULL;
pScrPriv->rrCrtcSetGamma = NULL;
#endif
-#if RANDR_10_INTERFACE
+#if RANDR_10_INTERFACE
pScrPriv->rrSetConfig = 0;
pScrPriv->rotations = RR_Rotate_0;
pScrPriv->reqWidth = pScreen->width;
@@ -282,7 +354,7 @@ Bool RRScreenInit(ScreenPtr pScreen)
pScrPriv->rate = 0;
pScrPriv->size = 0;
#endif
-
+
/*
* This value doesn't really matter -- any client must call
* GetScreenInfo before reading it which will automatically update
@@ -290,179 +362,357 @@ Bool RRScreenInit(ScreenPtr pScreen)
*/
pScrPriv->lastSetTime = currentTime;
pScrPriv->lastConfigTime = currentTime;
-
- wrap (pScrPriv, pScreen, CloseScreen, RRCloseScreen);
+ wrap(pScrPriv, pScreen, CloseScreen, RRCloseScreen);
+
+ pScreen->ConstrainCursorHarder = RRConstrainCursorHarder;
+ pScreen->ReplaceScanoutPixmap = RRReplaceScanoutPixmap;
pScrPriv->numOutputs = 0;
pScrPriv->outputs = NULL;
pScrPriv->numCrtcs = 0;
pScrPriv->crtcs = NULL;
-
- RRNScreens += 1; /* keep count of screens that implement randr */
+
+ RRMonitorInit(pScreen);
+
+ RRNScreens += 1; /* keep count of screens that implement randr */
return TRUE;
}
-/*ARGSUSED*/
-static int
-RRFreeClient (void * data, XID id)
+ /*ARGSUSED*/ static int
+RRFreeClient(void *data, XID id)
{
- RREventPtr pRREvent;
- WindowPtr pWin;
- RREventPtr *pHead, pCur, pPrev;
+ RREventPtr pRREvent;
+ WindowPtr pWin;
+ RREventPtr *pHead, pCur, pPrev;
pRREvent = (RREventPtr) data;
pWin = pRREvent->window;
+#ifndef NXAGENT_SERVER
+ dixLookupResourceByType((void **) &pHead, pWin->drawable.id,
+ RREventType, serverClient, DixDestroyAccess);
+#else /* !defined(NXAGENT_SERVER) */
pHead = (RREventPtr *) LookupIDByType(pWin->drawable.id, RREventType);
+#endif /* !defined(NXAGENT_SERVER) */
+
if (pHead) {
- pPrev = 0;
- for (pCur = *pHead; pCur && pCur != pRREvent; pCur=pCur->next)
- pPrev = pCur;
- if (pCur)
- {
- if (pPrev)
- pPrev->next = pRREvent->next;
- else
- *pHead = pRREvent->next;
- }
+ pPrev = 0;
+ for (pCur = *pHead; pCur && pCur != pRREvent; pCur = pCur->next)
+ pPrev = pCur;
+ if (pCur) {
+ if (pPrev)
+ pPrev->next = pRREvent->next;
+ else
+ *pHead = pRREvent->next;
+ }
}
- xfree ((void *) pRREvent);
+ xfree((void *) pRREvent);
return 1;
}
-/*ARGSUSED*/
-static int
-RRFreeEvents (void * data, XID id)
+ /*ARGSUSED*/ static int
+RRFreeEvents(void *data, XID id)
{
- RREventPtr *pHead, pCur, pNext;
+ RREventPtr *pHead, pCur, pNext;
pHead = (RREventPtr *) data;
for (pCur = *pHead; pCur; pCur = pNext) {
- pNext = pCur->next;
- FreeResource (pCur->clientResource, RRClientType);
- xfree ((void *) pCur);
+ pNext = pCur->next;
+ FreeResource(pCur->clientResource, RRClientType);
+ xfree((void *) pCur);
}
- xfree ((void *) pHead);
+ xfree((void *) pHead);
return 1;
}
void
-RRExtensionInit (void)
+RRExtensionInit(void)
{
ExtensionEntry *extEntry;
- if (RRNScreens == 0) return;
-
- #ifndef NXAGENT_SERVER
- if (!dixRequestPrivate(RRClientPrivateKey,
- sizeof (RRClientRec) +
- screenInfo.numScreens * sizeof (RRTimesRec)))
- return;
- #else
- RRClientPrivateIndex = AllocateClientPrivateIndex ();
- if (!AllocateClientPrivate (RRClientPrivateIndex,
- sizeof (RRClientRec) +
- screenInfo.numScreens * sizeof (RRTimesRec)))
- return;
- #endif
- if (!AddCallback (&ClientStateCallback, RRClientCallback, 0))
- return;
-
- RRClientType = CreateNewResourceType(RRFreeClient);
+ if (RRNScreens == 0)
+ return;
+
+#ifndef NXAGENT_SERVER
+ if (!dixRegisterPrivateKey(&RRClientPrivateKeyRec, PRIVATE_CLIENT,
+ sizeof(RRClientRec) +
+ screenInfo.numScreens * sizeof(RRTimesRec)))
+ return;
+#else /* !defined(NXAGENT_SERVER) */
+ RRClientPrivateIndex = AllocateClientPrivateIndex();
+ if (!AllocateClientPrivate(RRClientPrivateIndex,
+ sizeof(RRClientRec) +
+ screenInfo.numScreens * sizeof(RRTimesRec)))
+ return;
+#endif /* !defined(NXAGENT_SERVER) */
+
+ if (!AddCallback(&ClientStateCallback, RRClientCallback, 0))
+ return;
+
+ RRClientType = CreateNewResourceType(RRFreeClient
+#ifndef NXAGENT_SERVER
+ , "RandRClient"
+#endif
+ );
if (!RRClientType)
- return;
- RREventType = CreateNewResourceType(RRFreeEvents);
+ return;
+ RREventType = CreateNewResourceType(RRFreeEvents
+#ifndef NXAGENT_SERVER
+ , "RandREvent"
+#endif
+ );
if (!RREventType)
- return;
- extEntry = AddExtension (RANDR_NAME, RRNumberEvents, RRNumberErrors,
- ProcRRDispatch, SProcRRDispatch,
- RRResetProc, StandardMinorOpcode);
+ return;
+ extEntry = AddExtension(RANDR_NAME, RRNumberEvents, RRNumberErrors,
+ ProcRRDispatch, SProcRRDispatch,
+ NULL, StandardMinorOpcode);
if (!extEntry)
- return;
+ return;
RRErrorBase = extEntry->errorBase;
RREventBase = extEntry->eventBase;
- EventSwapVector[RREventBase + RRScreenChangeNotify] = (EventSwapPtr)
- SRRScreenChangeNotifyEvent;
+ EventSwapVector[RREventBase + RRScreenChangeNotify] = (EventSwapPtr)
+ SRRScreenChangeNotifyEvent;
EventSwapVector[RREventBase + RRNotify] = (EventSwapPtr)
- SRRNotifyEvent;
+ SRRNotifyEvent;
+
+ RRModeInitErrorValue();
+ RRCrtcInitErrorValue();
+ RROutputInitErrorValue();
+ RRProviderInitErrorValue();
#ifdef PANORAMIX
RRXineramaExtensionInit();
#endif
}
+void
+RRResourcesChanged(ScreenPtr pScreen)
+{
+ rrScrPriv(pScreen);
+ pScrPriv->resourcesChanged = TRUE;
+
+ RRSetChanged(pScreen);
+}
+
+static void
+RRDeliverResourceEvent(ClientPtr client, WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ rrScrPriv(pScreen);
+
+ xRRResourceChangeNotifyEvent re = {
+ .type = RRNotify + RREventBase,
+ .subCode = RRNotify_ResourceChange,
+#ifdef NXAGENT_SERVER
+ .sequenceNumber = client->sequence,
+#endif
+ .timestamp = pScrPriv->lastSetTime.milliseconds,
+ .window = pWin->drawable.id
+ };
+
+ WriteEventsToClient(client, 1, (xEvent *) &re);
+}
+
static int
-TellChanged (WindowPtr pWin, void * value)
+TellChanged(WindowPtr pWin, void *value)
{
- RREventPtr *pHead, pRREvent;
- ClientPtr client;
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ RREventPtr *pHead, pRREvent;
+ ClientPtr client;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+#ifndef NXAGENT_SERVER
+ ScreenPtr iter;
+ rrScrPrivPtr pSlaveScrPriv;
+#endif
+
rrScrPriv(pScreen);
- int i;
+ int i;
- pHead = (RREventPtr *) LookupIDByType (pWin->drawable.id, RREventType);
+#ifndef NXAGENT_SERVER
+ dixLookupResourceByType((void **) &pHead, pWin->drawable.id,
+ RREventType, serverClient, DixReadAccess);
+#else /* !defined(NXAGENT_SERVER) */
+ pHead = (RREventPtr *) LookupIDByType(pWin->drawable.id, RREventType);
+#endif /* !defined(NXAGENT_SERVER) */
if (!pHead)
- return WT_WALKCHILDREN;
+ return WT_WALKCHILDREN;
- for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next)
- {
- client = pRREvent->client;
- if (client == serverClient || client->clientGone)
- continue;
-
- if (pRREvent->mask & RRScreenChangeNotifyMask)
- RRDeliverScreenEvent (client, pWin, pScreen);
-
- if (pRREvent->mask & RRCrtcChangeNotifyMask)
- {
- for (i = 0; i < pScrPriv->numCrtcs; i++)
- {
- RRCrtcPtr crtc = pScrPriv->crtcs[i];
- if (crtc->changed)
- RRDeliverCrtcEvent (client, pWin, crtc);
- }
- }
-
- if (pRREvent->mask & RROutputChangeNotifyMask)
- {
- for (i = 0; i < pScrPriv->numOutputs; i++)
- {
- RROutputPtr output = pScrPriv->outputs[i];
- if (output->changed)
- RRDeliverOutputEvent (client, pWin, output);
- }
- }
+ for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) {
+ client = pRREvent->client;
+ if (client == serverClient || client->clientGone)
+ continue;
+
+ if (pRREvent->mask & RRScreenChangeNotifyMask)
+ RRDeliverScreenEvent(client, pWin, pScreen);
+
+ if (pRREvent->mask & RRCrtcChangeNotifyMask) {
+ for (i = 0; i < pScrPriv->numCrtcs; i++) {
+ RRCrtcPtr crtc = pScrPriv->crtcs[i];
+
+ if (crtc->changed)
+ RRDeliverCrtcEvent(client, pWin, crtc);
+ }
+
+#ifndef NXAGENT_SERVER
+ xorg_list_for_each_entry(iter, &pScreen->output_slave_list, output_head) {
+ pSlaveScrPriv = rrGetScrPriv(iter);
+ for (i = 0; i < pSlaveScrPriv->numCrtcs; i++) {
+ RRCrtcPtr crtc = pSlaveScrPriv->crtcs[i];
+
+ if (crtc->changed)
+ RRDeliverCrtcEvent(client, pWin, crtc);
+ }
+ }
+#endif
+ }
+
+ if (pRREvent->mask & RROutputChangeNotifyMask) {
+ for (i = 0; i < pScrPriv->numOutputs; i++) {
+ RROutputPtr output = pScrPriv->outputs[i];
+
+ if (output->changed)
+ RRDeliverOutputEvent(client, pWin, output);
+ }
+
+#ifndef NXAGENT_SERVER
+ xorg_list_for_each_entry(iter, &pScreen->output_slave_list, output_head) {
+ pSlaveScrPriv = rrGetScrPriv(iter);
+ for (i = 0; i < pSlaveScrPriv->numOutputs; i++) {
+ RROutputPtr output = pSlaveScrPriv->outputs[i];
+
+ if (output->changed)
+ RRDeliverOutputEvent(client, pWin, output);
+ }
+ }
+#endif
+ }
+
+#ifndef NXAGENT_SERVER
+ if (pRREvent->mask & RRProviderChangeNotifyMask) {
+ xorg_list_for_each_entry(iter, &pScreen->output_slave_list, output_head) {
+ pSlaveScrPriv = rrGetScrPriv(iter);
+ if (pSlaveScrPriv->provider->changed)
+ RRDeliverProviderEvent(client, pWin, pSlaveScrPriv->provider);
+ }
+ xorg_list_for_each_entry(iter, &pScreen->offload_slave_list, offload_head) {
+ pSlaveScrPriv = rrGetScrPriv(iter);
+ if (pSlaveScrPriv->provider->changed)
+ RRDeliverProviderEvent(client, pWin, pSlaveScrPriv->provider);
+ }
+ xorg_list_for_each_entry(iter, &pScreen->unattached_list, unattached_head) {
+ pSlaveScrPriv = rrGetScrPriv(iter);
+ if (pSlaveScrPriv->provider->changed)
+ RRDeliverProviderEvent(client, pWin, pSlaveScrPriv->provider);
+ }
+ }
+#endif
+
+ if (pRREvent->mask & RRResourceChangeNotifyMask) {
+ if (pScrPriv->resourcesChanged) {
+ RRDeliverResourceEvent(client, pWin);
+ }
+ }
}
return WT_WALKCHILDREN;
}
+void
+RRSetChanged(ScreenPtr pScreen)
+{
+#ifndef NXAGENT_SERVER
+ /* set changed bits on the master screen only */
+ ScreenPtr master;
+
+ rrScrPriv(pScreen);
+ rrScrPrivPtr mastersp;
+
+ if (pScreen->isGPU) {
+ master = pScreen->current_master;
+ if (!master)
+ return;
+ mastersp = rrGetScrPriv(master);
+ }
+ else
+ {
+ master = pScreen;
+ mastersp = pScrPriv;
+ }
+
+ mastersp->changed = TRUE;
+#else /* !defined(NXAGENT_SERVER) */
+ rrScrPriv(pScreen);
+ pScrPriv->changed = TRUE;
+#endif
+}
+
/*
* Something changed; send events and adjust pointer position
*/
void
-RRTellChanged (ScreenPtr pScreen)
+RRTellChanged(ScreenPtr pScreen)
{
- rrScrPriv (pScreen);
+ ScreenPtr master;
+ rrScrPriv(pScreen);
+ rrScrPrivPtr mastersp;
int i;
-
- if (pScrPriv->changed)
+#ifndef NXAGENT_SERVER
+ ScreenPtr iter;
+ rrScrPrivPtr pSlaveScrPriv;
+#endif
+
+#ifndef NXAGENT_SERVER
+ if (pScreen->isGPU) {
+ master = pScreen->current_master;
+ mastersp = rrGetScrPriv(master);
+ }
+ else
+#endif
{
- UpdateCurrentTime ();
- if (pScrPriv->configChanged)
- {
- pScrPriv->lastConfigTime = currentTime;
- pScrPriv->configChanged = FALSE;
- }
- pScrPriv->changed = FALSE;
- WalkTree (pScreen, TellChanged, (void *) pScreen);
- for (i = 0; i < pScrPriv->numOutputs; i++)
- pScrPriv->outputs[i]->changed = FALSE;
- for (i = 0; i < pScrPriv->numCrtcs; i++)
- pScrPriv->crtcs[i]->changed = FALSE;
- if (pScrPriv->layoutChanged)
- {
- pScrPriv->layoutChanged = FALSE;
- RRPointerScreenConfigured (pScreen);
- RRSendConfigNotify (pScreen);
- }
+ master = pScreen;
+ mastersp = pScrPriv;
+ }
+
+ if (mastersp->changed) {
+ UpdateCurrentTimeIf();
+ if (mastersp->configChanged) {
+ mastersp->lastConfigTime = currentTime;
+ mastersp->configChanged = FALSE;
+ }
+ pScrPriv->changed = FALSE;
+ mastersp->changed = FALSE;
+
+ WalkTree(master, TellChanged, (void *) master);
+
+ mastersp->resourcesChanged = FALSE;
+
+ for (i = 0; i < pScrPriv->numOutputs; i++)
+ pScrPriv->outputs[i]->changed = FALSE;
+ for (i = 0; i < pScrPriv->numCrtcs; i++)
+ pScrPriv->crtcs[i]->changed = FALSE;
+
+#ifndef NXAGENT_SERVER
+ xorg_list_for_each_entry(iter, &master->output_slave_list, output_head) {
+ pSlaveScrPriv = rrGetScrPriv(iter);
+ pSlaveScrPriv->provider->changed = FALSE;
+ for (i = 0; i < pSlaveScrPriv->numOutputs; i++)
+ pSlaveScrPriv->outputs[i]->changed = FALSE;
+ for (i = 0; i < pSlaveScrPriv->numCrtcs; i++)
+ pSlaveScrPriv->crtcs[i]->changed = FALSE;
+ }
+ xorg_list_for_each_entry(iter, &master->offload_slave_list, offload_head) {
+ pSlaveScrPriv = rrGetScrPriv(iter);
+ pSlaveScrPriv->provider->changed = FALSE;
+ }
+ xorg_list_for_each_entry(iter, &master->unattached_list, unattached_head) {
+ pSlaveScrPriv = rrGetScrPriv(iter);
+ pSlaveScrPriv->provider->changed = FALSE;
+ }
+#endif /* !defined(NXAGENT_SERVER) */
+
+ if (mastersp->layoutChanged) {
+ pScrPriv->layoutChanged = FALSE;
+ RRPointerScreenConfigured(master);
+ RRSendConfigNotify(master);
+ }
}
}
@@ -471,53 +721,60 @@ RRTellChanged (ScreenPtr pScreen)
* Used in emulating 1.0 behaviour
*/
RROutputPtr
-RRFirstOutput (ScreenPtr pScreen)
+RRFirstOutput(ScreenPtr pScreen)
{
rrScrPriv(pScreen);
- RROutputPtr output;
- int i, j;
-
- for (i = 0; i < pScrPriv->numCrtcs; i++)
- {
- RRCrtcPtr crtc = pScrPriv->crtcs[i];
- for (j = 0; j < pScrPriv->numOutputs; j++)
- {
- output = pScrPriv->outputs[j];
- if (output->crtc == crtc)
- return output;
- }
+ RROutputPtr output;
+ int i, j;
+
+ if (!pScrPriv)
+ return NULL;
+
+ if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc)
+ return pScrPriv->primaryOutput;
+
+ for (i = 0; i < pScrPriv->numCrtcs; i++) {
+ RRCrtcPtr crtc = pScrPriv->crtcs[i];
+
+ for (j = 0; j < pScrPriv->numOutputs; j++) {
+ output = pScrPriv->outputs[j];
+ if (output->crtc == crtc)
+ return output;
+ }
}
return NULL;
}
CARD16
-RRVerticalRefresh (xRRModeInfo *mode)
+RRVerticalRefresh(xRRModeInfo * mode)
{
- CARD32 refresh;
- CARD32 dots = mode->hTotal * mode->vTotal;
+ CARD32 refresh;
+ CARD32 dots = mode->hTotal * mode->vTotal;
+
if (!dots)
- return 0;
- refresh = (mode->dotClock + dots/2) / dots;
+ return 0;
+ refresh = (mode->dotClock + dots / 2) / dots;
if (refresh > 0xffff)
- refresh = 0xffff;
+ refresh = 0xffff;
return (CARD16) refresh;
}
static int
-ProcRRDispatch (ClientPtr client)
+ProcRRDispatch(ClientPtr client)
{
REQUEST(xReq);
if (stuff->data >= RRNumberRequests || !ProcRandrVector[stuff->data])
- return BadRequest;
+ return BadRequest;
+ UpdateCurrentTimeIf();
return (*ProcRandrVector[stuff->data]) (client);
}
static int
-SProcRRDispatch (ClientPtr client)
+SProcRRDispatch(ClientPtr client)
{
REQUEST(xReq);
- if (stuff->data >= RRNumberRequests || !ProcRandrVector[stuff->data])
- return BadRequest;
+ if (stuff->data >= RRNumberRequests || !SProcRandrVector[stuff->data])
+ return BadRequest;
+ UpdateCurrentTimeIf();
return (*SProcRandrVector[stuff->data]) (client);
}
-