[Mesa-dev] [PATCH v2 3/4] gallium: add GREMEDY_string_marker

Ilia Mirkin imirkin at alum.mit.edu
Wed Jan 20 11:48:11 PST 2016


Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

(with the GREMEDY bits subject to resolution of patch 1.)

On Wed, Jan 20, 2016 at 2:32 PM, Rob Clark <robdclark at gmail.com> wrote:
> From: Rob Clark <robclark at freedesktop.org>
>
> Since the GREMEDY extensions are normally only exposed by the gremedy
> debugger (and could possibly trigger debug paths in the app), we don't
> expose the extension by default, but instead only with
> ST_DEBUG=gremedy.
>
> Signed-off-by: Rob Clark <robclark at freedesktop.org>
> ---
>  src/gallium/docs/source/screen.rst               | 1 +
>  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/vc4/vc4_screen.c             | 1 +
>  src/gallium/include/pipe/p_context.h             | 7 +++++++
>  src/gallium/include/pipe/p_defines.h             | 1 +
>  src/mesa/state_tracker/st_context.c              | 9 +++++++++
>  src/mesa/state_tracker/st_debug.c                | 1 +
>  src/mesa/state_tracker/st_debug.h                | 1 +
>  src/mesa/state_tracker/st_extensions.c           | 5 +++++
>  20 files changed, 38 insertions(+)
>
> diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
> index d7ea123..b461810 100644
> --- a/src/gallium/docs/source/screen.rst
> +++ b/src/gallium/docs/source/screen.rst
> @@ -305,6 +305,7 @@ The integer capabilities:
>    for buffers is supported.
>  * ``PIPE_CAP_GENERATE_MIPMAP``: Indicates whether pipe_context::generate_mipmap
>    is supported.
> +* ``PIPE_CAP_STRING_MARKER``: Whether pipe->emit_string_marker() is supported.
>
>
>  .. _pipe_capf:
> diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
> index 6562924..e7b21de 100644
> --- a/src/gallium/drivers/freedreno/freedreno_screen.c
> +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
> @@ -164,6 +164,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>         case PIPE_CAP_TEXTURE_BARRIER:
>         case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
>         case PIPE_CAP_COMPUTE:
> +       case PIPE_CAP_STRING_MARKER:
>                 return 0;
>
>         case PIPE_CAP_SM3:
> diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
> index ede5558..6b0ab58 100644
> --- a/src/gallium/drivers/i915/i915_screen.c
> +++ b/src/gallium/drivers/i915/i915_screen.c
> @@ -261,6 +261,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
>     case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
>     case PIPE_CAP_INVALIDATE_BUFFER:
>     case PIPE_CAP_GENERATE_MIPMAP:
> +   case PIPE_CAP_STRING_MARKER:
>        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 fa32757..5171cca 100644
> --- a/src/gallium/drivers/ilo/ilo_screen.c
> +++ b/src/gallium/drivers/ilo/ilo_screen.c
> @@ -485,6 +485,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
>     case PIPE_CAP_INVALIDATE_BUFFER:
>     case PIPE_CAP_GENERATE_MIPMAP:
> +   case PIPE_CAP_STRING_MARKER:
>        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 fb52f5d..879a2e7 100644
> --- a/src/gallium/drivers/llvmpipe/lp_screen.c
> +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
> @@ -310,6 +310,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
>     case PIPE_CAP_INVALIDATE_BUFFER:
>     case PIPE_CAP_GENERATE_MIPMAP:
> +   case PIPE_CAP_STRING_MARKER:
>        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 933330f..61d91fd 100644
> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> @@ -183,6 +183,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>     case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
>     case PIPE_CAP_INVALIDATE_BUFFER:
>     case PIPE_CAP_GENERATE_MIPMAP:
> +   case PIPE_CAP_STRING_MARKER:
>        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 712835c..32da60e 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> @@ -226,6 +226,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>     case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
>     case PIPE_CAP_INVALIDATE_BUFFER:
>     case PIPE_CAP_GENERATE_MIPMAP:
> +   case PIPE_CAP_STRING_MARKER:
>        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 7211df9..84dbd69 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> @@ -215,6 +215,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>     case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
>     case PIPE_CAP_INVALIDATE_BUFFER:
>     case PIPE_CAP_GENERATE_MIPMAP:
> +   case PIPE_CAP_STRING_MARKER:
>        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 8823b8d..90c4f71 100644
> --- a/src/gallium/drivers/r300/r300_screen.c
> +++ b/src/gallium/drivers/r300/r300_screen.c
> @@ -209,6 +209,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>          case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
>          case PIPE_CAP_INVALIDATE_BUFFER:
>          case PIPE_CAP_GENERATE_MIPMAP:
> +        case PIPE_CAP_STRING_MARKER:
>              return 0;
>
>          /* SWTCL-only features. */
> diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
> index 08fdd36..c430eb3 100644
> --- a/src/gallium/drivers/r600/r600_pipe.c
> +++ b/src/gallium/drivers/r600/r600_pipe.c
> @@ -357,6 +357,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>         case PIPE_CAP_TGSI_FS_FACE_IS_INTEGER_SYSVAL:
>         case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
>         case PIPE_CAP_GENERATE_MIPMAP:
> +       case PIPE_CAP_STRING_MARKER:
>                 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 f6ff4a8..3e20c3b 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.c
> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
> @@ -349,6 +349,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>         case PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS:
>         case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
>         case PIPE_CAP_GENERATE_MIPMAP:
> +       case PIPE_CAP_STRING_MARKER:
>                 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 143702a..3bc5808 100644
> --- a/src/gallium/drivers/softpipe/sp_screen.c
> +++ b/src/gallium/drivers/softpipe/sp_screen.c
> @@ -260,6 +260,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
>     case PIPE_CAP_INVALIDATE_BUFFER:
>     case PIPE_CAP_GENERATE_MIPMAP:
> +   case PIPE_CAP_STRING_MARKER:
>        return 0;
>     }
>     /* should only get here on unhandled cases */
> diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
> index b21634f..8d04222 100644
> --- a/src/gallium/drivers/svga/svga_screen.c
> +++ b/src/gallium/drivers/svga/svga_screen.c
> @@ -357,6 +357,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_TGSI_PACK_HALF_FLOAT:
>     case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
>     case PIPE_CAP_INVALIDATE_BUFFER:
> +   case PIPE_CAP_STRING_MARKER:
>        return 0;
>     case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
>        return 64;
> diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
> index fb41877..08c2dad 100644
> --- a/src/gallium/drivers/vc4/vc4_screen.c
> +++ b/src/gallium/drivers/vc4/vc4_screen.c
> @@ -198,6 +198,7 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>          case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
>          case PIPE_CAP_INVALIDATE_BUFFER:
>          case PIPE_CAP_GENERATE_MIPMAP:
> +        case PIPE_CAP_STRING_MARKER:
>                  return 0;
>
>                  /* Stream output. */
> diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
> index 4b551ed..f69a75b 100644
> --- a/src/gallium/include/pipe/p_context.h
> +++ b/src/gallium/include/pipe/p_context.h
> @@ -679,6 +679,13 @@ struct pipe_context {
>                              unsigned flags);
>
>     /**
> +    * Emit string marker in cmdstream
> +    */
> +   void (*emit_string_marker)(struct pipe_context *ctx,
> +                              const char *string,
> +                              int len);
> +
> +   /**
>      * Generate mipmap.
>      * \return TRUE if mipmap generation succeeds, FALSE otherwise
>      */
> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
> index cb837cd..b46187b 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -644,6 +644,7 @@ enum pipe_cap
>     PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT,
>     PIPE_CAP_INVALIDATE_BUFFER,
>     PIPE_CAP_GENERATE_MIPMAP,
> +   PIPE_CAP_STRING_MARKER,
>  };
>
>  #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
> diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
> index 4add50e..ce1e97a 100644
> --- a/src/mesa/state_tracker/st_context.c
> +++ b/src/mesa/state_tracker/st_context.c
> @@ -438,6 +438,12 @@ void st_destroy_context( struct st_context *st )
>     free(ctx);
>  }
>
> +static void
> +st_emit_string_marker(struct gl_context *ctx, const GLchar *string, GLsizei len)
> +{
> +   struct st_context *st = ctx->st;
> +   st->pipe->emit_string_marker(st->pipe, string, len);
> +}
>
>  void st_init_driver_functions(struct pipe_screen *screen,
>                                struct dd_function_table *functions)
> @@ -476,6 +482,9 @@ void st_init_driver_functions(struct pipe_screen *screen,
>
>     st_init_vdpau_functions(functions);
>
> +   if (screen->get_param(screen, PIPE_CAP_STRING_MARKER))
> +      functions->EmitStringMarker = st_emit_string_marker;
> +
>     functions->Enable = st_Enable;
>     functions->UpdateState = st_invalidate_state;
>  }
> diff --git a/src/mesa/state_tracker/st_debug.c b/src/mesa/state_tracker/st_debug.c
> index 134366d..9eb3b53 100644
> --- a/src/mesa/state_tracker/st_debug.c
> +++ b/src/mesa/state_tracker/st_debug.c
> @@ -57,6 +57,7 @@ static const struct debug_named_value st_debug_flags[] = {
>     { "buffer",   DEBUG_BUFFER, NULL },
>     { "wf",       DEBUG_WIREFRAME, NULL },
>     { "precompile",  DEBUG_PRECOMPILE, NULL },
> +   { "gremedy",  DEBUG_GREMEDY, "Enable GREMEDY debug extensions" },
>     DEBUG_NAMED_VALUE_END
>  };
>
> diff --git a/src/mesa/state_tracker/st_debug.h b/src/mesa/state_tracker/st_debug.h
> index ed3ead8..a094fdc 100644
> --- a/src/mesa/state_tracker/st_debug.h
> +++ b/src/mesa/state_tracker/st_debug.h
> @@ -50,6 +50,7 @@ st_print_current(void);
>  #define DEBUG_BUFFER    0x200
>  #define DEBUG_WIREFRAME 0x400
>  #define DEBUG_PRECOMPILE   0x800
> +#define DEBUG_GREMEDY   0x1000
>
>  #ifdef DEBUG
>  extern int ST_DEBUG;
> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> index 2a3e523..53ea676 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -37,6 +37,7 @@
>  #include "util/u_math.h"
>
>  #include "st_context.h"
> +#include "st_debug.h"
>  #include "st_extensions.h"
>  #include "st_format.h"
>
> @@ -973,4 +974,8 @@ void st_init_extensions(struct pipe_screen *screen,
>        extensions->ARB_gpu_shader_fp64 = GL_TRUE;
>        extensions->ARB_vertex_attrib_64bit = GL_TRUE;
>     }
> +
> +   if ((ST_DEBUG & DEBUG_GREMEDY) &&
> +       screen->get_param(screen, PIPE_CAP_STRING_MARKER))
> +      extensions->GREMEDY_string_marker = GL_TRUE;
>  }
> --
> 2.5.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list