[Mesa-dev] [PATCH] i965: Replace 0 with ISL_FORMAT_UNSUPPORTED in format table (v2)

Matt Turner mattst88 at gmail.com
Thu Jun 1 21:03:29 UTC 2017


On Thu, Jun 1, 2017 at 12:55 PM, Chad Versace <chad at kiwitree.net> wrote:
> From: Chad Versace <chadversary at chromium.org>
>
> When given an *unsupported* mesa_format,
> brw_isl_format_for_mesa_format() returned 0, a *valid* isl_format,
> ISL_FORMAT_R32G32B32A32_FLOAT.  The problem is that
> brw_isl_format_for_mesa_format's inner table used 0 instead of
> ISL_FORMAT_UNSUPPORTED to indicate unsupported mesa formats.
>
> Some callers of brw_isl_format_for_mesa_format() were aware of this
> weirdness, and worked around it. This patch removes those workarounds.
>
> Tested on Broadwell as below, no regressions:
>
>     > deqp-egl --deqp-case='dEQP-EGL.functional.image.modify.*'
>     Test run totals:
>       Passed:        24/37 (64.9%)
>       Failed:        0/37 (0.0%)
>       Not supported: 13/37 (35.1%)
>       Warnings:      0/37 (0.0%)
>
>     > deqp-gles3 --deqp-case='dEQP-GLES3.functional.texture.format.*'
>     Test run totals:
>       Passed:        530/530 (100.0%)
>       Failed:        0/530 (0.0%)
>       Not supported: 0/530 (0.0%)
>       Warnings:      0/530 (0.0%)
>
>
> v2: Ensure that all array elements are initialized to
>   ISL_FORMAT_UNSUPPORTED, even when new formats are added to enum
>   mesa_format, by using an designated range initializer.
> ---
>
>  src/mesa/drivers/dri/i965/brw_surface_formats.c  | 96 ++----------------------
>  src/mesa/drivers/dri/i965/brw_wm_surface_state.c |  2 +-
>  2 files changed, 6 insertions(+), 92 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_surface_formats.c b/src/mesa/drivers/dri/i965/brw_surface_formats.c
> index 52d3acb..f878317 100644
> --- a/src/mesa/drivers/dri/i965/brw_surface_formats.c
> +++ b/src/mesa/drivers/dri/i965/brw_surface_formats.c
> @@ -36,31 +36,19 @@ brw_isl_format_for_mesa_format(mesa_format mesa_format)
>      * staying in sync, so we initialize to 0 even though
>      * ISL_FORMAT_R32G32B32A32_FLOAT happens to also be 0.
>      */
> -   static const uint32_t table[MESA_FORMAT_COUNT] =
> -   {
> -      [MESA_FORMAT_A8B8G8R8_UNORM] = 0,
> +   static const enum isl_format table[MESA_FORMAT_COUNT] = {
> +      [0 ... MESA_FORMAT_COUNT-1] = ISL_FORMAT_UNSUPPORTED,
> +

Awesome.

Reviewed-by: Matt Turner <mattst88 at gmail.com>


More information about the mesa-dev mailing list