gallium: add GREMEDY_string_marker
authorRob Clark <robclark@freedesktop.org>
Mon, 10 Aug 2015 15:41:29 +0000 (11:41 -0400)
committerRob Clark <robclark@freedesktop.org>
Thu, 21 Jan 2016 22:19:56 +0000 (17:19 -0500)
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@freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
20 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/vc4/vc4_screen.c
src/gallium/include/pipe/p_context.h
src/gallium/include/pipe/p_defines.h
src/mesa/state_tracker/st_context.c
src/mesa/state_tracker/st_debug.c
src/mesa/state_tracker/st_debug.h
src/mesa/state_tracker/st_extensions.c

index d7ea123b0e9ea8375b6c1a20a6b5774f183540e4..b461810644ac5056dde09422bf94384e29d85506 100644 (file)
@@ -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:
index 6562924dae10d293542ac0686c09f522004a8733..e7b21de6136d254339a093bfdb3904b61ef98cfe 100644 (file)
@@ -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:
index ede5558a11e543b84433dc27ec4d4f0d356de96d..6b0ab587001c6e35c06a0af5c5754e85607c6b38 100644 (file)
@@ -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:
index fa327571b9bf739e78a5e16ba177df5bb3c29fa5..5171cca9ea65b248ce7e6fb63f026e4249112adc 100644 (file)
@@ -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:
index fb52f5dc06331ac14d340f89a8650c1f5de9d01b..879a2e7d2f0af7944cd5e36a3a4b346f127c4b99 100644 (file)
@@ -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 */
index 933330f107a20a9cbff3851b26dfae5b1e028a49..61d91fd4cce8e6f370160b88c1b8a68a4c8ad762 100644 (file)
@@ -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:
index 712835c1ce15c1143318226cee4fa378375358a8..32da60e0a2391df9d870972cf84f0c0888c0a046 100644 (file)
@@ -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:
index 7211df94bb85eb3cf0e540160acdf11bdd604c0a..84dbd69b8a514b4fe7001751cc490b3b697822b3 100644 (file)
@@ -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:
index 8823b8d3197bb64ad9df4e2d74dc6f8bd77e874e..90c4f71a9458961f8326533c8233b15180d3bd6f 100644 (file)
@@ -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. */
index 8abd60231f9ae2f63f4b0dee5f3b2072a81b1293..9b0f31270dfc968f9cbd6e5f41dbe081114a7ab8 100644 (file)
@@ -363,6 +363,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:
index f6ff4a81bd458cfdd8a71c339146bab9514d4508..3e20c3b81faec6722a0b1508a1b9b8118df0fb67 100644 (file)
@@ -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:
index 143702a5650c323d6025649d1c29d9dadb81cfda..3bc580899d497c08d6a3c83e88d2643b5e8245c5 100644 (file)
@@ -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 */
index b21634f3d738d36780a74edb33e29ee2ff13962f..8d04222a0cd3fb123cec98d9d06e080dc05aae16 100644 (file)
@@ -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;
index fb41877017d0530aa914456a755761fabcec0403..08c2dad84065858482a735717cd57e280eac39b8 100644 (file)
@@ -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. */
index 4b551ed0b413bd1bee810a704542a684bc525170..f69a75be50eaf3dc3516f83de3c92bdd33cc1d86 100644 (file)
@@ -678,6 +678,13 @@ struct pipe_context {
    void (*dump_debug_state)(struct pipe_context *ctx, FILE *stream,
                             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
index cb837cd25978b7ffa68e6852ca9c87ec34b85523..b46187bc8a12137422622a7bfec90f8bd4edddbe 100644 (file)
@@ -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)
index 4add50e3ed9369298480352917414bd157f850fa..ce1e97aacb5daa980073bed04250869fe92ccd44 100644 (file)
@@ -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;
 }
index 134366db09d987b047c4becedcb17175c0b1d06e..9eb3b53b2304bbfd002bab4adf68e93611e34c08 100644 (file)
@@ -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
 };
 
index ed3ead82914e65d5d41d0ddafa56107391d9440d..a094fdc2bfaafbfb720e20f560c3e62d8c667845 100644 (file)
@@ -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;
index 2a3e52362e4c0bf02881803e116bb3454b4df5cd..53ea676739575662e24a401fa5192e2690aebf71 100644 (file)
@@ -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;
 }