[Mesa-dev] [PATCH 17/29] i965/blorp: Remove a pile of blorp_blit restrictions

Pohjolainen, Topi topi.pohjolainen at gmail.com
Tue Mar 6 08:15:55 UTC 2018


On Fri, Jan 26, 2018 at 05:59:46PM -0800, Jason Ekstrand wrote:
> Previously, blorp could only blit into something that was renderable.
> Thanks to recent additions to blorp, it can now blit into basically
> anything so long as it isn't compressed.
> ---
>  src/mesa/drivers/dri/i965/brw_blorp.c | 67 +++++++++++++++++------------------
>  1 file changed, 33 insertions(+), 34 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c
> index 82d9de1..b3b007f 100644
> --- a/src/mesa/drivers/dri/i965/brw_blorp.c
> +++ b/src/mesa/drivers/dri/i965/brw_blorp.c
> @@ -199,6 +199,26 @@ blorp_surf_for_miptree(struct brw_context *brw,
>     *level -= mt->first_level;
>  }
>  
> +static bool
> +brw_blorp_supports_dst_format(struct brw_context *brw, mesa_format format)
> +{
> +   /* If it's renderable, it's definitely supported. */
> +   if (brw->mesa_format_supports_render[format])
> +      return true;
> +
> +   /* BLORP can't compress anything */
> +   if (_mesa_is_format_compressed(format))
> +      return false;
> +
> +   /* No exotic formats such as GL_LUMINANCE_ALPHA */
> +   if (_mesa_get_format_bits(format, GL_RED_BITS) == 0 &&
> +       _mesa_get_format_bits(format, GL_DEPTH_BITS) == 0 &&
> +       _mesa_get_format_bits(format, GL_STENCIL_BITS) == 0)
> +      return false;
> +
> +   return true;
> +}
> +
>  static enum isl_format
>  brw_blorp_to_isl_format(struct brw_context *brw, mesa_format format,
>                          bool is_render_target)
> @@ -216,15 +236,20 @@ brw_blorp_to_isl_format(struct brw_context *brw, mesa_format format,
>        return ISL_FORMAT_R32_FLOAT;
>     case MESA_FORMAT_Z_UNORM16:
>        return ISL_FORMAT_R16_UNORM;
> -   default: {
> +   default:
>        if (is_render_target) {
> -         assert(brw->mesa_format_supports_render[format]);
> -         return brw->mesa_to_isl_render_format[format];
> +         assert(brw_blorp_supports_dst_format(brw, format));
> +         if (brw->mesa_format_supports_render[format]) {
> +            return brw->mesa_to_isl_render_format[format];
> +         } else {
> +            return brw_isl_format_for_mesa_format(format);
> +         }
>        } else {
> +         /* Some destinations (is_render_target == true) are supported by

I didn't really understand this comment, this is inside block where
"is_render_target == false".

> +          * blorp even though we technically can't render to them.
> +          */
>           return brw_isl_format_for_mesa_format(format);
>        }
> -      break;
> -   }
>     }
>  }
>  
> @@ -553,14 +578,6 @@ try_blorp_blit(struct brw_context *brw,
>        src_mt = find_miptree(buffer_bit, src_irb);
>        dst_mt = find_miptree(buffer_bit, dst_irb);
>  
> -      /* We can't handle format conversions between Z24 and other formats
> -       * since we have to lie about the surface format. See the comments in
> -       * brw_blorp_surface_info::set().
> -       */
> -      if ((src_mt->format == MESA_FORMAT_Z24_UNORM_X8_UINT) !=
> -          (dst_mt->format == MESA_FORMAT_Z24_UNORM_X8_UINT))
> -         return false;
> -
>        /* We also can't handle any combined depth-stencil formats because we
>         * have to reinterpret as a color format.
>         */
> @@ -629,32 +646,14 @@ brw_blorp_copytexsubimage(struct brw_context *brw,
>     struct intel_mipmap_tree *src_mt = src_irb->mt;
>     struct intel_mipmap_tree *dst_mt = intel_image->mt;
>  
> -   /* There is support for only up to eight samples. */
> -   if (src_mt->surf.samples > 8 || dst_mt->surf.samples > 8)
> -      return false;

Previous patches only dealt with formats and I fail to see how they enable
samples > 8. We probably can, to me it just seems that this is because of
something else than changes in this series. Or did I miss something?

> -
> -   if (_mesa_get_format_base_format(src_rb->Format) !=
> -       _mesa_get_format_base_format(dst_image->TexFormat)) {
> -      return false;
> -   }
> -
> -   /* We can't handle format conversions between Z24 and other formats since
> -    * we have to lie about the surface format.  See the comments in
> -    * brw_blorp_surface_info::set().
> -    */
> -   if ((src_mt->format == MESA_FORMAT_Z24_UNORM_X8_UINT) !=
> -       (dst_mt->format == MESA_FORMAT_Z24_UNORM_X8_UINT)) {
> -      return false;
> -   }
> -
> -   /* We also can't handle any combined depth-stencil formats because we
> -    * have to reinterpret as a color format.
> +   /* We can't handle any combined depth-stencil formats because we have to
> +    * reinterpret as a color format.
>      */
>     if (_mesa_get_format_base_format(src_mt->format) == GL_DEPTH_STENCIL ||
>         _mesa_get_format_base_format(dst_mt->format) == GL_DEPTH_STENCIL)
>        return false;
>  
> -   if (!brw->mesa_format_supports_render[dst_image->TexFormat])
> +   if (!brw_blorp_supports_dst_format(brw, dst_image->TexFormat))
>        return false;
>  
>     /* Source clipping shouldn't be necessary, since copytexsubimage (in
> -- 
> 2.5.0.400.gff86faf
> 
> _______________________________________________
> 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