From 0607ca42da5fdb79b64445e34c642925e94354de Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 31 May 2017 10:06:31 -0700 Subject: [PATCH] i965: Be a bit more conservative about certain resolves There are several places where we were resolving the entire miptree when we really only needed to resolve a single slice. Let's avoid the unneeded resolving. Reviewed-by: Topi Pohjolainen Reviewed-by: Chad Versace --- src/mesa/drivers/dri/i965/intel_pixel_bitmap.c | 3 ++- src/mesa/drivers/dri/i965/intel_pixel_read.c | 3 ++- src/mesa/drivers/dri/i965/intel_tex_image.c | 7 ++++--- src/mesa/drivers/dri/i965/intel_tex_subimage.c | 7 ++++--- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/mesa/drivers/dri/i965/intel_pixel_bitmap.c b/src/mesa/drivers/dri/i965/intel_pixel_bitmap.c index 4522d28a4e1..f79863e3493 100644 --- a/src/mesa/drivers/dri/i965/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/i965/intel_pixel_bitmap.c @@ -256,7 +256,8 @@ 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_all_slices_resolve_color(brw, irb->mt, 0); + intel_miptree_resolve_color(brw, irb->mt, irb->mt_level, 1, + irb->mt_layer, 1, 0); /* Chop it all into chunks that can be digested by hardware: */ for (py = 0; py < height; py += DY) { diff --git a/src/mesa/drivers/dri/i965/intel_pixel_read.c b/src/mesa/drivers/dri/i965/intel_pixel_read.c index 7074d7db9a2..7892b37a077 100644 --- a/src/mesa/drivers/dri/i965/intel_pixel_read.c +++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c @@ -147,7 +147,8 @@ 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_all_slices_resolve_color(brw, irb->mt, 0); + intel_miptree_resolve_color(brw, irb->mt, irb->mt_level, 1, + irb->mt_layer, 1, 0); bo = irb->mt->bo; diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c b/src/mesa/drivers/dri/i965/intel_tex_image.c index 77e09e83a58..8cd1eae296b 100644 --- a/src/mesa/drivers/dri/i965/intel_tex_image.c +++ b/src/mesa/drivers/dri/i965/intel_tex_image.c @@ -533,10 +533,13 @@ intel_gettexsubimage_tiled_memcpy(struct gl_context *ctx, if (brw->gen < 5 && brw->has_swizzling) return false; + int level = texImage->Level + texImage->TexObject->MinLevel; + /* 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_all_slices_resolve_color(brw, image->mt, 0); + assert(image->mt->logical_depth0 == 1); + intel_miptree_resolve_color(brw, image->mt, level, 1, 0, 1, 0); bo = image->mt->bo; @@ -561,8 +564,6 @@ intel_gettexsubimage_tiled_memcpy(struct gl_context *ctx, packing->Alignment, packing->RowLength, packing->SkipPixels, packing->SkipRows); - int level = texImage->Level + texImage->TexObject->MinLevel; - /* Adjust x and y offset based on miplevel */ xoffset += image->mt->level[level].level_x; yoffset += image->mt->level[level].level_y; diff --git a/src/mesa/drivers/dri/i965/intel_tex_subimage.c b/src/mesa/drivers/dri/i965/intel_tex_subimage.c index e9c7b802b11..caa673001fd 100644 --- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c +++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c @@ -145,10 +145,13 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx, if (brw->gen < 5 && brw->has_swizzling) return false; + int level = texImage->Level + texImage->TexObject->MinLevel; + /* 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_all_slices_resolve_color(brw, image->mt, 0); + assert(image->mt->logical_depth0 == 1); + intel_miptree_resolve_color(brw, image->mt, level, 1, 0, 1, 0); bo = image->mt->bo; @@ -177,8 +180,6 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx, packing->Alignment, packing->RowLength, packing->SkipPixels, packing->SkipRows, for_glTexImage); - int level = texImage->Level + texImage->TexObject->MinLevel; - /* Adjust x and y offset based on miplevel */ xoffset += image->mt->level[level].level_x; yoffset += image->mt->level[level].level_y; -- 2.30.2