summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2017-05-03 11:03:34 -0400
committerEmil Velikov <emil.l.velikov@gmail.com>2017-05-08 11:24:03 +0100
commit0bd957be11c20f3fb5e5a088af11431d2ef74b91 (patch)
treed6f44057fbe96b9a7a2556595ba4f141eb19e462
parent4ad2c57c2647ec8bc30b60df41b5d3d66c9e48e1 (diff)
downloadmesa-0bd957be11c20f3fb5e5a088af11431d2ef74b91.tar.gz
mesa-0bd957be11c20f3fb5e5a088af11431d2ef74b91.tar.bz2
mesa-0bd957be11c20f3fb5e5a088af11431d2ef74b91.zip
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@lists.freedesktop.org> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Adam Jackson <ajax@redhat.com> (cherry picked from commit f258815c7d4187fd83f6944943e78206a6cdc4cb)
-rw-r--r--src/egl/drivers/dri2/platform_drm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index cf35ce8a1f2..9431d95e0a7 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) {