[Mesa-dev] [PATCH v6 1/8] Gallium: Add new CAPS to indicate whether a driver can switch SRGB write

Gert Wollny gw.fossdev at gmail.com
Thu Nov 15 12:45:52 UTC 2018


From: Gert Wollny <gert.wollny at collabora.com>

Add a new cap that indicates whether the drivers supports
enabling/disabling the conversion from linear space to sRGB
for a framebuffer attachment. In Driver terms that this CAP indicates
whether the driver can switch between a linear and and a sRGB surface
format for draw destinations without changing the surface itself.

v2: rename CAP to DEST_SURFACE_SRGB_CONTROL to reflect its
    purpouse better (pointed out by Ilia Mirkin)
Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
---
 src/gallium/auxiliary/util/u_screen.c | 3 +++
 src/gallium/docs/source/screen.rst    | 3 +++
 src/gallium/include/pipe/p_defines.h  | 1 +
 3 files changed, 7 insertions(+)

diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c
index 73dbbee94a..b737375ee0 100644
--- a/src/gallium/auxiliary/util/u_screen.c
+++ b/src/gallium/auxiliary/util/u_screen.c
@@ -326,6 +326,9 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
    case PIPE_CAP_MAX_VERTEX_ELEMENT_SRC_OFFSET:
       return 2047;
 
+   case PIPE_CAP_DEST_SURFACE_SRGB_CONTROL:
+      return 1;
+
    default:
       unreachable("bad PIPE_CAP_*");
    }
diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
index 0abd164494..dbdf9e94d1 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -477,6 +477,9 @@ subpixel precision bias in bits during conservative rasterization.
   0 means no limit.
 * ``PIPE_CAP_MAX_VERTEX_ELEMENT_SRC_OFFSET``: The maximum supported value for
   of pipe_vertex_element::src_offset.
+* ``PIPE_CAP_DEST_SURFACE_SRGB_CONTROL``: Indicates whether the drivers
+  supports switching the format between sRGB and linear for a surface that is
+  used as destination in draw and blit calls.
 
 .. _pipe_capf:
 
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 693f041b1d..c8eaad0104 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -826,6 +826,7 @@ enum pipe_cap
    PIPE_CAP_MAX_COMBINED_HW_ATOMIC_COUNTER_BUFFERS,
    PIPE_CAP_MAX_TEXTURE_UPLOAD_MEMORY_BUDGET,
    PIPE_CAP_MAX_VERTEX_ELEMENT_SRC_OFFSET,
+   PIPE_CAP_DEST_SURFACE_SRGB_CONTROL,
 };
 
 /**
-- 
2.18.1



More information about the mesa-dev mailing list