aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira2015-08-17 08:21:24 -0500
committerDaniel Stone2017-04-06 14:32:43 -0500
commit890d43a6a8d091211b82dd432af5e0a38472ffa6 (patch)
treed049937e69429992f6d9bb927c1b3d70f601fa68 /xf86drmMode.c
parente379c6a137bba5c40d9a126b71a667b4d7f5697a (diff)
downloadexternal-libgbm-890d43a6a8d091211b82dd432af5e0a38472ffa6.tar.gz
external-libgbm-890d43a6a8d091211b82dd432af5e0a38472ffa6.tar.xz
external-libgbm-890d43a6a8d091211b82dd432af5e0a38472ffa6.zip
Add CRTC ID to vblank event
When using the atomic API, one request can span multiple CRTCs, however one event is generated per CRTC. As we cannot disambiguate the CRTC with user data (since we only have one piece of user data to pass in), newer kernels can include the CRTC ID in the page flip event. Add a new vfunc to dispatch vblank events carrying a CRTC ID to clients who negotiate a higher interface version. [daniels: Rebased, include new cap, call page_flip_handler if it is set but page_flip_handler2 isn't even on newer contexts, write a commit message.] v2: Split into separate commit. Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com> Signed-off-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@intel.com>
Diffstat (limited to 'xf86drmMode.c')
-rw-r--r--xf86drmMode.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/xf86drmMode.c b/xf86drmMode.c
index 0266bc10..d3bc20ea 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -889,6 +889,7 @@ int drmHandleEvent(int fd, drmEventContextPtr evctx)
889 int len, i; 889 int len, i;
890 struct drm_event *e; 890 struct drm_event *e;
891 struct drm_event_vblank *vblank; 891 struct drm_event_vblank *vblank;
892 void *user_data;
892 893
893 /* The DRM read semantics guarantees that we always get only 894 /* The DRM read semantics guarantees that we always get only
894 * complete events. */ 895 * complete events. */
@@ -915,15 +916,22 @@ int drmHandleEvent(int fd, drmEventContextPtr evctx)
915 U642VOID (vblank->user_data)); 916 U642VOID (vblank->user_data));
916 break; 917 break;
917 case DRM_EVENT_FLIP_COMPLETE: 918 case DRM_EVENT_FLIP_COMPLETE:
918 if (evctx->version < 2 ||
919 evctx->page_flip_handler == NULL)
920 break;
921 vblank = (struct drm_event_vblank *) e; 919 vblank = (struct drm_event_vblank *) e;
922 evctx->page_flip_handler(fd, 920 user_data = U642VOID (vblank->user_data);
923 vblank->sequence, 921
924 vblank->tv_sec, 922 if (evctx->version >= 3 && evctx->page_flip_handler2)
925 vblank->tv_usec, 923 evctx->page_flip_handler2(fd,
926 U642VOID (vblank->user_data)); 924 vblank->sequence,
925 vblank->tv_sec,
926 vblank->tv_usec,
927 vblank->crtc_id,
928 user_data);
929 else if (evctx->version >= 2 && evctx->page_flip_handler)
930 evctx->page_flip_handler(fd,
931 vblank->sequence,
932 vblank->tv_sec,
933 vblank->tv_usec,
934 user_data);
927 break; 935 break;
928 default: 936 default:
929 break; 937 break;