[Mesa-dev] [PATCH 14/22] isl-layout-flags

Chris Wilson chris at chris-wilson.co.uk
Sat Aug 5 09:40:06 UTC 2017


---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 14 +++++++-------
 src/mesa/drivers/dri/i965/intel_mipmap_tree.h |  1 +
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 74e120b983..88cfb030d3 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -783,6 +783,10 @@ intel_miptree_create_for_bo(struct brw_context *brw,
    const GLenum target = depth > 1 ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;
    const GLenum base_format = _mesa_get_format_base_format(format);
 
+   unsigned isl_flags = ISL_SURF_USAGE_TEXTURE_BIT;
+   if (!(layout_flags & MIPTREE_LAYOUT_FOR_TEXTURE))
+           isl_flags |= ISL_SURF_USAGE_RENDER_TARGET_BIT;
+
    if ((base_format == GL_DEPTH_COMPONENT ||
         base_format == GL_DEPTH_STENCIL)) {
       const mesa_format depth_only_format =
@@ -795,8 +799,7 @@ intel_miptree_create_for_bo(struct brw_context *brw,
       mt = make_surface(brw, target,
                         brw->gen >= 6 ? depth_only_format : format,
                         0, 0, width, height, depth, 1, tiling,
-                        ISL_SURF_USAGE_DEPTH_BIT |
-                        ISL_SURF_USAGE_TEXTURE_BIT,
+                        isl_flags | ISL_SURF_USAGE_DEPTH_BIT,
                         0, pitch, bo);
       if (!mt)
          return NULL;
@@ -815,8 +818,7 @@ intel_miptree_create_for_bo(struct brw_context *brw,
       mt = make_surface(brw, target, MESA_FORMAT_S_UINT8,
                         0, 0, width, height, depth, 1,
                         tiling,
-                        ISL_SURF_USAGE_STENCIL_BIT |
-                        ISL_SURF_USAGE_TEXTURE_BIT,
+                        isl_flags | ISL_SURF_USAGE_STENCIL_BIT,
                         BO_ALLOC_FOR_RENDER, pitch, bo);
       if (!mt)
          return NULL;
@@ -846,9 +848,7 @@ intel_miptree_create_for_bo(struct brw_context *brw,
    mt = make_surface(brw, target, format,
                      0, 0, width, height, depth, 1,
                      1lu << isl_tiling_from_i915_tiling(tiling),
-                     ISL_SURF_USAGE_RENDER_TARGET_BIT |
-                     ISL_SURF_USAGE_TEXTURE_BIT,
-                     0, pitch, bo);
+                     isl_flags, 0, pitch, bo);
    if (!mt)
       return NULL;
 
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
index 2179318413..05e7f90811 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
@@ -361,6 +361,7 @@ enum {
                                              MIPTREE_LAYOUT_TILING_NONE,
 
    MIPTREE_LAYOUT_FOR_SCANOUT              = 1 << 7,
+   MIPTREE_LAYOUT_FOR_TEXTURE              = 1 << 8,
 };
 
 struct intel_mipmap_tree *intel_miptree_create(struct brw_context *brw,
-- 
2.13.3



More information about the mesa-dev mailing list