xserver: Branch 'server-1.6-branch' - 6 commits
Adam Jackson
ajax at kemper.freedesktop.org
Tue Dec 16 10:47:46 PST 2008
Xext/sync.c | 51 +++++++++++++++++++----
randr/randr.c | 3 +
randr/randrstr.h | 8 +++
randr/rrdispatch.c | 2
randr/rroutput.c | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++-
randr/rrscreen.c | 17 ++++++-
randr/rrsdispatch.c | 27 ++++++++++++
randr/rrxinerama.c | 48 ++++++++++++++--------
8 files changed, 237 insertions(+), 31 deletions(-)
New commits:
commit ca56d764d2be28c64fe15c9e37d534ef00117ad2
Author: Adam Jackson <ajax at redhat.com>
Date: Wed Dec 10 16:13:20 2008 -0500
xsync: Fix wakeup storm in idletime counter.
Wakeup scheduling only considered the threshold values, and not whether
the trigger was edge or level.
See also:
https://bugzilla.redhat.com/show_bug.cgi?id=474586
http://svn.gnome.org/viewvc/gnome-screensaver/trunk/src/test-idle-ext.c?view=markup
(cherry picked from commit 1f4fb0225b278d1cf4145aebeb0bdd23dc8f62d5)
diff --git a/Xext/sync.c b/Xext/sync.c
index 63f6fa2..1b37366 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -2533,7 +2533,7 @@ SyncInitServerTime(void)
* IDLETIME implementation
*/
-static pointer IdleTimeCounter;
+static SyncCounter *IdleTimeCounter;
static XSyncValue *pIdleTimeValueLess;
static XSyncValue *pIdleTimeValueGreater;
@@ -2545,38 +2545,69 @@ IdleTimeQueryValue (pointer pCounter, CARD64 *pValue_return)
}
static void
-IdleTimeBlockHandler (pointer env,
- struct timeval **wt,
- pointer LastSelectMask)
+IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask)
{
- XSyncValue idle;
+ XSyncValue idle, old_idle;
+ SyncTriggerList *list = IdleTimeCounter->pTriglist;
+ SyncTrigger *trig;
if (!pIdleTimeValueLess && !pIdleTimeValueGreater)
return;
+ old_idle = IdleTimeCounter->value;
IdleTimeQueryValue (NULL, &idle);
+ IdleTimeCounter->value = idle; /* push, so CheckTrigger works */
if (pIdleTimeValueLess &&
XSyncValueLessOrEqual (idle, *pIdleTimeValueLess))
{
- AdjustWaitForDelay (wt, 0);
+ /*
+ * We've been idle for less than the threshold value, and someone
+ * wants to know about that, but now we need to know whether they
+ * want level or edge trigger. Check the trigger list against the
+ * current idle time, and if any succeed, bomb out of select()
+ * immediately so we can reschedule.
+ */
+
+ for (list = IdleTimeCounter->pTriglist; list; list = list->next) {
+ trig = list->pTrigger;
+ if (trig->CheckTrigger(trig, old_idle)) {
+ AdjustWaitForDelay(wt, 0);
+ break;
+ }
+ }
}
else if (pIdleTimeValueGreater)
{
- unsigned long timeout = 0;
+ /*
+ * There's a threshold in the positive direction. If we've been
+ * idle less than it, schedule a wakeup for sometime in the future.
+ * If we've been idle more than it, and someone wants to know about
+ * that level-triggered, schedule an immediate wakeup.
+ */
+ unsigned long timeout = -1;
- if (XSyncValueLessThan (idle, *pIdleTimeValueGreater))
- {
+ if (XSyncValueLessThan (idle, *pIdleTimeValueGreater)) {
XSyncValue value;
Bool overflow;
XSyncValueSubtract (&value, *pIdleTimeValueGreater,
idle, &overflow);
- timeout = XSyncValueLow32 (value);
+ timeout = min(timeout, XSyncValueLow32 (value));
+ } else {
+ for (list = IdleTimeCounter->pTriglist; list; list = list->next) {
+ trig = list->pTrigger;
+ if (trig->CheckTrigger(trig, old_idle)) {
+ timeout = min(timeout, 0);
+ break;
+ }
+ }
}
AdjustWaitForDelay (wt, timeout);
}
+
+ IdleTimeCounter->value = old_idle; /* pop */
}
static void
commit a82f10c5dd9fa74ff18759ab288bbd9c8b7ac4de
Author: Adam Jackson <ajax at redhat.com>
Date: Mon Dec 8 17:42:47 2008 -0500
randr: clear primaryOutput when the output is deleted
(cherry picked from commit 86c64ddf21763972aa7fc8c5770259123c9907b3)
diff --git a/randr/rroutput.c b/randr/rroutput.c
index 48b5700..82c2530 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -380,6 +380,9 @@ RROutputDestroyResource (pointer value, XID pid)
{
rrScrPriv(pScreen);
int i;
+
+ if (pScrPriv->primaryOutput == output)
+ pScrPriv->primaryOutput = NULL;
for (i = 0; i < pScrPriv->numOutputs; i++)
{
commit 2bc53ce66828b6c177e3298fa2f326c77c93e136
Author: Adam Jackson <ajax at redhat.com>
Date: Mon Dec 8 17:40:07 2008 -0500
randr: use primary output for RRFirstOutput()
(cherry picked from commit fe65f400ed16cb39db8c9518b9446f590c34db1a)
diff --git a/randr/randr.c b/randr/randr.c
index 230d816..2e482f0 100644
--- a/randr/randr.c
+++ b/randr/randr.c
@@ -438,6 +438,9 @@ RRFirstOutput (ScreenPtr pScreen)
RROutputPtr output;
int i, j;
+ if (pScrPriv->primaryOutput)
+ return pScrPriv->primaryOutput;
+
for (i = 0; i < pScrPriv->numCrtcs; i++)
{
RRCrtcPtr crtc = pScrPriv->crtcs[i];
commit f0234a9eb88ed103bca7db73a833c472ab95b48f
Author: Adam Jackson <ajax at redhat.com>
Date: Mon Dec 8 17:37:17 2008 -0500
randr: Mangle GetScreenResources sort order based on primary output
(cherry picked from commit cdcb516e561e2f65eb2fa523ca001c57674d5caf)
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index 7a8f2eb..9b1024e 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -324,7 +324,7 @@ rrGetScreenResources(ClientPtr client, Bool query)
rrScrPrivPtr pScrPriv;
CARD8 *extra;
unsigned long extraLen;
- int i, n, rc;
+ int i, n, rc, has_primary;
RRCrtc *crtcs;
RROutput *outputs;
xRRModeInfo *modeinfos;
@@ -401,12 +401,23 @@ rrGetScreenResources(ClientPtr client, Bool query)
outputs = (RROutput *) (crtcs + pScrPriv->numCrtcs);
modeinfos = (xRRModeInfo *) (outputs + pScrPriv->numOutputs);
names = (CARD8 *) (modeinfos + num_modes);
+
+ has_primary = (pScrPriv->primaryOutput != NULL);
+ if (pScrPriv->primaryOutput)
+ {
+ crtcs[0] = pScrPriv->primaryOutput->id;
+ if (client->swapped)
+ swapl (&crtcs[0], n);
+ }
for (i = 0; i < pScrPriv->numCrtcs; i++)
{
- crtcs[i] = pScrPriv->crtcs[i]->id;
+ if (pScrPriv->primaryOutput &&
+ pScrPriv->primaryOutput->crtc == pScrPriv->crtcs[i])
+ continue;
+ crtcs[i + has_primary] = pScrPriv->crtcs[i]->id;
if (client->swapped)
- swapl (&crtcs[i], n);
+ swapl (&crtcs[i + has_primary], n);
}
for (i = 0; i < pScrPriv->numOutputs; i++)
commit 2ef02833d614c42693e019a444560e84f501b5dc
Author: Adam Jackson <ajax at redhat.com>
Date: Mon Dec 8 17:28:55 2008 -0500
randr: Mangle compat Xinerama reply based on primary output
(cherry picked from commit d7b316e82bc7051f8829b4f4a640f50ae91c2db9)
diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c
index 544666f..ad40a1e 100644
--- a/randr/rrxinerama.c
+++ b/randr/rrxinerama.c
@@ -260,6 +260,30 @@ ProcRRXineramaIsActive(ClientPtr client)
return client->noClientException;
}
+static void
+RRXineramaWriteCrtc(ClientPtr client, RRCrtcPtr crtc)
+{
+ xXineramaScreenInfo scratch;
+
+ if (RRXineramaCrtcActive (crtc))
+ {
+ int width, height;
+ RRCrtcGetScanoutSize (crtc, &width, &height);
+ scratch.x_org = crtc->x;
+ scratch.y_org = crtc->y;
+ scratch.width = width;
+ scratch.height = height;
+ if(client->swapped) {
+ register int n;
+ swaps(&scratch.x_org, n);
+ swaps(&scratch.y_org, n);
+ swaps(&scratch.width, n);
+ swaps(&scratch.height, n);
+ }
+ WriteToClient(client, sz_XineramaScreenInfo, &scratch);
+ }
+}
+
int
ProcRRXineramaQueryScreens(ClientPtr client)
{
@@ -291,26 +315,16 @@ ProcRRXineramaQueryScreens(ClientPtr client)
rrScrPriv(pScreen);
xXineramaScreenInfo scratch;
int i;
+ int has_primary = (pScrPriv->primaryOutput != NULL);
+
+ if (has_primary) {
+ RRXineramaWriteCrtc(client, pScrPriv->primaryOutput->crtc);
+ }
for(i = 0; i < pScrPriv->numCrtcs; i++) {
RRCrtcPtr crtc = pScrPriv->crtcs[i];
- if (RRXineramaCrtcActive (crtc))
- {
- int width, height;
- RRCrtcGetScanoutSize (crtc, &width, &height);
- scratch.x_org = crtc->x;
- scratch.y_org = crtc->y;
- scratch.width = width;
- scratch.height = height;
- if(client->swapped) {
- register int n;
- swaps(&scratch.x_org, n);
- swaps(&scratch.y_org, n);
- swaps(&scratch.width, n);
- swaps(&scratch.height, n);
- }
- WriteToClient(client, sz_XineramaScreenInfo, (char *)&scratch);
- }
+ if (!has_primary || (crtc != pScrPriv->primaryOutput->crtc))
+ RRXineramaWriteCrtc(client, crtc);
}
}
commit 0bdfdaa7df8105c7ffc3248a4fdd5f64da67103c
Author: Adam Jackson <ajax at redhat.com>
Date: Tue Dec 9 10:51:37 2008 -0500
randr: Add [GS]etOutputPrimary
(cherry picked from commit 9d58d2a319059989ccdfa758f586149ccdc16df6)
diff --git a/randr/randrstr.h b/randr/randrstr.h
index f6aa5c7..b5cebdc 100644
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -2,6 +2,7 @@
* Copyright © 2000 Compaq Computer Corporation
* Copyright © 2002 Hewlett-Packard Company
* Copyright © 2006 Intel Corporation
+ * Copyright © 2008 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -272,6 +273,7 @@ typedef struct _rrScrPriv {
int numOutputs;
RROutputPtr *outputs;
+ RROutputPtr primaryOutput;
int numCrtcs;
RRCrtcPtr *crtcs;
@@ -822,6 +824,12 @@ RROutputDestroy (RROutputPtr output);
int
ProcRRGetOutputInfo (ClientPtr client);
+extern int
+ProcRRSetOutputPrimary (ClientPtr client);
+
+extern int
+ProcRRGetOutputPrimary (ClientPtr client);
+
/*
* Initialize output type
*/
diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c
index 0cc0bca..5a2ea71 100644
--- a/randr/rrdispatch.c
+++ b/randr/rrdispatch.c
@@ -217,5 +217,7 @@ int (*ProcRandrVector[RRNumberRequests])(ClientPtr) = {
ProcRRGetCrtcTransform, /* 27 */
ProcRRGetPanning, /* 28 */
ProcRRSetPanning, /* 29 */
+ ProcRRSetOutputPrimary, /* 30 */
+ ProcRRGetOutputPrimary, /* 31 */
};
diff --git a/randr/rroutput.c b/randr/rroutput.c
index 1ecde31..48b5700 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -1,5 +1,6 @@
/*
* Copyright © 2006 Keith Packard
+ * Copyright © 2008 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -426,7 +427,7 @@ RROutputInit (void)
}
#define OutputInfoExtra (SIZEOF(xRRGetOutputInfoReply) - 32)
-
+
int
ProcRRGetOutputInfo (ClientPtr client)
{
@@ -533,3 +534,109 @@ ProcRRGetOutputInfo (ClientPtr client)
return client->noClientException;
}
+
+void
+RRSetPrimaryOutput(ScreenPtr pScreen, rrScrPrivPtr pScrPriv,
+ RROutputPtr output)
+{
+ if (pScrPriv->primaryOutput == output)
+ return;
+
+ /* clear the old primary */
+ if (pScrPriv->primaryOutput) {
+ RROutputChanged(pScrPriv->primaryOutput, 0);
+ pScrPriv->primaryOutput = NULL;
+ }
+
+ /* set the new primary */
+ if (output) {
+ pScrPriv->primaryOutput = output;
+ RROutputChanged(output, 0);
+ }
+
+ pScrPriv->layoutChanged = TRUE;
+
+ RRTellChanged(pScreen);
+}
+
+int
+ProcRRSetOutputPrimary(ClientPtr client)
+{
+ REQUEST(xRRSetOutputPrimaryReq);
+ RROutputPtr output = NULL;
+ WindowPtr pWin;
+ rrScrPrivPtr pScrPriv;
+
+ REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq);
+
+ pWin = SecurityLookupIDByType(client, stuff->window, RT_WINDOW,
+ DixReadAccess);
+
+ if (!pWin) {
+ client->errorValue = stuff->window;
+ return BadWindow;
+ }
+
+ if (stuff->output) {
+ output = LookupOutput(client, stuff->output, DixReadAccess);
+
+ if (!output) {
+ client->errorValue = stuff->output;
+ return RRErrorBase + BadRROutput;
+ }
+
+ if (output->crtc) {
+ client->errorValue = stuff->output;
+ return BadMatch;
+ }
+
+ if (output->pScreen != pWin->drawable.pScreen) {
+ client->errorValue = stuff->window;
+ return BadMatch;
+ }
+ }
+
+ pScrPriv = rrGetScrPriv(pWin->drawable.pScreen);
+ RRSetPrimaryOutput(pWin->drawable.pScreen, pScrPriv, output);
+
+ return client->noClientException;
+}
+
+int
+ProcRRGetOutputPrimary(ClientPtr client)
+{
+ REQUEST(xRRGetOutputPrimaryReq);
+ WindowPtr pWin;
+ rrScrPrivPtr pScrPriv;
+ xRRGetOutputPrimaryReply rep;
+ RROutputPtr primary = NULL;
+
+ REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq);
+
+ pWin = SecurityLookupIDByType(client, stuff->window, RT_WINDOW,
+ DixReadAccess);
+
+ if (!pWin) {
+ client->errorValue = stuff->window;
+ return BadWindow;
+ }
+
+ pScrPriv = rrGetScrPriv(pWin->drawable.pScreen);
+ if (pScrPriv)
+ primary = pScrPriv->primaryOutput;
+
+ memset(&rep, 0, sizeof(rep));
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.output = primary ? primary->id : None;
+
+ if (client->swapped) {
+ int n;
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.output, n);
+ }
+
+ WriteToClient(client, sizeof(xRRGetOutputPrimaryReply), &rep);
+
+ return client->noClientException;
+}
diff --git a/randr/rrsdispatch.c b/randr/rrsdispatch.c
index 3ff9f3f..9fbf8f0 100644
--- a/randr/rrsdispatch.c
+++ b/randr/rrsdispatch.c
@@ -436,6 +436,31 @@ SProcRRSetPanning (ClientPtr client)
return (*ProcRandrVector[stuff->randrReqType]) (client);
}
+static int
+SProcRRSetOutputPrimary (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRSetOutputPrimaryReq);
+
+ REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->window, n);
+ swapl(&stuff->output, n);
+ return ProcRandrVector[stuff->randrReqType](client);
+}
+
+static int
+SProcRRGetOutputPrimary (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRSetOutputPrimaryReq);
+
+ REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->window, n);
+ return ProcRandrVector[stuff->randrReqType](client);
+}
+
int (*SProcRandrVector[RRNumberRequests])(ClientPtr) = {
SProcRRQueryVersion, /* 0 */
/* we skip 1 to make old clients fail pretty immediately */
@@ -472,5 +497,7 @@ int (*SProcRandrVector[RRNumberRequests])(ClientPtr) = {
SProcRRGetCrtcTransform, /* 27 */
SProcRRGetPanning, /* 28 */
SProcRRSetPanning, /* 29 */
+ SProcRRSetOutputPrimary, /* 30 */
+ SProcRRGetOutputPrimary, /* 31 */
};
More information about the xorg-commit
mailing list