gallium-intel: Cache software switch
authorJakob Bornecrantz <wallbraker@gmail.com>
Sat, 25 Apr 2009 11:55:21 +0000 (12:55 +0100)
committerJakob Bornecrantz <wallbraker@gmail.com>
Sat, 25 Apr 2009 11:56:52 +0000 (12:56 +0100)
src/gallium/winsys/drm/intel/gem/intel_be_context.c
src/gallium/winsys/drm/intel/gem/intel_be_device.c
src/gallium/winsys/drm/intel/gem/intel_be_device.h

index cfe8c884660d1dbf4d63c9a02050652214c2cd24..fe0b138fbea84e38376052643321a77dc4fd2ed0 100644 (file)
@@ -108,7 +108,7 @@ intel_be_create_context(struct pipe_screen *screen)
 
        intel_be_init_context(intel, device);
 
-       if (getenv("INTEL_SOFTPIPE"))
+       if (device->softpipe)
                pipe = softpipe_create(screen);
        else
                pipe = i915_create_context(screen, &device->base, &intel->base);
index 8979f0ae15297cefa5e72756ff0925519ec2fc7c..4fa7a5e1a221cf6480e8f3e216f96dfafa5230af 100644 (file)
@@ -6,6 +6,7 @@
 #include "pipe/p_state.h"
 #include "pipe/p_inlines.h"
 #include "util/u_memory.h"
+#include "util/u_debug.h"
 
 #include "intel_be_fence.h"
 
@@ -286,6 +287,8 @@ intel_be_init_device(struct intel_be_device *dev, int fd, unsigned id)
 
        dev->pools.gem = drm_intel_bufmgr_gem_init(dev->fd, dev->max_batch_size);
 
+       dev->softpipe = debug_get_bool_option("INTEL_SOFTPIPE", FALSE);
+
        return true;
 }
 
@@ -303,7 +306,7 @@ intel_be_create_screen(int drmFD, int deviceID)
 
        intel_be_init_device(dev, drmFD, deviceID);
 
-       if (getenv("INTEL_SOFTPIPE")) {
+       if (dev->softpipe) {
                screen = softpipe_create_screen(&dev->base);
                drm_api_hooks.buffer_from_texture = softpipe_get_texture_buffer;
        } else
index 47d2176cb4220ffc0474a7766202748bdb89802c..b32637ece298e7a2462e6f38ba2a047969323ba4 100644 (file)
@@ -16,6 +16,8 @@ struct intel_be_device
 {
        struct pipe_winsys base;
 
+       boolean softpipe;
+
        int fd; /**< Drm file discriptor */
 
        unsigned id;