summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm2
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-07-12 15:27:52 -0500
committerDerek Foreman <derekf@osg.samsung.com>2017-07-13 18:07:42 -0500
commit20def4da21e9fcea3d6ab910493b529ab371e3f4 (patch)
treeac68f362180d8e1595f413ed0f0fc7f89bb70b1a /src/lib/ecore_drm2
parent7e0beea3f599c56dd2a99d4eaec820723cf6bda2 (diff)
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
Diffstat (limited to 'src/lib/ecore_drm2')
-rw-r--r--src/lib/ecore_drm2/Ecore_Drm2.h14
-rw-r--r--src/lib/ecore_drm2/ecore_drm2.c3
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_outputs.c22
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_private.h2
4 files changed, 39 insertions, 2 deletions
diff --git a/src/lib/ecore_drm2/Ecore_Drm2.h b/src/lib/ecore_drm2/Ecore_Drm2.h
index 2d0779a4c9..4be533bc66 100644
--- a/src/lib/ecore_drm2/Ecore_Drm2.h
+++ b/src/lib/ecore_drm2/Ecore_Drm2.h
@@ -1075,6 +1075,20 @@ EAPI Eina_Bool ecore_drm2_plane_fb_set(Ecore_Drm2_Plane *plane, Ecore_Drm2_Fb *f
1075 * @since 1.20 1075 * @since 1.20
1076 */ 1076 */
1077EAPI void ecore_drm2_fb_status_handler_set(Ecore_Drm2_Fb *fb, Ecore_Drm2_Fb_Status_Handler handler, void *data); 1077EAPI void ecore_drm2_fb_status_handler_set(Ecore_Drm2_Fb *fb, Ecore_Drm2_Fb_Status_Handler handler, void *data);
1078
1079/**
1080 * Get the time of the last vblank
1081 *
1082 * Query the display hardware for the time of the last vblank.
1083 *
1084 * @param output
1085 * @param sec
1086 * @param usec
1087 *
1088 * @since 1.20
1089 */
1090EAPI Eina_Bool ecore_drm2_output_blanktime_get(Ecore_Drm2_Output *output, long *sec, long *usec);
1091
1078# endif 1092# endif
1079 1093
1080#endif 1094#endif
diff --git a/src/lib/ecore_drm2/ecore_drm2.c b/src/lib/ecore_drm2/ecore_drm2.c
index a43b11366a..526ea4a523 100644
--- a/src/lib/ecore_drm2/ecore_drm2.c
+++ b/src/lib/ecore_drm2/ecore_drm2.c
@@ -46,6 +46,7 @@ int (*sym_drmModePageFlip)(int fd, uint32_t crtc_id, uint32_t fb_id, uint32_t fl
46int (*sym_drmModeDirtyFB)(int fd, uint32_t bufferId, drmModeClipPtr clips, uint32_t num_clips) = NULL; 46int (*sym_drmModeDirtyFB)(int fd, uint32_t bufferId, drmModeClipPtr clips, uint32_t num_clips) = NULL;
47int (*sym_drmModeCrtcSetGamma)(int fd, uint32_t crtc_id, uint32_t size, uint16_t *red, uint16_t *green, uint16_t *blue) = NULL; 47int (*sym_drmModeCrtcSetGamma)(int fd, uint32_t crtc_id, uint32_t size, uint16_t *red, uint16_t *green, uint16_t *blue) = NULL;
48int (*sym_drmPrimeFDToHandle)(int fd, int prime_fd, uint32_t *handle) = NULL; 48int (*sym_drmPrimeFDToHandle)(int fd, int prime_fd, uint32_t *handle) = NULL;
49int (*sym_drmWaitVBlank)(int fd, drmVBlank *vbl) = NULL;
49 50
50EAPI int ECORE_DRM2_EVENT_OUTPUT_CHANGED = -1; 51EAPI int ECORE_DRM2_EVENT_OUTPUT_CHANGED = -1;
51EAPI int ECORE_DRM2_EVENT_ACTIVATE = -1; 52EAPI int ECORE_DRM2_EVENT_ACTIVATE = -1;
@@ -82,7 +83,7 @@ _ecore_drm2_link(void)
82 83
83 SYM(drm_lib, drmIoctl); 84 SYM(drm_lib, drmIoctl);
84 /* SYM(drm_lib, drmClose); */ 85 /* SYM(drm_lib, drmClose); */
85 /* SYM(drm_lib, drmWaitVBlank); */ 86 SYM(drm_lib, drmWaitVBlank);
86 SYM(drm_lib, drmHandleEvent); 87 SYM(drm_lib, drmHandleEvent);
87 SYM(drm_lib, drmGetVersion); 88 SYM(drm_lib, drmGetVersion);
88 SYM(drm_lib, drmFreeVersion); 89 SYM(drm_lib, drmFreeVersion);
diff --git a/src/lib/ecore_drm2/ecore_drm2_outputs.c b/src/lib/ecore_drm2/ecore_drm2_outputs.c
index 11b3c22ae3..d2b3acb54b 100644
--- a/src/lib/ecore_drm2/ecore_drm2_outputs.c
+++ b/src/lib/ecore_drm2/ecore_drm2_outputs.c
@@ -1582,3 +1582,25 @@ ecore_drm2_output_subpixel_get(const Ecore_Drm2_Output *output)
1582 EINA_SAFETY_ON_NULL_RETURN_VAL(output, 0); 1582 EINA_SAFETY_ON_NULL_RETURN_VAL(output, 0);
1583 return output->subpixel; 1583 return output->subpixel;
1584} 1584}
1585
1586EAPI Eina_Bool
1587ecore_drm2_output_blanktime_get(Ecore_Drm2_Output *output, long *sec, long *usec)
1588{
1589 drmVBlank v;
1590 int ret;
1591
1592 EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE);
1593 EINA_SAFETY_ON_NULL_RETURN_VAL(sec, EINA_FALSE);
1594 EINA_SAFETY_ON_NULL_RETURN_VAL(usec, EINA_FALSE);
1595
1596 memset(&v, 0, sizeof(v));
1597 v.request.type = DRM_VBLANK_RELATIVE;
1598 ret = sym_drmWaitVBlank(output->fd, &v);
1599 if (ret) return EINA_FALSE;
1600 if (v.reply.tval_sec < 0) return EINA_FALSE;
1601 if (v.reply.tval_usec < 0) return EINA_FALSE;
1602
1603 *sec = v.reply.tval_sec;
1604 *usec = v.reply.tval_usec;
1605 return EINA_TRUE;
1606}
diff --git a/src/lib/ecore_drm2/ecore_drm2_private.h b/src/lib/ecore_drm2/ecore_drm2_private.h
index 4ec2147e76..c8c2bf66c2 100644
--- a/src/lib/ecore_drm2/ecore_drm2_private.h
+++ b/src/lib/ecore_drm2/ecore_drm2_private.h
@@ -302,7 +302,7 @@ void _ecore_drm2_fb_deref(Ecore_Drm2_Fb *);
302void _ecore_drm2_fb_buffer_release(Ecore_Drm2_Output *output, Ecore_Drm2_Output_State *s); 302void _ecore_drm2_fb_buffer_release(Ecore_Drm2_Output *output, Ecore_Drm2_Output_State *s);
303 303
304/* extern int (*sym_drmClose)(int fd); */ 304/* extern int (*sym_drmClose)(int fd); */
305/* extern int (*sym_drmWaitVBlank)(int fd, drmVBlank *vbl); */ 305extern int (*sym_drmWaitVBlank)(int fd, drmVBlank *vbl);
306extern int (*sym_drmHandleEvent)(int fd, drmEventContext *evctx); 306extern int (*sym_drmHandleEvent)(int fd, drmEventContext *evctx);
307extern void *(*sym_drmGetVersion)(int fd); 307extern void *(*sym_drmGetVersion)(int fd);
308extern void (*sym_drmFreeVersion)(void *drmver); 308extern void (*sym_drmFreeVersion)(void *drmver);