From nobody Mon Feb 9 07:07:24 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1564068471; cv=none; d=zoho.com; s=zohoarc; b=ET6QMIwvWPOITl9zZg5qS4Jw05lDrCaPksiN0EbrdzFqCE/rwpVLFe9KSJMsaR6tUZjSGfd2o4rpT0A9a6WJibfl3jyZ/o9VOdbQ4eQa4S44JBlazINs2gJ0nAPJWKIB9NMhQi3cqOiw72K73zuwHpPCIFSC/4z2cM83IDfKAhE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564068471; 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:ARC-Authentication-Results; bh=4Zt4p8h9LBDqBncoCaRjyJmBHtQlh25DYcwwLHESC6k=; b=lMevtnjSSjjRvRv2Wdya7Xruv4++7Chz/xdihPCf1xoXgLF9j0jgEDWsnGlsN48ZAJi7qbojZq/WIvGbdJS2AMPAKSezKYGi6Zm4E6Zp76ckk/j4Czf6YXsxfIgrmz7Zenk/GOUDkJLQsCAZUFjvELBulTqQuuUfcq64u9Mdc58= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.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 1564068470713861.3593966766258; Thu, 25 Jul 2019 08:27:50 -0700 (PDT) Received: from localhost ([::1]:32852 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqfel-00007I-Hx for importer@patchew.org; Thu, 25 Jul 2019 11:27:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47867) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqfeY-0007pf-R5 for qemu-devel@nongnu.org; Thu, 25 Jul 2019 11:27:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hqfeT-0008Su-Je for qemu-devel@nongnu.org; Thu, 25 Jul 2019 11:27:34 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]:28210) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hqfeT-0008S7-9X for qemu-devel@nongnu.org; Thu, 25 Jul 2019 11:27:29 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 1DC4C7456C8; Thu, 25 Jul 2019 17:27:27 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 0019E7456B4; Thu, 25 Jul 2019 17:27:26 +0200 (CEST) Message-Id: From: BALATON Zoltan Date: Thu, 25 Jul 2019 17:25:11 +0200 MIME-Version: 1.0 To: qemu-devel@nongnu.org Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:738:2001:2001::2001 Subject: [Qemu-devel] [PATCH] ati-vga: Attempt to handle CRTC offset not exact multiple of stride 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: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" MacOS seems to need this and the resulting vbe_start_addr seems correct but I'm not sure this is how it should work (picture is still broken with MacOS but probably due to firmware problems now). It also occured to me that these CRTC regs are also present in VGA so I wonder if they should be shared in case some drivers try to poke them via VGA regs. Added a comment noting this although in practice drivers I've tried so far program the card accessing ati regs so I did not attempt to change it. Signed-off-by: BALATON Zoltan --- hw/display/ati.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/hw/display/ati.c b/hw/display/ati.c index b849f5d510..d1db07dd2f 100644 --- a/hw/display/ati.c +++ b/hw/display/ati.c @@ -50,6 +50,7 @@ static void ati_vga_switch_mode(ATIVGAState *s) s->mode =3D EXT_MODE; if (s->regs.crtc_gen_cntl & CRTC2_EN) { /* CRT controller enabled, use CRTC values */ + /* FIXME Should these be the same as VGA CRTC regs? */ uint32_t offs =3D s->regs.crtc_offset & 0x07ffffff; int stride =3D (s->regs.crtc_pitch & 0x7ff) * 8; int bpp =3D 0; @@ -103,14 +104,20 @@ static void ati_vga_switch_mode(ATIVGAState *s) if (stride) { vbe_ioport_write_index(&s->vga, 0, VBE_DISPI_INDEX_VIRT_WI= DTH); vbe_ioport_write_data(&s->vga, 0, stride); - if (offs % stride =3D=3D 0) { - vbe_ioport_write_index(&s->vga, 0, VBE_DISPI_INDEX_Y_O= FFSET); - vbe_ioport_write_data(&s->vga, 0, offs / stride); - } else { - /* FIXME what to do with this? */ - error_report("VGA offset is not multiple of pitch, " - "expect bad picture"); + if (offs % stride) { + /* FIXME Is this correct? */ + warn_report("CRTC offset is not multiple of pitch"); + vbe_ioport_write_index(&s->vga, 0, + VBE_DISPI_INDEX_X_OFFSET); + vbe_ioport_write_data(&s->vga, 0, + offs % stride / (bpp / 8)); } + vbe_ioport_write_index(&s->vga, 0, VBE_DISPI_INDEX_Y_OFFSE= T); + vbe_ioport_write_data(&s->vga, 0, offs / stride); + DPRINTF("VBE offset (%d,%d), vbe_start_addr=3D%x\n", + s->vga.vbe_regs[VBE_DISPI_INDEX_X_OFFSET], + s->vga.vbe_regs[VBE_DISPI_INDEX_Y_OFFSET], + s->vga.vbe_start_addr); } } } else { --=20 2.13.7