egl/drm: ensure the backing gbm is set before using it
[mesa.git] / src / egl / drivers / dri2 / platform_drm.c
index 42d79da7b02bee640e5dd72292d53f3bea391c4a..b0a2af6bf3d44fc43f3394e6f21f4dbb1f042da8 100644 (file)
@@ -715,6 +715,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
          goto cleanup;
       }
    }
+   dri2_dpy->gbm_dri = gbm_dri_device(gbm);
 
    if (strcmp(gbm_device_get_backend_name(gbm), "drm") != 0) {
       err = "DRI2: gbm device using incorrect/incompatible backend";
@@ -729,7 +730,6 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
 
    disp->Device = dev;
 
-   dri2_dpy->gbm_dri = gbm_dri_device(gbm);
    dri2_dpy->driver_name = strdup(dri2_dpy->gbm_dri->driver_name);
 
    dri2_dpy->dri_screen = dri2_dpy->gbm_dri->screen;