From patchwork Sun Sep 27 14:57:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 11802165 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 174F4139F for ; Sun, 27 Sep 2020 14:59:13 +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 828FF23899 for ; Sun, 27 Sep 2020 14:59:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="C90xHP4q" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 828FF23899 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:53078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMY8t-0006H5-NT for patchwork-qemu-devel@patchwork.kernel.org; Sun, 27 Sep 2020 10:59:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49104) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMY8D-0005Qy-FH for qemu-devel@nongnu.org; Sun, 27 Sep 2020 10:58:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:43106) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kMY88-0006TJ-I6 for qemu-devel@nongnu.org; Sun, 27 Sep 2020 10:58:28 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601218702; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8Y86zsB51YRxIrGPaBaJ0OMrK6jcKF47UHG43z60HUs=; b=C90xHP4qVTT/BJOHnMY/0TxoR97eilhWmkTaZRXWVoqdZq5nqbnQ6Ith3AE9eHBvFGTuAY kHDmskH8dp+++7NdgfoTljjBHamRtdV+iIoo442daGEwfmFXQ0ZN5xjwhJEulCYpeu7ugY +46noDpZ/tLWQvauSJ4nxngHMzqKnjI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-195-6AhkGRkrP32wLC_Dwu1F7g-1; Sun, 27 Sep 2020 10:58:19 -0400 X-MC-Unique: 6AhkGRkrP32wLC_Dwu1F7g-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8A6EF1005E5C; Sun, 27 Sep 2020 14:58:18 +0000 (UTC) Received: from localhost (unknown [10.36.110.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 34ECF60C84; Sun, 27 Sep 2020 14:58:07 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v3 1/6] edid: fix physical display size computation Date: Sun, 27 Sep 2020 18:57:46 +0400 Message-Id: <20200927145751.365446-2-marcandre.lureau@redhat.com> In-Reply-To: <20200927145751.365446-1-marcandre.lureau@redhat.com> References: <20200927145751.365446-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/27 10:58:22 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -36 X-Spam_score: -3.7 X-Spam_bar: --- X-Spam_report: (-3.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.576, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, 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: spice-devel@lists.freedesktop.org, Gerd Hoffmann , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Divide the resolution by the DPI, and multiply to mm. Note the computation done for edid[21/22] is correct (in cm). Signed-off-by: Marc-André Lureau --- hw/display/edid-generate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/display/edid-generate.c b/hw/display/edid-generate.c index e58472fde5..618c74e1df 100644 --- a/hw/display/edid-generate.c +++ b/hw/display/edid-generate.c @@ -208,8 +208,8 @@ static void edid_desc_timing(uint8_t *desc, uint32_t dpi) { /* physical display size */ - uint32_t xmm = xres * dpi / 254; - uint32_t ymm = yres * dpi / 254; + uint32_t xmm = xres * 254 / 10 / dpi; + uint32_t ymm = yres * 254 / 10 / dpi; /* pull some realistic looking timings out of thin air */ uint32_t xfront = xres * 25 / 100; From patchwork Sun Sep 27 14:57:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 11802173 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 038D2112E for ; Sun, 27 Sep 2020 15:04:50 +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 76B3023899 for ; Sun, 27 Sep 2020 15:04:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VnKOPx2o" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 76B3023899 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:35498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMYEK-0002oQ-GQ for patchwork-qemu-devel@patchwork.kernel.org; Sun, 27 Sep 2020 11:04:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49128) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMY8V-0005d8-MV for qemu-devel@nongnu.org; Sun, 27 Sep 2020 10:58:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:31626) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kMY8T-0006Tu-Lf for qemu-devel@nongnu.org; Sun, 27 Sep 2020 10:58:47 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601218724; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ybywO2OTt3WzzjRYQOYXGO2tmmQ+4oz5wdGb+9ihuOg=; b=VnKOPx2oFdJn/olQf69aUDfLytAc3oe1ztXaluDlBSSUSsKkYBOqTewzVG7pj1V3DLcZ6G cqfOb8NI5WLINiuFVyOJkK8p1iFcHTJhqwNnfQt0cq2PPS1tjc6z4Zp20Wz+j9+MKdyTwu /OrlXqjxVKKyp4xixvrSdwKXMlR39MA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-134-KNA4iyfeP2aZtfTmR_I3IA-1; Sun, 27 Sep 2020 10:58:24 -0400 X-MC-Unique: KNA4iyfeP2aZtfTmR_I3IA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F3F5E1DDE2; Sun, 27 Sep 2020 14:58:23 +0000 (UTC) Received: from localhost (unknown [10.36.110.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 841C761982; Sun, 27 Sep 2020 14:58:22 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v3 2/6] edid: use physical dimensions if available Date: Sun, 27 Sep 2020 18:57:47 +0400 Message-Id: <20200927145751.365446-3-marcandre.lureau@redhat.com> In-Reply-To: <20200927145751.365446-1-marcandre.lureau@redhat.com> References: <20200927145751.365446-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/27 10:58:07 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -36 X-Spam_score: -3.7 X-Spam_bar: --- X-Spam_report: (-3.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.576, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, 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: spice-devel@lists.freedesktop.org, Gerd Hoffmann , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Replace dpi with width_mm/height_mm in qemu_edid_info. Use it when set (non-zero) to compute the DPI and generate the EDID. Signed-off-by: Marc-André Lureau --- hw/display/edid-generate.c | 36 +++++++++++++++++++++++++----------- include/hw/display/edid.h | 5 ++++- qemu-edid.c | 11 +++++++++-- 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/hw/display/edid-generate.c b/hw/display/edid-generate.c index 618c74e1df..1665b7cbb2 100644 --- a/hw/display/edid-generate.c +++ b/hw/display/edid-generate.c @@ -205,12 +205,8 @@ static void edid_desc_dummy(uint8_t *desc) static void edid_desc_timing(uint8_t *desc, uint32_t xres, uint32_t yres, - uint32_t dpi) + uint32_t xmm, uint32_t ymm) { - /* physical display size */ - uint32_t xmm = xres * 254 / 10 / dpi; - uint32_t ymm = yres * 254 / 10 / dpi; - /* pull some realistic looking timings out of thin air */ uint32_t xfront = xres * 25 / 100; uint32_t xsync = xres * 3 / 100; @@ -290,12 +286,24 @@ static void edid_colorspace(uint8_t *edid, edid[34] = white_y >> 2; } +static uint32_t qemu_edid_dpi_from_mm(uint32_t mm, uint32_t res) +{ + return res * 254 / 10 / mm; +} + +uint32_t qemu_edid_dpi_to_mm(uint32_t dpi, uint32_t res) +{ + return res * 254 / 10 / dpi; +} + void qemu_edid_generate(uint8_t *edid, size_t size, qemu_edid_info *info) { uint32_t desc = 54; uint8_t *xtra3 = NULL; uint8_t *dta = NULL; + uint32_t width_mm, height_mm; + uint32_t dpi = 100; /* if no width_mm/height_mm */ /* =============== set defaults =============== */ @@ -305,15 +313,20 @@ void qemu_edid_generate(uint8_t *edid, size_t size, if (!info->name) { info->name = "QEMU Monitor"; } - if (!info->dpi) { - info->dpi = 100; - } if (!info->prefx) { info->prefx = 1024; } if (!info->prefy) { info->prefy = 768; } + if (info->width_mm && info->height_mm) { + width_mm = info->width_mm; + height_mm = info->height_mm; + dpi = qemu_edid_dpi_from_mm(width_mm, info->prefx); + } else { + width_mm = qemu_edid_dpi_to_mm(dpi, info->prefx); + height_mm = qemu_edid_dpi_to_mm(dpi, info->prefy); + } /* =============== extensions =============== */ @@ -360,8 +373,8 @@ void qemu_edid_generate(uint8_t *edid, size_t size, edid[20] = 0xa5; /* screen size: undefined */ - edid[21] = info->prefx * 254 / 100 / info->dpi; - edid[22] = info->prefy * 254 / 100 / info->dpi; + edid[21] = width_mm / 10; + edid[22] = height_mm / 10; /* display gamma: 2.2 */ edid[23] = 220 - 100; @@ -387,7 +400,8 @@ void qemu_edid_generate(uint8_t *edid, size_t size, /* =============== descriptor blocks =============== */ - edid_desc_timing(edid + desc, info->prefx, info->prefy, info->dpi); + edid_desc_timing(edid + desc, info->prefx, info->prefy, + width_mm, height_mm); desc += 18; edid_desc_ranges(edid + desc); diff --git a/include/hw/display/edid.h b/include/hw/display/edid.h index 5b1de57f24..1f8fc9b375 100644 --- a/include/hw/display/edid.h +++ b/include/hw/display/edid.h @@ -5,7 +5,8 @@ typedef struct qemu_edid_info { const char *vendor; /* http://www.uefi.org/pnp_id_list */ const char *name; const char *serial; - uint32_t dpi; + uint16_t width_mm; + uint16_t height_mm; uint32_t prefx; uint32_t prefy; uint32_t maxx; @@ -18,6 +19,8 @@ size_t qemu_edid_size(uint8_t *edid); void qemu_edid_region_io(MemoryRegion *region, Object *owner, uint8_t *edid, size_t size); +uint32_t qemu_edid_dpi_to_mm(uint32_t dpi, uint32_t res); + #define DEFINE_EDID_PROPERTIES(_state, _edid_info) \ DEFINE_PROP_UINT32("xres", _state, _edid_info.prefx, 0), \ DEFINE_PROP_UINT32("yres", _state, _edid_info.prefy, 0), \ diff --git a/qemu-edid.c b/qemu-edid.c index 46eef70498..1db3372b98 100644 --- a/qemu-edid.c +++ b/qemu-edid.c @@ -9,7 +9,10 @@ #include "qemu/cutils.h" #include "hw/display/edid.h" -static qemu_edid_info info; +static qemu_edid_info info = (qemu_edid_info) { + .prefx = 1024, + .prefy = 768, +}; static void usage(FILE *out) { @@ -39,6 +42,7 @@ int main(int argc, char *argv[]) { FILE *outfile = NULL; uint8_t blob[256]; + uint32_t dpi = 100; int rc; for (;;) { @@ -83,7 +87,7 @@ int main(int argc, char *argv[]) } break; case 'd': - if (qemu_strtoui(optarg, NULL, 10, &info.dpi) < 0) { + if (qemu_strtoui(optarg, NULL, 10, &dpi) < 0) { fprintf(stderr, "not a number: %s\n", optarg); exit(1); } @@ -110,6 +114,9 @@ int main(int argc, char *argv[]) outfile = stdout; } + info.width_mm = qemu_edid_dpi_to_mm(dpi, info.prefx); + info.height_mm = qemu_edid_dpi_to_mm(dpi, info.prefy); + memset(blob, 0, sizeof(blob)); qemu_edid_generate(blob, sizeof(blob), &info); fwrite(blob, sizeof(blob), 1, outfile); From patchwork Sun Sep 27 14:57:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 11802169 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EC60E112E for ; Sun, 27 Sep 2020 15:01:03 +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 90A0B23899 for ; Sun, 27 Sep 2020 15:01:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fSES/4Ca" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 90A0B23899 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:57870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMYAe-0008K0-TF for patchwork-qemu-devel@patchwork.kernel.org; Sun, 27 Sep 2020 11:01:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49124) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMY8U-0005bY-O1 for qemu-devel@nongnu.org; Sun, 27 Sep 2020 10:58:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:20552) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kMY8T-0006Tq-1X for qemu-devel@nongnu.org; Sun, 27 Sep 2020 10:58:46 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601218724; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hNLcghou2JIIFL8nOu0gOdDNzxKgsPO8BGkR410M6LI=; b=fSES/4Cas0OthixwQM55GDrXZVuBH77IjnnIYUAjcR7vlFIrupJ06DDVW70mNyGQXRTnR6 PcsLvF8cAiU7gbULD94z+GOjNUog5b/orj/xmYA9gjDvZfMTzXIrfooUC+0NOWObnDZEVf 4d0hhYjL5bwzKCXTq3398EJCs0dcs5w= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-593-aKgGuxWjPr-Q2HZlDuMVUw-1; Sun, 27 Sep 2020 10:58:41 -0400 X-MC-Unique: aKgGuxWjPr-Q2HZlDuMVUw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CF8AA807331; Sun, 27 Sep 2020 14:58:40 +0000 (UTC) Received: from localhost (unknown [10.36.110.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 10DAA5D9CA; Sun, 27 Sep 2020 14:58:27 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v3 3/6] ui: add getter for UIInfo Date: Sun, 27 Sep 2020 18:57:48 +0400 Message-Id: <20200927145751.365446-4-marcandre.lureau@redhat.com> In-Reply-To: <20200927145751.365446-1-marcandre.lureau@redhat.com> References: <20200927145751.365446-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/27 10:58:22 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -36 X-Spam_score: -3.7 X-Spam_bar: --- X-Spam_report: (-3.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.576, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, 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: spice-devel@lists.freedesktop.org, Gerd Hoffmann , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau The following patch is going to introduce extra fields / details to UIInfo. Add a getter and keep the current values, instead of memset(0) Signed-off-by: Marc-André Lureau --- include/ui/console.h | 1 + ui/console.c | 7 +++++++ ui/spice-display.c | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/ui/console.h b/include/ui/console.h index 79e301f946..353d2e49a1 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -264,6 +264,7 @@ void update_displaychangelistener(DisplayChangeListener *dcl, void unregister_displaychangelistener(DisplayChangeListener *dcl); bool dpy_ui_info_supported(QemuConsole *con); +const QemuUIInfo *dpy_get_ui_info(const QemuConsole *con); int dpy_set_ui_info(QemuConsole *con, QemuUIInfo *info); void dpy_gfx_update(QemuConsole *con, int x, int y, int w, int h); diff --git a/ui/console.c b/ui/console.c index 7592c3c324..54a74c0b16 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1516,6 +1516,13 @@ bool dpy_ui_info_supported(QemuConsole *con) return con->hw_ops->ui_info != NULL; } +const QemuUIInfo *dpy_get_ui_info(const QemuConsole *con) +{ + assert(con != NULL); + + return &con->ui_info; +} + int dpy_set_ui_info(QemuConsole *con, QemuUIInfo *info) { assert(con != NULL); diff --git a/ui/spice-display.c b/ui/spice-display.c index 19632fdf6c..625d9232b9 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -672,7 +672,7 @@ static int interface_client_monitors_config(QXLInstance *sin, return 1; } - memset(&info, 0, sizeof(info)); + info = *dpy_get_ui_info(ssd->dcl.con); if (mc->num_of_monitors == 1) { /* From patchwork Sun Sep 27 14:57:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 11802171 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3983A92C for ; Sun, 27 Sep 2020 15:01:47 +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 E3B2B23899 for ; Sun, 27 Sep 2020 15:01:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="P8OUdc5i" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E3B2B23899 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:59134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMYBO-0000X2-0y for patchwork-qemu-devel@patchwork.kernel.org; Sun, 27 Sep 2020 11:01:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49152) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMY8k-000626-E1 for qemu-devel@nongnu.org; Sun, 27 Sep 2020 10:59:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:40913) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kMY8i-0006UI-OT for qemu-devel@nongnu.org; Sun, 27 Sep 2020 10:59:02 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601218740; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b0l8qvWRrHwiSkIqmmCGlnK1Woq1I9l3yvB4ZPhG79Y=; b=P8OUdc5ivEovT5bgi6NFgWBCpdr5vFyXsw475jsnFGKDKTM4JANaR5z2oqhgTsFvBCfZJm PVC5+f9c/V81Vu+Hav2U4a50MjTdFW41avHVzAmrQBbyccRl1GEbMoPfVzyDXXJZn+5k7F fQzPDcLsq3P6ep1zwcqODjqK/lW9Ug8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-300-z30i4VWZN4urGLAgNL5npQ-1; Sun, 27 Sep 2020 10:58:56 -0400 X-MC-Unique: z30i4VWZN4urGLAgNL5npQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2BBA6186841E; Sun, 27 Sep 2020 14:58:55 +0000 (UTC) Received: from localhost (unknown [10.36.110.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0332110013C4; Sun, 27 Sep 2020 14:58:44 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v3 4/6] spice: remove the single monitor config logic Date: Sun, 27 Sep 2020 18:57:49 +0400 Message-Id: <20200927145751.365446-5-marcandre.lureau@redhat.com> In-Reply-To: <20200927145751.365446-1-marcandre.lureau@redhat.com> References: <20200927145751.365446-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/27 10:58:07 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -36 X-Spam_score: -3.7 X-Spam_bar: --- X-Spam_report: (-3.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.576, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, 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: spice-devel@lists.freedesktop.org, Gerd Hoffmann , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Introduced in commit 9c956e646178fee8c14ce7dfae5a9d7cb901876c ("spice: prepare for upcoming spice-server change"), the new logic never materialized in the spice server source tree. Let's remove it for now, until it actually changes in Spice. Signed-off-by: Marc-André Lureau --- ui/spice-display.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/ui/spice-display.c b/ui/spice-display.c index 625d9232b9..b304c13149 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -674,28 +674,10 @@ static int interface_client_monitors_config(QXLInstance *sin, info = *dpy_get_ui_info(ssd->dcl.con); - if (mc->num_of_monitors == 1) { - /* - * New spice-server version which filters the list of monitors - * to only include those that belong to our display channel. - * - * single-head configuration (where filtering doesn't matter) - * takes this code path too. - */ - info.width = mc->monitors[0].width; - info.height = mc->monitors[0].height; - } else { - /* - * Old spice-server which gives us all monitors, so we have to - * figure ourself which entry we need. Array index is the - * channel_id, which is the qemu console index, see - * qemu_spice_add_display_interface(). - */ - head = qemu_console_get_index(ssd->dcl.con); - if (mc->num_of_monitors > head) { - info.width = mc->monitors[head].width; - info.height = mc->monitors[head].height; - } + head = qemu_console_get_index(ssd->dcl.con); + if (mc->num_of_monitors > head) { + info.width = mc->monitors[head].width; + info.height = mc->monitors[head].height; } trace_qemu_spice_ui_info(ssd->qxl.id, info.width, info.height); From patchwork Sun Sep 27 14:57:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 11802167 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 86FCC112E for ; Sun, 27 Sep 2020 14:59:56 +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 32E6C23899 for ; Sun, 27 Sep 2020 14:59:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Fq9ofA/1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 32E6C23899 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:56590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMY9b-0007fG-4G for patchwork-qemu-devel@patchwork.kernel.org; Sun, 27 Sep 2020 10:59:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49190) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMY8y-0006QE-57 for qemu-devel@nongnu.org; Sun, 27 Sep 2020 10:59:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:36410) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kMY8w-0006Vq-IQ for qemu-devel@nongnu.org; Sun, 27 Sep 2020 10:59:15 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601218754; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EWT3eeP8M1S4mF5jrWBk/Kh6soLRKqtXBG4/bKeL4bg=; b=Fq9ofA/1hqmSVobVHEsNCzIAVkfkjEh4laXgIwbbh5KFKEFSQemDW4rRlrI3aPnsSAycWl cMliBkXCqWwO2sv1XSCI2hRDFQbuQVBqVPwYtw3MFF/O8WkpWn5GC6oUJtm86ERXvgFwwJ cppe6Bdv7Q5WRQ8XXVUTFljrS+bSfXE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-381-Xq8ATs5mOLmMQx8X147b_g-1; Sun, 27 Sep 2020 10:59:09 -0400 X-MC-Unique: Xq8ATs5mOLmMQx8X147b_g-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 92680807322; Sun, 27 Sep 2020 14:59:08 +0000 (UTC) Received: from localhost (unknown [10.36.110.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5BBFA78801; Sun, 27 Sep 2020 14:58:59 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v3 5/6] spice: get monitors physical dimension Date: Sun, 27 Sep 2020 18:57:50 +0400 Message-Id: <20200927145751.365446-6-marcandre.lureau@redhat.com> In-Reply-To: <20200927145751.365446-1-marcandre.lureau@redhat.com> References: <20200927145751.365446-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/27 10:58:22 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -36 X-Spam_score: -3.7 X-Spam_bar: --- X-Spam_report: (-3.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.576, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, 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: spice-devel@lists.freedesktop.org, Gerd Hoffmann , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau With upcoming Spice server version 0.14.4, the monitor configuration can contain additional fields for the monitor physical dimensions. Signed-off-by: Marc-André Lureau --- include/ui/console.h | 3 +++ ui/spice-display.c | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/include/ui/console.h b/include/ui/console.h index 353d2e49a1..e7303d8b98 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -119,6 +119,9 @@ typedef struct DisplaySurface { } DisplaySurface; typedef struct QemuUIInfo { + /* physical dimension */ + uint16_t width_mm; + uint16_t height_mm; /* geometry */ int xoff; int yoff; diff --git a/ui/spice-display.c b/ui/spice-display.c index b304c13149..0178d5766d 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -678,6 +678,13 @@ static int interface_client_monitors_config(QXLInstance *sin, if (mc->num_of_monitors > head) { info.width = mc->monitors[head].width; info.height = mc->monitors[head].height; +#if SPICE_SERVER_VERSION >= 0x000e04 /* release 0.14.4 */ + if (mc->flags & VD_AGENT_CONFIG_MONITORS_FLAG_PHYSICAL_SIZE) { + VDAgentMonitorMM *mm = (void *)&mc->monitors[mc->num_of_monitors]; + info.width_mm = mm[head].width; + info.height_mm = mm[head].height; + } +#endif } trace_qemu_spice_ui_info(ssd->qxl.id, info.width, info.height); From patchwork Sun Sep 27 14:57:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 11802175 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C7792112C for ; Sun, 27 Sep 2020 15:06:53 +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 5EB7023899 for ; Sun, 27 Sep 2020 15:06:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MdSBh/hM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5EB7023899 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:40062 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMYGK-0005IO-EG for patchwork-qemu-devel@patchwork.kernel.org; Sun, 27 Sep 2020 11:06:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMY9A-0006om-27 for qemu-devel@nongnu.org; Sun, 27 Sep 2020 10:59:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:43929) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kMY98-0006Wl-ED for qemu-devel@nongnu.org; Sun, 27 Sep 2020 10:59:27 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601218765; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PQD54WdAZS3iIKMslHPFTacgZs+8lfyKf4zASmwmDHo=; b=MdSBh/hMZbSBMDBo1ciStgazvwK4+iR7SNxBINoK2d4TzNRkLWntJsCbL3WJxM5mhp22zr koMX8YC/YhxHSU1WEFFzaFjaJkztNnAKo+FWSyjS+fOjhBg2hsTN3uJxd1W7Suoi+3W89T FKl0QucFIGWa2TqVCgYSR/ulCCbjJLU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-260-k-zpFqQAOJ6mkyBYcCIQXg-1; Sun, 27 Sep 2020 10:59:23 -0400 X-MC-Unique: k-zpFqQAOJ6mkyBYcCIQXg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 809231DDEB; Sun, 27 Sep 2020 14:59:22 +0000 (UTC) Received: from localhost (unknown [10.36.110.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id F0C145D9CA; Sun, 27 Sep 2020 14:59:12 +0000 (UTC) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v3 6/6] virtio-gpu: set physical dimensions for EDID Date: Sun, 27 Sep 2020 18:57:51 +0400 Message-Id: <20200927145751.365446-7-marcandre.lureau@redhat.com> In-Reply-To: <20200927145751.365446-1-marcandre.lureau@redhat.com> References: <20200927145751.365446-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/27 10:58:07 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -36 X-Spam_score: -3.7 X-Spam_bar: --- X-Spam_report: (-3.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.576, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, 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: spice-devel@lists.freedesktop.org, Gerd Hoffmann , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau --- hw/display/virtio-gpu-base.c | 2 ++ hw/display/virtio-gpu.c | 2 ++ include/hw/virtio/virtio-gpu.h | 1 + 3 files changed, 5 insertions(+) diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c index aeb8723542..40ccd00f94 100644 --- a/hw/display/virtio-gpu-base.c +++ b/hw/display/virtio-gpu-base.c @@ -82,6 +82,8 @@ static int virtio_gpu_ui_info(void *opaque, uint32_t idx, QemuUIInfo *info) g->req_state[idx].y = info->yoff; g->req_state[idx].width = info->width; g->req_state[idx].height = info->height; + g->req_state[idx].width_mm = info->width_mm; + g->req_state[idx].height_mm = info->height_mm; if (info->width && info->height) { g->enabled_output_bitmask |= (1 << idx); diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 90be4e3ed7..f3b71fa9c7 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -212,6 +212,8 @@ virtio_gpu_generate_edid(VirtIOGPU *g, int scanout, { VirtIOGPUBase *b = VIRTIO_GPU_BASE(g); qemu_edid_info info = { + .width_mm = b->req_state[scanout].width_mm, + .height_mm = b->req_state[scanout].height_mm, .prefx = b->req_state[scanout].width, .prefy = b->req_state[scanout].height, }; diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 455e0a7433..1aed7275c8 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -62,6 +62,7 @@ struct virtio_gpu_scanout { }; struct virtio_gpu_requested_state { + uint16_t width_mm, height_mm; uint32_t width, height; int x, y; };