ecore_drm2: Allow picking a sequence number for blanktime_get

This lets us do a blocking wait for a vsync.  Something we should try to
do as infrequently as possible, but in some cases we need it one time at
startup to catch graphics driver bugs.
This commit is contained in:
Derek Foreman 2017-07-28 09:40:40 -05:00
parent 2efa25511f
commit 8e500c6835
3 changed files with 10 additions and 4 deletions

View File

@ -1079,15 +1079,20 @@ EAPI void ecore_drm2_fb_status_handler_set(Ecore_Drm2_Fb *fb, Ecore_Drm2_Fb_Stat
/**
* Get the time of the last vblank
*
* Query the display hardware for the time of the last vblank.
* Query the display hardware for the time of a vblank, potentially blocking.
*
* If sequence is 0 the time of the last vblank will be immediately returned,
* if it's above zero that number of vblanks will pass before the function
* returns.
*
* @param output
* @param sequence
* @param sec
* @param usec
*
* @since 1.20
*/
EAPI Eina_Bool ecore_drm2_output_blanktime_get(Ecore_Drm2_Output *output, long *sec, long *usec);
EAPI Eina_Bool ecore_drm2_output_blanktime_get(Ecore_Drm2_Output *output, int sequence, long *sec, long *usec);
# endif

View File

@ -1584,7 +1584,7 @@ ecore_drm2_output_subpixel_get(const Ecore_Drm2_Output *output)
}
EAPI Eina_Bool
ecore_drm2_output_blanktime_get(Ecore_Drm2_Output *output, long *sec, long *usec)
ecore_drm2_output_blanktime_get(Ecore_Drm2_Output *output, int sequence, long *sec, long *usec)
{
drmVBlank v;
int ret;
@ -1595,6 +1595,7 @@ ecore_drm2_output_blanktime_get(Ecore_Drm2_Output *output, long *sec, long *usec
memset(&v, 0, sizeof(v));
v.request.type = DRM_VBLANK_RELATIVE;
v.request.sequence = sequence;
ret = sym_drmWaitVBlank(output->fd, &v);
if (ret) return EINA_FALSE;
if (v.reply.tval_sec < 0) return EINA_FALSE;

View File

@ -680,7 +680,7 @@ _drm_last_tick_get(Ecore_Evas *ee)
long sec, usec;
edata = ee->engine.data;
if (!ecore_drm2_output_blanktime_get(edata->output, &sec, &usec))
if (!ecore_drm2_output_blanktime_get(edata->output, 0, &sec, &usec))
return -1.0;
return sec + usec / 1000000.0;