From 4ba2df0bd2e62fd623f50e4c0e2445a9515fa1dc Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Fri, 9 Oct 2020 11:20:25 +0300 Subject: [PATCH] cogl: Remove cogl_get_clock_time() It's no longer used. Part-of: --- cogl/cogl/cogl-context.c | 11 ------ cogl/cogl/cogl-context.h | 23 ----------- cogl/cogl/winsys/cogl-winsys-glx.c | 46 ---------------------- cogl/cogl/winsys/cogl-winsys-private.h | 3 -- src/backends/native/meta-gpu-kms.c | 19 --------- src/backends/native/meta-gpu-kms.h | 2 - src/backends/native/meta-renderer-native.c | 11 ------ 7 files changed, 115 deletions(-) diff --git a/cogl/cogl/cogl-context.c b/cogl/cogl/cogl-context.c index 85002cdec..b7bf14f87 100644 --- a/cogl/cogl/cogl-context.c +++ b/cogl/cogl/cogl-context.c @@ -449,17 +449,6 @@ _cogl_context_set_current_modelview_entry (CoglContext *context, context->current_modelview_entry = entry; } -int64_t -cogl_get_clock_time (CoglContext *context) -{ - const CoglWinsysVtable *winsys = _cogl_context_get_winsys (context); - - if (winsys->context_get_clock_time) - return winsys->context_get_clock_time (context); - else - return 0; -} - CoglGraphicsResetStatus cogl_get_graphics_reset_status (CoglContext *context) { diff --git a/cogl/cogl/cogl-context.h b/cogl/cogl/cogl-context.h index b6e8b8152..20b9561b9 100644 --- a/cogl/cogl/cogl-context.h +++ b/cogl/cogl/cogl-context.h @@ -286,29 +286,6 @@ cogl_foreach_feature (CoglContext *context, CoglFeatureCallback callback, void *user_data); -/** - * cogl_get_clock_time: - * @context: a #CoglContext pointer - * - * Returns the current time value from Cogl's internal clock. This - * clock is used for measuring times such as the presentation time - * in a #CoglFrameInfo. - * - * This method is meant for converting timestamps retrieved from Cogl - * to other time systems, and is not meant to be used as a standalone - * timing system. For that reason, if this function is called without - * having retrieved a valid (non-zero) timestamp from Cogl first, it - * may return 0 to indicate that Cogl has no active internal clock. - * - * Return value: the time value for the Cogl clock, in nanoseconds - * from an arbitrary point in time, or 0 if Cogl doesn't have an - * active internal clock. - * Since: 1.14 - * Stability: unstable - */ -COGL_EXPORT int64_t -cogl_get_clock_time (CoglContext *context); - /** * CoglGraphicsResetStatus: * @COGL_GRAPHICS_RESET_STATUS_NO_ERROR: diff --git a/cogl/cogl/winsys/cogl-winsys-glx.c b/cogl/cogl/winsys/cogl-winsys-glx.c index bf0acffc9..a2cb5c548 100644 --- a/cogl/cogl/winsys/cogl-winsys-glx.c +++ b/cogl/cogl/winsys/cogl-winsys-glx.c @@ -174,51 +174,6 @@ find_onscreen_for_xid (CoglContext *context, uint32_t xid) return NULL; } -static int64_t -get_monotonic_time_ns (void) -{ - struct timespec ts; - - clock_gettime (CLOCK_MONOTONIC, &ts); - return ts.tv_sec * G_GINT64_CONSTANT (1000000000) + ts.tv_nsec; -} - -static int64_t -_cogl_winsys_get_clock_time (CoglContext *context) -{ - CoglGLXRenderer *glx_renderer = context->display->renderer->winsys; - - if (!glx_renderer->glXWaitForMsc) - return get_monotonic_time_ns (); - - /* We don't call ensure_ust_type() because we don't have a drawable - * to work with. cogl_get_clock_time() is documented to only work - * once a valid, non-zero, timestamp has been retrieved from Cogl. - */ - - switch (glx_renderer->ust_type) - { - case COGL_GLX_UST_IS_UNKNOWN: - case COGL_GLX_UST_IS_OTHER: - return 0; - case COGL_GLX_UST_IS_GETTIMEOFDAY: - { - struct timeval tv; - - gettimeofday(&tv, NULL); - return tv.tv_sec * G_GINT64_CONSTANT (1000000000) + - tv.tv_usec * G_GINT64_CONSTANT (1000); - } - case COGL_GLX_UST_IS_MONOTONIC_TIME: - { - return get_monotonic_time_ns (); - } - } - - g_assert_not_reached(); - return 0; -} - static void notify_swap_buffers (CoglContext *context, GLXBufferSwapComplete *swap_event) { @@ -1468,7 +1423,6 @@ static CoglWinsysVtable _cogl_winsys_vtable = .display_destroy = _cogl_winsys_display_destroy, .context_init = _cogl_winsys_context_init, .context_deinit = _cogl_winsys_context_deinit, - .context_get_clock_time = _cogl_winsys_get_clock_time, /* X11 tfp support... */ /* XXX: instead of having a rather monolithic winsys vtable we could diff --git a/cogl/cogl/winsys/cogl-winsys-private.h b/cogl/cogl/winsys/cogl-winsys-private.h index 788573f94..29bea6aa4 100644 --- a/cogl/cogl/winsys/cogl-winsys-private.h +++ b/cogl/cogl/winsys/cogl-winsys-private.h @@ -105,9 +105,6 @@ typedef struct _CoglWinsysVtable /* Optional functions */ - int64_t - (*context_get_clock_time) (CoglContext *context); - #ifdef COGL_HAS_XLIB_SUPPORT gboolean (*texture_pixmap_x11_create) (CoglTexturePixmapX11 *tex_pixmap); diff --git a/src/backends/native/meta-gpu-kms.c b/src/backends/native/meta-gpu-kms.c index 7cec11325..e964b1094 100644 --- a/src/backends/native/meta-gpu-kms.c +++ b/src/backends/native/meta-gpu-kms.c @@ -100,14 +100,6 @@ meta_gpu_kms_is_crtc_active (MetaGpuKms *gpu_kms, return TRUE; } -static int64_t -timespec_to_nanoseconds (const struct timespec *ts) -{ - const int64_t one_billion = 1000000000; - - return ((int64_t) ts->tv_sec) * one_billion + ts->tv_nsec; -} - MetaKmsDevice * meta_gpu_kms_get_kms_device (MetaGpuKms *gpu_kms) { @@ -132,17 +124,6 @@ meta_gpu_kms_get_file_path (MetaGpuKms *gpu_kms) return meta_kms_device_get_path (gpu_kms->kms_device); } -int64_t -meta_gpu_kms_get_current_time_ns (MetaGpuKms *gpu_kms) -{ - struct timespec ts; - - if (clock_gettime (gpu_kms->clock_id, &ts)) - return 0; - - return timespec_to_nanoseconds (&ts); -} - gboolean meta_gpu_kms_is_clock_monotonic (MetaGpuKms *gpu_kms) { diff --git a/src/backends/native/meta-gpu-kms.h b/src/backends/native/meta-gpu-kms.h index 8af89b0ce..80957f5a0 100644 --- a/src/backends/native/meta-gpu-kms.h +++ b/src/backends/native/meta-gpu-kms.h @@ -57,8 +57,6 @@ uint32_t meta_gpu_kms_get_id (MetaGpuKms *gpu_kms); const char * meta_gpu_kms_get_file_path (MetaGpuKms *gpu_kms); -int64_t meta_gpu_kms_get_current_time_ns (MetaGpuKms *gpu_kms); - gboolean meta_gpu_kms_is_clock_monotonic (MetaGpuKms *gpu_kms); void meta_gpu_kms_set_power_save_mode (MetaGpuKms *gpu_kms, diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c index 0bb3eb66a..0839904b4 100644 --- a/src/backends/native/meta-renderer-native.c +++ b/src/backends/native/meta-renderer-native.c @@ -904,15 +904,6 @@ meta_renderer_native_create_offscreen (MetaRendererNative *renderer, return fb; } -static int64_t -meta_renderer_native_get_clock_time (CoglContext *context) -{ - CoglRenderer *cogl_renderer = cogl_context_get_renderer (context); - MetaGpuKms *gpu_kms = cogl_renderer->custom_winsys_user_data; - - return meta_gpu_kms_get_current_time_ns (gpu_kms); -} - static const CoglWinsysVtable * get_native_cogl_winsys_vtable (CoglRenderer *cogl_renderer) { @@ -934,8 +925,6 @@ get_native_cogl_winsys_vtable (CoglRenderer *cogl_renderer) vtable.renderer_disconnect = meta_renderer_native_disconnect; vtable.renderer_create_dma_buf = meta_renderer_native_create_dma_buf; - vtable.context_get_clock_time = meta_renderer_native_get_clock_time; - vtable_inited = TRUE; }