From a49c3c0faefe8761be21e9ee9ee0ffbbdbceb21e Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 1 Feb 2006 15:48:52 +0000 Subject: [PATCH] Ensure that color buffers and textures are mapped (bmBufferMap) before software rasterizer fallbacks. This has two functions, firstly to ensure that the Data pointers point to something and secondly to ensure than any pending fences on those buffers are discharged before allowing the software rasterizer to read/write the data. This needs to be integrated with Brian's validate code. --- src/mesa/drivers/dri/i915/intel_span.c | 37 ++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i915/intel_span.c b/src/mesa/drivers/dri/i915/intel_span.c index a0f848f7b0e..f42e1fbd588 100644 --- a/src/mesa/drivers/dri/i915/intel_span.c +++ b/src/mesa/drivers/dri/i915/intel_span.c @@ -31,12 +31,14 @@ #include "colormac.h" #include "intel_screen.h" - #include "intel_span.h" +#include "intel_regions.h" #include "intel_ioctl.h" +#include "intel_tex.h" + #include "swrast/swrast.h" - +#undef DBG #define DBG 0 #define LOCAL_VARS \ @@ -205,16 +207,47 @@ do { \ void intelSpanRenderStart( GLcontext *ctx ) { intelContextPtr intel = INTEL_CONTEXT(ctx); + GLuint i; intelFlush(&intel->ctx); LOCK_HARDWARE(intel); intelWaitForIdle(intel); + + /* Just map the framebuffer and all textures. Bufmgr code will + * take care of waiting on the necessary fences: + */ + intel_region_map(intel, intel->front_region); + intel_region_map(intel, intel->back_region); + intel_region_map(intel, intel->depth_region); + + for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { + if (ctx->Texture.Unit[i]._ReallyEnabled) { + struct gl_texture_object *texObj = ctx->Texture.Unit[i]._Current; + intel_tex_map_images(intel, intel_texture_object(texObj)); + } + } } void intelSpanRenderFinish( GLcontext *ctx ) { intelContextPtr intel = INTEL_CONTEXT( ctx ); + GLuint i; + _swrast_flush( ctx ); + + /* Now unmap the framebuffer: + */ + intel_region_unmap(intel, intel->front_region); + intel_region_unmap(intel, intel->back_region); + intel_region_unmap(intel, intel->depth_region); + + for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { + if (ctx->Texture.Unit[i]._ReallyEnabled) { + struct gl_texture_object *texObj = ctx->Texture.Unit[i]._Current; + intel_tex_unmap_images(intel, intel_texture_object(texObj)); + } + } + UNLOCK_HARDWARE( intel ); }