From 8f1edf4bd3a1f050ce9eeb5eac45dd1a8f7a6d5e Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 19 May 2016 13:59:54 -0700 Subject: dix: Use list for ready clients This converts the dispatch loop into using a list of ready clients instead of an array. This changes the WaitForSomething API so that it notifies DIX when a client becomes ready to read, instead of returning the set of ready clients. Signed-off-by: Keith Packard Reviewed-by: Adam Jackson --- include/dixstruct.h | 15 +++++++++++++++ include/os.h | 3 +-- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/dixstruct.h b/include/dixstruct.h index 8e70ae1fa..1f383497c 100644 --- a/include/dixstruct.h +++ b/include/dixstruct.h @@ -76,6 +76,7 @@ typedef struct _saveSet { typedef struct _Client { void *requestBuffer; void *osPrivate; /* for OS layer, including scheduler */ + struct xorg_list ready; /* List of clients ready to run */ Mask clientAsMask; short index; unsigned char majorOp, minorOp; @@ -138,6 +139,20 @@ extern Bool SmartScheduleSignalEnable; extern void SmartScheduleStartTimer(void); extern void SmartScheduleStopTimer(void); +/* Client has requests queued or data on the network */ +void mark_client_ready(ClientPtr client); + +/* Client has no requests queued and no data on network */ +void mark_client_not_ready(ClientPtr client); + +static inline Bool client_is_ready(ClientPtr client) +{ + return !xorg_list_is_empty(&client->ready); +} + +Bool +clients_are_ready(void); + #define SMART_MAX_PRIORITY (20) #define SMART_MIN_PRIORITY (-20) diff --git a/include/os.h b/include/os.h index b0a068ed2..765562c80 100644 --- a/include/os.h +++ b/include/os.h @@ -96,8 +96,7 @@ extern _X_EXPORT void (*OsVendorVErrorFProc) (const char *, _X_ATTRIBUTE_PRINTF(1, 0); #endif -extern _X_EXPORT int WaitForSomething(int * /*pClientsReady */ - ); +extern _X_EXPORT Bool WaitForSomething(Bool clients_are_ready); extern _X_EXPORT int ReadRequestFromClient(ClientPtr /*client */ ); -- cgit v1.2.3