summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2011-11-25 14:26:00 +0100
committerFrancisco Jerez <[email protected]>2012-05-11 12:39:43 +0200
commit317be33d73228fe8b340de8e029ff24b6e0d95b5 (patch)
treee04d2f6823c13cf51ea7cbd7ae55f2f396391ce2 /src
parente1364530622a26f11c79694429cf84418a0b7ef7 (diff)
gallium: Add "pipe-loader" target.
This target generates pipe driver modules intended to be consumed by auxiliary/pipe-loader. Most of it was taken from the "gbm" target -- the duplicated code will be replaced with references to this target in a future commit. Reviewed-by: Jakob Bornecrantz <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/targets/pipe-loader/Makefile165
-rw-r--r--src/gallium/targets/pipe-loader/pipe_i915.c27
-rw-r--r--src/gallium/targets/pipe-loader/pipe_nouveau.c21
-rw-r--r--src/gallium/targets/pipe-loader/pipe_r300.c27
-rw-r--r--src/gallium/targets/pipe-loader/pipe_r600.c26
-rw-r--r--src/gallium/targets/pipe-loader/pipe_swrast.c22
-rw-r--r--src/gallium/targets/pipe-loader/pipe_vmwgfx.c27
7 files changed, 315 insertions, 0 deletions
diff --git a/src/gallium/targets/pipe-loader/Makefile b/src/gallium/targets/pipe-loader/Makefile
new file mode 100644
index 00000000000..963932d393f
--- /dev/null
+++ b/src/gallium/targets/pipe-loader/Makefile
@@ -0,0 +1,165 @@
+# Makefile for building pipe driver shared libraries.
+#
+# Input variables: PIPE_INSTALL_DIR, PIPE_PREFIX (optional)
+#
+TOP = ../../../..
+include $(TOP)/configs/current
+
+PIPE_PREFIX ?= pipe_
+
+PIPE_CPPFLAGS = \
+ -DGALLIUM_RBUG \
+ -DGALLIUM_TRACE \
+ -DGALLIUM_GALAHAD \
+ -I$(TOP)/include \
+ -I$(TOP)/src/gallium/auxiliary \
+ -I$(TOP)/src/gallium/drivers \
+ -I$(TOP)/src/gallium/include \
+ -I$(TOP)/src/gallium/winsys
+
+PIPE_LIBS = \
+ $(TOP)/src/gallium/drivers/identity/libidentity.a \
+ $(TOP)/src/gallium/drivers/galahad/libgalahad.a \
+ $(TOP)/src/gallium/drivers/trace/libtrace.a \
+ $(TOP)/src/gallium/drivers/rbug/librbug.a \
+ $(GALLIUM_AUXILIARIES)
+
+PIPE_SYS = $(LIBDRM_LIB) -lm -lpthread $(DLOPEN_LIBS)
+
+PIPE_CFLAGS = $(LIBDRM_CFLAGS)
+
+PIPE_LDFLAGS = -Wl,--no-undefined
+
+# i915 pipe driver
+i915_LIBS = \
+ $(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \
+ $(TOP)/src/gallium/drivers/i915/libi915.a
+i915_SYS = -ldrm_intel
+
+# nouveau pipe driver
+nouveau_LIBS = \
+ $(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \
+ $(TOP)/src/gallium/drivers/nv30/libnv30.a \
+ $(TOP)/src/gallium/drivers/nv50/libnv50.a \
+ $(TOP)/src/gallium/drivers/nvc0/libnvc0.a \
+ $(TOP)/src/gallium/drivers/nouveau/libnouveau.a
+nouveau_SYS = -ldrm_nouveau
+
+# r300 pipe driver
+r300_LIBS = \
+ $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
+ $(TOP)/src/gallium/drivers/r300/libr300.a
+r300_SYS += -ldrm_radeon
+
+# r600 pipe driver
+r600_LIBS = \
+ $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
+ $(TOP)/src/gallium/drivers/r600/libr600.a
+r600_SYS += -ldrm_radeon
+
+# vmwgfx pipe driver
+vmwgfx_LIBS = \
+ $(TOP)/src/gallium/winsys/svga/drm/libsvgadrm.a \
+ $(TOP)/src/gallium/drivers/svga/libsvga.a
+
+ifneq ($(findstring llvmpipe,$(GALLIUM_DRIVERS_DIRS)),)
+ swrast_LIBS = $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
+ PIPE_CFLAGS += -DGALLIUM_LLVMPIPE
+else ifneq ($(findstring softpipe,$(GALLIUM_DRIVERS_DIRS)),)
+ swrast_LIBS = $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a
+ PIPE_CFLAGS += -DGALLIUM_SOFTPIPE
+endif
+
+# LLVM
+ifeq ($(MESA_LLVM),1)
+ PIPE_SYS += $(LLVM_LIBS)
+ PIPE_LDFLAGS += $(LLVM_LDFLAGS)
+endif
+
+# determine the targets/sources
+_PIPE_TARGETS_CC =
+_PIPE_TARGETS_CXX =
+PIPE_SOURCES =
+
+ifneq ($(findstring i915/drm,$(GALLIUM_WINSYS_DIRS)),)
+ _PIPE_TARGETS_CC += $(PIPE_PREFIX)i915.so
+ PIPE_SOURCES += pipe_i915.c
+endif
+
+ifneq ($(findstring nouveau/drm,$(GALLIUM_WINSYS_DIRS)),)
+ _PIPE_TARGETS_CXX += $(PIPE_PREFIX)nouveau.so
+ PIPE_SOURCES += pipe_nouveau.c
+endif
+
+ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
+ifneq ($(findstring r300,$(GALLIUM_DRIVERS_DIRS)),)
+ _PIPE_TARGETS_CC += $(PIPE_PREFIX)r300.so
+ PIPE_SOURCES += pipe_r300.c
+endif
+endif
+
+ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
+ifneq ($(findstring r600,$(GALLIUM_DRIVERS_DIRS)),)
+ _PIPE_TARGETS_CC += $(PIPE_PREFIX)r600.so
+ PIPE_SOURCES += pipe_r600.c
+endif
+endif
+
+ifneq ($(findstring svga/drm,$(GALLIUM_WINSYS_DIRS)),)
+ _PIPE_TARGETS_CC += $(PIPE_PREFIX)vmwgfx.so
+ PIPE_SOURCES += pipe_vmwgfx.c
+endif
+
+ifneq ($(filter llvmpipe softpipe,$(GALLIUM_DRIVERS_DIRS)),)
+ _PIPE_TARGETS_CC += $(PIPE_PREFIX)swrast.so
+ PIPE_SOURCES += pipe_swrast.c
+endif
+
+PIPE_OBJECTS := $(PIPE_SOURCES:.c=.o)
+
+ifeq ($(MESA_LLVM),1)
+ PIPE_TARGETS_CXX = $(_PIPE_TARGETS_CXX) $(_PIPE_TARGETS_CC)
+ PIPE_TARGETS_CC =
+else
+ PIPE_TARGETS_CXX = $(_PIPE_TARGETS_CXX)
+ PIPE_TARGETS_CC = $(_PIPE_TARGETS_CC)
+endif
+
+PIPE_TARGETS = $(PIPE_TARGETS_CC) $(PIPE_TARGETS_CXX)
+
+default: depend $(PIPE_TARGETS)
+
+.SECONDEXPANSION:
+
+$(PIPE_TARGETS_CC): $(PIPE_PREFIX)%.so: pipe_%.o $(PIPE_LIBS) $$(%_LIBS)
+ $(MKLIB) -o $@ -noprefix -linker '$(CC)' \
+ -ldflags '-L$(TOP)/$(LIB_DIR) $(PIPE_LDFLAGS) $(LDFLAGS)' \
+ $(MKLIB_OPTIONS) $< \
+ -Wl,--start-group $(PIPE_LIBS) $($*_LIBS) -Wl,--end-group \
+ $(PIPE_SYS) $($*_SYS)
+
+$(PIPE_TARGETS_CXX): $(PIPE_PREFIX)%.so: pipe_%.o $(PIPE_LIBS) $$(%_LIBS)
+ $(MKLIB) -o $@ -noprefix -linker '$(CXX)' \
+ -ldflags '-L$(TOP)/$(LIB_DIR) $(PIPE_LDFLAGS) $(LDFLAGS)' \
+ $(MKLIB_OPTIONS) $< \
+ -Wl,--start-group $(PIPE_LIBS) $($*_LIBS) -Wl,--end-group \
+ $(PIPE_SYS) $($*_SYS)
+
+$(PIPE_OBJECTS): %.o: %.c
+ $(CC) -c -o $@ $< $(PIPE_CPPFLAGS) $(PIPE_CFLAGS) $(CFLAGS)
+
+install: $(PIPE_TARGETS)
+ $(INSTALL) -d $(PIPE_INSTALL_DIR)
+ for tgt in $(PIPE_TARGETS); do \
+ $(MINSTALL) "$$tgt" $(PIPE_INSTALL_DIR); \
+ done
+
+clean:
+ rm -f $(PIPE_TARGETS) $(PIPE_OBJECTS) depend depend.bak
+
+depend: $(PIPE_SOURCES)
+ rm -f depend
+ touch depend
+ $(MKDEP) $(MKDEP_OPTIONS) $(PIPE_CPPFLAGS) $(PIPE_SOURCES) 2>/dev/null
+
+sinclude depend
diff --git a/src/gallium/targets/pipe-loader/pipe_i915.c b/src/gallium/targets/pipe-loader/pipe_i915.c
new file mode 100644
index 00000000000..85662cb85b5
--- /dev/null
+++ b/src/gallium/targets/pipe-loader/pipe_i915.c
@@ -0,0 +1,27 @@
+
+#include "target-helpers/inline_debug_helper.h"
+#include "state_tracker/drm_driver.h"
+#include "i915/drm/i915_drm_public.h"
+#include "i915/i915_public.h"
+
+static struct pipe_screen *
+create_screen(int fd)
+{
+ struct i915_winsys *iws;
+ struct pipe_screen *screen;
+
+ iws = i915_drm_winsys_create(fd);
+ if (!iws)
+ return NULL;
+
+ screen = i915_screen_create(iws);
+ if (!screen)
+ return NULL;
+
+ screen = debug_screen_wrap(screen);
+
+ return screen;
+}
+
+PUBLIC
+DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen, NULL)
diff --git a/src/gallium/targets/pipe-loader/pipe_nouveau.c b/src/gallium/targets/pipe-loader/pipe_nouveau.c
new file mode 100644
index 00000000000..65425e8d456
--- /dev/null
+++ b/src/gallium/targets/pipe-loader/pipe_nouveau.c
@@ -0,0 +1,21 @@
+
+#include "target-helpers/inline_debug_helper.h"
+#include "state_tracker/drm_driver.h"
+#include "nouveau/drm/nouveau_drm_public.h"
+
+static struct pipe_screen *
+create_screen(int fd)
+{
+ struct pipe_screen *screen;
+
+ screen = nouveau_drm_screen_create(fd);
+ if (!screen)
+ return NULL;
+
+ screen = debug_screen_wrap(screen);
+
+ return screen;
+}
+
+PUBLIC
+DRM_DRIVER_DESCRIPTOR("nouveau", "nouveau", create_screen, NULL)
diff --git a/src/gallium/targets/pipe-loader/pipe_r300.c b/src/gallium/targets/pipe-loader/pipe_r300.c
new file mode 100644
index 00000000000..055685996e6
--- /dev/null
+++ b/src/gallium/targets/pipe-loader/pipe_r300.c
@@ -0,0 +1,27 @@
+
+#include "target-helpers/inline_debug_helper.h"
+#include "state_tracker/drm_driver.h"
+#include "radeon/drm/radeon_drm_public.h"
+#include "r300/r300_public.h"
+
+static struct pipe_screen *
+create_screen(int fd)
+{
+ struct radeon_winsys *sws;
+ struct pipe_screen *screen;
+
+ sws = radeon_drm_winsys_create(fd);
+ if (!sws)
+ return NULL;
+
+ screen = r300_screen_create(sws);
+ if (!screen)
+ return NULL;
+
+ screen = debug_screen_wrap(screen);
+
+ return screen;
+}
+
+PUBLIC
+DRM_DRIVER_DESCRIPTOR("r300", "radeon", create_screen, NULL)
diff --git a/src/gallium/targets/pipe-loader/pipe_r600.c b/src/gallium/targets/pipe-loader/pipe_r600.c
new file mode 100644
index 00000000000..5d89aca6ec3
--- /dev/null
+++ b/src/gallium/targets/pipe-loader/pipe_r600.c
@@ -0,0 +1,26 @@
+#include "state_tracker/drm_driver.h"
+#include "target-helpers/inline_debug_helper.h"
+#include "radeon/drm/radeon_drm_public.h"
+#include "r600/r600_public.h"
+
+static struct pipe_screen *
+create_screen(int fd)
+{
+ struct radeon_winsys *rw;
+ struct pipe_screen *screen;
+
+ rw = radeon_drm_winsys_create(fd);
+ if (!rw)
+ return NULL;
+
+ screen = r600_screen_create(rw);
+ if (!screen)
+ return NULL;
+
+ screen = debug_screen_wrap(screen);
+
+ return screen;
+}
+
+PUBLIC
+DRM_DRIVER_DESCRIPTOR("r600", "radeon", create_screen, NULL)
diff --git a/src/gallium/targets/pipe-loader/pipe_swrast.c b/src/gallium/targets/pipe-loader/pipe_swrast.c
new file mode 100644
index 00000000000..092abf07a52
--- /dev/null
+++ b/src/gallium/targets/pipe-loader/pipe_swrast.c
@@ -0,0 +1,22 @@
+
+#include "target-helpers/inline_sw_helper.h"
+#include "target-helpers/inline_debug_helper.h"
+#include "state_tracker/drm_driver.h"
+
+PUBLIC struct pipe_screen *
+swrast_create_screen(struct sw_winsys *ws);
+
+PUBLIC
+DRM_DRIVER_DESCRIPTOR("swrast", NULL, NULL, NULL)
+
+struct pipe_screen *
+swrast_create_screen(struct sw_winsys *ws)
+{
+ struct pipe_screen *screen;
+
+ screen = sw_screen_create(ws);
+ if (screen)
+ screen = debug_screen_wrap(screen);
+
+ return screen;
+}
diff --git a/src/gallium/targets/pipe-loader/pipe_vmwgfx.c b/src/gallium/targets/pipe-loader/pipe_vmwgfx.c
new file mode 100644
index 00000000000..bfe665be6eb
--- /dev/null
+++ b/src/gallium/targets/pipe-loader/pipe_vmwgfx.c
@@ -0,0 +1,27 @@
+
+#include "target-helpers/inline_debug_helper.h"
+#include "state_tracker/drm_driver.h"
+#include "svga/drm/svga_drm_public.h"
+#include "svga/svga_public.h"
+
+static struct pipe_screen *
+create_screen(int fd)
+{
+ struct svga_winsys_screen *sws;
+ struct pipe_screen *screen;
+
+ sws = svga_drm_winsys_screen_create(fd);
+ if (!sws)
+ return NULL;
+
+ screen = svga_screen_create(sws);
+ if (!screen)
+ return NULL;
+
+ screen = debug_screen_wrap(screen);
+
+ return screen;
+}
+
+PUBLIC
+DRM_DRIVER_DESCRIPTOR("vmwgfx", "vmwgfx", create_screen, NULL)