[Mesa-dev] [PATCH 1/2] gallium: add a cap for supporting 4-offset TG4 opcodes

Ilia Mirkin imirkin at alum.mit.edu
Mon Apr 28 16:34:10 PDT 2014


On Mon, Apr 28, 2014 at 7:30 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>
> I also took the liberty to tabify a few adjacent lines in the files that
> predominantly use tabs. I've done this enough times that I'm thinking of
> dropping a lot of .emacs files all over...

Oh, I meant to ask -- should this be a shader cap instead? Not really
sure where the distinction is. But TEXTURE_GATHER_SM5 is a screen cap,
and it also only affects the operation of the TG4 instruction. So I
did this change with it as a regular screen cap. But happy to flip it
around.

>
>  src/gallium/docs/source/screen.rst               | 2 ++
>  src/gallium/drivers/freedreno/freedreno_screen.c | 9 +++++----
>  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             | 3 ++-
>  src/gallium/drivers/radeonsi/si_pipe.c           | 3 ++-
>  src/gallium/drivers/softpipe/sp_screen.c         | 1 +
>  src/gallium/drivers/svga/svga_screen.c           | 1 +
>  src/gallium/include/pipe/p_defines.h             | 1 +
>  14 files changed, 21 insertions(+), 6 deletions(-)
>
> diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
> index f5acebb..7498f5c 100644
> --- a/src/gallium/docs/source/screen.rst
> +++ b/src/gallium/docs/source/screen.rst
> @@ -200,6 +200,8 @@ The integer capabilities:
>  * ``PIPE_CAP_SAMPLE_SHADING``: Whether there is support for per-sample
>    shading. The context->set_min_samples function will be expected to be
>    implemented.
> +* ``PIPE_CAP_TEXTURE_GATHER_OFFSETS``: Whether the ``TG4`` instruction can
> +  accept 4 offsets.
>
>
>  .. _pipe_capf:
> diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
> index d62d4b6..4de3e3f 100644
> --- a/src/gallium/drivers/freedreno/freedreno_screen.c
> +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
> @@ -202,13 +202,14 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>         case PIPE_CAP_USER_INDEX_BUFFERS:
>         case PIPE_CAP_QUERY_PIPELINE_STATISTICS:
>         case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
> -        case PIPE_CAP_TGSI_VS_LAYER:
> +       case PIPE_CAP_TGSI_VS_LAYER:
>         case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
>         case PIPE_CAP_TEXTURE_GATHER_SM5:
> -        case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
> -        case PIPE_CAP_FAKE_SW_MSAA:
> +       case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
> +       case PIPE_CAP_FAKE_SW_MSAA:
>         case PIPE_CAP_TEXTURE_QUERY_LOD:
> -        case PIPE_CAP_SAMPLE_SHADING:
> +       case PIPE_CAP_SAMPLE_SHADING:
> +       case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>                 return 0;
>
>         /* Stream output. */
> diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
> index 8ee4330..dfd7a2e 100644
> --- a/src/gallium/drivers/i915/i915_screen.c
> +++ b/src/gallium/drivers/i915/i915_screen.c
> @@ -221,6 +221,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
>     case PIPE_CAP_FAKE_SW_MSAA:
>     case PIPE_CAP_TEXTURE_QUERY_LOD:
>     case PIPE_CAP_SAMPLE_SHADING:
> +   case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>        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 c8fa686..0a1c56d 100644
> --- a/src/gallium/drivers/ilo/ilo_screen.c
> +++ b/src/gallium/drivers/ilo/ilo_screen.c
> @@ -440,6 +440,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_FAKE_SW_MSAA:
>     case PIPE_CAP_TEXTURE_QUERY_LOD:
>     case PIPE_CAP_SAMPLE_SHADING:
> +   case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>        return 0;
>
>     default:
> diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
> index 98dbab7..e236802 100644
> --- a/src/gallium/drivers/llvmpipe/lp_screen.c
> +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
> @@ -242,6 +242,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
>     case PIPE_CAP_TEXTURE_QUERY_LOD:
>     case PIPE_CAP_SAMPLE_SHADING:
> +   case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>        return 0;
>     case PIPE_CAP_FAKE_SW_MSAA:
>         return 1;
> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> index 77a04d2..8fe3ebf 100644
> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> @@ -136,6 +136,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>     case PIPE_CAP_FAKE_SW_MSAA:
>     case PIPE_CAP_TEXTURE_QUERY_LOD:
>     case PIPE_CAP_SAMPLE_SHADING:
> +   case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>        return 0;
>     case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY:
>     case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> index 7ffffa6..0a57cb5 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> @@ -198,6 +198,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>     case PIPE_CAP_TEXTURE_GATHER_SM5:
>     case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
>     case PIPE_CAP_FAKE_SW_MSAA:
> +   case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>        return 0;
>     case PIPE_CAP_MAX_VIEWPORTS:
>        return NV50_MAX_VIEWPORTS;
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> index 045b491..e7b387c 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> @@ -186,6 +186,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>        return 1;
>     case PIPE_CAP_TEXTURE_QUERY_LOD:
>     case PIPE_CAP_SAMPLE_SHADING:
> +   case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>        return 1;
>     case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
>        return 4;
> diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
> index d570514..2c0fc49 100644
> --- a/src/gallium/drivers/r300/r300_screen.c
> +++ b/src/gallium/drivers/r300/r300_screen.c
> @@ -174,6 +174,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>          case PIPE_CAP_TEXTURE_QUERY_LOD:
>          case PIPE_CAP_FAKE_SW_MSAA:
>          case PIPE_CAP_SAMPLE_SHADING:
> +        case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>              return 0;
>
>          /* SWTCL-only features. */
> diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
> index 0668b27..368307c 100644
> --- a/src/gallium/drivers/r600/r600_pipe.c
> +++ b/src/gallium/drivers/r600/r600_pipe.c
> @@ -314,7 +314,8 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>         case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
>         case PIPE_CAP_TEXTURE_GATHER_SM5:
>         case PIPE_CAP_TEXTURE_QUERY_LOD:
> -        case PIPE_CAP_SAMPLE_SHADING:
> +       case PIPE_CAP_SAMPLE_SHADING:
> +       case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>                 return 0;
>
>         /* Stream output. */
> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
> index 873115b..027d332 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.c
> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
> @@ -243,7 +243,8 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>         case PIPE_CAP_TGSI_TEXCOORD:
>         case PIPE_CAP_FAKE_SW_MSAA:
>         case PIPE_CAP_TEXTURE_QUERY_LOD:
> -        case PIPE_CAP_SAMPLE_SHADING:
> +       case PIPE_CAP_SAMPLE_SHADING:
> +       case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>                 return 0;
>
>         case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
> diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
> index e7c3319..316c512 100644
> --- a/src/gallium/drivers/softpipe/sp_screen.c
> +++ b/src/gallium/drivers/softpipe/sp_screen.c
> @@ -190,6 +190,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
>     case PIPE_CAP_TEXTURE_QUERY_LOD:
>     case PIPE_CAP_SAMPLE_SHADING:
> +   case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>        return 0;
>     case PIPE_CAP_FAKE_SW_MSAA:
>        return 1;
> diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
> index 8c70bb7..5281c48 100644
> --- a/src/gallium/drivers/svga/svga_screen.c
> +++ b/src/gallium/drivers/svga/svga_screen.c
> @@ -274,6 +274,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_FAKE_SW_MSAA:
>     case PIPE_CAP_TEXTURE_QUERY_LOD:
>     case PIPE_CAP_SAMPLE_SHADING:
> +   case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>        return 0;
>     case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
>        return 64;
> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
> index fec17f9..d318412 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -557,6 +557,7 @@ enum pipe_cap {
>     PIPE_CAP_MIN_TEXTURE_GATHER_OFFSET = 95,
>     PIPE_CAP_MAX_TEXTURE_GATHER_OFFSET = 96,
>     PIPE_CAP_SAMPLE_SHADING = 97,
> +   PIPE_CAP_TEXTURE_GATHER_OFFSETS = 98,
>  };
>
>  #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
> --
> 1.8.3.2
>


More information about the mesa-dev mailing list