From nobody Sun Sep 28 15:28:18 2025 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=1756823651; cv=none; d=zohomail.com; s=zohoarc; b=gNzxyfuiEsQsNP3owZs6EAIQGZLmw85JWxYZPiTBzj2YUSXs8geDClUWsMDBUbjR4ciM/M5t0hxFm5C8V5Sz4EYtVynwrpo2oGjQwy7Wm92yoNRN0CzUF6GO7zuAtpRso49pgdZgYZfC3sTI3GkSBmonFxzWOPdXLsejt+9Mpow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756823651; 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=dHSCPE30znSY0wWG1dnzAUCDvKJoJRQ7QqhxUlGgzFo=; b=VXVxET503s1ZoU16Rl/bnQFf/0H7UMXJigjKnUG60k/MIGs3OrtZSmHMTCtMwmhWSZn7SxhJ8FtuwKxi11dkGLZcsThzB4sAM0a6jVkfIRLF+ZmJkL7dvy2cqz9epVWBvJ3wP0VYS/PVAnsr4HcgUrwQB5EDCWZzzbMXyOaN8RM= 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 1756823651140820.0642777239234; Tue, 2 Sep 2025 07:34:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1utRlg-0003Ao-SD; Tue, 02 Sep 2025 10:13:52 -0400 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 <3gvu2aAkKCqEBOLFFTMFSHPPHMF.DPNRFNV-EFWFMOPOHOV.PSH@flex--ankeesler.bounces.google.com>) id 1utRlZ-000388-C7 for qemu-devel@nongnu.org; Tue, 02 Sep 2025 10:13:45 -0400 Received: from mail-qv1-xf49.google.com ([2607:f8b0:4864:20::f49]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <3gvu2aAkKCqEBOLFFTMFSHPPHMF.DPNRFNV-EFWFMOPOHOV.PSH@flex--ankeesler.bounces.google.com>) id 1utRlH-0005LK-FE for qemu-devel@nongnu.org; Tue, 02 Sep 2025 10:13:44 -0400 Received: by mail-qv1-xf49.google.com with SMTP id 6a1803df08f44-70dd6d255c4so135773806d6.0 for ; Tue, 02 Sep 2025 07:13:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1756822403; x=1757427203; 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=dHSCPE30znSY0wWG1dnzAUCDvKJoJRQ7QqhxUlGgzFo=; b=dcHMaliOyNba2g+yphuv2Zk/5z8QTucL0lYTGSnP462FYNzkOSNjdsPKBQJmSPLPBT 9nSWo1ZIrCIjYxOgI5qYmdDmKW4Np0fvWATPqFKms0MBB/0Hb85FWhmpc08tIRC6G9iD Ppu5FY1IMa4C/fdHEbaXjJzgGHHqHBE3ZkPA/vcg/J0ZEWgWcgQU9Q8jSMjYsfIs1lc/ qaGeXIigl2EKlHUQ3OeH8yCkowG4hM7P9rv+K/hTfh8etzF0yEw2j6ZKn8uUXM66m+dn 4efXrtX+l5PHFKTmD+Ay3N1PgPjLY/9LL+6TpkxEhnzi91UognPBN6YDLmGzFgGi9IhZ W/FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756822403; x=1757427203; 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=dHSCPE30znSY0wWG1dnzAUCDvKJoJRQ7QqhxUlGgzFo=; b=Vjnw+Gnj9ZRaDKOVVtu8fi6Hg+JXRTnzaXP3uCCBn0KzmvDeuyNfFVwzmZwX+FOdQD ZP7wnmWGUrct3ryrvLlV0sV8pa6XiDzyrcsaWLKldQrarcSjknDOhJxQ0+U6qU3j6voX SIoblM7Z5i3E+joNTruQqKbzIqstR+0e3gCUMMP4lpKGKuxYShkFhSuaqrTrB/O+gQgP 1hll+cY/HOJSi5/t1wlyllTiTpcwh0sn9eB8Wgp1r/KZnHkbywApIsQUN3emEvaZ/ReN Ywpys0+2XriRO8fkYVlYo5TVzEwSLoGJqCdR+joU53Ah7T6oUh6zRZl2qSfTyXG00u0w iSmg== X-Gm-Message-State: AOJu0YyIN3TFnZB9W5NWtJLAF83Hx3QYSyofXL45QLM+fmCu4wWSLAUp tTFT+4f5g4NEhQb7AOgh9JYt8DFOHLKOPzTxrYEyigAMC+jzYPgOY8Ir0ETvYbfgfDdJHCTsXz8 gePh60NUgD8abThYU X-Google-Smtp-Source: AGHT+IGhn452ukdULXAIbH1TYQFSAodQviu9A4SiU72IYKb64PF3kuaVaXxon8m247idQq6IR2bdFijVcon4FsA= X-Received: from qkbef6.prod.google.com ([2002:a05:620a:8086:b0:7ff:c939:d59e]) (user=ankeesler job=prod-delivery.src-stubby-dispatcher) by 2002:a05:622a:1101:b0:4af:1fe7:2170 with SMTP id d75a77b69052e-4b31dcd3740mr112062291cf.39.1756822402879; Tue, 02 Sep 2025 07:13:22 -0700 (PDT) Date: Tue, 2 Sep 2025 14:13:12 +0000 In-Reply-To: <20250902141312.750525-1-ankeesler@google.com> Mime-Version: 1.0 References: <20250902141312.750525-1-ankeesler@google.com> X-Mailer: git-send-email 2.51.0.338.gd7d06c2dae-goog Message-ID: <20250902141312.750525-2-ankeesler@google.com> Subject: [PATCH v3 1/1] Support per-head resolutions with virtio-gpu From: Andrew Keesler To: berrange@redhat.com, marcandre.lureau@gmail.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::f49; envelope-from=3gvu2aAkKCqEBOLFFTMFSHPPHMF.DPNRFNV-EFWFMOPOHOV.PSH@flex--ankeesler.bounces.google.com; helo=mail-qv1-xf49.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: 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: 1756823653179116600 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). 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: !(xres || yres) && (outputs[i].has_xres && outputs[i].has_yres) Behavior: new behavior - outputs[i] enabled with outputs[i].xres/yres Case: (xres || yres) && (outputs[i].has_xres && outputs[i].has_yres) Behavior: new behavior - outputs[i] enabled with outputs[i].xres/yres Reviewed-by: Daniel P. Berrang=C3=A9 --- hw/display/virtio-gpu-base.c | 10 ++++++++++ qapi/virtio.json | 10 ++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c index 7269477a1c..6adb5312a4 100644 --- a/hw/display/virtio-gpu-base.c +++ b/hw/display/virtio-gpu-base.c @@ -233,6 +233,16 @@ 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 && 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 9d652fe4a8..9469c63e81 100644 --- a/qapi/virtio.json +++ b/qapi/virtio.json @@ -966,15 +966,21 @@ ## # @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. # # @name: the name of the output # +# @xres: horizontal resolution of the output in pixels (since 10.2) +# +# @yres: vertical resolution of the output in pixels (since 10.2) +# # Since: 10.1 ## =20 { 'struct': 'VirtIOGPUOutput', - 'data': { 'name': 'str' } } + 'data': { 'name': 'str', '*xres': 'uint16', '*yres': 'uint16' } } =20 ## # @DummyVirtioForceArrays: --=20 2.51.0.338.gd7d06c2dae-goog