ecore_drm2: Allow picking a sequence number for blanktime_get
authorDerek Foreman <derekf@osg.samsung.com>
Fri, 28 Jul 2017 14:40:40 +0000 (09:40 -0500)
committerDerek Foreman <derekf@osg.samsung.com>
Fri, 28 Jul 2017 15:41:11 +0000 (10:41 -0500)
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.

src/lib/ecore_drm2/Ecore_Drm2.h
src/lib/ecore_drm2/ecore_drm2_outputs.c
src/modules/ecore_evas/engines/drm/ecore_evas_drm.c

index 4be533b..450f1fa 100644 (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
 
index d2b3acb..fba4be0 100644 (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;
index dd46ce0..302048c 100644 (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;