From 87f12bb2d95236c7b025d1a8be56b5ab1683d702 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 22 Nov 2011 11:00:35 -0800 Subject: i915: Fix build since hiz merge. v2: Guard against rb->mt being NULL, since we may enter the draw regions path before intel_prepare_render() has been called to set them. Reviewed-by: Chad Versace (v1) --- src/mesa/drivers/dri/i915/Makefile.sources | 1 + src/mesa/drivers/dri/i915/i830_state.c | 3 ++- src/mesa/drivers/dri/i915/i830_vtbl.c | 19 ++++++++++--------- src/mesa/drivers/dri/i915/i915_tex_layout.c | 12 ++++++------ src/mesa/drivers/dri/i915/i915_vtbl.c | 17 +++++++++-------- src/mesa/drivers/dri/i915/intel_resolve_map.c | 1 + 6 files changed, 29 insertions(+), 24 deletions(-) create mode 120000 src/mesa/drivers/dri/i915/intel_resolve_map.c (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/Makefile.sources b/src/mesa/drivers/dri/i915/Makefile.sources index c5b9c1fea2f..d961c073324 100644 --- a/src/mesa/drivers/dri/i915/Makefile.sources +++ b/src/mesa/drivers/dri/i915/Makefile.sources @@ -16,6 +16,7 @@ i915_C_SOURCES := \ intel_extensions.c \ intel_extensions_es.c \ intel_mipmap_tree.c \ + intel_resolve_map.c \ intel_tex_layout.c \ intel_tex_image.c \ intel_tex_subimage.c \ diff --git a/src/mesa/drivers/dri/i915/i830_state.c b/src/mesa/drivers/dri/i915/i830_state.c index 03af7bdc0e5..3136ced5ffb 100644 --- a/src/mesa/drivers/dri/i915/i830_state.c +++ b/src/mesa/drivers/dri/i915/i830_state.c @@ -37,6 +37,7 @@ #include "intel_screen.h" #include "intel_batchbuffer.h" +#include "intel_mipmap_tree.h" #include "intel_fbo.h" #include "intel_buffers.h" @@ -848,7 +849,7 @@ i830Enable(struct gl_context * ctx, GLenum cap, GLboolean state) if (ctx->DrawBuffer) { struct intel_renderbuffer *irbStencil = intel_get_renderbuffer(ctx->DrawBuffer, BUFFER_STENCIL); - hw_stencil = (irbStencil && irbStencil->region); + hw_stencil = (irbStencil && irbStencil->mt->region); } if (hw_stencil) { I830_STATECHANGE(i830, I830_UPLOAD_CTX); diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c index e79dd755685..e85b2f9b5f2 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -28,6 +28,7 @@ #include "i830_context.h" #include "i830_reg.h" #include "intel_batchbuffer.h" +#include "intel_mipmap_tree.h" #include "intel_regions.h" #include "intel_tris.h" #include "intel_fbo.h" @@ -760,7 +761,7 @@ i830_update_draw_buffer(struct intel_context *intel) for (i = 0; i < fb->_NumColorDrawBuffers; i++) { irb = intel_renderbuffer(fb->_ColorDrawBuffers[i]); - colorRegions[i] = irb ? irb->region : NULL; + colorRegions[i] = (irb && irb->mt) ? irb->mt->region : NULL; } } else { @@ -778,7 +779,7 @@ i830_update_draw_buffer(struct intel_context *intel) /* drawing to user-created FBO */ struct intel_renderbuffer *irb; irb = intel_renderbuffer(fb->_ColorDrawBuffers[0]); - colorRegions[0] = (irb && irb->region) ? irb->region : NULL; + colorRegions[0] = (irb && irb->mt->region) ? irb->mt->region : NULL; } } @@ -790,10 +791,10 @@ i830_update_draw_buffer(struct intel_context *intel) } /* Check for depth fallback. */ - if (irbDepth && irbDepth->region) { + if (irbDepth && irbDepth->mt) { FALLBACK(intel, INTEL_FALLBACK_DEPTH_BUFFER, false); - depthRegion = irbDepth->region; - } else if (irbDepth && !irbDepth->region) { + depthRegion = irbDepth->mt->region; + } else if (irbDepth && !irbDepth->mt) { FALLBACK(intel, INTEL_FALLBACK_DEPTH_BUFFER, true); depthRegion = NULL; } else { /* !irbDepth */ @@ -803,10 +804,10 @@ i830_update_draw_buffer(struct intel_context *intel) } /* Check for stencil fallback. */ - if (irbStencil && irbStencil->region) { + if (irbStencil && irbStencil->mt) { assert(irbStencil->Base.Format == MESA_FORMAT_S8_Z24); FALLBACK(intel, INTEL_FALLBACK_STENCIL_BUFFER, false); - } else if (irbStencil && !irbStencil->region) { + } else if (irbStencil && !irbStencil->mt) { FALLBACK(intel, INTEL_FALLBACK_STENCIL_BUFFER, true); } else { /* !irbStencil */ /* No fallback is needed because there is no stencil buffer. */ @@ -816,9 +817,9 @@ i830_update_draw_buffer(struct intel_context *intel) /* If we have a (packed) stencil buffer attached but no depth buffer, * we still need to set up the shared depth/stencil state so we can use it. */ - if (depthRegion == NULL && irbStencil && irbStencil->region + if (depthRegion == NULL && irbStencil && irbStencil->mt && irbStencil->Base.Format == MESA_FORMAT_S8_Z24) { - depthRegion = irbStencil->region; + depthRegion = irbStencil->mt->region; } /* diff --git a/src/mesa/drivers/dri/i915/i915_tex_layout.c b/src/mesa/drivers/dri/i915/i915_tex_layout.c index a86384bbcfd..caa7127203b 100644 --- a/src/mesa/drivers/dri/i915/i915_tex_layout.c +++ b/src/mesa/drivers/dri/i915/i915_tex_layout.c @@ -126,7 +126,7 @@ i915_miptree_layout_cube(struct intel_mipmap_tree * mt) mt->total_height = dim * 4; for (level = mt->first_level; level <= mt->last_level; level++) { - intel_miptree_set_level_info(mt, level, 6, + intel_miptree_set_level_info(mt, level, 0, 0, lvlWidth, lvlHeight, 1); @@ -167,7 +167,7 @@ i915_miptree_layout_3d(struct intel_mipmap_tree * mt) /* XXX: hardware expects/requires 9 levels at minimum. */ for (level = mt->first_level; level <= MAX2(8, mt->last_level); level++) { - intel_miptree_set_level_info(mt, level, depth, 0, mt->total_height, + intel_miptree_set_level_info(mt, level, 0, mt->total_height, width, height, depth); stack_height += MAX2(2, height); @@ -208,7 +208,7 @@ i915_miptree_layout_2d(struct intel_mipmap_tree * mt) mt->total_height = 0; for (level = mt->first_level; level <= mt->last_level; level++) { - intel_miptree_set_level_info(mt, level, 1, + intel_miptree_set_level_info(mt, level, 0, mt->total_height, width, height, 1); @@ -335,7 +335,7 @@ i945_miptree_layout_cube(struct intel_mipmap_tree * mt) /* Set all the levels to effectively occupy the whole rectangular region. */ for (level = mt->first_level; level <= mt->last_level; level++) { - intel_miptree_set_level_info(mt, level, 6, + intel_miptree_set_level_info(mt, level, 0, 0, lvlWidth, lvlHeight, 1); lvlWidth /= 2; @@ -421,7 +421,7 @@ i945_miptree_layout_3d(struct intel_mipmap_tree * mt) GLint y = 0; GLint q, j; - intel_miptree_set_level_info(mt, level, depth, + intel_miptree_set_level_info(mt, level, 0, mt->total_height, width, height, depth); @@ -469,7 +469,7 @@ i945_miptree_layout(struct intel_mipmap_tree * mt) case GL_TEXTURE_1D: case GL_TEXTURE_2D: case GL_TEXTURE_RECTANGLE_ARB: - i945_miptree_layout_2d(mt, 1); + i945_miptree_layout_2d(mt); break; default: _mesa_problem(NULL, "Unexpected tex target in i945_miptree_layout()"); diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index e21eb662ff4..e938af84bf5 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -41,6 +41,7 @@ #include "swrast_setup/swrast_setup.h" #include "intel_batchbuffer.h" +#include "intel_mipmap_tree.h" #include "intel_regions.h" #include "intel_tris.h" #include "intel_fbo.h" @@ -755,15 +756,15 @@ i915_update_draw_buffer(struct intel_context *intel) } else { struct intel_renderbuffer *irb; irb = intel_renderbuffer(fb->_ColorDrawBuffers[0]); - colorRegion = irb ? irb->region : NULL; + colorRegion = (irb && irb->mt) ? irb->mt->region : NULL; FALLBACK(intel, INTEL_FALLBACK_DRAW_BUFFER, false); } /* Check for depth fallback. */ - if (irbDepth && irbDepth->region) { + if (irbDepth && irbDepth->mt) { FALLBACK(intel, INTEL_FALLBACK_DEPTH_BUFFER, false); - depthRegion = irbDepth->region; - } else if (irbDepth && !irbDepth->region) { + depthRegion = irbDepth->mt->region; + } else if (irbDepth && !irbDepth->mt) { FALLBACK(intel, INTEL_FALLBACK_DEPTH_BUFFER, true); depthRegion = NULL; } else { /* !irbDepth */ @@ -773,10 +774,10 @@ i915_update_draw_buffer(struct intel_context *intel) } /* Check for stencil fallback. */ - if (irbStencil && irbStencil->region) { + if (irbStencil && irbStencil->mt) { assert(irbStencil->Base.Format == MESA_FORMAT_S8_Z24); FALLBACK(intel, INTEL_FALLBACK_STENCIL_BUFFER, false); - } else if (irbStencil && !irbStencil->region) { + } else if (irbStencil && !irbStencil->mt) { FALLBACK(intel, INTEL_FALLBACK_STENCIL_BUFFER, true); } else { /* !irbStencil */ /* No fallback is needed because there is no stencil buffer. */ @@ -786,9 +787,9 @@ i915_update_draw_buffer(struct intel_context *intel) /* If we have a (packed) stencil buffer attached but no depth buffer, * we still need to set up the shared depth/stencil state so we can use it. */ - if (depthRegion == NULL && irbStencil && irbStencil->region + if (depthRegion == NULL && irbStencil && irbStencil->mt && irbStencil->Base.Format == MESA_FORMAT_S8_Z24) { - depthRegion = irbStencil->region; + depthRegion = irbStencil->mt->region; } /* diff --git a/src/mesa/drivers/dri/i915/intel_resolve_map.c b/src/mesa/drivers/dri/i915/intel_resolve_map.c new file mode 120000 index 00000000000..77e50fbaea4 --- /dev/null +++ b/src/mesa/drivers/dri/i915/intel_resolve_map.c @@ -0,0 +1 @@ +../intel/intel_resolve_map.c \ No newline at end of file -- cgit v1.2.3