Mesa (7.10): r300g/swtcl: re-enable LLVM

Marek Olšák mareko at kemper.freedesktop.org
Tue Dec 28 18:48:32 UTC 2010


Module: Mesa
Branch: 7.10
Commit: 1e58915062afa642b8f2d55c5ad590b65ffffecc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1e58915062afa642b8f2d55c5ad590b65ffffecc

Author: Marek Olšák <maraeo at gmail.com>
Date:   Tue Dec 28 19:41:00 2010 +0100

r300g/swtcl: re-enable LLVM

Based on a patch from Drill <drill87 at gmail.com>.

NOTE: This is a candidate for the 7.10 branch.
(cherry picked from commit 88550083b3857184445075e70fed8b2eed4952a1)

Conflicts:

	src/gallium/drivers/r300/r300_context.c

---

 src/gallium/drivers/r300/r300_context.c |   16 ++++++++++++++--
 src/gallium/drivers/r300/r300_context.h |    1 +
 src/gallium/drivers/r300/r300_screen.c  |    8 ++++++++
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 67b011a..848020c 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -35,7 +35,9 @@
 #include "r300_screen_buffer.h"
 #include "r300_winsys.h"
 
-#include <inttypes.h>
+#ifdef HAVE_LLVM
+#include "gallivm/lp_bld_init.h"
+#endif
 
 static void r300_update_num_contexts(struct r300_screen *r300screen,
                                      int diff)
@@ -103,9 +105,14 @@ static void r300_destroy_context(struct pipe_context* context)
 
     if (r300->blitter)
         util_blitter_destroy(r300->blitter);
-    if (r300->draw)
+    if (r300->draw) {
         draw_destroy(r300->draw);
 
+#ifdef HAVE_LLVM
+        gallivm_destroy(r300->gallivm);
+#endif
+    }
+
     if (r300->upload_vb)
         u_upload_destroy(r300->upload_vb);
     if (r300->upload_ib)
@@ -424,7 +431,12 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
 
     if (!r300screen->caps.has_tcl) {
         /* Create a Draw. This is used for SW TCL. */
+#ifdef HAVE_LLVM
+        r300->gallivm = gallivm_create();
+        r300->draw = draw_create_gallivm(&r300->context, r300->gallivm);
+#else
         r300->draw = draw_create(&r300->context);
+#endif
         if (r300->draw == NULL)
             goto fail;
         /* Enable our renderer. */
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 39dcde0..c719c02 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -459,6 +459,7 @@ struct r300_context {
     struct r300_screen *screen;
 
     /* Draw module. Used mostly for SW TCL. */
+    struct gallivm_state *gallivm;
     struct draw_context* draw;
     /* Vertex buffer for SW TCL. */
     struct pipe_resource* vbo;
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index 921d6f1..a076e4b 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -34,6 +34,10 @@
 
 #include "draw/draw_context.h"
 
+#ifdef HAVE_LLVM
+#include "gallivm/lp_bld_init.h"
+#endif
+
 /* Return the identifier behind whom the brave coders responsible for this
  * amalgamation of code, sweat, and duct tape, routinely obscure their names.
  *
@@ -484,5 +488,9 @@ struct pipe_screen* r300_screen_create(struct r300_winsys_screen *rws)
 
     util_format_s3tc_init();
 
+#ifdef HAVE_LLVM
+    lp_build_init();
+#endif
+
     return &r300screen->screen;
 }




More information about the mesa-commit mailing list