RandR 1.2 rotation code must adjust width/height.

Mode lines reflect the monitor mode, not the projected size into the frame
buffer. Flip width/height around so that the dimensions are oriented
correctly.
(cherry picked from 612a8e61803da8db0e305cbb093696b8e4284572 commit)
This commit is contained in:
Keith Packard 2006-12-13 01:21:32 -08:00 committed by Dave Airlie
parent 6c6901434a
commit 670bbb8731
2 changed files with 29 additions and 8 deletions

View File

@ -698,7 +698,15 @@ ProcRRSetCrtcConfig (ClientPtr client)
*/ */
if (pScrPriv->rrScreenSetSize) if (pScrPriv->rrScreenSetSize)
{ {
if (stuff->x + mode->mode.width > pScreen->width) int source_width = mode->mode.width;
int source_height = mode->mode.height;
if (rotation == RR_Rotate_90 || rotation == RR_Rotate_270)
{
source_width = mode->mode.height;
source_height = mode->mode.width;
}
if (stuff->x + source_width > pScreen->width)
{ {
client->errorValue = stuff->x; client->errorValue = stuff->x;
if (outputs) if (outputs)
@ -706,7 +714,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
return BadValue; return BadValue;
} }
if (stuff->y + mode->mode.height > pScreen->height) if (stuff->y + source_height > pScreen->height)
{ {
client->errorValue = stuff->y; client->errorValue = stuff->y;
if (outputs) if (outputs)

View File

@ -268,7 +268,6 @@ ProcRRSetScreenSize (ClientPtr client)
WindowPtr pWin; WindowPtr pWin;
ScreenPtr pScreen; ScreenPtr pScreen;
rrScrPrivPtr pScrPriv; rrScrPrivPtr pScrPriv;
RRCrtcPtr crtc;
int i; int i;
REQUEST_SIZE_MATCH(xRRSetScreenSizeReq); REQUEST_SIZE_MATCH(xRRSetScreenSizeReq);
@ -291,13 +290,27 @@ ProcRRSetScreenSize (ClientPtr client)
client->errorValue = stuff->height; client->errorValue = stuff->height;
return BadValue; return BadValue;
} }
for (i = 0; i < pScrPriv->numCrtcs; i++) { for (i = 0; i < pScrPriv->numCrtcs; i++)
crtc = pScrPriv->crtcs[i]; {
if (crtc->mode && RRCrtcPtr crtc = pScrPriv->crtcs[i];
(crtc->x + crtc->mode->mode.width > stuff->width || RRModePtr mode = crtc->mode;
crtc->y + crtc->mode->mode.height > stuff->height)) if (mode)
{
int source_width = mode->mode.width;
int source_height = mode->mode.height;
Rotation rotation = crtc->rotation;
if (rotation == RR_Rotate_90 || rotation == RR_Rotate_270)
{
source_width = mode->mode.height;
source_height = mode->mode.width;
}
if (crtc->x + source_width > stuff->width ||
crtc->y + source_height > stuff->height)
return BadMatch; return BadMatch;
} }
}
if (stuff->widthInMillimeters == 0 || stuff->heightInMillimeters == 0) if (stuff->widthInMillimeters == 0 || stuff->heightInMillimeters == 0)
{ {
client->errorValue = 0; client->errorValue = 0;