xserver: Branch 'master' - 2 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 12 14:47:10 UTC 2018


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

New commits:
commit fc78bcca21e767697de6ad4d8e03b6728856f613
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>

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 af151895f3cb1755a7a5631f2398a3d3b219cbef
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>

diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index 9b930d603..210c11824 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -995,6 +995,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 05ac048e1..2eb069d01 100644
--- a/hw/xwayland/xwayland-glamor-gbm.c
+++ b/hw/xwayland/xwayland-glamor-gbm.c
@@ -879,6 +879,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");
@@ -925,7 +926,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;
     }


More information about the xorg-commit mailing list