[Mesa-dev] [PATCH 09/13] pipe-loader: introduce pipe_loader_sw_probe_dri helper

Emil Velikov emil.l.velikov at gmail.com
Mon Feb 10 20:26:29 PST 2014


Will be used in the following commits.

v2: Link gallium tests against the library.

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 src/gallium/auxiliary/pipe-loader/pipe_loader.h    | 13 +++++++++++++
 src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c | 19 +++++++++++++++++++
 src/gallium/tests/trivial/Makefile.am              |  1 +
 3 files changed, 33 insertions(+)

diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.h b/src/gallium/auxiliary/pipe-loader/pipe_loader.h
index 1073dc4..f5a7252 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader.h
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.h
@@ -45,6 +45,7 @@ extern "C" {
 #endif
 
 struct pipe_screen;
+struct drisw_loader_funcs;
 
 enum pipe_loader_device_type {
    PIPE_LOADER_DEVICE_SOFTWARE,
@@ -120,6 +121,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.
  *
  * This function is platform-specific.
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
index 8cf8980..954e16e 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
@@ -29,9 +29,11 @@
 
 #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;
@@ -66,6 +68,23 @@ 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);
+   *devs = &sdev->base;
+
+   return true;
+}
+
 int
 pipe_loader_sw_probe(struct pipe_loader_device **devs, int ndev)
 {
diff --git a/src/gallium/tests/trivial/Makefile.am b/src/gallium/tests/trivial/Makefile.am
index d65eb86..7a6b95d 100644
--- a/src/gallium/tests/trivial/Makefile.am
+++ b/src/gallium/tests/trivial/Makefile.am
@@ -13,6 +13,7 @@ AM_CPPFLAGS = \
 
 LDADD = $(GALLIUM_PIPE_LOADER_LIBS) \
 	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.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 \
 	$(LIBUDEV_LIBS) \
-- 
1.8.5.4



More information about the mesa-dev mailing list