diff --git a/src/gallium/drivers/iris/iris_blit.c b/src/gallium/drivers/iris/iris_blit.c index 475e2b63c3a..32a5e8e38df 100644 --- a/src/gallium/drivers/iris/iris_blit.c +++ b/src/gallium/drivers/iris/iris_blit.c @@ -262,7 +262,8 @@ iris_blorp_surf_for_resource(struct iris_batch *batch, static bool is_astc(enum isl_format format) { - return isl_format_get_layout(format)->txc == ISL_TXC_ASTC; + return format != ISL_FORMAT_UNSUPPORTED && + isl_format_get_layout(format)->txc == ISL_TXC_ASTC; } static void @@ -686,8 +687,13 @@ iris_copy_region(struct blorp_context *blorp, enum isl_aux_usage dst_aux_usage = copy_region_aux_usage(ice, batch, dst_res, dst_fmt, dst_level, true); - if (iris_batch_references(batch, src_res->bo)) - tex_cache_flush_hack(batch, src_fmt, src_res->surf.format); + if (iris_batch_references(batch, src_res->bo)) { + /* blorp_copy_get_formats() is only valid for compressed surfaces. */ + tex_cache_flush_hack(batch, + src_aux_usage == ISL_AUX_USAGE_NONE ? + ISL_FORMAT_UNSUPPORTED : src_fmt, + src_res->surf.format); + } if (dst->target == PIPE_BUFFER) util_range_add(&dst_res->base.b, &dst_res->valid_buffer_range, dstx, dstx + src_box->width); diff --git a/src/intel/blorp/blorp.h b/src/intel/blorp/blorp.h index 3c29100d383..0ec501a80d4 100644 --- a/src/intel/blorp/blorp.h +++ b/src/intel/blorp/blorp.h @@ -255,10 +255,16 @@ blorp_blit(struct blorp_batch *batch, enum blorp_filter filter, bool mirror_x, bool mirror_y); +/* Returns the format the blorp_copy() call can be assumed to use if it + * receives a blorp surface which enables lossless compression. + */ enum isl_format blorp_copy_get_color_format(const struct isl_device *isl_dev, enum isl_format surf_format); +/* Returns the format the blorp_copy() call can be assumed to use if it + * receives a blorp surface which enables lossless compression. + */ void blorp_copy_get_formats(const struct isl_device *isl_dev, const struct isl_surf *src_surf, diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c index db8a607a926..0c353509692 100644 --- a/src/intel/blorp/blorp_blit.c +++ b/src/intel/blorp/blorp_blit.c @@ -3007,6 +3007,10 @@ blorp_copy(struct blorp_batch *batch, params.src.aux_usage == ISL_AUX_USAGE_FCV_CCS_E || params.src.aux_usage == ISL_AUX_USAGE_STC_CCS); + /* The public interface states that the value returned by the format query + * is valid for losslessly compressed surfaces. Internally, we're free to + * use it as a starting point for all surfaces. + */ blorp_copy_get_formats(isl_dev, ¶ms.src.surf, ¶ms.dst.surf, ¶ms.src.view.format, ¶ms.dst.view.format);