summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/python/st_softpipe_winsys.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers/python/st_softpipe_winsys.c')
-rw-r--r--src/gallium/state_trackers/python/st_softpipe_winsys.c55
1 files changed, 42 insertions, 13 deletions
diff --git a/src/gallium/state_trackers/python/st_softpipe_winsys.c b/src/gallium/state_trackers/python/st_softpipe_winsys.c
index 81676bc3a4..985374190c 100644
--- a/src/gallium/state_trackers/python/st_softpipe_winsys.c
+++ b/src/gallium/state_trackers/python/st_softpipe_winsys.c
@@ -26,18 +26,47 @@
*
**************************************************************************/
-/**
- * @file
- * Softpipe support.
- *
- * @author Keith Whitwell
- * @author Brian Paul
- * @author Jose Fonseca
- */
-
-#include "softpipe/sp_winsys.h"
+#include "util/u_debug.h"
+#include "softpipe/sp_public.h"
+#include "llvmpipe/lp_public.h"
+#include "state_tracker/sw_winsys.h"
+#include "null/null_sw_winsys.h"
#include "st_winsys.h"
-const struct st_winsys st_softpipe_winsys = {
- &softpipe_create_screen_malloc
-};
+
+struct pipe_screen *
+st_software_screen_create(void)
+{
+ struct sw_winsys *ws;
+ const char *default_driver;
+ const char *driver;
+ struct pipe_screen *screen = NULL;
+
+#if defined(HAVE_LLVMPIPE)
+ default_driver = "llvmpipe";
+#elif defined(HAVE_SOFTPIPE)
+ default_driver = "softpipe";
+#else
+ default_driver = "";
+#endif
+
+ ws = null_sw_create();
+ if(!ws)
+ return NULL;
+
+ driver = debug_get_option("GALLIUM_DRIVER", default_driver);
+
+#ifdef HAVE_LLVMPIPE
+ if (strcmp(driver, "llvmpipe") == 0) {
+ screen = llvmpipe_create_screen(ws);
+ }
+#endif
+
+#ifdef HAVE_SOFTPIPE
+ if (strcmp(driver, "softpipe") == 0) {
+ screen = softpipe_create_screen(ws);
+ }
+#endif
+
+ return screen;
+}