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 e357189ca..4c7d35678 100644
--- a/xorg-server/randr/rrscreen.c
+++ b/xorg-server/randr/rrscreen.c
@@ -22,14 +22,12 @@
#include "randrstr.h"
+static const int padlength[4] = {0, 3, 2, 1};
/* From render.h */
#ifndef SubPixelUnknown
#define SubPixelUnknown 0
#endif
-extern char *ConnectionInfo;
-
-static int padlength[4] = {0, 3, 2, 1};
static CARD16
RR10CurrentSizeID (ScreenPtr pScreen);
@@ -231,7 +229,7 @@ ProcRRGetScreenSizeRange (ClientPtr client)
if (pScrPriv)
{
- if (!RRGetInfo (pScreen))
+ if (!RRGetInfo (pScreen, FALSE))
return BadAlloc;
rep.minWidth = pScrPriv->minWidth;
rep.minHeight = pScrPriv->minHeight;
@@ -321,8 +319,8 @@ ProcRRSetScreenSize (ClientPtr client)
return Success;
}
-int
-ProcRRGetScreenResources (ClientPtr client)
+static int
+rrGetScreenResources(ClientPtr client, Bool query)
{
REQUEST(xRRGetScreenResourcesReq);
xRRGetScreenResourcesReply rep;
@@ -331,7 +329,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;
@@ -346,8 +344,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)
@@ -408,12 +406,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++)
@@ -470,6 +482,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;
@@ -596,7 +620,7 @@ ProcRRGetScreenInfo (ClientPtr client)
rep.pad = 0;
if (pScrPriv)
- if (!RRGetInfo (pScreen))
+ if (!RRGetInfo (pScreen, TRUE))
return BadAlloc;
output = RRFirstOutput (pScreen);
@@ -604,7 +628,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;
@@ -777,7 +801,7 @@ ProcRRSetScreenConfig (ClientPtr client)
rep.status = RRSetConfigFailed;
goto sendReply;
}
- if (!RRGetInfo (pScreen))
+ if (!RRGetInfo (pScreen, FALSE))
return BadAlloc;
output = RRFirstOutput (pScreen);
@@ -926,8 +950,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