pipe-loader: introduce pipe_loader_sw_probe_dri helper
authorEmil Velikov <emil.l.velikov@gmail.com>
Sat, 22 Feb 2014 03:21:40 +0000 (03:21 +0000)
committerEmil Velikov <emil.l.velikov@gmail.com>
Sat, 22 Feb 2014 03:26:29 +0000 (03:26 +0000)
Will be used in the following commits.

v2: Link gallium tests against the library.
v3: Handle dri_create_sw_winsys failure
v4: Rebase on top of the targets/xa changes

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com> (v2)
src/gallium/auxiliary/pipe-loader/pipe_loader.h
src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
src/gallium/tests/trivial/Makefile.am

index 315ab32fde02efdf44a2783660368d4aff48a862..9a461608d996ca0860e035215b6533b5c2caf81d 100644 (file)
@@ -44,6 +44,7 @@ extern "C" {
 #endif
 
 struct pipe_screen;
+struct drisw_loader_funcs;
 
 enum pipe_loader_device_type {
    PIPE_LOADER_DEVICE_SOFTWARE,
@@ -118,6 +119,18 @@ pipe_loader_sw_probe_xlib(struct pipe_loader_device **devs, Display *display);
 
 #endif
 
+/**
+ * Initialize sw dri device give the drisw_loader_funcs.
+ *
+ * This function is platform-specific.
+ *
+ * \sa pipe_loader_probe
+ */
+bool
+pipe_loader_sw_probe_dri(struct pipe_loader_device **devs,
+                         struct drisw_loader_funcs *drisw_lf);
+
+
 /**
  * Get a list of known software devices.
  *
index 7e2585e1c7bd5c773eaa3e3f9da44ce2375efd1b..abc87a2c744bb967713ace6d78338b720b9939b9 100644 (file)
 
 #include "util/u_memory.h"
 #include "util/u_dl.h"
+#include "sw/dri/dri_sw_winsys.h"
 #include "sw/null/null_sw_winsys.h"
 #include "sw/xlib/xlib_sw_winsys.h"
 #include "target-helpers/inline_sw_helper.h"
+#include "state_tracker/drisw_api.h"
 
 struct pipe_loader_sw_device {
    struct pipe_loader_device base;
@@ -70,6 +72,27 @@ pipe_loader_sw_probe_xlib(struct pipe_loader_device **devs, Display *display)
 }
 #endif
 
+bool
+pipe_loader_sw_probe_dri(struct pipe_loader_device **devs, struct drisw_loader_funcs *drisw_lf)
+{
+   struct pipe_loader_sw_device *sdev = CALLOC_STRUCT(pipe_loader_sw_device);
+
+   if (!sdev)
+      return false;
+
+   sdev->base.type = PIPE_LOADER_DEVICE_SOFTWARE;
+   sdev->base.driver_name = "swrast";
+   sdev->base.ops = &pipe_loader_sw_ops;
+   sdev->ws = dri_create_sw_winsys(drisw_lf);
+   if (!sdev->ws) {
+      FREE(sdev);
+      return false;
+   }
+   *devs = &sdev->base;
+
+   return true;
+}
+
 int
 pipe_loader_sw_probe(struct pipe_loader_device **devs, int ndev)
 {
index debb2e24e91734fc28473eb39f5b5b727429134d..656ee64e0f56529272867e7d5764ca7ce663cf96 100644 (file)
@@ -13,6 +13,7 @@ AM_CPPFLAGS = \
 
 LDADD = $(GALLIUM_PIPE_LOADER_CLIENT_LIBS) \
        $(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_client.la \
+       $(top_builddir)/src/gallium/winsys/sw/dri/libswdri.la \
        $(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \
        $(top_builddir)/src/gallium/auxiliary/libgallium.la \
        $(DLOPEN_LIBS) \