aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-graphics/xorg-app/xrandr/0001-Fixed-CRTC-disable-in-xrandr-causing-scale-issue.patch
blob: 3ba30c34166eefeb3d8ca17cb7ae959eb597e49a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
From 3e946f562ba38993b57ea46bc7089c4f6bc7951b Mon Sep 17 00:00:00 2001
From: Arsalan-Awan <Arsalan_Awan@mentor.com>
Date: Mon, 5 Mar 2018 18:37:37 +0500
Subject: [PATCH] Fixed CRTC disable in xrandr causing scale issue

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(-)

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);
-- 
2.7.4