From nobody Wed Feb 11 02:07:20 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=google.com ARC-Seal: i=1; a=rsa-sha256; t=1770726698; cv=none; d=zohomail.com; s=zohoarc; b=f2tM9s7PWIKGRrAuE9CRbGmROXWKUp49ty8FouFQ/kqdQGVN4y+njWQnG3w5H2bBto2t6Xjo30DT6N2+GI107k1qQ7pB3s/XwogSC+Zk4JLIJPj7ku4Xl0cIQ7nNxaWa+YSluDw3YRAk9YB7NCpQFZd8ieZxedQelEuA5yKCjC4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770726698; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=kyNRXINSUTBLxrJLZZH047zYsNH4CQmHf2WvnCpbFRA=; b=jF2VjECyhLylgD2xE8uNTSfB7vm136aoWDlsBMnP02w8FHuweQp7HQ3r+5f7GlD2U+WTrJEjBuvmakjg+o9UnAJBcXzyhZCx2f4kq07BNr3Biml0xOyQ4o4KGDkVoLGIOEx2bIDBs7li27ejvoVpmQiDDsh7uoADUu790jf610A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770726698873899.758218847078; Tue, 10 Feb 2026 04:31:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vpmtZ-00077n-Fw; Tue, 10 Feb 2026 07:31:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <3-CSLaQkKCsEhurllzslynvvnsl.jvtxlt1-kl2lsuvunu1.vyn@flex--ankeesler.bounces.google.com>) id 1vpmtM-00072A-JK for qemu-devel@nongnu.org; Tue, 10 Feb 2026 07:30:56 -0500 Received: from mail-qk1-x749.google.com ([2607:f8b0:4864:20::749]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <3-CSLaQkKCsEhurllzslynvvnsl.jvtxlt1-kl2lsuvunu1.vyn@flex--ankeesler.bounces.google.com>) id 1vpmtH-0005eN-V8 for qemu-devel@nongnu.org; Tue, 10 Feb 2026 07:30:53 -0500 Received: by mail-qk1-x749.google.com with SMTP id af79cd13be357-8c6a87029b6so246924785a.1 for ; Tue, 10 Feb 2026 04:30:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1770726649; x=1771331449; darn=nongnu.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=kyNRXINSUTBLxrJLZZH047zYsNH4CQmHf2WvnCpbFRA=; b=Yjj9JqKLDssNYHPSY4mA08FHopkQe1j3Oi1Ba5HimpZiedsAv5nr+TzEApR8spVsvA KBrwNnbFU/Q//gN3DPrVVmLnCMcL/6TZ2jLDRY7wKLewSG1ng6CiX98ISKG422ELEQY3 QdKRMwk9eBw+iMDSfXosTrVm46AqXdKgkk9mr1/h66d5nyc6i0BRwtqx+tyraczHSETF nxDYlEyxGLIhvIGEOMbtYpGXR/5xrxgsjk3mBCqU118kfaf/bVQp+b37X4jEI/l1mjnF NEEStxdzEaDv+ieVQ5EYkNGcgqlJtUP2LuBJRXgdB3y0dHxiaTWPaWDSfCwWCOvaGm4f p86Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770726649; x=1771331449; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kyNRXINSUTBLxrJLZZH047zYsNH4CQmHf2WvnCpbFRA=; b=hqce4LQLYIoxD3pp4dE3D6eP3gWxtbuQX6LM493Se9BPMPX6hOLdYaUt0rEMmbyopN Rd653/ypH+jz4xFIVGuTw/ElgFfHgVozBf4EMlyDxKE22VshatSxVOV0N2gmAY4rriuq pCSid0UHtwcsfFjWJ9mqkZo2OGTS9lhHXJsnKqf+oN0FI+udMpSrWoD1d6f7s78EGbsv lXn63GPkegTleIT2dQDK2o7VSc1ZsHbJ8t1/RYmQRQGZZarYQ0UHQc87BWQ3ZCccOBaK 88EVP94fBrbMAdi2zW7RdSgqoA1Bh4Q9P0NpQcU3NNCi1Mu3urlRIWjzJpDSXf8SwRjy 44GA== X-Gm-Message-State: AOJu0YxpPRSfQ/4xwGaV6iBZ1qXSz6rawWhs2qJuiKUlmzQRuy/iy5Uz 9D2IHnxMIPVl0yrv89KMhq7D266xhiQucc7sQ1O1yhak5H2YhSZdbJDWmXTsTy6gKDvoP7sitxI u7HN2gI3sGlcHhteq X-Received: from qvbnh18.prod.google.com ([2002:a05:6214:3912:b0:894:7038:8d75]) (user=ankeesler job=prod-delivery.src-stubby-dispatcher) by 2002:a05:620a:22e5:b0:8ca:fe5c:ea6d with SMTP id af79cd13be357-8cafe5cec8emr1309346585a.59.1770726648982; Tue, 10 Feb 2026 04:30:48 -0800 (PST) Date: Tue, 10 Feb 2026 12:30:38 +0000 In-Reply-To: <20260210123038.2332364-1-ankeesler@google.com> Mime-Version: 1.0 References: <20260210123038.2332364-1-ankeesler@google.com> X-Mailer: git-send-email 2.53.0.239.g8d8fc8a987-goog Message-ID: <20260210123038.2332364-2-ankeesler@google.com> Subject: [PATCH v5 1/1] Support per-head resolutions with virtio-gpu From: Andrew Keesler To: alex.bennee@linaro.org, armbru@redhat.com Cc: qemu-devel@nongnu.org, Andrew Keesler Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::749; envelope-from=3-CSLaQkKCsEhurllzslynvvnsl.jvtxlt1-kl2lsuvunu1.vyn@flex--ankeesler.bounces.google.com; helo=mail-qk1-x749.google.com X-Spam_score_int: -95 X-Spam_score: -9.6 X-Spam_bar: --------- X-Spam_report: (-9.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, 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, USER_IN_DEF_DKIM_WL=-7.5 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @google.com) X-ZM-MESSAGEID: 1770726700522158500 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In 454f4b0f, we started down the path of supporting separate configurations per display head (e.g., you have 2 heads - one with EDID name "AAA" and the other with EDID name "BBB"). In this change, we add resolution to this configuration surface (e.g., you have 2 heads - one with resolution 111x222 and the other with resolution 333x444). -display vnc=3Dlocalhost:0,id=3Daaa,display=3Dvga,head=3D0 \ -display vnc=3Dlocalhost:1,id=3Dbbb,display=3Dvga,head=3D1 \ -device '{"driver":"virtio-vga", "max_outputs":2, "id":"vga", "outputs":[ { "name":"AAA", "xres":111, "yres":222 }, { "name":"BBB", "xres":333, "yres":444 } ]}' Here is the behavior matrix of the current resolution configuration surface (xres/yres) with the new resolution configuration surface (outputs[i].xres/yres). Note - we use "xres" and "yres" (instead of, say, "width" and "height") to match analogous virtio_gpu_base_conf.xres/yres. Case: !(xres || yres) && !(outputs[i].has_xres && outputs[i].has_yres) Behavior: current behavior - outputs[0] enabled with default xres/yres Case: (xres || yres) && !(outputs[i].has_xres && outputs[i].has_yres) Behavior: current behavior - outputs[0] enabled with xres/yres Case: outputs[i].has_xres && outputs[i].has_yres Behavior: new behavior - outputs[i] enabled with outputs[i].xres/yres Case: outputs[i].has_xres !=3D outputs[i].has_yres Behavior: error Signed-off-by: Andrew Keesler --- hw/display/virtio-gpu-base.c | 16 ++++++++++++++++ qapi/virtio.json | 13 +++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c index 7269477a1c..4bd2311182 100644 --- a/hw/display/virtio-gpu-base.c +++ b/hw/display/virtio-gpu-base.c @@ -233,6 +233,22 @@ virtio_gpu_base_device_realize(DeviceState *qdev, g->req_state[0].width =3D g->conf.xres; g->req_state[0].height =3D g->conf.yres; =20 + for (output_idx =3D 0, node =3D g->conf.outputs; + node && output_idx < g->conf.max_outputs; + output_idx++, node =3D node->next) { + if (node->value->has_xres !=3D node->value->has_yres) { + error_setg(errp, + "must set both outputs[%lu].xres and outputs[%lu].y= res", + output_idx, output_idx); + return false; + } + if (node->value->has_xres && node->value->has_yres) { + g->enabled_output_bitmask |=3D (1 << output_idx); + g->req_state[output_idx].width =3D node->value->xres; + g->req_state[output_idx].height =3D node->value->yres; + } + } + g->hw_ops =3D &virtio_gpu_ops; for (i =3D 0; i < g->conf.max_outputs; i++) { g->scanout[i].con =3D diff --git a/qapi/virtio.json b/qapi/virtio.json index cd67c4f52e..09dd0e6d05 100644 --- a/qapi/virtio.json +++ b/qapi/virtio.json @@ -970,15 +970,24 @@ ## # @VirtIOGPUOutput: # -# Describes configuration of a VirtIO GPU output. +# Describes configuration of a VirtIO GPU output. If both @xres and +# @yres are set, they take precedence over root virtio-gpu resolution +# configuration and enable the corresponding output. If none of @xres +# and @yres are set, root virtio-gpu resolution configuration takes +# precedence and only the first output is enabled. Only setting one +# of @xres or @yres is an error. # # @name: the name of the output # +# @xres: horizontal resolution of the output in pixels (since 11.0) +# +# @yres: vertical resolution of the output in pixels (since 11.0) +# # Since: 10.1 ## =20 { 'struct': 'VirtIOGPUOutput', - 'data': { 'name': 'str' } } + 'data': { 'name': 'str', '*xres': 'uint16', '*yres': 'uint16' } } =20 ## # @DummyVirtioForceArrays: --=20 2.53.0.rc2.204.g2597b5adb4-goog