freedreno/a3xx: output RGBA16_FLOAT from fs for certain outputs
authorIlia Mirkin <imirkin@alum.mit.edu>
Tue, 2 Dec 2014 06:00:47 +0000 (01:00 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sat, 6 Dec 2014 23:18:40 +0000 (18:18 -0500)
Fixes R11G11B10F rendering, and is required for SRGB format support.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
src/gallium/drivers/freedreno/a3xx/fd3_format.c
src/gallium/drivers/freedreno/a3xx/fd3_format.h
src/gallium/drivers/freedreno/a3xx/fd3_gmem.c

index adfe323dda668fdcc52ea7f312bdd511d65b4732..ec7fdefa76d1f6a8cf8b2425b7e0d29351c5572d 100644 (file)
@@ -316,6 +316,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);
+       }
+}
+
 static inline enum a3xx_tex_swiz
 tex_swiz(unsigned swiz)
 {
index 043454e2733f2abdecd647131a338a86c856c40d..6a47fda102978c50880de0254cc321e1228c808d 100644 (file)
@@ -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,
index 8edfb8b46d192ed1bbde1484f5ce40ed6c67132f..68264096866a660a89beaa43b945b6670cda8353 100644 (file)
@@ -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))));
        }
 }