targets/libgl-xlib: add code to inject trace and identity layers
[mesa.git] / src / gallium / targets / libgl-xlib / xlib.c
index 6651bd538eeaff77406dfa21a0d2baf676dc7ab1..7881bc2cb18821cd59d6e49e2a32178317edd675 100644 (file)
 #include "util/u_debug.h"
 #include "softpipe/sp_public.h"
 #include "llvmpipe/lp_public.h"
+#include "identity/id_public.h"
+#include "trace/tr_public.h"
 #include "cell/ppu/cell_public.h"
 
+
 /* advertise OpenGL support */
 PUBLIC const int st_api_OpenGL = 1;
 
@@ -46,7 +49,7 @@ static struct pipe_screen *
 create_screen( struct sw_winsys *winsys )
 {
 #if defined(GALLIUM_CELL)
-   if (!getenv("GALLIUM_NOCELL")) 
+   if (!debug_get_bool_option("GALLIUM_NOCELL", FALSE)) 
       return cell_create_screen( winsys );
 #endif
 
@@ -73,6 +76,17 @@ xlib_create_screen( Display *display )
    if (screen == NULL)
       goto fail;
 
+   /* Finally we have somewhere to inject layers into the stack in a
+    * clean fashion:
+    */
+   if (debug_get_bool_option("GALLIUM_WRAP", FALSE)) {
+      screen = identity_screen_create(screen);
+   }
+
+   if (debug_get_bool_option("GALLIUM_TRACE", FALSE)) {
+      screen = trace_screen_create( screen );
+   }
+
    return screen;
 
 fail: