From a1306f4ef6f83a86d03720641f3cdc5e13485fa6 Mon Sep 17 00:00:00 2001
From: Chia-I Wu
Date: Fri, 22 Jan 2010 15:51:51 +0800
Subject: [PATCH] winsys/drm: Add swrast.
The swrast winsys always returns NULL when drm_api_create is called.
---
configs/default | 4 ++--
configure.ac | 12 ++++++++++++
docs/egl.html | 10 ++++++++++
src/gallium/winsys/drm/swrast/Makefile | 12 ++++++++++++
src/gallium/winsys/drm/swrast/core/Makefile | 10 ++++++++++
src/gallium/winsys/drm/swrast/core/swrast_drm_api.c | 13 +++++++++++++
src/gallium/winsys/drm/swrast/egl_g3d/Makefile | 12 ++++++++++++
src/gallium/winsys/drm/swrast/egl_g3d/dummy.c | 1 +
8 files changed, 72 insertions(+), 2 deletions(-)
create mode 100644 src/gallium/winsys/drm/swrast/Makefile
create mode 100644 src/gallium/winsys/drm/swrast/core/Makefile
create mode 100644 src/gallium/winsys/drm/swrast/core/swrast_drm_api.c
create mode 100644 src/gallium/winsys/drm/swrast/egl_g3d/Makefile
create mode 100644 src/gallium/winsys/drm/swrast/egl_g3d/dummy.c
diff --git a/configs/default b/configs/default
index 6863495be3e..2665f5296a6 100644
--- a/configs/default
+++ b/configs/default
@@ -100,8 +100,8 @@ GALLIUM_DIRS = auxiliary drivers state_trackers
GALLIUM_AUXILIARIES = $(TOP)/src/gallium/auxiliary/libgallium.a
GALLIUM_DRIVERS_DIRS = softpipe failover svga i915 i965 r300 trace identity
GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
-GALLIUM_WINSYS_DIRS = xlib egl_xlib
-GALLIUM_WINSYS_DRM_DIRS =
+GALLIUM_WINSYS_DIRS = drm xlib egl_xlib
+GALLIUM_WINSYS_DRM_DIRS = swrast
GALLIUM_STATE_TRACKERS_DIRS = glx
# native displays EGL should support
diff --git a/configure.ac b/configure.ac
index bb011abff26..d6e32f590aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1311,6 +1311,18 @@ if test "x$enable_gallium_nouveau" = xyes; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nv04 nv10 nv20 nv30 nv40 nv50"
fi
+dnl
+dnl Gallium swrast configuration
+dnl
+AC_ARG_ENABLE([gallium-swrast],
+ [AS_HELP_STRING([--enable-gallium-swrast],
+ [build gallium swrast @<:@default=disabled@:>@])],
+ [enable_gallium_swrast="$enableval"],
+ [enable_gallium_swrast=auto])
+if test "x$enable_gallium_swrast" = xyes; then
+ GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS swrast"
+fi
+
dnl prepend CORE_DIRS to SRC_DIRS
SRC_DIRS="$CORE_DIRS $SRC_DIRS"
diff --git a/docs/egl.html b/docs/egl.html
index 5561d1a4b86..efc7b1ed3aa 100644
--- a/docs/egl.html
+++ b/docs/egl.html
@@ -81,6 +81,15 @@ that a number of EGL drivers depend on the egl_g3d
state tracker.
They will not be built without the egl_g3d
state
tracker.
+
+
+--enable-gallium-swrast
+
+This option is not specific to EGL. But if there is no driver for your
+hardware, or you are experiencing problems with the hardware driver, you can
+enable the swrast DRM driver. It is a dummy driver and EGL will fallback to
+software rendering automatically.
+
@@ -159,6 +168,7 @@ tracker to build. The available drivers are
egl_<dpy>_i965
egl_<dpy>_radeon
egl_<dpy>_nouveau
+egl_<dpy>_swrast
egl_<dpy>_vmwgfx
diff --git a/src/gallium/winsys/drm/swrast/Makefile b/src/gallium/winsys/drm/swrast/Makefile
new file mode 100644
index 00000000000..363b89584f2
--- /dev/null
+++ b/src/gallium/winsys/drm/swrast/Makefile
@@ -0,0 +1,12 @@
+# src/gallium/winsys/drm/swrast/Makefile
+TOP = ../../../../..
+include $(TOP)/configs/current
+
+SUBDIRS = core $(GALLIUM_STATE_TRACKERS_DIRS)
+
+default install clean:
+ @for dir in $(SUBDIRS) ; do \
+ if [ -d $$dir ] ; then \
+ (cd $$dir && $(MAKE) $@) || exit 1; \
+ fi \
+ done
diff --git a/src/gallium/winsys/drm/swrast/core/Makefile b/src/gallium/winsys/drm/swrast/core/Makefile
new file mode 100644
index 00000000000..93931ae22b9
--- /dev/null
+++ b/src/gallium/winsys/drm/swrast/core/Makefile
@@ -0,0 +1,10 @@
+# src/gallium/winsys/drm/swrast/core/Makefile
+
+TOP = ../../../../../..
+include $(TOP)/configs/current
+
+LIBNAME = swrastdrm
+
+C_SOURCES = swrast_drm_api.c
+
+include ../../../../Makefile.template
diff --git a/src/gallium/winsys/drm/swrast/core/swrast_drm_api.c b/src/gallium/winsys/drm/swrast/core/swrast_drm_api.c
new file mode 100644
index 00000000000..8c9f80e2c15
--- /dev/null
+++ b/src/gallium/winsys/drm/swrast/core/swrast_drm_api.c
@@ -0,0 +1,13 @@
+#include "state_tracker/drm_api.h"
+
+static struct drm_api swrast_drm_api =
+{
+ .name = "swrast",
+};
+
+struct drm_api *
+drm_api_create()
+{
+ (void) swrast_drm_api;
+ return NULL;
+}
diff --git a/src/gallium/winsys/drm/swrast/egl_g3d/Makefile b/src/gallium/winsys/drm/swrast/egl_g3d/Makefile
new file mode 100644
index 00000000000..f0d051ea0ea
--- /dev/null
+++ b/src/gallium/winsys/drm/swrast/egl_g3d/Makefile
@@ -0,0 +1,12 @@
+TOP = ../../../../../..
+include $(TOP)/configs/current
+
+EGL_DRIVER_NAME = swrast
+EGL_DRIVER_SOURCES = dummy.c
+EGL_DRIVER_LIBS =
+
+EGL_DRIVER_PIPES = \
+ $(TOP)/src/gallium/winsys/drm/swrast/core/libswrastdrm.a \
+ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a
+
+include ../../Makefile.egl_g3d
diff --git a/src/gallium/winsys/drm/swrast/egl_g3d/dummy.c b/src/gallium/winsys/drm/swrast/egl_g3d/dummy.c
new file mode 100644
index 00000000000..4a1bc28b0b6
--- /dev/null
+++ b/src/gallium/winsys/drm/swrast/egl_g3d/dummy.c
@@ -0,0 +1 @@
+/* mklib expects at least one object file */
--
2.30.2