[PATCH 1/2] armada: Use NotifyFd for drm fd
Christian Gmeiner
christian.gmeiner at gmail.com
Wed Feb 8 08:29:59 UTC 2017
ping
2016-12-04 21:55 GMT+01:00 Christian Gmeiner <christian.gmeiner at gmail.com>:
> NotifyFd is available after API 22, and must be used after API 23.
>
> Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
> ---
> src/common_drm.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/src/common_drm.c b/src/common_drm.c
> index 92700ce..18e48a0 100644
> --- a/src/common_drm.c
> +++ b/src/common_drm.c
> @@ -35,6 +35,10 @@
> #include <libudev.h>
> #endif
>
> +#if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(22,0)
> +#define HAVE_NOTIFY_FD 1
> +#endif
> +
> enum {
> OPTION_HW_CURSOR,
> OPTION_HOTPLUG,
> @@ -1158,6 +1162,15 @@ Bool common_drm_PreScreenInit(ScreenPtr pScreen)
> return TRUE;
> }
>
> +#if HAVE_NOTIFY_FD
> +static void
> +drmmode_notify_fd(int fd, int notify, void *data)
> +{
> + struct common_drm_info *drm = data;
> +
> + drmHandleEvent(drm->fd, &drm->event_context);
> +}
> +#else
> static void common_drm_wakeup_handler(pointer data, int err, pointer p)
> {
> struct common_drm_info *drm = data;
> @@ -1169,6 +1182,7 @@ static void common_drm_wakeup_handler(pointer data, int err, pointer p)
> if (FD_ISSET(drm->fd, read_mask))
> drmHandleEvent(drm->fd, &drm->event_context);
> }
> +#endif
>
> Bool common_drm_PostScreenInit(ScreenPtr pScreen)
> {
> @@ -1236,9 +1250,13 @@ Bool common_drm_PostScreenInit(ScreenPtr pScreen)
> xf86DPMSInit(pScreen, xf86DPMSSet, 0);
>
> /* Setup the synchronisation feedback */
> +#if HAVE_NOTIFY_FD
> + SetNotifyFd(drm->fd, drmmode_notify_fd, X_NOTIFY_READ, drm);
> +#else
> AddGeneralSocket(drm->fd);
> RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA,
> common_drm_wakeup_handler, drm);
> +#endif
>
> #ifdef HAVE_UDEV
> if (!common_drm_udev_init(pScreen)) {
> --
> 2.10.2
>
greets
--
Christian Gmeiner, MSc
https://www.youtube.com/user/AloryOFFICIAL
https://soundcloud.com/christian-gmeiner
More information about the etnaviv
mailing list