From 1aa4e6bac0245ce70466760cdabd1bc2c24776e2 Mon Sep 17 00:00:00 2001 From: Nanley Chery Date: Wed, 7 Jun 2023 15:49:31 -0400 Subject: [PATCH] iris: Create BLORP surfaces after resource preparation iris_resource_prepare_render will soon gain the ability to change a resource's clear color. iris_blorp_surf_for_resource will keep a copy of that clear color, so make sure calls to it happen after the render preparation helper. At the moment, this shouldn't have an impact besides improving debugging. While we're here, do the same for the generic access preparation helper. We may convert those to more specific helpers at a later time. Reviewed-by: Lionel Landwerlin Part-of: --- src/gallium/drivers/iris/iris_blit.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/iris/iris_blit.c b/src/gallium/drivers/iris/iris_blit.c index 8eb2062a5df..482b24980b5 100644 --- a/src/gallium/drivers/iris/iris_blit.c +++ b/src/gallium/drivers/iris/iris_blit.c @@ -508,6 +508,12 @@ iris_blit(struct pipe_context *ctx, const struct pipe_blit_info *info) iris_resource_render_aux_usage(ice, dst_res, dst_fmt.fmt, info->dst.level, false); + iris_resource_prepare_render(ice, dst_res, dst_fmt.fmt, info->dst.level, + info->dst.box.z, info->dst.box.depth, + dst_aux_usage); + iris_emit_buffer_barrier_for(batch, dst_res->bo, + IRIS_DOMAIN_RENDER_WRITE); + struct blorp_surf src_surf, dst_surf; iris_blorp_surf_for_resource(&screen->isl_dev, &src_surf, &src_res->base.b, src_aux_usage, @@ -516,12 +522,6 @@ iris_blit(struct pipe_context *ctx, const struct pipe_blit_info *info) &dst_res->base.b, dst_aux_usage, info->dst.level, true); - iris_resource_prepare_render(ice, dst_res, dst_fmt.fmt, info->dst.level, - info->dst.box.z, info->dst.box.depth, - dst_aux_usage); - iris_emit_buffer_barrier_for(batch, dst_res->bo, - IRIS_DOMAIN_RENDER_WRITE); - if (iris_batch_references(batch, src_res->bo)) tex_cache_flush_hack(batch, src_fmt.fmt, src_res->surf.format); @@ -730,12 +730,6 @@ iris_copy_region(struct blorp_context *blorp, } else { // XXX: what about one surface being a buffer and not the other? - struct blorp_surf src_surf, dst_surf; - iris_blorp_surf_for_resource(&screen->isl_dev, &src_surf, - src, src_aux_usage, src_level, false); - iris_blorp_surf_for_resource(&screen->isl_dev, &dst_surf, - dst, dst_aux_usage, dst_level, true); - iris_resource_prepare_access(ice, src_res, src_level, 1, src_box->z, src_box->depth, src_aux_usage, src_clear_supported); @@ -747,6 +741,12 @@ iris_copy_region(struct blorp_context *blorp, IRIS_DOMAIN_SAMPLER_READ); iris_emit_buffer_barrier_for(batch, dst_res->bo, write_domain); + struct blorp_surf src_surf, dst_surf; + iris_blorp_surf_for_resource(&screen->isl_dev, &src_surf, + src, src_aux_usage, src_level, false); + iris_blorp_surf_for_resource(&screen->isl_dev, &dst_surf, + dst, dst_aux_usage, dst_level, true); + for (int slice = 0; slice < src_box->depth; slice++) { iris_batch_maybe_flush(batch, 1500);