forked from enlightenment/efl
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:
parent
2efa25511f
commit
8e500c6835
|
@ -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
|
* 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 output
|
||||||
|
* @param sequence
|
||||||
* @param sec
|
* @param sec
|
||||||
* @param usec
|
* @param usec
|
||||||
*
|
*
|
||||||
* @since 1.20
|
* @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
|
# endif
|
||||||
|
|
||||||
|
|
|
@ -1584,7 +1584,7 @@ ecore_drm2_output_subpixel_get(const Ecore_Drm2_Output *output)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
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;
|
drmVBlank v;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -1595,6 +1595,7 @@ ecore_drm2_output_blanktime_get(Ecore_Drm2_Output *output, long *sec, long *usec
|
||||||
|
|
||||||
memset(&v, 0, sizeof(v));
|
memset(&v, 0, sizeof(v));
|
||||||
v.request.type = DRM_VBLANK_RELATIVE;
|
v.request.type = DRM_VBLANK_RELATIVE;
|
||||||
|
v.request.sequence = sequence;
|
||||||
ret = sym_drmWaitVBlank(output->fd, &v);
|
ret = sym_drmWaitVBlank(output->fd, &v);
|
||||||
if (ret) return EINA_FALSE;
|
if (ret) return EINA_FALSE;
|
||||||
if (v.reply.tval_sec < 0) return EINA_FALSE;
|
if (v.reply.tval_sec < 0) return EINA_FALSE;
|
||||||
|
|
|
@ -680,7 +680,7 @@ _drm_last_tick_get(Ecore_Evas *ee)
|
||||||
long sec, usec;
|
long sec, usec;
|
||||||
|
|
||||||
edata = ee->engine.data;
|
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 -1.0;
|
||||||
|
|
||||||
return sec + usec / 1000000.0;
|
return sec + usec / 1000000.0;
|
||||||
|
|
Loading…
Reference in New Issue