xserver: Branch 'master' - 2 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Apr 14 17:31:53 UTC 2024


 hw/xnest/Screen.c |    8 +++-----
 mi/mi.h           |    5 -----
 mi/miscrinit.c    |   14 +++++++++-----
 3 files changed, 12 insertions(+), 15 deletions(-)

New commits:
commit 7c5b5642b2abf7d67e1ce04b75d85915faa34f4c
Author: Tom Yan <tom.ty89 at gmail.com>
Date:   Thu Jan 20 22:25:07 2022 +0800

    mi: decouple miCreateScreenResources from pScreen->{width,height}
    
    This allows pScreen->{width,height} to be changed to smaller values
    after miScreenInit() is called but before pScreen is further set up
    / used by dix, so that the screen size can be fit to the mode of
    choice even when it does not have the maximum width and/or height
    among its peers.
    
    XGetImage() for one will fail once the screen is change back to a
    bigger size with xrandr, which prevents e.g. x11vnc to work on the
    server.
    
    Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/854>

diff --git a/mi/miscrinit.c b/mi/miscrinit.c
index f375d19fa..2030674a9 100644
--- a/mi/miscrinit.c
+++ b/mi/miscrinit.c
@@ -55,6 +55,8 @@ from The Open Group.
 typedef struct {
     void *pbits;                /* pointer to framebuffer */
     int width;                  /* delta to add to a framebuffer addr to move one row down */
+    int xsize;
+    int ysize;
 } miScreenInitParmsRec, *miScreenInitParmsPtr;
 
 /* this plugs into pScreen->ModifyPixmapHeader */
@@ -166,8 +168,8 @@ miCreateScreenResources(ScreenPtr pScreen)
         if (!pPixmap)
             return FALSE;
 
-        if (!(*pScreen->ModifyPixmapHeader) (pPixmap, pScreen->width,
-                                             pScreen->height,
+        if (!(*pScreen->ModifyPixmapHeader) (pPixmap, pScrInitParms->xsize,
+                                             pScrInitParms->ysize,
                                              pScreen->rootDepth,
                                              BitsPerPixel(pScreen->rootDepth),
                                              PixmapBytePad(pScrInitParms->width,
@@ -185,7 +187,7 @@ miCreateScreenResources(ScreenPtr pScreen)
 }
 
 static Bool
-miScreenDevPrivateInit(ScreenPtr pScreen, int width, void *pbits)
+miScreenDevPrivateInit(ScreenPtr pScreen, int width, void *pbits, int xsize, int ysize)
 {
     miScreenInitParmsPtr pScrInitParms;
 
@@ -198,6 +200,8 @@ miScreenDevPrivateInit(ScreenPtr pScreen, int width, void *pbits)
         return FALSE;
     pScrInitParms->pbits = pbits;
     pScrInitParms->width = width;
+    pScrInitParms->xsize = xsize;
+    pScrInitParms->ysize = ysize;
     pScreen->devPrivate = (void *) pScrInitParms;
     return TRUE;
 }
@@ -291,7 +295,7 @@ miScreenInit(ScreenPtr pScreen, void *pbits,  /* pointer to screen bits */
 
     miSetZeroLineBias(pScreen, DEFAULTZEROLINEBIAS);
 
-    return miScreenDevPrivateInit(pScreen, width, pbits);
+    return miScreenDevPrivateInit(pScreen, width, pbits, xsize, ysize);
 }
 
 DevPrivateKeyRec miZeroLineScreenKeyRec;
commit aa3f5023e3fae0df74039702b6c8218bc14dc679
Author: Tom Yan <tom.ty89 at gmail.com>
Date:   Thu Jan 20 21:54:35 2022 +0800

    xnest/mi: remove redundant call of miScreenDevPrivateInit()
    
    miScreenDevPrivateInit() is also made static in this commit.
    
    Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/854>

diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c
index 88c146040..5769dd1c2 100644
--- a/hw/xnest/Screen.c
+++ b/hw/xnest/Screen.c
@@ -242,8 +242,9 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
 
     /* myNum */
     /* id */
-    miScreenInit(pScreen, NULL, xnestWidth, xnestHeight, 1, 1, xnestWidth, rootDepth, numDepths, depths, defaultVisual, /* root visual */
-                 numVisuals, visuals);
+    if (!miScreenInit(pScreen, NULL, xnestWidth, xnestHeight, 1, 1, xnestWidth, rootDepth, numDepths, depths, defaultVisual, /* root visual */
+                      numVisuals, visuals))
+        return FALSE;
 
     pScreen->defColormap = (Colormap) FakeClientID(0);
     pScreen->minInstalledCmaps = MINCMAPS;
@@ -332,9 +333,6 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
     /* overwrite miCloseScreen with our own */
     pScreen->CloseScreen = xnestCloseScreen;
 
-    if (!miScreenDevPrivateInit(pScreen, xnestWidth, NULL))
-        return FALSE;
-
     /* overwrite miSetShape with our own */
     pScreen->SetShape = xnestSetShape;
 
diff --git a/mi/mi.h b/mi/mi.h
index 8b0a231ca..2d1cd782c 100644
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -382,11 +382,6 @@ extern _X_EXPORT Bool miModifyPixmapHeader(PixmapPtr pPixmap,
 extern _X_EXPORT Bool miCreateScreenResources(ScreenPtr /*pScreen */
     );
 
-extern _X_EXPORT Bool miScreenDevPrivateInit(ScreenPtr pScreen,
-                                             int width,
-                                             void *pbits
-    );
-
 extern _X_EXPORT Bool miScreenInit(ScreenPtr pScreen,
                                    void *pbits,
                                    int xsize,
diff --git a/mi/miscrinit.c b/mi/miscrinit.c
index 3bb52b1bc..f375d19fa 100644
--- a/mi/miscrinit.c
+++ b/mi/miscrinit.c
@@ -184,7 +184,7 @@ miCreateScreenResources(ScreenPtr pScreen)
     return TRUE;
 }
 
-Bool
+static Bool
 miScreenDevPrivateInit(ScreenPtr pScreen, int width, void *pbits)
 {
     miScreenInitParmsPtr pScrInitParms;


More information about the xorg-commit mailing list