From patchwork Tue Feb 25 20:09:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Anton V. Boyarshinov" X-Patchwork-Id: 1244579 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=altlinux.org 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 ozlabs.org (Postfix) with ESMTPS id 48RwJ801vDz9sPk for ; Wed, 26 Feb 2020 10:34:30 +1100 (AEDT) Received: from localhost ([::1]:36092 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6jic-0007fW-SR for incoming@patchwork.ozlabs.org; Tue, 25 Feb 2020 18:34:26 -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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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] = 0xa5; /* screen size: undefined */ - edid[21] = info->prefx * info->dpi / 2540; - edid[22] = info->prefy * info->dpi / 2540; + edid[21] = (uint8_t) ((float) info->prefx / info->dpi * 2.54); + edid[22] = (uint8_t) ((float) info->prefy / info->dpi * 2.54); /* display gamma: 2.2 */ edid[23] = 220 - 100;