Daniel Martin <consume.no...@gmail.com> writes:

> ephyrPoll() isn't used anywhere else. You could merge it into
> kdrive_notify_conn().

Good call. I've renamed that to:

static void
ephyrXcbNotify(int fd, int ready, void *data)

and eliminated the extra kdrive_notify_conn wrapper.

From 7e824b6f85b9ed81d29864685177fc7c5e659d42 Mon Sep 17 00:00:00 2001
From: Keith Packard <kei...@keithp.com>
Date: Sun, 20 Sep 2015 14:44:29 +0100
Subject: [PATCH xserver 15/24] 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.no...@gmail.com>

Signed-off-by: Keith Packard <kei...@keithp.com>
Cc: Daniel Martin <consume.no...@gmail.com>
---
 hw/kdrive/ephyr/ephyr.c | 6 ++++--
 hw/kdrive/ephyr/ephyr.h | 3 ---
 hw/kdrive/ephyr/hostx.c | 6 ++++++
 hw/kdrive/ephyr/hostx.h | 2 ++
 hw/kdrive/ephyr/os.c    | 1 -
 5 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index e6e72d3..a45a2be 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -1193,8 +1193,8 @@ ephyrProcessConfigureNotify(xcb_generic_event_t *xev)
 #endif /* RANDR */
 }
 
-void
-ephyrPoll(void)
+static void
+ephyrXcbNotify(int fd, int ready, void *data)
 {
     xcb_connection_t *conn = hostx_get_xcbconn();
 
@@ -1345,6 +1345,7 @@ static Status
 MouseEnable(KdPointerInfo * pi)
 {
     ((EphyrPointerPrivate *) pi->driverPrivate)->enabled = TRUE;
+    SetNotifyFd(hostx_get_fd(), ephyrXcbNotify, X_NOTIFY_READ, NULL);
     return Success;
 }
 
@@ -1352,6 +1353,7 @@ static void
 MouseDisable(KdPointerInfo * pi)
 {
     ((EphyrPointerPrivate *) pi->driverPrivate)->enabled = FALSE;
+    RemoveNotifyFd(hostx_get_fd());
     return;
 }
 
diff --git a/hw/kdrive/ephyr/ephyr.h b/hw/kdrive/ephyr/ephyr.h
index 18bfe11..f5015f6 100644
--- a/hw/kdrive/ephyr/ephyr.h
+++ b/hw/kdrive/ephyr/ephyr.h
@@ -168,9 +168,6 @@ Bool
 Bool
  ephyrCreateColormap(ColormapPtr pmap);
 
-void
- ephyrPoll(void);
-
 #ifdef RANDR
 Bool
  ephyrRandRGetInfo(ScreenPtr pScreen, Rotation * rotations);
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index dc265d5..09e9333 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -1103,6 +1103,12 @@ hostx_get_screen(void)
 }
 
 int
+hostx_get_fd(void)
+{
+    return xcb_get_file_descriptor(HostX.conn);
+}
+
+int
 hostx_get_window(int a_screen_number)
 {
     EphyrScrPriv *scrpriv;
diff --git a/hw/kdrive/ephyr/hostx.h b/hw/kdrive/ephyr/hostx.h
index 93aaa50..65d3ebb 100644
--- a/hw/kdrive/ephyr/hostx.h
+++ b/hw/kdrive/ephyr/hostx.h
@@ -198,4 +198,6 @@ int hostx_has_dri(void);
 int hostx_has_glx(void);
 #endif                          /* XF86DRI */
 
+int hostx_get_fd(void);
+
 #endif /*_XLIBS_STUFF_H_*/
diff --git a/hw/kdrive/ephyr/os.c b/hw/kdrive/ephyr/os.c
index 0dbcbb8..b481d0a 100644
--- a/hw/kdrive/ephyr/os.c
+++ b/hw/kdrive/ephyr/os.c
@@ -45,5 +45,4 @@ EphyrInit(void)
 
 KdOsFuncs EphyrOsFuncs = {
     .Init = EphyrInit,
-    .pollEvents = ephyrPoll,
 };
-- 
2.5.0

-- 
-keith

Attachment: signature.asc
Description: PGP signature

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to