Mesa (master): egl/platform/drm: Don' t take display ownership until gbm is initialized

Adam Jackson ajax at kemper.freedesktop.org
Thu May 4 17:01:38 UTC 2017


Module: Mesa
Branch: master
Commit: f258815c7d4187fd83f6944943e78206a6cdc4cb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f258815c7d4187fd83f6944943e78206a6cdc4cb

Author: Adam Jackson <ajax at redhat.com>
Date:   Wed May  3 11:03:34 2017 -0400

egl/platform/drm: Don't take display ownership until gbm is initialized

If the gbm_create_device() call here actually did fail, any subsequent
eglTerminate on the display would segfault.

Cc: <mesa-stable at lists.freedesktop.org>
Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>
Signed-off-by: Adam Jackson <ajax at redhat.com>

---

 src/egl/drivers/dri2/platform_drm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index cf35ce8a1f..9431d95e0a 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -689,12 +689,12 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
          fd = loader_open_device(buf);
       if (fd < 0)
          fd = loader_open_device("/dev/dri/card0");
-      dri2_dpy->own_device = 1;
       gbm = gbm_create_device(fd);
       if (gbm == NULL) {
          err = "DRI2: failed to create gbm device";
          goto cleanup;
       }
+      dri2_dpy->own_device = 1;
    } else {
       fd = fcntl(gbm_device_get_fd(gbm), F_DUPFD_CLOEXEC, 3);
       if (fd < 0) {




More information about the mesa-commit mailing list