gallium: add a cap to expose whether driver supports mixed color/zs bits
authorIlia Mirkin <imirkin@alum.mit.edu>
Sun, 21 Aug 2016 02:40:33 +0000 (22:40 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Tue, 23 Aug 2016 22:30:49 +0000 (18:30 -0400)
Some hardware can't render to color/depth buffers of mixed bitness. When
that happens a fallback has to happen, but this allows the driver to
express that this isn't an optimal scenario. The purpose of this is to
remove such fbconfigs from the GLX/EGL config list.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
17 files changed:
src/gallium/docs/source/screen.rst
src/gallium/drivers/freedreno/freedreno_screen.c
src/gallium/drivers/i915/i915_screen.c
src/gallium/drivers/ilo/ilo_screen.c
src/gallium/drivers/llvmpipe/lp_screen.c
src/gallium/drivers/nouveau/nv30/nv30_screen.c
src/gallium/drivers/nouveau/nv50/nv50_screen.c
src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r600/r600_pipe.c
src/gallium/drivers/radeonsi/si_pipe.c
src/gallium/drivers/softpipe/sp_screen.c
src/gallium/drivers/svga/svga_screen.c
src/gallium/drivers/swr/swr_screen.cpp
src/gallium/drivers/vc4/vc4_screen.c
src/gallium/drivers/virgl/virgl_screen.c
src/gallium/include/pipe/p_defines.h

index 3199e3c816fd93e1ed907e52d25cddd161947bbe..c00d0127ce5eca931e21f29b25515d5449b54351 100644 (file)
@@ -347,6 +347,12 @@ The integer capabilities:
   for ``pipe_rasterizer_state::offset_units_unscaled``.
 * ``PIPE_CAP_VIEWPORT_SUBPIXEL_BITS``: Number of bits of subpixel precision for
   floating point viewport bounds.
+* ``PIPE_CAP_MIXED_COLOR_DEPTH_BITS``: Whether there is non-fallback
+  support for color/depth format combinations that use a different
+  number of bits. For the purpose of this cap, Z24 is treated as
+  32-bit. If set to off, that means that a B5G6R5 + Z24 or RGBA8 + Z16
+  combination will require a driver fallback, and should not be
+  advertised in the GLX/EGL config list.
 
 
 .. _pipe_capf:
index 92decd23e33345dea4b3a89b44000444bbc61474..fbdd1e2bbde1dbd44f08ae7c7f0c2250b3ef4b73 100644 (file)
@@ -175,6 +175,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
        case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
        case PIPE_CAP_VERTEXID_NOBASE:
        case PIPE_CAP_STRING_MARKER:
+       case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
                return 1;
 
        case PIPE_CAP_USER_CONSTANT_BUFFERS:
index ab3d4a6b2774a3416b64b701806742e32d41b67e..9f801a9b850c11caae2a7eb01d46e5d493fe9937 100644 (file)
@@ -201,6 +201,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
    case PIPE_CAP_USER_VERTEX_BUFFERS:
    case PIPE_CAP_USER_INDEX_BUFFERS:
    case PIPE_CAP_USER_CONSTANT_BUFFERS:
+   case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
       return 1;
 
    /* Unsupported features (boolean caps). */
index e98b6f20c39fc1af651ace896a00c51be8c7091f..050c03b66cc437a02c588167e500b2fd7bdbfbcf 100644 (file)
@@ -450,6 +450,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_ENDIANNESS:
       return PIPE_ENDIAN_LITTLE;
    case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
+   case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
       return true;
    case PIPE_CAP_TGSI_VS_LAYER_VIEWPORT:
    case PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES:
index 1c00aa91034f4c3f14d5e4daa797a96ad754875b..18837a24bb15cc0fe66ca348296c03f12bd00d3b 100644 (file)
@@ -109,6 +109,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    switch (param) {
    case PIPE_CAP_NPOT_TEXTURES:
    case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
+   case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
       return 1;
    case PIPE_CAP_TWO_SIDED_STENCIL:
       return 1;
index 3d75021fa49690405d0f90c1c11f67f60c5b34d4..ed74c3aa24946889f27f026f7c8a2c29ddcded0c 100644 (file)
@@ -200,6 +200,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_MAX_WINDOW_RECTANGLES:
    case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
    case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
+   case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
       return 0;
 
    case PIPE_CAP_VENDOR_ID:
index d18a768113299445ac420fa6dc2005bd1d25ac9a..d878547c9a5892d783d0bfcac34859a5d104f0d4 100644 (file)
@@ -150,6 +150,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_TEXTURE_SHADOW_MAP:
    case PIPE_CAP_NPOT_TEXTURES:
    case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
+   case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
    case PIPE_CAP_ANISOTROPIC_FILTER:
    case PIPE_CAP_TEXTURE_BUFFER_OBJECTS:
    case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
index fb0a9c85f153131a4b516043b09541a57b6c8ee9..f139f66f36544c0914f53459413188ab835caf14 100644 (file)
@@ -173,6 +173,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_TEXTURE_SHADOW_MAP:
    case PIPE_CAP_NPOT_TEXTURES:
    case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
+   case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
    case PIPE_CAP_ANISOTROPIC_FILTER:
    case PIPE_CAP_SEAMLESS_CUBE_MAP:
    case PIPE_CAP_CUBE_MAP_ARRAY:
index b69e5246ef03313bdadb7848749883ee8c79f2e4..509feaebb1d701344e0a468c9f905ff054540570 100644 (file)
@@ -95,6 +95,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
         /* Supported features (boolean caps). */
         case PIPE_CAP_NPOT_TEXTURES:
         case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
+        case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
         case PIPE_CAP_TWO_SIDED_STENCIL:
         case PIPE_CAP_ANISOTROPIC_FILTER:
         case PIPE_CAP_POINT_SPRITE:
index 5f69a5d1b2ffbbbf03efcb5d2d6651fb3b79e447..c09821d2a56f74fc91b0afc8d36e7132f5886a5d 100644 (file)
@@ -234,6 +234,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
        /* Supported features (boolean caps). */
        case PIPE_CAP_NPOT_TEXTURES:
        case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
+       case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
        case PIPE_CAP_TWO_SIDED_STENCIL:
        case PIPE_CAP_ANISOTROPIC_FILTER:
        case PIPE_CAP_POINT_SPRITE:
index 62b62db34a849ce677b05b89b73a0fbed7b04c0d..131d3a217398befc571d8523bf3f426af1f07ccb 100644 (file)
@@ -345,6 +345,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
        case PIPE_CAP_START_INSTANCE:
        case PIPE_CAP_NPOT_TEXTURES:
        case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
+       case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
        case PIPE_CAP_VERTEX_COLOR_CLAMPED:
        case PIPE_CAP_FRAGMENT_COLOR_CLAMPED:
         case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER:
index e80c1aa38a8a5e97a9e4aee01c6bf0ededbd8e50..b742bdecbc919d22b71811be6c2fc09e1f203b8d 100644 (file)
@@ -67,6 +67,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    switch (param) {
    case PIPE_CAP_NPOT_TEXTURES:
    case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
+   case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
       return 1;
    case PIPE_CAP_TWO_SIDED_STENCIL:
       return 1;
index 7c4e305f504e085fcf46827a39c7379812fc7fab..c5f8c87927d9a60fb88d47614858599f5f5c4148 100644 (file)
@@ -179,6 +179,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
    switch (param) {
    case PIPE_CAP_NPOT_TEXTURES:
    case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
+   case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
       return 1;
    case PIPE_CAP_TWO_SIDED_STENCIL:
       return 1;
index 3790fea8359ab4d2272e06849c15f6e838c933de..5c94877282cdb2b77de85c6982690497f92a666b 100644 (file)
@@ -152,6 +152,7 @@ swr_get_param(struct pipe_screen *screen, enum pipe_cap param)
    switch (param) {
    case PIPE_CAP_NPOT_TEXTURES:
    case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
+   case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
       return 1;
    case PIPE_CAP_TWO_SIDED_STENCIL:
       return 1;
index 9e08e561c3ed32bc804fa9309d547aaf73c04a08..652d9b467424faa20af35d272d1f5f211ece8cb4 100644 (file)
@@ -141,6 +141,7 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
                 return 1;
 
         case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
+        case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
                 return 1;
 
                 /* Unsupported features. */
index e01b5b405afca0edca7c55f9668c40b830e10c51..dd135a789d74ce75484230ba1e08560360d2ee1e 100644 (file)
@@ -184,6 +184,7 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_ENDIANNESS:
       return 0;
    case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
+   case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
       return 1;
    case PIPE_CAP_TGSI_VS_LAYER_VIEWPORT:
       return 0;
index 69bd89ece61f7f1fb8a1b993e6d730e9e35da9df..1e4d80227b4d4b7b4b3c698d4035ca1907f39875 100644 (file)
@@ -737,6 +737,7 @@ enum pipe_cap
    PIPE_CAP_MAX_WINDOW_RECTANGLES,
    PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED,
    PIPE_CAP_VIEWPORT_SUBPIXEL_BITS,
+   PIPE_CAP_MIXED_COLOR_DEPTH_BITS,
 };
 
 #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)