diff options
author | Topi Pohjolainen <topi.pohjolainen@intel.com> | 2016-04-19 09:01:10 +0300 |
---|---|---|
committer | Topi Pohjolainen <topi.pohjolainen@intel.com> | 2016-05-12 19:49:26 +0300 |
commit | 84066ebd6330b50e7628bdb0a40763e10e5f12d7 (patch) | |
tree | b27ef3dff0cb021dd29e42987ae29aeefd3635bc /src/mesa/drivers/dri/i965/intel_mipmap_tree.c | |
parent | 1ca02b6ebb424489d7c16be26a9f96359bbce25a (diff) | |
download | external_mesa3d-84066ebd6330b50e7628bdb0a40763e10e5f12d7.zip external_mesa3d-84066ebd6330b50e7628bdb0a40763e10e5f12d7.tar.gz external_mesa3d-84066ebd6330b50e7628bdb0a40763e10e5f12d7.tar.bz2 |
i965: Deferred allocation of mcs for lossless compressed
Until now mcs was associated to single sampled buffers only for
fast clear purposes and it was therefore the responsibility of the
clear logic to allocate the aux buffer when needed. Now that normal
3D render or blorp blit may render with mcs enabled also, they need
to prepare the mcs just as well.
v2: Do not enable for scanout buffers
v3 (Ben):
- Fix typo in commit message.
- Check for gen < 9 and return early in brw_predraw_set_aux_buffers()
- Check for gen < 9 and return early in intel_miptree_prepare_mcs()
v4: Check for msaa_layput and number of samples to determine if
lossless compression is to used. Otherwise one cannot distuingish
between fast clear with and without compression.
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Diffstat (limited to 'src/mesa/drivers/dri/i965/intel_mipmap_tree.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c index 8f6dc24..0b432ec 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c @@ -1622,6 +1622,46 @@ intel_miptree_alloc_non_msrt_mcs(struct brw_context *brw, return mt->mcs_mt; } +void +intel_miptree_prepare_mcs(struct brw_context *brw, + struct intel_mipmap_tree *mt) +{ + if (mt->mcs_mt) + return; + + if (brw->gen < 9) + return; + + /* Single sample compression is represented re-using msaa compression + * layout type: "Compressed Multisampled Surfaces". + */ + if (mt->msaa_layout != INTEL_MSAA_LAYOUT_CMS || mt->num_samples > 1) + return; + + /* Clients are not currently capable of consuming compressed + * single-sampled buffers. + */ + if (mt->is_scanout) + return; + + assert(intel_tiling_supports_non_msrt_mcs(brw, mt->tiling) || + intel_miptree_supports_lossless_compressed(brw, mt)); + + /* Consider if lossless compression is supported but the needed + * auxiliary buffer doesn't exist yet. + * + * Failing to allocate the auxiliary buffer means running out of + * memory. The pointer to the aux miptree is left NULL which should + * signal non-compressed behavior. + */ + if (!intel_miptree_alloc_non_msrt_mcs(brw, mt)) { + _mesa_warning(NULL, + "Failed to allocated aux buffer for lossless" + " compressed %p %u:%u %s\n", + mt, mt->logical_width0, mt->logical_height0, + _mesa_get_format_name(mt->format)); + } +} /** * Helper for intel_miptree_alloc_hiz() that sets |