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=1756403703; cv=none; d=zohomail.com; s=zohoarc; b=kC513V5i0PHKCNYTm8CwDaTTBXkJZ0ydaW6Ox/E5jwbfMu4GgnDXkY7RSXruO1j9UxaIA0idAul+VF3wn7o8T+ro14yXYRNP9yAoe1D9WanM8cVLT8bVhsgsRzVglZhRgWHHpqCGOQgIttf+PDTvpWocOtXtywNTLkHQ4HEDwOU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756403703; 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=3Xa+Cr9KqBCArfh1BVK1sBDjtakPs/JB+duqu8nLn7o=; b=oLNm8dsFjMvufFchnYJYCdCcAY/QozH7YT+BIH9PQhTVn2R6Ch4XpUpLc4RJ98CAJDlRPUym+8/Y+Hm1/e1WlLso8rGN1PRz9Rj2O1m2Avr+3aBVHN5rxf3xZ3P5x1qlHRYpdhMxSSw8lLB6oLwwEpz9ikX5nj2vpcUunA4fLxc= 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 17564037036991015.1120689530876; Thu, 28 Aug 2025 10:55:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1urgoJ-0003dd-8x; Thu, 28 Aug 2025 13:53:19 -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 <3fpewaAkKCrsbolfftmfshpphmf.dpnrfnv-efwfmopohov.psh@flex--ankeesler.bounces.google.com>) id 1urgoG-0003dF-No for qemu-devel@nongnu.org; Thu, 28 Aug 2025 13:53:16 -0400 Received: from mail-qt1-x84a.google.com ([2607:f8b0:4864:20::84a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <3fpewaAkKCrsbolfftmfshpphmf.dpnrfnv-efwfmopohov.psh@flex--ankeesler.bounces.google.com>) id 1urgo8-00081d-JZ for qemu-devel@nongnu.org; Thu, 28 Aug 2025 13:53:16 -0400 Received: by mail-qt1-x84a.google.com with SMTP id d75a77b69052e-4b109be41a1so49526411cf.2 for ; Thu, 28 Aug 2025 10:53:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1756403583; x=1757008383; 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=3Xa+Cr9KqBCArfh1BVK1sBDjtakPs/JB+duqu8nLn7o=; b=OXbkJVW+W09O0WvGFXQMkA1/Tm7as9tPIF6HQY6oU1VLJncn2UOKsct7GCblVRtnz6 c7xTCeR6nK3oHMGJwsh0z/xqRqZVMPdEDvRo+Nr07LLuXai2G65ygAnhmwCmclGsCf5B d+VeVsuXpCb0xmxF9FmnKUgIjxfGepUm2tXA23v7pxN45woSiN5nubwnBs35yn9wpOF6 LPBfBrEkM375k6O0LigvCuvKVrMYuU4ynZpumEHFET16nPCRxIbde0A6sc0O6GPr6aoW 6Kv4xj4BEB1FvyXBx6kXz47c82ivpHkh9sSFg16AYA+qvTWug9aQo8uIKd/wIL0g6AHz 3LbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756403583; x=1757008383; 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=3Xa+Cr9KqBCArfh1BVK1sBDjtakPs/JB+duqu8nLn7o=; b=g4ifqajhvI6cy1ZMIQVDOwEBc2H2QZKR/Sqs+mFq4sA1v3PFrSh72AGbhLdptmSUCd 57xJ+zPMQVPF3Ek5qw3S9P+kGVGRZP4wZOEImdozOXDyFyL3cmKm2f+lZfbP5yXDYSy9 sn0DHn1DzPNDEx3Wqtm2oRj2pM1oMMOJSrofYEx0d833Asvi4AdL0nDpiUmUU0JPojL5 FJEc05Ai6cBjsItYbBsXRtD6R38SgiDRoDkyyET9Hki/51FDqI7fwzfc6eGB7xl2T96G uIVOeTyywyvmn6THl9YoPl9FS7RzwqN3Kh7ftPhZKfTKPl0iUMWBNxxZYvKoYJO5yNVg aqGw== X-Gm-Message-State: AOJu0Yw+Bx9o+aBHJEYPG7/Fd/50Lcub052d6tOUWd4luOU/BCkTvZFD +pou3zQimBWV70pMBfi8o1mKbAWGadmMl9YuLaYrGi3TgIXa5mTR+gcArFMiHlKLxw3UWhRTNRi ZsBsO9J56EpfWILVX X-Google-Smtp-Source: AGHT+IErTmp/pG1SJL1JrowZ8dxWqRDYguXTrXaeSTGDSjvOHEIf7Pxr9jgjQFZMkuonvFujnCwdoy1+faLeGOA= X-Received: from qknqf9.prod.google.com ([2002:a05:620a:6609:b0:7e6:99b9:8ab0]) (user=ankeesler job=prod-delivery.src-stubby-dispatcher) by 2002:a05:622a:1993:b0:4b0:8057:1de9 with SMTP id d75a77b69052e-4b2aaa19f21mr286456101cf.3.1756403582840; Thu, 28 Aug 2025 10:53:02 -0700 (PDT) Date: Thu, 28 Aug 2025 17:52:59 +0000 In-Reply-To: <20250828175259.3831672-1-ankeesler@google.com> Mime-Version: 1.0 References: <20250828175259.3831672-1-ankeesler@google.com> X-Mailer: git-send-email 2.51.0.338.gd7d06c2dae-goog Message-ID: <20250828175259.3831672-2-ankeesler@google.com> Subject: [PATCH v2 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::84a; envelope-from=3fpewaAkKCrsbolfftmfshpphmf.dpnrfnv-efwfmopohov.psh@flex--ankeesler.bounces.google.com; helo=mail-qt1-x84a.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, T_SPF_TEMPERROR=0.01, 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: 1756403704591116600 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].xres || outputs[i].yres) Behavior: current behavior - outputs[0] enabled with default xres/yres Case: (xres || yres) && !(outputs[i].xres || outputs[i].yres) Behavior: current behavior - outputs[0] enabled with xres/yres Case: !(xres || yres) && (outputs[i].xres || outputs[i].yres) Behavior: new behavior - outputs[i] enabled with outputs[i].xres/yres Case: (xres || yres) && (outputs[i].xres || outputs[i].yres) Behavior: new behavior - outputs[i] enabled with outputs[i].xres/yres --- hw/display/virtio-gpu-base.c | 10 ++++++++++ include/hw/virtio/virtio-gpu.h | 2 ++ qapi/virtio.json | 6 +++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c index 7269477a1c..8bcbe5e837 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->xres || node->value->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/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 9f16f89a36..7597e87971 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -129,6 +129,8 @@ struct virtio_gpu_base_conf { uint32_t xres; uint32_t yres; uint64_t hostmem; + // If set, outputs[i].xres/yres takes precedent over xres/yres and ena= bles + // the ith output. VirtIOGPUOutputList *outputs; }; =20 diff --git a/qapi/virtio.json b/qapi/virtio.json index 9d652fe4a8..9f753543cb 100644 --- a/qapi/virtio.json +++ b/qapi/virtio.json @@ -970,11 +970,15 @@ # # @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