diff --git a/src/intel/blorp/blorp_clear.c b/src/intel/blorp/blorp_clear.c index a13d817f118..f7d24141be9 100644 --- a/src/intel/blorp/blorp_clear.c +++ b/src/intel/blorp/blorp_clear.c @@ -396,6 +396,41 @@ get_fast_clear_rect(const struct isl_device *dev, *y1 = ALIGN(*y1, y_align) / y_scaledown; } +static void +convert_rt_from_3d_to_2d(const struct isl_device *isl_dev, + struct blorp_surface_info *info) +{ + assert(info->surf.dim == ISL_SURF_DIM_3D); + assert(info->surf.dim_layout == ISL_DIM_LAYOUT_GFX4_2D); + + /* Some tilings have different swizzling between 2D/3D images. So, + * conversion would not be possible. + */ + assert(!isl_tiling_is_std_y(info->surf.tiling)); + assert(!isl_tiling_is_64(info->surf.tiling)); + + /* Convert from 3D to 2D-array. */ + uint32_t array_pitch_el_rows = info->surf.array_pitch_el_rows; + uint64_t size_B = info->surf.size_B; + bool ok = isl_surf_init(isl_dev, &info->surf, + .dim = ISL_SURF_DIM_2D, + .format = info->surf.format, + .width = info->surf.logical_level0_px.w, + .height = info->surf.logical_level0_px.h, + .depth = 1, + .levels = info->surf.levels, + .array_len = info->surf.logical_level0_px.d, + .samples = 1, + .row_pitch_B = info->surf.row_pitch_B, + .usage = info->surf.usage, + .tiling_flags = (1 << info->surf.tiling)); + assert(ok); + + /* Fix up the array-pitch and size. */ + info->surf.array_pitch_el_rows = array_pitch_el_rows; + info->surf.size_B = size_B; +} + void blorp_fast_clear(struct blorp_batch *batch, const struct blorp_surf *surf, @@ -451,6 +486,16 @@ blorp_fast_clear(struct blorp_batch *batch, blorp_surface_info_init(batch, ¶ms.dst, surf, level, start_layer, format, true); + + /* BSpec: 46969 (r45602): + * + * 3D/Volumetric surfaces do not support Fast Clear operation. + */ + if (ISL_GFX_VERX10(batch->blorp->isl_dev) == 120 && + params.dst.surf.dim == ISL_SURF_DIM_3D) { + convert_rt_from_3d_to_2d(batch->blorp->isl_dev, ¶ms.dst); + } + params.num_samples = params.dst.surf.samples; assert(params.num_samples != 0); @@ -1147,6 +1192,23 @@ blorp_ccs_resolve(struct blorp_batch *batch, blorp_surface_info_init(batch, ¶ms.dst, surf, level, start_layer, format, true); + /* From the TGL PRM, Volume 2d: 3DSTATE_PS_BODY, + * + * 3D/Volumetric surfaces do not support Fast Clear operation. + * + * [...] + * + * 3D/Volumetric surfaces do not support in-place resolve pass + * operation. + * + * HSD 1406738321 suggests a more limited scope of restrictions, but + * there should be no harm in complying with the Bspec restrictions. + */ + if (ISL_GFX_VERX10(batch->blorp->isl_dev) == 120 && + params.dst.surf.dim == ISL_SURF_DIM_3D) { + convert_rt_from_3d_to_2d(batch->blorp->isl_dev, ¶ms.dst); + } + params.x0 = params.y0 = 0; params.x1 = u_minify(params.dst.surf.logical_level0_px.width, level); params.y1 = u_minify(params.dst.surf.logical_level0_px.height, level); diff --git a/src/intel/blorp/blorp_genX_exec_brw.h b/src/intel/blorp/blorp_genX_exec_brw.h index 37ecd27685d..4dbf16d0422 100644 --- a/src/intel/blorp/blorp_genX_exec_brw.h +++ b/src/intel/blorp/blorp_genX_exec_brw.h @@ -793,25 +793,10 @@ blorp_emit_ps_config(struct blorp_batch *batch, ps.RenderTargetResolveType = RESOLVE_PARTIAL; break; case ISL_AUX_OP_FULL_RESOLVE: - /* WA 1406738321: - * In-place full resolve of a 3D/Volume surface is not supported. - * In order to fully resolve 3D/volume surface, copy operation must be - * performed to a new destination (declared as uncompressed) using the - * compressed 3D surface as a source. - */ -#if GFX_VERx10 == 120 - assert(params->src.surf.dim != ISL_SURF_DIM_3D); -#endif ps.RenderTargetResolveType = RESOLVE_FULL; break; #endif /* GFX_VER < 20 */ case ISL_AUX_OP_FAST_CLEAR: - /* WA 1406738321: - * 3D/Volumetric surfaces do not support Fast Clear operation. - */ -#if GFX_VERx10 == 120 - assert(params->dst.surf.dim != ISL_SURF_DIM_3D); -#endif ps.RenderTargetFastClearEnable = true; break; default: @@ -819,6 +804,21 @@ blorp_emit_ps_config(struct blorp_batch *batch, } #if GFX_VERx10 == 120 + /* The 3DSTATE_PS_BODY page for TGL says: + * + * 3D/Volumetric surfaces do not support Fast Clear operation. + * + * [...] + * + * 3D/Volumetric surfaces do not support in-place resolve pass + * operation. + * + * HSD 1406738321 suggests a more limited scope of restrictions, but + * there should be no harm in complying with the Bspec restrictions. + */ + if (params->dst.surf.dim == ISL_SURF_DIM_3D) + assert(params->fast_clear_op == ISL_AUX_OP_NONE); + /* The RENDER_SURFACE_STATE page for TGL says: * * For an 8 bpp surface with NUM_MULTISAMPLES = 1, Surface Width not diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c index 98e75436f7b..617ce7cc0e0 100644 --- a/src/intel/isl/isl.c +++ b/src/intel/isl/isl.c @@ -3184,12 +3184,6 @@ isl_surf_supports_ccs(const struct isl_device *dev, /* Single-sampled color can't have MCS or HiZ */ assert(hiz_or_mcs_surf == NULL || hiz_or_mcs_surf->size_B == 0); - /* Wa_1406738321: 3D textures need a blit to a new surface - * in order to perform a resolve. For now, just disable CCS on TGL. - */ - if (dev->info->verx10 == 120 && surf->dim == ISL_SURF_DIM_3D) - return false; - /* From Bspec 49252, Render Decompression: * * "Compressed displayable surfaces must be 16KB aligned and have