* Thomas Hellstrom <thellstrom-at-vmware-dot-com>
*/
+#include <unistd.h>
#include "xa_tracker.h"
#include "xa_priv.h"
#include "pipe/p_state.h"
#include "pipe/p_format.h"
+#include "pipe-loader/pipe_loader.h"
#include "state_tracker/drm_driver.h"
#include "util/u_inlines.h"
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;
- xa->screen = driver_descriptor.create_screen(drm_fd);
+#if GALLIUM_STATIC_TARGETS
+ xa->screen = dd_create_screen(drm_fd);
+ (void) loader_fd; /* silence unused var warning */
+#else
+ 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)
goto out_no_screen;
out_no_pipe:
xa->screen->destroy(xa->screen);
out_no_screen:
+#if !GALLIUM_STATIC_TARGETS
+ if (xa->dev)
+ pipe_loader_release(&xa->dev, 1);
+#endif
free(xa);
return NULL;
}
free(xa->supported_formats);
xa_context_destroy(xa->default_ctx);
xa->screen->destroy(xa->screen);
+#if !GALLIUM_STATIC_TARGETS
+ pipe_loader_release(&xa->dev, 1);
+#endif
free(xa);
}
{
struct winsys_handle whandle;
memset(&whandle, 0, sizeof(whandle));
+ whandle.type = DRM_API_HANDLE_TYPE_SHARED;
whandle.handle = handle;
whandle.stride = stride;
return surface_create(xa, width, height, depth, stype, xa_format, flags, &whandle);