From nobody Sun Apr 12 00:57:15 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1772643108; cv=none; d=zohomail.com; s=zohoarc; b=BTMqCtUAfGu7FLKsKKKCMAU1DGuGpt36R3EKop/i64cn537j9VqoKorTvPaSLlTNv9pXqL0GLfJK/SA+rg3Oc6odtnIAuRHOcQlS+uY6ImEMT0INoZOtKuNSYNDnA8uMwBFLM2je+hlbHn25GDiw5FJpHuH6kcN/yB6B2MGtD4Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772643108; h=Content-Type:Content-Transfer-Encoding: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=UZAvHG40jXQMBngawC8NrPyT3mArKFlvPG9XrbzWnFE=; b=U5/CoIjxXj9jDG6qfmigI7+7W0pZY8G7WGUD6ahfXVUygOZBypqfcH00CxTtmeXbuTFf/MrMQ88oUxmOI4qssSlV5l42vammYI5InOqatpm2XYY6a08/b5cItOcJgULT41Xgi2NL6yAp9YStKyMhFKxQM20Eqo4ACBYLN2/7KJQ= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1772643108380414.9034654060091; Wed, 4 Mar 2026 08:51:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vxpR1-0003rs-Ja; Wed, 04 Mar 2026 11:50:55 -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 ) id 1vxpQx-0003pS-UQ for qemu-devel@nongnu.org; Wed, 04 Mar 2026 11:50:52 -0500 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vxpQt-0002PC-U4 for qemu-devel@nongnu.org; Wed, 04 Mar 2026 11:50:51 -0500 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-65bfc858561so3383315a12.2 for ; Wed, 04 Mar 2026 08:50:46 -0800 (PST) Received: from draig.lan ([185.124.0.126]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-65fac06e3fasm5775501a12.25.2026.03.04.08.50.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2026 08:50:44 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id C78285FB2D; Wed, 04 Mar 2026 16:50:43 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772643046; x=1773247846; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UZAvHG40jXQMBngawC8NrPyT3mArKFlvPG9XrbzWnFE=; b=r80TizfW5A0K2c5OUJzq1zs/7w9Biwtl0zL6OdhnQot2cQl79qbbOJ2eGtvvl0VKI2 fVnpPWBGIH1KCjTtV+coDKfNBQ5i8kBqMKHA/LN3qXziNbTJFHg/5SDSMaQLQAaXeQl7 x8wB3anTNbX8i9jE6OEueJ9q5kg6EZoW8YQMis9E6/F6PfV6Ahr+uvRW7Z1xU2jP4duJ PaMYeVqRR6u5Vf94UnT3BvYqo5ojPsgpCkM7d6/243F2+LE+V1jlAnWnCihQxLMFggvO stXlh+9ImaKC751DpMO8aFMc6aX8qb8TL2DStaO1unKvkIwi2yNkIvxZmgQw1QD2Q1G4 qP6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772643046; x=1773247846; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=UZAvHG40jXQMBngawC8NrPyT3mArKFlvPG9XrbzWnFE=; b=RMc3XIZcONiAyE5aWdED00+BK2RXLogXwxJsacAvDmXYlR8y4ebq5uMFTM8lhU9oJG tF3zXshwuY3y+sFRhr1KJNq1DC4ZxtuhN0AcNZ1Uc4Q+4Z0ZtHGh0EhY3dDA6nzgyJs5 iacphJFJ6syrnU6bvpTIo0hz2nFEG2SscpDMQGdmOZ1nvIA8rCuHX0GUph8VOEDUbSQO mOr2FOs0Aj6TC+UHnE2iqZ4EV82W6kHvzc7lZ3MVwaEHG5+95m3IqLLlM1RfyaycDttC 5fG4diKkfcyc+LTBOvo8Cose/FfzfJT0ZR9cKY+oRfk5voQtVOymV1tMBozCad32o3/x nBNg== X-Gm-Message-State: AOJu0YxmK0LlU/2/9pERIrPd5t9RcObfEfurAMPWEaWnNYKthx+2I+cG E7qibGdjDk7pXLI+9QaAzuMylcOrhVnr+eHFsGmhnVyxgF6jBszGzPD0ggnr52H72cs= X-Gm-Gg: ATEYQzxwjWiXh/XwDS2XraqRmz3pApFo/xNty13+2hmHz9mhDJx2XWwa7ZZDWFpTZK4 Km7voceZAmskO6kqOhAO98s7TnL842+pNU9r9AMSgnppbm4BIQac7QskWC3andJ/ZKrlvfEa1V3 lXrNYVOlCsePS0ql80GexUlO4+6bgI9hyNs31AbrmhJkYdojQ+NZwwgGN/EloxwW5SaoLMKkGkB 95/rbAus+EMRoFXDop7g/53HfEa+j3L7Ux8tyD7VD3Cj+FtvdWA7SiWOl4M9yAb5kMgztvDbeqk xiv1s0jSi0t3iKbEhY+cQ/e6NOSims9WdFs9MLsOipY3RId4SLsxRtNrklPXCIbBonDt2fj7MnD HaztbV2cPD+624E5w7Fx6kKZT+AfE7aLmnWDiWmOk+TopFqm4GPvVMGJ742DodJhltG8bc4785S NOOWI5Bl03zC+y96017onK2VI= X-Received: by 2002:a05:6402:40c8:b0:660:48f:22b9 with SMTP id 4fb4d7f45d1cf-660ef78bfc7mr1456247a12.12.1772643045513; Wed, 04 Mar 2026 08:50:45 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Markus Armbruster , Akihiko Odaki , Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Eric Blake , "Michael S. Tsirkin" , Dmitry Osipenko , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Andrew Keesler Subject: [PATCH 01/20] Support per-head resolutions with virtio-gpu Date: Wed, 4 Mar 2026 16:50:23 +0000 Message-ID: <20260304165043.1437519-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260304165043.1437519-1-alex.bennee@linaro.org> References: <20260304165043.1437519-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::533; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x533.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.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 @linaro.org) X-ZM-MESSAGEID: 1772643110966139100 From: Andrew Keesler 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 Acked-by: Markus Armbruster Message-ID: <20260210123038.2332364-2-ankeesler@google.com> [AJB: fix format strings for size_t in error_setg] Signed-off-by: Alex Benn=C3=A9e --- qapi/virtio.json | 13 +++++++++++-- hw/display/virtio-gpu-base.c | 16 ++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/qapi/virtio.json b/qapi/virtio.json index cd67c4f52e3..09dd0e6d05a 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: diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c index 7269477a1c8..cb76302e2d8 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[%zd].xres and outputs[%zd].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 --=20 2.47.3