On 12/12/2017 07:00 PM, Ian Romanick wrote:
On 11/19/2017 11:18 PM, Tapani Pälli wrote:
Add GL_GPU_DISJOINT_EXT and enable extension when ARB_timer_query
is supported by the driver.

Following dEQP cases pass:
    dEQP-EGL.functional.get_proc_address.extension.gl_ext_disjoint_timer_query
    dEQP-EGL.functional.client_extensions.disjoint

Piglit test 'ext_disjoint_timer_query-simple' passes with these changes.

No changes/regression observed in Intel CI.

Signed-off-by: Tapani Pälli <[email protected]>
---
  src/mesa/main/extensions_table.h |  1 +
  src/mesa/main/get.c              | 17 +++++++++++++++++
  src/mesa/main/get_hash_params.py |  5 +++++
  src/mesa/main/glheader.h         |  4 ++++
  src/mesa/main/mtypes.h           |  1 +
  src/mesa/main/queryobj.c         |  3 ++-
  6 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index 5b66e7d30d..78f0d35feb 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -209,6 +209,7 @@ EXT(EXT_copy_image                          , OES_copy_image
  EXT(EXT_copy_texture                        , dummy_true                      
       , GLL,  x ,  x ,  x , 1995)
  EXT(EXT_depth_bounds_test                   , EXT_depth_bounds_test           
       , GLL, GLC,  x ,  x , 2002)
  EXT(EXT_discard_framebuffer                 , dummy_true                      
       ,  x ,  x , ES1, ES2, 2009)
+EXT(EXT_disjoint_timer_query                , ARB_timer_query                  
      ,  x ,  x ,  x , ES2, 2016)
                                                  ^^^^^^^^^^^^^^^

This should be EXT_disjoint_timer_query, right?  All of the things below
seem to use that flag.

Right, seems like I did not think this through. Earlier I thought we could simply turn it on for all drivers that support ARB_timer_query (and robustness) but seems not all the drivers do so we need to toggle it on separately. I will need to update this one and add a separate patch to toggle it on in the i965 driver.


  EXT(EXT_draw_buffers                        , dummy_true                      
       ,  x ,  x ,  x , ES2, 2012)
  EXT(EXT_draw_buffers2                       , EXT_draw_buffers2               
       , GLL, GLC,  x ,  x , 2006)
  EXT(EXT_draw_buffers_indexed                , ARB_draw_buffers_blend          
       ,  x ,  x ,  x ,  30, 2014)
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index ea8d932b18..6c0d1f7e9a 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -578,6 +578,13 @@ static const int extra_EXT_provoking_vertex_32[] = {
     EXTRA_END
  };
+static const int extra_EXT_disjoint_timer_query[] = {
+   EXTRA_API_ES2,
+   EXTRA_API_ES3,
+   EXT(EXT_disjoint_timer_query),
+   EXTRA_END
+};
+
/* This is the big table describing all the enums we accept in
   * glGet*v().  The table is partitioned into six parts: enums
@@ -1151,6 +1158,16 @@ find_custom_value(struct gl_context *ctx, const struct 
value_desc *d, union valu
           }
        }
        break;
+   /* GL_EXT_disjoint_timer_query */
+   case GL_GPU_DISJOINT_EXT:
+      {
+         simple_mtx_lock(&ctx->Shared->Mutex);
+         v->value_int = ctx->Shared->DisjointOperation;
+         /* Reset state as expected by the spec. */
+         ctx->Shared->DisjointOperation = false;
+         simple_mtx_unlock(&ctx->Shared->Mutex);
+      }
+      break;
     }
  }
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 20ef6e4977..55a956da84 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -254,6 +254,11 @@ descriptor=[
    [ "POINT_SIZE_ARRAY_BUFFER_BINDING_OES", "LOC_CUSTOM, TYPE_INT, 0, 
NO_EXTRA" ],
  ]},
+# Enums in GLES2, GLES3
+{ "apis": ["GLES2", "GLES3"], "params": [
+  [ "GPU_DISJOINT_EXT", "LOC_CUSTOM, TYPE_INT, 0, 
extra_EXT_disjoint_timer_query" ],
+]},
+
  { "apis": ["GL", "GL_CORE", "GLES2"], "params": [
  # == GL_MAX_TEXTURE_COORDS_NV
    [ "MAX_TEXTURE_COORDS_ARB", "CONTEXT_INT(Const.MaxTextureCoordUnits), 
extra_ARB_fragment_program" ],
diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h
index 3f2a923782..35a442a77b 100644
--- a/src/mesa/main/glheader.h
+++ b/src/mesa/main/glheader.h
@@ -144,6 +144,10 @@ typedef void *GLeglImageOES;
  #define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT                 0x8A52
  #endif
+#ifndef GL_EXT_disjoint_timer_query
+#define GL_GPU_DISJOINT_EXT                                     0x8FBB
+#endif
+
  /* Inexplicably, GL_HALF_FLOAT_OES has a different value than GL_HALF_FLOAT.
   */
  #ifndef GL_HALF_FLOAT_OES
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 4cb6a74d69..9ed8d86688 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -4143,6 +4143,7 @@ struct gl_extensions
     GLboolean EXT_blend_func_separate;
     GLboolean EXT_blend_minmax;
     GLboolean EXT_depth_bounds_test;
+   GLboolean EXT_disjoint_timer_query;
     GLboolean EXT_draw_buffers2;
     GLboolean EXT_framebuffer_multisample;
     GLboolean EXT_framebuffer_multisample_blit_scaled;
diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
index d966814a76..79600d7db1 100644
--- a/src/mesa/main/queryobj.c
+++ b/src/mesa/main/queryobj.c
@@ -822,7 +822,8 @@ get_query_object(struct gl_context *ctx, const char *func,
     if (buf && buf != ctx->Shared->NullBufferObj) {
        bool is_64bit = ptype == GL_INT64_ARB ||
           ptype == GL_UNSIGNED_INT64_ARB;
-      if (!ctx->Extensions.ARB_query_buffer_object) {
+      if (!ctx->Extensions.ARB_query_buffer_object &&
+          !ctx->Extensions.EXT_disjoint_timer_query) {
           _mesa_error(ctx, GL_INVALID_OPERATION, "%s(not supported)", func);
           return;
        }


_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to