From patchwork Mon Sep 3 17:53:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?S=C3=B8ren_Sandmann?= X-Patchwork-Id: 181403 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 30C6C2C008D for ; Tue, 4 Sep 2012 03:51:52 +1000 (EST) Received: from localhost ([::1]:39434 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8aoQ-0002pX-CG for incoming@patchwork.ozlabs.org; Mon, 03 Sep 2012 13:51:50 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45918) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8ank-0000jj-Dl for qemu-devel@nongnu.org; Mon, 03 Sep 2012 13:51:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T8ane-0003Xz-5P for qemu-devel@nongnu.org; Mon, 03 Sep 2012 13:51:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2889) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8and-0003WB-S2 for qemu-devel@nongnu.org; Mon, 03 Sep 2012 13:51:02 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q83Hp06o016653 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 3 Sep 2012 13:51:00 -0400 Received: from dhcp-100-3-184.bos.redhat.com (dhcp-189-4.bos.redhat.com [10.16.189.4]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q83Howjc024642; Mon, 3 Sep 2012 13:51:00 -0400 From: =?UTF-8?q?S=C3=B8ren=20Sandmann?= To: spice-devel@freedesktop.org, qemu-devel@nongnu.org Date: Mon, 3 Sep 2012 13:53:53 -0400 Message-Id: <1346694835-23590-3-git-send-email-sandmann@cs.au.dk> In-Reply-To: <1346694835-23590-1-git-send-email-sandmann@cs.au.dk> References: <1346694835-23590-1-git-send-email-sandmann@cs.au.dk> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id q83Hp06o016653 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: =?UTF-8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Subject: [Qemu-devel] [PATCH 3/5] Process outstanding commands in the ring after changing capability bits X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Søren Sandmann Pedersen When a new client connects, there may be commands in the ring that it can't understand, so we need to process these before forwarding new commands to the client. By doing this after changing the capability bits we ensure that the new client will never see a command that it doesn't understand (under the assumption that the guest will read and obey the capability bits). --- server/red_worker.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/server/red_worker.c b/server/red_worker.c index 60b5471..f87967c 100644 --- a/server/red_worker.c +++ b/server/red_worker.c @@ -9493,6 +9493,11 @@ static void on_new_display_channel_client(DisplayChannelClient *dcc) } red_channel_client_ack_zero_messages_window(&dcc->common.base); if (worker->surfaces[0].context.canvas) { + int ring_is_empty; + + while (red_process_commands(worker, MAX_PIPE_SIZE, &ring_is_empty)) { + } + red_current_flush(worker, 0); push_new_primary_surface(dcc); red_push_surface_image(dcc, 0);