From nobody Thu Nov 13 20:44:50 2025 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1582673693; cv=none; d=zohomail.com; s=zohoarc; b=mqUYVzHq/GQx5xOUZZOcCalq8kGNjrZSqT/tgTkuRUV2XMkPPN9fS304+eOlL7oRS2NOFEGurdozXAkS/nVsDhMQKHRq0D9+YnMdnESxq88rNu0NGNHZK4UVW50H5/gTUgS8NmWki4T6Mz6mtsiIjz2oLbx+plhWNCMcBUtzkjw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582673693; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=W0b7Y4Lk/ZfBoFuhwy2EagTHIBIYqMv8ruli0MFdCGw=; b=Tzhi3+fc6/YOJhtzYH0rSGg2UO3r3i33MY47csvwKC97Cmvy74Y68qTRTCd4aEgN3tLZB2Kkz5jm91BpSf962G7YJ19Jr5Ii+oYtJ/SBK2suL6X03GWOSv+HHrwW101bFhwqz5pQ4AjwmjouGULkFbE1MoW8C8R6j9BAhbUUlMw= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1582673692791355.8532512087364; Tue, 25 Feb 2020 15:34:52 -0800 (PST) Received: from localhost ([::1]:36096 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6jj0-0008S0-Gc for importer@patchew.org; Tue, 25 Feb 2020 18:34:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48090) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6gW0-0006yw-4T for qemu-devel@nongnu.org; Tue, 25 Feb 2020 15:09:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6gVy-0005tl-PG for qemu-devel@nongnu.org; Tue, 25 Feb 2020 15:09:11 -0500 Received: from vmicros1.altlinux.org ([194.107.17.57]:53056) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1j6gVy-0005m9-HW for qemu-devel@nongnu.org; Tue, 25 Feb 2020 15:09:10 -0500 Received: from imap.altlinux.org (imap.altlinux.org [194.107.17.38]) by vmicros1.altlinux.org (Postfix) with ESMTP id BC83572CCEF; Tue, 25 Feb 2020 23:09:07 +0300 (MSK) Received: from x230.localdomain (109-252-52-89.nat.spd-mgts.ru [109.252.52.89]) by imap.altlinux.org (Postfix) with ESMTPSA id 9F9A54A4A2A; Tue, 25 Feb 2020 23:09:07 +0300 (MSK) Date: Tue, 25 Feb 2020 23:09:14 +0300 From: "Anton V. Boyarshinov" To: Gerd Hoffmann Subject: [PATCH] Arithmetic error fixed in EDID generation Message-ID: <20200225200914.3ec2c07b@x230.localdomain> Organization: ALT Linux X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-alt-linux-gnu) MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 194.107.17.57 X-Mailman-Approved-At: Tue, 25 Feb 2020 18:34:07 -0500 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: shaba@altlinux.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" To compute screen size in centimeters we should calculate: pixels/dpi*2.54 but not pixels*dpi/2540 Using wrong formula we actually get 65 DPI and very small fonts. Signed-off-by: Anton V. Boyarshinov --- 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 75c945a948..537e063662 100644 --- a/hw/display/edid-generate.c +++ b/hw/display/edid-generate.c @@ -360,8 +360,8 @@ void qemu_edid_generate(uint8_t *edid, size_t size, edid[20] =3D 0xa5; =20 /* screen size: undefined */ - edid[21] =3D info->prefx * info->dpi / 2540; - edid[22] =3D info->prefy * info->dpi / 2540; + edid[21] =3D (uint8_t) ((float) info->prefx / info->dpi * 2.54); + edid[22] =3D (uint8_t) ((float) info->prefy / info->dpi * 2.54); =20 /* display gamma: 2.2 */ edid[23] =3D 220 - 100; --=20 2.21.0