backends/native: Get rendering and swap timings during scanout

Scanout doesn't go through the usual path of compositing and doing
eglSwapBuffers, therefore it doesn't hit the timestamp query placed in
that path. Instead, get the timings by binding the scanout buffer to an
FBO and doing a timestamp query on the FBO.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1762>
This commit is contained in:
Ivan Molodetskikh
2021-01-06 15:42:33 +03:00
committed by Marge Bot
parent 5a0d3ed4dd
commit 1116b14f38
5 changed files with 179 additions and 0 deletions

View File

@ -185,6 +185,27 @@ meta_drm_buffer_get_format (MetaDrmBuffer *buffer)
return META_DRM_BUFFER_GET_CLASS (buffer)->get_format (buffer);
}
gboolean
meta_drm_buffer_supports_fill_timings (MetaDrmBuffer *buffer)
{
return META_DRM_BUFFER_GET_CLASS (buffer)->fill_timings != NULL;
}
gboolean
meta_drm_buffer_fill_timings (MetaDrmBuffer *buffer,
CoglFrameInfo *info,
GError **error)
{
if (!meta_drm_buffer_supports_fill_timings (buffer))
{
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
"Buffer doesn't support filling timing info");
return FALSE;
}
return META_DRM_BUFFER_GET_CLASS (buffer)->fill_timings (buffer, info, error);
}
static void
meta_drm_buffer_get_property (GObject *object,
guint prop_id,