On 05/31/2016 08:39 AM, Marek Olšák wrote:
Ping

On Thu, May 19, 2016 at 12:59 PM, Marek Olšák <mar...@gmail.com> wrote:
From: Marek Olšák <marek.ol...@amd.com>

---
  src/gallium/auxiliary/util/u_inlines.h    | 12 ++++++++++++
  src/gallium/drivers/radeon/r600_texture.c | 23 ++++++-----------------
  2 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_inlines.h 
b/src/gallium/auxiliary/util/u_inlines.h
index 07c058a..b733c9f 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -650,6 +650,18 @@ util_max_layer(const struct pipe_resource *r, unsigned 
level)
     }
  }

+static inline bool
+util_texrange_covers_whole_level(const struct pipe_resource *tex,
+                                 unsigned level, unsigned x, unsigned y,
+                                 unsigned z, unsigned width,
+                                 unsigned height, unsigned depth)
+{
+   return x == 0 && y == 0 && z == 0 &&
+          width == u_minify(tex->width0, level) &&
+          height == u_minify(tex->height0, level) &&
+          depth == util_max_layer(tex, level) + 1;
+}

Is the function only meant to handle 1/2D mipmapped textures? What about cube, 3d, array, etc? Can we assert on tex->target for the expected types?

Looks OK otherwise.

Reviewed-by: Brian Paul <bri...@vmware.com>


+
  #ifdef __cplusplus
  }
  #endif
diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index e2955aa..db63beb 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -38,17 +38,6 @@ static void r600_texture_discard_cmask(struct 
r600_common_screen *rscreen,
                                        struct r600_texture *rtex);


-static bool range_covers_whole_texture(struct pipe_resource *tex,
-                                      unsigned level, unsigned x, unsigned y,
-                                      unsigned z, unsigned width,
-                                      unsigned height, unsigned depth)
-{
-       return x == 0 && y == 0 && z == 0 &&
-              width == u_minify(tex->width0, level) &&
-              height == u_minify(tex->height0, level) &&
-              depth == util_max_layer(tex, level) + 1;
-}
-
  bool r600_prepare_for_dma_blit(struct r600_common_context *rctx,
                                struct r600_texture *rdst,
                                unsigned dst_level, unsigned dstx,
@@ -87,9 +76,9 @@ bool r600_prepare_for_dma_blit(struct r600_common_context 
*rctx,
         if (rdst->dcc_offset) {
                 /* We can't discard DCC if the texture has been exported. */
                 if (rdst->resource.is_shared ||
-                   !range_covers_whole_texture(&rdst->resource.b.b, dst_level,
-                                               dstx, dsty, dstz, 
src_box->width,
-                                               src_box->height, 
src_box->depth))
+                   !util_texrange_covers_whole_level(&rdst->resource.b.b, 
dst_level,
+                                                     dstx, dsty, dstz, 
src_box->width,
+                                                     src_box->height, 
src_box->depth))
                         return false;

                 r600_texture_discard_dcc(rctx->screen, rdst);
@@ -101,9 +90,9 @@ bool r600_prepare_for_dma_blit(struct r600_common_context 
*rctx,
          *        SDMA. Otherwise, use the 3D path.
          */
         if (rdst->cmask.size && rdst->dirty_level_mask & (1 << dst_level)) {
-               if (!range_covers_whole_texture(&rdst->resource.b.b, dst_level,
-                                               dstx, dsty, dstz, 
src_box->width,
-                                               src_box->height, 
src_box->depth))
+               if (!util_texrange_covers_whole_level(&rdst->resource.b.b, 
dst_level,
+                                                     dstx, dsty, dstz, 
src_box->width,
+                                                     src_box->height, 
src_box->depth))
                         return false;

                 r600_texture_discard_cmask(rctx->screen, rdst);
--
2.7.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=CwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=T0t4QG7chq2ZwJo6wilkFznRSFy-8uDKartPGbomVj8&m=0WLT_iCHXl55a0Ml-vv08PURtoGwtvz5acBK5_7MgVk&s=Wv4_nMBfbzFhvgalOpUCp7K0FbvXGhQS4Yy8nziMk8c&e=


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

Reply via email to