Browse Source

iris: Resolve stencil buffer lossless compression with WM_HZ_OP packet

Even though stencil buffer compression looks like regular lossless color
compression w/o fast clear support, we have to resolve stencil buffer
with WM_HZ_OP packet.

v2: Check if resource is stencil with helper function (Nanley Chery)

v3: Remove unnecessary included file (Nanley Chery)

v4: (Nanley Chery)
- Avoid stencil buffer aux state transition by improving condition check

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
tags/19.3-branchpoint
Sagar Ghuge 6 years ago
parent
commit
b8223991b5
1 changed files with 13 additions and 9 deletions
  1. 13
    9
      src/gallium/drivers/iris/iris_resolve.c

+ 13
- 9
src/gallium/drivers/iris/iris_resolve.c View File

} }


if (s_res) { if (s_res) {
if (may_have_resolved_depth) {
if (may_have_resolved_depth && ice->state.stencil_writes_enabled) {
iris_resource_finish_write(ice, s_res, zs_surf->u.tex.level, iris_resource_finish_write(ice, s_res, zs_surf->u.tex.level,
zs_surf->u.tex.first_layer, num_layers, zs_surf->u.tex.first_layer, num_layers,
ISL_AUX_USAGE_NONE);
s_res->aux.usage);
} }


if (ice->state.stencil_writes_enabled) if (ice->state.stencil_writes_enabled)


struct blorp_batch blorp_batch; struct blorp_batch blorp_batch;
blorp_batch_init(&ice->blorp, &blorp_batch, batch, 0); blorp_batch_init(&ice->blorp, &blorp_batch, batch, 0);
blorp_ccs_resolve(&blorp_batch, &surf, level, layer, 1,
isl_format_srgb_to_linear(res->surf.format),
resolve_op);
/* On Gen >= 12, Stencil buffer with lossless compression needs to be
* resolve with WM_HZ_OP packet.
*/
if (isl_surf_usage_is_stencil(res->surf.usage)) {
blorp_hiz_stencil_op(&blorp_batch, &surf, level, layer,
1, resolve_op);
} else {
blorp_ccs_resolve(&blorp_batch, &surf, level, layer, 1,
isl_format_srgb_to_linear(res->surf.format),
resolve_op);
}
blorp_batch_finish(&blorp_batch); blorp_batch_finish(&blorp_batch);


/* See comment above */ /* See comment above */


if (res->surf.usage & ISL_SURF_USAGE_DEPTH_BIT) { if (res->surf.usage & ISL_SURF_USAGE_DEPTH_BIT) {
assert(iris_resource_level_has_hiz(res, level)); assert(iris_resource_level_has_hiz(res, level));
} else if (res->surf.usage & ISL_SURF_USAGE_STENCIL_BIT) {
unreachable("Cannot get aux state for stencil");
} else { } else {
assert(res->surf.samples == 1 || assert(res->surf.samples == 1 ||
res->surf.msaa_layout == ISL_MSAA_LAYOUT_ARRAY); res->surf.msaa_layout == ISL_MSAA_LAYOUT_ARRAY);


if (res->surf.usage & ISL_SURF_USAGE_DEPTH_BIT) { if (res->surf.usage & ISL_SURF_USAGE_DEPTH_BIT) {
assert(iris_resource_level_has_hiz(res, level)); assert(iris_resource_level_has_hiz(res, level));
} else if (res->surf.usage & ISL_SURF_USAGE_STENCIL_BIT) {
unreachable("Cannot set aux state for stencil");
} else { } else {
assert(res->surf.samples == 1 || assert(res->surf.samples == 1 ||
res->surf.msaa_layout == ISL_MSAA_LAYOUT_ARRAY); res->surf.msaa_layout == ISL_MSAA_LAYOUT_ARRAY);

Loading…
Cancel
Save