This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

GLES Disjoint timer query unexpected value

Hi,

I'm having an issue getting plausible values at certain times with a disjoint timer query. I've read the discussion in here but my issue seems slightly different.

I'm not trying to time individual draw calls but rather the time it takes for complete the backbuffer.

I'm getting "roughly" consistent numbers for a large part of the frames, but frequently get 18446744073709551615 (2^64-1). This happens even when glGetQueryObjectuiv() returns true for an available query. Here's a snippet of the code (which is a slightly modified version this Unity plugin to use a 64-bit query):

GLuint available = 0;
glGetQueryObjectuiv(queryObject, GL_QUERY_RESULT_AVAILABLE, &available);
if (available == GL_TRUE) 
{
  GLuint64 elapsed_time_ns;
  glGetQueryObjectui64vEXT(queryObject, GL_QUERY_RESULT, &elapsed_time_ns);
  if (glGetError() == GL_NO_ERROR) 
  {
    ...
  }
  ...
}

I've tried forcing a synchronous call by ignoring the availability of the result. In such cases, the MAX_UINT above doesn't seem to occur and the values are "roughly" consistent (sometimes a few ms apart, but that's perhaps due HW pipelining).

I've gone through the extension spec but I can't find anything that might explain this. Could I've missed something?

I'm running this on a Samsung A20 with a Mali-G71. I've tried the same test on a device with an old Adreno 330 and I don't seem to get the same issue though.

GLuint available = 0;
glGetQueryObjectuiv(queryObject, GL_QUERY_RESULT_AVAILABLE, &available);
if (available == GL_TRUE) 
{
  GLuint64 elapsed_time_ns;
  glGetQueryObjectui64vEXT(queryObject, GL_QUERY_RESULT, &elapsed_time_ns);
  if (glGetError() == GL_NO_ERROR) 
  {
    ...
  }
  ...
}

Parents
  • Our driver will also have a wait in glGetQueryObjectui64vEXT(GL_QUERY_RESULT_EXT) if GL_QUERY_RESULT_AVAILABLE_EXT is not called, and the result is initialized to 0.

    Can you please try this?

    GLuint query;
            GLuint64 time;
            GLuint dis_result = 0;
            glGenQueriesEXT(1, &query);
            glBeginQueryEXT(GL_TIME_ELAPSED_EXT, query);
            glClear(GL_COLOR_BUFFER_BIT);
            glEndQueryEXT(GL_TIME_ELAPSED_EXT);
    
            while (!dis_result)
            {
                    glGetQueryObjectuivEXT(query, GL_QUERY_RESULT_AVAILABLE_EXT, &dis_result);
            }
    
            glGetQueryObjectui64vEXT(query, GL_QUERY_RESULT_EXT, &time);
    		__android_log_print(ANDROID_LOG_ERROR, "Timer", "elapsed time is: %lld\n", (long long)time);
            glDeleteQueriesEXT(1, &query);

    I can always get something like

    elapsed time is: 4273

    So if you are still getting -1, I think I have to contact Samsung if they changed the driver a little bit.

Reply
  • Our driver will also have a wait in glGetQueryObjectui64vEXT(GL_QUERY_RESULT_EXT) if GL_QUERY_RESULT_AVAILABLE_EXT is not called, and the result is initialized to 0.

    Can you please try this?

    GLuint query;
            GLuint64 time;
            GLuint dis_result = 0;
            glGenQueriesEXT(1, &query);
            glBeginQueryEXT(GL_TIME_ELAPSED_EXT, query);
            glClear(GL_COLOR_BUFFER_BIT);
            glEndQueryEXT(GL_TIME_ELAPSED_EXT);
    
            while (!dis_result)
            {
                    glGetQueryObjectuivEXT(query, GL_QUERY_RESULT_AVAILABLE_EXT, &dis_result);
            }
    
            glGetQueryObjectui64vEXT(query, GL_QUERY_RESULT_EXT, &time);
    		__android_log_print(ANDROID_LOG_ERROR, "Timer", "elapsed time is: %lld\n", (long long)time);
            glDeleteQueriesEXT(1, &query);

    I can always get something like

    elapsed time is: 4273

    So if you are still getting -1, I think I have to contact Samsung if they changed the driver a little bit.

Children