return _eglError(EGL_BAD_ALLOC, "eglInitialize");
disp->DriverData = (void *) dri2_dpy;
- dri2_dpy->conn = XGetXCBConnection(disp->NativeDisplay);
- if (!dri2_dpy->conn) {
+ if (disp->NativeDisplay != NULL)
+ dri2_dpy->conn = XGetXCBConnection(disp->NativeDisplay);
+ else
dri2_dpy->conn = xcb_connect(0, 0);
- if (!dri2_dpy->conn) {
- _eglLog(_EGL_WARNING, "DRI2: xcb_connect failed");
- goto cleanup_dpy;
- }
+ if (!dri2_dpy->conn) {
+ _eglLog(_EGL_WARNING, "DRI2: xcb_connect failed");
+ goto cleanup_dpy;
}
xcb_prefetch_extension_data (dri2_dpy->conn, &xcb_xfixes_id);