gallium/tests/trivial: Switch to the pipe loader.
authorFrancisco Jerez <currojerez@riseup.net>
Wed, 25 Apr 2012 20:16:26 +0000 (22:16 +0200)
committerFrancisco Jerez <currojerez@riseup.net>
Fri, 11 May 2012 10:39:44 +0000 (12:39 +0200)
It simplifies things slightly, and besides, it makes possible to
execute the trivial tests on a hardware device instead of being
limited to software rendering.

Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
configure.ac
src/gallium/tests/trivial/Makefile
src/gallium/tests/trivial/quad-tex.c
src/gallium/tests/trivial/tri.c

index 4b26e72..3c742cd 100644 (file)
@@ -643,6 +643,12 @@ AC_ARG_ENABLE([r600-llvm-compiler],
     [enable_r600_llvm="$enableval"],
     [enable_r600_llvm=no])
 
+AC_ARG_ENABLE([gallium_tests],
+    [AS_HELP_STRING([--enable-gallium-tests],
+        [Enable optional Gallium tests) @<:@default=disable@:>@])],
+    [enable_gallium_tests="$enableval"],
+    [enable_gallium_tests=no])
+
 # Option for Gallium drivers
 GALLIUM_DRIVERS_DEFAULT="r300,r600,svga,swrast"
 
@@ -1967,6 +1973,11 @@ if test "x$with_gallium_drivers" != x; then
     done
 fi
 
+if test "x$enable_gallium_tests" = xyes; then
+    SRC_DIRS="$SRC_DIRS gallium/tests/trivial"
+    enable_gallium_loader=yes
+fi
+
 if test "x$enable_gallium_loader" = xyes; then
     GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/null"
     GALLIUM_PIPE_LOADER_DEFINES="-DHAVE_PIPE_LOADER_SW"
index 4ddbb0b..bfe186b 100644 (file)
@@ -11,19 +11,10 @@ INCLUDES = \
        -I$(TOP)/src/gallium/winsys \
        $(PROG_INCLUDES)
 
-ifeq ($(MESA_LLVM),1)
-LINKS = $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
-LDFLAGS += $(LLVM_LDFLAGS)
-endif
-
 LINKS += \
-       $(TOP)/src/gallium/drivers/rbug/librbug.a \
-       $(TOP)/src/gallium/drivers/trace/libtrace.a \
-       $(TOP)/src/gallium/drivers/galahad/libgalahad.a \
-       $(TOP)/src/gallium/winsys/sw/null/libws_null.a \
-       $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
+       $(GALLIUM_PIPE_LOADER_LIBS) \
        $(GALLIUM_AUXILIARIES) \
-       $(PROG_LINKS)
+       $(PROG_LINKS) $(LIBUDEV_LIBS)
 
 SOURCES = \
        tri.c \
@@ -33,17 +24,25 @@ OBJECTS = $(SOURCES:.c=.o)
 
 PROGS = $(OBJECTS:.o=)
 
-PROG_DEFINES = \
-       -DGALLIUM_SOFTPIPE -DGALLIUM_RBUG -DGALLIUM_TRACE -DGALLIUM_GALAHAD
+PROG_DEFINES = -DPIPE_SEARCH_DIR=\"$(PIPE_SRC_DIR)\" \
+               $(GALLIUM_PIPE_LOADER_DEFINES)
+
+PIPE_SRC_DIR = $(TOP)/src/gallium/targets/pipe-loader
 
 ##### TARGETS #####
 
-default: $(PROGS)
+default: $(PROGS) pipes
+
+install:
 
 clean:
        -rm -f $(PROGS)
        -rm -f *.o
        -rm -f result.bmp
+       @$(MAKE) -C $(PIPE_SRC_DIR) clean
+
+pipes:
+       @$(MAKE) -C $(PIPE_SRC_DIR)
 
 ##### RULES #####
 
index cc19e8d..7caac29 100644 (file)
 #include "util/u_memory.h"
 /* util_make_[fragment|vertex]_passthrough_shader */
 #include "util/u_simple_shaders.h"
-
-/* sw_screen_create: to get a software pipe driver */
-#include "target-helpers/inline_sw_helper.h"
-/* debug_screen_wrap: to wrap with debug pipe drivers */
-#include "target-helpers/inline_debug_helper.h"
-/* null software winsys */
-#include "sw/null/null_sw_winsys.h"
+/* to get a hardware pipe driver */
+#include "pipe-loader/pipe_loader.h"
 
 struct program
 {
+       struct pipe_loader_device *dev;
        struct pipe_screen *screen;
        struct pipe_context *pipe;
        struct cso_context *cso;
@@ -93,10 +89,15 @@ struct program
 static void init_prog(struct program *p)
 {
        struct pipe_surface surf_tmpl;
-       /* create the software rasterizer */
-       p->screen = sw_screen_create(null_sw_create());
-       /* wrap the screen with any debugger */
-       p->screen = debug_screen_wrap(p->screen);
+       int ret;
+
+       /* find a hardware device */
+       ret = pipe_loader_probe(&p->dev, 1);
+       assert(ret);
+
+       /* init a pipe screen */
+       p->screen = pipe_loader_create_screen(p->dev, PIPE_SEARCH_DIR);
+       assert(p->screen);
 
        /* create the pipe driver context and cso context */
        p->pipe = p->screen->context_create(p->screen, NULL);
@@ -298,6 +299,7 @@ static void close_prog(struct program *p)
        cso_destroy_context(p->cso);
        p->pipe->destroy(p->pipe);
        p->screen->destroy(p->screen);
+       pipe_loader_release(&p->dev, 1);
 
        FREE(p);
 }
index 9190f78..f3e1e94 100644 (file)
 #include "util/u_memory.h"
 /* util_make_[fragment|vertex]_passthrough_shader */
 #include "util/u_simple_shaders.h"
-
-/* sw_screen_create: to get a software pipe driver */
-#include "target-helpers/inline_sw_helper.h"
-/* debug_screen_wrap: to wrap with debug pipe drivers */
-#include "target-helpers/inline_debug_helper.h"
-/* null software winsys */
-#include "sw/null/null_sw_winsys.h"
+/* to get a hardware pipe driver */
+#include "pipe-loader/pipe_loader.h"
 
 struct program
 {
+       struct pipe_loader_device *dev;
        struct pipe_screen *screen;
        struct pipe_context *pipe;
        struct cso_context *cso;
@@ -88,10 +84,15 @@ struct program
 static void init_prog(struct program *p)
 {
        struct pipe_surface surf_tmpl;
-       /* create the software rasterizer */
-       p->screen = sw_screen_create(null_sw_create());
-       /* wrap the screen with any debugger */
-       p->screen = debug_screen_wrap(p->screen);
+       int ret;
+
+       /* find a hardware device */
+       ret = pipe_loader_probe(&p->dev, 1);
+       assert(ret);
+
+       /* init a pipe screen */
+       p->screen = pipe_loader_create_screen(p->dev, PIPE_SEARCH_DIR);
+       assert(p->screen);
 
        /* create the pipe driver context and cso context */
        p->pipe = p->screen->context_create(p->screen, NULL);
@@ -234,6 +235,7 @@ static void close_prog(struct program *p)
        cso_destroy_context(p->cso);
        p->pipe->destroy(p->pipe);
        p->screen->destroy(p->screen);
+       pipe_loader_release(&p->dev, 1);
 
        FREE(p);
 }