[PATCH xserver] os: Eliminate NewOutputPending
Hans de Goede
hdegoede at redhat.com
Thu Sep 22 13:44:48 UTC 2016
Hi,
On 09/22/2016 11:34 AM, Keith Packard wrote:
> By removing clients from output_pending_clients list when flushing is
> attempted, that list now becomes the list of clients that need
> flushing, which is equivalent to what NewOutputPending was used for.
>
> Clients are added to output_pending_clients when data are added to
> their output buffer and when write blocked clients become writable.
>
> Signed-off-by: Keith Packard <keithp at keithp.com>
Patch LGTM:
Reviewed-by: Hans de Goede <hdegoede at redhat.com>
Regards,
Hans
> ---
> os/WaitFor.c | 2 +-
> os/connection.c | 3 +--
> os/io.c | 16 ++++------------
> os/osdep.h | 2 --
> 4 files changed, 6 insertions(+), 17 deletions(-)
>
> diff --git a/os/WaitFor.c b/os/WaitFor.c
> index 024df35..cde2c8c 100644
> --- a/os/WaitFor.c
> +++ b/os/WaitFor.c
> @@ -213,7 +213,7 @@ WaitForSomething(Bool are_ready)
> timeout = check_timers();
>
> BlockHandler(&timeout);
> - if (NewOutputPending)
> + if (any_output_pending())
> FlushAllOutput();
> /* keep this check close to select() call to minimize race */
> if (dispatchException)
> diff --git a/os/connection.c b/os/connection.c
> index a901ebf..52b5067 100644
> --- a/os/connection.c
> +++ b/os/connection.c
> @@ -121,7 +121,6 @@ SOFTWARE.
> struct ospoll *server_poll;
>
> int MaxClients = 0;
> -Bool NewOutputPending; /* not yet attempted to write some new output */
> Bool NoListenAll; /* Don't establish any listening sockets */
>
> static Bool RunFromSmartParent; /* send SIGUSR1 to parent process */
> @@ -712,7 +711,7 @@ ClientReady(int fd, int xevents, void *data)
> mark_client_ready(client);
> if (xevents & X_NOTIFY_WRITE) {
> ospoll_mute(server_poll, fd, X_NOTIFY_WRITE);
> - NewOutputPending = TRUE;
> + output_pending_mark(client);
> }
> }
>
> diff --git a/os/io.c b/os/io.c
> index 5ba1e86..7b95118 100644
> --- a/os/io.c
> +++ b/os/io.c
> @@ -596,9 +596,8 @@ FlushAllOutput(void)
> {
> OsCommPtr oc;
> register ClientPtr client, tmp;
> - Bool newoutput = NewOutputPending;
>
> - if (!newoutput)
> + if (!any_output_pending())
> return;
>
> /*
> @@ -607,7 +606,6 @@ FlushAllOutput(void)
> * simply wait for the select to tell us when he's ready to receive.
> */
> CriticalOutputPending = FALSE;
> - NewOutputPending = FALSE;
>
> xorg_list_for_each_entry_safe(client, tmp, &output_pending_clients, output_pending) {
> if (client->clientGone)
> @@ -615,8 +613,7 @@ FlushAllOutput(void)
> if (!client_is_ready(client)) {
> oc = (OsCommPtr) client->osPrivate;
> (void) FlushClient(client, oc, (char *) NULL, 0);
> - } else
> - NewOutputPending = TRUE;
> + }
> }
> }
>
> @@ -759,16 +756,12 @@ WriteToClient(ClientPtr who, int count, const void *__buf)
> }
> #endif
> if (oco->count == 0 || oco->count + count + padBytes > oco->size) {
> - output_pending_clear(who);
> - if (!any_output_pending()) {
> + if (!any_output_pending())
> CriticalOutputPending = FALSE;
> - NewOutputPending = FALSE;
> - }
>
> return FlushClient(who, oc, buf, count);
> }
>
> - NewOutputPending = TRUE;
> output_pending_mark(who);
> memmove((char *) oco->buf + oco->count, buf, count);
> oco->count += count;
> @@ -802,6 +795,7 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
> long notWritten;
> long todo;
>
> + output_pending_clear(who);
> if (!oco)
> return 0;
> written = 0;
> @@ -868,7 +862,6 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
> /* If we've arrived here, then the client is stuffed to the gills
> and not ready to accept more. Make a note of it and buffer
> the rest. */
> - output_pending_mark(who);
>
> if (written < oco->count) {
> if (written > 0) {
> @@ -932,7 +925,6 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
>
> /* everything was flushed out */
> oco->count = 0;
> - output_pending_clear(who);
>
> if (oco->size > BUFWATERMARK) {
> free(oco->buf);
> diff --git a/os/osdep.h b/os/osdep.h
> index 90a247f..9c8bd48 100644
> --- a/os/osdep.h
> +++ b/os/osdep.h
> @@ -165,8 +165,6 @@ extern void SetConnectionTranslation(int conn, int client);
> extern void ClearConnectionTranslation(void);
> #endif
>
> -extern Bool NewOutputPending;
> -
> extern WorkQueuePtr workQueue;
>
> /* in WaitFor.c */
>
More information about the xorg-devel
mailing list