i965: Add means for limiting color resolves
authorTopi Pohjolainen <topi.pohjolainen@intel.com>
Wed, 9 Dec 2015 10:56:06 +0000 (12:56 +0200)
committerTopi Pohjolainen <topi.pohjolainen@intel.com>
Sat, 13 Feb 2016 07:50:24 +0000 (09:50 +0200)
Until now there has been only one type of color buffer that needs
to resolved - namely single sampled fast clear. As even the
sampler engine in GPU doesn't understand the associated meta data,
the color values need to be always resolved prior to reading them.

From SKL onwards there is new scheme supported called the lossless
compression of single sampled color buffers. This is something that
is understood by the sampling engine and therefore resolving of
these types of buffers is not necessary before sampling.
This patch adds means to make the distinction when considering if
resolve is needed.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Ben Widawsky <benjamin.widawsky@intel.com>
src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/i965/intel_blit.c
src/mesa/drivers/dri/i965/intel_copy_image.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 c7cb3944870bbaf6413026b11727a5e1a566d71d..e8c5e955247db260cefa9f1be595ea102d2fad65 100644 (file)
@@ -71,7 +71,7 @@ brw_blorp_blit_miptrees(struct brw_context *brw,
     * to destination color buffers, and the standard render path is
     * fast-color-aware.
     */
-   intel_miptree_resolve_color(brw, src_mt);
+   intel_miptree_resolve_color(brw, src_mt, 0);
    intel_miptree_slice_resolve_depth(brw, src_mt, src_level, src_layer);
    intel_miptree_slice_resolve_depth(brw, dst_mt, dst_level, dst_layer);
 
index 44d2fe4d9e43543837265ff1b507497f7ea554a5..a5f7a2e8b8ae095fb4d8f92d7ee2c305118e2787 100644 (file)
@@ -208,7 +208,7 @@ intel_update_state(struct gl_context * ctx, GLuint new_state)
       if (!tex_obj || !tex_obj->mt)
         continue;
       intel_miptree_all_slices_resolve_depth(brw, tex_obj->mt);
-      intel_miptree_resolve_color(brw, tex_obj->mt);
+      intel_miptree_resolve_color(brw, tex_obj->mt, 0);
       brw_render_cache_set_check_flush(brw, tex_obj->mt->bo);
    }
 
@@ -223,7 +223,7 @@ intel_update_state(struct gl_context * ctx, GLuint new_state)
             tex_obj = intel_texture_object(u->TexObj);
 
             if (tex_obj && tex_obj->mt) {
-               intel_miptree_resolve_color(brw, tex_obj->mt);
+               intel_miptree_resolve_color(brw, tex_obj->mt, 0);
                brw_render_cache_set_check_flush(brw, tex_obj->mt->bo);
             }
          }
@@ -252,7 +252,7 @@ intel_update_state(struct gl_context * ctx, GLuint new_state)
              _mesa_get_srgb_format_linear(mt->format) == mt->format)
                continue;
 
-         intel_miptree_resolve_color(brw, mt);
+         intel_miptree_resolve_color(brw, mt, 0);
          brw_render_cache_set_check_flush(brw, mt->bo);
       }
    }
@@ -1227,7 +1227,7 @@ intel_resolve_for_dri2_flush(struct brw_context *brw,
       if (rb == NULL || rb->mt == NULL)
          continue;
       if (rb->mt->num_samples <= 1)
-         intel_miptree_resolve_color(brw, rb->mt);
+         intel_miptree_resolve_color(brw, rb->mt, 0);
       else
          intel_renderbuffer_downsample(brw, rb);
    }
index 6d29fbdde216824b61a679d948163c279428b2fd..72cf9af5b53a12d1956287e27c6771fa0ed24c93 100644 (file)
@@ -317,8 +317,8 @@ intel_miptree_blit(struct brw_context *brw,
     */
    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);
-   intel_miptree_resolve_color(brw, dst_mt);
+   intel_miptree_resolve_color(brw, src_mt, 0);
+   intel_miptree_resolve_color(brw, dst_mt, 0);
 
    if (src_flip)
       src_y = minify(src_mt->physical_height0, src_level - src_mt->first_level) - src_y - height;
index dbbac1c95a2a4360fb0a4fe95a7cad9a4e3540d3..08b7623e63dc88e309874d974fade8e7f1e2bf70 100644 (file)
@@ -270,11 +270,11 @@ intel_copy_image_sub_data(struct gl_context *ctx,
     */
    intel_miptree_all_slices_resolve_hiz(brw, src_mt);
    intel_miptree_all_slices_resolve_depth(brw, src_mt);
-   intel_miptree_resolve_color(brw, src_mt);
+   intel_miptree_resolve_color(brw, src_mt, 0);
 
    intel_miptree_all_slices_resolve_hiz(brw, dst_mt);
    intel_miptree_all_slices_resolve_depth(brw, dst_mt);
-   intel_miptree_resolve_color(brw, dst_mt);
+   intel_miptree_resolve_color(brw, dst_mt, 0);
 
    _mesa_get_format_block_size(src_mt->format, &bw, &bh);
 
index 5f739d9cac575744f606b1028cf099f77cfffb27..1f4c59b6cc3773a3273c383394a5d372be562c78 100644 (file)
@@ -2012,8 +2012,11 @@ intel_miptree_all_slices_resolve_depth(struct brw_context *brw,
 
 void
 intel_miptree_resolve_color(struct brw_context *brw,
-                            struct intel_mipmap_tree *mt)
+                            struct intel_mipmap_tree *mt,
+                            int flags)
 {
+   (void)flags;
+
    switch (mt->fast_clear_state) {
    case INTEL_FAST_CLEAR_STATE_NO_MCS:
    case INTEL_FAST_CLEAR_STATE_RESOLVED:
@@ -2050,7 +2053,7 @@ intel_miptree_make_shareable(struct brw_context *brw,
    assert(mt->msaa_layout == INTEL_MSAA_LAYOUT_NONE);
 
    if (mt->mcs_mt) {
-      intel_miptree_resolve_color(brw, mt);
+      intel_miptree_resolve_color(brw, mt, 0);
       intel_miptree_release(&mt->mcs_mt);
       mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_NO_MCS;
    }
@@ -2158,7 +2161,7 @@ intel_miptree_map_raw(struct brw_context *brw, struct intel_mipmap_tree *mt)
    /* CPU accesses to color buffers don't understand fast color clears, so
     * resolve any pending fast color clears before we map.
     */
-   intel_miptree_resolve_color(brw, mt);
+   intel_miptree_resolve_color(brw, mt, 0);
 
    drm_intel_bo *bo = mt->bo;
 
index 64f73ea9ae5b5315d8ccf0cbc3d86bbf9a2977c5..08cb1b8fb39b2a90eb5c7c4668fa73e64cb20eea 100644 (file)
@@ -886,7 +886,8 @@ intel_miptree_used_for_rendering(struct intel_mipmap_tree *mt)
 
 void
 intel_miptree_resolve_color(struct brw_context *brw,
-                            struct intel_mipmap_tree *mt);
+                            struct intel_mipmap_tree *mt,
+                            int flags);
 
 void
 intel_miptree_make_shareable(struct brw_context *brw,
index 699e48a297c65cb1a74fcfbdbcec51ba9634aa94..54a741395eb611847909f2cf25463df4c4a0779e 100644 (file)
@@ -257,7 +257,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);
+   intel_miptree_resolve_color(brw, irb->mt, 0);
 
    /* Chop it all into chunks that can be digested by hardware: */
    for (py = 0; py < height; py += DY) {
index 10d14623fe1fe5d0ddec3530c3c455625ff8b01e..31030b1b4ead0e8b38af35ef03de3f217cd5875d 100644 (file)
@@ -155,7 +155,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);
+   intel_miptree_resolve_color(brw, irb->mt, 0);
 
    bo = irb->mt->bo;
 
index 5d32a4ce650cbe45f3596e0e5fe68418b9afb038..e21c3ac543fd418d3229eeef5dd6bfe0f6fb0b1b 100644 (file)
@@ -423,7 +423,7 @@ intel_gettexsubimage_tiled_memcpy(struct gl_context *ctx,
    /* Since we are going to write raw data to the miptree, we need to resolve
     * any pending fast color clears before we start.
     */
-   intel_miptree_resolve_color(brw, image->mt);
+   intel_miptree_resolve_color(brw, image->mt, 0);
 
    bo = image->mt->bo;
 
index 970ded1e66b7d9177335f053e7a122fb81471ba8..573f701acdd4d49f4d3299dda24fa52f96e69bd7 100644 (file)
@@ -140,7 +140,7 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
    /* Since we are going to write raw data to the miptree, we need to resolve
     * any pending fast color clears before we start.
     */
-   intel_miptree_resolve_color(brw, image->mt);
+   intel_miptree_resolve_color(brw, image->mt, 0);
 
    bo = image->mt->bo;