kdrive/ephyr: Use NotifyFd for XCB connection input [v2]
Eliminates polling every 20ms for device input. v2: rename ephyrPoll to ephyrXcbNotify and fix the API so it can be used directly for SetNotifyFd. Thanks to Daniel Martin <consume.noise@gmail.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com> Cc: Daniel Martin <consume.noise@gmail.com>
This commit is contained in:
parent
483c2a1adf
commit
58354fcf47
|
@ -1182,8 +1182,8 @@ ephyrProcessConfigureNotify(xcb_generic_event_t *xev)
|
||||||
#endif /* RANDR */
|
#endif /* RANDR */
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ephyrPoll(void)
|
ephyrXcbNotify(int fd, int ready, void *data)
|
||||||
{
|
{
|
||||||
xcb_connection_t *conn = hostx_get_xcbconn();
|
xcb_connection_t *conn = hostx_get_xcbconn();
|
||||||
|
|
||||||
|
@ -1334,6 +1334,7 @@ static Status
|
||||||
MouseEnable(KdPointerInfo * pi)
|
MouseEnable(KdPointerInfo * pi)
|
||||||
{
|
{
|
||||||
((EphyrPointerPrivate *) pi->driverPrivate)->enabled = TRUE;
|
((EphyrPointerPrivate *) pi->driverPrivate)->enabled = TRUE;
|
||||||
|
SetNotifyFd(hostx_get_fd(), ephyrXcbNotify, X_NOTIFY_READ, NULL);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1341,6 +1342,7 @@ static void
|
||||||
MouseDisable(KdPointerInfo * pi)
|
MouseDisable(KdPointerInfo * pi)
|
||||||
{
|
{
|
||||||
((EphyrPointerPrivate *) pi->driverPrivate)->enabled = FALSE;
|
((EphyrPointerPrivate *) pi->driverPrivate)->enabled = FALSE;
|
||||||
|
RemoveNotifyFd(hostx_get_fd());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -168,9 +168,6 @@ Bool
|
||||||
Bool
|
Bool
|
||||||
ephyrCreateColormap(ColormapPtr pmap);
|
ephyrCreateColormap(ColormapPtr pmap);
|
||||||
|
|
||||||
void
|
|
||||||
ephyrPoll(void);
|
|
||||||
|
|
||||||
#ifdef RANDR
|
#ifdef RANDR
|
||||||
Bool
|
Bool
|
||||||
ephyrRandRGetInfo(ScreenPtr pScreen, Rotation * rotations);
|
ephyrRandRGetInfo(ScreenPtr pScreen, Rotation * rotations);
|
||||||
|
|
|
@ -1112,6 +1112,12 @@ hostx_get_screen(void)
|
||||||
return HostX.screen;
|
return HostX.screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
hostx_get_fd(void)
|
||||||
|
{
|
||||||
|
return xcb_get_file_descriptor(HostX.conn);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
hostx_get_window(int a_screen_number)
|
hostx_get_window(int a_screen_number)
|
||||||
{
|
{
|
||||||
|
|
|
@ -198,4 +198,6 @@ int hostx_has_dri(void);
|
||||||
int hostx_has_glx(void);
|
int hostx_has_glx(void);
|
||||||
#endif /* XF86DRI */
|
#endif /* XF86DRI */
|
||||||
|
|
||||||
|
int hostx_get_fd(void);
|
||||||
|
|
||||||
#endif /*_XLIBS_STUFF_H_*/
|
#endif /*_XLIBS_STUFF_H_*/
|
||||||
|
|
|
@ -45,5 +45,4 @@ EphyrInit(void)
|
||||||
|
|
||||||
KdOsFuncs EphyrOsFuncs = {
|
KdOsFuncs EphyrOsFuncs = {
|
||||||
.Init = EphyrInit,
|
.Init = EphyrInit,
|
||||||
.pollEvents = ephyrPoll,
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue