freedreno/a3xx: add support for SRGB render targets
authorIlia Mirkin <imirkin@alum.mit.edu>
Fri, 28 Nov 2014 19:10:50 +0000 (14:10 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sat, 6 Dec 2014 23:18:43 +0000 (18:18 -0500)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
docs/relnotes/10.5.0.html
src/gallium/drivers/freedreno/a3xx/fd3_format.c
src/gallium/drivers/freedreno/a3xx/fd3_gmem.c

index c6df2de89b62e51cdfb83873e01da4ba9609a97f..2987d536e01589b5e2749339b4c662bc08acb285 100644 (file)
@@ -44,6 +44,7 @@ Note: some of the new features are only available with certain drivers.
 </p>
 
 <ul>
+<li>GL_ARB_framebuffer_sRGB on freedreno</li>
 <li>GL_ARB_texture_rg on freedreno</li>
 <li>GL_EXT_packed_float on freedreno</li>
 <li>GL_EXT_texture_shared_exponent on freedreno</li>
index ec7fdefa76d1f6a8cf8b2425b7e0d29351c5572d..95999e9c69e8dbdddb8efdeb43e762497bd2e64d 100644 (file)
@@ -159,8 +159,8 @@ static struct fd3_format formats[PIPE_FORMAT_COUNT] = {
 
        VT(R8G8B8A8_UNORM,   8_8_8_8_UNORM, R8G8B8A8_UNORM, WZYX),
        _T(R8G8B8X8_UNORM,   8_8_8_8_UNORM, R8G8B8A8_UNORM, WZYX),
-       _T(R8G8B8A8_SRGB,    8_8_8_8_UNORM, NONE,           WZYX),
-       _T(R8G8B8X8_SRGB,    8_8_8_8_UNORM, NONE,           WZYX),
+       _T(R8G8B8A8_SRGB,    8_8_8_8_UNORM, R8G8B8A8_UNORM, WZYX),
+       _T(R8G8B8X8_SRGB,    8_8_8_8_UNORM, R8G8B8A8_UNORM, WZYX),
        VT(R8G8B8A8_SNORM,   8_8_8_8_SNORM, R8G8B8A8_SNORM, WZYX),
        VT(R8G8B8A8_UINT,    8_8_8_8_UINT,  R8G8B8A8_UINT,  WZYX),
        VT(R8G8B8A8_SINT,    8_8_8_8_SINT,  R8G8B8A8_SINT,  WZYX),
@@ -169,18 +169,18 @@ static struct fd3_format formats[PIPE_FORMAT_COUNT] = {
 
        VT(B8G8R8A8_UNORM,   8_8_8_8_UNORM, R8G8B8A8_UNORM, WXYZ),
        _T(B8G8R8X8_UNORM,   8_8_8_8_UNORM, R8G8B8A8_UNORM, WXYZ),
-       VT(B8G8R8A8_SRGB,    8_8_8_8_UNORM, NONE,           WXYZ),
-       _T(B8G8R8X8_SRGB,    8_8_8_8_UNORM, NONE,           WXYZ),
+       VT(B8G8R8A8_SRGB,    8_8_8_8_UNORM, R8G8B8A8_UNORM, WXYZ),
+       _T(B8G8R8X8_SRGB,    8_8_8_8_UNORM, R8G8B8A8_UNORM, WXYZ),
 
        VT(A8B8G8R8_UNORM,   8_8_8_8_UNORM, R8G8B8A8_UNORM, XYZW),
        _T(X8B8G8R8_UNORM,   8_8_8_8_UNORM, R8G8B8A8_UNORM, XYZW),
-       _T(A8B8G8R8_SRGB,    8_8_8_8_UNORM, NONE,           XYZW),
-       _T(X8B8G8R8_SRGB,    8_8_8_8_UNORM, NONE,           XYZW),
+       _T(A8B8G8R8_SRGB,    8_8_8_8_UNORM, R8G8B8A8_UNORM, XYZW),
+       _T(X8B8G8R8_SRGB,    8_8_8_8_UNORM, R8G8B8A8_UNORM, XYZW),
 
        VT(A8R8G8B8_UNORM,   8_8_8_8_UNORM, R8G8B8A8_UNORM, ZYXW),
        _T(X8R8G8B8_UNORM,   8_8_8_8_UNORM, R8G8B8A8_UNORM, ZYXW),
-       _T(A8R8G8B8_SRGB,    8_8_8_8_UNORM, NONE,           ZYXW),
-       _T(X8R8G8B8_SRGB,    8_8_8_8_UNORM, NONE,           ZYXW),
+       _T(A8R8G8B8_SRGB,    8_8_8_8_UNORM, R8G8B8A8_UNORM, ZYXW),
+       _T(X8R8G8B8_SRGB,    8_8_8_8_UNORM, R8G8B8A8_UNORM, ZYXW),
 
        VT(R10G10B10A2_UNORM,   10_10_10_2_UNORM, R10G10B10A2_UNORM, WZYX),
        VT(B10G10R10A2_UNORM,   10_10_10_2_UNORM, R10G10B10A2_UNORM, WXYZ),
index 68264096866a660a89beaa43b945b6670cda8353..a196c9c926ddb1a8c6f32314753ba5e2581919ea 100644 (file)
@@ -59,6 +59,7 @@ emit_mrt(struct fd_ringbuffer *ring, unsigned nr_bufs,
        for (i = 0; i < 4; i++) {
                enum a3xx_color_fmt format = 0;
                enum a3xx_color_swap swap = WZYX;
+               bool srgb = false;
                struct fd_resource *rsc = NULL;
                struct fd_resource_slice *slice = NULL;
                uint32_t stride = 0;
@@ -72,6 +73,7 @@ emit_mrt(struct fd_ringbuffer *ring, unsigned nr_bufs,
                        slice = &rsc->slices[psurf->u.tex.level];
                        format = fd3_pipe2color(psurf->format);
                        swap = fd3_pipe2swap(psurf->format);
+                       srgb = util_format_is_srgb(psurf->format);
 
                        debug_assert(psurf->u.tex.first_layer == psurf->u.tex.last_layer);
 
@@ -92,7 +94,8 @@ emit_mrt(struct fd_ringbuffer *ring, unsigned nr_bufs,
                OUT_RING(ring, A3XX_RB_MRT_BUF_INFO_COLOR_FORMAT(format) |
                                A3XX_RB_MRT_BUF_INFO_COLOR_TILE_MODE(tile_mode) |
                                A3XX_RB_MRT_BUF_INFO_COLOR_BUF_PITCH(stride) |
-                               A3XX_RB_MRT_BUF_INFO_COLOR_SWAP(swap));
+                               A3XX_RB_MRT_BUF_INFO_COLOR_SWAP(swap) |
+                               COND(srgb, A3XX_RB_MRT_BUF_INFO_COLOR_SRGB));
                if (bin_w || (i >= nr_bufs)) {
                        OUT_RING(ring, A3XX_RB_MRT_BUF_BASE_COLOR_BUF_BASE(base));
                } else {