From 13cb8264d81f09ce046c73fd751596572d13512e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michel=20D=C3=A4nzer?= Date: Thu, 23 Apr 2009 12:57:46 +0100 Subject: [PATCH] gallium/intel/gem: Use softpipe rather than i915simple if INTEL_SOFTPIPE is set. --- src/gallium/drivers/softpipe/sp_texture.c | 19 +++++++++++++++++++ src/gallium/drivers/softpipe/sp_winsys.h | 6 ++++++ .../winsys/drm/intel/gem/intel_be_context.c | 14 ++++++++------ .../winsys/drm/intel/gem/intel_be_device.c | 7 ++++++- src/gallium/winsys/drm/intel/xorg/Makefile | 3 ++- 5 files changed, 41 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index c0113c47adb..9e19745889e 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -399,3 +399,22 @@ softpipe_init_screen_texture_funcs(struct pipe_screen *screen) screen->transfer_map = softpipe_transfer_map; screen->transfer_unmap = softpipe_transfer_unmap; } + + +boolean +softpipe_get_texture_buffer( struct pipe_texture *texture, + struct pipe_buffer **buf, + unsigned *stride ) +{ + struct softpipe_texture *tex = (struct softpipe_texture *)texture; + + if (!tex) + return FALSE; + + pipe_buffer_reference(buf, tex->buffer); + + if (stride) + *stride = tex->stride[0]; + + return TRUE; +} diff --git a/src/gallium/drivers/softpipe/sp_winsys.h b/src/gallium/drivers/softpipe/sp_winsys.h index cf91e7782bc..9e571862b75 100644 --- a/src/gallium/drivers/softpipe/sp_winsys.h +++ b/src/gallium/drivers/softpipe/sp_winsys.h @@ -52,6 +52,12 @@ struct pipe_screen * softpipe_create_screen(struct pipe_winsys *); +boolean +softpipe_get_texture_buffer( struct pipe_texture *texture, + struct pipe_buffer **buf, + unsigned *stride ); + + #ifdef __cplusplus } #endif 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 bb6f1b916c2..cfe8c884660 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_context.c +++ b/src/gallium/winsys/drm/intel/gem/intel_be_context.c @@ -1,6 +1,8 @@ #include "pipe/p_screen.h" +#include "softpipe/sp_winsys.h" + #include "intel_be_device.h" #include "intel_be_context.h" #include "intel_be_batchbuffer.h" @@ -106,13 +108,13 @@ intel_be_create_context(struct pipe_screen *screen) intel_be_init_context(intel, device); -#if 0 - pipe = intel_create_softpipe(intel, screen->winsys); -#else - pipe = i915_create_context(screen, &device->base, &intel->base); -#endif + if (getenv("INTEL_SOFTPIPE")) + pipe = softpipe_create(screen); + else + pipe = i915_create_context(screen, &device->base, &intel->base); - pipe->priv = intel; + if (pipe) + pipe->priv = intel; return pipe; } 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 0f6300323b0..8979f0ae152 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_device.c +++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.c @@ -10,6 +10,7 @@ #include "intel_be_fence.h" #include "i915simple/i915_winsys.h" +#include "softpipe/sp_winsys.h" #include "intel_be_api.h" @@ -302,7 +303,11 @@ intel_be_create_screen(int drmFD, int deviceID) intel_be_init_device(dev, drmFD, deviceID); - screen = i915_create_screen(&dev->base, deviceID); + if (getenv("INTEL_SOFTPIPE")) { + screen = softpipe_create_screen(&dev->base); + drm_api_hooks.buffer_from_texture = softpipe_get_texture_buffer; + } else + screen = i915_create_screen(&dev->base, deviceID); return screen; } diff --git a/src/gallium/winsys/drm/intel/xorg/Makefile b/src/gallium/winsys/drm/intel/xorg/Makefile index a45ca570db1..b1b6b9362b6 100644 --- a/src/gallium/winsys/drm/intel/xorg/Makefile +++ b/src/gallium/winsys/drm/intel/xorg/Makefile @@ -21,6 +21,7 @@ LIBS = \ $(GALLIUMDIR)/state_trackers/xorg/libxorgtracker.a \ $(GALLIUMDIR)/winsys/drm/intel/gem/libinteldrm.a \ $(TOP)/src/gallium/drivers/i915simple/libi915simple.a \ + $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ $(GALLIUM_AUXILIARIES) ############################################# @@ -29,7 +30,7 @@ LIBS = \ all default: $(TARGET) -$(TARGET): $(OBJECTS) Makefile $(GALLIUMDIR)/state_trackers/xorg/libxorgtracker.a +$(TARGET): $(OBJECTS) Makefile $(GALLIUMDIR)/state_trackers/xorg/libxorgtracker.a $(LIBS) $(TOP)/bin/mklib -noprefix -o $@ \ $(OBJECTS) $(LIBS) $(shell pkg-config --libs libdrm) -ldrm_intel -- 2.30.2