summaryrefslogtreecommitdiff
path: root/randr/rroutput.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@guitar.keithp.com>2006-10-03 21:06:11 -0700
committerKeith Packard <keithp@guitar.keithp.com>2006-10-03 21:06:11 -0700
commitc4f30c63538e1451f15ed1991439869127d9b148 (patch)
tree3bf1beea337d3a60d5c057d61ef66256c8676d5a /randr/rroutput.c
parentb36fde9257263fa502147df37e8331184c323e14 (diff)
Add mode origins and output options. Fix memmoves in resource free funcs.
Output options and mode origins both affected driver ABI. memmove mistakes were causing 'Freeing resource which isn't there' messages. Prune unused non-user defined modes from available list now.
Diffstat (limited to 'randr/rroutput.c')
-rw-r--r--randr/rroutput.c43
1 files changed, 36 insertions, 7 deletions
diff --git a/randr/rroutput.c b/randr/rroutput.c
index 90b2b9856..b252d7dec 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -60,6 +60,8 @@ RROutputCreate (ScreenPtr pScreen,
output->connection = RR_UnknownConnection;
output->subpixelOrder = SubPixelUnknown;
output->crtc = NULL;
+ output->currentOptions = 0;
+ output->possibleOptions = 0;
output->numCrtcs = 0;
output->crtcs = NULL;
output->numClones = 0;
@@ -190,6 +192,17 @@ RROutputSetCrtcs (RROutputPtr output,
return TRUE;
}
+Bool
+RROutputSetPossibleOptions (RROutputPtr output,
+ CARD32 possibleOptions)
+{
+ if (output->possibleOptions == possibleOptions)
+ return TRUE;
+ output->possibleOptions = possibleOptions;
+ output->changed = TRUE;
+ return TRUE;
+}
+
void
RROutputSetCrtc (RROutputPtr output, RRCrtcPtr crtc)
{
@@ -222,6 +235,17 @@ RROutputSetSubpixelOrder (RROutputPtr output,
return TRUE;
}
+Bool
+RROutputSetCurrentOptions (RROutputPtr output,
+ CARD32 currentOptions)
+{
+ if (output->currentOptions == currentOptions)
+ return TRUE;
+ output->currentOptions = currentOptions;
+ output->changed = TRUE;
+ return TRUE;
+}
+
void
RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output)
{
@@ -248,7 +272,7 @@ RROutputDestroyResource (pointer value, XID pid)
{
if (pScrPriv->outputs[i] == output)
{
- memmove (pScrPriv->outputs, pScrPriv->outputs + 1,
+ memmove (pScrPriv->outputs + i, pScrPriv->outputs + i + 1,
(pScrPriv->numOutputs - (i - 1)) * sizeof (RROutputPtr));
--pScrPriv->numOutputs;
break;
@@ -280,6 +304,8 @@ RROutputInit (void)
return TRUE;
}
+#define OutputInfoExtra (SIZEOF(xRRGetOutputInfoReply) - 32)
+
int
ProcRRGetOutputInfo (ClientPtr client)
{
@@ -307,24 +333,27 @@ ProcRRGetOutputInfo (ClientPtr client)
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = 0;
+ rep.length = OutputInfoExtra >> 2;
rep.timestamp = pScrPriv->lastSetTime.milliseconds;
rep.crtc = output->crtc ? output->crtc->id : None;
+ rep.currentOptions = output->currentOptions;
rep.connection = output->connection;
rep.subpixelOrder = output->subpixelOrder;
rep.nCrtcs = output->numCrtcs;
rep.nModes = output->numModes;
rep.nClones = output->numClones;
rep.nameLength = output->nameLength;
+ rep.possibleOptions = output->possibleOptions;
+ rep.pad1 = 42;
- rep.length = (output->numCrtcs +
- output->numModes +
- output->numClones +
- ((rep.nameLength + 3) >> 2));
+ extraLen = ((output->numCrtcs +
+ output->numModes +
+ output->numClones +
+ ((rep.nameLength + 3) >> 2)) << 2);
- extraLen = rep.length << 2;
if (extraLen)
{
+ rep.length += extraLen >> 2;
extra = xalloc (extraLen);
if (!extra)
return BadAlloc;