From patchwork Sun Sep 2 21:35:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?S=C3=B8ren_Sandmann_Pedersen?= X-Patchwork-Id: 181292 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 A01742C0095 for ; Mon, 3 Sep 2012 14:22:04 +1000 (EST) Received: from localhost ([::1]:51059 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8OAk-0006pz-MF for incoming@patchwork.ozlabs.org; Mon, 03 Sep 2012 00:22:02 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35361) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8Hmj-0003tR-Ua for qemu-devel@nongnu.org; Sun, 02 Sep 2012 17:32:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T8Hmi-0006Ri-G3 for qemu-devel@nongnu.org; Sun, 02 Sep 2012 17:32:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40318) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8Hmi-0006RA-6r for qemu-devel@nongnu.org; Sun, 02 Sep 2012 17:32:48 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q82LWk3t019385 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 2 Sep 2012 17:32:47 -0400 Received: from dhcp-100-3-184.bos.redhat.com (dhcp-189-4.bos.redhat.com [10.16.189.4]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q82LWgWr007933; Sun, 2 Sep 2012 17:32:46 -0400 From: =?UTF-8?q?S=C3=B8ren=20Sandmann=20Pedersen?= To: qemu-devel@nongnu.org, spice-devel@lists.freedesktop.org Date: Sun, 2 Sep 2012 17:35:26 -0400 Message-Id: <1346621726-11313-7-git-send-email-ssp@redhat.com> In-Reply-To: <1346621726-11313-1-git-send-email-ssp@redhat.com> References: <5040688D.5070707@redhat.com> <1346621726-11313-1-git-send-email-ssp@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 X-Mailman-Approved-At: Mon, 03 Sep 2012 00:21:21 -0400 Cc: kraxel@redhat.com, =?UTF-8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Subject: [Qemu-devel] [PATCH-v2 qemu] qxl: Add set_client_capabilities() interface to QXLInterface 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 This new interface lets spice server inform the guest whether (a) a client is connected (b) what capabilities the client has There is a fixed number (464) of bits reserved for capabilities, and when the capabilities bits change, the QXL_INTERRUPT_CLIENT interrupt is generated. Signed-off-by: Soren Sandmann --- hw/qxl.c | 29 ++++++++++++++++++++++++++++- hw/qxl.h | 2 +- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/hw/qxl.c b/hw/qxl.c index c2dd3b4..1f62529 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -901,6 +901,26 @@ static void interface_async_complete(QXLInstance *sin, uint64_t cookie_token) } } +#if SPICE_SERVER_VERSION >= 0x000b04 + +/* called from spice server thread context only */ +static void interface_set_client_capabilities(QXLInstance *sin, + uint8_t client_present, + uint8_t caps[58]) +{ + PCIQXLDevice *qxl = container_of(sin, PCIQXLDevice, ssd.qxl); + + qxl->shadow_rom.client_present = client_present; + memcpy(qxl->shadow_rom.client_capabilities, caps, sizeof(caps)); + qxl->rom->client_present = client_present; + memcpy(qxl->rom->client_capabilities, caps, sizeof(caps)); + qxl_rom_set_dirty(qxl); + + qxl_send_events(qxl, QXL_INTERRUPT_CLIENT); +} + +#endif + static const QXLInterface qxl_interface = { .base.type = SPICE_INTERFACE_QXL, .base.description = "qxl gpu", @@ -922,6 +942,9 @@ static const QXLInterface qxl_interface = { .flush_resources = interface_flush_resources, .async_complete = interface_async_complete, .update_area_complete = interface_update_area_complete, +#if SPICE_SERVER_VERSION >= 0x000b04 + .set_client_capabilities = interface_set_client_capabilities, +#endif }; static void qxl_enter_vga_mode(PCIQXLDevice *d) @@ -1292,7 +1315,7 @@ static void qxl_set_mode(PCIQXLDevice *d, int modenr, int loadvm) d->mode = QXL_MODE_COMPAT; d->cmdflags = QXL_COMMAND_FLAG_COMPAT; -#ifdef QXL_COMMAND_FLAG_COMPAT_16BPP /* new in spice 0.6.1 */ +#if QXL_COMMAND_FLAG_COMPAT_16BPP /* new in spice 0.6.1 */ if (mode->bits == 16) { d->cmdflags |= QXL_COMMAND_FLAG_COMPAT_16BPP; } @@ -1785,6 +1808,10 @@ static int qxl_init_common(PCIQXLDevice *qxl) io_size = 16; break; case 3: /* qxl-3 */ + pci_device_rev = QXL_REVISION_STABLE_V10; + io_size = msb_mask(QXL_IO_RANGE_SIZE * 2 - 1); + break; + case 4: default: pci_device_rev = QXL_DEFAULT_REVISION; io_size = msb_mask(QXL_IO_RANGE_SIZE * 2 - 1); diff --git a/hw/qxl.h b/hw/qxl.h index 172baf6..98d5a64 100644 --- a/hw/qxl.h +++ b/hw/qxl.h @@ -128,7 +128,7 @@ typedef struct PCIQXLDevice { } \ } while (0) -#define QXL_DEFAULT_REVISION QXL_REVISION_STABLE_V10 +#define QXL_DEFAULT_REVISION QXL_REVISION_STABLE_V12 /* qxl.c */ void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL phys, int group_id);