[PATCH 2/2] retrace: use GREMEDY_string_marker to emit call no's

Rob Clark robdclark at gmail.com
Sat Aug 15 05:25:28 PDT 2015


On Fri, Aug 14, 2015 at 8:50 AM, José Fonseca <jose.r.fonseca at gmail.com> wrote:
> It's a good idea.
>
> But I think that instead of GL_GREMEDY_string_marker it would be better to
> use GL_KHR_debug and
>
>   glDebugMessageInsert(GL_DEBUG_SOURCE_THIRD_PARTY,...)
>
> as KHR_debug already foresees this sort of usage (from the spec):
>
>     "A message's source identifies the origin of the message and can either
>     describe components of the GL, the window system, third-party external
>     sources such as external debuggers, or even the application itself."
>
> We could also use an unique message id (like `APTR`) so the OpenGL driver
> can treat this message specially (e.g., use it to annotate its command
> lists, etc.)

hmm, actually it seems like this was envisioned with
GL_DEBUG_TYPE_MARKER.. I'll update my mesa patchset to plumb this
message type through to the driver so that it can actually be inserted
into the cmdstream as intended..

BR,
-R

> This also should only be done when retrace::debug option is enabled (in
> particular, nothing of the sort should be attempted when benchmarking.)
>
> Jose
>
> On Mon, Aug 10, 2015 at 11:14 PM, Rob Clark <robdclark at gmail.com> wrote:
>>
>> If the extension is present, use it to log call numbers for draw
>> commands.
>>
>> Signed-off-by: Rob Clark <robdclark at gmail.com>
>> ---
>>  retrace/glretrace.hpp      |  2 ++
>>  retrace/glretrace_main.cpp | 15 +++++++++++++++
>>  retrace/retrace.hpp        |  2 ++
>>  retrace/retrace_main.cpp   |  4 ++++
>>  4 files changed, 23 insertions(+)
>>
>> diff --git a/retrace/glretrace.hpp b/retrace/glretrace.hpp
>> index b172f85..ebd5996 100644
>> --- a/retrace/glretrace.hpp
>> +++ b/retrace/glretrace.hpp
>> @@ -55,6 +55,8 @@ struct Context {
>>
>>      bool used;
>>
>> +    bool GREMEDY_string_marker;
>> +
>>      inline glprofile::Profile
>>      profile(void) const {
>>          return wsContext->profile;
>> diff --git a/retrace/glretrace_main.cpp b/retrace/glretrace_main.cpp
>> index 71dde8e..513aca3 100755
>> --- a/retrace/glretrace_main.cpp
>> +++ b/retrace/glretrace_main.cpp
>> @@ -348,6 +348,7 @@ initContext() {
>>      supportsElapsed     =
>> currentContext->hasExtension("GL_EXT_timer_query") || supportsTimestamp;
>>      supportsOcclusion   =
>> currentProfile.versionGreaterOrEqual(glprofile::API_GL, 1, 5);
>>      supportsARBShaderObjects =
>> currentContext->hasExtension("GL_ARB_shader_objects");
>> +    currentContext->GREMEDY_string_marker =
>> currentContext->hasExtension("GL_GREMEDY_string_marker");
>>
>>  #ifdef __APPLE__
>>      // GL_TIMESTAMP doesn't work on Apple.  GL_TIME_ELAPSED still does
>> however.
>> @@ -620,6 +621,20 @@ public:
>>      dumpState(StateWriter &writer) {
>>          glstate::dumpCurrentContext(writer);
>>      }
>> +
>> +    void
>> +    log(trace::Call &call) {
>> +        glretrace::Context *currentContext =
>> glretrace::getCurrentContext();
>> +        if (currentContext && currentContext->GREMEDY_string_marker) {
>> +            char *str;
>> +            int len = asprintf(&str, "%d:%s", call.no, call.name());
>> +            if (len > 0) {
>> +                glStringMarkerGREMEDY(len, str);
>> +                free(str);
>> +            }
>> +        }
>> +    }
>> +
>>  };
>>
>>  static GLDumper glDumper;
>> diff --git a/retrace/retrace.hpp b/retrace/retrace.hpp
>> index c2b06e3..c624b27 100644
>> --- a/retrace/retrace.hpp
>> +++ b/retrace/retrace.hpp
>> @@ -217,6 +217,8 @@ public:
>>
>>      virtual void
>>      dumpState(StateWriter &) = 0;
>> +
>> +    virtual void log(trace::Call &call) {}
>>  };
>>
>>
>> diff --git a/retrace/retrace_main.cpp b/retrace/retrace_main.cpp
>> index 48651cd..356aca3 100644
>> --- a/retrace/retrace_main.cpp
>> +++ b/retrace/retrace_main.cpp
>> @@ -232,6 +232,10 @@ retraceCall(trace::Call *call) {
>>          }
>>      }
>>
>> +    if (call->flags & trace::CALL_FLAG_RENDER) {
>> +       dumper->log(*call);
>> +    }
>> +
>>      retracer.retrace(*call);
>>
>>      if (doSnapshot) {
>> --
>> 2.4.3
>>
>> _______________________________________________
>> apitrace mailing list
>> apitrace at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/apitrace
>
>


More information about the apitrace mailing list