[Freedreno] [PATCH 6/8] freedreno/a3xx: output RGBA16_FLOAT from fs for certain outputs

Rob Clark robdclark at gmail.com
Thu Dec 4 08:53:31 PST 2014


On Wed, Dec 3, 2014 at 9:57 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> Fixes R11G11B10F rendering, and is required for SRGB format support.
>
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>  src/gallium/drivers/freedreno/a3xx/fd3_format.c | 13 +++++++++++++
>  src/gallium/drivers/freedreno/a3xx/fd3_format.h |  1 +
>  src/gallium/drivers/freedreno/a3xx/fd3_gmem.c   |  4 +++-
>  3 files changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_format.c b/src/gallium/drivers/freedreno/a3xx/fd3_format.c
> index 3df5b86..07e88cc 100644
> --- a/src/gallium/drivers/freedreno/a3xx/fd3_format.c
> +++ b/src/gallium/drivers/freedreno/a3xx/fd3_format.c
> @@ -336,6 +336,19 @@ fd3_gmem_restore_format(enum pipe_format format)
>         }
>  }
>
> +enum a3xx_color_fmt
> +fd3_fs_output_format(enum pipe_format format)
> +{
> +       if (util_format_is_srgb(format))
> +               return RB_R16G16B16A16_FLOAT;
> +       switch (format) {
> +       case PIPE_FORMAT_R11G11B10_FLOAT:
> +               return RB_R16G16B16A16_FLOAT;
> +       default:
> +               return fd3_pipe2color(format);
> +       }
> +}

at some point, when I have a chance to figure out what a4xx needs for
these formats, it might make sense to convert this into pipe_format ->
pipe_format fxn and put in freedreno_util.h instead (because I suspect
I'll need the same logic, but w/ a4xx_color_format enum instead)

But I guess we can cross that bridge when we get there..

BR,
-R

> +
>  static inline enum a3xx_tex_swiz
>  tex_swiz(unsigned swiz)
>  {
> diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_format.h b/src/gallium/drivers/freedreno/a3xx/fd3_format.h
> index 043454e..6a47fda 100644
> --- a/src/gallium/drivers/freedreno/a3xx/fd3_format.h
> +++ b/src/gallium/drivers/freedreno/a3xx/fd3_format.h
> @@ -35,6 +35,7 @@ enum a3xx_tex_fmt fd3_pipe2tex(enum pipe_format format);
>  enum a3xx_tex_fetchsize fd3_pipe2fetchsize(enum pipe_format format);
>  enum a3xx_color_fmt fd3_pipe2color(enum pipe_format format);
>  enum pipe_format fd3_gmem_restore_format(enum pipe_format format);
> +enum a3xx_color_fmt fd3_fs_output_format(enum pipe_format format);
>  enum a3xx_color_swap fd3_pipe2swap(enum pipe_format format);
>
>  uint32_t fd3_tex_swiz(enum pipe_format format, unsigned swizzle_r,
> diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c b/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c
> index 8edfb8b..6826409 100644
> --- a/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c
> +++ b/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c
> @@ -101,7 +101,9 @@ emit_mrt(struct fd_ringbuffer *ring, unsigned nr_bufs,
>                 }
>
>                 OUT_PKT0(ring, REG_A3XX_SP_FS_IMAGE_OUTPUT_REG(i), 1);
> -               OUT_RING(ring, A3XX_SP_FS_IMAGE_OUTPUT_REG_MRTFORMAT(format));
> +               OUT_RING(ring, COND((i < nr_bufs) && bufs[i],
> +                                                       A3XX_SP_FS_IMAGE_OUTPUT_REG_MRTFORMAT(
> +                                                                       fd3_fs_output_format(bufs[i]->format))));
>         }
>  }
>
> --
> 2.0.4
>


More information about the Freedreno mailing list