i915: Fix build since hiz merge.
authorEric Anholt <eric@anholt.net>
Tue, 22 Nov 2011 19:00:35 +0000 (11:00 -0800)
committerEric Anholt <eric@anholt.net>
Wed, 23 Nov 2011 17:44:58 +0000 (09:44 -0800)
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 <chad.versace@linux.intel.com> (v1)
src/mesa/drivers/dri/i915/Makefile.sources
src/mesa/drivers/dri/i915/i830_state.c
src/mesa/drivers/dri/i915/i830_vtbl.c
src/mesa/drivers/dri/i915/i915_tex_layout.c
src/mesa/drivers/dri/i915/i915_vtbl.c
src/mesa/drivers/dri/i915/intel_resolve_map.c [new symlink]

index c5b9c1fea2ffb9b127834922ff02c3df6e4d496b..d961c073324b8edc13aefe1d7a0604aec855ba40 100644 (file)
@@ -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 \
index 03af7bdc0e5cc519e8cdecaf29f3c324edd32b5d..3136ced5ffbd4d043fabf1b9f82be755b9a87429 100644 (file)
@@ -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);
index e79dd7556858ca6322e518e7411e11d181124ba1..e85b2f9b5f23c66fb1b1060a0c2fde0fd1e4001f 100644 (file)
@@ -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;
    }
 
    /*
index a86384bbcfdc90b244c58403dbaa64718926f54e..caa7127203b2aca1489ec5029000640953bba41c 100644 (file)
@@ -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()");
index e21eb662ff47d5dfe61770437eca4ddea32a4e27..e938af84bf56bc55fd3c672ee36eca4d9c3e946b 100644 (file)
@@ -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 (symlink)
index 0000000..77e50fb
--- /dev/null
@@ -0,0 +1 @@
+../intel/intel_resolve_map.c
\ No newline at end of file