[mutter] cogl: Merge FEATURE_ID_GET_GPU_TIME into FEATURE_ID_TIMESTAMP_QUERY
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] cogl: Merge FEATURE_ID_GET_GPU_TIME into FEATURE_ID_TIMESTAMP_QUERY
- Date: Thu, 27 Jan 2022 23:47:40 +0000 (UTC)
commit c970bb3e6c624aead5c8bd1b082805e14658c454
Author: Daniel van Vugt <daniel van vugt canonical com>
Date: Fri Jan 21 15:25:53 2022 +0800
cogl: Merge FEATURE_ID_GET_GPU_TIME into FEATURE_ID_TIMESTAMP_QUERY
Because both code paths require the existence of `GL_TIMESTAMP[_EXT]`
which is only guaranteed if `ARB_timer_query` (included in GL core 3.3)
is implemented.
We know when that is true because `context->glGenQueries` and
`context->glQueryCounter` are non-NULL. So that is the minimum
requirement for any use of `GL_TIMESTAMP`, even when it is used in
`glGetInteger64v`.
Until now, Raspberry Pi (OpenGL 2.1) would find a working implementation
of `glGetInteger64v` but failed to check whether the driver understands
`GL_TIMESTAMP` (it doesn't).
Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2107
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2253>
cogl/cogl/cogl-context.c | 2 +-
cogl/cogl/cogl-context.h | 3 +--
cogl/cogl/driver/gl/cogl-util-gl.c | 2 +-
cogl/cogl/driver/gl/gl/cogl-driver-gl.c | 5 +----
cogl/cogl/driver/gl/gles/cogl-driver-gles.c | 5 +----
cogl/cogl/winsys/cogl-onscreen-egl.c | 2 +-
src/backends/native/meta-drm-buffer-gbm.c | 2 +-
7 files changed, 7 insertions(+), 14 deletions(-)
---
diff --git a/cogl/cogl/cogl-context.c b/cogl/cogl/cogl-context.c
index 67bea6b8d2..276617554f 100644
--- a/cogl/cogl/cogl-context.c
+++ b/cogl/cogl/cogl-context.c
@@ -519,7 +519,7 @@ int64_t
cogl_context_get_gpu_time_ns (CoglContext *context)
{
g_return_val_if_fail (cogl_has_feature (context,
- COGL_FEATURE_ID_GET_GPU_TIME),
+ COGL_FEATURE_ID_TIMESTAMP_QUERY),
0);
return context->driver_vtable->get_gpu_time_ns (context);
diff --git a/cogl/cogl/cogl-context.h b/cogl/cogl/cogl-context.h
index 38ac11be83..dd4c3e8ef6 100644
--- a/cogl/cogl/cogl-context.h
+++ b/cogl/cogl/cogl-context.h
@@ -210,7 +210,6 @@ typedef enum _CoglFeatureID
COGL_FEATURE_ID_TEXTURE_EGL_IMAGE_EXTERNAL,
COGL_FEATURE_ID_BLIT_FRAMEBUFFER,
COGL_FEATURE_ID_TIMESTAMP_QUERY,
- COGL_FEATURE_ID_GET_GPU_TIME,
/*< private >*/
_COGL_N_FEATURE_IDS /*< skip >*/
@@ -385,7 +384,7 @@ cogl_context_timestamp_query_get_time_ns (CoglContext *context,
* cogl_context_get_gpu_time_ns:
* @context: a #CoglContext pointer
*
- * This function should only be called if the COGL_FEATURE_ID_GET_GPU_TIME
+ * This function should only be called if the COGL_FEATURE_ID_TIMESTAMP_QUERY
* feature is advertised.
*
* Return value: Current GPU time in nanoseconds
diff --git a/cogl/cogl/driver/gl/cogl-util-gl.c b/cogl/cogl/driver/gl/cogl-util-gl.c
index 59d2e74d44..32ecbd3c3f 100644
--- a/cogl/cogl/driver/gl/cogl-util-gl.c
+++ b/cogl/cogl/driver/gl/cogl-util-gl.c
@@ -558,7 +558,7 @@ cogl_gl_get_gpu_time_ns (CoglContext *context)
int64_t gpu_time_ns;
g_return_val_if_fail (cogl_has_feature (context,
- COGL_FEATURE_ID_GET_GPU_TIME),
+ COGL_FEATURE_ID_TIMESTAMP_QUERY),
0);
GE (context, glGetInteger64v (GL_TIMESTAMP, &gpu_time_ns));
diff --git a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c
index 83939e8828..e498263aa0 100644
--- a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c
+++ b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c
@@ -543,12 +543,9 @@ _cogl_driver_update_features (CoglContext *ctx,
COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_HALF_FLOAT,
TRUE);
- if (ctx->glGenQueries && ctx->glQueryCounter)
+ if (ctx->glGenQueries && ctx->glQueryCounter && ctx->glGetInteger64v)
COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_TIMESTAMP_QUERY, TRUE);
- if (ctx->glGetInteger64v)
- COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_GET_GPU_TIME, TRUE);
-
/* Cache features */
for (i = 0; i < G_N_ELEMENTS (private_features); i++)
ctx->private_features[i] |= private_features[i];
diff --git a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c
index 33d28848c3..1780c3fbeb 100644
--- a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c
+++ b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c
@@ -437,12 +437,9 @@ _cogl_driver_update_features (CoglContext *context,
COGL_FEATURE_ID_TEXTURE_RG,
TRUE);
- if (context->glGenQueries && context->glQueryCounter)
+ if (context->glGenQueries && context->glQueryCounter && context->glGetInteger64v)
COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_TIMESTAMP_QUERY, TRUE);
- if (context->glGetInteger64v)
- COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_GET_GPU_TIME, TRUE);
-
/* Cache features */
for (i = 0; i < G_N_ELEMENTS (private_features); i++)
context->private_features[i] |= private_features[i];
diff --git a/cogl/cogl/winsys/cogl-onscreen-egl.c b/cogl/cogl/winsys/cogl-onscreen-egl.c
index 8a587049e8..f078968668 100644
--- a/cogl/cogl/winsys/cogl-onscreen-egl.c
+++ b/cogl/cogl/winsys/cogl-onscreen-egl.c
@@ -295,7 +295,7 @@ cogl_onscreen_egl_swap_buffers_with_damage (CoglOnscreen *onscreen,
COGL_FRAMEBUFFER (onscreen),
COGL_FRAMEBUFFER_STATE_BIND);
- if (cogl_has_feature (context, COGL_FEATURE_ID_GET_GPU_TIME))
+ if (cogl_has_feature (context, COGL_FEATURE_ID_TIMESTAMP_QUERY))
{
info->gpu_time_before_buffer_swap_ns =
cogl_context_get_gpu_time_ns (context);
diff --git a/src/backends/native/meta-drm-buffer-gbm.c b/src/backends/native/meta-drm-buffer-gbm.c
index 30a8f5cbcd..2b00b1ebfc 100644
--- a/src/backends/native/meta-drm-buffer-gbm.c
+++ b/src/backends/native/meta-drm-buffer-gbm.c
@@ -324,7 +324,7 @@ meta_drm_buffer_gbm_fill_timings (MetaDrmBuffer *buffer,
cogl_fbo = cogl_offscreen_new_with_texture (COGL_TEXTURE (cogl_tex));
cogl_object_unref (cogl_tex);
- if (cogl_has_feature (cogl_context, COGL_FEATURE_ID_GET_GPU_TIME))
+ if (cogl_has_feature (cogl_context, COGL_FEATURE_ID_TIMESTAMP_QUERY))
{
info->gpu_time_before_buffer_swap_ns =
cogl_context_get_gpu_time_ns (cogl_context);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]