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

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Oct 15 12:54:45 UTC 2018


 glamor/glamor_egl.c               |   16 +++++++++++++++-
 hw/xfree86/fbdevhw/fbdevhw.c      |   16 ++++++++++++++++
 hw/xwayland/xwayland-glamor-gbm.c |   11 +++++++++++
 3 files changed, 42 insertions(+), 1 deletion(-)

New commits:
commit f5dc787fc9bb102e4eea477d1817e35370084ea2
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Oct 10 14:09:11 2018 -0400

    fbdevhw: Refuse to touch PCI devices on the fallback probe path
    
    Fixes: https://gitlab.freedesktop.org/xorg/driver/xf86-video-fbdev/issues/9
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit fc78bcca21e767697de6ad4d8e03b6728856f613)

diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c
index 0bd77df87..3fb1d2bba 100644
--- a/hw/xfree86/fbdevhw/fbdevhw.c
+++ b/hw/xfree86/fbdevhw/fbdevhw.c
@@ -329,6 +329,22 @@ fbdev_open(int scrnIndex, const char *dev, char **namep)
         return -1;
     }
 
+    /* only touch non-PCI devices on this path */
+    {
+        char buf[PATH_MAX];
+        char *sysfs_path = NULL;
+        char *node = strrchr(dev, '/') + 1;
+
+        if (asprintf(&sysfs_path, "/sys/class/graphics/%s", node) < 0 ||
+            readlink(sysfs_path, buf, sizeof(buf) < 0) ||
+            strstr(buf, "devices/pci")) {
+            free(sysfs_path);
+            close(fd);
+            return -1;
+        }
+        free(sysfs_path);
+    }
+
     if (namep) {
         if (-1 == ioctl(fd, FBIOGET_FSCREENINFO, (void *) (&fix))) {
             *namep = NULL;
commit 4795c069a503144ea31f01de0c039f32d9880292
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Oct 5 14:50:20 2018 -0400

    glamor/egl: Avoid crashing on broken configurations
    
    0a9415cf apparently can tickle bugs in the GL stack where glGetString
    returns NULL, presumably because the eglMakeCurrent() didn't manage to
    actually install a dispatch table and you're hitting a stub function.
    That's clearly not our bug, but if it happens we should at least not
    crash. Notice this case and fail gently.
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit af151895f3cb1755a7a5631f2398a3d3b219cbef)

diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index 31b1faffa..d3c678d6b 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -989,6 +989,11 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
     }
 
     renderer = glGetString(GL_RENDERER);
+    if (!renderer) {
+        xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+                   "glGetString() returned NULL, your GL is broken\n");
+        goto error;
+    }
     if (strstr((const char *)renderer, "llvmpipe")) {
         xf86DrvMsg(scrn->scrnIndex, X_INFO,
                    "Refusing to try glamor on llvmpipe\n");
diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c
index 25a354bf7..6aa1e4641 100644
--- a/hw/xwayland/xwayland-glamor-gbm.c
+++ b/hw/xwayland/xwayland-glamor-gbm.c
@@ -797,6 +797,7 @@ xwl_glamor_gbm_init_egl(struct xwl_screen *xwl_screen)
         GLAMOR_GL_CORE_VER_MINOR,
         EGL_NONE
     };
+    const GLubyte *renderer;
 
     if (!xwl_gbm->fd_render_node && !xwl_gbm->drm_authenticated) {
         ErrorF("Failed to get wl_drm, disabling Glamor and DRI3\n");
@@ -843,7 +844,12 @@ xwl_glamor_gbm_init_egl(struct xwl_screen *xwl_screen)
         goto error;
     }
 
-    if (strstr((const char *)glGetString(GL_RENDERER), "llvmpipe")) {
+    renderer = glGetString(GL_RENDERER);
+    if (!renderer) {
+        ErrorF("glGetString() returned NULL, your GL is broken\n");
+        goto error;
+    }
+    if (strstr((const char *)renderer, "llvmpipe")) {
         ErrorF("Refusing to try glamor on llvmpipe\n");
         goto error;
     }
commit 1e3c5d614ee33d9eac1d2cf6366feeb8341fc0f4
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Sep 14 11:33:43 2018 -0400

    glamor_egl: Don't initialize on llvmpipe
    
    Mesa started supporting GL_OES_EGL_image on llvmpipe in 17.3, after this
    commit:
    
        commit bbdeddd5fd0b797e1e281f058338b3da4d98029d
        Author: Gurchetan Singh <gurchetansingh at chromium.org>
        Date:   Tue Aug 1 14:49:33 2017 -0700
    
            st/dri: add drisw image extension
    
    That's pretty cool, but it means glamor now thinks it can initialize on
    llvmpipe. This is almost certainly not what anyone wants, as glamor on
    llvmpipe is pretty much uniformly slower than fb.
    
    This fixes both Xorg and Xwayland to refuse glamor in such a setup.
    Xephyr is left alone, both because glamor is not the default there and
    because Xephyr+glamor+llvmpipe is one of the easier ways to get xts to
    exercise glamor.
    
    The (very small) downside of this change is that you lose DRI3 support.
    This wouldn't have helped you very much (since an lp glamor blit is
    slower than a pixman blit), but it would eliminate the PutImage overhead
    for llvmpipe's glXSwapBuffers. A future change should add DRI3 support
    for the fb-only case.
    
    Reviewed-by: Eric Anholt <eric at anholt.net>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit 0a9415cf793babed1f28c61f8047d51de04f1528)

diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index 0edfa111c..31b1faffa 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -892,6 +892,7 @@ Bool
 glamor_egl_init(ScrnInfoPtr scrn, int fd)
 {
     struct glamor_egl_screen_private *glamor_egl;
+    const GLubyte *renderer;
 
     glamor_egl = calloc(sizeof(*glamor_egl), 1);
     if (glamor_egl == NULL)
@@ -986,6 +987,14 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
                    "Failed to make EGL context current\n");
         goto error;
     }
+
+    renderer = glGetString(GL_RENDERER);
+    if (strstr((const char *)renderer, "llvmpipe")) {
+        xf86DrvMsg(scrn->scrnIndex, X_INFO,
+                   "Refusing to try glamor on llvmpipe\n");
+        goto error;
+    }
+
     /*
      * Force the next glamor_make_current call to set the right context
      * (in case of multiple GPUs using glamor)
@@ -999,7 +1008,7 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
     }
 
     xf86DrvMsg(scrn->scrnIndex, X_INFO, "glamor X acceleration enabled on %s\n",
-               glGetString(GL_RENDERER));
+               renderer);
 
 #ifdef GBM_BO_WITH_MODIFIERS
     if (epoxy_has_egl_extension(glamor_egl->display,
diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c
index 06fcf5239..25a354bf7 100644
--- a/hw/xwayland/xwayland-glamor-gbm.c
+++ b/hw/xwayland/xwayland-glamor-gbm.c
@@ -843,6 +843,11 @@ xwl_glamor_gbm_init_egl(struct xwl_screen *xwl_screen)
         goto error;
     }
 
+    if (strstr((const char *)glGetString(GL_RENDERER), "llvmpipe")) {
+        ErrorF("Refusing to try glamor on llvmpipe\n");
+        goto error;
+    }
+
     if (!epoxy_has_gl_extension("GL_OES_EGL_image")) {
         ErrorF("GL_OES_EGL_image not available\n");
         goto error;


More information about the xorg-commit mailing list