When no mode is specified, don't validate mode-specific parameters.

This commit is contained in:
Keith Packard 2006-09-21 09:52:04 -07:00
parent 219546fd76
commit b36fde9257

View File

@ -564,64 +564,67 @@ ProcRRSetCrtcConfig (ClientPtr client)
goto sendReply; goto sendReply;
} }
/* if (mode)
* Validate requested rotation
*/
rotation = (Rotation) stuff->rotation;
/* test the rotation bits only! */
switch (rotation & 0xf) {
case RR_Rotate_0:
case RR_Rotate_90:
case RR_Rotate_180:
case RR_Rotate_270:
break;
default:
/*
* Invalid rotation
*/
client->errorValue = stuff->rotation;
if (outputs)
xfree (outputs);
return BadValue;
}
if ((~crtc->rotations) & rotation)
{ {
/* /*
* requested rotation or reflection not supported by screen * Validate requested rotation
*/ */
client->errorValue = stuff->rotation; rotation = (Rotation) stuff->rotation;
if (outputs)
xfree (outputs); /* test the rotation bits only! */
return BadMatch; switch (rotation & 0xf) {
} case RR_Rotate_0:
case RR_Rotate_90:
case RR_Rotate_180:
case RR_Rotate_270:
break;
default:
/*
* Invalid rotation
*/
client->errorValue = stuff->rotation;
if (outputs)
xfree (outputs);
return BadValue;
}
if ((~crtc->rotations) & rotation)
{
/*
* requested rotation or reflection not supported by screen
*/
client->errorValue = stuff->rotation;
if (outputs)
xfree (outputs);
return BadMatch;
}
#ifdef RANDR_12_INTERFACE #ifdef RANDR_12_INTERFACE
/* /*
* Check screen size bounds if the DDX provides a 1.2 interface * Check screen size bounds if the DDX provides a 1.2 interface
* for setting screen size. Else, assume the CrtcSet sets * for setting screen size. Else, assume the CrtcSet sets
* the size along with the mode * the size along with the mode
*/ */
if (pScrPriv->rrScreenSetSize) if (pScrPriv->rrScreenSetSize)
{
if (stuff->x + mode->mode.width > pScreen->width)
{ {
client->errorValue = stuff->x; if (stuff->x + mode->mode.width > pScreen->width)
if (outputs) {
xfree (outputs); client->errorValue = stuff->x;
return BadValue; if (outputs)
xfree (outputs);
return BadValue;
}
if (stuff->y + mode->mode.height > pScreen->height)
{
client->errorValue = stuff->y;
if (outputs)
xfree (outputs);
return BadValue;
}
} }
if (stuff->y + mode->mode.height > pScreen->height)
{
client->errorValue = stuff->y;
if (outputs)
xfree (outputs);
return BadValue;
}
}
#endif #endif
}
/* /*
* Make sure the requested set-time is not older than * Make sure the requested set-time is not older than