cogl: Remove cogl_get_clock_time()

It's no longer used.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1484>
This commit is contained in:
Ivan Molodetskikh 2020-10-09 11:20:25 +03:00 committed by Marge Bot
parent 4810164885
commit 4ba2df0bd2
7 changed files with 0 additions and 115 deletions

View File

@ -449,17 +449,6 @@ _cogl_context_set_current_modelview_entry (CoglContext *context,
context->current_modelview_entry = entry; 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 CoglGraphicsResetStatus
cogl_get_graphics_reset_status (CoglContext *context) cogl_get_graphics_reset_status (CoglContext *context)
{ {

View File

@ -286,29 +286,6 @@ cogl_foreach_feature (CoglContext *context,
CoglFeatureCallback callback, CoglFeatureCallback callback,
void *user_data); 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: * CoglGraphicsResetStatus:
* @COGL_GRAPHICS_RESET_STATUS_NO_ERROR: * @COGL_GRAPHICS_RESET_STATUS_NO_ERROR:

View File

@ -174,51 +174,6 @@ find_onscreen_for_xid (CoglContext *context, uint32_t xid)
return NULL; 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 static void
notify_swap_buffers (CoglContext *context, GLXBufferSwapComplete *swap_event) notify_swap_buffers (CoglContext *context, GLXBufferSwapComplete *swap_event)
{ {
@ -1468,7 +1423,6 @@ static CoglWinsysVtable _cogl_winsys_vtable =
.display_destroy = _cogl_winsys_display_destroy, .display_destroy = _cogl_winsys_display_destroy,
.context_init = _cogl_winsys_context_init, .context_init = _cogl_winsys_context_init,
.context_deinit = _cogl_winsys_context_deinit, .context_deinit = _cogl_winsys_context_deinit,
.context_get_clock_time = _cogl_winsys_get_clock_time,
/* X11 tfp support... */ /* X11 tfp support... */
/* XXX: instead of having a rather monolithic winsys vtable we could /* XXX: instead of having a rather monolithic winsys vtable we could

View File

@ -105,9 +105,6 @@ typedef struct _CoglWinsysVtable
/* Optional functions */ /* Optional functions */
int64_t
(*context_get_clock_time) (CoglContext *context);
#ifdef COGL_HAS_XLIB_SUPPORT #ifdef COGL_HAS_XLIB_SUPPORT
gboolean gboolean
(*texture_pixmap_x11_create) (CoglTexturePixmapX11 *tex_pixmap); (*texture_pixmap_x11_create) (CoglTexturePixmapX11 *tex_pixmap);

View File

@ -100,14 +100,6 @@ meta_gpu_kms_is_crtc_active (MetaGpuKms *gpu_kms,
return TRUE; 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 * MetaKmsDevice *
meta_gpu_kms_get_kms_device (MetaGpuKms *gpu_kms) 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); 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 gboolean
meta_gpu_kms_is_clock_monotonic (MetaGpuKms *gpu_kms) meta_gpu_kms_is_clock_monotonic (MetaGpuKms *gpu_kms)
{ {

View File

@ -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); 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); gboolean meta_gpu_kms_is_clock_monotonic (MetaGpuKms *gpu_kms);
void meta_gpu_kms_set_power_save_mode (MetaGpuKms *gpu_kms, void meta_gpu_kms_set_power_save_mode (MetaGpuKms *gpu_kms,

View File

@ -904,15 +904,6 @@ meta_renderer_native_create_offscreen (MetaRendererNative *renderer,
return fb; 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 * static const CoglWinsysVtable *
get_native_cogl_winsys_vtable (CoglRenderer *cogl_renderer) 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_disconnect = meta_renderer_native_disconnect;
vtable.renderer_create_dma_buf = meta_renderer_native_create_dma_buf; 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; vtable_inited = TRUE;
} }