From 5f701f22f00ea17e0aba91c9995c9f559963d591 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 25 Apr 2009 12:55:21 +0100 Subject: [PATCH] gallium-intel: Cache software switch --- src/gallium/winsys/drm/intel/gem/intel_be_context.c | 2 +- src/gallium/winsys/drm/intel/gem/intel_be_device.c | 5 ++++- src/gallium/winsys/drm/intel/gem/intel_be_device.h | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_context.c b/src/gallium/winsys/drm/intel/gem/intel_be_context.c index cfe8c884660..fe0b138fbea 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_context.c +++ b/src/gallium/winsys/drm/intel/gem/intel_be_context.c @@ -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); diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.c b/src/gallium/winsys/drm/intel/gem/intel_be_device.c index 8979f0ae152..4fa7a5e1a22 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_device.c +++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.c @@ -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 diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.h b/src/gallium/winsys/drm/intel/gem/intel_be_device.h index 47d2176cb42..b32637ece29 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_device.h +++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.h @@ -16,6 +16,8 @@ struct intel_be_device { struct pipe_winsys base; + boolean softpipe; + int fd; /**< Drm file discriptor */ unsigned id; -- 2.30.2