From: Ilia Mirkin
Date: Fri, 28 Nov 2014 19:10:50 +0000 (-0500)
Subject: freedreno/a3xx: add support for SRGB render targets
X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e02ed16cb52973975a097f955ec341a579c8f863;p=mesa.git
freedreno/a3xx: add support for SRGB render targets
Signed-off-by: Ilia Mirkin
Reviewed-by: Rob Clark
---
diff --git a/docs/relnotes/10.5.0.html b/docs/relnotes/10.5.0.html
index c6df2de89b6..2987d536e01 100644
--- a/docs/relnotes/10.5.0.html
+++ b/docs/relnotes/10.5.0.html
@@ -44,6 +44,7 @@ Note: some of the new features are only available with certain drivers.
+- GL_ARB_framebuffer_sRGB on freedreno
- GL_ARB_texture_rg on freedreno
- GL_EXT_packed_float on freedreno
- GL_EXT_texture_shared_exponent on freedreno
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_format.c b/src/gallium/drivers/freedreno/a3xx/fd3_format.c
index ec7fdefa76d..95999e9c69e 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_format.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_format.c
@@ -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),
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c b/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c
index 68264096866..a196c9c926d 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c
@@ -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 {