xserver: Branch 'server-1.20-branch' - 10 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Feb 12 21:13:09 UTC 2020


 exa/exa_accel.c                                  |    2 -
 glamor/glamor_copy.c                             |    8 ++++--
 glamor/glamor_picture.c                          |    4 ++-
 glamor/glamor_prepare.c                          |   28 ++++++++++++++++++-----
 glamor/glamor_priv.h                             |    1 
 glx/glxdri2.c                                    |    2 -
 hw/xfree86/drivers/modesetting/drmmode_display.c |    9 ++++---
 hw/xfree86/modes/xf86Rotate.c                    |    2 -
 os/io.c                                          |    5 ++++
 9 files changed, 45 insertions(+), 16 deletions(-)

New commits:
commit d44bbb4710961651dcf10701bc562f1f01509010
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Feb 10 10:22:34 2020 +0100

    glamor: Fix a compiler warning since the recent OOM fixes.
    
    Signed-off-by: Eric Anholt <eric at anholt.net>
    (cherry picked from commit 3b26b90cb787a14fa5f8bb2033eab8ab6562a9a5)

diff --git a/glamor/glamor_prepare.c b/glamor/glamor_prepare.c
index c1a611f9a..835c4ebea 100644
--- a/glamor/glamor_prepare.c
+++ b/glamor/glamor_prepare.c
@@ -146,8 +146,6 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
 static void
 glamor_fini_pixmap(PixmapPtr pixmap)
 {
-    ScreenPtr                   screen = pixmap->drawable.pScreen;
-    glamor_screen_private       *glamor_priv = glamor_get_screen_private(screen);
     glamor_pixmap_private       *priv = glamor_get_pixmap_private(pixmap);
 
     if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(priv))
commit d2a6c8708ca4f27c8d9aade6db2c4e7f2d8c624f
Author: Paul Kocialkowski <paul.kocialkowski at bootlin.com>
Date:   Mon Feb 10 10:21:02 2020 +0100

    glamor: Fallback to system memory for RW PBO buffer allocation
    
    We currently support two modes of operation for RW PBO buffers: one
    that allocates a pack buffer with GL memory and one that uses system
    memory when the former is not supported.
    
    Since allocation with system memory is less likely to fail, add a
    fallback to system memory when GL memory failed instead of bailing
    out.
    
    Signed-off-by: Paul Kocialkowski <paul.kocialkowski at bootlin.com>
    (cherry picked from commit 8c4e8d9eff03cefc987f13c900b0a47403946127)

diff --git a/glamor/glamor_prepare.c b/glamor/glamor_prepare.c
index 6b35936fc..c1a611f9a 100644
--- a/glamor/glamor_prepare.c
+++ b/glamor/glamor_prepare.c
@@ -107,9 +107,10 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
                 glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
                 glDeleteBuffers(1, &priv->pbo);
                 priv->pbo = 0;
-                return FALSE;
             }
-        } else {
+        }
+
+        if (!priv->pbo) {
             pixmap->devPrivate.ptr = xallocarray(pixmap->devKind,
                                                  pixmap->drawable.height);
             if (!pixmap->devPrivate.ptr)
@@ -123,7 +124,7 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
 
     RegionUninit(&region);
 
-    if (glamor_priv->has_rw_pbo) {
+    if (priv->pbo) {
         if (priv->map_access == GLAMOR_ACCESS_RW)
             gl_access = GL_READ_WRITE;
         else
@@ -155,7 +156,7 @@ glamor_fini_pixmap(PixmapPtr pixmap)
     if (!priv->prepared)
         return;
 
-    if (glamor_priv->has_rw_pbo) {
+    if (priv->pbo) {
         glBindBuffer(GL_PIXEL_UNPACK_BUFFER, priv->pbo);
         glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
         pixmap->devPrivate.ptr = NULL;
@@ -170,7 +171,7 @@ glamor_fini_pixmap(PixmapPtr pixmap)
 
     RegionUninit(&priv->prepare_region);
 
-    if (glamor_priv->has_rw_pbo) {
+    if (priv->pbo) {
         glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
         glDeleteBuffers(1, &priv->pbo);
         priv->pbo = 0;
commit ca034c2f2cfff8e49b816b8ecbaa96215b796e36
Author: Paul Kocialkowski <paul.kocialkowski at bootlin.com>
Date:   Mon Feb 10 10:20:30 2020 +0100

    glamor: Propagate glamor_prepare_access failures in copy helpers
    
    glamor_prepare_access can fail for a few reasons, especially when
    failing to allocate a PBO buffer. Take this in account and bail in
    the copy helpers that call the helper when a failure happens.
    
    Signed-off-by: Paul Kocialkowski <paul.kocialkowski at bootlin.com>
    (cherry picked from commit de6b3fac1f26075ce915006c914c4a4755617715)

diff --git a/glamor/glamor_copy.c b/glamor/glamor_copy.c
index e050c0220..1ab2be6c0 100644
--- a/glamor/glamor_copy.c
+++ b/glamor/glamor_copy.c
@@ -221,7 +221,9 @@ glamor_copy_cpu_fbo(DrawablePtr src,
         goto bail;
 
     glamor_make_current(glamor_priv);
-    glamor_prepare_access(src, GLAMOR_ACCESS_RO);
+
+    if (!glamor_prepare_access(src, GLAMOR_ACCESS_RO))
+        goto bail;
 
     glamor_get_drawable_deltas(dst, dst_pixmap, &dst_xoff, &dst_yoff);
 
@@ -309,7 +311,9 @@ glamor_copy_fbo_cpu(DrawablePtr src,
         goto bail;
 
     glamor_make_current(glamor_priv);
-    glamor_prepare_access(dst, GLAMOR_ACCESS_RW);
+
+    if (!glamor_prepare_access(dst, GLAMOR_ACCESS_RW))
+        goto bail;
 
     glamor_get_drawable_deltas(src, src_pixmap, &src_xoff, &src_yoff);
 
commit a7b165d994d74131778a5a9bcffec957f1d1cacb
Author: Paul Kocialkowski <paul.kocialkowski at bootlin.com>
Date:   Mon Feb 10 10:20:04 2020 +0100

    glamor: Error out on out-of-memory when allocating PBO for FBO access
    
    Packed buffer allocation (which happens at glBufferData time with the
    buffer bound) can fail when there is no GL memory left.
    
    Pick up the error when it happens, print a proper error message, do
    some cleanup and bail.
    
    Signed-off-by: Paul Kocialkowski <paul.kocialkowski at bootlin.com>
    (cherry picked from commit bc2e12239f86e5a4acd220744f42eb83ba55d328)

diff --git a/glamor/glamor_prepare.c b/glamor/glamor_prepare.c
index 5a73e6c7d..6b35936fc 100644
--- a/glamor/glamor_prepare.c
+++ b/glamor/glamor_prepare.c
@@ -88,10 +88,27 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
 
             gl_usage = GL_STREAM_READ;
 
+            glamor_priv->suppress_gl_out_of_memory_logging = true;
+
             glBindBuffer(GL_PIXEL_PACK_BUFFER, priv->pbo);
             glBufferData(GL_PIXEL_PACK_BUFFER,
                          pixmap->devKind * pixmap->drawable.height, NULL,
                          gl_usage);
+
+            glamor_priv->suppress_gl_out_of_memory_logging = false;
+
+            if (glGetError() == GL_OUT_OF_MEMORY) {
+                if (!glamor_priv->logged_any_pbo_allocation_failure) {
+                    LogMessageVerb(X_WARNING, 0, "glamor: Failed to allocate %d "
+                                   "bytes PBO due to GL_OUT_OF_MEMORY.\n",
+                                   pixmap->devKind * pixmap->drawable.height);
+                    glamor_priv->logged_any_pbo_allocation_failure = true;
+                }
+                glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
+                glDeleteBuffers(1, &priv->pbo);
+                priv->pbo = 0;
+                return FALSE;
+            }
         } else {
             pixmap->devPrivate.ptr = xallocarray(pixmap->devKind,
                                                  pixmap->drawable.height);
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index 661c11d90..1686ef5a4 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -289,6 +289,7 @@ typedef struct glamor_screen_private {
 
     Bool suppress_gl_out_of_memory_logging;
     Bool logged_any_fbo_allocation_failure;
+    Bool logged_any_pbo_allocation_failure;
 
     /* xv */
     glamor_program xv_prog;
commit 428b5ce4da99a43bfa0c1933ec447f7feb3639a1
Author: Paul Kocialkowski <paul.kocialkowski at bootlin.com>
Date:   Mon Feb 10 10:19:18 2020 +0100

    glamor: Propagate FBO allocation failure for picture to texture upload
    
    When uploading a picture to a texture, glamor_upload_picture_to_texture
    calls glamor_pixmap_ensure_fbo to ensure that there is backing FBO.
    The FBO will be allocated if the picture's drawable pixmap does not have
    one already, which can fail when there is no GL memory left.
    
    glamor_upload_picture_to_texture checks that the call succeeded and will
    enter the failure path if it did not. However, unlike many other
    functions in glamor, this one has ret set to TRUE initially, so it needs
    to be set to FALSE when a failure happens.
    
    Otherwise, the error is not propagated and the failure path return TRUE.
    This leads to a fault when trying to access the FBO pointer later on.
    
    Signed-off-by: Paul Kocialkowski <paul.kocialkowski at bootlin.com>
    (cherry picked from commit c98c7709c67d8ed6b7455ec700a49b58c396ec2c)

diff --git a/glamor/glamor_picture.c b/glamor/glamor_picture.c
index 84a33ad6a..685d8d618 100644
--- a/glamor/glamor_picture.c
+++ b/glamor/glamor_picture.c
@@ -340,8 +340,10 @@ glamor_upload_picture_to_texture(PicturePtr picture)
     else
         iformat = format;
 
-    if (!glamor_pixmap_ensure_fbo(pixmap, iformat, GLAMOR_CREATE_FBO_NO_FBO))
+    if (!glamor_pixmap_ensure_fbo(pixmap, iformat, GLAMOR_CREATE_FBO_NO_FBO)) {
+        ret = FALSE;
         goto fail;
+    }
 
     glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
 
commit 948afd768398955f043fef8e14d7d154cea25f85
Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Feb 6 17:59:08 2020 +0100

    modesetting: remove unnecessary error message, fix zaphod leases
    
    I introduced this error with the MST hotplug code, but it can trigger
    on zaphod setups, and is perfectly fine. There is no support for
    MST/hotplug on zaphod setups currently, so we can just skip over
    the dynamic connector handling here. However we shouldn't skip
    over the lease handling so move it into the codepath.
    
    Fixes: 9257b1252da9 ("modesetting: add dynamic connector hotplug support (MST) (v3)")
    Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    (cherry picked from commit 1cfdd1a96580733df3625bcea3384ffee3dc92df)

diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index 3874f6e21..ae06fa357 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -3677,7 +3677,7 @@ drmmode_handle_uevents(int fd, void *closure)
         goto out;
 
     if (mode_res->count_crtcs != config->num_crtc) {
-        ErrorF("number of CRTCs changed - failed to handle, %d vs %d\n", mode_res->count_crtcs, config->num_crtc);
+        /* this triggers with Zaphod mode where we don't currently support connector hotplug or MST. */
         goto out_free_res;
     }
 
@@ -3726,15 +3726,16 @@ drmmode_handle_uevents(int fd, void *closure)
         drmmode_output_init(scrn, drmmode, mode_res, i, TRUE, 0);
     }
 
-    /* Check to see if a lessee has disappeared */
-    drmmode_validate_leases(scrn);
-
     if (changed) {
         RRSetChanged(xf86ScrnToScreen(scrn));
         RRTellChanged(xf86ScrnToScreen(scrn));
     }
 
 out_free_res:
+
+    /* Check to see if a lessee has disappeared */
+    drmmode_validate_leases(scrn);
+
     drmModeFreeResources(mode_res);
 out:
     RRGetInfo(xf86ScrnToScreen(scrn), TRUE);
commit 1c3e51dabadbf65e7fdedbebbdcd19a85fb03e34
Author: Michel Dänzer <mdaenzer at redhat.com>
Date:   Thu Feb 6 17:57:16 2020 +0100

    xfree86/modes: Bail from xf86RotateRedisplay if pScreen->root is NULL
    
    Avoids a crash in xf86RotatePrepare -> DamageRegister during
    CreateScreenResources if rotation or another transform is configured for
    any connected RandR output in xorg.conf. The generic rotation/transform
    code generally can't work without the root window currently.
    
    Closes: https://gitlab.freedesktop.org/xorg/xserver/issues/969
    Fixes: 094f42cdfe5d "xfree86/modes: Call xf86RotateRedisplay from
                         xf86CrtcRotate"
    Acked-by: Olivier Fourdan <ofourdan at redhat.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit 6a5e47c57d16de8b6a6a2636f3cbad1aebec32e2)

diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c
index 05944cfcb..5415ed97c 100644
--- a/hw/xfree86/modes/xf86Rotate.c
+++ b/hw/xfree86/modes/xf86Rotate.c
@@ -176,7 +176,7 @@ xf86RotateRedisplay(ScreenPtr pScreen)
     DamagePtr damage = xf86_config->rotation_damage;
     RegionPtr region;
 
-    if (!damage)
+    if (!damage || !pScreen->root)
         return FALSE;
     xf86RotatePrepare(pScreen);
     region = DamageRegion(damage);
commit af2fd88b1019f63fe3ce871f9e99b3e1e4608b25
Author: Daniel Llewellyn <daniel at bowlhat.net>
Date:   Thu Feb 6 17:56:12 2020 +0100

    os: Ignore dying client in ResetCurrentRequest
    
    You might as well, it's harmless. Better, some cleanup code (like DRI2
    swap wait) needs to run both normally and at client exit, so it
    simplifies the callers to not need to check first. See 4308f5d3 for a
    similar example.
    
    Props: @ajax (Adam Jackson)
    
    Fixes: xorg/xserver#211
    
    Signed-off-by: Daniel Llewellyn <diddledan at ubuntu.com>
    (cherry picked from commit 578371616e09364318c9fb2371a693d438b31b29)

diff --git a/os/io.c b/os/io.c
index b099f0967..939f51743 100644
--- a/os/io.c
+++ b/os/io.c
@@ -557,6 +557,11 @@ void
 ResetCurrentRequest(ClientPtr client)
 {
     OsCommPtr oc = (OsCommPtr) client->osPrivate;
+
+    /* ignore dying clients */
+    if (!oc)
+        return;
+
     register ConnectionInputPtr oci = oc->input;
     register xReq *request;
     int gotnow, needed;
commit e5293f1c5d7b20d98ed4975dc29a6f88c8bc6a0d
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Feb 6 17:55:25 2020 +0100

    Revert "dri2: Don't make reference to noClientException"
    
    It's true that the value would always be -1, if it's not zero, but it's
    usually zero is the problem. As a result we return failure from
    otherwise successful indirect GLX paths, which isn't very nice of us.
    
    This reverts commit 7d33ab0f8c7958b205076f71e4b47c24aace77fd.
    
    Fixes: https://gitlab.freedesktop.org/xorg/xserver/issues/211
    (cherry picked from commit e1fa3beb2fe2519e69f859f0acdc68e5a770de27)

diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index d402ca860..822515a86 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -295,7 +295,7 @@ __glXDRIcontextWait(__GLXcontext * baseContext,
     }
 
     if (ret) {
-        *error = -1;
+        *error = cl->client->noClientException;
         return TRUE;
     }
 
commit d845ceae53bb425695e6a185b51ae1b432dd4672
Author: George Matsumura <gmmatsumura01 at bvsd.org>
Date:   Thu Feb 6 17:54:36 2020 +0100

    Restrict 1x1 pixmap filling optimization to GXcopy
    
    This restricts an optimization whereby the filling of 1x1 pixmaps
    went around the driver-provided function to cases where the
    source color is meant to be directly copied to the destination,
    as opposed to other operations which should produce different
    destination values than just the foreground color.
    
    Signed-off-by: George Matsumura <gmmatsumura01 at bvsd.org>
    Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
    (cherry picked from commit 83826075e59c0393c16d2a2482dc5c9f2fdf4564)

diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index b26d5c804..41fcb129f 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -1037,7 +1037,7 @@ exaFillRegionSolid(DrawablePtr pDrawable, RegionPtr pRegion, Pixel pixel,
         if (pExaPixmap->pDamage &&
             pExaPixmap->sys_ptr && pDrawable->type == DRAWABLE_PIXMAP &&
             pDrawable->width == 1 && pDrawable->height == 1 &&
-            pDrawable->bitsPerPixel != 24) {
+            pDrawable->bitsPerPixel != 24 && alu == GXcopy) {
             RegionPtr pending_damage = DamagePendingRegion(pExaPixmap->pDamage);
 
             switch (pDrawable->bitsPerPixel) {


More information about the xorg-commit mailing list