dri2_dpy->driver = NULL;
end = search_paths + strlen(search_paths);
for (p = search_paths; p < end && dri2_dpy->driver == NULL; p = next + 1) {
+ int path_len;
+
next = strchr(p, ':');
if (next == NULL)
next = end;
+ path_len = next - p;
snprintf(path, sizeof path,
dri_driver_format,
- next - p, p,
+ path_len, p,
xcb_dri2_connect_driver_name_length (connect),
xcb_dri2_connect_driver_name (connect));
extensions = dri2_dpy->core->getExtensions(dri2_dpy->dri_screen);
for (i = 0; extensions[i]; i++) {
+ _eglLog(_EGL_DEBUG, "DRI2: found extension `%s'", extensions[i]->name);
if ((strcmp(extensions[i]->name, __DRI2_FLUSH) == 0))
dri2_dpy->flush = (__DRI2flushExtension *) extensions[i];
}
if ((cctx == NULL && ddraw == NULL && rdraw == NULL) ||
dri2_dpy->core->bindContext(cctx, ddraw, rdraw)) {
- if (dsurf)
+ if (dsurf && !_eglIsSurfaceLinked(dsurf))
dri2_destroy_surface(drv, disp, dsurf);
- if (rsurf && rsurf != dsurf)
+ if (rsurf && rsurf != dsurf && !_eglIsSurfaceLinked(dsurf))
dri2_destroy_surface(drv, disp, rsurf);
- if (ctx != NULL)
+ if (ctx != NULL && !_eglIsContextLinked(ctx))
dri2_dpy->core->unbindContext(dri2_egl_context(ctx)->dri_context);
return EGL_TRUE;