From patchwork Sun Mar 14 12:23:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitaly Chipounov X-Patchwork-Id: 12137319 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78948C433E0 for ; Sun, 14 Mar 2021 12:27:12 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ADD0764EC3 for ; Sun, 14 Mar 2021 12:27:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ADD0764EC3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=cyberhaven.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:38828 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLPpu-0000UF-O9 for qemu-devel@archiver.kernel.org; Sun, 14 Mar 2021 08:27:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56100) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLPna-0008AA-5S for qemu-devel@nongnu.org; Sun, 14 Mar 2021 08:24:46 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:42107) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lLPnY-0005fR-3t for qemu-devel@nongnu.org; Sun, 14 Mar 2021 08:24:45 -0400 Received: by mail-wr1-x42c.google.com with SMTP id j2so7210775wrx.9 for ; Sun, 14 Mar 2021 05:24:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cyberhaven.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=w1iwVVGTSg4NdbQwU7XN2V/K8U/yuHiCibwnvt9K3YQ=; b=dF6dBDDbAt3GU8m1J3eR2kq+9xlPimM2L/k/dUMnUAxMPrwRa4w8MeFG5c0UGAInfX Uti/IBJ8/cotfcgZZZ6eoF5kLiuk71ftRWGhGuyJlEtnO894Mzx9uG1RHL6q0aEAvxEM 7+/av0sJmuPKUuAuiL8+yBQsFIS4cLOB1JCwh9dSQWOtrSnoCIFZhCIrr050ohZn4buC 6O6xXEEFGYubEhZvkrQ0ISbaDAIAglQuQ2R+fGxMFtwaCc3WILwW0L8133OjYaNjooae 5UgsP6sjjlSfv8KWlV/BK7HtwvDF6bXrIxjuE2jscITn4e672zCvYPJhQce0+eMrt2RN jAtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=w1iwVVGTSg4NdbQwU7XN2V/K8U/yuHiCibwnvt9K3YQ=; b=irSkxlBa9L8OGqHXqcbWAdrEwIZiEHGPtcsNkGH1k5vttQGCarIirtpQBx0mYPo83j A/OlZ/DvQ9vPl65MDV+B3bQapXx2Fe5FJHyYq4RWYIGFdh64iHep+qgdpOjNkbPAE434 K7mPvan9poS9qkWxrd7s7laSWYoAteQv6TOqU3NDlkQKcH3Xs97glOXTN8We619/ABpM AJ6qLH8noJs5KLOax0+ju/U/TbBo9QfJwecRp1AOW4A5smO85oWPJxeC9Ierrut6szoM ZGVv9yrwG/sbqeVyyGQUvJDLk8sWsB/K9exQjpQ0dfKbaAg3hcFZ+Q75OmPj4CaFeN2z pPwA== X-Gm-Message-State: AOAM533aIGICvZUDFJoqr6ovCit547Pgyj05RU6hCneBv0tqx6Uiq/YW Q3pwGHtPiQnGppX8cCb8OTPsUMGfdATA+FcQHkU= X-Google-Smtp-Source: ABdhPJw7tVC/jQrxocXvPPIHCtG7yN6D7LtRpqZSCujFFxX5wHhZVx80FXjNCqFmxPxZJs0OuEiOUA== X-Received: by 2002:a05:6000:4b:: with SMTP id k11mr22839702wrx.35.1615724681623; Sun, 14 Mar 2021 05:24:41 -0700 (PDT) Received: from localhost.localdomain (bbcs-71-51.pub.wingo.ch. [144.2.71.51]) by smtp.gmail.com with ESMTPSA id o188sm9688011wme.7.2021.03.14.05.24.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 05:24:41 -0700 (PDT) From: vitaly@cyberhaven.com To: qemu-devel@nongnu.org Subject: [PATCH] hw/display/virtio-vga: made vga memory size configurable Date: Sun, 14 Mar 2021 13:23:14 +0100 Message-Id: <20210314122314.3201195-1-vitaly@cyberhaven.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=vitaly@cyberhaven.com; helo=mail-wr1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vitaly Chipounov , kraxel@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Vitaly Chipounov This enables higher resolutions. The default is still 8MB for backwards compatibility with existing snapshots. The property name "vgamem_fb" is similar to that of the other graphic adapters. seabios/vgasrc/svgamodes.c needs to be updated as well. For example, adding the following line would expose a 3840x2160 resolution to the guest. { 0x199, { MM_DIRECT, 3840, 2160, 32, 8, 16, SEG_GRAPH } }, Signed-off-by: Vitaly Chipounov --- hw/display/virtio-vga.c | 3 ++- hw/virtio/virtio-pci.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c index d3c6404061..657fafc48f 100644 --- a/hw/display/virtio-vga.c +++ b/hw/display/virtio-vga.c @@ -118,7 +118,7 @@ static void virtio_vga_base_realize(VirtIOPCIProxy *vpci_dev, Error **errp) int i; /* init vga compat bits */ - vga->vram_size_mb = 8; + vga->vram_size_mb = vpci_dev->vgamem_size_mb; vga_common_init(vga, OBJECT(vpci_dev)); vga_init(vga, OBJECT(vpci_dev), pci_address_space(&vpci_dev->pci_dev), pci_address_space_io(&vpci_dev->pci_dev), true); @@ -204,6 +204,7 @@ static void virtio_vga_set_big_endian_fb(Object *obj, bool value, Error **errp) static Property virtio_vga_base_properties[] = { DEFINE_VIRTIO_GPU_PCI_PROPERTIES(VirtIOPCIProxy), + DEFINE_PROP_UINT32("vgamem_mb", VirtIOPCIProxy, vgamem_size_mb, 8), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index d7d5d403a9..8684311a8d 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -151,6 +151,8 @@ struct VirtIOPCIProxy { VirtIOIRQFD *vector_irqfd; int nvqs_with_notifiers; VirtioBusState bus; + + uint32_t vgamem_size_mb; }; static inline bool virtio_pci_modern(VirtIOPCIProxy *proxy)