Commit 2e781457 authored by Ville Syrjälä's avatar Ville Syrjälä

xfree86/modes: Take rotation into account when checking mode size

Assume that a mode can be used in either landscape or portrait
orientation. I suppose the correct thing to do would be to
collect all the supported rotations from the CRTCs that can be used
with a specific output, but that information doesn't seem to be
readily available when these checks are done. So just assume that
either orientation is fine.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@nokia.com>
Reviewed-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
parent 0ce25fd7
......@@ -355,15 +355,32 @@ xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
{
DisplayModePtr mode;
for (mode = modeList; mode != NULL; mode = mode->next) {
if (maxPitch > 0 && mode->HDisplay > maxPitch)
mode->status = MODE_BAD_WIDTH;
if (maxX > 0 && mode->HDisplay > maxX)
mode->status = MODE_VIRTUAL_X;
if (maxPitch <= 0)
maxPitch = MAXINT;
if (maxX <= 0)
maxX = MAXINT;
if (maxY <= 0)
maxY = MAXINT;
if (maxY > 0 && mode->VDisplay > maxY)
mode->status = MODE_VIRTUAL_Y;
for (mode = modeList; mode != NULL; mode = mode->next) {
if ((xf86ModeWidth(mode, RR_Rotate_0) > maxPitch ||
xf86ModeWidth(mode, RR_Rotate_0) > maxX ||
xf86ModeHeight(mode, RR_Rotate_0) > maxY) &&
(xf86ModeWidth(mode, RR_Rotate_90) > maxPitch ||
xf86ModeWidth(mode, RR_Rotate_90) > maxX ||
xf86ModeHeight(mode, RR_Rotate_90) > maxY)) {
if (xf86ModeWidth(mode, RR_Rotate_0) > maxPitch ||
xf86ModeWidth(mode, RR_Rotate_90) > maxPitch)
mode->status = MODE_BAD_WIDTH;
if (xf86ModeWidth(mode, RR_Rotate_0) > maxX ||
xf86ModeWidth(mode, RR_Rotate_90) > maxX)
mode->status = MODE_VIRTUAL_X;
if (xf86ModeHeight(mode, RR_Rotate_0) > maxY ||
xf86ModeHeight(mode, RR_Rotate_90) > maxY)
mode->status = MODE_VIRTUAL_Y;
}
if (mode->next == modeList)
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment