Bug 16042

Summary: Bogus mode rewriting in xf86Crtc.c
Product: xorg Reporter: Søren Sandmann Pedersen <soren.sandmann>
Component: Server/GeneralAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED MOVED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: keithp
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Søren Sandmann Pedersen 2008-05-20 16:32:06 UTC
In xf86CrtcSetMode() there is this passage:

    /* Shift offsets that move us out of virtual size */
    if (x + mode->HDisplay > xf86_config->maxWidth ||
	y + mode->VDisplay > xf86_config->maxHeight)
    {
	if (x + mode->HDisplay > xf86_config->maxWidth)
	    crtc->x = xf86_config->maxWidth - mode->HDisplay;
	if (y + mode->VDisplay > xf86_config->maxHeight)
	    crtc->y = xf86_config->maxHeight - mode->VDisplay;
	if (crtc->x < 0 || crtc->y < 0)
	{
	    xf86DrvMsg (scrn->scrnIndex, X_ERROR,
			"Mode %dx%d does not fit virtual size %dx%d - "
			"internal error\n", mode->HDisplay, mode->VDisplay,
			xf86_config->maxWidth, xf86_config->maxHeight);
	    goto done;
	}
	xf86DrvMsg (scrn->scrnIndex, X_ERROR,
		    "Mode %dx%d+%d+%d does not fit virtual size %dx%d - "
		    "offset updated to +%d+%d\n",
		    mode->HDisplay, mode->VDisplay, x, y,
		    xf86_config->maxWidth, xf86_config->maxHeight,
		    crtc->x, crtc->y);
    }

This is incorrect because it doesn't take rotation into account, but it's also bogus since if it can't set the right mode, it should just fail instead of silently changing it to something else.

I suggest deleting it altogether.
Comment 1 Keith Packard 2008-05-20 17:49:50 UTC
Yes, it should just 'fix' the problem instead of failing to start, but that means figuring out how to fix it. Without shadow frame buffers, it cannot allow crtcs to extend beyond the frame buffer.
Comment 2 Søren Sandmann Pedersen 2008-05-20 20:36:38 UTC
It shouldn't "fix" anything if the user sets the mode of the CRTC. In that case it should just fail.
Comment 3 Adam Jackson 2008-06-23 12:08:36 UTC
Or it could upscale.  RANDR has projective transforms now, after all.

(Note: not a completely serious suggestion.)
Comment 4 GitLab Migration User 2018-12-13 22:20:13 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/xserver/issues/372.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.