ecore_drm2: Add a query for the next vblank time

I guess this is a feature, and we're deep in freeze, but:

a) this is critical for fixing T5462 properly without any side effects.
b) ecore_drm2 is all beta api
c) this should only affect wayland users

ref T5462
This commit is contained in:
Derek Foreman 2017-07-12 15:27:52 -05:00
parent 7e0beea3f5
commit 20def4da21
4 changed files with 39 additions and 2 deletions

View File

@ -1075,6 +1075,20 @@ EAPI Eina_Bool ecore_drm2_plane_fb_set(Ecore_Drm2_Plane *plane, Ecore_Drm2_Fb *f
* @since 1.20
*/
EAPI void ecore_drm2_fb_status_handler_set(Ecore_Drm2_Fb *fb, Ecore_Drm2_Fb_Status_Handler handler, void *data);
/**
* Get the time of the last vblank
*
* Query the display hardware for the time of the last vblank.
*
* @param output
* @param sec
* @param usec
*
* @since 1.20
*/
EAPI Eina_Bool ecore_drm2_output_blanktime_get(Ecore_Drm2_Output *output, long *sec, long *usec);
# endif
#endif

View File

@ -46,6 +46,7 @@ int (*sym_drmModePageFlip)(int fd, uint32_t crtc_id, uint32_t fb_id, uint32_t fl
int (*sym_drmModeDirtyFB)(int fd, uint32_t bufferId, drmModeClipPtr clips, uint32_t num_clips) = NULL;
int (*sym_drmModeCrtcSetGamma)(int fd, uint32_t crtc_id, uint32_t size, uint16_t *red, uint16_t *green, uint16_t *blue) = NULL;
int (*sym_drmPrimeFDToHandle)(int fd, int prime_fd, uint32_t *handle) = NULL;
int (*sym_drmWaitVBlank)(int fd, drmVBlank *vbl) = NULL;
EAPI int ECORE_DRM2_EVENT_OUTPUT_CHANGED = -1;
EAPI int ECORE_DRM2_EVENT_ACTIVATE = -1;
@ -82,7 +83,7 @@ _ecore_drm2_link(void)
SYM(drm_lib, drmIoctl);
/* SYM(drm_lib, drmClose); */
/* SYM(drm_lib, drmWaitVBlank); */
SYM(drm_lib, drmWaitVBlank);
SYM(drm_lib, drmHandleEvent);
SYM(drm_lib, drmGetVersion);
SYM(drm_lib, drmFreeVersion);

View File

@ -1582,3 +1582,25 @@ ecore_drm2_output_subpixel_get(const Ecore_Drm2_Output *output)
EINA_SAFETY_ON_NULL_RETURN_VAL(output, 0);
return output->subpixel;
}
EAPI Eina_Bool
ecore_drm2_output_blanktime_get(Ecore_Drm2_Output *output, long *sec, long *usec)
{
drmVBlank v;
int ret;
EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(sec, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(usec, EINA_FALSE);
memset(&v, 0, sizeof(v));
v.request.type = DRM_VBLANK_RELATIVE;
ret = sym_drmWaitVBlank(output->fd, &v);
if (ret) return EINA_FALSE;
if (v.reply.tval_sec < 0) return EINA_FALSE;
if (v.reply.tval_usec < 0) return EINA_FALSE;
*sec = v.reply.tval_sec;
*usec = v.reply.tval_usec;
return EINA_TRUE;
}

View File

@ -302,7 +302,7 @@ void _ecore_drm2_fb_deref(Ecore_Drm2_Fb *);
void _ecore_drm2_fb_buffer_release(Ecore_Drm2_Output *output, Ecore_Drm2_Output_State *s);
/* extern int (*sym_drmClose)(int fd); */
/* extern int (*sym_drmWaitVBlank)(int fd, drmVBlank *vbl); */
extern int (*sym_drmWaitVBlank)(int fd, drmVBlank *vbl);
extern int (*sym_drmHandleEvent)(int fd, drmEventContext *evctx);
extern void *(*sym_drmGetVersion)(int fd);
extern void (*sym_drmFreeVersion)(void *drmver);