i965: Use the new resolve function for several simple cases
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 25 May 2017 05:09:51 +0000 (22:09 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 8 Jun 2017 05:18:53 +0000 (22:18 -0700)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/i965/intel_blit.c
src/mesa/drivers/dri/i965/intel_mipmap_tree.c
src/mesa/drivers/dri/i965/intel_mipmap_tree.h
src/mesa/drivers/dri/i965/intel_pixel_bitmap.c
src/mesa/drivers/dri/i965/intel_pixel_read.c
src/mesa/drivers/dri/i965/intel_tex_image.c
src/mesa/drivers/dri/i965/intel_tex_subimage.c

index bf7200bd00e32c33bd8320877efe30ceefc2eebd..94a166b4f3c9bb658308939214ac501711558a45 100644 (file)
@@ -1395,7 +1395,7 @@ intel_resolve_for_dri2_flush(struct brw_context *brw,
       if (rb->mt->num_samples <= 1) {
          assert(rb->mt_layer == 0 && rb->mt_level == 0 &&
                 rb->layer_count == 1);
-         intel_miptree_resolve_color(brw, rb->mt, 0, 1, 0, 1, 0);
+         intel_miptree_prepare_access(brw, rb->mt, 0, 1, 0, 1, false, false);
       } else {
          intel_renderbuffer_downsample(brw, rb);
       }
index dc68614b4d38283d2096ec78b6ca3bc49222e76a..e79e02a075232debe27d67a80a7bb2ddc7266a46 100644 (file)
@@ -324,11 +324,8 @@ intel_miptree_blit(struct brw_context *brw,
    /* The blitter has no idea about HiZ or fast color clears, so we need to
     * resolve the miptrees before we do anything.
     */
-   intel_miptree_slice_resolve_depth(brw, src_mt, src_level, src_slice);
-   intel_miptree_slice_resolve_depth(brw, dst_mt, dst_level, dst_slice);
-   intel_miptree_resolve_color(brw, src_mt, src_level, 1, src_slice, 1, 0);
-   intel_miptree_resolve_color(brw, dst_mt, dst_level, 1, dst_slice, 1, 0);
-   intel_miptree_slice_set_needs_hiz_resolve(dst_mt, dst_level, dst_slice);
+   intel_miptree_access_raw(brw, src_mt, src_level, src_slice, false);
+   intel_miptree_access_raw(brw, dst_mt, dst_level, dst_slice, true);
 
    if (src_flip)
       src_y = minify(src_mt->physical_height0, src_level - src_mt->first_level) - src_y - height;
@@ -383,11 +380,8 @@ intel_miptree_copy(struct brw_context *brw,
    /* The blitter has no idea about HiZ or fast color clears, so we need to
     * resolve the miptrees before we do anything.
     */
-   intel_miptree_slice_resolve_depth(brw, src_mt, src_level, src_slice);
-   intel_miptree_slice_resolve_depth(brw, dst_mt, dst_level, dst_slice);
-   intel_miptree_resolve_color(brw, src_mt, src_level, 1, src_slice, 1, 0);
-   intel_miptree_resolve_color(brw, dst_mt, dst_level, 1, dst_slice, 1, 0);
-   intel_miptree_slice_set_needs_hiz_resolve(dst_mt, dst_level, dst_slice);
+   intel_miptree_access_raw(brw, src_mt, src_level, src_slice, false);
+   intel_miptree_access_raw(brw, dst_mt, dst_level, dst_slice, true);
 
    uint32_t src_image_x, src_image_y;
    intel_miptree_get_image_offset(src_mt, src_level, src_slice,
index 04ac46f789c37707e1de254e4c258a4d7851bd10..800b1626964cbd082c3a572a61f3f28ad8dd8597 100644 (file)
@@ -2420,8 +2420,10 @@ intel_miptree_make_shareable(struct brw_context *brw,
     */
    assert(mt->msaa_layout == INTEL_MSAA_LAYOUT_NONE || mt->num_samples <= 1);
 
+   intel_miptree_prepare_access(brw, mt, 0, INTEL_REMAINING_LEVELS,
+                                0, INTEL_REMAINING_LAYERS, false, false);
+
    if (mt->mcs_buf) {
-      intel_miptree_all_slices_resolve_color(brw, mt, 0);
       mt->aux_disable |= (INTEL_AUX_DISABLE_CCS | INTEL_AUX_DISABLE_MCS);
       brw_bo_unreference(mt->mcs_buf->bo);
       free(mt->mcs_buf);
@@ -2436,7 +2438,6 @@ intel_miptree_make_shareable(struct brw_context *brw,
 
    if (mt->hiz_buf) {
       mt->aux_disable |= INTEL_AUX_DISABLE_HIZ;
-      intel_miptree_all_slices_resolve_depth(brw, mt);
       intel_miptree_hiz_buffer_free(mt->hiz_buf);
       mt->hiz_buf = NULL;
 
@@ -3194,11 +3195,8 @@ intel_miptree_map(struct brw_context *brw,
       return;
    }
 
-   intel_miptree_resolve_color(brw, mt, level, 1, slice, 1, 0);
-   intel_miptree_slice_resolve_depth(brw, mt, level, slice);
-   if (map->mode & GL_MAP_WRITE_BIT) {
-      intel_miptree_slice_set_needs_hiz_resolve(mt, level, slice);
-   }
+   intel_miptree_access_raw(brw, mt, level, slice,
+                            map->mode & GL_MAP_WRITE_BIT);
 
    if (mt->format == MESA_FORMAT_S_UINT8) {
       intel_miptree_map_s8(brw, mt, map, level, slice);
index 77572292f639c40a92ab2a17a9672d9dcb8d1bf1..a3d68e62f37e02adb96d2d874d52746fb14e4890 100644 (file)
@@ -1027,6 +1027,24 @@ intel_miptree_set_aux_state(struct brw_context *brw,
                             uint32_t start_layer, uint32_t num_layers,
                             enum isl_aux_state aux_state);
 
+/**
+ * Prepare a miptree for raw access
+ *
+ * This helper prepares the miptree for access that knows nothing about any
+ * sort of compression whatsoever.  This is useful when mapping the surface or
+ * using it with the blitter.
+ */
+static inline void
+intel_miptree_access_raw(struct brw_context *brw,
+                         struct intel_mipmap_tree *mt,
+                         uint32_t level, uint32_t layer,
+                         bool write)
+{
+   intel_miptree_prepare_access(brw, mt, level, 1, layer, 1, false, false);
+   if (write)
+      intel_miptree_finish_write(brw, mt, level, layer, 1, false);
+}
+
 void
 intel_miptree_make_shareable(struct brw_context *brw,
                              struct intel_mipmap_tree *mt);
index f79863e3493931ca350b377475e8675e2d69ed68..af94a1c82f56370c6aa08f6096215f38df07197a 100644 (file)
@@ -256,8 +256,7 @@ do_blit_bitmap( struct gl_context *ctx,
    /* The blitter has no idea about fast color clears, so we need to resolve
     * the miptree before we do anything.
     */
-   intel_miptree_resolve_color(brw, irb->mt, irb->mt_level, 1,
-                               irb->mt_layer, 1, 0);
+   intel_miptree_access_raw(brw, irb->mt, irb->mt_level, irb->mt_layer, true);
 
    /* Chop it all into chunks that can be digested by hardware: */
    for (py = 0; py < height; py += DY) {
index 7892b37a077b653246b9e023ed9d7cfc303aebfb..871559edf9e4bc254890358562f301dd6d647425 100644 (file)
@@ -147,8 +147,7 @@ intel_readpixels_tiled_memcpy(struct gl_context * ctx,
    /* Since we are going to read raw data to the miptree, we need to resolve
     * any pending fast color clears before we start.
     */
-   intel_miptree_resolve_color(brw, irb->mt, irb->mt_level, 1,
-                               irb->mt_layer, 1, 0);
+   intel_miptree_access_raw(brw, irb->mt, irb->mt_level, irb->mt_layer, false);
 
    bo = irb->mt->bo;
 
index 8cd1eae296bb74b0f201652e02f211eae8355610..ea166f019fb3bae8cc431d33214c8fdceb8188a2 100644 (file)
@@ -539,7 +539,7 @@ intel_gettexsubimage_tiled_memcpy(struct gl_context *ctx,
     * any pending fast color clears before we start.
     */
    assert(image->mt->logical_depth0 == 1);
-   intel_miptree_resolve_color(brw, image->mt, level, 1, 0, 1, 0);
+   intel_miptree_access_raw(brw, image->mt, level, 0, true);
 
    bo = image->mt->bo;
 
index caa673001fde0943cc19340c38d0ac2089ab1c4b..da5b3f0d30235ae1bb06812da4ab6bfcdfd19e11 100644 (file)
@@ -151,7 +151,7 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
     * any pending fast color clears before we start.
     */
    assert(image->mt->logical_depth0 == 1);
-   intel_miptree_resolve_color(brw, image->mt, level, 1, 0, 1, 0);
+   intel_miptree_access_raw(brw, image->mt, level, 0, true);
 
    bo = image->mt->bo;