pipe-loader: add pipe_loader_sw_probe_kms() implementation
authorEmil Velikov <emil.l.velikov@gmail.com>
Wed, 14 Oct 2015 15:24:55 +0000 (16:24 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Sat, 21 Nov 2015 12:52:18 +0000 (12:52 +0000)
Will be used as a counterpart for target-helpers'
kms_swrast_create_screen().

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Rob Clark <robclark@freedesktop.org>
configure.ac
src/gallium/Automake.inc
src/gallium/auxiliary/pipe-loader/pipe_loader.h
src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c

index 98acfdda0a23044b1027355105115c6fdc53ed70..322f7b643bd8c385350e45aac105b6dc4a041700 100644 (file)
@@ -2283,6 +2283,10 @@ if test "x$enable_gallium_loader" = xyes; then
         GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_DRI"
     fi
 
+    if test "x$have_drisw_kms" = xyes; then
+        GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_KMS"
+    fi
+
     if test "x$enable_gallium_drm_loader" = xyes; then
         GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_DRM"
     fi
index ee07ab6c8f98d87caca3d84ee0719105f04ea30f..095e6ec55fb3888907e38896f93e23f3356202c4 100644 (file)
@@ -67,3 +67,8 @@ if HAVE_DRISW
 GALLIUM_PIPE_LOADER_WINSYS_LIBS += \
        $(top_builddir)/src/gallium/winsys/sw/dri/libswdri.la
 endif
+
+if HAVE_DRISW_KMS
+GALLIUM_PIPE_LOADER_WINSYS_LIBS += \
+       $(top_builddir)/src/gallium/winsys/sw/kms-dri/libswkmsdri.la
+endif
index 7aa9c67d504e237601a3284848e042f64edd2d40..8eba8a6f008cacaa06507843147e7b5050725205 100644 (file)
@@ -123,6 +123,16 @@ bool
 pipe_loader_sw_probe_dri(struct pipe_loader_device **devs,
                          struct drisw_loader_funcs *drisw_lf);
 
+/**
+ * Initialize a kms backed sw device given an fd.
+ *
+ * This function is platform-specific.
+ *
+ * \sa pipe_loader_probe
+ */
+bool
+pipe_loader_sw_probe_kms(struct pipe_loader_device **devs, int fd);
+
 /**
  * Initialize a null sw device.
  *
index 6794930193dc121111cc9afdc919925c79f57654..86039a35ef7e9d85353099ecadda62cb8e007686 100644 (file)
@@ -30,6 +30,7 @@
 #include "util/u_memory.h"
 #include "util/u_dl.h"
 #include "sw/dri/dri_sw_winsys.h"
+#include "sw/kms-dri/kms_dri_sw_winsys.h"
 #include "sw/null/null_sw_winsys.h"
 #include "sw/wrapper/wrapper_sw_winsys.h"
 #include "target-helpers/inline_sw_helper.h"
@@ -72,6 +73,29 @@ pipe_loader_sw_probe_dri(struct pipe_loader_device **devs, struct drisw_loader_f
 }
 #endif
 
+#ifdef HAVE_PIPE_LOADER_KMS
+bool
+pipe_loader_sw_probe_kms(struct pipe_loader_device **devs, int fd)
+{
+   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 = kms_dri_create_winsys(fd);
+   if (!sdev->ws) {
+      FREE(sdev);
+      return false;
+   }
+   *devs = &sdev->base;
+
+   return true;
+}
+#endif
+
 bool
 pipe_loader_sw_probe_null(struct pipe_loader_device **devs)
 {