xserver: Branch 'master' - 3 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 28 17:52:38 UTC 2019


 hw/xwin/InitOutput.c  |    3 +--
 hw/xwin/winmonitors.c |    4 ++--
 hw/xwin/winprocarg.c  |   29 ++++++-----------------------
 hw/xwin/winrandr.c    |   37 +++++++++++++++++++++++++++++--------
 hw/xwin/winwndproc.c  |    2 --
 5 files changed, 38 insertions(+), 37 deletions(-)

New commits:
commit ff6b771eeea763c19d057e8741a2cadb37db9b68
Author: Jon Turney <jon.turney at dronecode.org.uk>
Date:   Thu Mar 8 14:25:54 2018 +0000

    hw/xwin: Improve data returned for RANDR queries
    
    Set a linear gamma ramp.  This avoids the xrandr command always warning
    'Failed to get size of gamma for output default'
    (perhaps we should be using GDI GetDeviceGammaRamp(), if possible?)
    
    Make CRTC report non-zero physical dimensions initially

diff --git a/hw/xwin/winrandr.c b/hw/xwin/winrandr.c
index 30b7c5f6b..038d63bde 100644
--- a/hw/xwin/winrandr.c
+++ b/hw/xwin/winrandr.c
@@ -276,6 +276,21 @@ winRandRInit(ScreenPtr pScreen)
 
         /* Set mode to current display size */
         winRandRUpdateMode(pScreen, output);
+
+        /* Make up some physical dimensions */
+        output->mmWidth = (pScreen->width * 25.4)/monitorResolution;
+        output->mmHeight = (pScreen->height * 25.4)/monitorResolution;
+
+        /* Allocate and make up a (fixed, linear) gamma ramp */
+        {
+            int i;
+            RRCrtcGammaSetSize(crtc, 256);
+            for (i = 0; i < crtc->gammaSize; i++) {
+                crtc->gammaRed[i] = i << 8;
+                crtc->gammaBlue[i] = i << 8;
+                crtc->gammaGreen[i] = i << 8;
+            }
+        }
     }
 
     /*
commit 2549ab2065ad293139d4e82e5d5a5ea13f7257c9
Author: Jon Turney <jon.turney at dronecode.org.uk>
Date:   Fri Mar 9 14:16:01 2018 +0000

    hw/xwin: Always keep RANDR fake mode information up to date
    
    The rrGetInfo hook is not called for all RANDR requests (e.g.
    RRGetOutputInfo), so we must always keep the fake mode information up to
    date, rather than doing it lazily in the rrGetInfo hook)
    
    Because we are so bad, most GTK+3 versions treat the output name 'default'
    specially, and don't try to use RANDR with it.  But versions 3.21.6 to
    3.22.24, don't do this, and get badly confused by a CRTC with size 0x0.
    
    See:
    https://bugzilla.gnome.org/show_bug.cgi?id=771033
    https://bugzilla.gnome.org/show_bug.cgi?id=780101
    
    Future work: Rather than reporting a single fake CRTC with a mode matching
    the entire virtual display, the fake CRTCs we report should match our
    'pseudo-xinerama' monitors

diff --git a/hw/xwin/winrandr.c b/hw/xwin/winrandr.c
index 16caea742..30b7c5f6b 100644
--- a/hw/xwin/winrandr.c
+++ b/hw/xwin/winrandr.c
@@ -42,17 +42,17 @@
 static Bool
 winRandRGetInfo(ScreenPtr pScreen, Rotation * pRotations)
 {
-    rrScrPrivPtr pRRScrPriv;
-    RROutputPtr output;
-
-    pRRScrPriv = rrGetScrPriv(pScreen);
-    output = pRRScrPriv->outputs[0];
-
     winDebug("winRandRGetInfo ()\n");
 
     /* Don't support rotations */
     *pRotations = RR_Rotate_0;
 
+    return TRUE;
+}
+
+static void
+winRandRUpdateMode(ScreenPtr pScreen, RROutputPtr output)
+{
     /* Delete previous mode */
     if (output->modes[0])
         {
@@ -83,8 +83,6 @@ winRandRGetInfo(ScreenPtr pScreen, Rotation * pRotations)
         mode = RRModeGet(&modeInfo, name);
         output->crtc->mode = mode;
     }
-
-    return TRUE;
 }
 
 /*
@@ -95,6 +93,7 @@ winDoRandRScreenSetSize(ScreenPtr pScreen,
                         CARD16 width,
                         CARD16 height, CARD32 mmWidth, CARD32 mmHeight)
 {
+    rrScrPrivPtr pRRScrPriv;
     winScreenPriv(pScreen);
     winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
     WindowPtr pRoot = pScreen->root;
@@ -136,6 +135,10 @@ winDoRandRScreenSetSize(ScreenPtr pScreen,
     // and arrange for it to be repainted
     pScreen->PaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND);
 
+    // Set mode to current display size
+    pRRScrPriv = rrGetScrPriv(pScreen);
+    winRandRUpdateMode(pScreen, pRRScrPriv->primaryOutput);
+
     /* Indicate that a screen size change took place */
     RRScreenSizeNotify(pScreen);
 }
@@ -270,6 +273,9 @@ winRandRInit(ScreenPtr pScreen)
         /* Ensure we have space for exactly one mode */
         output->modes = malloc(sizeof(RRModePtr));
         output->modes[0] = NULL;
+
+        /* Set mode to current display size */
+        winRandRUpdateMode(pScreen, output);
     }
 
     /*
commit b078e03410f5f2a004ab9732eb6e5ed24da3edcf
Author: Jon Turney <jon.turney at dronecode.org.uk>
Date:   Wed Apr 19 14:50:38 2017 +0100

    hw/xwin: Make QueryMonitor() slightly less insane
    
    Make QueryMonitor() slightly less insane, making it return TRUE if the
    specified monitor exists, rather than always returning TRUE (which we
    are uselessly checking, and then also checking if the specified monitor
    exists)
    
    (Note that EnumDisplayMonitors() doesn't seem to have meaningful way to
    return errors, see 5940580f)
    
    Also: Spamming the long UseMsg() after "Invalid monitor number" isn't very
    helpful.
    
    Also: If we are exiting in ddxProcessArgument() due to an error in
    options, use a non-zero exit status.

diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index 250051425..c336820df 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -981,8 +981,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
           for (iMonitor = 1; ; iMonitor++)
             {
               struct GetMonitorInfoData data;
-              QueryMonitor(iMonitor, &data);
-              if (data.bMonitorSpecifiedExists)
+              if (QueryMonitor(iMonitor, &data))
                 {
                   MONITORINFO mi;
                   mi.cbSize = sizeof(MONITORINFO);
diff --git a/hw/xwin/winmonitors.c b/hw/xwin/winmonitors.c
index 955fb9214..5ff565308 100644
--- a/hw/xwin/winmonitors.c
+++ b/hw/xwin/winmonitors.c
@@ -39,7 +39,7 @@ from The Open Group.
  */
 
 static
-    wBOOL CALLBACK
+WINBOOL CALLBACK
 getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data)
 {
     struct GetMonitorInfoData *data = (struct GetMonitorInfoData *) _data;
@@ -70,5 +70,5 @@ QueryMonitor(int i, struct GetMonitorInfoData *data)
     /* query information */
     EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data);
 
-    return TRUE;
+    return data->bMonitorSpecifiedExists;
 }
diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index 29e91abc8..cb03b00e0 100644
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -309,11 +309,7 @@ ddxProcessArgument(int argc, char *argv[], int i)
         if (i + 2 < argc && 1 == sscanf(argv[i + 2], "@%d", (int *) &iMonitor)) {
             struct GetMonitorInfoData data;
 
-            if (!QueryMonitor(iMonitor, &data)) {
-                ErrorF
-                    ("ddxProcessArgument - screen - Querying monitors failed\n");
-            }
-            else if (data.bMonitorSpecifiedExists == TRUE) {
+            if (QueryMonitor(iMonitor, &data)) {
                 winErrorFVerb(2,
                               "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n",
                               iMonitor);
@@ -334,8 +330,7 @@ ddxProcessArgument(int argc, char *argv[], int i)
                 ErrorF
                     ("ddxProcessArgument - screen - Invalid monitor number %d\n",
                      iMonitor);
-                UseMsg();
-                exit(0);
+                exit(1);
                 return 0;
             }
         }
@@ -366,11 +361,7 @@ ddxProcessArgument(int argc, char *argv[], int i)
                                 (int *) &iMonitor)) {
                     struct GetMonitorInfoData data;
 
-                    if (!QueryMonitor(iMonitor, &data)) {
-                        ErrorF
-                            ("ddxProcessArgument - screen - Querying monitors failed\n");
-                    }
-                    else if (data.bMonitorSpecifiedExists == TRUE) {
+                    if (QueryMonitor(iMonitor, &data)) {
                         g_ScreenInfo[nScreenNum].iMonitor = iMonitor;
                         g_ScreenInfo[nScreenNum].hMonitor = data.monitorHandle;
                         g_ScreenInfo[nScreenNum].dwInitialX +=
@@ -383,11 +374,9 @@ ddxProcessArgument(int argc, char *argv[], int i)
                         ErrorF
                             ("ddxProcessArgument - screen - Invalid monitor number %d\n",
                              iMonitor);
-                        UseMsg();
-                        exit(0);
+                        exit(1);
                         return 0;
                     }
-
                 }
             }
 
@@ -395,11 +384,7 @@ ddxProcessArgument(int argc, char *argv[], int i)
             else if (1 == sscanf(argv[i + 2], "%*dx%*d@%d", (int *) &iMonitor)) {
                 struct GetMonitorInfoData data;
 
-                if (!QueryMonitor(iMonitor, &data)) {
-                    ErrorF
-                        ("ddxProcessArgument - screen - Querying monitors failed\n");
-                }
-                else if (data.bMonitorSpecifiedExists == TRUE) {
+                if (QueryMonitor(iMonitor, &data)) {
                     winErrorFVerb(2,
                                   "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n",
                                   iMonitor);
@@ -414,11 +399,9 @@ ddxProcessArgument(int argc, char *argv[], int i)
                     ErrorF
                         ("ddxProcessArgument - screen - Invalid monitor number %d\n",
                          iMonitor);
-                    UseMsg();
-                    exit(0);
+                    exit(1);
                     return 0;
                 }
-
             }
         }
         else if (i + 3 < argc && 1 == sscanf(argv[i + 2], "%d", (int *) &iWidth)
diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c
index 16b5f0565..e375be9c1 100644
--- a/hw/xwin/winwndproc.c
+++ b/hw/xwin/winwndproc.c
@@ -238,7 +238,6 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
                     struct GetMonitorInfoData data;
 
                     if (QueryMonitor(s_pScreenInfo->iMonitor, &data)) {
-                        if (data.bMonitorSpecifiedExists == TRUE) {
                             dwWidth = data.monitorWidth;
                             dwHeight = data.monitorHeight;
                             /*
@@ -250,7 +249,6 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
                             ErrorF("Monitor number %d no longer exists!\n",
                                    s_pScreenInfo->iMonitor);
                         }
-                    }
                 }
 
                 /*


More information about the xorg-commit mailing list