[Mesa-dev] [PATCH v2 2/3] gallium: Add capability for ARB_robust_buffer_access_behavior

Roland Scheidegger sroland at vmware.com
Tue Apr 12 13:56:10 UTC 2016


Am 12.04.2016 um 15:12 schrieb Bas Nieuwenhuizen:
> Signed-off-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
> ---
>  src/gallium/docs/source/screen.rst               | 5 +++++
>  src/gallium/drivers/freedreno/freedreno_screen.c | 1 +
>  src/gallium/drivers/i915/i915_screen.c           | 1 +
>  src/gallium/drivers/ilo/ilo_screen.c             | 1 +
>  src/gallium/drivers/llvmpipe/lp_screen.c         | 1 +
>  src/gallium/drivers/nouveau/nv30/nv30_screen.c   | 1 +
>  src/gallium/drivers/nouveau/nv50/nv50_screen.c   | 1 +
>  src/gallium/drivers/nouveau/nvc0/nvc0_screen.c   | 1 +
>  src/gallium/drivers/r300/r300_screen.c           | 1 +
>  src/gallium/drivers/r600/r600_pipe.c             | 1 +
>  src/gallium/drivers/radeonsi/si_pipe.c           | 1 +
>  src/gallium/drivers/softpipe/sp_screen.c         | 1 +
>  src/gallium/drivers/svga/svga_screen.c           | 1 +
>  src/gallium/drivers/swr/swr_screen.cpp           | 1 +
>  src/gallium/drivers/vc4/vc4_screen.c             | 1 +
>  src/gallium/drivers/virgl/virgl_screen.c         | 1 +
>  src/gallium/include/pipe/p_defines.h             | 1 +
>  src/mesa/state_tracker/st_extensions.c           | 1 +
>  18 files changed, 22 insertions(+)
> 
> diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
> index 824f580..b281029 100644
> --- a/src/gallium/docs/source/screen.rst
> +++ b/src/gallium/docs/source/screen.rst
> @@ -331,6 +331,11 @@ The integer capabilities:
>    primitive on a layer is obtained from ``PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS``
>    even though it can be larger than the number of layers supported by either
>    rendering or textures.
> +* ``PIPE_CAP_ROBUST_BUFFER_ACCESS``: Implementation uses bounds checking on
> +  resource accesses by shader if the context is created with
> +  PIPE_CONTEXT_ROBUST_BUFFER_ACCESS. See the ARB_robust_buffer_access_behavior
> +  extension for information on the required behavior for out of bounds accesses
> +  and accesses to unbound resources.
I think this is a bit of a misnomer. "Robust buffer access" is already
provided by just ARB_robustness in gl terms (meaning it just isn't
allowed to crash for out-of-bounds access generally).
Although admitedly PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR would be quite
a long name...


>  
>  
>  .. _pipe_capf:
> diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
> index 707be17..6547533 100644
> --- a/src/gallium/drivers/freedreno/freedreno_screen.c
> +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
> @@ -256,6 +256,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>  	case PIPE_CAP_GENERATE_MIPMAP:
>  	case PIPE_CAP_SURFACE_REINTERPRET_BLOCKS:
>  	case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
> +	case PIPE_CAP_ROBUST_BUFFER_ACCESS:
>  		return 0;
>  
>  	case PIPE_CAP_MAX_VIEWPORTS:
> diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
> index 68e32e5..697120c 100644
> --- a/src/gallium/drivers/i915/i915_screen.c
> +++ b/src/gallium/drivers/i915/i915_screen.c
> @@ -270,6 +270,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
>     case PIPE_CAP_PCI_DEVICE:
>     case PIPE_CAP_PCI_FUNCTION:
>     case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
> +   case PIPE_CAP_ROBUST_BUFFER_ACCESS:
>        return 0;
>  
>     case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
> diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c
> index 142d6f1..54ca2a4 100644
> --- a/src/gallium/drivers/ilo/ilo_screen.c
> +++ b/src/gallium/drivers/ilo/ilo_screen.c
> @@ -499,6 +499,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_PCI_DEVICE:
>     case PIPE_CAP_PCI_FUNCTION:
>     case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
> +   case PIPE_CAP_ROBUST_BUFFER_ACCESS:
>        return 0;
>  
>     case PIPE_CAP_VENDOR_ID:
> diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
> index 6a5f906..6f81b13 100644
> --- a/src/gallium/drivers/llvmpipe/lp_screen.c
> +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
> @@ -320,6 +320,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_PCI_DEVICE:
>     case PIPE_CAP_PCI_FUNCTION:
>     case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
> +   case PIPE_CAP_ROBUST_BUFFER_ACCESS:
>        return 0;
>     }
>     /* should only get here on unhandled cases */
> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> index ece8af7..67dbbb0 100644
> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> @@ -193,6 +193,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>     case PIPE_CAP_PCI_DEVICE:
>     case PIPE_CAP_PCI_FUNCTION:
>     case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
> +   case PIPE_CAP_ROBUST_BUFFER_ACCESS:
>        return 0;
>  
>     case PIPE_CAP_VENDOR_ID:
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> index a2c9a3e..4192925 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> @@ -246,6 +246,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>     case PIPE_CAP_PCI_DEVICE:
>     case PIPE_CAP_PCI_FUNCTION:
>     case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
> +   case PIPE_CAP_ROBUST_BUFFER_ACCESS:
>        return 0;
>  
>     case PIPE_CAP_VENDOR_ID:
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> index b6eb679..daadd36 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> @@ -258,6 +258,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>     case PIPE_CAP_PCI_BUS:
>     case PIPE_CAP_PCI_DEVICE:
>     case PIPE_CAP_PCI_FUNCTION:
> +   case PIPE_CAP_ROBUST_BUFFER_ACCESS:
>        return 0;
>  
>     case PIPE_CAP_VENDOR_ID:
> diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
> index b3a7f04..b2120a6 100644
> --- a/src/gallium/drivers/r300/r300_screen.c
> +++ b/src/gallium/drivers/r300/r300_screen.c
> @@ -215,6 +215,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>          case PIPE_CAP_QUERY_BUFFER_OBJECT:
>          case PIPE_CAP_QUERY_MEMORY_INFO:
>          case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
> +	case PIPE_CAP_ROBUST_BUFFER_ACCESS:
>              return 0;
>  
>          /* SWTCL-only features. */
> diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
> index 36b808f..56fcba3 100644
> --- a/src/gallium/drivers/r600/r600_pipe.c
> +++ b/src/gallium/drivers/r600/r600_pipe.c
> @@ -365,6 +365,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>  	case PIPE_CAP_GENERATE_MIPMAP:
>  	case PIPE_CAP_STRING_MARKER:
>  	case PIPE_CAP_QUERY_BUFFER_OBJECT:
> +	case PIPE_CAP_ROBUST_BUFFER_ACCESS:
>  		return 0;
>  
>  	case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
> index 41bb84d..74049c9 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.c
> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
> @@ -357,6 +357,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>  	case PIPE_CAP_GENERATE_MIPMAP:
>  	case PIPE_CAP_STRING_MARKER:
>  	case PIPE_CAP_QUERY_BUFFER_OBJECT:
> +	case PIPE_CAP_ROBUST_BUFFER_ACCESS:
>  		return 0;
>  
>  	case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
> diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
> index 00b414c..6583ce0 100644
> --- a/src/gallium/drivers/softpipe/sp_screen.c
> +++ b/src/gallium/drivers/softpipe/sp_screen.c
> @@ -270,6 +270,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_PCI_DEVICE:
>     case PIPE_CAP_PCI_FUNCTION:
>     case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
> +   case PIPE_CAP_ROBUST_BUFFER_ACCESS:
>        return 0;
>     case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
>        return 4;
> diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
> index 536fb6f..ab1275c 100644
> --- a/src/gallium/drivers/svga/svga_screen.c
> +++ b/src/gallium/drivers/svga/svga_screen.c
> @@ -364,6 +364,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_PCI_BUS:
>     case PIPE_CAP_PCI_DEVICE:
>     case PIPE_CAP_PCI_FUNCTION:
> +   case PIPE_CAP_ROBUST_BUFFER_ACCESS:
>        return 0;
>     case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
>        return 64;
> diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp
> index f9e52be..7bc0b91 100644
> --- a/src/gallium/drivers/swr/swr_screen.cpp
> +++ b/src/gallium/drivers/swr/swr_screen.cpp
> @@ -337,6 +337,7 @@ swr_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_SURFACE_REINTERPRET_BLOCKS:
>     case PIPE_CAP_QUERY_BUFFER_OBJECT:
>     case PIPE_CAP_QUERY_MEMORY_INFO:
> +   case PIPE_CAP_ROBUST_BUFFER_ACCESS:
>        return 0;
>     }
>  
> diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
> index 167a2f5..6b28f37 100644
> --- a/src/gallium/drivers/vc4/vc4_screen.c
> +++ b/src/gallium/drivers/vc4/vc4_screen.c
> @@ -208,6 +208,7 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>          case PIPE_CAP_PCI_DEVICE:
>          case PIPE_CAP_PCI_FUNCTION:
>          case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
> +        case PIPE_CAP_ROBUST_BUFFER_ACCESS:
>                  return 0;
>  
>                  /* Stream output. */
> diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c
> index 5a5afc1..ce01be6 100644
> --- a/src/gallium/drivers/virgl/virgl_screen.c
> +++ b/src/gallium/drivers/virgl/virgl_screen.c
> @@ -240,6 +240,7 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_PCI_DEVICE:
>     case PIPE_CAP_PCI_FUNCTION:
>     case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
> +   case PIPE_CAP_ROBUST_BUFFER_ACCESS:
>        return 0;
>     case PIPE_CAP_VENDOR_ID:
>        return 0x1af4;
> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
> index 5e204a3..a65aa5a 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -691,6 +691,7 @@ enum pipe_cap
>     PIPE_CAP_PCI_DEVICE,
>     PIPE_CAP_PCI_FUNCTION,
>     PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT,
> +   PIPE_CAP_ROBUST_BUFFER_ACCESS,
>  };
>  
>  #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> index 2878943..6f0eac7 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -589,6 +589,7 @@ void st_init_extensions(struct pipe_screen *screen,
>        { o(ARB_pipeline_statistics_query),    PIPE_CAP_QUERY_PIPELINE_STATISTICS        },
>        { o(ARB_point_sprite),                 PIPE_CAP_POINT_SPRITE                     },
>        { o(ARB_query_buffer_object),          PIPE_CAP_QUERY_BUFFER_OBJECT              },
> +      { o(ARB_robust_buffer_access_behavior), PIPE_CAP_ROBUST_BUFFER_ACCESS            },
>        { o(ARB_sample_shading),               PIPE_CAP_SAMPLE_SHADING                   },
>        { o(ARB_seamless_cube_map),            PIPE_CAP_SEAMLESS_CUBE_MAP                },
>        { o(ARB_shader_draw_parameters),       PIPE_CAP_DRAW_PARAMETERS                  },
> 

Otherwise looks good.

FWIW I think it should work for llvmpipe too. Albeit I'm not entirely
sure (if there's something in this extension which has stricter
requirements than d3d10 does it might not, but IIRC the requirements are
actually still looser than what d3d10 needs).


More information about the mesa-dev mailing list