mesa; add a dummy _mesa_error_no_memory() symbol to libglsl_util
[mesa.git] / src / gallium / state_trackers / xa / xa_tracker.c
index 6e4312e0079b2b064fbd5d3a16f5329f193dd48b..f69ac8edf2774a1dfd2d824d4a2ea6fc0c55ef4f 100644 (file)
@@ -26,6 +26,7 @@
  * Thomas Hellstrom <thellstrom-at-vmware-dot-com>
  */
 
+#include <unistd.h>
 #include "xa_tracker.h"
 #include "xa_priv.h"
 #include "pipe/p_state.h"
@@ -140,14 +141,19 @@ xa_tracker_create(int drm_fd)
     struct xa_tracker *xa = calloc(1, sizeof(struct xa_tracker));
     enum xa_surface_type stype;
     unsigned int num_formats;
+    int loader_fd;
 
     if (!xa)
        return NULL;
 
 #if GALLIUM_STATIC_TARGETS
     xa->screen = dd_create_screen(drm_fd);
+    (void) loader_fd; /* silence unused var warning */
 #else
-    if (pipe_loader_drm_probe_fd(&xa->dev, drm_fd, false))
+    loader_fd = dup(drm_fd);
+    if (loader_fd == -1)
+        return NULL;
+    if (pipe_loader_drm_probe_fd(&xa->dev, loader_fd, false))
        xa->screen = pipe_loader_create_screen(xa->dev, PIPE_SEARCH_DIR);
 #endif
     if (!xa->screen)