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.
This commit is contained in:
parent
b36fde9257
commit
c4f30c6353
|
@ -52,7 +52,7 @@ miRRCrtcSet (ScreenPtr pScreen,
|
||||||
int y,
|
int y,
|
||||||
Rotation rotation,
|
Rotation rotation,
|
||||||
int numOutput,
|
int numOutput,
|
||||||
RROutputPtr *outputs)
|
RROutputConfigPtr outputs)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -114,6 +114,10 @@ miRandRInit (ScreenPtr pScreen)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!RROutputSetCrtcs (output, &crtc, 1))
|
if (!RROutputSetCrtcs (output, &crtc, 1))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
if (!RROutputSetPossibleOptions (output, 0))
|
||||||
|
return FALSE;
|
||||||
|
if (!RROutputSetCurrentOptions (output, 0))
|
||||||
|
return FALSE;
|
||||||
if (!RROutputSetConnection (output, RR_Connected))
|
if (!RROutputSetConnection (output, RR_Connected))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
RRCrtcNotify (crtc, mode, 0, 0, RR_Rotate_0, 1, &output);
|
RRCrtcNotify (crtc, mode, 0, 0, RR_Rotate_0, 1, &output);
|
||||||
|
|
|
@ -72,12 +72,14 @@ extern int (*SProcRandrVector[RRNumberRequests])(ClientPtr);
|
||||||
typedef struct _rrMode RRModeRec, *RRModePtr;
|
typedef struct _rrMode RRModeRec, *RRModePtr;
|
||||||
typedef struct _rrCrtc RRCrtcRec, *RRCrtcPtr;
|
typedef struct _rrCrtc RRCrtcRec, *RRCrtcPtr;
|
||||||
typedef struct _rrOutput RROutputRec, *RROutputPtr;
|
typedef struct _rrOutput RROutputRec, *RROutputPtr;
|
||||||
|
typedef struct _rrOutputConfig RROutputConfigRec, *RROutputConfigPtr;
|
||||||
|
|
||||||
struct _rrMode {
|
struct _rrMode {
|
||||||
int refcnt;
|
int refcnt;
|
||||||
xRRModeInfo mode;
|
xRRModeInfo mode;
|
||||||
char *name;
|
char *name;
|
||||||
void *devPrivate;
|
void *devPrivate;
|
||||||
|
ScreenPtr screen;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _rrCrtc {
|
struct _rrCrtc {
|
||||||
|
@ -105,6 +107,8 @@ struct _rrOutput {
|
||||||
CARD8 connection;
|
CARD8 connection;
|
||||||
CARD8 subpixelOrder;
|
CARD8 subpixelOrder;
|
||||||
RRCrtcPtr crtc;
|
RRCrtcPtr crtc;
|
||||||
|
CARD32 currentOptions;
|
||||||
|
CARD32 possibleOptions;
|
||||||
int numCrtcs;
|
int numCrtcs;
|
||||||
RRCrtcPtr *crtcs;
|
RRCrtcPtr *crtcs;
|
||||||
int numClones;
|
int numClones;
|
||||||
|
@ -116,6 +120,11 @@ struct _rrOutput {
|
||||||
void *devPrivate;
|
void *devPrivate;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct _rrOutputConfig {
|
||||||
|
RROutputPtr output;
|
||||||
|
CARD32 options;
|
||||||
|
};
|
||||||
|
|
||||||
#if RANDR_12_INTERFACE
|
#if RANDR_12_INTERFACE
|
||||||
typedef Bool (*RRScreenSetSizeProcPtr) (ScreenPtr pScreen,
|
typedef Bool (*RRScreenSetSizeProcPtr) (ScreenPtr pScreen,
|
||||||
CARD16 width,
|
CARD16 width,
|
||||||
|
@ -130,7 +139,7 @@ typedef Bool (*RRCrtcSetProcPtr) (ScreenPtr pScreen,
|
||||||
int y,
|
int y,
|
||||||
Rotation rotation,
|
Rotation rotation,
|
||||||
int numOutputs,
|
int numOutputs,
|
||||||
RROutputPtr *outputs);
|
RROutputConfigPtr outputs);
|
||||||
|
|
||||||
typedef Bool (*RRCrtcSetGammaProcPtr) (ScreenPtr pScreen,
|
typedef Bool (*RRCrtcSetGammaProcPtr) (ScreenPtr pScreen,
|
||||||
RRCrtcPtr crtc);
|
RRCrtcPtr crtc);
|
||||||
|
@ -352,7 +361,7 @@ miRRCrtcSet (ScreenPtr pScreen,
|
||||||
int y,
|
int y,
|
||||||
Rotation rotation,
|
Rotation rotation,
|
||||||
int numOutput,
|
int numOutput,
|
||||||
RROutputPtr *outputs);
|
RROutputConfigPtr outputs);
|
||||||
|
|
||||||
/* randr.c */
|
/* randr.c */
|
||||||
/*
|
/*
|
||||||
|
@ -440,7 +449,7 @@ RRCrtcNotify (RRCrtcPtr crtc,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
Rotation rotation,
|
Rotation rotation,
|
||||||
int numOutput,
|
int numOutputs,
|
||||||
RROutputPtr *outputs);
|
RROutputPtr *outputs);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -456,7 +465,7 @@ RRCrtcSet (RRCrtcPtr crtc,
|
||||||
int y,
|
int y,
|
||||||
Rotation rotation,
|
Rotation rotation,
|
||||||
int numOutput,
|
int numOutput,
|
||||||
RROutputPtr *outputs);
|
RROutputConfigPtr outputs);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Request that the Crtc gamma be changed
|
* Request that the Crtc gamma be changed
|
||||||
|
@ -530,6 +539,9 @@ RRModeGet (ScreenPtr pScreen,
|
||||||
xRRModeInfo *modeInfo,
|
xRRModeInfo *modeInfo,
|
||||||
const char *name);
|
const char *name);
|
||||||
|
|
||||||
|
void
|
||||||
|
RRModePruneUnused (ScreenPtr pScreen);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Destroy a mode.
|
* Destroy a mode.
|
||||||
*/
|
*/
|
||||||
|
@ -584,6 +596,10 @@ RROutputSetCrtcs (RROutputPtr output,
|
||||||
RRCrtcPtr *crtcs,
|
RRCrtcPtr *crtcs,
|
||||||
int numCrtcs);
|
int numCrtcs);
|
||||||
|
|
||||||
|
Bool
|
||||||
|
RROutputSetPossibleOptions (RROutputPtr output,
|
||||||
|
CARD32 possibleOptions);
|
||||||
|
|
||||||
void
|
void
|
||||||
RROutputSetCrtc (RROutputPtr output, RRCrtcPtr crtc);
|
RROutputSetCrtc (RROutputPtr output, RRCrtcPtr crtc);
|
||||||
|
|
||||||
|
@ -595,6 +611,10 @@ Bool
|
||||||
RROutputSetSubpixelOrder (RROutputPtr output,
|
RROutputSetSubpixelOrder (RROutputPtr output,
|
||||||
int subpixelOrder);
|
int subpixelOrder);
|
||||||
|
|
||||||
|
Bool
|
||||||
|
RROutputSetCurrentOptions (RROutputPtr output,
|
||||||
|
CARD32 currentOptions);
|
||||||
|
|
||||||
void
|
void
|
||||||
RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output);
|
RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output);
|
||||||
|
|
||||||
|
|
|
@ -92,25 +92,25 @@ RRCrtcNotify (RRCrtcPtr crtc,
|
||||||
|
|
||||||
if (numOutputs != prevNumOutputs)
|
if (numOutputs != prevNumOutputs)
|
||||||
{
|
{
|
||||||
RROutputPtr *outputs;
|
RROutputPtr *newoutputs;
|
||||||
|
|
||||||
if (numOutputs)
|
if (numOutputs)
|
||||||
{
|
{
|
||||||
if (crtc->numOutputs)
|
if (crtc->numOutputs)
|
||||||
outputs = xrealloc (crtc->outputs,
|
newoutputs = xrealloc (crtc->outputs,
|
||||||
numOutputs * sizeof (RROutputPtr));
|
numOutputs * sizeof (RROutputPtr));
|
||||||
else
|
else
|
||||||
outputs = xalloc (numOutputs * sizeof (RROutputPtr));
|
newoutputs = xalloc (numOutputs * sizeof (RROutputPtr));
|
||||||
if (!outputs)
|
if (!newoutputs)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (crtc->outputs)
|
if (crtc->outputs)
|
||||||
xfree (crtc->outputs);
|
xfree (crtc->outputs);
|
||||||
outputs = NULL;
|
newoutputs = NULL;
|
||||||
}
|
}
|
||||||
crtc->outputs = outputs;
|
crtc->outputs = newoutputs;
|
||||||
crtc->numOutputs = numOutputs;
|
crtc->numOutputs = numOutputs;
|
||||||
}
|
}
|
||||||
for (i = 0; i < numOutputs; i++)
|
for (i = 0; i < numOutputs; i++)
|
||||||
|
@ -183,7 +183,7 @@ RRCrtcSet (RRCrtcPtr crtc,
|
||||||
int y,
|
int y,
|
||||||
Rotation rotation,
|
Rotation rotation,
|
||||||
int numOutputs,
|
int numOutputs,
|
||||||
RROutputPtr *outputs)
|
RROutputConfigPtr outputs)
|
||||||
{
|
{
|
||||||
ScreenPtr pScreen = crtc->pScreen;
|
ScreenPtr pScreen = crtc->pScreen;
|
||||||
rrScrPriv(pScreen);
|
rrScrPriv(pScreen);
|
||||||
|
@ -252,7 +252,7 @@ RRCrtcDestroyResource (pointer value, XID pid)
|
||||||
{
|
{
|
||||||
if (pScrPriv->crtcs[i] == crtc)
|
if (pScrPriv->crtcs[i] == crtc)
|
||||||
{
|
{
|
||||||
memmove (pScrPriv->crtcs, pScrPriv->crtcs + 1,
|
memmove (pScrPriv->crtcs + i, pScrPriv->crtcs + i + 1,
|
||||||
(pScrPriv->numCrtcs - (i - 1)) * sizeof (RRCrtcPtr));
|
(pScrPriv->numCrtcs - (i - 1)) * sizeof (RRCrtcPtr));
|
||||||
--pScrPriv->numCrtcs;
|
--pScrPriv->numCrtcs;
|
||||||
break;
|
break;
|
||||||
|
@ -458,15 +458,15 @@ ProcRRSetCrtcConfig (ClientPtr client)
|
||||||
RRCrtcPtr crtc;
|
RRCrtcPtr crtc;
|
||||||
RRModePtr mode;
|
RRModePtr mode;
|
||||||
int numOutputs;
|
int numOutputs;
|
||||||
RROutputPtr *outputs = NULL;
|
RROutputConfigPtr outputs = NULL;
|
||||||
RROutput *outputIds;
|
xRROutputConfig *outputConfigs;
|
||||||
TimeStamp configTime;
|
TimeStamp configTime;
|
||||||
TimeStamp time;
|
TimeStamp time;
|
||||||
Rotation rotation;
|
Rotation rotation;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq);
|
REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq);
|
||||||
numOutputs = stuff->length - (SIZEOF (xRRSetCrtcConfigReq) >> 2);
|
numOutputs = (stuff->length - (SIZEOF (xRRSetCrtcConfigReq) >> 2)) >> 1;
|
||||||
|
|
||||||
crtc = LookupIDByType (stuff->crtc, RRCrtcType);
|
crtc = LookupIDByType (stuff->crtc, RRCrtcType);
|
||||||
if (!crtc)
|
if (!crtc)
|
||||||
|
@ -493,39 +493,47 @@ ProcRRSetCrtcConfig (ClientPtr client)
|
||||||
}
|
}
|
||||||
if (numOutputs)
|
if (numOutputs)
|
||||||
{
|
{
|
||||||
outputs = xalloc (numOutputs * sizeof (RROutputPtr));
|
outputs = xalloc (numOutputs * sizeof (RROutputConfigRec));
|
||||||
if (!outputs)
|
if (!outputs)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
outputs = NULL;
|
outputs = NULL;
|
||||||
|
|
||||||
outputIds = (RROutput *) (stuff + 1);
|
outputConfigs = (xRROutputConfig *) (stuff + 1);
|
||||||
for (i = 0; i < numOutputs; i++)
|
for (i = 0; i < numOutputs; i++)
|
||||||
{
|
{
|
||||||
outputs[i] = LookupIDByType (outputIds[i], RROutputType);
|
outputs[i].output = LookupIDByType (outputConfigs[i].output, RROutputType);
|
||||||
if (!outputs[i])
|
if (!outputs[i].output)
|
||||||
{
|
{
|
||||||
client->errorValue = outputIds[i];
|
client->errorValue = outputConfigs[i].output;
|
||||||
if (outputs)
|
if (outputs)
|
||||||
xfree (outputs);
|
xfree (outputs);
|
||||||
return RRErrorBase + BadRROutput;
|
return RRErrorBase + BadRROutput;
|
||||||
}
|
}
|
||||||
|
outputs[i].options = outputConfigs[i].options;
|
||||||
|
if (outputs[i].options & ~outputs[i].output->possibleOptions)
|
||||||
|
{
|
||||||
|
client->errorValue = outputConfigs[i].options;
|
||||||
|
if (outputs)
|
||||||
|
xfree (outputs);
|
||||||
|
return BadMatch;
|
||||||
|
}
|
||||||
/* validate crtc for this output */
|
/* validate crtc for this output */
|
||||||
for (j = 0; j < outputs[i]->numCrtcs; j++)
|
for (j = 0; j < outputs[i].output->numCrtcs; j++)
|
||||||
if (outputs[i]->crtcs[j] == crtc)
|
if (outputs[i].output->crtcs[j] == crtc)
|
||||||
break;
|
break;
|
||||||
if (j == outputs[j]->numCrtcs)
|
if (j == outputs[j].output->numCrtcs)
|
||||||
{
|
{
|
||||||
if (outputs)
|
if (outputs)
|
||||||
xfree (outputs);
|
xfree (outputs);
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
/* validate mode for this output */
|
/* validate mode for this output */
|
||||||
for (j = 0; j < outputs[i]->numModes; j++)
|
for (j = 0; j < outputs[i].output->numModes; j++)
|
||||||
if (outputs[i]->modes[j] == mode)
|
if (outputs[i].output->modes[j] == mode)
|
||||||
break;
|
break;
|
||||||
if (j == outputs[i]->numModes)
|
if (j == outputs[i].output->numModes)
|
||||||
{
|
{
|
||||||
if (outputs)
|
if (outputs)
|
||||||
xfree (outputs);
|
xfree (outputs);
|
||||||
|
|
|
@ -208,6 +208,7 @@ RRGetInfo (ScreenPtr pScreen)
|
||||||
if (pScrPriv->nSizes)
|
if (pScrPriv->nSizes)
|
||||||
RRScanOldConfig (pScreen, rotations);
|
RRScanOldConfig (pScreen, rotations);
|
||||||
#endif
|
#endif
|
||||||
|
RRModePruneUnused (pScreen);
|
||||||
RRTellChanged (pScreen);
|
RRTellChanged (pScreen);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,27 @@
|
||||||
|
|
||||||
RESTYPE RRModeType;
|
RESTYPE RRModeType;
|
||||||
|
|
||||||
|
static Bool
|
||||||
|
RRModeEqual (xRRModeInfo *a, xRRModeInfo *b)
|
||||||
|
{
|
||||||
|
if (a->width != b->width) return FALSE;
|
||||||
|
if (a->height != b->height) return FALSE;
|
||||||
|
if (a->mmWidth != b->mmWidth) return FALSE;
|
||||||
|
if (a->mmHeight != b->mmHeight) return FALSE;
|
||||||
|
if (a->dotClock != b->dotClock) return FALSE;
|
||||||
|
if (a->hSyncStart != b->hSyncStart) return FALSE;
|
||||||
|
if (a->hSyncEnd != b->hSyncEnd) return FALSE;
|
||||||
|
if (a->hTotal != b->hTotal) return FALSE;
|
||||||
|
if (a->hSkew != b->hSkew) return FALSE;
|
||||||
|
if (a->vSyncStart != b->vSyncStart) return FALSE;
|
||||||
|
if (a->vSyncEnd != b->vSyncEnd) return FALSE;
|
||||||
|
if (a->vTotal != b->vTotal) return FALSE;
|
||||||
|
if (a->nameLength != b->nameLength) return FALSE;
|
||||||
|
if (a->modeFlags != b->modeFlags) return FALSE;
|
||||||
|
if (a->origin != b->origin) return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
RRModePtr
|
RRModePtr
|
||||||
RRModeGet (ScreenPtr pScreen,
|
RRModeGet (ScreenPtr pScreen,
|
||||||
xRRModeInfo *modeInfo,
|
xRRModeInfo *modeInfo,
|
||||||
|
@ -37,8 +58,7 @@ RRModeGet (ScreenPtr pScreen,
|
||||||
for (i = 0; i < pScrPriv->numModes; i++)
|
for (i = 0; i < pScrPriv->numModes; i++)
|
||||||
{
|
{
|
||||||
mode = pScrPriv->modes[i];
|
mode = pScrPriv->modes[i];
|
||||||
modeInfo->id = mode->mode.id;
|
if (RRModeEqual (&mode->mode, modeInfo) &&
|
||||||
if (!memcmp (modeInfo, &mode->mode, sizeof (xRRModeInfo)) &&
|
|
||||||
!memcmp (name, mode->name, modeInfo->nameLength))
|
!memcmp (name, mode->name, modeInfo->nameLength))
|
||||||
{
|
{
|
||||||
++mode->refcnt;
|
++mode->refcnt;
|
||||||
|
@ -54,6 +74,7 @@ RRModeGet (ScreenPtr pScreen,
|
||||||
mode->name = (char *) (mode + 1);
|
mode->name = (char *) (mode + 1);
|
||||||
memcpy (mode->name, name, modeInfo->nameLength);
|
memcpy (mode->name, name, modeInfo->nameLength);
|
||||||
mode->name[modeInfo->nameLength] = '\0';
|
mode->name[modeInfo->nameLength] = '\0';
|
||||||
|
mode->screen = pScreen;
|
||||||
|
|
||||||
if (pScrPriv->numModes)
|
if (pScrPriv->numModes)
|
||||||
modes = xrealloc (pScrPriv->modes,
|
modes = xrealloc (pScrPriv->modes,
|
||||||
|
@ -80,8 +101,31 @@ RRModeGet (ScreenPtr pScreen,
|
||||||
void
|
void
|
||||||
RRModeDestroy (RRModePtr mode)
|
RRModeDestroy (RRModePtr mode)
|
||||||
{
|
{
|
||||||
|
ScreenPtr pScreen;
|
||||||
|
rrScrPrivPtr pScrPriv;
|
||||||
|
int m;
|
||||||
|
|
||||||
if (--mode->refcnt > 0)
|
if (--mode->refcnt > 0)
|
||||||
return;
|
return;
|
||||||
|
pScreen = mode->screen;
|
||||||
|
pScrPriv = rrGetScrPriv (pScreen);
|
||||||
|
for (m = 0; m < pScrPriv->numModes; m++)
|
||||||
|
{
|
||||||
|
if (pScrPriv->modes[m] == mode)
|
||||||
|
{
|
||||||
|
memmove (pScrPriv->modes + m, pScrPriv->modes + m + 1,
|
||||||
|
(pScrPriv->numModes - m - 1) * sizeof (RRModePtr));
|
||||||
|
pScrPriv->numModes--;
|
||||||
|
if (!pScrPriv->numModes)
|
||||||
|
{
|
||||||
|
xfree (pScrPriv->modes);
|
||||||
|
pScrPriv->modes = NULL;
|
||||||
|
}
|
||||||
|
pScrPriv->changed = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
xfree (mode);
|
xfree (mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,6 +148,26 @@ RRModeInit (void)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
RRModePruneUnused (ScreenPtr pScreen)
|
||||||
|
{
|
||||||
|
rrScrPriv (pScreen);
|
||||||
|
RRModePtr *unused, mode;
|
||||||
|
int m;
|
||||||
|
int num = pScrPriv->numModes;
|
||||||
|
|
||||||
|
unused = xalloc (num * sizeof (RRModePtr));
|
||||||
|
if (!unused)
|
||||||
|
return;
|
||||||
|
memcpy (unused, pScrPriv->modes, num * sizeof (RRModePtr));
|
||||||
|
for (m = 0; m < num; m++) {
|
||||||
|
mode = unused[m];
|
||||||
|
if (mode->refcnt == 1 && mode->mode.origin != RRModeOriginUser)
|
||||||
|
FreeResource (mode->mode.id, 0);
|
||||||
|
}
|
||||||
|
xfree (unused);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ProcRRCreateMode (ClientPtr client)
|
ProcRRCreateMode (ClientPtr client)
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,6 +60,8 @@ RROutputCreate (ScreenPtr pScreen,
|
||||||
output->connection = RR_UnknownConnection;
|
output->connection = RR_UnknownConnection;
|
||||||
output->subpixelOrder = SubPixelUnknown;
|
output->subpixelOrder = SubPixelUnknown;
|
||||||
output->crtc = NULL;
|
output->crtc = NULL;
|
||||||
|
output->currentOptions = 0;
|
||||||
|
output->possibleOptions = 0;
|
||||||
output->numCrtcs = 0;
|
output->numCrtcs = 0;
|
||||||
output->crtcs = NULL;
|
output->crtcs = NULL;
|
||||||
output->numClones = 0;
|
output->numClones = 0;
|
||||||
|
@ -190,6 +192,17 @@ RROutputSetCrtcs (RROutputPtr output,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Bool
|
||||||
|
RROutputSetPossibleOptions (RROutputPtr output,
|
||||||
|
CARD32 possibleOptions)
|
||||||
|
{
|
||||||
|
if (output->possibleOptions == possibleOptions)
|
||||||
|
return TRUE;
|
||||||
|
output->possibleOptions = possibleOptions;
|
||||||
|
output->changed = TRUE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RROutputSetCrtc (RROutputPtr output, RRCrtcPtr crtc)
|
RROutputSetCrtc (RROutputPtr output, RRCrtcPtr crtc)
|
||||||
{
|
{
|
||||||
|
@ -222,6 +235,17 @@ RROutputSetSubpixelOrder (RROutputPtr output,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Bool
|
||||||
|
RROutputSetCurrentOptions (RROutputPtr output,
|
||||||
|
CARD32 currentOptions)
|
||||||
|
{
|
||||||
|
if (output->currentOptions == currentOptions)
|
||||||
|
return TRUE;
|
||||||
|
output->currentOptions = currentOptions;
|
||||||
|
output->changed = TRUE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output)
|
RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output)
|
||||||
{
|
{
|
||||||
|
@ -248,7 +272,7 @@ RROutputDestroyResource (pointer value, XID pid)
|
||||||
{
|
{
|
||||||
if (pScrPriv->outputs[i] == output)
|
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 - (i - 1)) * sizeof (RROutputPtr));
|
||||||
--pScrPriv->numOutputs;
|
--pScrPriv->numOutputs;
|
||||||
break;
|
break;
|
||||||
|
@ -280,6 +304,8 @@ RROutputInit (void)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define OutputInfoExtra (SIZEOF(xRRGetOutputInfoReply) - 32)
|
||||||
|
|
||||||
int
|
int
|
||||||
ProcRRGetOutputInfo (ClientPtr client)
|
ProcRRGetOutputInfo (ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -307,24 +333,27 @@ ProcRRGetOutputInfo (ClientPtr client)
|
||||||
|
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
rep.length = 0;
|
rep.length = OutputInfoExtra >> 2;
|
||||||
rep.timestamp = pScrPriv->lastSetTime.milliseconds;
|
rep.timestamp = pScrPriv->lastSetTime.milliseconds;
|
||||||
rep.crtc = output->crtc ? output->crtc->id : None;
|
rep.crtc = output->crtc ? output->crtc->id : None;
|
||||||
|
rep.currentOptions = output->currentOptions;
|
||||||
rep.connection = output->connection;
|
rep.connection = output->connection;
|
||||||
rep.subpixelOrder = output->subpixelOrder;
|
rep.subpixelOrder = output->subpixelOrder;
|
||||||
rep.nCrtcs = output->numCrtcs;
|
rep.nCrtcs = output->numCrtcs;
|
||||||
rep.nModes = output->numModes;
|
rep.nModes = output->numModes;
|
||||||
rep.nClones = output->numClones;
|
rep.nClones = output->numClones;
|
||||||
rep.nameLength = output->nameLength;
|
rep.nameLength = output->nameLength;
|
||||||
|
rep.possibleOptions = output->possibleOptions;
|
||||||
|
rep.pad1 = 42;
|
||||||
|
|
||||||
rep.length = (output->numCrtcs +
|
extraLen = ((output->numCrtcs +
|
||||||
output->numModes +
|
output->numModes +
|
||||||
output->numClones +
|
output->numClones +
|
||||||
((rep.nameLength + 3) >> 2));
|
((rep.nameLength + 3) >> 2)) << 2);
|
||||||
|
|
||||||
extraLen = rep.length << 2;
|
|
||||||
if (extraLen)
|
if (extraLen)
|
||||||
{
|
{
|
||||||
|
rep.length += extraLen >> 2;
|
||||||
extra = xalloc (extraLen);
|
extra = xalloc (extraLen);
|
||||||
if (!extra)
|
if (!extra)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
|
@ -372,7 +372,7 @@ ProcRRGetScreenResources (ClientPtr client)
|
||||||
|
|
||||||
rep.length = (pScrPriv->numCrtcs +
|
rep.length = (pScrPriv->numCrtcs +
|
||||||
pScrPriv->numOutputs +
|
pScrPriv->numOutputs +
|
||||||
pScrPriv->numModes * 10 +
|
pScrPriv->numModes * (SIZEOF(xRRModeInfo) >> 2) +
|
||||||
((rep.nbytesNames + 3) >> 2));
|
((rep.nbytesNames + 3) >> 2));
|
||||||
|
|
||||||
extraLen = rep.length << 2;
|
extraLen = rep.length << 2;
|
||||||
|
@ -429,7 +429,7 @@ ProcRRGetScreenResources (ClientPtr client)
|
||||||
pScrPriv->modes[i]->mode.nameLength);
|
pScrPriv->modes[i]->mode.nameLength);
|
||||||
names += pScrPriv->modes[i]->mode.nameLength;
|
names += pScrPriv->modes[i]->mode.nameLength;
|
||||||
}
|
}
|
||||||
assert ((names + 3 >> 3) == rep.length);
|
assert (((((char *) names - (char *) extra) + 3) >> 2) == rep.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
|
@ -694,7 +694,7 @@ ProcRRSetScreenConfig (ClientPtr client)
|
||||||
Rotation rotation;
|
Rotation rotation;
|
||||||
int rate;
|
int rate;
|
||||||
Bool has_rate;
|
Bool has_rate;
|
||||||
RROutputPtr output;
|
RROutputConfigRec output;
|
||||||
RRModePtr mode;
|
RRModePtr mode;
|
||||||
RR10DataPtr pData = NULL;
|
RR10DataPtr pData = NULL;
|
||||||
RRScreenSizePtr pSize;
|
RRScreenSizePtr pSize;
|
||||||
|
@ -731,13 +731,14 @@ ProcRRSetScreenConfig (ClientPtr client)
|
||||||
if (!RRGetInfo (pScreen))
|
if (!RRGetInfo (pScreen))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
output = RRFirstOutput (pScreen);
|
output.output = RRFirstOutput (pScreen);
|
||||||
if (!output)
|
if (!output.output)
|
||||||
{
|
{
|
||||||
time = currentTime;
|
time = currentTime;
|
||||||
rep.status = RRSetConfigFailed;
|
rep.status = RRSetConfigFailed;
|
||||||
goto sendReply;
|
goto sendReply;
|
||||||
}
|
}
|
||||||
|
output.options = output.output->currentOptions;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if the client's config timestamp is not the same as the last config
|
* if the client's config timestamp is not the same as the last config
|
||||||
|
@ -750,7 +751,7 @@ ProcRRSetScreenConfig (ClientPtr client)
|
||||||
goto sendReply;
|
goto sendReply;
|
||||||
}
|
}
|
||||||
|
|
||||||
pData = RR10GetData (pScreen, output);
|
pData = RR10GetData (pScreen, output.output);
|
||||||
if (!pData)
|
if (!pData)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
|
@ -786,7 +787,7 @@ ProcRRSetScreenConfig (ClientPtr client)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((~output->crtc->rotations) & rotation)
|
if ((~output.output->crtc->rotations) & rotation)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* requested rotation or reflection not supported by screen
|
* requested rotation or reflection not supported by screen
|
||||||
|
@ -835,7 +836,7 @@ ProcRRSetScreenConfig (ClientPtr client)
|
||||||
goto sendReply;
|
goto sendReply;
|
||||||
}
|
}
|
||||||
|
|
||||||
rep.status = RRCrtcSet (output->crtc, mode, 0, 0, stuff->rotation,
|
rep.status = RRCrtcSet (output.output->crtc, mode, 0, 0, stuff->rotation,
|
||||||
1, &output);
|
1, &output);
|
||||||
|
|
||||||
sendReply:
|
sendReply:
|
||||||
|
|
Loading…
Reference in New Issue