[Mesa-dev] [PATCH 31/32] i965: Remove scanout restriction from lossless compression

Ben Widawsky ben at bwidawsk.net
Fri Jan 6 00:14:17 UTC 2017


On 17-01-05 17:55:15, Topi Pohjolainen Topi Pohjolainen wrote:
>On Wed, Jan 04, 2017 at 06:36:05PM -0800, Ben Widawsky wrote:
>> On 17-01-04 10:41:58, Topi Pohjolainen Topi Pohjolainen wrote:
>> > On Mon, Jan 02, 2017 at 06:37:22PM -0800, Ben Widawsky wrote:
>> > > v2: Try to keep the assert as recommended by Topi. This requires
>> > > modifying the num_samples check to be <= 1 because internally created
>> > > buffers set num_samples = 0.
>> > >
>> > > Cc: Topi Pohjolainen <topi.pohjolainen at intel.com>
>> > > Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
>> > > Acked-by: Daniel Stone <daniels at collabora.com>
>> > > ---
>> > >  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 16 +++++++++-------
>> > >  1 file changed, 9 insertions(+), 7 deletions(-)
>> > >
>> > > diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
>> > > index 749d346386..6c34b302e1 100644
>> > > --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
>> > > +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
>> > > @@ -157,7 +157,7 @@ intel_miptree_supports_non_msrt_fast_clear(struct brw_context *brw,
>> > >     if (mt->aux_disable & INTEL_AUX_DISABLE_MCS)
>> > >        return false;
>> > >
>> > > -   if (mt->is_scanout)
>> > > +   if (mt->is_scanout && mt->msaa_layout != INTEL_MSAA_LAYOUT_CMS)
>> > >        return false;
>> > >
>> > >     /* This function applies only to non-multisampled render targets. */
>> > > @@ -526,8 +526,12 @@ intel_miptree_create_layout(struct brw_context *brw,
>> > >        layout_flags |= MIPTREE_LAYOUT_FORCE_HALIGN16;
>> > >     } else {
>> > >        const UNUSED bool is_lossless_compressed_aux =
>> > > -         brw->gen >= 9 && num_samples == 1 &&
>> > > -         mt->format == MESA_FORMAT_R_UINT32;
>> > > +         brw->gen >= 9 &&
>> > > +         /* Is lossless compressed texture */
>> > > +         ((num_samples == 1 && mt->format == MESA_FORMAT_R_UINT32) ||
>> > > +          /* Is lossless compressed scanout */
>> >
>> > Does MIPTREE_LAYOUT_FOR_SCANOUT find its way here?
>> >
>>
>> Yes? How would you like it, assert? I think it should be fine to add this.
>
>I was about to suggest this instead:
>
>        const UNUSED bool is_lossless_compressed_tex_aux =
>           num_samples == 1 && mt->format == MESA_FORMAT_R_UINT32;
>        const UNUSED bool is_lossless_compressed_scanout_aux =
>           (layout_flags & MIPTREE_LAYOUT_FOR_SCANOUT) && num_samples == 0 &&
>           (mt->format == MESA_FORMAT_B8G8R8X8_UNORM ||
>            mt->format == MESA_FORMAT_R8G8B8X8_UNORM);
>        const UNUSED bool is_lossless_compressed_aux =
>           brw->gen >= 9 &&
>           (is_lossless_compressed_tex_aux ||
>            is_lossless_compressed_scanout_aux);
>
>
>But then I realized that this already existing is_lossless_compressed_aux
>logic is dead code. We don't currently allocate miptree for mcs_buf at all.
>So would you mind adding a small patch removing the existing before adding
>the scanout assert? Sorry for the churn :(
>

Oops. Sure.

>>
>> > > +         (num_samples == 0 && (mt->format == MESA_FORMAT_B8G8R8X8_UNORM ||
>> > > +                               mt->format == MESA_FORMAT_R8G8B8X8_UNORM)));
>> > >
>> > >        /* For now, nothing else has this requirement */
>> > >        assert(is_lossless_compressed_aux ||
>> > > @@ -752,11 +756,9 @@ intel_miptree_create(struct brw_context *brw,
>> > >         * resolves.
>> > >         */
>> > >        const bool lossless_compression_disabled = INTEL_DEBUG & DEBUG_NO_RBC;
>> > > -      assert(!mt->is_scanout);
>> > >        const bool is_lossless_compressed =
>> > >           unlikely(!lossless_compression_disabled) &&
>> > > -         brw->gen >= 9 && !mt->is_scanout &&
>> > > -         intel_miptree_supports_lossless_compressed(brw, mt);
>> > > +         brw->gen >= 9 && intel_miptree_supports_lossless_compressed(brw, mt);
>> > >
>> > >        if (is_lossless_compressed) {
>> > >           intel_miptree_alloc_non_msrt_mcs(brw, mt, is_lossless_compressed);
>> > > @@ -1058,7 +1060,7 @@ intel_miptree_release(struct intel_mipmap_tree **mt)
>> > >        intel_miptree_release(&(*mt)->stencil_mt);
>> > >        intel_miptree_release(&(*mt)->r8stencil_mt);
>> > >        intel_miptree_hiz_buffer_free((*mt)->hiz_buf);
>> > > -      if ((*mt)->mcs_buf && !(*mt)->is_scanout) {
>> > > +      if ((*mt)->mcs_buf) {
>> > >           drm_intel_bo_unreference((*mt)->mcs_buf->bo);
>> > >           free((*mt)->mcs_buf);
>> > >        }
>> > > --
>> > > 2.11.0
>> > >
>> > > _______________________________________________
>> > > mesa-dev mailing list
>> > > mesa-dev at lists.freedesktop.org
>> > > https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list