Received: from [140.186.70.92] (port=37124 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PzuVQ-0005pG-7b for qemu-devel@nongnu.org; Wed, 16 Mar 2011 13:27:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PzuVO-0007Rb-LX for qemu-devel@nongnu.org; Wed, 16 Mar 2011 13:27:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:5250) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PzuVO-0007R6-Bx for qemu-devel@nongnu.org; Wed, 16 Mar 2011 13:27:30 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2GHRFXx010271 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 16 Mar 2011 13:27:29 -0400 Date: Wed, 16 Mar 2011 18:42:32 +0200 From: Alon Levy Subject: Re: [Qemu-devel] [PATCH v3 1/4] qxl/spice-display: move pipe to ssd Message-ID: <20110316164232.GJ7413@playa.tlv.redhat.com> References: <1300290769-31155-1-git-send-email-alevy@redhat.com> <1300290769-31155-2-git-send-email-alevy@redhat.com> <4D80E7C4.80808@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4D80E7C4.80808@redhat.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jes Sorensen Cc: hdegoede@redhat.com, uril@redhat.com, qemu-devel@nongnu.org, gleb@redhat.com On Wed, Mar 16, 2011 at 05:39:32PM +0100, Jes Sorensen wrote: > On 03/16/11 16:52, Alon Levy wrote: > > This moves the int pipe[2] and pthread_t main data from the > > PCIQXLDevice struct to the SimpleSpiceDisplay. This will let us > > reuse it in the next patch for both -spice with no -qxl usage and > > for vga mode from qxl. > > > > Also move the pipe creation function (which is effectively completely rewritten > > by this patch anyways) from hw/qxl.c to ui/spice-display.c, since > > spice-display will depend on it after the next patch and qemu can be build > > with ui/spice-display.c in combination with no hw/qxl.c. > > --- > > hw/qxl.c | 22 +++++----------------- > > hw/qxl.h | 4 ---- > > ui/spice-display.c | 21 +++++++++++++++++++++ > > ui/spice-display.h | 8 ++++++++ > > 4 files changed, 34 insertions(+), 21 deletions(-) > > > > diff --git a/hw/qxl.c b/hw/qxl.c > > index fe4212b..201698f 100644 > > --- a/hw/qxl.c > > +++ b/hw/qxl.c > > @@ -1062,7 +1062,7 @@ static void pipe_read(void *opaque) > > int len; > > > > do { > > - len = read(d->pipe[0], &dummy, sizeof(dummy)); > > + len = read(d->ssd.pipe[0], &dummy, sizeof(dummy)); > > } while (len == sizeof(dummy)); > > qxl_set_irq(d); > > } > > @@ -1078,10 +1078,11 @@ static void qxl_send_events(PCIQXLDevice *d, uint32_t events) > > if ((old_pending & le_events) == le_events) { > > return; > > } > > - if (pthread_self() == d->main) { > > + if (pthread_self() == d->ssd.main) { > > + /* running in io_thread thread */ > [snip] > > diff --git a/ui/spice-display.h b/ui/spice-display.h > > index aef0464..3e6cf7c 100644 > > --- a/ui/spice-display.h > > +++ b/ui/spice-display.h > > @@ -43,6 +43,11 @@ typedef struct SimpleSpiceDisplay { > > QXLRect dirty; > > int notify; > > int running; > > + > > + /* thread signaling - used both in qxl (in vga mode > > + * and in native mode) and without qxl */ > > + pthread_t main; > > + int pipe[2]; /* to iothread */ > > } SimpleSpiceDisplay; > > This really should be using QemuThread rather than pthread_t directly. I > am not quite sure what impact it will have on the use of pthread_self() > above, there might be a need for an additional wrapper there. > Agreed, but it's not introduced by this patch, that code is just being moved from qxl.h to spice-display.h, from PCIQXLDevice to SimpleSpiceDisplay (which is embedded in PCIQXLDevice as well as used standalone when there is no qxl device). I'll make a separate patch for this. > Cheers, > Jes