On 01/13/2012 04:57 PM, Chad Versace wrote:
Nothing works if HiZ is enabled and the DDX is incapable of HiZ (that is,
the DDX version is<  2.16).

The problem is that the refactoring that eliminated
intel_renderbuffer::stencil_rb broke the recovery path in
intel_verify_dri2_has_hiz().  Specifically, it broke line
intel_context.c:1445, which allocates the region for
DRI_BUFFER_DEPTH_STENCIL. That allocation was creating a separate stencil
miptree, despite the buffer being a packed depthstencil buffer. Havoc
ensued.

This patch introduces a bool flag that prevents allocation of that stencil
miptree.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44103
CC: Ian Romanick<i...@freedesktop.org>

Tested-by: Ian Romanick <ian.d.roman...@intel.com>

Note: This is a candidate for the 8.0 branch.
Signed-off-by: Chad Versace<chad.vers...@linux.intel.com>
---
  src/mesa/drivers/dri/intel/intel_mipmap_tree.c |   17 +++++++++++++----
  1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index 4e1a502..eae79c1 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -58,6 +58,11 @@ target_to_target(GLenum target)
     }
  }

+/**
+ * @param for_region Indicates that the caller is
+ *        intel_miptree_create_for_region(). If true, then do not create
+ *        \c stencil_mt.
+ */
  static struct intel_mipmap_tree *
  intel_miptree_create_internal(struct intel_context *intel,
                              GLenum target,
@@ -66,7 +71,8 @@ intel_miptree_create_internal(struct intel_context *intel,
                              GLuint last_level,
                              GLuint width0,
                              GLuint height0,
-                             GLuint depth0)
+                             GLuint depth0,
+                             bool for_region)
  {
     struct intel_mipmap_tree *mt = calloc(sizeof(*mt), 1);
     int compress_byte = 0;
@@ -106,7 +112,8 @@ intel_miptree_create_internal(struct intel_context *intel,
        mt->cpp = 2;
     }

-   if (_mesa_is_depthstencil_format(_mesa_get_format_base_format(format))&&
+   if (!for_region&&
+       _mesa_is_depthstencil_format(_mesa_get_format_base_format(format))&&
         (intel->must_use_separate_stencil ||
        (intel->has_separate_stencil&&
        intel->vtbl.is_hiz_depth_format(intel, format)))) {
@@ -199,7 +206,8 @@ intel_miptree_create(struct intel_context *intel,

     mt = intel_miptree_create_internal(intel, target, format,
                                      first_level, last_level, width0,
-                                     height0, depth0);
+                                     height0, depth0,
+                                     false);
     /*
      * pitch == 0 || height == 0  indicates the null texture
      */
@@ -234,7 +242,8 @@ intel_miptree_create_for_region(struct intel_context *intel,

     mt = intel_miptree_create_internal(intel, target, format,
                                      0, 0,
-                                     region->width, region->height, 1);
+                                     region->width, region->height, 1,
+                                     true);
     if (!mt)
        return mt;


_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to