aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/randr/rrscreen.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/randr/rrscreen.c')
-rw-r--r--xorg-server/randr/rrscreen.c56
1 files changed, 41 insertions, 15 deletions
diff --git a/xorg-server/randr/rrscreen.c b/xorg-server/randr/rrscreen.c
index f39197337..dd645a936 100644
--- a/xorg-server/randr/rrscreen.c
+++ b/xorg-server/randr/rrscreen.c
@@ -22,9 +22,7 @@
#include "randrstr.h"
-extern char *ConnectionInfo;
-
-static int padlength[4] = {0, 3, 2, 1};
+static const int padlength[4] = {0, 3, 2, 1};
static CARD16
RR10CurrentSizeID (ScreenPtr pScreen);
@@ -226,7 +224,7 @@ ProcRRGetScreenSizeRange (ClientPtr client)
if (pScrPriv)
{
- if (!RRGetInfo (pScreen))
+ if (!RRGetInfo (pScreen, FALSE))
return BadAlloc;
rep.minWidth = pScrPriv->minWidth;
rep.minHeight = pScrPriv->minHeight;
@@ -316,8 +314,8 @@ ProcRRSetScreenSize (ClientPtr client)
return Success;
}
-int
-ProcRRGetScreenResources (ClientPtr client)
+static int
+rrGetScreenResources(ClientPtr client, Bool query)
{
REQUEST(xRRGetScreenResourcesReq);
xRRGetScreenResourcesReply rep;
@@ -326,7 +324,7 @@ ProcRRGetScreenResources (ClientPtr client)
rrScrPrivPtr pScrPriv;
CARD8 *extra;
unsigned long extraLen;
- int i, n, rc;
+ int i, n, rc, has_primary = 0;
RRCrtc *crtcs;
RROutput *outputs;
xRRModeInfo *modeinfos;
@@ -341,8 +339,8 @@ ProcRRGetScreenResources (ClientPtr client)
pScrPriv = rrGetScrPriv(pScreen);
rep.pad = 0;
- if (pScrPriv)
- if (!RRGetInfo (pScreen))
+ if (query && pScrPriv)
+ if (!RRGetInfo (pScreen, query))
return BadAlloc;
if (!pScrPriv)
@@ -403,12 +401,26 @@ ProcRRGetScreenResources (ClientPtr client)
outputs = (RROutput *) (crtcs + pScrPriv->numCrtcs);
modeinfos = (xRRModeInfo *) (outputs + pScrPriv->numOutputs);
names = (CARD8 *) (modeinfos + num_modes);
+
+ if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc)
+ {
+ has_primary = 1;
+ crtcs[0] = pScrPriv->primaryOutput->crtc->id;
+ if (client->swapped)
+ swapl (&crtcs[0], n);
+ }
for (i = 0; i < pScrPriv->numCrtcs; i++)
{
- crtcs[i] = pScrPriv->crtcs[i]->id;
+ if (has_primary &&
+ pScrPriv->primaryOutput->crtc == pScrPriv->crtcs[i])
+ {
+ has_primary = 0;
+ 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++)
@@ -465,6 +477,18 @@ ProcRRGetScreenResources (ClientPtr client)
return client->noClientException;
}
+int
+ProcRRGetScreenResources (ClientPtr client)
+{
+ return rrGetScreenResources(client, TRUE);
+}
+
+int
+ProcRRGetScreenResourcesCurrent (ClientPtr client)
+{
+ return rrGetScreenResources(client, FALSE);
+}
+
typedef struct _RR10Data {
RRScreenSizePtr sizes;
int nsize;
@@ -591,7 +615,7 @@ ProcRRGetScreenInfo (ClientPtr client)
rep.pad = 0;
if (pScrPriv)
- if (!RRGetInfo (pScreen))
+ if (!RRGetInfo (pScreen, TRUE))
return BadAlloc;
output = RRFirstOutput (pScreen);
@@ -599,7 +623,7 @@ ProcRRGetScreenInfo (ClientPtr client)
if (!pScrPriv || !output)
{
rep.type = X_Reply;
- rep.setOfRotations = RR_Rotate_0;;
+ rep.setOfRotations = RR_Rotate_0;
rep.sequenceNumber = client->sequence;
rep.length = 0;
rep.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id;
@@ -772,7 +796,7 @@ ProcRRSetScreenConfig (ClientPtr client)
rep.status = RRSetConfigFailed;
goto sendReply;
}
- if (!RRGetInfo (pScreen))
+ if (!RRGetInfo (pScreen, FALSE))
return BadAlloc;
output = RRFirstOutput (pScreen);
@@ -921,8 +945,10 @@ ProcRRSetScreenConfig (ClientPtr client)
if (!RRCrtcSet (crtc, mode, 0, 0, stuff->rotation, 1, &output))
rep.status = RRSetConfigFailed;
- else
+ else {
+ pScrPriv->lastSetTime = time;
rep.status = RRSetConfigSuccess;
+ }
/*
* XXX Configure other crtcs to mirror as much as possible