st/egl: Disable SHM in ximage backend.
[mesa.git] / src / gallium / state_trackers / egl / x11 / native_x11.c
index 695ab88010b3c9683cf3b0c1bed8a26d8f45c0e4..55f0d4d30838d2aea4a150cfc098014090d9cb85 100644 (file)
@@ -22,6 +22,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include <stdio.h>
 #include <string.h>
 #include "util/u_debug.h"
 #include "util/u_memory.h"
@@ -70,7 +71,8 @@ native_create_probe(EGLNativeDisplayType dpy)
    if (xscr) {
       if (x11_screen_support(xscr, X11_SCREEN_EXTENSION_DRI2)) {
          driver_name = x11_screen_probe_dri2(xscr);
-         nprobe->data = strdup(driver_name);
+         if (driver_name)
+            nprobe->data = strdup(driver_name);
       }
 
       x11_screen_destroy(xscr);
@@ -139,9 +141,16 @@ native_create_display(EGLNativeDisplayType dpy)
 
    if (!ndpy) {
       EGLint level = (force_sw) ? _EGL_INFO : _EGL_WARNING;
-
-      _eglLog(level, "use software fallback");
-      ndpy = x11_create_ximage_display(dpy, TRUE);
+      boolean use_shm;
+
+      /*
+       * XXX st/mesa calls pipe_screen::update_buffer in st_validate_state.
+       * When SHM is used, there is a good chance that the shared memory
+       * segment is detached before the softpipe tile cache is flushed.
+       */
+      use_shm = FALSE;
+      _eglLog(level, "use software%s fallback", (use_shm) ? " (SHM)" : "");
+      ndpy = x11_create_ximage_display(dpy, use_shm);
    }
 
    return ndpy;