gallium: allow drivers to impose BO flags restrictions on constant buffer 0
authorMarek Olšák <marek.olsak@amd.com>
Sat, 27 Jan 2018 00:52:08 +0000 (01:52 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Sat, 17 Feb 2018 03:20:55 +0000 (04:20 +0100)
Required by radeonsi for optimal behavior.

18 files changed:
src/gallium/docs/source/screen.rst
src/gallium/drivers/etnaviv/etnaviv_screen.c
src/gallium/drivers/freedreno/freedreno_screen.c
src/gallium/drivers/i915/i915_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_get.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/vc5/vc5_screen.c
src/gallium/drivers/virgl/virgl_screen.c
src/gallium/include/pipe/p_defines.h

index 95b62534493d29e5798df4a85773e53d8e61afd4..e375d67a4b62ff7f2e912e0792ee4a25575fea0c 100644 (file)
@@ -414,6 +414,10 @@ The integer capabilities:
   contexts can return 0.
 * ``PIPE_CAP_FENCE_SIGNAL``: True if the driver supports signaling semaphores
   using fence_server_signal().
+* ``PIPE_CAP_CONSTBUF0_FLAGS``: The bits of pipe_resource::flags that must be
+  set when binding that buffer as constant buffer 0. If the buffer doesn't have
+  those bits set, pipe_context::set_constant_buffer(.., 0, ..) is ignored
+  by the driver, and the driver can throw assertion failures.
 
 
 .. _pipe_capf:
index 16b58d3f03f87607ce0862917f08b9b0fa25f838..3dd628bd9b42cb9906f267be5d4dec7db8cdcd86 100644 (file)
@@ -267,6 +267,7 @@ etna_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET:
    case PIPE_CAP_CONTEXT_PRIORITY_MASK:
    case PIPE_CAP_FENCE_SIGNAL:
+   case PIPE_CAP_CONSTBUF0_FLAGS:
       return 0;
 
    /* Stream output. */
index eb5c436e109e0b4cf98a1ed695235a32e8b5a244..86aee69bb4f47c3e0a073124024a72ad998c10fa 100644 (file)
@@ -337,6 +337,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
        case PIPE_CAP_MAX_COMBINED_SHADER_OUTPUT_RESOURCES:
        case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET:
        case PIPE_CAP_FENCE_SIGNAL:
+       case PIPE_CAP_CONSTBUF0_FLAGS:
                return 0;
 
        case PIPE_CAP_CONTEXT_PRIORITY_MASK:
index ac3621f814978fb582f917600c133644d87b87e1..345e82b573eeef968b14a17728fa8cd5c08b2a52 100644 (file)
@@ -325,6 +325,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
    case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET:
    case PIPE_CAP_CONTEXT_PRIORITY_MASK:
    case PIPE_CAP_FENCE_SIGNAL:
+   case PIPE_CAP_CONSTBUF0_FLAGS:
       return 0;
 
    case PIPE_CAP_MAX_VIEWPORTS:
index 439e15bc1a7b258418184d77a24cc480f8163e1e..01ef348e3b0b45726200bc34c6458bfe8787c4eb 100644 (file)
@@ -360,6 +360,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET:
    case PIPE_CAP_CONTEXT_PRIORITY_MASK:
    case PIPE_CAP_FENCE_SIGNAL:
+   case PIPE_CAP_CONSTBUF0_FLAGS:
       return 0;
    }
    /* should only get here on unhandled cases */
index 07d8c9c98b1e3350af0fcf11413b6f600d298b79..d7fcff16fb64f05dccadb8012347dcce09c9d525 100644 (file)
@@ -227,6 +227,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET:
    case PIPE_CAP_CONTEXT_PRIORITY_MASK:
    case PIPE_CAP_FENCE_SIGNAL:
+   case PIPE_CAP_CONSTBUF0_FLAGS:
       return 0;
 
    case PIPE_CAP_VENDOR_ID:
index 5c006e6be75fa6468d04995b89604e8a78c5afe3..a9a4dde508a157f4d78a2eaef30cff4353a98066 100644 (file)
@@ -279,6 +279,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET:
    case PIPE_CAP_CONTEXT_PRIORITY_MASK:
    case PIPE_CAP_FENCE_SIGNAL:
+   case PIPE_CAP_CONSTBUF0_FLAGS:
       return 0;
 
    case PIPE_CAP_VENDOR_ID:
index 225772cecefa0bc852893ea47d7d7a82dbe99670..e9072c1ed86eb6a08aa14ecffee2f8fd2ec0645e 100644 (file)
@@ -308,6 +308,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET:
    case PIPE_CAP_CONTEXT_PRIORITY_MASK:
    case PIPE_CAP_FENCE_SIGNAL:
+   case PIPE_CAP_CONSTBUF0_FLAGS:
       return 0;
 
    case PIPE_CAP_VENDOR_ID:
index 825b1118c2a09c3a6fc60f98c670405c418ffb29..fdfc5cf64d23182380a869807e0b7b4298f6a9dd 100644 (file)
@@ -249,6 +249,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
         case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET:
         case PIPE_CAP_CONTEXT_PRIORITY_MASK:
         case PIPE_CAP_FENCE_SIGNAL:
+        case PIPE_CAP_CONSTBUF0_FLAGS:
             return 0;
 
         /* SWTCL-only features. */
index ecdbe5d9bf53cf78f2f0fd5be7856c4592f396dc..1f81b70c628ed312cd1ac734c5e5b9c450467725 100644 (file)
@@ -413,6 +413,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
        case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET:
        case PIPE_CAP_CONTEXT_PRIORITY_MASK:
        case PIPE_CAP_FENCE_SIGNAL:
+       case PIPE_CAP_CONSTBUF0_FLAGS:
                return 0;
 
        case PIPE_CAP_DOUBLES:
index ef03a962d1ef1e53046afd8ef8d2571280c7da46..a67daa5eae7f98657801c2a2c670edb22a02d2df 100644 (file)
@@ -268,6 +268,7 @@ static int si_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
        case PIPE_CAP_TILE_RASTER_ORDER:
        case PIPE_CAP_MAX_COMBINED_SHADER_OUTPUT_RESOURCES:
        case PIPE_CAP_CONTEXT_PRIORITY_MASK:
+       case PIPE_CAP_CONSTBUF0_FLAGS:
                return 0;
 
        case PIPE_CAP_FENCE_SIGNAL:
index f02da809469f201484f4bc2b553f7bf1b6179f32..12824a8c28fb3658204268e52d5be2436c8bc94c 100644 (file)
@@ -312,6 +312,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET:
    case PIPE_CAP_CONTEXT_PRIORITY_MASK:
    case PIPE_CAP_FENCE_SIGNAL:
+   case PIPE_CAP_CONSTBUF0_FLAGS:
       return 0;
    case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
       return 4;
index 29f383ea3b888f0643afbdf5a569da47cc1a3b01..0c55112a37b8c61b728b38f3ebcc775b989bf82e 100644 (file)
@@ -450,6 +450,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET:
    case PIPE_CAP_CONTEXT_PRIORITY_MASK:
    case PIPE_CAP_FENCE_SIGNAL:
+   case PIPE_CAP_CONSTBUF0_FLAGS:
       return 0;
    }
 
index ff0c2bb8a5cb111c37a62dccf236213130434208..55f8d4b5cf019703868cde2ed91e7dbf35e1101c 100644 (file)
@@ -345,6 +345,7 @@ swr_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET:
    case PIPE_CAP_CONTEXT_PRIORITY_MASK:
    case PIPE_CAP_FENCE_SIGNAL:
+   case PIPE_CAP_CONSTBUF0_FLAGS:
       return 0;
 
    case PIPE_CAP_VENDOR_ID:
index 606a92101a823f3c787ed711546261f4e9123a7b..e341211f5bdc8804ca97714cc8bade9b85c328ff 100644 (file)
@@ -287,6 +287,7 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
         case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET:
         case PIPE_CAP_CONTEXT_PRIORITY_MASK:
         case PIPE_CAP_FENCE_SIGNAL:
+       case PIPE_CAP_CONSTBUF0_FLAGS:
                 return 0;
 
                 /* Stream output. */
index 66f4dd9cf94a524639514b40892730daaa9bb1e4..47727d0adad438b1f32c400441440b71480f1ad2 100644 (file)
@@ -259,6 +259,7 @@ vc5_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
         case PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS:
         case PIPE_CAP_MAX_COMBINED_SHADER_OUTPUT_RESOURCES:
         case PIPE_CAP_CONTEXT_PRIORITY_MASK:
+       case PIPE_CAP_CONSTBUF0_FLAGS:
                 return 0;
 
                 /* Geometry shader output, unsupported. */
index f4f3195ce3fd3331f2d4d04a432e19fedc17a82f..22a694ea271a246bc68035c25eb45b61745d6124 100644 (file)
@@ -273,6 +273,7 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET:
    case PIPE_CAP_CONTEXT_PRIORITY_MASK:
    case PIPE_CAP_FENCE_SIGNAL:
+   case PIPE_CAP_CONSTBUF0_FLAGS:
       return 0;
    case PIPE_CAP_VENDOR_ID:
       return 0x1af4;
index ab9d6a81ef279f7a126a1151046eb157368f0521..ed8eeb89f9273457aed070d4ed0667f5093ef1e8 100644 (file)
@@ -793,6 +793,7 @@ enum pipe_cap
    PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET,
    PIPE_CAP_CONTEXT_PRIORITY_MASK,
    PIPE_CAP_FENCE_SIGNAL,
+   PIPE_CAP_CONSTBUF0_FLAGS,
 };
 
 /**