[Mesa-dev] [PATCH] nv50,nvc0: fix Z24 formats

Ilia Mirkin imirkin at alum.mit.edu
Thu Sep 11 14:01:09 PDT 2014


On Thu, Sep 11, 2014 at 5:45 PM, David Heidelberger
<david.heidelberger at ixit.cz> wrote:
> also fixes nv50_blit_eng2d_get_mask for PIPE_FORMAT_X8Z24_UNORM

Can you explain the problem a little bit and what the end-effect of
this fix is? If not, that's OK, I can probably work it out...

>
> Tested-by: Tiziano Bacocco <tizbac2 at gmail.com> (on NVC0)

What was the test that was done? Full piglit run before and after?

> Signed-off-by: David Heidelberger <david.heidelberger at ixit.cz>
> ---
>  src/gallium/drivers/nouveau/nv50/nv50_blit.h    | 26
> ++++++++++++-------------
>  src/gallium/drivers/nouveau/nv50/nv50_surface.c |  1 +
>  src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c |  1 +
>  3 files changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_blit.h
> b/src/gallium/drivers/nouveau/nv50/nv50_blit.h
> index bdd6a63..6b9ddac 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_blit.h
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_blit.h
> @@ -111,6 +111,7 @@ nv50_blit_zeta_to_colour_format(enum pipe_format format)
>     case PIPE_FORMAT_Z24_UNORM_S8_UINT:
>     case PIPE_FORMAT_S8_UINT_Z24_UNORM:
>     case PIPE_FORMAT_Z24X8_UNORM:
> +   case PIPE_FORMAT_X8Z24_UNORM:
>        return PIPE_FORMAT_R8G8B8A8_UNORM;
>     case PIPE_FORMAT_Z32_FLOAT:
>        return PIPE_FORMAT_R32_FLOAT;
> @@ -127,23 +128,20 @@ static INLINE uint16_t
>  nv50_blit_derive_color_mask(const struct pipe_blit_info *info)
>  {
>     const unsigned mask = info->mask;
> -
>     uint16_t color_mask = 0;
>
>     switch (info->dst.format) {
>     case PIPE_FORMAT_Z24_UNORM_S8_UINT:
> -      if (mask & PIPE_MASK_S)
> -         color_mask |= 0x1000;
> +      if (mask & PIPE_MASK_S) color_mask |= 0x1000;
>        /* fall through */
>     case PIPE_FORMAT_Z24X8_UNORM:
> -      if (mask & PIPE_MASK_Z)
> -         color_mask |= 0x0111;
> +      if (mask & PIPE_MASK_Z) color_mask |= 0x0111;
>        break;
>     case PIPE_FORMAT_S8_UINT_Z24_UNORM:
> -      if (mask & PIPE_MASK_Z)
> -         color_mask |= 0x1110;
> -      if (mask & PIPE_MASK_S)
> -         color_mask |= 0x0001;
> +      if (mask & PIPE_MASK_S) color_mask |= 0x0001;
> +      /* fall through */
> +   case PIPE_FORMAT_X8Z24_UNORM:
> +      if (mask & PIPE_MASK_Z) color_mask |= 0x1110;
>        break;
>     default:
>        if (mask & (PIPE_MASK_R | PIPE_MASK_Z)) color_mask |= 0x0001;
> @@ -152,7 +150,6 @@ nv50_blit_derive_color_mask(const struct pipe_blit_info
> *info)
>        if (mask & PIPE_MASK_A) color_mask |= 0x1000;
>        break;
>     }
> -
>     return color_mask;
>  }
>
> @@ -163,15 +160,16 @@ nv50_blit_eng2d_get_mask(const struct pipe_blit_info
> *info)
>
>     switch (info->dst.format) {
>     case PIPE_FORMAT_Z24_UNORM_S8_UINT:
> -      if (info->mask & PIPE_MASK_Z) mask |= 0x00ffffff;
>        if (info->mask & PIPE_MASK_S) mask |= 0xff000000;
> +      /* fall through */
> +   case PIPE_FORMAT_Z24X8_UNORM:
> +      if (info->mask & PIPE_MASK_Z) mask |= 0x00ffffff;
>        break;
>     case PIPE_FORMAT_S8_UINT_Z24_UNORM:
> -      if (info->mask & PIPE_MASK_Z) mask |= 0xffffff00;
>        if (info->mask & PIPE_MASK_S) mask |= 0x000000ff;
> -      break;
> +      /* fall through */
>     case PIPE_FORMAT_X8Z24_UNORM:
> -      if (info->mask & PIPE_MASK_Z) mask = 0x00ffffff;
> +      if (info->mask & PIPE_MASK_Z) mask |= 0xffffff00;
>        break;
>     default:
>        mask = 0xffffffff;
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_surface.c
> b/src/gallium/drivers/nouveau/nv50/nv50_surface.c
> index 3f33033..cc683e3 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_surface.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_surface.c
> @@ -834,6 +834,7 @@ nv50_blit_select_mode(const struct pipe_blit_info *info)
>           return NV50_BLIT_MODE_X24S8;
>        }
>     case PIPE_FORMAT_S8_UINT_Z24_UNORM:
> +   case PIPE_FORMAT_X8Z24_UNORM:
>        switch (mask & PIPE_MASK_ZS) {
>        case PIPE_MASK_ZS: return NV50_BLIT_MODE_S8Z24;
>        case PIPE_MASK_Z:  return NV50_BLIT_MODE_X8Z24;
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
> b/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
> index 3baa752..4b4d090 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
> @@ -53,6 +53,7 @@ nvc0_mt_choose_storage_type(struct nv50_miptree *mt,
> boolean compressed)
>        else
>           tile_flags = 0x01;
>        break;
> +   case PIPE_FORMAT_X8Z24_UNORM:
>     case PIPE_FORMAT_S8_UINT_Z24_UNORM:
>        if (compressed)
>           tile_flags = 0x51 + ms;
> --
> 2.1.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list