Fixed CRTC disable in xrandr causing scale issue

Submitted by Arsalan Awan on March 5, 2018, 2:49 p.m.

Details

Message ID 1520261387-24393-1-git-send-email-Arsalan_Awan@mentor.com
State New
Headers show
Series "Fixed CRTC disable in xrandr causing scale issue" ( rev: 3 ) in X.org

Not browsing as part of any series.

Commit Message

Arsalan Awan March 5, 2018, 2:49 p.m.
From: Arsalan-Awan <Arsalan_Awan@mentor.com>

Whenever scale value is increased when it is between 0.0 - 1.0
and is kept within 0.0 - 1.0 range, the display does not expand
to fullscreen. It rather becomes smaller and leaves blank spaces on
the right and bottom sides. And the following error message shows up:

X Error of failed request: BadMatch (invalid parameter attributes)
  Major opcode of failed request: 139 (RANDR)
  Minor opcode of failed request: 7 (RRSetScreenSize)
  Serial number of failed request: 36
  Current serial number in output stream: 38

Before xrandr attempts to apply the transformation matrix requested
by "scale", "transform" or "scale-from" options, it disables the
CRTCs for which the transformed image's dimensions are larger than the
target display's resolution/mode. But, when the image is smaller, it
does not disable the CRTCs, and proceeds with applying the
transformation (involves framebuffer dimension changes). This works well
for all the scale values and transitions except for the above mentioned
transitions.

This patch fixes such issues!

Signed-off-by: Arsalan-Awan <Arsalan_Awan@mentor.com>
---
 xrandr.c | 31 +++++--------------------------
 1 file changed, 5 insertions(+), 26 deletions(-)

Patch hide | download patch | download mbox

diff --git a/xrandr.c b/xrandr.c
index dcfdde0..d2872ef 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -1723,8 +1723,7 @@  apply (void)
 	XGrabServer (dpy);
     
     /*
-     * Turn off any crtcs which are to be disabled or which are
-     * larger than the target size
+     * Turn off any crtcs which are to be disabled
      */
     for (c = 0; c < res->ncrtc; c++)
     {
@@ -1736,33 +1735,13 @@  apply (void)
 	    continue;
 	
 	/* 
-	 * If this crtc is to be left enabled, make
-	 * sure the old size fits then new screen
+	 * Once the scale value is changed in xrandr, omitting the
+	 * following if statement causes the display to fail to
+	 * turn back ON after it goes to sleep due to inactivity.
 	 */
 	if (crtc->mode_info) 
-	{
-	    XRRModeInfo	*old_mode = find_mode_by_xid (crtc_info->mode);
-	    int x, y, w, h;
-	    box_t bounds;
-
-	    if (!old_mode) 
-		panic (RRSetConfigFailed, crtc);
-	    
-	    /* old position and size information */
-	    mode_geometry (old_mode, crtc_info->rotation,
-			   &crtc->current_transform.transform,
-			   &bounds);
-
-	    x = crtc_info->x + bounds.x1;
-	    y = crtc_info->y + bounds.y1;
-	    w = bounds.x2 - bounds.x1;
-	    h = bounds.y2 - bounds.y1;
-
-	    /* if it fits, skip it */
-	    if (x + w <= fb_width && y + h <= fb_height) 
-		continue;
 	    crtc->changing = True;
-	}
+
 	s = crtc_disable (crtc);
 	if (s != RRSetConfigSuccess)
 	    panic (s, crtc);