From nobody Sat Feb 7 04:55:06 2026 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=none dis=none) header.from=jablonski.xyz ARC-Seal: i=1; a=rsa-sha256; t=1770223611; cv=none; d=zohomail.com; s=zohoarc; b=OKlgKriUNascMHCh9fz0y+uWcO5O5h49P7dJFjYDamNdkf0NTxqkDk96wXM+XO2Wa1f/KX5eaM12NMIQyNwDvsxShy5nSx3GdCvp3r0s4JJIIVIrkn6pRZh++NXqs6WDoH8jVdMPcb3cTDKxjZ5/eyQJXfaIGy/Bza9t4tgGHM8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770223611; h=Content-Transfer-Encoding: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=laB0U4bo8HCPOWBM9uXAA+xB62yuJOctU/qX8DNsXjM=; b=d4o3YYXagTDdYHBM9mL5XN7vCQvPPvHVEGSW1BoHsOzahoagJZrm04+HSEdvlxzq/8mB9rvlOWd1LZTs/obo8jz9629VWloVPW9mhi8x3GgQgTkciEuyWatiWJjUxXRX5fHMC5ZydQX3LegqjhRZpAVR9gsRLuPseIaXE9h1DsI= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770223611043242.91795721649441; Wed, 4 Feb 2026 08:46:51 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vng1J-00073U-Ai; Wed, 04 Feb 2026 11:46:25 -0500 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 ) id 1vng1A-00070R-5Z for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:16 -0500 Received: from fout-b7-smtp.messagingengine.com ([202.12.124.150]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vng16-0004WH-GN for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:15 -0500 Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfout.stl.internal (Postfix) with ESMTP id 6EF281D00144; Wed, 4 Feb 2026 11:46:10 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Wed, 04 Feb 2026 11:46:10 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 11:46:09 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id 3612959e; Wed, 4 Feb 2026 16:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jablonski.xyz; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1770223570; x= 1770309970; bh=laB0U4bo8HCPOWBM9uXAA+xB62yuJOctU/qX8DNsXjM=; b=W UXyjYhJCbnmp0/A0WM8SfrpgUKPugzI6rCWb7pLvjPKjzaooAsF8w18oLWI181gj xPRbPBwjzRdZAfEdONKjQjLX026EG8LOfsR8LLeznxKBTh5FBtNaTbLIewIPHwSE SCBCxvx08aHvY4s5qEBukMUTW9s6tQh1HPIOLcJR6MO+Z+Ip5+bu6kEVTiGwkjzt a+7cpOCO/lRlo8Mff1S/Hz8LAra2jxm2Yl903iBSNaqgvX2siluXIzAieMuQH/4F 2MG6Ff0jZlkJXvGN3w4MSaHmlVTT1tP6198uVb36Kn9e0men7WK6NUYVXo+mTzcN a5mgvvslbSitU1lvU0NoA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1770223570; x=1770309970; bh=l aB0U4bo8HCPOWBM9uXAA+xB62yuJOctU/qX8DNsXjM=; b=U2AYSxXheqT9spuhF H7UJJ3aEFRno6pj8gYVyOHvYwHTsp1LhVZ00nyc6n3c5kWvJiQwHgQvCI/Ksnt6s 5CGSlx6cBMS/JMjexnmR5LSYK0tgGiitybIsDgRLEN6IR7LK/y3ya5JKrXF0YlBc ivkO53v22py88fbGIdIfWHPSYOBST+l9XHKtiTr7ptfwfSVhX0vQcI8i4IhbHJED rYavNiqcbKhHmSJYYXLvFDuMzXLvQ6/WUMP9zmIXfUkg1dyaHEucOKcHl3A3a9cw bSIBZyp5sIm1Djfy0LtABP0/HNGpSKX76jMt8lWLXoLDl1L++3++Eg40bRqm6rKx 7al6g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedvleehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg gslhhonhhskhhirdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpth htoheptghhrggusehjrggslhhonhhskhhirdighiiipdhrtghpthhtohepsggrlhgrthho nhesvghikhdrsghmvgdrhhhu X-ME-Proxy: Feedback-ID: ib26944c1:Fastmail From: Chad Jablonski To: qemu-devel@nongnu.org Cc: balaton@eik.bme.hu, Chad Jablonski Subject: [PATCH v8 01/18] ati-vga: Fix framebuffer mapping by using hardware-correct aperture sizes Date: Wed, 4 Feb 2026 11:45:49 -0500 Message-ID: <20260204164606.3425246-2-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260204164606.3425246-1-chad@jablonski.xyz> References: <20260204164606.3425246-1-chad@jablonski.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=202.12.124.150; envelope-from=chad@jablonski.xyz; helo=fout-b7-smtp.messagingengine.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @jablonski.xyz) X-ZM-MESSAGEID: 1770223614220154100 Content-Type: text/plain; charset="utf-8" Rage 128 cards always request 64MB for their linear (framebuffer) aperture and R100 cards always request 128MB. This is regardless of the amount of physical VRAM on the board. The following are results from real hardware tests: Card VRAM PCI BAR0 CONFIG_MEMSIZE CONFIG= _APER_SIZE AGP_APER_OFFSET Reviewed-by: BALATON Zoltan ----------------------- ---- -------- -------------- ------= ---------- --------------- Rage 128 Pro Ultra TF 32MB 64MB 0x02000000 0x020= 00000 0x02000000 Rage 128 RF/SG AGP 16MB 64MB 0x01000000 0x020= 00000 0x02000000 Radeon R100 QD [Radeon 7200] 64MB 128MB 0x04000000 0x040= 00000 N/A Radeon RV100 QY [Radeon 7000/VE] 32MB 128MB 0x02000000 0x040= 00000 N/A Previously the linear aperture (BAR0) would match the VRAM size. This discrepancy caused issues with the X.org and XFree86 r128 drivers. These drivers apply a mask of 0xfc000000 (2^26 =3D 64MB) to the linear aperture address. If that address is not on a 64MB boundary the framebuffer points to an incorrect memory location. Testing shows that the Radeon R100 also has a BAR0 larger than VRAM (128MB in this case) and the X.org radeon driver also masks to 64MB. For Rage 128, CONFIG_APER_SIZE also differs from the previous value and the behavior stated in the documentation. The Rage 128 register guide states that it should contain the size of the VRAM + AGP memory. The cards tested above show that this isn't the case. These tests also included enabling/disabling AGP with 8MB of memory. It didn't change the contents of CONFIG_APER_SIZE. For both Rage 128 and R100 the CONFIG_APER_SIZE is half of the PCI BAR0 siz= e. Signed-off-by: Chad Jablonski Reviewed-by: BALATON Zoltan --- hw/display/ati.c | 16 ++++++++++++++-- hw/display/ati_int.h | 5 +++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/hw/display/ati.c b/hw/display/ati.c index e9c3ad2cd1..8438a77de0 100644 --- a/hw/display/ati.c +++ b/hw/display/ati.c @@ -361,7 +361,7 @@ static uint64_t ati_mm_read(void *opaque, hwaddr addr, = unsigned int size) PCI_BASE_ADDRESS_0, size) & 0xffffff= f0; break; case CONFIG_APER_SIZE: - val =3D s->vga.vram_size / 2; + val =3D memory_region_size(&s->linear_aper) / 2; break; case CONFIG_REG_1_BASE: val =3D pci_default_read_config(&s->dev, @@ -952,6 +952,7 @@ static void ati_vga_realize(PCIDevice *dev, Error **err= p) { ATIVGAState *s =3D ATI_VGA(dev); VGACommonState *vga =3D &s->vga; + uint64_t aper_size; =20 #ifndef CONFIG_PIXMAN if (s->use_pixman !=3D 0) { @@ -1011,7 +1012,18 @@ static void ati_vga_realize(PCIDevice *dev, Error **= errp) /* io space is alias to beginning of mmregs */ memory_region_init_alias(&s->io, OBJECT(s), "ati.io", &s->mm, 0, 0x100= ); =20 - pci_register_bar(dev, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &vga->vram); + /* + * The framebuffer is at the beginning of the linear aperture. For + * Rage128 the upper half of the aperture is reserved for an AGP + * window (which we do not emulate.) + */ + aper_size =3D s->dev_id =3D=3D PCI_DEVICE_ID_ATI_RAGE128_PF ? + ATI_RAGE128_LINEAR_APER_SIZE : ATI_R100_LINEAR_APER_SIZE; + memory_region_init(&s->linear_aper, OBJECT(dev), "ati-linear-aperture0= ", + aper_size); + memory_region_add_subregion(&s->linear_aper, 0, &vga->vram); + + pci_register_bar(dev, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->linear_ape= r); pci_register_bar(dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->io); pci_register_bar(dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->mm); =20 diff --git a/hw/display/ati_int.h b/hw/display/ati_int.h index f5a47b82b0..708cc1dd3a 100644 --- a/hw/display/ati_int.h +++ b/hw/display/ati_int.h @@ -10,6 +10,7 @@ #define ATI_INT_H =20 #include "qemu/timer.h" +#include "qemu/units.h" #include "hw/pci/pci_device.h" #include "hw/i2c/bitbang_i2c.h" #include "vga_int.h" @@ -29,6 +30,9 @@ /* Radeon RV100 (VE) */ #define PCI_DEVICE_ID_ATI_RADEON_QY 0x5159 =20 +#define ATI_RAGE128_LINEAR_APER_SIZE (64 * MiB) +#define ATI_R100_LINEAR_APER_SIZE (128 * MiB) + #define TYPE_ATI_VGA "ati-vga" OBJECT_DECLARE_SIMPLE_TYPE(ATIVGAState, ATI_VGA) =20 @@ -97,6 +101,7 @@ struct ATIVGAState { QEMUCursor *cursor; QEMUTimer vblank_timer; bitbang_i2c_interface bbi2c; + MemoryRegion linear_aper; MemoryRegion io; MemoryRegion mm; ATIVGARegs regs; --=20 2.52.0 From nobody Sat Feb 7 04:55:06 2026 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=none dis=none) header.from=jablonski.xyz ARC-Seal: i=1; a=rsa-sha256; t=1770223591; cv=none; d=zohomail.com; s=zohoarc; b=AQSgjRjVMm56QEjq8+plBDViM9TZz53k9y/3dL44XNejGbu32siPnZKq+jRYCvnY4evM8q4H3wSRM+8unrbPVkSxDuVo5q+BYXAxnsSdi+4f6ccRpA2r/2+W6a6naYdAoJeMul32vGN3irKUYNAB6wMO0s/vgu4pQ1Z2qhv3U08= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770223591; h=Content-Transfer-Encoding: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=ABtiVlaCZkrAUapG4ZkghRtl4BtewIcQLfaOOoKZZwo=; b=GHqN3HYuGGQO+EF7ZeWuBvdzn+uqUUoi2Emu+JAWFtw1q2avtB+My4rgtnRiQBNV5OeKHvrepdl8iE4Lkd0E301qaKWUsOLTldihzH9igzD4AN/9ZKScHABceNV/7FI7wEaniEtwrRxpXwAE/68UPC7kDfQDE2KIqE/52x23q7k= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770223591683829.1591590556804; Wed, 4 Feb 2026 08:46:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vng1C-00070a-BD; Wed, 04 Feb 2026 11:46:18 -0500 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 ) id 1vng18-0006zt-Gz for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:14 -0500 Received: from fout-b7-smtp.messagingengine.com ([202.12.124.150]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vng16-0004WI-Fr for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:14 -0500 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.stl.internal (Postfix) with ESMTP id 0357F1D0013D; Wed, 4 Feb 2026 11:46:10 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Wed, 04 Feb 2026 11:46:11 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 11:46:10 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id 7ec644b7; Wed, 4 Feb 2026 16:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jablonski.xyz; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1770223570; x= 1770309970; bh=ABtiVlaCZkrAUapG4ZkghRtl4BtewIcQLfaOOoKZZwo=; b=j cW46JnSqWNAwbjgxYS7txM/hmb/Rh/BGm+OgVKfSgrYlsKDGxnclpVCNfUc5UN/i X0G6PVej1I1++ab+VXZIGEgXMj8XsCg8SPuzBNO/uf0KmcErDWGOJB+awlwNVrPv cFAAGndZdR6xcScFJmN/np7UsrvnsbgrYKHyAv2PqCdiaK2+uskrhc1curcRBnJC dxw/iuT9R/zEfjUhVi5PIuUAa8Nyp4T0vdJxI+dZdHautHyfcLLF7d/NzbSITaM7 WHIG7pKBg5e8WcjfnBjWZllI2j6vhZMGyXzp13mZFoqWaX/UH8PO+w2uNIpZxJlG JaXbSyTFgIQEDYH6DD5yw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1770223570; x=1770309970; bh=A BtiVlaCZkrAUapG4ZkghRtl4BtewIcQLfaOOoKZZwo=; b=cycvuWXSEJFrhi8jH 0dwLmzTBsoGV3Zrhbag850NzdxycSwApDpn9sfFgI0jlupCSXS/BznFpx1oWX8Vs xBNi8hRMAmWzW3qTZqJATFo5oj8ZqkzxTD1f4qJsMygvCwMyt1Qu8NblEgwDTdQZ M4kmXSLmQVDCk+L7W3bTGGDDnKCXTkqBc1d48eLpPkYesRLsshkzxzKViBOSRWB1 MYC0lRuzRnIMej+naoREpaeb/j25p621tsaTGr22IwDMGecR5PCVsHbT28zQfpQd n21meXZjgPY2glkN9+ypskn51fbCj1Dnhj8XS7O0RBk0OE6e4xzK3WKAvpJSVDYw YQORA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedvleehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg gslhhonhhskhhirdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopegthhgrugesjhgrsghlohhnshhkihdrgiihiidprhgtphhtthhope gsrghlrghtohhnsegvihhkrdgsmhgvrdhhuhdprhgtphhtthhopehqvghmuhdquggvvhgv lhesnhhonhhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: ib26944c1:Fastmail From: Chad Jablonski To: qemu-devel@nongnu.org Cc: balaton@eik.bme.hu, Chad Jablonski Subject: [PATCH v8 02/18] ati-vga: Fix DST_PITCH and SRC_PITCH reads Date: Wed, 4 Feb 2026 11:45:50 -0500 Message-ID: <20260204164606.3425246-3-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260204164606.3425246-1-chad@jablonski.xyz> References: <20260204164606.3425246-1-chad@jablonski.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=202.12.124.150; envelope-from=chad@jablonski.xyz; helo=fout-b7-smtp.messagingengine.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @jablonski.xyz) X-ZM-MESSAGEID: 1770223594346158500 Content-Type: text/plain; charset="utf-8" Reading DST_PITCH and SRC_PITCH on the Rage 128 is broken. The read handlers attempt to construct the value from pitch and tile bits in the register state but mistakenly AND them instead of ORing them. This means the pitch is always zero on read. Signed-off-by: Chad Jablonski Reviewed-by: BALATON Zoltan --- hw/display/ati.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/display/ati.c b/hw/display/ati.c index 8438a77de0..777a6b0a2e 100644 --- a/hw/display/ati.c +++ b/hw/display/ati.c @@ -438,7 +438,7 @@ static uint64_t ati_mm_read(void *opaque, hwaddr addr, = unsigned int size) case DST_PITCH: val =3D s->regs.dst_pitch; if (s->dev_id =3D=3D PCI_DEVICE_ID_ATI_RAGE128_PF) { - val &=3D s->regs.dst_tile << 16; + val |=3D s->regs.dst_tile << 16; } break; case DST_WIDTH: @@ -468,7 +468,7 @@ static uint64_t ati_mm_read(void *opaque, hwaddr addr, = unsigned int size) case SRC_PITCH: val =3D s->regs.src_pitch; if (s->dev_id =3D=3D PCI_DEVICE_ID_ATI_RAGE128_PF) { - val &=3D s->regs.src_tile << 16; + val |=3D s->regs.src_tile << 16; } break; case DP_BRUSH_BKGD_CLR: --=20 2.52.0 From nobody Sat Feb 7 04:55:06 2026 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=none dis=none) header.from=jablonski.xyz ARC-Seal: i=1; a=rsa-sha256; t=1770223598; cv=none; d=zohomail.com; s=zohoarc; b=nPqINaSwUsPbMezzACTFrjCNJDZu6OuueVwcGCbriZLtXZm2SG8n1z6W1T57wRigC+EQdaDQmfgZn1gHStr4EqiRqFwehEwdafGaGe4Tkgfk4J0WX1vUHESn6nnzPhQbeuabanYPva6tyUh+50WArpmxWm3rhFdFGpZh0v67PJM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770223598; h=Content-Transfer-Encoding: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=UFSgWoKS6dct4PEaVxUuYg6ee7pN7SwnivHZWSj1kps=; b=amO3kVe94YEXCkGXHdyTYII6co2wXLK080K1VNq9aIuKyX9pbNtA5soxNUG+Qg52A0vAJ6lJrxj43f0FZulWl4idLX5iuiwDxC5PGGXi+fw03Z43rwBW0XM8C7pV/+GWf/xOqpxMVA/aid8sRzz9QKGkQv8KI0q03Bl+e0k9pF4= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770223598461882.9713373618962; Wed, 4 Feb 2026 08:46:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vng1J-00073b-B6; Wed, 04 Feb 2026 11:46:26 -0500 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 ) id 1vng19-00070I-NB for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:16 -0500 Received: from fhigh-b5-smtp.messagingengine.com ([202.12.124.156]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vng16-0004WP-G5 for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:15 -0500 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfhigh.stl.internal (Postfix) with ESMTP id 252657A0063; Wed, 4 Feb 2026 11:46:11 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Wed, 04 Feb 2026 11:46:11 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 11:46:10 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id 2dcdd128; Wed, 4 Feb 2026 16:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jablonski.xyz; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1770223571; x= 1770309971; bh=UFSgWoKS6dct4PEaVxUuYg6ee7pN7SwnivHZWSj1kps=; b=f TKCywWJ6EAUEFniNexmPEmmbOEV68HkAoqChy+lZspo3fj5GaGKTLrzHc1CfJphB edBRhkQ1NJBsY2K8QDlmzH1i8zYdpvFqueDw21bt8qUCHMKIYkFUYLO/MNlt/NRu OHIBDD6NWtRBu2hKUcN4n79fpmvgehB1Zuuz7bvB+UVILDmr+iA6L1GOsyE8X/AN 5u1ARegUVO6ARfGa/meUG+VuKw/dX+7X4mQRridrqIub5QhnM3jDap33WqVCdgBi 7+hsgkF6xyCAS82dgIJT7zDbAHX/Aeivd70gkwYoUFPo77wz1gZz59cCkMWNvxVi zpNFWa7A/AST/WYk1tDLw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1770223571; x=1770309971; bh=U FSgWoKS6dct4PEaVxUuYg6ee7pN7SwnivHZWSj1kps=; b=g9HnkM+DA0/lfxm9Q Mq9oitJ4dgexLpEhxgXvOXQkSSOG56VhTHaAK06lHWdq0M++fIBBRDThBhXKdY7w d7HY3yRFLw6ziVt6fPIDKJw0z2YzT0Pfx5e9WtenKM2/rAa7AgMUBw4I3eG+jTzD Bl8i3JLnsPtf3CI6NICOsAAskJfTIfkGp1Q9cRlwHrDjM9Uj1r4cqaXQh71jTSxL 3cqySZ1oxue8W7Px6kamRZNXsyV3fBq92vVQju9a2garyA/UIH4NihHC5+fiA3wb C6a5wCCqeMwxtLhc4MQSe3xcbgiD53wv4fDgl2assv+ltnoTtz8G2SXCk6Ia01yL u8A1Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedvleehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg gslhhonhhskhhirdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpth htoheptghhrggusehjrggslhhonhhskhhirdighiiipdhrtghpthhtohepsggrlhgrthho nhesvghikhdrsghmvgdrhhhu X-ME-Proxy: Feedback-ID: ib26944c1:Fastmail From: Chad Jablonski To: qemu-devel@nongnu.org Cc: balaton@eik.bme.hu, Chad Jablonski Subject: [PATCH v8 03/18] ati-vga: Read aliased values from DP_GUI_MASTER_CNTL Date: Wed, 4 Feb 2026 11:45:51 -0500 Message-ID: <20260204164606.3425246-4-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260204164606.3425246-1-chad@jablonski.xyz> References: <20260204164606.3425246-1-chad@jablonski.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=202.12.124.156; envelope-from=chad@jablonski.xyz; helo=fhigh-b5-smtp.messagingengine.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @jablonski.xyz) X-ZM-MESSAGEID: 1770223600215158500 Content-Type: text/plain; charset="utf-8" DP_GUI_MASTER_CNTL aliases several fields from DP_DATATYPE and DP_MIX. These were being written correctly but not returned on a read of DP_GUI_MASTER_CNTL. Signed-off-by: Chad Jablonski Reviewed-by: BALATON Zoltan --- hw/display/ati.c | 8 +++++++- hw/display/ati_regs.h | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/hw/display/ati.c b/hw/display/ati.c index 777a6b0a2e..028efd13e1 100644 --- a/hw/display/ati.c +++ b/hw/display/ati.c @@ -460,7 +460,13 @@ static uint64_t ati_mm_read(void *opaque, hwaddr addr,= unsigned int size) val =3D s->regs.dst_y; break; case DP_GUI_MASTER_CNTL: - val =3D s->regs.dp_gui_master_cntl; + /* DP_GUI_MASTER_CNTL aliases fields from DP_MIX and DP_DATATYPE */ + val =3D s->regs.dp_gui_master_cntl | + ((s->regs.dp_datatype & DP_BRUSH_DATATYPE) >> 4) | + ((s->regs.dp_datatype & DP_DST_DATATYPE) << 8) | + ((s->regs.dp_datatype & DP_SRC_DATATYPE) >> 4) | + (s->regs.dp_mix & DP_ROP3) | + ((s->regs.dp_mix & DP_SRC_SOURCE) << 16); break; case SRC_OFFSET: val =3D s->regs.src_offset; diff --git a/hw/display/ati_regs.h b/hw/display/ati_regs.h index d7127748ff..0a0825db04 100644 --- a/hw/display/ati_regs.h +++ b/hw/display/ati_regs.h @@ -386,6 +386,9 @@ #define DST_16BPP 0x00000004 #define DST_24BPP 0x00000005 #define DST_32BPP 0x00000006 +#define DP_DST_DATATYPE 0x0000000f +#define DP_BRUSH_DATATYPE 0x00000f00 +#define DP_SRC_DATATYPE 0x00030000 =20 #define BRUSH_SOLIDCOLOR 0x00000d00 =20 @@ -437,6 +440,8 @@ #define DP_SRC_RECT 0x00000200 #define DP_SRC_HOST 0x00000300 #define DP_SRC_HOST_BYTEALIGN 0x00000400 +#define DP_SRC_SOURCE 0x00000700 +#define DP_ROP3 0x00ff0000 =20 /* LVDS_GEN_CNTL constants */ #define LVDS_BL_MOD_LEVEL_MASK 0x0000ff00 --=20 2.52.0 From nobody Sat Feb 7 04:55:06 2026 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=none dis=none) header.from=jablonski.xyz ARC-Seal: i=1; a=rsa-sha256; t=1770223600; cv=none; d=zohomail.com; s=zohoarc; b=S4zHHc3LSPZb1wYvnsEo3HVla+NqnClKVjKnVV8CZgu8Rkc2En3xIbvyv1tMYtVEmtmTTchzRX9Jf7sn8Wm8hlH0+i/dti0iwOx9c05wu5/GsmRbLpb6MDuxzr4V9t/kcuj7z0a03zZKM5NDYYshJetHxgAeXxcnfXMwfhnINQQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770223600; h=Content-Transfer-Encoding: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=iZFopa7BN2v/Wniu8RWnxAcgO5JG4vm8jdapubVGmHM=; b=jjHGZyT7dL2jtInniW2/d+25I8ukyxp4RrXqwtoUUMG1x/3Jcsi6kJ5Q8ArP4VJYDyieqw4PLoDTH57vC1SwfdliEp7Q1G7l4UzVISpAIf2Sn40vQO8KtDKf0dB8EYiSl2f40+jd1AOG5lgyScdnVlfyE1kuSBXWBQspGe9pow0= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770223600701873.8006581277424; Wed, 4 Feb 2026 08:46:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vng1I-000732-1p; Wed, 04 Feb 2026 11:46:24 -0500 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 ) id 1vng19-00070G-NA for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:16 -0500 Received: from fhigh-b5-smtp.messagingengine.com ([202.12.124.156]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vng16-0004Wd-GB for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:15 -0500 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.stl.internal (Postfix) with ESMTP id A391B7A0102; Wed, 4 Feb 2026 11:46:11 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Wed, 04 Feb 2026 11:46:11 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 11:46:11 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id ae14ee1c; Wed, 4 Feb 2026 16:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jablonski.xyz; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1770223571; x= 1770309971; bh=iZFopa7BN2v/Wniu8RWnxAcgO5JG4vm8jdapubVGmHM=; b=d MJxxMMsvOQJSQcHDCYbs8NDERijvBWNSTVx23pNbAeNd0au+kBNvJuy9PaE2V+KE zl5XH26JvJDalk7SaQzYSIm1wd765N+p5W3c/5xvjhoURd2lZl76dh0Evxmy0V6A rH5A+gzSqXC6QE3MZhHXLJt1/zL89Q9L2tWR++IDMLL0orzNtnifWHohpVNBFMb0 IZ3g9RAGIt5TU9E1Do69J/irCwuMKymv4hbmn29ZiTZ7Nq1JqggtG9e8BszVMcRm FeGrSCZdLBMfKvYLKR2CjIyzbI5F+vI+b4nxjYBINtH622bih2AJbwH9MfGugw9b F5KvwSORQuXBogHGCmWRw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1770223571; x=1770309971; bh=i ZFopa7BN2v/Wniu8RWnxAcgO5JG4vm8jdapubVGmHM=; b=PQcG0ogYY6bbpEOTe y3I4hXeOfEa7WQmtpJmht4AwPn5d5GlN4xM/g+b4kYhurfudCSUbPPHNo2WPsFTB ZrtXLj7aDHL3iOYd3347is2VRKztPTA6f1AnwUfdSOVjQGDtT8IBXL0W5I0gIMv7 x2mMPbA/E7e5gW+2g25rbC4day1KUap0QoW/YcOm+uTj/EgvNrindoXs1z0t3U7L tIOb7eqA+c4qRqsRLxINyImg4rYBolY3QUV9jP53VNOb44XSgBaVK7213f/2eF3M NKHHNK4QJr5vKD6YU9ZM9z34sooSMD+ISYTCizDQ8bPNeflDQS/gABwwCmSO2zj7 7xXbQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedvleehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg gslhhonhhskhhirdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpth htohepsggrlhgrthhonhesvghikhdrsghmvgdrhhhupdhrtghpthhtoheptghhrggusehj rggslhhonhhskhhirdighiii X-ME-Proxy: Feedback-ID: ib26944c1:Fastmail From: Chad Jablonski To: qemu-devel@nongnu.org Cc: balaton@eik.bme.hu, Chad Jablonski Subject: [PATCH v8 04/18] ati-vga: Latch src and dst pitch and offset on master_cntl default Date: Wed, 4 Feb 2026 11:45:52 -0500 Message-ID: <20260204164606.3425246-5-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260204164606.3425246-1-chad@jablonski.xyz> References: <20260204164606.3425246-1-chad@jablonski.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=202.12.124.156; envelope-from=chad@jablonski.xyz; helo=fhigh-b5-smtp.messagingengine.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @jablonski.xyz) X-ZM-MESSAGEID: 1770223602288158500 Content-Type: text/plain; charset="utf-8" Hardware testing on the Rage 128 confirms that (SRC/DST)_OFFSET, and (SRC/DST)_PITCH are latched when (SRC/DST)_PITCH_OFFSET_CNTL bits in DP_GUI_MASTER_CNTL are set to "default". The earlier approach looked at the state of the (SRC/DST)_PITCH_OFFSET_CNTL bits when offset and pitch registers were used. This meant that when (SRC/DST)_PITCH_OFFSET_CNTL was reset to "leave alone" the old values stored in the registers would return. This is not how the real hardware works. Signed-off-by: Chad Jablonski Reviewed-by: BALATON Zoltan --- hw/display/ati.c | 9 +++++++++ hw/display/ati_2d.c | 13 ++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/hw/display/ati.c b/hw/display/ati.c index 028efd13e1..ce23e5e48b 100644 --- a/hw/display/ati.c +++ b/hw/display/ati.c @@ -868,6 +868,15 @@ static void ati_mm_write(void *opaque, hwaddr addr, s->regs.dp_datatype =3D (data & 0x0f00) >> 8 | (data & 0x30f0) << = 4 | (data & 0x4000) << 16; s->regs.dp_mix =3D (data & GMC_ROP3_MASK) | (data & 0x7000000) >> = 16; + + if (!(data & GMC_SRC_PITCH_OFFSET_CNTL)) { + s->regs.src_offset =3D s->regs.default_offset; + s->regs.src_pitch =3D s->regs.default_pitch; + } + if (!(data & GMC_DST_PITCH_OFFSET_CNTL)) { + s->regs.dst_offset =3D s->regs.default_offset; + s->regs.dst_pitch =3D s->regs.default_pitch; + } break; case DST_WIDTH_X: s->regs.dst_x =3D data & 0x3fff; diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c index 309bb5ccb6..a8c4c534b9 100644 --- a/hw/display/ati_2d.c +++ b/hw/display/ati_2d.c @@ -43,8 +43,6 @@ static int ati_bpp_from_datatype(ATIVGAState *s) } } =20 -#define DEFAULT_CNTL (s->regs.dp_gui_master_cntl & GMC_DST_PITCH_OFFSET_CN= TL) - void ati_2d_blt(ATIVGAState *s) { /* FIXME it is probably more complex than this and may need to be */ @@ -63,13 +61,12 @@ void ati_2d_blt(ATIVGAState *s) qemu_log_mask(LOG_GUEST_ERROR, "Invalid bpp\n"); return; } - int dst_stride =3D DEFAULT_CNTL ? s->regs.dst_pitch : s->regs.default_= pitch; + int dst_stride =3D s->regs.dst_pitch; if (!dst_stride) { qemu_log_mask(LOG_GUEST_ERROR, "Zero dest pitch\n"); return; } - uint8_t *dst_bits =3D s->vga.vram_ptr + (DEFAULT_CNTL ? - s->regs.dst_offset : s->regs.default_offset); + uint8_t *dst_bits =3D s->vga.vram_ptr + s->regs.dst_offset; =20 if (s->dev_id =3D=3D PCI_DEVICE_ID_ATI_RAGE128_PF) { dst_bits +=3D s->regs.crtc_offset & 0x07ffffff; @@ -97,14 +94,12 @@ void ati_2d_blt(ATIVGAState *s) s->regs.src_x : s->regs.src_x + 1 - s->regs.dst_wid= th); unsigned src_y =3D (s->regs.dp_cntl & DST_Y_TOP_TO_BOTTOM ? s->regs.src_y : s->regs.src_y + 1 - s->regs.dst_hei= ght); - int src_stride =3D DEFAULT_CNTL ? - s->regs.src_pitch : s->regs.default_pitch; + int src_stride =3D s->regs.src_pitch; if (!src_stride) { qemu_log_mask(LOG_GUEST_ERROR, "Zero source pitch\n"); return; } - uint8_t *src_bits =3D s->vga.vram_ptr + (DEFAULT_CNTL ? - s->regs.src_offset : s->regs.default_offset); + uint8_t *src_bits =3D s->vga.vram_ptr + s->regs.src_offset; =20 if (s->dev_id =3D=3D PCI_DEVICE_ID_ATI_RAGE128_PF) { src_bits +=3D s->regs.crtc_offset & 0x07ffffff; --=20 2.52.0 From nobody Sat Feb 7 04:55:06 2026 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=none dis=none) header.from=jablonski.xyz ARC-Seal: i=1; a=rsa-sha256; t=1770223661; cv=none; d=zohomail.com; s=zohoarc; b=A2cuivexOT+g9tVRwZYclrONK/aReFSzQ3hkyldV5XC2Mk9FvMFifa8xQ3HY99GO62+37T16WJXxK8Frq4UqQvHNEXWlacAfgz5Iu2vqoS86/dW4ibMPeTNccA1fL1aAOdm8zS7TDwEQAhaNMJ5iKEr5pcZmmOYVM0+/wWM2iVQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770223661; h=Content-Transfer-Encoding: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=t09fhcpWk+aZIQ1AgyqKwCgGRfq7HEmlcpbHugFS7Os=; b=RaFTcW6XQzg6CHAmUE3HRAScSzIxEeb6RNTlCRwulN64m0ZfjzhOJ/PIGRiIvDaW3/1WcsPzpl2SOi5VfBg4qsHCANUn9paJL9qfiV0bXHPFEPzjQdnj9top6eUxOgqwia40aEVSqOeXAi9eeYbiTXS0qnFIE6V0h08pv7WAuFM= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770223661806647.4606463102274; Wed, 4 Feb 2026 08:47:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vng1R-00078N-RA; Wed, 04 Feb 2026 11:46:33 -0500 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 ) id 1vng19-00070F-M1 for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:16 -0500 Received: from fout-b7-smtp.messagingengine.com ([202.12.124.150]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vng16-0004Wg-Kw for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:15 -0500 Received: from phl-compute-07.internal (phl-compute-07.internal [10.202.2.47]) by mailfout.stl.internal (Postfix) with ESMTP id E46111D00152; Wed, 4 Feb 2026 11:46:11 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-07.internal (MEProxy); Wed, 04 Feb 2026 11:46:12 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 11:46:11 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id f1fd96fd; Wed, 4 Feb 2026 16:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jablonski.xyz; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1770223571; x= 1770309971; bh=t09fhcpWk+aZIQ1AgyqKwCgGRfq7HEmlcpbHugFS7Os=; b=K 5/aA9d5hPXS+ho6+QcTzgQh4Tr8zwPi791ScgnSC+0B9Wjb9omoK9ByhvQJqIyOC Xs1xNWf9HFDbGtZ54bde+5Xb7XpA1YJitooJD6R+zfnhmf6bOR1+P75sPc2PgfHe SiKHmdVOmuROmFt7HvJ5fKhsifOh/nKOI1seE30d87S/1XCwcgB6Nk3Yrv2Ec3Fz SL1Yarhf+zAm4Y9aTRkA4MLy9Qf0jL/IajsyctHy9YDuL2TzG0s/IbzSsy5Ylipn rYFsxktJvWAsjA5C4EDyKu8Clfz2RqE5hV/kX3znTjawNidq7ipi8Sp+3JS+Yka2 bExL21sgxc5hP1XzTAf3g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1770223571; x=1770309971; bh=t 09fhcpWk+aZIQ1AgyqKwCgGRfq7HEmlcpbHugFS7Os=; b=ntYW9S4y0773yqld0 y3JdhOPn4OG5pwithZHeC055PJAH/DcyCgT5139H5+1oYRbzV7YHNDcegHtH6552 j9ynGgEKtr9pJskzUsm3foytzFZr7XOHAZH9y44Wx78HTFVA7VJZiA+3z/IGyUe3 w2CUsSsOlTi0pj9B/HewJiSIKGeWG5ZfyqwbGeaTPfFfXcEzQBHCLrEMZGNBLuuy hEfR4PAZUYdgAkPYkBIezTKgsq2yPsVoQsAnoR+9Ha3woGDA/iyc5EKiJbTnNa6j qSxCf70E5QvWnEsxD00UQ9KhzWDBatXHbnLBa0/syoHhluFQSoGUAwe3RkvC5OLt JRWvw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedvleeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg gslhhonhhskhhirdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopegthhgrugesjhgrsghlohhnshhkihdrgiihiidprhgtphhtthhope gsrghlrghtohhnsegvihhkrdgsmhgvrdhhuhdprhgtphhtthhopehqvghmuhdquggvvhgv lhesnhhonhhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: ib26944c1:Fastmail From: Chad Jablonski To: qemu-devel@nongnu.org Cc: balaton@eik.bme.hu, Chad Jablonski Subject: [PATCH v8 05/18] ati-vga: Implement foreground and background color register writes Date: Wed, 4 Feb 2026 11:45:53 -0500 Message-ID: <20260204164606.3425246-6-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260204164606.3425246-1-chad@jablonski.xyz> References: <20260204164606.3425246-1-chad@jablonski.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=202.12.124.150; envelope-from=chad@jablonski.xyz; helo=fout-b7-smtp.messagingengine.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @jablonski.xyz) X-ZM-MESSAGEID: 1770223663333154100 Content-Type: text/plain; charset="utf-8" These are straightforward 32-bit register write handlers. They're necessary for a future patch which will use them for color expansion from monochrome host data transfers. Signed-off-by: Chad Jablonski Reviewed-by: BALATON Zoltan --- hw/display/ati.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/display/ati.c b/hw/display/ati.c index ce23e5e48b..26fc74b19b 100644 --- a/hw/display/ati.c +++ b/hw/display/ati.c @@ -924,6 +924,12 @@ static void ati_mm_write(void *opaque, hwaddr addr, case DP_CNTL: s->regs.dp_cntl =3D data; break; + case DP_SRC_FRGD_CLR: + s->regs.dp_src_frgd_clr =3D data; + break; + case DP_SRC_BKGD_CLR: + s->regs.dp_src_bkgd_clr =3D data; + break; case DP_DATATYPE: s->regs.dp_datatype =3D data & 0xe0070f0f; break; --=20 2.52.0 From nobody Sat Feb 7 04:55:06 2026 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=none dis=none) header.from=jablonski.xyz ARC-Seal: i=1; a=rsa-sha256; t=1770223656; cv=none; d=zohomail.com; s=zohoarc; b=LfB0GXGsEc0/FFLVoZp3OhZMq3yHcnnyy4czUrkcrVbKQTZK4kOKKN8GAPKESS0o3h0PceNMLCVvITvUnLczWGXEBf0V9NPIrM0drLG3qw15nXT79+dzKfeynA1HSHMNdLSv1tVbijL8/9dBj6SJ25mVc7GP9hrjdN/HLziiemQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770223656; h=Content-Transfer-Encoding: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=t0OpkvKmgs3r3p5IFcwqLrOzfIoWRJB1S+bWvMool0c=; b=fP5lu6c0S2hR636ICGxWFmL4JBnv9/U3W6GpliFkFK+wi9E76iQ4nj8lUzPoihsZkBGE7RhYz4s0m6uMp7HoN1xQQcvSY9Lg15pLwKC2Z06aDT3K752hklll5aKKpCzGCOv9XencxJ0j0dHt+8to4gdYm0aRqh4nwsdnQortg0A= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770223656523350.1078108086632; Wed, 4 Feb 2026 08:47:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vng1q-0007U3-JD; Wed, 04 Feb 2026 11:46:58 -0500 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 ) id 1vng19-00070Q-WA for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:16 -0500 Received: from fhigh-b5-smtp.messagingengine.com ([202.12.124.156]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vng17-0004Wm-30 for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:15 -0500 Received: from phl-compute-08.internal (phl-compute-08.internal [10.202.2.48]) by mailfhigh.stl.internal (Postfix) with ESMTP id 577C87A003E; Wed, 4 Feb 2026 11:46:12 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Wed, 04 Feb 2026 11:46:12 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 11:46:11 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id 5a39ba9f; Wed, 4 Feb 2026 16:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jablonski.xyz; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1770223572; x= 1770309972; bh=t0OpkvKmgs3r3p5IFcwqLrOzfIoWRJB1S+bWvMool0c=; b=P UHywBTEyxqJqu5jNu3URu9rf2xKCi0ZewZVXUGz2Q2zSPrUTT3fCUN1oSvs9wuoS CScWaXld9h1dgTqrW86eeYsEOCNQr1y3PGsX7hUtaQg6F1AUCyiyd4PlDArMlmCi 1nmIbzdylP0u3IaXcScE2TEMAecoJlTdZwpvJqmyF8cQlDkZxEgCZpv9svTsVL4w PzbuMM9ai7c+svt8LBQuVEeAcnE3PSazNxH6fWIy/iwDfcoPr7Qcwe909X/1scr8 f9dSEvUIENX/y9GFZjFs4TXGhW7G6biOoMJR8+M17U1N6FqacKDtO6Se5hXlRVnu lD16FIUq/i0nVz7RvpgKg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1770223572; x=1770309972; bh=t 0OpkvKmgs3r3p5IFcwqLrOzfIoWRJB1S+bWvMool0c=; b=NlHB7ptTjEQXQWUya AbBQQLOEgc8rwWCQx57txPuBF6eXWKVm6VG9lRCvivO4T/In78WBjF4s/ERG8JEd uo5Ndlkq1S9w9Q/9vgqtO5VhlwHW0taCZOmKcCdFYqTM6habIJyN6Ad85qtVGXjB CiEvd5XFbSo0JWNiCI6OMX48k5qBp8YdXkz9EVnWx8hrtOT17ayBPOgETl8sBVfz PJLbw5b1mJ0atGjLDm65AtFxcfDq8MnZJVpGhLC1CHzhVUD0sWL5WohoUpavGbzh EaKegy+NlpXt0xPkmDIHidYSEFvmI5tH3fRiUJmYBIE2dEm4dLRpsJt8E4tb7tyS byPQQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedvleeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg gslhhonhhskhhirdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopegthhgrugesjhgrsghlohhnshhkihdrgiihiidprhgtphhtthhope gsrghlrghtohhnsegvihhkrdgsmhgvrdhhuhdprhgtphhtthhopehqvghmuhdquggvvhgv lhesnhhonhhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: ib26944c1:Fastmail From: Chad Jablonski To: qemu-devel@nongnu.org Cc: balaton@eik.bme.hu, Chad Jablonski Subject: [PATCH v8 06/18] ati-vga: Add scissor clipping register support Date: Wed, 4 Feb 2026 11:45:54 -0500 Message-ID: <20260204164606.3425246-7-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260204164606.3425246-1-chad@jablonski.xyz> References: <20260204164606.3425246-1-chad@jablonski.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=202.12.124.156; envelope-from=chad@jablonski.xyz; helo=fhigh-b5-smtp.messagingengine.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @jablonski.xyz) X-ZM-MESSAGEID: 1770223659328154100 Content-Type: text/plain; charset="utf-8" Implement read and write operations on SC_TOP_LEFT, SC_BOTTOM_RIGHT, and SRC_SC_BOTTOM_RIGHT registers. These registers are also updated when the src and/or dst clipping fields on DP_GUI_MASTER_CNTL are set to default clipping. Scissor clipping is used when rendering text in X.org. The r128 driver sends host data much wider than is necessary to draw a glyph and cuts it down to size using clipping before rendering. The actual clipping implementation follows in a future patch. This also includes a very minor refactor of the combined default_sc_bottom_right field in the registers struct to default_sc_bottom and default_sc_right. This was done to stay consistent with the other scissor registers and prevent repeated masking and extraction. Signed-off-by: Chad Jablonski Reviewed-by: BALATON Zoltan --- v5: Removed unused default_sc_bottom_right field --- hw/display/ati.c | 70 +++++++++++++++++++++++++++++++++++++++++-- hw/display/ati_int.h | 9 +++++- hw/display/ati_regs.h | 2 ++ 3 files changed, 78 insertions(+), 3 deletions(-) diff --git a/hw/display/ati.c b/hw/display/ati.c index 26fc74b19b..6cf243bcf9 100644 --- a/hw/display/ati.c +++ b/hw/display/ati.c @@ -514,7 +514,32 @@ static uint64_t ati_mm_read(void *opaque, hwaddr addr,= unsigned int size) val |=3D s->regs.default_tile << 16; break; case DEFAULT_SC_BOTTOM_RIGHT: - val =3D s->regs.default_sc_bottom_right; + val =3D (s->regs.default_sc_bottom << 16) | + s->regs.default_sc_right; + break; + case SC_TOP: + val =3D s->regs.sc_top; + break; + case SC_LEFT: + val =3D s->regs.sc_left; + break; + case SC_BOTTOM: + val =3D s->regs.sc_bottom; + break; + case SC_RIGHT: + val =3D s->regs.sc_right; + break; + case SRC_SC_BOTTOM: + val =3D s->regs.src_sc_bottom; + break; + case SRC_SC_RIGHT: + val =3D s->regs.src_sc_right; + break; + case SC_TOP_LEFT: + case SC_BOTTOM_RIGHT: + case SRC_SC_BOTTOM_RIGHT: + qemu_log_mask(LOG_GUEST_ERROR, + "Read from write-only register 0x%x\n", (unsigned)ad= dr); break; default: break; @@ -877,6 +902,16 @@ static void ati_mm_write(void *opaque, hwaddr addr, s->regs.dst_offset =3D s->regs.default_offset; s->regs.dst_pitch =3D s->regs.default_pitch; } + if (!(data & GMC_SRC_CLIPPING)) { + s->regs.src_sc_right =3D s->regs.default_sc_right; + s->regs.src_sc_bottom =3D s->regs.default_sc_bottom; + } + if (!(data & GMC_DST_CLIPPING)) { + s->regs.sc_top =3D 0; + s->regs.sc_left =3D 0; + s->regs.sc_right =3D s->regs.default_sc_right; + s->regs.sc_bottom =3D s->regs.default_sc_bottom; + } break; case DST_WIDTH_X: s->regs.dst_x =3D data & 0x3fff; @@ -956,7 +991,38 @@ static void ati_mm_write(void *opaque, hwaddr addr, } break; case DEFAULT_SC_BOTTOM_RIGHT: - s->regs.default_sc_bottom_right =3D data & 0x3fff3fff; + s->regs.default_sc_right =3D data & 0x3fff; + s->regs.default_sc_bottom =3D (data >> 16) & 0x3fff; + break; + case SC_TOP_LEFT: + s->regs.sc_left =3D data & 0x3fff; + s->regs.sc_top =3D (data >> 16) & 0x3fff; + break; + case SC_LEFT: + s->regs.sc_left =3D data & 0x3fff; + break; + case SC_TOP: + s->regs.sc_top =3D data & 0x3fff; + break; + case SC_BOTTOM_RIGHT: + s->regs.sc_right =3D data & 0x3fff; + s->regs.sc_bottom =3D (data >> 16) & 0x3fff; + break; + case SC_RIGHT: + s->regs.sc_right =3D data & 0x3fff; + break; + case SC_BOTTOM: + s->regs.sc_bottom =3D data & 0x3fff; + break; + case SRC_SC_BOTTOM_RIGHT: + s->regs.src_sc_right =3D data & 0x3fff; + s->regs.src_sc_bottom =3D (data >> 16) & 0x3fff; + break; + case SRC_SC_RIGHT: + s->regs.src_sc_right =3D data & 0x3fff; + break; + case SRC_SC_BOTTOM: + s->regs.src_sc_bottom =3D data & 0x3fff; break; default: break; diff --git a/hw/display/ati_int.h b/hw/display/ati_int.h index 708cc1dd3a..98f57ca5fa 100644 --- a/hw/display/ati_int.h +++ b/hw/display/ati_int.h @@ -78,14 +78,21 @@ typedef struct ATIVGARegs { uint32_t dp_brush_frgd_clr; uint32_t dp_src_frgd_clr; uint32_t dp_src_bkgd_clr; + uint16_t sc_top; + uint16_t sc_left; + uint16_t sc_bottom; + uint16_t sc_right; + uint16_t src_sc_bottom; + uint16_t src_sc_right; uint32_t dp_cntl; uint32_t dp_datatype; uint32_t dp_mix; uint32_t dp_write_mask; uint32_t default_offset; uint32_t default_pitch; + uint16_t default_sc_bottom; + uint16_t default_sc_right; uint32_t default_tile; - uint32_t default_sc_bottom_right; } ATIVGARegs; =20 struct ATIVGAState { diff --git a/hw/display/ati_regs.h b/hw/display/ati_regs.h index 0a0825db04..3999edb9b7 100644 --- a/hw/display/ati_regs.h +++ b/hw/display/ati_regs.h @@ -397,6 +397,8 @@ #define GMC_DST_PITCH_OFFSET_CNTL 0x00000002 #define GMC_SRC_CLIP_DEFAULT 0x00000000 #define GMC_DST_CLIP_DEFAULT 0x00000000 +#define GMC_SRC_CLIPPING 0x00000004 +#define GMC_DST_CLIPPING 0x00000008 #define GMC_BRUSH_SOLIDCOLOR 0x000000d0 #define GMC_SRC_DSTCOLOR 0x00003000 #define GMC_BYTE_ORDER_MSB_TO_LSB 0x00000000 --=20 2.52.0 From nobody Sat Feb 7 04:55:06 2026 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=none dis=none) header.from=jablonski.xyz ARC-Seal: i=1; a=rsa-sha256; t=1770223592; cv=none; d=zohomail.com; s=zohoarc; b=ZqxFyhu7QzRuwaL4ZoVYzzlC9PvDKdO2TAaEo94/B26FlAI4fsXxqyE7G/7dTiuSKgdldsRUiEBevwfOPzAe2jhn3c7K/w9tvi140iF/JDaWagq9X/Kb7b5PVYtHT6RYbR2l5XG9VDuuCub8t4WVWsqU7pQj/oSxCVjgKwWDcP0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770223592; h=Content-Transfer-Encoding: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=jEmCW2CJeKwiBoliiD/nWnWhBy0/mPCAScNKxecv+dg=; b=fNIEsN5gvt3l0kV/jOD0ULTTESapVcUWayPRG80ycY4UUZNnhjmrS3XHEqYNxFNR23UWNkvHJFeUcyfWQtIIphwbOteEH4dg+/wmjx7J9tWnqjmYjQjO+bTyNAobZ8CE6J/Ks0luUb3Rxapdjhp4dZVpfZVcmAQN2IDFBmhfjgA= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770223591808150.0459924133354; Wed, 4 Feb 2026 08:46:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vng1J-00073a-BZ; Wed, 04 Feb 2026 11:46:26 -0500 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 ) id 1vng1A-000711-NH for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:17 -0500 Received: from fout-b7-smtp.messagingengine.com ([202.12.124.150]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vng17-0004Wu-A0 for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:16 -0500 Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfout.stl.internal (Postfix) with ESMTP id 8D6001D00161; Wed, 4 Feb 2026 11:46:12 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Wed, 04 Feb 2026 11:46:12 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 11:46:12 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id 293bb1cd; Wed, 4 Feb 2026 16:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jablonski.xyz; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1770223572; x= 1770309972; bh=jEmCW2CJeKwiBoliiD/nWnWhBy0/mPCAScNKxecv+dg=; b=S dXZ9DM4uYqWzFhEzAxr3iFIKL1/ZXy1Nzbi0Zp+Iz/qEeg9u+QDdkvPNuG+FqFBA j8WKvXa9YHoB/yQLc5/PImVNhJu0+V5jl3uP89qArh2lDjV89Ul15AZGz9HxIX15 0PKJ8CVQNJwYJurMXaPjoUGZd9yzu60u2BCo8rmTiGUIzGiUFVK+oxxY/0p96dm3 dTYZGPTOKSeixQwPC5XLsxYhv4c1wSnvDviLAwURw8SEq+8sUwmm/hyJiu8+qigv j1tg6OABXEfHodRQFyDXtObsozoO6IRWxshXG768Z9MKV2GwE8gZmHhcGdMfPCNP +SxBdhsc6j+B1FVDuHQiw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1770223572; x=1770309972; bh=j EmCW2CJeKwiBoliiD/nWnWhBy0/mPCAScNKxecv+dg=; b=PlwKeqdTa90T/V23v x/S4WC1++Tq3lJ3PLt17zGy2JrOTUdYnLWITvYkCXx1LMOSUp6iOAlaFbW0loweP zm6vwWy3PXYOFNEwgVWfgv4U603ovUvQX/17SnCiGkVK4jjMHGNMl/Oi2vvLuRfN IDJWb7IrT6CDOW3DnV/4foVnlfNYR4bL1lHMkm1/aID2mnakgaqIDmtOxAQL2nrN X/xWNQJLNDb4gxFsokTQKxZ62V50phqSgyYxU/+fvWDAgj/rJuWZl1beD9jDzi8S ToBE4L7HMRTpoYLa+hjXkrSShLgfVRCmCShFlL8oxGqJG/FKddJayZizMAG1Z1GV PcSbw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedvleehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg gslhhonhhskhhirdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopegsrghlrghtohhnsegvihhkrdgsmhgvrdhhuhdprhgtphhtthhope hqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtoheptghhrggusehj rggslhhonhhskhhirdighiii X-ME-Proxy: Feedback-ID: ib26944c1:Fastmail From: Chad Jablonski To: qemu-devel@nongnu.org Cc: balaton@eik.bme.hu, Chad Jablonski Subject: [PATCH v8 07/18] ati-vga: Remove dst_x/y updates after blit Date: Wed, 4 Feb 2026 11:45:55 -0500 Message-ID: <20260204164606.3425246-8-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260204164606.3425246-1-chad@jablonski.xyz> References: <20260204164606.3425246-1-chad@jablonski.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=202.12.124.150; envelope-from=chad@jablonski.xyz; helo=fout-b7-smtp.messagingengine.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @jablonski.xyz) X-ZM-MESSAGEID: 1770223594343158500 Content-Type: text/plain; charset="utf-8" The Mobility M6 register reference (DST_HEIGHT_WIDTH) states that dst_y is updated after a blit but this appears to not be the case. Hardware testing revealed that both the R128 and R100 do not update dst_x or dst_y after a blit, regardless of the source. This removes the update. Signed-off-by: Chad Jablonski Reviewed-by: BALATON Zoltan --- hw/display/ati_2d.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c index a8c4c534b9..cfc7bf9789 100644 --- a/hw/display/ati_2d.c +++ b/hw/display/ati_2d.c @@ -174,10 +174,6 @@ void ati_2d_blt(ATIVGAState *s) dst_y * surface_stride(ds), s->regs.dst_height * surface_stride(ds= )); } - s->regs.dst_x =3D (s->regs.dp_cntl & DST_X_LEFT_TO_RIGHT ? - dst_x + s->regs.dst_width : dst_x); - s->regs.dst_y =3D (s->regs.dp_cntl & DST_Y_TOP_TO_BOTTOM ? - dst_y + s->regs.dst_height : dst_y); break; } case ROP3_PATCOPY: @@ -228,8 +224,6 @@ void ati_2d_blt(ATIVGAState *s) dst_y * surface_stride(ds), s->regs.dst_height * surface_stride(ds= )); } - s->regs.dst_y =3D (s->regs.dp_cntl & DST_Y_TOP_TO_BOTTOM ? - dst_y + s->regs.dst_height : dst_y); break; } default: --=20 2.52.0 From nobody Sat Feb 7 04:55:06 2026 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=none dis=none) header.from=jablonski.xyz ARC-Seal: i=1; a=rsa-sha256; t=1770223718; cv=none; d=zohomail.com; s=zohoarc; b=Lc4uRBWjYwxXpOJKVp40T6Ejq5qo3aSNE5CN8Hk0kOMt7WjVhS506Kpxs4CJ8B6liCEynbx3Eqy/svdksueqDItKUHpen4HfklZhuq6ezhNxwKBbuS0Tl4YDWEC04SZpOorVQjC2dvFQ1us/0Ovp2ZCzktxtyzQLSzxH9L97Dys= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770223718; h=Content-Transfer-Encoding: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=wc5/CA1CTZ2XV6+LGH2Lp1kbRIEEc2t8V0W1vjZuoYM=; b=Kw46uzSPNt7zPf1LpHNIzrwTvCTRG1jIRRtTaI5ZZoA818DXgZE6XO4XwJ7TFn4wfRB3k7kVxyoAJ4Zcn3KXkIuR4J1NVTTewD4+MAu5Tv62uo6iwyTor4axpd7DZyDwJjPR3cfGuqULBiemwfUZq0EMRQG4WazH+8FljoHY7jw= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770223718452735.0367096178941; Wed, 4 Feb 2026 08:48:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vng1L-000742-Al; Wed, 04 Feb 2026 11:46:27 -0500 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 ) id 1vng1B-000715-Td for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:18 -0500 Received: from fout-b7-smtp.messagingengine.com ([202.12.124.150]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vng18-0004XM-NX for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:17 -0500 Received: from phl-compute-10.internal (phl-compute-10.internal [10.202.2.50]) by mailfout.stl.internal (Postfix) with ESMTP id 1312C1D00168; Wed, 4 Feb 2026 11:46:13 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-10.internal (MEProxy); Wed, 04 Feb 2026 11:46:13 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 11:46:12 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id 8b477faf; Wed, 4 Feb 2026 16:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jablonski.xyz; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1770223572; x= 1770309972; bh=wc5/CA1CTZ2XV6+LGH2Lp1kbRIEEc2t8V0W1vjZuoYM=; b=k 1LRvY7FLFOfugsgyTuUJ3Or9QB9pWA34/yYAIhNuMytOCE5VXrIJCTJcxQRUdqsK AQ/Qgu3kjf+aWVf2mKmU3O6+vqCtAIzqfsfoHDbkMdw4xx9LkNIQCY0fRLCOuXsa A9rKrL+TxaNd3d6abtkLdkAJ8C8IS5xIUvHe3hZnteiRVBp4ghK2jG0CBQWkZ3WC u/AD6n70teLUJ23ED3qdjoHDGvcVlXFKK8iln+xzH/hZGFHjrDkChUj2fF33wmRG y+/AC7f20SLj0LDH/5LPL//8WVAL8a4nhst07PeratPlFvW9m1CgfegVz4wYAf1b 26I73Ge/g6z4KYF7gc6Yg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1770223572; x=1770309972; bh=w c5/CA1CTZ2XV6+LGH2Lp1kbRIEEc2t8V0W1vjZuoYM=; b=pIA0Gnlmht2Pk+2nH ZFui0C72YhZbOiENLjMLDXWGGl/FBRTzO3WaZ4UnTKiS9Emr9OdP+g60qUjrSsKU 7umIKyBJUFqvIsXc0hvG72u+IP/DQGO+/Dj5k40qcISNmbbzTRn7kJNxwujTNY+A kFaGpEO1kgt5KQv/nkgbrBGlWv1aoiMIhZD2Wt6YesFJ9l/NAu7iWYOdmEkOxOxM hohq677gDGLqB1O6B97e7Bt/6aEAY+bC10qo5qf5IyI6uQKEczsMECRuNHBt4NAd nDTgJoqsRZ0RjHTaenKWCQIK6xSjAKfCfJAS6ReTm6PJcipMhpFoWNc2VT9UwWH6 7PAIg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedvleeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg gslhhonhhskhhirdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpth htohepsggrlhgrthhonhesvghikhdrsghmvgdrhhhupdhrtghpthhtoheptghhrggusehj rggslhhonhhskhhirdighiii X-ME-Proxy: Feedback-ID: ib26944c1:Fastmail From: Chad Jablonski To: qemu-devel@nongnu.org Cc: balaton@eik.bme.hu, Chad Jablonski Subject: [PATCH v8 08/18] ati-vga: Consolidate dirty region tracking in ati_2d_blt Date: Wed, 4 Feb 2026 11:45:56 -0500 Message-ID: <20260204164606.3425246-9-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260204164606.3425246-1-chad@jablonski.xyz> References: <20260204164606.3425246-1-chad@jablonski.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=202.12.124.150; envelope-from=chad@jablonski.xyz; helo=fout-b7-smtp.messagingengine.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @jablonski.xyz) X-ZM-MESSAGEID: 1770223720255154100 Content-Type: text/plain; charset="utf-8" Both supported ROPs follow the same memory set dirty logic. This consolidates that logic to remove the duplication. Signed-off-by: Chad Jablonski --- hw/display/ati_2d.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c index cfc7bf9789..980cdd6ac0 100644 --- a/hw/display/ati_2d.c +++ b/hw/display/ati_2d.c @@ -43,15 +43,28 @@ static int ati_bpp_from_datatype(ATIVGAState *s) } } =20 +static void ati_set_dirty(ATIVGAState *s, + const uint8_t *dst_bits, unsigned dst_y) +{ + VGACommonState *vga =3D &s->vga; + DisplaySurface *ds =3D qemu_console_surface(vga->con); + + DPRINTF("%p %u ds: %p %d %d rop: %x\n", vga->vram_ptr, vga->vbe_start_= addr, + surface_data(ds), surface_stride(ds), surface_bits_per_pixel(d= s), + (s->regs.dp_mix & GMC_ROP3_MASK) >> 16); + if (dst_bits >=3D vga->vram_ptr + vga->vbe_start_addr && + dst_bits < vga->vram_ptr + vga->vbe_start_addr + + vga->vbe_regs[VBE_DISPI_INDEX_YRES] * vga->vbe_line_offset) { + memory_region_set_dirty(&vga->vram, vga->vbe_start_addr + + s->regs.dst_offset + dst_y * surface_strid= e(ds), + s->regs.dst_height * surface_stride(ds)); + } +} + void ati_2d_blt(ATIVGAState *s) { /* FIXME it is probably more complex than this and may need to be */ /* rewritten but for now as a start just to get some output: */ - DisplaySurface *ds =3D qemu_console_surface(s->vga.con); - DPRINTF("%p %u ds: %p %d %d rop: %x\n", s->vga.vram_ptr, - s->vga.vbe_start_addr, surface_data(ds), surface_stride(ds), - surface_bits_per_pixel(ds), - (s->regs.dp_mix & GMC_ROP3_MASK) >> 16); unsigned dst_x =3D (s->regs.dp_cntl & DST_X_LEFT_TO_RIGHT ? s->regs.dst_x : s->regs.dst_x + 1 - s->regs.dst_widt= h); unsigned dst_y =3D (s->regs.dp_cntl & DST_Y_TOP_TO_BOTTOM ? @@ -166,14 +179,6 @@ void ati_2d_blt(ATIVGAState *s) memmove(&dst_bits[i], &src_bits[j], s->regs.dst_width * by= pp); } } - if (dst_bits >=3D s->vga.vram_ptr + s->vga.vbe_start_addr && - dst_bits < s->vga.vram_ptr + s->vga.vbe_start_addr + - s->vga.vbe_regs[VBE_DISPI_INDEX_YRES] * s->vga.vbe_line_offset= ) { - memory_region_set_dirty(&s->vga.vram, s->vga.vbe_start_addr + - s->regs.dst_offset + - dst_y * surface_stride(ds), - s->regs.dst_height * surface_stride(ds= )); - } break; } case ROP3_PATCOPY: @@ -216,18 +221,13 @@ void ati_2d_blt(ATIVGAState *s) } } } - if (dst_bits >=3D s->vga.vram_ptr + s->vga.vbe_start_addr && - dst_bits < s->vga.vram_ptr + s->vga.vbe_start_addr + - s->vga.vbe_regs[VBE_DISPI_INDEX_YRES] * s->vga.vbe_line_offset= ) { - memory_region_set_dirty(&s->vga.vram, s->vga.vbe_start_addr + - s->regs.dst_offset + - dst_y * surface_stride(ds), - s->regs.dst_height * surface_stride(ds= )); - } break; } default: qemu_log_mask(LOG_UNIMP, "Unimplemented ati_2d blt op %x\n", (s->regs.dp_mix & GMC_ROP3_MASK) >> 16); + return; } + + ati_set_dirty(s, dst_bits, dst_y); } --=20 2.52.0 From nobody Sat Feb 7 04:55:06 2026 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=none dis=none) header.from=jablonski.xyz ARC-Seal: i=1; a=rsa-sha256; t=1770223736; cv=none; d=zohomail.com; s=zohoarc; b=mhpdt1jSqp0d7pKI3NjfJ/IXzP7rlfljk9sl0kjKf30JiQvJ9ZYkCmkS1Wk8UysOINIpgwJM8Ua+U/anjIvmwYkvb9znvHAU9Tt5w7OUFDLEYak5xPbh3GiDVml/Nju8eAQvQfv9aXcLwF5/FcXU/RATmR6MCygnKiznMDWD57g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770223736; h=Content-Transfer-Encoding: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=pFvDrCs4rTE8Xavb9xtgI9c9ynRu6wIk7meG5xVIP8U=; b=PRpszmi2W9oxk1AuaKOPgy/HcrLzFA4vwHppXlTMeM+KRM/mNdrCV7Cr0CucyVIYQByJtwvv+mxDtAQnetgqpjj7ijBeblzcNDOILYRVVQ/G6dxVmVuIywqSmmzuEqsgSNrp67vWLN+qJLnyBB6iS9rSWNZsbm7hfEiTROhHJKo= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770223736788598.4798410022462; Wed, 4 Feb 2026 08:48:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vng1L-000741-BL; Wed, 04 Feb 2026 11:46:27 -0500 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 ) id 1vng1B-000714-5J for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:18 -0500 Received: from fhigh-b5-smtp.messagingengine.com ([202.12.124.156]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vng17-0004X3-VU for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:16 -0500 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfhigh.stl.internal (Postfix) with ESMTP id 3D1DA7A0124; Wed, 4 Feb 2026 11:46:13 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Wed, 04 Feb 2026 11:46:13 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 11:46:12 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id b309b06d; Wed, 4 Feb 2026 16:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jablonski.xyz; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1770223573; x= 1770309973; bh=pFvDrCs4rTE8Xavb9xtgI9c9ynRu6wIk7meG5xVIP8U=; b=q yNSmYePmi0trCWiEEe5+p4BmtviGTZQ+iu1FIgvdP2BQmFPsIp1p+Twwxm3HS8IW EniHVGtePa0JpbKokWCipSC+e3APHBPy/7YTIGfbKIs6iaGmCBznsXq4uo/a0+Gi OFVub9F77Q+ag3Di/GXEAGkPfK9fpcUNYM4l6uqV0rJIcrmZZ3Rw3jDQkdtPNVkq oxDE+mZ7YLL3pI9v2QYXGn/mlHan55fAOL5JHl3moDm4qepFESzJTRD1HGvTFUMA GvZLmKcWDawKAhpaHTfnVFnzZypEcDsJiJMLpvaH8CB4G8GKvKVlqLCnV/fhUT5h QGfLS8et/G5lWTi2o3ilg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1770223573; x=1770309973; bh=p FvDrCs4rTE8Xavb9xtgI9c9ynRu6wIk7meG5xVIP8U=; b=SjgUXo4SDYcbJ/8Hm 56p/oCOJjkvNkny53DpWi6KKl4OqAvvBm2Wfn8oBXjQDDnDGPQknWUSKh2iT7LkU KL0EufP28KtsMySn9i9q6E/HLI1G1F8eIyU2muC3jd/lnfWDDU001wt+Ry0qBsTe zFn9rP9avPcqzkkPO6zWwMS8LDtCPk+hV1Yy3lzW2/TVdy1AzfpuJI/F8lGDzFjS IY1DzTgG3ZhbNg5Uws81HCgIZtcplZDLnWmLKFgrjMOGKtnw3+reni15dHYQY+ZO +ZhvyU6aMPXG+adCn74n8ea5DwVzbrO/qCI4OW3qJPnDdBnTeaWFpMMFlD1q3y+I gmXcg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedvleehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg gslhhonhhskhhirdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpth htoheptghhrggusehjrggslhhonhhskhhirdighiiipdhrtghpthhtohepsggrlhgrthho nhesvghikhdrsghmvgdrhhhu X-ME-Proxy: Feedback-ID: ib26944c1:Fastmail From: Chad Jablonski To: qemu-devel@nongnu.org Cc: balaton@eik.bme.hu, Chad Jablonski Subject: [PATCH v8 09/18] ati-vga: Remove src and dst stride mutation in ati_2d_blt Date: Wed, 4 Feb 2026 11:45:57 -0500 Message-ID: <20260204164606.3425246-10-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260204164606.3425246-1-chad@jablonski.xyz> References: <20260204164606.3425246-1-chad@jablonski.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=202.12.124.156; envelope-from=chad@jablonski.xyz; helo=fhigh-b5-smtp.messagingengine.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @jablonski.xyz) X-ZM-MESSAGEID: 1770223738244158500 Content-Type: text/plain; charset="utf-8" Pixman requires stride in words. So over the course of the ati_2d_blt function both src and dst stride were mutated before being passed to pixman and then back afterwards. This creates local variables holding src and dst stride in words avoiding the potentially confusing mutation. Signed-off-by: Chad Jablonski --- hw/display/ati_2d.c | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c index 980cdd6ac0..e8b9bf5f70 100644 --- a/hw/display/ati_2d.c +++ b/hw/display/ati_2d.c @@ -85,6 +85,7 @@ void ati_2d_blt(ATIVGAState *s) dst_bits +=3D s->regs.crtc_offset & 0x07ffffff; dst_stride *=3D bpp; } + int dst_stride_words =3D dst_stride / sizeof(uint32_t); uint8_t *end =3D s->vga.vram_ptr + s->vga.vram_size; if (dst_x > 0x3fff || dst_y > 0x3fff || dst_bits >=3D end || dst_bits + dst_x @@ -118,6 +119,7 @@ void ati_2d_blt(ATIVGAState *s) src_bits +=3D s->regs.crtc_offset & 0x07ffffff; src_stride *=3D bpp; } + int src_stride_words =3D src_stride / sizeof(uint32_t); if (src_x > 0x3fff || src_y > 0x3fff || src_bits >=3D end || src_bits + src_x + (src_y + s->regs.dst_height) * src_stride >=3D end) { @@ -125,18 +127,16 @@ void ati_2d_blt(ATIVGAState *s) return; } =20 - src_stride /=3D sizeof(uint32_t); - dst_stride /=3D sizeof(uint32_t); DPRINTF("pixman_blt(%p, %p, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d= )\n", - src_bits, dst_bits, src_stride, dst_stride, bpp, bpp, - src_x, src_y, dst_x, dst_y, + src_bits, dst_bits, src_stride_words, dst_stride_words, + bpp, bpp, src_x, src_y, dst_x, dst_y, s->regs.dst_width, s->regs.dst_height); #ifdef CONFIG_PIXMAN if ((s->use_pixman & BIT(1)) && s->regs.dp_cntl & DST_X_LEFT_TO_RIGHT && s->regs.dp_cntl & DST_Y_TOP_TO_BOTTOM) { fallback =3D !pixman_blt((uint32_t *)src_bits, (uint32_t *)dst= _bits, - src_stride, dst_stride, bpp, bpp, + src_stride_words, dst_stride_words, bpp= , bpp, src_x, src_y, dst_x, dst_y, s->regs.dst_width, s->regs.dst_height); } else if (s->use_pixman & BIT(1)) { @@ -146,12 +146,12 @@ void ati_2d_blt(ATIVGAState *s) uint32_t *tmp =3D g_malloc(tmp_stride * sizeof(uint32_t) * s->regs.dst_height); fallback =3D !pixman_blt((uint32_t *)src_bits, tmp, - src_stride, tmp_stride, bpp, bpp, + src_stride_words, tmp_stride, bpp, bpp, src_x, src_y, 0, 0, s->regs.dst_width, s->regs.dst_height); if (!fallback) { fallback =3D !pixman_blt(tmp, (uint32_t *)dst_bits, - tmp_stride, dst_stride, bpp, bpp, + tmp_stride, dst_stride_words, bpp, = bpp, 0, 0, dst_x, dst_y, s->regs.dst_width, s->regs.dst_heig= ht); } @@ -163,18 +163,15 @@ void ati_2d_blt(ATIVGAState *s) } if (fallback) { unsigned int y, i, j, bypp =3D bpp / 8; - unsigned int src_pitch =3D src_stride * sizeof(uint32_t); - unsigned int dst_pitch =3D dst_stride * sizeof(uint32_t); - for (y =3D 0; y < s->regs.dst_height; y++) { i =3D dst_x * bypp; j =3D src_x * bypp; if (s->regs.dp_cntl & DST_Y_TOP_TO_BOTTOM) { - i +=3D (dst_y + y) * dst_pitch; - j +=3D (src_y + y) * src_pitch; + i +=3D (dst_y + y) * dst_stride; + j +=3D (src_y + y) * src_stride; } else { - i +=3D (dst_y + s->regs.dst_height - 1 - y) * dst_pitc= h; - j +=3D (src_y + s->regs.dst_height - 1 - y) * src_pitc= h; + i +=3D (dst_y + s->regs.dst_height - 1 - y) * dst_stri= de; + j +=3D (src_y + s->regs.dst_height - 1 - y) * src_stri= de; } memmove(&dst_bits[i], &src_bits[j], s->regs.dst_width * by= pp); } @@ -201,21 +198,19 @@ void ati_2d_blt(ATIVGAState *s) break; } =20 - dst_stride /=3D sizeof(uint32_t); DPRINTF("pixman_fill(%p, %d, %d, %d, %d, %d, %d, %x)\n", - dst_bits, dst_stride, bpp, dst_x, dst_y, + dst_bits, dst_stride_words, bpp, dst_x, dst_y, s->regs.dst_width, s->regs.dst_height, filler); #ifdef CONFIG_PIXMAN if (!(s->use_pixman & BIT(0)) || - !pixman_fill((uint32_t *)dst_bits, dst_stride, bpp, dst_x, dst= _y, - s->regs.dst_width, s->regs.dst_height, filler)) + !pixman_fill((uint32_t *)dst_bits, dst_stride_words, bpp, dst_= x, + dst_y, s->regs.dst_width, s->regs.dst_height, fil= ler)) #endif { /* fallback when pixman failed or we don't want to call it */ unsigned int x, y, i, bypp =3D bpp / 8; - unsigned int dst_pitch =3D dst_stride * sizeof(uint32_t); for (y =3D 0; y < s->regs.dst_height; y++) { - i =3D dst_x * bypp + (dst_y + y) * dst_pitch; + i =3D dst_x * bypp + (dst_y + y) * dst_stride; for (x =3D 0; x < s->regs.dst_width; x++, i +=3D bypp) { stn_he_p(&dst_bits[i], bypp, filler); } --=20 2.52.0 From nobody Sat Feb 7 04:55:06 2026 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=none dis=none) header.from=jablonski.xyz ARC-Seal: i=1; a=rsa-sha256; t=1770223676; cv=none; d=zohomail.com; s=zohoarc; b=mOY3bUm4LCbtKzuqkzC+Y652RCoAVBrewX3f7iESQBMmYet98pQudbHrobRP7m+Y9uIz3WRUgOyVVuZ53UFnRVHy5M+j8EBMu48EAYyU6ILkTGxCuo0kdT/z2zCdaTI6tMsYJG8W6SAu4zpe7G+LIooEIxOvwFHrG9NkIro9FK8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770223676; h=Content-Transfer-Encoding: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=VdUP9zFdBAQ8o9L25psVF4bIDfcLY4zJ+o4E5zyHfsI=; b=ljMZLNjEnwVzKGRJ2QqBggw3if++83GkehxsFEOYd2pBTsKmmxXnxT3es5mGMXZiN7BP5kvFSpeRkXg9DkZnq52zWoCqCb0UXPoLAju/aKxpmawOfDiPYcR6qWXU77kSgEGIXmwT1nhwAn7F78hG11HQdn4i0CsW7b4HMNFecz8= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770223676286991.0589233140543; Wed, 4 Feb 2026 08:47:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vng1i-0007Nc-Mz; Wed, 04 Feb 2026 11:46:52 -0500 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 ) id 1vng1E-00071r-26 for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:22 -0500 Received: from fout-b7-smtp.messagingengine.com ([202.12.124.150]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vng18-0004XL-Mh for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:18 -0500 Received: from phl-compute-07.internal (phl-compute-07.internal [10.202.2.47]) by mailfout.stl.internal (Postfix) with ESMTP id B6AD91D0016A; Wed, 4 Feb 2026 11:46:13 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-07.internal (MEProxy); Wed, 04 Feb 2026 11:46:13 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 11:46:13 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id 718914d3; Wed, 4 Feb 2026 16:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jablonski.xyz; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1770223573; x= 1770309973; bh=VdUP9zFdBAQ8o9L25psVF4bIDfcLY4zJ+o4E5zyHfsI=; b=k NeOaXRj3L4xVAeLR+Ckudqch1IqeemKL1XnBe84XjI5/zPRYTtapW6lSPzd+pX1j AxWmPjMekqBlL+Kiohsk4r1EblxaKsKoMFiwLtvDRabbQFVYuPhlgjD3G0GW9haz n6qnC4p1IoSMjXSPuM24pIsNjgTwPS5hMRF11enfDfzplZ22Tvcs3Y9uvE1MF5UI fcXmV8gWe88w6seDLrTbtPtV9E4ZIEpGbgViTLa+ZMK9MlIf+0VjUKD3Yh+bHAwn xWoY8L7tJZs8WXzk3I+DY9u969GgaIHz9xzb5mx6fsvkdRiZtVp/3iLTjUPNaQmT GZgGzb+0dfxVN4OuzJpZQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1770223573; x=1770309973; bh=V dUP9zFdBAQ8o9L25psVF4bIDfcLY4zJ+o4E5zyHfsI=; b=W0DFBAFl53ZN/UPz2 jupO8oCfT09isQVn+Qh6BA5/9cbeDVy7fniRZ3oMo+2l9WicWCAf1qflBxyV9yAr 3Dz0HwlnifbiCuBgXxyb43f2yPabDvnX2FYtcnd7UoBT5sMIMsxf5AFN9Xe860ju +GtFhVrUlF+CzF5AoFm9RBGztRX8OyPp5UZmliovdPMABMzNeroI2eH3GbKaN4KK gI+fs/rLKS2mo9XhbDt28xr6RuGfrl76hwQ8g/xSUvUT0Z6yKxPBS+u/ZxV2dLlS 679l1rPNil9bRgVJRta0AiZuofM+icdHHrCX4Y/jvb/yRRHnokqwqChNMSfPjbiI Jt8aQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedvleeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg gslhhonhhskhhirdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopegsrghlrghtohhnsegvihhkrdgsmhgvrdhhuhdprhgtphhtthhope gthhgrugesjhgrsghlohhnshhkihdrgiihiidprhgtphhtthhopehqvghmuhdquggvvhgv lhesnhhonhhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: ib26944c1:Fastmail From: Chad Jablonski To: qemu-devel@nongnu.org Cc: balaton@eik.bme.hu, Chad Jablonski Subject: [PATCH v8 10/18] ati-vga: Use local variables for register values in ati_2d_blt Date: Wed, 4 Feb 2026 11:45:58 -0500 Message-ID: <20260204164606.3425246-11-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260204164606.3425246-1-chad@jablonski.xyz> References: <20260204164606.3425246-1-chad@jablonski.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=202.12.124.150; envelope-from=chad@jablonski.xyz; helo=fout-b7-smtp.messagingengine.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @jablonski.xyz) X-ZM-MESSAGEID: 1770223677997158500 Content-Type: text/plain; charset="utf-8" ati_2d_blt uses a mixture of locals and direct register access of needed state. This assigns all values derived from register state to local variables. It prepares the function for a larger refactor that removes the dependency on the full device and direct register access entirely. Signed-off-by: Chad Jablonski --- hw/display/ati_2d.c | 97 ++++++++++++++++++++++++--------------------- 1 file changed, 52 insertions(+), 45 deletions(-) diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c index e8b9bf5f70..618aedc3da 100644 --- a/hw/display/ati_2d.c +++ b/hw/display/ati_2d.c @@ -65,10 +65,20 @@ void ati_2d_blt(ATIVGAState *s) { /* FIXME it is probably more complex than this and may need to be */ /* rewritten but for now as a start just to get some output: */ - unsigned dst_x =3D (s->regs.dp_cntl & DST_X_LEFT_TO_RIGHT ? - s->regs.dst_x : s->regs.dst_x + 1 - s->regs.dst_widt= h); - unsigned dst_y =3D (s->regs.dp_cntl & DST_Y_TOP_TO_BOTTOM ? - s->regs.dst_y : s->regs.dst_y + 1 - s->regs.dst_heig= ht); + bool use_pixman_fill =3D s->use_pixman & BIT(0); + bool use_pixman_blt =3D s->use_pixman & BIT(1); + int rop3 =3D s->regs.dp_mix & GMC_ROP3_MASK; + bool left_to_right =3D s->regs.dp_cntl & DST_X_LEFT_TO_RIGHT; + bool top_to_bottom =3D s->regs.dp_cntl & DST_Y_TOP_TO_BOTTOM; + uint32_t frgd_clr =3D s->regs.dp_brush_frgd_clr; + uint8_t *palette =3D s->vga.palette; + unsigned dst_offset =3D s->regs.dst_offset; + unsigned dst_width =3D s->regs.dst_width; + unsigned dst_height =3D s->regs.dst_height; + unsigned dst_x =3D (left_to_right ? + s->regs.dst_x : s->regs.dst_x + 1 - dst_width); + unsigned dst_y =3D (top_to_bottom ? + s->regs.dst_y : s->regs.dst_y + 1 - dst_height); int bpp =3D ati_bpp_from_datatype(s); if (!bpp) { qemu_log_mask(LOG_GUEST_ERROR, "Invalid bpp\n"); @@ -79,7 +89,7 @@ void ati_2d_blt(ATIVGAState *s) qemu_log_mask(LOG_GUEST_ERROR, "Zero dest pitch\n"); return; } - uint8_t *dst_bits =3D s->vga.vram_ptr + s->regs.dst_offset; + uint8_t *dst_bits =3D s->vga.vram_ptr + dst_offset; =20 if (s->dev_id =3D=3D PCI_DEVICE_ID_ATI_RAGE128_PF) { dst_bits +=3D s->regs.crtc_offset & 0x07ffffff; @@ -88,26 +98,25 @@ void ati_2d_blt(ATIVGAState *s) int dst_stride_words =3D dst_stride / sizeof(uint32_t); uint8_t *end =3D s->vga.vram_ptr + s->vga.vram_size; if (dst_x > 0x3fff || dst_y > 0x3fff || dst_bits >=3D end - || dst_bits + dst_x - + (dst_y + s->regs.dst_height) * dst_stride >=3D end) { + || dst_bits + dst_x + (dst_y + dst_height) * dst_stride >=3D end) { qemu_log_mask(LOG_UNIMP, "blt outside vram not implemented\n"); return; } DPRINTF("%d %d %d, %d %d %d, (%d,%d) -> (%d,%d) %dx%d %c %c\n", - s->regs.src_offset, s->regs.dst_offset, s->regs.default_offset, - s->regs.src_pitch, s->regs.dst_pitch, s->regs.default_pitch, + s->regs.src_offset, dst_offset, s->regs.default_offset, + s->regs.src_pitch, dst_stride, s->regs.default_pitch, s->regs.src_x, s->regs.src_y, dst_x, dst_y, - s->regs.dst_width, s->regs.dst_height, - (s->regs.dp_cntl & DST_X_LEFT_TO_RIGHT ? '>' : '<'), - (s->regs.dp_cntl & DST_Y_TOP_TO_BOTTOM ? 'v' : '^')); - switch (s->regs.dp_mix & GMC_ROP3_MASK) { + dst_width, dst_height, + (left_to_right ? '>' : '<'), + (top_to_bottom ? 'v' : '^')); + switch (rop3) { case ROP3_SRCCOPY: { bool fallback =3D false; - unsigned src_x =3D (s->regs.dp_cntl & DST_X_LEFT_TO_RIGHT ? - s->regs.src_x : s->regs.src_x + 1 - s->regs.dst_wid= th); - unsigned src_y =3D (s->regs.dp_cntl & DST_Y_TOP_TO_BOTTOM ? - s->regs.src_y : s->regs.src_y + 1 - s->regs.dst_hei= ght); + unsigned src_x =3D (left_to_right ? + s->regs.src_x : s->regs.src_x + 1 - dst_width); + unsigned src_y =3D (top_to_bottom ? + s->regs.src_y : s->regs.src_y + 1 - dst_height); int src_stride =3D s->regs.src_pitch; if (!src_stride) { qemu_log_mask(LOG_GUEST_ERROR, "Zero source pitch\n"); @@ -122,7 +131,7 @@ void ati_2d_blt(ATIVGAState *s) int src_stride_words =3D src_stride / sizeof(uint32_t); if (src_x > 0x3fff || src_y > 0x3fff || src_bits >=3D end || src_bits + src_x - + (src_y + s->regs.dst_height) * src_stride >=3D end) { + + (src_y + dst_height) * src_stride >=3D end) { qemu_log_mask(LOG_UNIMP, "blt outside vram not implemented\n"); return; } @@ -130,30 +139,28 @@ void ati_2d_blt(ATIVGAState *s) DPRINTF("pixman_blt(%p, %p, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d= )\n", src_bits, dst_bits, src_stride_words, dst_stride_words, bpp, bpp, src_x, src_y, dst_x, dst_y, - s->regs.dst_width, s->regs.dst_height); + dst_width, dst_height); #ifdef CONFIG_PIXMAN - if ((s->use_pixman & BIT(1)) && - s->regs.dp_cntl & DST_X_LEFT_TO_RIGHT && - s->regs.dp_cntl & DST_Y_TOP_TO_BOTTOM) { + if (use_pixman_blt && left_to_right && top_to_bottom) { fallback =3D !pixman_blt((uint32_t *)src_bits, (uint32_t *)dst= _bits, src_stride_words, dst_stride_words, bpp= , bpp, src_x, src_y, dst_x, dst_y, - s->regs.dst_width, s->regs.dst_height); - } else if (s->use_pixman & BIT(1)) { + dst_width, dst_height); + } else if (use_pixman_blt) { /* FIXME: We only really need a temporary if src and dst overl= ap */ - int llb =3D s->regs.dst_width * (bpp / 8); + int llb =3D dst_width * (bpp / 8); int tmp_stride =3D DIV_ROUND_UP(llb, sizeof(uint32_t)); uint32_t *tmp =3D g_malloc(tmp_stride * sizeof(uint32_t) * - s->regs.dst_height); + dst_height); fallback =3D !pixman_blt((uint32_t *)src_bits, tmp, src_stride_words, tmp_stride, bpp, bpp, src_x, src_y, 0, 0, - s->regs.dst_width, s->regs.dst_height); + dst_width, dst_height); if (!fallback) { fallback =3D !pixman_blt(tmp, (uint32_t *)dst_bits, tmp_stride, dst_stride_words, bpp, = bpp, 0, 0, dst_x, dst_y, - s->regs.dst_width, s->regs.dst_heig= ht); + dst_width, dst_height); } g_free(tmp); } else @@ -163,17 +170,17 @@ void ati_2d_blt(ATIVGAState *s) } if (fallback) { unsigned int y, i, j, bypp =3D bpp / 8; - for (y =3D 0; y < s->regs.dst_height; y++) { + for (y =3D 0; y < dst_height; y++) { i =3D dst_x * bypp; j =3D src_x * bypp; - if (s->regs.dp_cntl & DST_Y_TOP_TO_BOTTOM) { + if (top_to_bottom) { i +=3D (dst_y + y) * dst_stride; j +=3D (src_y + y) * src_stride; } else { - i +=3D (dst_y + s->regs.dst_height - 1 - y) * dst_stri= de; - j +=3D (src_y + s->regs.dst_height - 1 - y) * src_stri= de; + i +=3D (dst_y + dst_height - 1 - y) * dst_stride; + j +=3D (src_y + dst_height - 1 - y) * src_stride; } - memmove(&dst_bits[i], &src_bits[j], s->regs.dst_width * by= pp); + memmove(&dst_bits[i], &src_bits[j], dst_width * bypp); } } break; @@ -184,34 +191,34 @@ void ati_2d_blt(ATIVGAState *s) { uint32_t filler =3D 0; =20 - switch (s->regs.dp_mix & GMC_ROP3_MASK) { + switch (rop3) { case ROP3_PATCOPY: - filler =3D s->regs.dp_brush_frgd_clr; + filler =3D frgd_clr; break; case ROP3_BLACKNESS: - filler =3D 0xffUL << 24 | rgb_to_pixel32(s->vga.palette[0], - s->vga.palette[1], s->vga.palette[2]); + filler =3D 0xffUL << 24 | rgb_to_pixel32(palette[0], palette[1= ], + palette[2]); break; case ROP3_WHITENESS: - filler =3D 0xffUL << 24 | rgb_to_pixel32(s->vga.palette[3], - s->vga.palette[4], s->vga.palette[5]); + filler =3D 0xffUL << 24 | rgb_to_pixel32(palette[3], palette[4= ], + palette[5]); break; } =20 DPRINTF("pixman_fill(%p, %d, %d, %d, %d, %d, %d, %x)\n", dst_bits, dst_stride_words, bpp, dst_x, dst_y, - s->regs.dst_width, s->regs.dst_height, filler); + dst_width, dst_height, filler); #ifdef CONFIG_PIXMAN - if (!(s->use_pixman & BIT(0)) || + if (!use_pixman_fill || !pixman_fill((uint32_t *)dst_bits, dst_stride_words, bpp, dst_= x, - dst_y, s->regs.dst_width, s->regs.dst_height, fil= ler)) + dst_y, dst_width, dst_height, filler)) #endif { /* fallback when pixman failed or we don't want to call it */ unsigned int x, y, i, bypp =3D bpp / 8; - for (y =3D 0; y < s->regs.dst_height; y++) { + for (y =3D 0; y < dst_height; y++) { i =3D dst_x * bypp + (dst_y + y) * dst_stride; - for (x =3D 0; x < s->regs.dst_width; x++, i +=3D bypp) { + for (x =3D 0; x < dst_width; x++, i +=3D bypp) { stn_he_p(&dst_bits[i], bypp, filler); } } @@ -220,7 +227,7 @@ void ati_2d_blt(ATIVGAState *s) } default: qemu_log_mask(LOG_UNIMP, "Unimplemented ati_2d blt op %x\n", - (s->regs.dp_mix & GMC_ROP3_MASK) >> 16); + rop3 >> 16); return; } =20 --=20 2.52.0 From nobody Sat Feb 7 04:55:06 2026 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=none dis=none) header.from=jablonski.xyz ARC-Seal: i=1; a=rsa-sha256; t=1770223682; cv=none; d=zohomail.com; s=zohoarc; b=DgGo7kIhXQwxgHZxnwMm70S2xzs+P2aX3qKtCuTEdDlLNmC6TTixMz54U5BLdgzP7QSByyxgVZsy7nJtlbhwC8G11mR5/n0CKir9c3eYLkhtC+HmTN35iguY0fI+xdW352rEfwLzeFEvRpOrP9Vt0mN7mPXljrdxu3DYLi3wkhw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770223682; h=Content-Transfer-Encoding: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=y5Txo/ge3wt7aVEEtskxAjDd4xcVvCJ4m6h2lSWpD1Q=; b=RMPtpHY9e/x7roZOvNdLmuS9rGyqDGQ7fLuhsN7yPSP5jqwZJDCF948EfkNGSsMMVQsBFH+10oM8WHNAkLJkb0yVzo+rsKFeMirZGZTqyAj80hLrJdGUTzfR4NlnLRo8fTXmKDvy5Js/6HdyD9pbbyLSBydmmJNFEYXPXgK3i44= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770223682036168.13609197107598; Wed, 4 Feb 2026 08:48:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vng1Y-0007Fb-DF; Wed, 04 Feb 2026 11:46:40 -0500 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 ) id 1vng1E-00071q-0s for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:22 -0500 Received: from fout-b7-smtp.messagingengine.com ([202.12.124.150]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vng18-0004XW-Ss for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:19 -0500 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id EEF4F1D0016F; Wed, 4 Feb 2026 11:46:13 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Wed, 04 Feb 2026 11:46:14 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 11:46:13 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id aabaaa6e; Wed, 4 Feb 2026 16:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jablonski.xyz; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1770223573; x= 1770309973; bh=y5Txo/ge3wt7aVEEtskxAjDd4xcVvCJ4m6h2lSWpD1Q=; b=L pUmm6RBI47uX/2iV7XMLad7jUZa49EDU68m4sd34J38e8bAg9Sx6YTn8iSxiDTV3 7noZoYywLAiKMeLL1hAoQlBBkdyATe4Y1dmQIAxQmnb6Lce3CtCyuTLMiLEt8oRP rBINq3F2ZojAg2rMs8HnrAwH/YKWbfyYbG4CEbyK1egP8VkZ2MsjapTPbHmFK5jE ztK0seSlLQqb9uX0nvgva4fkZ1QTKSLyvwKFKkgdxnIj9GOXnPENu8QS5e2VzKvK yziGDnBlpnWDIQrx8pl00nNGLEqJ7fManh1HfrIc2JWs2DT7ZjN4w/KfjC62/x9a J0wPraYFtXsZkM1P4MUpw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1770223573; x=1770309973; bh=y 5Txo/ge3wt7aVEEtskxAjDd4xcVvCJ4m6h2lSWpD1Q=; b=Z4gtT/nrcsixZmC5z mYcaaa2iT9Nu7xzX+n1eMOVedbmD3q36CgPjEv3vCRjbP2hLbDnMpausDCC/JkB9 49DPJLyVSUQ/kf4AO775YmIN3xXjDRrP9LhENthQuQIWLrykgYhzIkijtNZW+/gC 7L8U4mOiA+HBi7Hu/0ZO2/4ehvesquGJRK/2DhxtSqHchQ/4oV1YxODcwxgRh9/n OLWkGyGIrvbuSYpb+uwJ4QM6QMf05eqY9FbiojtmQDXFbuJMRP4rkkoWhGWxKE3R MBp0XZStSew8CZDWcAkySmJLQI2wHNoy0TkLncWWhpIcvcRfhdA2pdiL4qGhWbdA 5cgQA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedvleeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg gslhhonhhskhhirdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpth htoheptghhrggusehjrggslhhonhhskhhirdighiiipdhrtghpthhtohepsggrlhgrthho nhesvghikhdrsghmvgdrhhhu X-ME-Proxy: Feedback-ID: ib26944c1:Fastmail From: Chad Jablonski To: qemu-devel@nongnu.org Cc: balaton@eik.bme.hu, Chad Jablonski Subject: [PATCH v8 11/18] ati-vga: Introduce ATI2DCtx struct for 2D blit context Date: Wed, 4 Feb 2026 11:45:59 -0500 Message-ID: <20260204164606.3425246-12-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260204164606.3425246-1-chad@jablonski.xyz> References: <20260204164606.3425246-1-chad@jablonski.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=202.12.124.150; envelope-from=chad@jablonski.xyz; helo=fout-b7-smtp.messagingengine.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @jablonski.xyz) X-ZM-MESSAGEID: 1770223684059158500 Content-Type: text/plain; charset="utf-8" Previously all state derived from registers was moved to locals. Now we can mechanically replace those locals with fields on the new ATI2DCtx struct. Signed-off-by: Chad Jablonski --- hw/display/ati_2d.c | 222 +++++++++++++++++++++++++------------------- 1 file changed, 126 insertions(+), 96 deletions(-) diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c index 618aedc3da..4154202677 100644 --- a/hw/display/ati_2d.c +++ b/hw/display/ati_2d.c @@ -13,6 +13,7 @@ #include "qemu/log.h" #include "ui/pixel_ops.h" #include "ui/console.h" +#include "ui/rect.h" =20 /* * NOTE: @@ -43,21 +44,39 @@ static int ati_bpp_from_datatype(ATIVGAState *s) } } =20 -static void ati_set_dirty(ATIVGAState *s, - const uint8_t *dst_bits, unsigned dst_y) +typedef struct { + int bpp; + uint32_t rop3; + bool left_to_right; + bool top_to_bottom; + uint32_t frgd_clr; + const uint8_t *palette; + const uint8_t *vram_end; + + QemuRect dst; + int dst_stride; + uint8_t *dst_bits; + uint32_t dst_offset; + + QemuRect src; + int src_stride; + const uint8_t *src_bits; +} ATI2DCtx; + +static void ati_set_dirty(VGACommonState *vga, const ATI2DCtx *ctx) { - VGACommonState *vga =3D &s->vga; DisplaySurface *ds =3D qemu_console_surface(vga->con); =20 DPRINTF("%p %u ds: %p %d %d rop: %x\n", vga->vram_ptr, vga->vbe_start_= addr, surface_data(ds), surface_stride(ds), surface_bits_per_pixel(d= s), - (s->regs.dp_mix & GMC_ROP3_MASK) >> 16); - if (dst_bits >=3D vga->vram_ptr + vga->vbe_start_addr && - dst_bits < vga->vram_ptr + vga->vbe_start_addr + + ctx->rop3 >> 16); + if (ctx->dst_bits >=3D vga->vram_ptr + vga->vbe_start_addr && + ctx->dst_bits < vga->vram_ptr + vga->vbe_start_addr + vga->vbe_regs[VBE_DISPI_INDEX_YRES] * vga->vbe_line_offset) { memory_region_set_dirty(&vga->vram, vga->vbe_start_addr + - s->regs.dst_offset + dst_y * surface_strid= e(ds), - s->regs.dst_height * surface_stride(ds)); + ctx->dst_offset + ctx->dst.y + * surface_stride(ds), + ctx->dst.height * surface_stride(ds)); } } =20 @@ -67,100 +86,105 @@ void ati_2d_blt(ATIVGAState *s) /* rewritten but for now as a start just to get some output: */ bool use_pixman_fill =3D s->use_pixman & BIT(0); bool use_pixman_blt =3D s->use_pixman & BIT(1); - int rop3 =3D s->regs.dp_mix & GMC_ROP3_MASK; - bool left_to_right =3D s->regs.dp_cntl & DST_X_LEFT_TO_RIGHT; - bool top_to_bottom =3D s->regs.dp_cntl & DST_Y_TOP_TO_BOTTOM; - uint32_t frgd_clr =3D s->regs.dp_brush_frgd_clr; - uint8_t *palette =3D s->vga.palette; - unsigned dst_offset =3D s->regs.dst_offset; - unsigned dst_width =3D s->regs.dst_width; - unsigned dst_height =3D s->regs.dst_height; - unsigned dst_x =3D (left_to_right ? - s->regs.dst_x : s->regs.dst_x + 1 - dst_width); - unsigned dst_y =3D (top_to_bottom ? - s->regs.dst_y : s->regs.dst_y + 1 - dst_height); - int bpp =3D ati_bpp_from_datatype(s); - if (!bpp) { + ATI2DCtx ctx_; + ATI2DCtx *ctx =3D &ctx_; + ctx->rop3 =3D s->regs.dp_mix & GMC_ROP3_MASK; + ctx->left_to_right =3D s->regs.dp_cntl & DST_X_LEFT_TO_RIGHT; + ctx->top_to_bottom =3D s->regs.dp_cntl & DST_Y_TOP_TO_BOTTOM; + ctx->frgd_clr =3D s->regs.dp_brush_frgd_clr; + ctx->palette =3D s->vga.palette; + ctx->dst_offset =3D s->regs.dst_offset; + ctx->dst.width =3D s->regs.dst_width; + ctx->dst.height =3D s->regs.dst_height; + ctx->dst.x =3D (ctx->left_to_right ? + s->regs.dst_x : s->regs.dst_x + 1 - ctx->dst.width); + ctx->dst.y =3D (ctx->top_to_bottom ? + s->regs.dst_y : s->regs.dst_y + 1 - ctx->dst.height); + ctx->bpp =3D ati_bpp_from_datatype(s); + if (!ctx->bpp) { qemu_log_mask(LOG_GUEST_ERROR, "Invalid bpp\n"); return; } - int dst_stride =3D s->regs.dst_pitch; - if (!dst_stride) { + ctx->dst_stride =3D s->regs.dst_pitch; + if (!ctx->dst_stride) { qemu_log_mask(LOG_GUEST_ERROR, "Zero dest pitch\n"); return; } - uint8_t *dst_bits =3D s->vga.vram_ptr + dst_offset; + ctx->dst_bits =3D s->vga.vram_ptr + ctx->dst_offset; =20 if (s->dev_id =3D=3D PCI_DEVICE_ID_ATI_RAGE128_PF) { - dst_bits +=3D s->regs.crtc_offset & 0x07ffffff; - dst_stride *=3D bpp; + ctx->dst_bits +=3D s->regs.crtc_offset & 0x07ffffff; + ctx->dst_stride *=3D ctx->bpp; } - int dst_stride_words =3D dst_stride / sizeof(uint32_t); - uint8_t *end =3D s->vga.vram_ptr + s->vga.vram_size; - if (dst_x > 0x3fff || dst_y > 0x3fff || dst_bits >=3D end - || dst_bits + dst_x + (dst_y + dst_height) * dst_stride >=3D end) { + int dst_stride_words =3D ctx->dst_stride / sizeof(uint32_t); + ctx->vram_end =3D s->vga.vram_ptr + s->vga.vram_size; + if (ctx->dst.x > 0x3fff || ctx->dst.y > 0x3fff + || ctx->dst_bits >=3D ctx->vram_end || ctx->dst_bits + ctx->dst.x + + (ctx->dst.y + ctx->dst.height) * ctx->dst_stride >=3D ctx->vram= _end) { qemu_log_mask(LOG_UNIMP, "blt outside vram not implemented\n"); return; } DPRINTF("%d %d %d, %d %d %d, (%d,%d) -> (%d,%d) %dx%d %c %c\n", - s->regs.src_offset, dst_offset, s->regs.default_offset, - s->regs.src_pitch, dst_stride, s->regs.default_pitch, - s->regs.src_x, s->regs.src_y, dst_x, dst_y, - dst_width, dst_height, - (left_to_right ? '>' : '<'), - (top_to_bottom ? 'v' : '^')); - switch (rop3) { + s->regs.src_offset, ctx->dst_offset, s->regs.default_offset, + ctx->src_stride, ctx->dst_stride, s->regs.default_pitch, + ctx->src.x, ctx->src.y, ctx->dst.x, ctx->dst.y, + ctx->dst.width, ctx->dst.height, + (ctx->left_to_right ? '>' : '<'), + (ctx->top_to_bottom ? 'v' : '^')); + switch (ctx->rop3) { case ROP3_SRCCOPY: { bool fallback =3D false; - unsigned src_x =3D (left_to_right ? - s->regs.src_x : s->regs.src_x + 1 - dst_width); - unsigned src_y =3D (top_to_bottom ? - s->regs.src_y : s->regs.src_y + 1 - dst_height); - int src_stride =3D s->regs.src_pitch; - if (!src_stride) { + ctx->src.x =3D (ctx->left_to_right ? + s->regs.src_x : s->regs.src_x + 1 - ctx->dst.width); + ctx->src.y =3D (ctx->top_to_bottom ? + s->regs.src_y : s->regs.src_y + 1 - ctx->dst.height); + ctx->src_stride =3D s->regs.src_pitch; + if (!ctx->src_stride) { qemu_log_mask(LOG_GUEST_ERROR, "Zero source pitch\n"); return; } - uint8_t *src_bits =3D s->vga.vram_ptr + s->regs.src_offset; + ctx->src_bits =3D s->vga.vram_ptr + s->regs.src_offset; =20 if (s->dev_id =3D=3D PCI_DEVICE_ID_ATI_RAGE128_PF) { - src_bits +=3D s->regs.crtc_offset & 0x07ffffff; - src_stride *=3D bpp; + ctx->src_bits +=3D s->regs.crtc_offset & 0x07ffffff; + ctx->src_stride *=3D ctx->bpp; } - int src_stride_words =3D src_stride / sizeof(uint32_t); - if (src_x > 0x3fff || src_y > 0x3fff || src_bits >=3D end - || src_bits + src_x - + (src_y + dst_height) * src_stride >=3D end) { + int src_stride_words =3D ctx->src_stride / sizeof(uint32_t); + if (ctx->src.x > 0x3fff || ctx->src.y > 0x3fff + || ctx->src_bits >=3D ctx->vram_end + || ctx->src_bits + ctx->src.x + (ctx->src.y + ctx->dst.height) + * ctx->src_stride >=3D ctx->vram_end) { qemu_log_mask(LOG_UNIMP, "blt outside vram not implemented\n"); return; } =20 DPRINTF("pixman_blt(%p, %p, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d= )\n", - src_bits, dst_bits, src_stride_words, dst_stride_words, - bpp, bpp, src_x, src_y, dst_x, dst_y, - dst_width, dst_height); + ctx->src_bits, ctx->dst_bits, src_stride_words, + dst_stride_words, ctx->bpp, ctx->bpp, ctx->src.x, ctx->src= .y, + ctx->dst.x, ctx->dst.y, ctx->dst.width, ctx->dst.height); #ifdef CONFIG_PIXMAN - if (use_pixman_blt && left_to_right && top_to_bottom) { - fallback =3D !pixman_blt((uint32_t *)src_bits, (uint32_t *)dst= _bits, - src_stride_words, dst_stride_words, bpp= , bpp, - src_x, src_y, dst_x, dst_y, - dst_width, dst_height); + if (use_pixman_blt && ctx->left_to_right && ctx->top_to_bottom) { + fallback =3D !pixman_blt((uint32_t *)ctx->src_bits, + (uint32_t *)ctx->dst_bits, src_stride_w= ords, + dst_stride_words, ctx->bpp, ctx->bpp, + ctx->src.x, ctx->src.y, ctx->dst.x, + ctx->dst.y, ctx->dst.width, ctx->dst.he= ight); } else if (use_pixman_blt) { /* FIXME: We only really need a temporary if src and dst overl= ap */ - int llb =3D dst_width * (bpp / 8); + int llb =3D ctx->dst.width * (ctx->bpp / 8); int tmp_stride =3D DIV_ROUND_UP(llb, sizeof(uint32_t)); uint32_t *tmp =3D g_malloc(tmp_stride * sizeof(uint32_t) * - dst_height); - fallback =3D !pixman_blt((uint32_t *)src_bits, tmp, - src_stride_words, tmp_stride, bpp, bpp, - src_x, src_y, 0, 0, - dst_width, dst_height); + ctx->dst.height); + fallback =3D !pixman_blt((uint32_t *)ctx->src_bits, tmp, + src_stride_words, tmp_stride, ctx->bpp, + ctx->bpp, ctx->src.x, ctx->src.y, 0, 0, + ctx->dst.width, ctx->dst.height); if (!fallback) { - fallback =3D !pixman_blt(tmp, (uint32_t *)dst_bits, - tmp_stride, dst_stride_words, bpp, = bpp, - 0, 0, dst_x, dst_y, - dst_width, dst_height); + fallback =3D !pixman_blt(tmp, (uint32_t *)ctx->dst_bits, + tmp_stride, dst_stride_words, ctx->= bpp, + ctx->bpp, 0, 0, ctx->dst.x, ctx->ds= t.y, + ctx->dst.width, ctx->dst.height); } g_free(tmp); } else @@ -169,18 +193,21 @@ void ati_2d_blt(ATIVGAState *s) fallback =3D true; } if (fallback) { - unsigned int y, i, j, bypp =3D bpp / 8; - for (y =3D 0; y < dst_height; y++) { - i =3D dst_x * bypp; - j =3D src_x * bypp; - if (top_to_bottom) { - i +=3D (dst_y + y) * dst_stride; - j +=3D (src_y + y) * src_stride; + unsigned int y, i, j, bypp =3D ctx->bpp / 8; + for (y =3D 0; y < ctx->dst.height; y++) { + i =3D ctx->dst.x * bypp; + j =3D ctx->src.x * bypp; + if (ctx->top_to_bottom) { + i +=3D (ctx->dst.y + y) * ctx->dst_stride; + j +=3D (ctx->src.y + y) * ctx->src_stride; } else { - i +=3D (dst_y + dst_height - 1 - y) * dst_stride; - j +=3D (src_y + dst_height - 1 - y) * src_stride; + i +=3D (ctx->dst.y + ctx->dst.height - 1 - y) + * ctx->dst_stride; + j +=3D (ctx->src.y + ctx->dst.height - 1 - y) + * ctx->src_stride; } - memmove(&dst_bits[i], &src_bits[j], dst_width * bypp); + memmove(&ctx->dst_bits[i], &ctx->src_bits[j], + ctx->dst.width * bypp); } } break; @@ -191,35 +218,38 @@ void ati_2d_blt(ATIVGAState *s) { uint32_t filler =3D 0; =20 - switch (rop3) { + switch (ctx->rop3) { case ROP3_PATCOPY: - filler =3D frgd_clr; + filler =3D ctx->frgd_clr; break; case ROP3_BLACKNESS: - filler =3D 0xffUL << 24 | rgb_to_pixel32(palette[0], palette[1= ], - palette[2]); + filler =3D 0xffUL << 24 | rgb_to_pixel32(ctx->palette[0], + ctx->palette[1], + ctx->palette[2]); break; case ROP3_WHITENESS: - filler =3D 0xffUL << 24 | rgb_to_pixel32(palette[3], palette[4= ], - palette[5]); + filler =3D 0xffUL << 24 | rgb_to_pixel32(ctx->palette[3], + ctx->palette[4], + ctx->palette[5]); break; } =20 DPRINTF("pixman_fill(%p, %d, %d, %d, %d, %d, %d, %x)\n", - dst_bits, dst_stride_words, bpp, dst_x, dst_y, - dst_width, dst_height, filler); + ctx->dst_bits, dst_stride_words, ctx->bpp, ctx->dst.x, + ctx->dst.y, ctx->dst.width, ctx->dst.height, filler); #ifdef CONFIG_PIXMAN if (!use_pixman_fill || - !pixman_fill((uint32_t *)dst_bits, dst_stride_words, bpp, dst_= x, - dst_y, dst_width, dst_height, filler)) + !pixman_fill((uint32_t *)ctx->dst_bits, dst_stride_words, ctx-= >bpp, + ctx->dst.x, ctx->dst.y, + ctx->dst.width, ctx->dst.height, filler)) #endif { /* fallback when pixman failed or we don't want to call it */ - unsigned int x, y, i, bypp =3D bpp / 8; - for (y =3D 0; y < dst_height; y++) { - i =3D dst_x * bypp + (dst_y + y) * dst_stride; - for (x =3D 0; x < dst_width; x++, i +=3D bypp) { - stn_he_p(&dst_bits[i], bypp, filler); + unsigned int x, y, i, bypp =3D ctx->bpp / 8; + for (y =3D 0; y < ctx->dst.height; y++) { + i =3D ctx->dst.x * bypp + (ctx->dst.y + y) * ctx->dst_stri= de; + for (x =3D 0; x < ctx->dst.width; x++, i +=3D bypp) { + stn_he_p(&ctx->dst_bits[i], bypp, filler); } } } @@ -227,9 +257,9 @@ void ati_2d_blt(ATIVGAState *s) } default: qemu_log_mask(LOG_UNIMP, "Unimplemented ati_2d blt op %x\n", - rop3 >> 16); + ctx->rop3 >> 16); return; } =20 - ati_set_dirty(s, dst_bits, dst_y); + ati_set_dirty(&s->vga, ctx); } --=20 2.52.0 From nobody Sat Feb 7 04:55:06 2026 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=none dis=none) header.from=jablonski.xyz ARC-Seal: i=1; a=rsa-sha256; t=1770223676; cv=none; d=zohomail.com; s=zohoarc; b=a4SWN11D43/n/LfMO4I5W3l+alzloY7f/ByzfGXYSLV7R7uFQAPeUsxdjaIdScCJijoTufY1cFoJ3GKIB8iH2cKHrM/eQJqJDkg7TXh8aWJuZfjpjxCIrwQhPT9TFcQMAv04CxP6q5vhiKEiRJNRwIwjycNcovTa94yyb/PIrmo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770223676; h=Content-Transfer-Encoding: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=8E8EO5MFzU7EGJqwB1/3+1ke6zNnVRVKaQSUNKQX0jQ=; b=cKX4surJPc/u3BFfnTz3inDdYugVaG9hDupN+roGdZOCHS164kzs8GdUL26kT5NyWUdr2Z0Vbnxj21At0ZGO9hCZ2jMShs9WGWHfy6/8kdiAw8FNNB85XPBlR2KD3qpOtQV4ca6en8yWVKnzO/lyONhiTryZkPGgknj9jyXq9fY= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770223676337508.58170439837386; Wed, 4 Feb 2026 08:47:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vng1R-00078e-T9; Wed, 04 Feb 2026 11:46:33 -0500 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 ) id 1vng1D-00071n-VA for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:22 -0500 Received: from fout-b7-smtp.messagingengine.com ([202.12.124.150]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vng19-0004Xd-D4 for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:19 -0500 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id 51B141D0013D; Wed, 4 Feb 2026 11:46:14 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Wed, 04 Feb 2026 11:46:14 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 11:46:13 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id 31db66e4; Wed, 4 Feb 2026 16:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jablonski.xyz; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1770223574; x= 1770309974; bh=8E8EO5MFzU7EGJqwB1/3+1ke6zNnVRVKaQSUNKQX0jQ=; b=K GH7ugJQcwY9J8nIENFJ5iwybn44HY7e3IvFEA9w2Q+RAb42iN3cTPMjRGupbVSDK OmgWxGKir41vouPjpgdEbxvt0crvdqz94HBuVMAEg5aUrXLdzE47RQHltKd6BaKA dOE2lCQ4T9DfY2plaQP/08u+KEAYfaz8TMJEVy0MYDYxvQe5de+6gqHQC96BQxdt 1t+qJxqZGk8QM/e8OMcUVlhYw0E26VrTOdQIc8ZLt2hvj4qz9H1+rp2W/vLuNoeu hw7nFYEgXJ8KGkpfLyhuL14n5XsdciCXWPYHI83W3NCbbVj0cwtC8OQ2lri3Kj6d dOHtqxBi0/AsxapYsqQ3Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1770223574; x=1770309974; bh=8 E8EO5MFzU7EGJqwB1/3+1ke6zNnVRVKaQSUNKQX0jQ=; b=seNyV5rUPdO0CXAsf SZEEamWohTxbGEvXL8zBglDkLGA38klAYIMhbd9vRvobriNx4S3+qb8LDrZez58X 98BjZ8y6ft96Qx9ZDUM3D0UMTMr8niW/zbBUB7nFFKXEP99hnFiW4KrfXNMstnBb 8cY7/i9Xm4d0LMcnyln70nHUxtlcV75lDI/CmK4dmbOIC5coYnch8PldjiMWfKGR +Tk4646NCVz/0f16WN8SOpR2sQg8hI1M/wrwUaMvJH30LxD2vHdlAM1vqb7GS95S fI7nXW6B+Y+Z24hHIfwrWhLiYO2fzSjIoBEPud4C11vKo/0eAtLntueQtx84G1sj SRCYg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedvleeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg gslhhonhhskhhirdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpth htohepsggrlhgrthhonhesvghikhdrsghmvgdrhhhupdhrtghpthhtoheptghhrggusehj rggslhhonhhskhhirdighiii X-ME-Proxy: Feedback-ID: ib26944c1:Fastmail From: Chad Jablonski To: qemu-devel@nongnu.org Cc: balaton@eik.bme.hu, Chad Jablonski Subject: [PATCH v8 12/18] ati-vga: Extract setup_2d_blt_ctx from ati_2d_blt Date: Wed, 4 Feb 2026 11:46:00 -0500 Message-ID: <20260204164606.3425246-13-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260204164606.3425246-1-chad@jablonski.xyz> References: <20260204164606.3425246-1-chad@jablonski.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=202.12.124.150; envelope-from=chad@jablonski.xyz; helo=fout-b7-smtp.messagingengine.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @jablonski.xyz) X-ZM-MESSAGEID: 1770223677940158500 Content-Type: text/plain; charset="utf-8" setup_2d_blt_ctx is responsible for knowing how to retrieve the state needed by ati_2d_blt from the registers and assigning it to the ATI2DCtx. This will be useful in a future patch when HOST_DATA needs to make small modifications to the ctx. Signed-off-by: Chad Jablonski --- hw/display/ati_2d.c | 75 ++++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 35 deletions(-) diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c index 4154202677..cf80296a25 100644 --- a/hw/display/ati_2d.c +++ b/hw/display/ati_2d.c @@ -25,7 +25,7 @@ * possible. */ =20 -static int ati_bpp_from_datatype(ATIVGAState *s) +static int ati_bpp_from_datatype(const ATIVGAState *s) { switch (s->regs.dp_datatype & 0xf) { case 2: @@ -80,76 +80,81 @@ static void ati_set_dirty(VGACommonState *vga, const AT= I2DCtx *ctx) } } =20 -void ati_2d_blt(ATIVGAState *s) +static void setup_2d_blt_ctx(const ATIVGAState *s, ATI2DCtx *ctx) { - /* FIXME it is probably more complex than this and may need to be */ - /* rewritten but for now as a start just to get some output: */ - bool use_pixman_fill =3D s->use_pixman & BIT(0); - bool use_pixman_blt =3D s->use_pixman & BIT(1); - ATI2DCtx ctx_; - ATI2DCtx *ctx =3D &ctx_; + ctx->bpp =3D ati_bpp_from_datatype(s); ctx->rop3 =3D s->regs.dp_mix & GMC_ROP3_MASK; ctx->left_to_right =3D s->regs.dp_cntl & DST_X_LEFT_TO_RIGHT; ctx->top_to_bottom =3D s->regs.dp_cntl & DST_Y_TOP_TO_BOTTOM; ctx->frgd_clr =3D s->regs.dp_brush_frgd_clr; ctx->palette =3D s->vga.palette; ctx->dst_offset =3D s->regs.dst_offset; + ctx->vram_end =3D s->vga.vram_ptr + s->vga.vram_size; + ctx->dst.width =3D s->regs.dst_width; ctx->dst.height =3D s->regs.dst_height; ctx->dst.x =3D (ctx->left_to_right ? s->regs.dst_x : s->regs.dst_x + 1 - ctx->dst.width); ctx->dst.y =3D (ctx->top_to_bottom ? s->regs.dst_y : s->regs.dst_y + 1 - ctx->dst.height); - ctx->bpp =3D ati_bpp_from_datatype(s); + ctx->dst_stride =3D s->regs.dst_pitch; + ctx->dst_bits =3D s->vga.vram_ptr + s->regs.dst_offset; + if (s->dev_id =3D=3D PCI_DEVICE_ID_ATI_RAGE128_PF) { + ctx->dst_bits +=3D s->regs.crtc_offset & 0x07ffffff; + ctx->dst_stride *=3D ctx->bpp; + } + + ctx->src.x =3D (ctx->left_to_right ? + s->regs.src_x : s->regs.src_x + 1 - ctx->dst.width); + ctx->src.y =3D (ctx->top_to_bottom ? + s->regs.src_y : s->regs.src_y + 1 - ctx->dst.height); + ctx->src_stride =3D s->regs.src_pitch; + ctx->src_bits =3D s->vga.vram_ptr + s->regs.src_offset; + if (s->dev_id =3D=3D PCI_DEVICE_ID_ATI_RAGE128_PF) { + ctx->src_bits +=3D s->regs.crtc_offset & 0x07ffffff; + ctx->src_stride *=3D ctx->bpp; + } + DPRINTF("%d %d %d, %d %d %d, (%d,%d) -> (%d,%d) %dx%d %c %c\n", + s->regs.src_offset, s->regs.dst_offset, s->regs.default_offset, + ctx->src_stride, ctx->dst_stride, s->regs.default_pitch, + ctx->src.x, ctx->src.y, ctx->dst.x, ctx->dst.y, + ctx->dst.width, ctx->dst.height, + (ctx->left_to_right ? '>' : '<'), + (ctx->top_to_bottom ? 'v' : '^')); +} + +void ati_2d_blt(ATIVGAState *s) +{ + /* FIXME it is probably more complex than this and may need to be */ + /* rewritten but for now as a start just to get some output: */ + bool use_pixman_fill =3D s->use_pixman & BIT(0); + bool use_pixman_blt =3D s->use_pixman & BIT(1); + ATI2DCtx ctx_; + ATI2DCtx *ctx =3D &ctx_; + setup_2d_blt_ctx(s, ctx); if (!ctx->bpp) { qemu_log_mask(LOG_GUEST_ERROR, "Invalid bpp\n"); return; } - ctx->dst_stride =3D s->regs.dst_pitch; if (!ctx->dst_stride) { qemu_log_mask(LOG_GUEST_ERROR, "Zero dest pitch\n"); return; } - ctx->dst_bits =3D s->vga.vram_ptr + ctx->dst_offset; - - if (s->dev_id =3D=3D PCI_DEVICE_ID_ATI_RAGE128_PF) { - ctx->dst_bits +=3D s->regs.crtc_offset & 0x07ffffff; - ctx->dst_stride *=3D ctx->bpp; - } int dst_stride_words =3D ctx->dst_stride / sizeof(uint32_t); - ctx->vram_end =3D s->vga.vram_ptr + s->vga.vram_size; if (ctx->dst.x > 0x3fff || ctx->dst.y > 0x3fff || ctx->dst_bits >=3D ctx->vram_end || ctx->dst_bits + ctx->dst.x + (ctx->dst.y + ctx->dst.height) * ctx->dst_stride >=3D ctx->vram= _end) { qemu_log_mask(LOG_UNIMP, "blt outside vram not implemented\n"); return; } - DPRINTF("%d %d %d, %d %d %d, (%d,%d) -> (%d,%d) %dx%d %c %c\n", - s->regs.src_offset, ctx->dst_offset, s->regs.default_offset, - ctx->src_stride, ctx->dst_stride, s->regs.default_pitch, - ctx->src.x, ctx->src.y, ctx->dst.x, ctx->dst.y, - ctx->dst.width, ctx->dst.height, - (ctx->left_to_right ? '>' : '<'), - (ctx->top_to_bottom ? 'v' : '^')); switch (ctx->rop3) { case ROP3_SRCCOPY: { bool fallback =3D false; - ctx->src.x =3D (ctx->left_to_right ? - s->regs.src_x : s->regs.src_x + 1 - ctx->dst.width); - ctx->src.y =3D (ctx->top_to_bottom ? - s->regs.src_y : s->regs.src_y + 1 - ctx->dst.height); - ctx->src_stride =3D s->regs.src_pitch; if (!ctx->src_stride) { qemu_log_mask(LOG_GUEST_ERROR, "Zero source pitch\n"); return; } - ctx->src_bits =3D s->vga.vram_ptr + s->regs.src_offset; - - if (s->dev_id =3D=3D PCI_DEVICE_ID_ATI_RAGE128_PF) { - ctx->src_bits +=3D s->regs.crtc_offset & 0x07ffffff; - ctx->src_stride *=3D ctx->bpp; - } int src_stride_words =3D ctx->src_stride / sizeof(uint32_t); if (ctx->src.x > 0x3fff || ctx->src.y > 0x3fff || ctx->src_bits >=3D ctx->vram_end --=20 2.52.0 From nobody Sat Feb 7 04:55:06 2026 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=none dis=none) header.from=jablonski.xyz ARC-Seal: i=1; a=rsa-sha256; t=1770223645; cv=none; d=zohomail.com; s=zohoarc; b=EiPgVOEbfepCOX9mxf5Ob1wPNOF2oPLOia9VbU5D6N0Ofl8EDQLilC9d+ZQPl5oJD/avVZSfPBEL/9bsX5zSoue6XJsarHhlCIhBLgzAyR6iqW2NhSpO+MehPma9BdtMidID1ulEF4wyI7Nd3MIfFs7oGg2llIAUG3UhLBUu6IQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770223645; h=Content-Transfer-Encoding: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=8KLDTX8XBd2F/OTfKN2mr45UqgSUUoPBem6fdHsn5mg=; b=i4O1K3xI4qnVieaX+aI/40BIz9pIYN6tM/el6E4iUQdjN2KjLjDivG6qSBDDCvvLvVjKzr+fysq+GEdxgSHcJgNr11/urjmqFqoadQEVlvjvetC5BQUgk9K0rQAtEOatVhsarzSFMaIERtdYs8lFvXpzGvKUGhyEv51FU2iSp1A= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770223645390211.59614399201735; Wed, 4 Feb 2026 08:47:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vng1S-0007BC-JT; Wed, 04 Feb 2026 11:46:34 -0500 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 ) id 1vng1D-00071m-Uq for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:22 -0500 Received: from fout-b7-smtp.messagingengine.com ([202.12.124.150]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vng1A-0004Y6-1l for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:19 -0500 Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfout.stl.internal (Postfix) with ESMTP id 650CF1D00159; Wed, 4 Feb 2026 11:46:14 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Wed, 04 Feb 2026 11:46:14 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 11:46:13 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id c38fbacc; Wed, 4 Feb 2026 16:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jablonski.xyz; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1770223574; x= 1770309974; bh=8KLDTX8XBd2F/OTfKN2mr45UqgSUUoPBem6fdHsn5mg=; b=D FZ14ItKpbKg81UDnT+dHnKsWWX/rtFrvl0wzJR1T5G1GeV81vHWkGqWiN90FK1A4 f9cDFyFEflfna3P2W4WckJ/mTk3NRCutz816f+XAcLs0oOMY/djrWRjpGy6o8aBr WAr+pNBV69VPTbnk3iXt0WP16q2r6aUh6cd0BKo23YsyAVYyzOI50OjGMJCjqaTj TlIaGFdxHxAF+AapSP10S0HaKxOtP455QjqJobnYEghmzkErtQZfZRtxjz5g0ti0 qSGVOqujvkSQdBkKNbVSORCYqoI4yQSE9a+mytnb3jTrlLLto30ZGtWBiopKdUuK sMeGvZFPlpPjRTZf43/4g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1770223574; x=1770309974; bh=8 KLDTX8XBd2F/OTfKN2mr45UqgSUUoPBem6fdHsn5mg=; b=rD8DNZszl97ZCoLuH OuUOf8vbhE9/XLZsg6Ks37ImfkB116QrBvYMj86yVEl5z7HRl2mUdCH8mvVKkfHZ FCK3Q1hXIuqOsLk9ZDyVvUD9J440lX8VPh27YZn0gSUYfkrIaDUnwln6xV6FEVw8 ZBURHeSGrAOAKnPgFarqz1N7FABombOe9ZJd8+rk10HMFt0sEbK9kv4wDS5dQgWs C3mGu/F4P6ng6t8AcyT0LgjzZW//7JzJ1u1+Nb/DvIownCZHlFyoQMxR8tdULm8P pyAelgirQvcNui/4U+BWvsAi3Z7uFglm3bWNFb3x1Y80zd5u8A02L0EyhZCHtDTF cWIFw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedvleehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg gslhhonhhskhhirdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopegthhgrugesjhgrsghlohhnshhkihdrgiihiidprhgtphhtthhope gsrghlrghtohhnsegvihhkrdgsmhgvrdhhuhdprhgtphhtthhopehqvghmuhdquggvvhgv lhesnhhonhhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: ib26944c1:Fastmail From: Chad Jablonski To: qemu-devel@nongnu.org Cc: balaton@eik.bme.hu, Chad Jablonski Subject: [PATCH v8 13/18] ati-vga: Split ati_2d_do_blt from ati_2d_blt Date: Wed, 4 Feb 2026 11:46:01 -0500 Message-ID: <20260204164606.3425246-14-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260204164606.3425246-1-chad@jablonski.xyz> References: <20260204164606.3425246-1-chad@jablonski.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=202.12.124.150; envelope-from=chad@jablonski.xyz; helo=fout-b7-smtp.messagingengine.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @jablonski.xyz) X-ZM-MESSAGEID: 1770223647230154100 Content-Type: text/plain; charset="utf-8" ati_2d_blt remains the public interface to the blitter but the bulk of the implementation is moved down into ati_2d_do_blt which is passed an ATI2DCtx. Signed-off-by: Chad Jablonski --- hw/display/ati_2d.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c index cf80296a25..063928c442 100644 --- a/hw/display/ati_2d.c +++ b/hw/display/ati_2d.c @@ -123,15 +123,12 @@ static void setup_2d_blt_ctx(const ATIVGAState *s, AT= I2DCtx *ctx) (ctx->top_to_bottom ? 'v' : '^')); } =20 -void ati_2d_blt(ATIVGAState *s) +static void ati_2d_do_blt(ATIVGAState *s, ATI2DCtx *ctx) { /* FIXME it is probably more complex than this and may need to be */ /* rewritten but for now as a start just to get some output: */ bool use_pixman_fill =3D s->use_pixman & BIT(0); bool use_pixman_blt =3D s->use_pixman & BIT(1); - ATI2DCtx ctx_; - ATI2DCtx *ctx =3D &ctx_; - setup_2d_blt_ctx(s, ctx); if (!ctx->bpp) { qemu_log_mask(LOG_GUEST_ERROR, "Invalid bpp\n"); return; @@ -263,8 +260,13 @@ void ati_2d_blt(ATIVGAState *s) default: qemu_log_mask(LOG_UNIMP, "Unimplemented ati_2d blt op %x\n", ctx->rop3 >> 16); - return; } +} =20 - ati_set_dirty(&s->vga, ctx); +void ati_2d_blt(ATIVGAState *s) +{ + ATI2DCtx ctx; + setup_2d_blt_ctx(s, &ctx); + ati_2d_do_blt(s, &ctx); + ati_set_dirty(&s->vga, &ctx); } --=20 2.52.0 From nobody Sat Feb 7 04:55:06 2026 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=none dis=none) header.from=jablonski.xyz ARC-Seal: i=1; a=rsa-sha256; t=1770223615; cv=none; d=zohomail.com; s=zohoarc; b=C3NtFezvpy23Li1teOih2femf+ARdVsnMqTC5UYjVRUS15ny255zzE0YvygDsjkMjleco6FohetPwstq5EJKvhHMOSfRIWUlfF+MKSD3Iv+TwNQPwbV6m8uB8s081Qti5rIzYbkQTRGYc0XxxlJGVFTL/tv5F4RsYKpL5spDL7A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770223615; h=Content-Transfer-Encoding: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=BGK+qrVIcAnLNRs4fCH6awA6ce+4NWjLrrbX14e0/JI=; b=JwWQDxGpvnMdOAJiIAdtlqiNtPoEKsFYkDwzGrLpWbEx7EAHYnl4VM3Y3DnyMI6RsCnWC7XLYbymPpxj+GzLsTrIykshjvY1Efar+6/2B6x7TQRvC5BqLj9V8xLs/dIHe+fkZkobwoDz0i6nB65GnYWcwB0GyIRwEEAbanzUsoQ= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770223615852942.3773164242036; Wed, 4 Feb 2026 08:46:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vng1N-00074D-51; Wed, 04 Feb 2026 11:46:29 -0500 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 ) id 1vng1E-00071p-14 for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:22 -0500 Received: from fhigh-b5-smtp.messagingengine.com ([202.12.124.156]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vng19-0004Xp-DX for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:19 -0500 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.stl.internal (Postfix) with ESMTP id 9CC307A0075; Wed, 4 Feb 2026 11:46:14 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Wed, 04 Feb 2026 11:46:14 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 11:46:14 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id d4629aea; Wed, 4 Feb 2026 16:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jablonski.xyz; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1770223574; x= 1770309974; bh=BGK+qrVIcAnLNRs4fCH6awA6ce+4NWjLrrbX14e0/JI=; b=m qB2F9DF9vRoEs7jtMsu4ZBDC6aQTU1i3+NGy59fSlyqM5Grr7GL2Wr5f3JDdvSct kSCJ5FpaKtq+URa+AMPQsIWkZHJGwmEbRL/i8UQDBphwF/Y02Ep9zusWwB8wyT/+ Ng9aW6/MrCLCWYFq6k5IbhqYOuYuRpTd6IsYOsFEzmCdpqDKVvXgYwHd3+Mi9/eo DWaGYYkRFxyP1xyKif7sbGjqtrGpEtxljXzvy3iSKOvITpkcfPnxGIoEcA13Wdwd zp3J1X4shmq4s4fVKoATQdIY3b2A2XnJcYde2z+h1dkow4Kcmk2VptrgoXZezij9 ldKviEpjBdlO0X6WaXpHA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1770223574; x=1770309974; bh=B GK+qrVIcAnLNRs4fCH6awA6ce+4NWjLrrbX14e0/JI=; b=jpusHqDx6FtmfZHwt FSypEwp6tLtWIfStZPpG+3jpRBHT0/ZcjCpc4zsU7Nx1ob6sgMdOAZkQMcwm+iM6 60lXct5E43lJNmjhgavHOdSj0/JIDbK6TKiGeuLNFCrWzX5+2em28oxZFIFUzmF+ WVRtZYkOROwxmcLhplXNF4KIZ126rU053JDAQCOqwsKo2mElhrF30m3bxPSE3C12 yzgCndcF3iw8j5XtMof7eQP2zUoqi1XftWtq8V94qleGjsPGH2VI/yCyHmyC9Rzs D/y9ry7SmX7y8oFE3NbbPM3bQr1/MqRxaw/QhomIsqPkGmUxcRmhNWEh9MMbIIB1 RCUzQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedvleeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg gslhhonhhskhhirdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopegthhgrugesjhgrsghlohhnshhkihdrgiihiidprhgtphhtthhope gsrghlrghtohhnsegvihhkrdgsmhgvrdhhuhdprhgtphhtthhopehqvghmuhdquggvvhgv lhesnhhonhhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: ib26944c1:Fastmail From: Chad Jablonski To: qemu-devel@nongnu.org Cc: balaton@eik.bme.hu, Chad Jablonski Subject: [PATCH v8 14/18] ati-vga: Remove ATIVGAState param from ati_2d_do_blt Date: Wed, 4 Feb 2026 11:46:02 -0500 Message-ID: <20260204164606.3425246-15-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260204164606.3425246-1-chad@jablonski.xyz> References: <20260204164606.3425246-1-chad@jablonski.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=202.12.124.156; envelope-from=chad@jablonski.xyz; helo=fhigh-b5-smtp.messagingengine.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @jablonski.xyz) X-ZM-MESSAGEID: 1770223617644158500 Content-Type: text/plain; charset="utf-8" This completes the decoupling from the ATIVGAState struct. Signed-off-by: Chad Jablonski --- hw/display/ati_2d.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c index 063928c442..8a820bc91f 100644 --- a/hw/display/ati_2d.c +++ b/hw/display/ati_2d.c @@ -123,12 +123,12 @@ static void setup_2d_blt_ctx(const ATIVGAState *s, AT= I2DCtx *ctx) (ctx->top_to_bottom ? 'v' : '^')); } =20 -static void ati_2d_do_blt(ATIVGAState *s, ATI2DCtx *ctx) +static void ati_2d_do_blt(ATI2DCtx *ctx, uint8_t use_pixman) { /* FIXME it is probably more complex than this and may need to be */ /* rewritten but for now as a start just to get some output: */ - bool use_pixman_fill =3D s->use_pixman & BIT(0); - bool use_pixman_blt =3D s->use_pixman & BIT(1); + bool use_pixman_fill =3D use_pixman & BIT(0); + bool use_pixman_blt =3D use_pixman & BIT(1); if (!ctx->bpp) { qemu_log_mask(LOG_GUEST_ERROR, "Invalid bpp\n"); return; @@ -267,6 +267,6 @@ void ati_2d_blt(ATIVGAState *s) { ATI2DCtx ctx; setup_2d_blt_ctx(s, &ctx); - ati_2d_do_blt(s, &ctx); + ati_2d_do_blt(&ctx, s->use_pixman); ati_set_dirty(&s->vga, &ctx); } --=20 2.52.0 From nobody Sat Feb 7 04:55:06 2026 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=none dis=none) header.from=jablonski.xyz ARC-Seal: i=1; a=rsa-sha256; t=1770223677; cv=none; d=zohomail.com; s=zohoarc; b=k2UMbPYeeW2AYUc98IQ5AgDytLE+AogTwnHAR3DuaHwXuhAdLyIcaNRGvwUiA53Kl9/TKXZt1O1sBdQobVEuEh6M+ChZmCuHeBZfoElPEyS21/aodnCksEk1UtYDXzGQlsahp3DYUUbfKns++dVsFsCa7lKoX+ZOEYJEZCwaYrw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770223677; h=Content-Transfer-Encoding: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=WHB7HXBOW3/SU+k+R5lQR6UvT5Yz3Ua6vmh5gkfmy7A=; b=AQGhLjKpM27HdbMs2/Te7/0DqoWKKvWosiA70FIAMeiy84ZKZWHgrnIzZAM5B3GbAaa3h72fmk2hJoTyDBnHu8WcI+cZeJjdwVrQDIEOqk0ZnYjNy7keF2samBGo4azhQoMSPr71Qt9J2BtPcIQWZaFs06zu2UxjVBXBUwFDe2Q= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770223677720259.19820177186796; Wed, 4 Feb 2026 08:47:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vng1Y-0007Hv-Ft; Wed, 04 Feb 2026 11:46:40 -0500 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 ) id 1vng1L-000745-Ls for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:28 -0500 Received: from fout-b7-smtp.messagingengine.com ([202.12.124.150]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vng1K-0004Y7-3l for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:27 -0500 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.stl.internal (Postfix) with ESMTP id 09A5A1D00175; Wed, 4 Feb 2026 11:46:15 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Wed, 04 Feb 2026 11:46:15 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 11:46:14 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id 8c0ca560; Wed, 4 Feb 2026 16:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jablonski.xyz; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1770223574; x= 1770309974; bh=WHB7HXBOW3/SU+k+R5lQR6UvT5Yz3Ua6vmh5gkfmy7A=; b=U evrr9rSRS/kYdz82nlILkA3auvNQf+Rdm02Zin7F1CK6ntamRELCBEn7CV3Lsbew eB3Ibo0KIys3S1TFhSoStKQ4RMxYUtPgbas/+ag1QZPytRW1PTKideCLFsO21yiw 2xR+LJHOF+rdNvyLG7OvrjhhDIzo5Pw52ECx/eassXOeLufzKlFKTbuzFnwW/RP2 kZmwd0kK0Pi3yz2/L8+6OQN0j2GM7/ExReDrX9OYRSOh7NN9LpyM0c+95KARcG16 kLsO8EGagYBJUrTEqI43ixoNR2cdHjdtL9PseYxKRpjttKT8QpfJCG3089nhnh6p ahAzRPAbeMh3vtfrTY+gg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1770223574; x=1770309974; bh=W HB7HXBOW3/SU+k+R5lQR6UvT5Yz3Ua6vmh5gkfmy7A=; b=GfJYdGSR8vJ213fIq 2YSFonkwNydIipkgHpqLn+Ni+sBByW7qpjWMRJKOTEWdWyO1qdcen/RBOJvAyiea 2VcvXqcsVBach+knO+dVjYkNzcQVWonIPV6E26/A+lUEGs5u9A1utB74k3u+AfsS YMg7rF0Jv3/LODN3fQva2rUTZfmxOSKD79F43eUSnrBEuOchThYBy+kjIV15rru0 O/OxNnjIh8vsNbqOMxSviNDyZntUcOAjQJtRnR+dmhkv1EQJp+nqJxE+iMgHxWoM 1cekVT6ouBNz36qZzxehoyhfu9hiCvDSUgWBqPHjbdiDVx8CBdwowXffYVHoxZcX S8zmw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedvleehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg gslhhonhhskhhirdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpth htoheptghhrggusehjrggslhhonhhskhhirdighiiipdhrtghpthhtohepsggrlhgrthho nhesvghikhdrsghmvgdrhhhu X-ME-Proxy: Feedback-ID: ib26944c1:Fastmail From: Chad Jablonski To: qemu-devel@nongnu.org Cc: balaton@eik.bme.hu, Chad Jablonski Subject: [PATCH v8 15/18] ati-vga: Move source bounds validation to ati_2d_blt Date: Wed, 4 Feb 2026 11:46:03 -0500 Message-ID: <20260204164606.3425246-16-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260204164606.3425246-1-chad@jablonski.xyz> References: <20260204164606.3425246-1-chad@jablonski.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=202.12.124.150; envelope-from=chad@jablonski.xyz; helo=fout-b7-smtp.messagingengine.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @jablonski.xyz) X-ZM-MESSAGEID: 1770223677889158500 Content-Type: text/plain; charset="utf-8" A call to ati_2d_blt implies that the source will be vram. Checking bounds is useful in that case. Other sources (HOST_DATA) will not make sense to check against vram bounds. Signed-off-by: Chad Jablonski --- hw/display/ati_2d.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c index 8a820bc91f..463da001d9 100644 --- a/hw/display/ati_2d.c +++ b/hw/display/ati_2d.c @@ -153,13 +153,6 @@ static void ati_2d_do_blt(ATI2DCtx *ctx, uint8_t use_p= ixman) return; } int src_stride_words =3D ctx->src_stride / sizeof(uint32_t); - if (ctx->src.x > 0x3fff || ctx->src.y > 0x3fff - || ctx->src_bits >=3D ctx->vram_end - || ctx->src_bits + ctx->src.x + (ctx->src.y + ctx->dst.height) - * ctx->src_stride >=3D ctx->vram_end) { - qemu_log_mask(LOG_UNIMP, "blt outside vram not implemented\n"); - return; - } =20 DPRINTF("pixman_blt(%p, %p, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d= )\n", ctx->src_bits, ctx->dst_bits, src_stride_words, @@ -267,6 +260,12 @@ void ati_2d_blt(ATIVGAState *s) { ATI2DCtx ctx; setup_2d_blt_ctx(s, &ctx); + if (ctx.src.x > 0x3fff || ctx.src.y > 0x3fff + || ctx.src_bits >=3D ctx.vram_end || ctx.src_bits + ctx.src.x + + (ctx.src.y + ctx.dst.height) * ctx.src_stride >=3D ctx.vram_end= ) { + qemu_log_mask(LOG_UNIMP, "blt outside vram not implemented\n"); + return; + } ati_2d_do_blt(&ctx, s->use_pixman); ati_set_dirty(&s->vga, &ctx); } --=20 2.52.0 From nobody Sat Feb 7 04:55:06 2026 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=none dis=none) header.from=jablonski.xyz ARC-Seal: i=1; a=rsa-sha256; t=1770223697; cv=none; d=zohomail.com; s=zohoarc; b=mkDecERZjBKP12kLXAVrbxYc+vwDCdfy68LThtD7yJFMns5nZsfGElPWpLr1tYDXFlIl/+QZua7GxwFNg/y+0jSClmSTD872aIZY6fXkZefMt9557wXK0XjH1UUaxKrOtPOQiSHJ7/RjockiguBYnkjUwUoRuj9YqKcaxhrcm+U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770223697; h=Content-Transfer-Encoding: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=ALXw7+kFhadaK+v0D/xMOYKKTLFyhtOCLdEdTyR+gUQ=; b=CU7cZtIAHeV7FpyHNs3bTPGUtTJfRhHZjaAYxDjXx3aTHKiAMwTpVrciKSPIu/PDbsjgfTiv3tbWeHfpOprYReqU3/G95fMexWCeqEj0GsHgBSmi4ckQpsNEjVKteAQZe2xX3KH7AbvxzyNjTepkVKKdAeLrE/fZdSMlemQikvM= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770223697231612.1641719043888; Wed, 4 Feb 2026 08:48:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vng1L-000740-5R; Wed, 04 Feb 2026 11:46:27 -0500 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 ) id 1vng1F-000721-AV for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:22 -0500 Received: from fhigh-b5-smtp.messagingengine.com ([202.12.124.156]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vng1A-0004YH-5o for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:21 -0500 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfhigh.stl.internal (Postfix) with ESMTP id 088DD7A00FC; Wed, 4 Feb 2026 11:46:15 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Wed, 04 Feb 2026 11:46:15 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 11:46:14 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id e57244e6; Wed, 4 Feb 2026 16:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jablonski.xyz; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1770223574; x= 1770309974; bh=ALXw7+kFhadaK+v0D/xMOYKKTLFyhtOCLdEdTyR+gUQ=; b=p Fw+YISTQiQzMadscwrpIbq5C0AP/bPCa7WrgzheyCXwGye033NB2gQvG9jhpjdU4 65+EgLvsQtmWyF58ivsCiRyk93fx3koZGz1UK6qdyXI+pV/K2hyJ7u2LF9tb14Y8 zCmy5nbNct5LVh6rLny3nmdwwsqHdw6YyAPmHHBQ2d9gVLsky0DCPS/2gg/3S7bz d4hWVC6uZGs56r9SeMiZSssWWAKirlOb5dcHPNZ5kgKCfvhLfOvnJOJM9Zz3Zimd SPBffSR1MCazLfgAUKoLFBOVzW3ohCs9D9+VB4nTG/jEzriBrv60ZJ0ILMEtSTBp aNFeKqJitmhS17oPklPVw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1770223574; x=1770309974; bh=A LXw7+kFhadaK+v0D/xMOYKKTLFyhtOCLdEdTyR+gUQ=; b=WTB62BZwjbBHfkGyR f+3iTYHrEYDTgB3/ETGbPALnnF/Vl/JGFB4HNRzi02jfcHnjRAVxUHA2zr/kTLxP 8Sjls4fHvHKIFn4mOvIPL+zoOjd9qQlZf7+v7eptyQGekb0EfYygFG575YkOY8Ua DQ8a+4YRwd1sIi9qwcCKIXagvyQCz3/wQLBdYgFmGazwskRh+wzo5EOHcR9PJVlG z2EQA12t5cdEgdEdF/DOCjnnu2LogbqU17dq4xASeLoftroIQU2JfKHPMN3AfVyq /SEH9p16/XZXH2rsmaNHmQZb3jJTiJ7zgqHjT2RdYzcVZWRtFmSSZpQz4FVIDu7H DyBHg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedvleehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg gslhhonhhskhhirdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopegthhgrugesjhgrsghlohhnshhkihdrgiihiidprhgtphhtthhope gsrghlrghtohhnsegvihhkrdgsmhgvrdhhuhdprhgtphhtthhopehqvghmuhdquggvvhgv lhesnhhonhhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: ib26944c1:Fastmail From: Chad Jablonski To: qemu-devel@nongnu.org Cc: balaton@eik.bme.hu, Chad Jablonski Subject: [PATCH v8 16/18] ati-vga: Implement scissor rectangle clipping for 2D operations Date: Wed, 4 Feb 2026 11:46:04 -0500 Message-ID: <20260204164606.3425246-17-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260204164606.3425246-1-chad@jablonski.xyz> References: <20260204164606.3425246-1-chad@jablonski.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=202.12.124.156; envelope-from=chad@jablonski.xyz; helo=fhigh-b5-smtp.messagingengine.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @jablonski.xyz) X-ZM-MESSAGEID: 1770223725905158500 Content-Type: text/plain; charset="utf-8" Use scissor registers to clip blit operations. This is required for text rendering in X using the r128 driver. Without it overly-wide glyphs are drawn and create all sorts of chaos. The visible destination rectangle (vis_dst) is the intersection of the scissor rectangle and the destination rectangle (dst). The src also needs to be offset if clipped on the top and/or left sides to ensure that src data is read correctly and appears clipped when drawn rather than shifted. Signed-off-by: Chad Jablonski --- hw/display/ati_2d.c | 75 +++++++++++++++++++++++++++++---------------- 1 file changed, 49 insertions(+), 26 deletions(-) diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c index 463da001d9..53f00e07ec 100644 --- a/hw/display/ati_2d.c +++ b/hw/display/ati_2d.c @@ -52,6 +52,7 @@ typedef struct { uint32_t frgd_clr; const uint8_t *palette; const uint8_t *vram_end; + QemuRect scissor; =20 QemuRect dst; int dst_stride; @@ -91,6 +92,11 @@ static void setup_2d_blt_ctx(const ATIVGAState *s, ATI2D= Ctx *ctx) ctx->dst_offset =3D s->regs.dst_offset; ctx->vram_end =3D s->vga.vram_ptr + s->vga.vram_size; =20 + ctx->scissor.width =3D s->regs.sc_right - s->regs.sc_left + 1; + ctx->scissor.height =3D s->regs.sc_bottom - s->regs.sc_top + 1; + ctx->scissor.x =3D s->regs.sc_left; + ctx->scissor.y =3D s->regs.sc_top; + ctx->dst.width =3D s->regs.dst_width; ctx->dst.height =3D s->regs.dst_height; ctx->dst.x =3D (ctx->left_to_right ? @@ -129,6 +135,7 @@ static void ati_2d_do_blt(ATI2DCtx *ctx, uint8_t use_pi= xman) /* rewritten but for now as a start just to get some output: */ bool use_pixman_fill =3D use_pixman & BIT(0); bool use_pixman_blt =3D use_pixman & BIT(1); + QemuRect vis_src, vis_dst; if (!ctx->bpp) { qemu_log_mask(LOG_GUEST_ERROR, "Invalid bpp\n"); return; @@ -144,6 +151,22 @@ static void ati_2d_do_blt(ATI2DCtx *ctx, uint8_t use_p= ixman) qemu_log_mask(LOG_UNIMP, "blt outside vram not implemented\n"); return; } + qemu_rect_intersect(&ctx->dst, &ctx->scissor, &vis_dst); + if (!vis_dst.height || !vis_dst.width) { + /* Nothing is visible, completely clipped */ + return; + } + /* + * The src must be offset if clipping is applied to the dst. + * This is so that when the source is blit to a dst clipped + * on the top or left the src image is not shifted into the + * clipped region but actually clipped. + */ + vis_src.x =3D ctx->src.x + (vis_dst.x - ctx->dst.x); + vis_src.y =3D ctx->src.y + (vis_dst.y - ctx->dst.y); + vis_src.width =3D vis_dst.width; + vis_src.height =3D vis_dst.height; + switch (ctx->rop3) { case ROP3_SRCCOPY: { @@ -156,30 +179,30 @@ static void ati_2d_do_blt(ATI2DCtx *ctx, uint8_t use_= pixman) =20 DPRINTF("pixman_blt(%p, %p, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d= )\n", ctx->src_bits, ctx->dst_bits, src_stride_words, - dst_stride_words, ctx->bpp, ctx->bpp, ctx->src.x, ctx->src= .y, - ctx->dst.x, ctx->dst.y, ctx->dst.width, ctx->dst.height); + dst_stride_words, ctx->bpp, ctx->bpp, vis_src.x, vis_src.y, + vis_dst.x, vis_dst.y, vis_dst.width, vis_dst.height); #ifdef CONFIG_PIXMAN if (use_pixman_blt && ctx->left_to_right && ctx->top_to_bottom) { fallback =3D !pixman_blt((uint32_t *)ctx->src_bits, (uint32_t *)ctx->dst_bits, src_stride_w= ords, dst_stride_words, ctx->bpp, ctx->bpp, - ctx->src.x, ctx->src.y, ctx->dst.x, - ctx->dst.y, ctx->dst.width, ctx->dst.he= ight); + vis_src.x, vis_src.y, vis_dst.x, vis_ds= t.y, + vis_dst.width, vis_dst.height); } else if (use_pixman_blt) { /* FIXME: We only really need a temporary if src and dst overl= ap */ - int llb =3D ctx->dst.width * (ctx->bpp / 8); + int llb =3D vis_dst.width * (ctx->bpp / 8); int tmp_stride =3D DIV_ROUND_UP(llb, sizeof(uint32_t)); uint32_t *tmp =3D g_malloc(tmp_stride * sizeof(uint32_t) * - ctx->dst.height); + vis_dst.height); fallback =3D !pixman_blt((uint32_t *)ctx->src_bits, tmp, src_stride_words, tmp_stride, ctx->bpp, - ctx->bpp, ctx->src.x, ctx->src.y, 0, 0, - ctx->dst.width, ctx->dst.height); + ctx->bpp, vis_src.x, vis_src.y, 0, 0, + vis_dst.width, vis_dst.height); if (!fallback) { fallback =3D !pixman_blt(tmp, (uint32_t *)ctx->dst_bits, tmp_stride, dst_stride_words, ctx->= bpp, - ctx->bpp, 0, 0, ctx->dst.x, ctx->ds= t.y, - ctx->dst.width, ctx->dst.height); + ctx->bpp, 0, 0, vis_dst.x, vis_dst.= y, + vis_dst.width, vis_dst.height); } g_free(tmp); } else @@ -189,20 +212,20 @@ static void ati_2d_do_blt(ATI2DCtx *ctx, uint8_t use_= pixman) } if (fallback) { unsigned int y, i, j, bypp =3D ctx->bpp / 8; - for (y =3D 0; y < ctx->dst.height; y++) { - i =3D ctx->dst.x * bypp; - j =3D ctx->src.x * bypp; + for (y =3D 0; y < vis_dst.height; y++) { + i =3D vis_dst.x * bypp; + j =3D vis_src.x * bypp; if (ctx->top_to_bottom) { - i +=3D (ctx->dst.y + y) * ctx->dst_stride; - j +=3D (ctx->src.y + y) * ctx->src_stride; + i +=3D (vis_dst.y + y) * ctx->dst_stride; + j +=3D (vis_src.y + y) * ctx->src_stride; } else { - i +=3D (ctx->dst.y + ctx->dst.height - 1 - y) + i +=3D (vis_dst.y + vis_dst.height - 1 - y) * ctx->dst_stride; - j +=3D (ctx->src.y + ctx->dst.height - 1 - y) + j +=3D (vis_src.y + vis_dst.height - 1 - y) * ctx->src_stride; } memmove(&ctx->dst_bits[i], &ctx->src_bits[j], - ctx->dst.width * bypp); + vis_dst.width * bypp); } } break; @@ -230,20 +253,20 @@ static void ati_2d_do_blt(ATI2DCtx *ctx, uint8_t use_= pixman) } =20 DPRINTF("pixman_fill(%p, %d, %d, %d, %d, %d, %d, %x)\n", - ctx->dst_bits, dst_stride_words, ctx->bpp, ctx->dst.x, - ctx->dst.y, ctx->dst.width, ctx->dst.height, filler); + ctx->dst_bits, dst_stride_words, ctx->bpp, vis_dst.x, + vis_dst.y, vis_dst.width, vis_dst.height, filler); #ifdef CONFIG_PIXMAN if (!use_pixman_fill || - !pixman_fill((uint32_t *)ctx->dst_bits, dst_stride_words, ctx-= >bpp, - ctx->dst.x, ctx->dst.y, - ctx->dst.width, ctx->dst.height, filler)) + !pixman_fill((uint32_t *)ctx->dst_bits, dst_stride_words, ctx= ->bpp, + vis_dst.x, vis_dst.y, vis_dst.width, vis_dst.hei= ght, + filler)) #endif { /* fallback when pixman failed or we don't want to call it */ unsigned int x, y, i, bypp =3D ctx->bpp / 8; - for (y =3D 0; y < ctx->dst.height; y++) { - i =3D ctx->dst.x * bypp + (ctx->dst.y + y) * ctx->dst_stri= de; - for (x =3D 0; x < ctx->dst.width; x++, i +=3D bypp) { + for (y =3D 0; y < vis_dst.height; y++) { + i =3D vis_dst.x * bypp + (vis_dst.y + y) * ctx->dst_stride; + for (x =3D 0; x < vis_dst.width; x++, i +=3D bypp) { stn_he_p(&ctx->dst_bits[i], bypp, filler); } } --=20 2.52.0 From nobody Sat Feb 7 04:55:06 2026 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=none dis=none) header.from=jablonski.xyz ARC-Seal: i=1; a=rsa-sha256; t=1770223647; cv=none; d=zohomail.com; s=zohoarc; b=KCU8iN3QzBAIIzyEGzKyDikwpM/KH1BjMU1V+iHRmsn02bhC7BG0MtlGrv4jlWgYGPlLYIpEA8G2SfZouyUxjr2ga/vdkE+Zv/Nq5IPH+dgCNXU+xeEvf3JGUuuuBbGXtXgn2gr4AFw269tjWBTtzfYMQpgLOq11Y0yx62Rvy2Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770223647; h=Content-Transfer-Encoding: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=yF27HNX02Ru9Co1eGRAH4G56t9l9sU85B21tcUxK7cQ=; b=S+AmpfQFHBxozKpp+u11yyaXBS49WDN0uGLe8+MzgDvS2FZM7FBgKf5jD/MwlcU2M4zgwfLdLxMNz8UDg7eY6jauBqVPWuVjeOphSDKC140mOr4uqY5Ypz4xsD4RBVsj954diOZ/aoGPZ0qlyaoxjju4otis90aviShEJ2emvDw= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770223646885589.5616163098272; Wed, 4 Feb 2026 08:47:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vng1S-0007BA-IT; Wed, 04 Feb 2026 11:46:34 -0500 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 ) id 1vng1F-00071z-25 for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:22 -0500 Received: from fhigh-b5-smtp.messagingengine.com ([202.12.124.156]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vng1A-0004YI-5N for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:20 -0500 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.stl.internal (Postfix) with ESMTP id 4DB0F7A0114; Wed, 4 Feb 2026 11:46:15 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Wed, 04 Feb 2026 11:46:15 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 11:46:14 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id 1872e1e3; Wed, 4 Feb 2026 16:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jablonski.xyz; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1770223575; x= 1770309975; bh=yF27HNX02Ru9Co1eGRAH4G56t9l9sU85B21tcUxK7cQ=; b=o fA18ff30Xs9kRE8iOBVjER20V9bw0oyLBF9cAtpjFSLKzPVxvxo+L5FlczMc4Ibj gnyFG0m6xxjukTxHc6F62NFW8OtJXGGOBr6rf80JJoK5Rmtb3p4uQuFsaoS4ZThL LMM/ViZClAuaoU+5NbDNzRF+lUbOKNUkw65QpvJSFM4cXn56cBREAnl8/5S1BZPf cyxDkjwq9Fd6c9NjUlV6eHAz9oepDDv4X4LT5AiP3A1poMnmcMTzSLkYx9+3+P3c w59Uc5KT8u9qI1ubHdgGcv3f+JRjC8Kujk9z2gnH2m/xaQnYSqmG/Jx/7t2WZYZy 6yX2XEOEAFw9mADT1VeJw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1770223575; x=1770309975; bh=y F27HNX02Ru9Co1eGRAH4G56t9l9sU85B21tcUxK7cQ=; b=vWXVUlP8li0vjsnVY Qeeo/wbsOPBM79oup0x+5/uN1WWwrNE1Rw37UqMH1M8LwagAkyUU1WSAfFU8SC7t heox3Aw+eRwdLWgjFm/8bC+eBabUEwtOlF3z1cutKsk24hS4dWvABcNLaQ+YNZO4 k/COkmGyPIem+qTdE8f3GOwdUQf5th5QuH5W4tikH0pcylCZuk33H7JlV5BvRt2L ch1h8dNHxxNfv3AH6WSqhZ6XRR5sf7OL5kKqXZd7+OIvB0uW0H9PW//ZTCtknQ6Z OjvKL658ONTgX3Ae9JRfDW/zqg1/e496PYjBBvH2oKP2lJJRHPKJiNMjuM3FAzxz wW8mw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedvleehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg gslhhonhhskhhirdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopegsrghlrghtohhnsegvihhkrdgsmhgvrdhhuhdprhgtphhtthhope gthhgrugesjhgrsghlohhnshhkihdrgiihiidprhgtphhtthhopehqvghmuhdquggvvhgv lhesnhhonhhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: ib26944c1:Fastmail From: Chad Jablonski To: qemu-devel@nongnu.org Cc: balaton@eik.bme.hu, Chad Jablonski Subject: [PATCH v8 17/18] ati-vga: Implement HOST_DATA register writes Date: Wed, 4 Feb 2026 11:46:05 -0500 Message-ID: <20260204164606.3425246-18-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260204164606.3425246-1-chad@jablonski.xyz> References: <20260204164606.3425246-1-chad@jablonski.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=202.12.124.156; envelope-from=chad@jablonski.xyz; helo=fhigh-b5-smtp.messagingengine.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @jablonski.xyz) X-ZM-MESSAGEID: 1770223649199154100 Content-Type: text/plain; charset="utf-8" Writing to any of the HOST_DATA0-7 registers pushes the written data into a 128-bit accumulator. When the accumulator is full a flush is triggered to copy it to the framebuffer. A final write to HOST_DATA_LAST will also initiate a flush. The flush itself is left for the next patch. Unaligned HOST_DATA* writes result in, from what I can tell, undefined behavior on real hardware. A well-behaved driver shouldn't be doing this anyway. For that reason they are not handled here at all. Signed-off-by: Chad Jablonski --- hw/display/ati.c | 32 ++++++++++++++++++++++++++++++++ hw/display/ati_dbg.c | 9 +++++++++ hw/display/ati_int.h | 8 ++++++++ hw/display/ati_regs.h | 9 +++++++++ 4 files changed, 58 insertions(+) diff --git a/hw/display/ati.c b/hw/display/ati.c index 6cf243bcf9..fd717044b0 100644 --- a/hw/display/ati.c +++ b/hw/display/ati.c @@ -561,6 +561,13 @@ static inline void ati_reg_write_offs(uint32_t *reg, i= nt offs, } } =20 +static void ati_host_data_reset(ATIHostDataState *hd) +{ + hd->next =3D 0; + hd->row =3D 0; + hd->col =3D 0; +} + static void ati_mm_write(void *opaque, hwaddr addr, uint64_t data, unsigned int size) { @@ -836,6 +843,7 @@ static void ati_mm_write(void *opaque, hwaddr addr, break; case DST_WIDTH: s->regs.dst_width =3D data & 0x3fff; + ati_host_data_reset(&s->host_data); ati_2d_blt(s); break; case DST_HEIGHT: @@ -886,6 +894,7 @@ static void ati_mm_write(void *opaque, hwaddr addr, case DST_HEIGHT_WIDTH: s->regs.dst_width =3D data & 0x3fff; s->regs.dst_height =3D (data >> 16) & 0x3fff; + ati_host_data_reset(&s->host_data); ati_2d_blt(s); break; case DP_GUI_MASTER_CNTL: @@ -916,6 +925,7 @@ static void ati_mm_write(void *opaque, hwaddr addr, case DST_WIDTH_X: s->regs.dst_x =3D data & 0x3fff; s->regs.dst_width =3D (data >> 16) & 0x3fff; + ati_host_data_reset(&s->host_data); ati_2d_blt(s); break; case SRC_X_Y: @@ -929,6 +939,7 @@ static void ati_mm_write(void *opaque, hwaddr addr, case DST_WIDTH_HEIGHT: s->regs.dst_height =3D data & 0x3fff; s->regs.dst_width =3D (data >> 16) & 0x3fff; + ati_host_data_reset(&s->host_data); ati_2d_blt(s); break; case DST_HEIGHT_Y: @@ -1024,6 +1035,25 @@ static void ati_mm_write(void *opaque, hwaddr addr, case SRC_SC_BOTTOM: s->regs.src_sc_bottom =3D data & 0x3fff; break; + case HOST_DATA0: + case HOST_DATA1: + case HOST_DATA2: + case HOST_DATA3: + case HOST_DATA4: + case HOST_DATA5: + case HOST_DATA6: + case HOST_DATA7: + s->host_data.acc[s->host_data.next++] =3D data; + if (s->host_data.next >=3D 4) { + qemu_log_mask(LOG_UNIMP, "HOST_DATA flush not yet implemented\= n"); + s->host_data.next =3D 0; + } + break; + case HOST_DATA_LAST: + s->host_data.acc[s->host_data.next] =3D data; + qemu_log_mask(LOG_UNIMP, "HOST_DATA flush not yet implemented\n"); + ati_host_data_reset(&s->host_data); + break; default: break; } @@ -1129,6 +1159,8 @@ static void ati_vga_reset(DeviceState *dev) /* reset vga */ vga_common_reset(&s->vga); s->mode =3D VGA_MODE; + + ati_host_data_reset(&s->host_data); } =20 static void ati_vga_exit(PCIDevice *dev) diff --git a/hw/display/ati_dbg.c b/hw/display/ati_dbg.c index 3ffa7f35df..5c799d540a 100644 --- a/hw/display/ati_dbg.c +++ b/hw/display/ati_dbg.c @@ -252,6 +252,15 @@ static struct ati_regdesc ati_reg_names[] =3D { {"MC_SRC1_CNTL", 0x19D8}, {"TEX_CNTL", 0x1800}, {"RAGE128_MPP_TB_CONFIG", 0x01c0}, + {"HOST_DATA0", 0x17c0}, + {"HOST_DATA1", 0x17c4}, + {"HOST_DATA2", 0x17c8}, + {"HOST_DATA3", 0x17cc}, + {"HOST_DATA4", 0x17d0}, + {"HOST_DATA5", 0x17d4}, + {"HOST_DATA6", 0x17d8}, + {"HOST_DATA7", 0x17dc}, + {"HOST_DATA_LAST", 0x17e0}, {NULL, -1} }; =20 diff --git a/hw/display/ati_int.h b/hw/display/ati_int.h index 98f57ca5fa..ef474e366e 100644 --- a/hw/display/ati_int.h +++ b/hw/display/ati_int.h @@ -95,6 +95,13 @@ typedef struct ATIVGARegs { uint32_t default_tile; } ATIVGARegs; =20 +typedef struct ATIHostDataState { + uint32_t row; + uint32_t col; + uint32_t next; + uint32_t acc[4]; +} ATIHostDataState; + struct ATIVGAState { PCIDevice dev; VGACommonState vga; @@ -112,6 +119,7 @@ struct ATIVGAState { MemoryRegion io; MemoryRegion mm; ATIVGARegs regs; + ATIHostDataState host_data; }; =20 const char *ati_reg_name(int num); diff --git a/hw/display/ati_regs.h b/hw/display/ati_regs.h index 3999edb9b7..48f15e9b1d 100644 --- a/hw/display/ati_regs.h +++ b/hw/display/ati_regs.h @@ -252,6 +252,15 @@ #define DP_T12_CNTL 0x178c #define DST_BRES_T1_LNTH 0x1790 #define DST_BRES_T2_LNTH 0x1794 +#define HOST_DATA0 0x17c0 +#define HOST_DATA1 0x17c4 +#define HOST_DATA2 0x17c8 +#define HOST_DATA3 0x17cc +#define HOST_DATA4 0x17d0 +#define HOST_DATA5 0x17d4 +#define HOST_DATA6 0x17d8 +#define HOST_DATA7 0x17dc +#define HOST_DATA_LAST 0x17e0 #define SCALE_SRC_HEIGHT_WIDTH 0x1994 #define SCALE_OFFSET_0 0x1998 #define SCALE_PITCH 0x199c --=20 2.52.0 From nobody Sat Feb 7 04:55:06 2026 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=none dis=none) header.from=jablonski.xyz ARC-Seal: i=1; a=rsa-sha256; t=1770223654; cv=none; d=zohomail.com; s=zohoarc; b=KjHq/j+5qbrtMHJGC6MecDMheAclFIuXuSAxKZbM5oRs1xj3Nk44vEo8ww6rqz4Pwf2kz4ppcuzzbmeFgT7cptOKEp5vDRFtvMEz89s2WGghDqwU8BXspPHYzAcS+9G5lNNUJs9NZu15oNrRbnA4guK9WbXbiFJ92Hpbp+JNbKE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770223654; h=Content-Transfer-Encoding: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=PdWCyyZVoq9rSO4tnOaL9465qRC90aZ6qTNBQk4TT6E=; b=oBTHRXaBh8y6t7Cpq9HG2DUGyk2z6QZA3cJvdm1wCPEve/9PzoFwrMUBXL9KfYDdaNh4nV7CBKNTXDzTBOXwCvPNZEXXGI+kgf3NR62Cwc57mzyS3U5Z9LkdXEePHGRQSjvHUpbFwIX07oGOazPfdojx+MfmFMBzYI+O/E9L3kQ= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770223654073160.90199260779912; Wed, 4 Feb 2026 08:47:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vng1s-0007XB-Jf; Wed, 04 Feb 2026 11:47:00 -0500 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 ) id 1vng1N-00074F-50 for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:29 -0500 Received: from fout-b7-smtp.messagingengine.com ([202.12.124.150]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vng1K-0004Yd-HP for qemu-devel@nongnu.org; Wed, 04 Feb 2026 11:46:28 -0500 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.stl.internal (Postfix) with ESMTP id AAF0C1D00163; Wed, 4 Feb 2026 11:46:15 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Wed, 04 Feb 2026 11:46:15 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 11:46:15 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id be41346d; Wed, 4 Feb 2026 16:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jablonski.xyz; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1770223575; x= 1770309975; bh=PdWCyyZVoq9rSO4tnOaL9465qRC90aZ6qTNBQk4TT6E=; b=W 8MP7LbZ5/lwkx+NoLiImBNrGg7lXyhCHYybrmJkm9lKifNwYuE6+TCOq4QMmav82 H4f7MqAIdx1yYTXMa/MV4KpRRYUj21OFW+9WybrFJxrRc0k7LdT9RVn0BBfkprvY BsPcgcVex+X4bkpSplFllS5A4DBZx4XbUTP/YLjES193CUBD6eQoSLwF4GJAuwwM 1IXNUiKAKuFLsAXXiQJcFpw/AgbzowgvZlvcWkhs0aBIQC9cMNqgdwn1IqQKtnMH q4dXAj+hpFhmD8w78PufOXX07ze5cey7AGPfPzcC5cMoHhox6IAZzsHuNg2p8MP8 rBxrZwIysAaCzRXebYyoA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1770223575; x=1770309975; bh=P dWCyyZVoq9rSO4tnOaL9465qRC90aZ6qTNBQk4TT6E=; b=XKU5ckp8S32jrjxtv ipnlMSPwezhXfkVuC8847VgkHVzDMLQH7PGK7uzRkWg2hZjSqKbO6NA/AOO6kwRx JcFYDHNaGGLbInzdstOZDOh3c3oHddDa+rYVUPDdCR/w/8HOvIoEYJLY7vxJh01a oZPU4j70bq8THY7RjnAJRWt7ZK9/tAZj648m3xfoM+wcHMcx476kxFeqEWguXHLZ XJ5VOG+hJSexdNkmu4s4Z9XkB+/nheVJceWY3xGNkMd2unQEdaOB1ovLIL/vEcn2 hmVB5wp4GRnRVZsXw5h1dXXjSdlhTOQmmht6opSinXjq581K1dsu1WWOn8L2Xqrk wcs5w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedvleehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg gslhhonhhskhhirdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpth htohepsggrlhgrthhonhesvghikhdrsghmvgdrhhhupdhrtghpthhtoheptghhrggusehj rggslhhonhhskhhirdighiii X-ME-Proxy: Feedback-ID: ib26944c1:Fastmail From: Chad Jablonski To: qemu-devel@nongnu.org Cc: balaton@eik.bme.hu, Chad Jablonski Subject: [PATCH v8 18/18] ati-vga: Implement HOST_DATA flush to VRAM Date: Wed, 4 Feb 2026 11:46:06 -0500 Message-ID: <20260204164606.3425246-19-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260204164606.3425246-1-chad@jablonski.xyz> References: <20260204164606.3425246-1-chad@jablonski.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=202.12.124.150; envelope-from=chad@jablonski.xyz; helo=fout-b7-smtp.messagingengine.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @jablonski.xyz) X-ZM-MESSAGEID: 1770223655864158500 Content-Type: text/plain; charset="utf-8" Implement flushing the 128-bit HOST_DATA accumulator to VRAM to enable text rendering in X. Currently supports only the monochrome foreground/background datatype. The flush is broken up into two steps. First, expansion of the monochrome bits to the destination color depth. Then the expanded pixels are sent to the ati_2d_do_blt one scanline at a time. ati_2d_do_blt then clips and performs the blit. Signed-off-by: Chad Jablonski --- hw/display/ati.c | 4 +-- hw/display/ati_2d.c | 84 +++++++++++++++++++++++++++++++++++++++++++ hw/display/ati_int.h | 3 ++ hw/display/ati_regs.h | 4 +++ 4 files changed, 93 insertions(+), 2 deletions(-) diff --git a/hw/display/ati.c b/hw/display/ati.c index fd717044b0..514935e510 100644 --- a/hw/display/ati.c +++ b/hw/display/ati.c @@ -1045,13 +1045,13 @@ static void ati_mm_write(void *opaque, hwaddr addr, case HOST_DATA7: s->host_data.acc[s->host_data.next++] =3D data; if (s->host_data.next >=3D 4) { - qemu_log_mask(LOG_UNIMP, "HOST_DATA flush not yet implemented\= n"); + ati_flush_host_data(s); s->host_data.next =3D 0; } break; case HOST_DATA_LAST: s->host_data.acc[s->host_data.next] =3D data; - qemu_log_mask(LOG_UNIMP, "HOST_DATA flush not yet implemented\n"); + ati_flush_host_data(s); ati_host_data_reset(&s->host_data); break; default: diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c index 53f00e07ec..fc18ed4384 100644 --- a/hw/display/ati_2d.c +++ b/hw/display/ati_2d.c @@ -282,6 +282,11 @@ static void ati_2d_do_blt(ATI2DCtx *ctx, uint8_t use_p= ixman) void ati_2d_blt(ATIVGAState *s) { ATI2DCtx ctx; + uint32_t src_source =3D s->regs.dp_mix & DP_SRC_SOURCE; + if (src_source =3D=3D DP_SRC_HOST || src_source =3D=3D DP_SRC_HOST_BYT= EALIGN) { + /* HOST_DATA sources are handled by ati_flush_host_data() */ + return; + } setup_2d_blt_ctx(s, &ctx); if (ctx.src.x > 0x3fff || ctx.src.y > 0x3fff || ctx.src_bits >=3D ctx.vram_end || ctx.src_bits + ctx.src.x @@ -292,3 +297,82 @@ void ati_2d_blt(ATIVGAState *s) ati_2d_do_blt(&ctx, s->use_pixman); ati_set_dirty(&s->vga, &ctx); } + +void ati_flush_host_data(ATIVGAState *s) +{ + ATI2DCtx ctx, chunk; + uint32_t fg =3D s->regs.dp_src_frgd_clr; + uint32_t bg =3D s->regs.dp_src_bkgd_clr; + unsigned bypp, row, col, idx; + uint8_t pix_buf[ATI_HOST_DATA_ACC_BITS * sizeof(uint32_t)]; + uint32_t byte_pix_order =3D s->regs.dp_datatype & DP_BYTE_PIX_ORDER; + uint32_t src_source =3D s->regs.dp_mix & DP_SRC_SOURCE; + uint32_t src_datatype =3D s->regs.dp_datatype & DP_SRC_DATATYPE; + + if (src_source !=3D DP_SRC_HOST) { + qemu_log_mask(LOG_UNIMP, "host_data_blt: only DP_SRC_HOST supporte= d\n"); + return; + } + if (src_datatype !=3D SRC_MONO_FRGD_BKGD) { + qemu_log_mask(LOG_UNIMP, + "host_data_blt: only SRC_MONO_FRGD_BKGD supported\n"= ); + return; + } + + setup_2d_blt_ctx(s, &ctx); + + if (!ctx.left_to_right || !ctx.top_to_bottom) { + qemu_log_mask(LOG_UNIMP, "host_data_blt: only L->R, T->B supported= \n"); + return; + } + + bypp =3D ctx.bpp / 8; + + /* Expand monochrome bits to color pixels */ + idx =3D 0; + for (int word =3D 0; word < 4; word++) { + for (int byte =3D 0; byte < 4; byte++) { + uint8_t byte_val =3D s->host_data.acc[word] >> (byte * 8); + for (int i =3D 0; i < 8; i++) { + int bit =3D byte_pix_order ? i : (7 - i); + bool is_fg =3D extract8(byte_val, bit, 1); + uint32_t color =3D is_fg ? fg : bg; + stn_he_p(&pix_buf[idx * bypp], bypp, color); + idx +=3D 1; + } + } + } + + /* Copy and then modify blit ctx for use in a chunked blit */ + chunk =3D ctx; + chunk.src_bits =3D pix_buf; + chunk.src.y =3D 0; + chunk.src_stride =3D ATI_HOST_DATA_ACC_BITS * bypp; + + /* Blit one scanline chunk at a time */ + row =3D s->host_data.row; + col =3D s->host_data.col; + idx =3D 0; + while (idx < ATI_HOST_DATA_ACC_BITS && row < ctx.dst.height) { + unsigned pix_in_scanline =3D MIN(ATI_HOST_DATA_ACC_BITS - idx, + ctx.dst.width - col); + chunk.src.x =3D idx; + /* Build a rect for this scanline chunk */ + chunk.dst.x =3D ctx.dst.x + col; + chunk.dst.y =3D ctx.dst.y + row; + chunk.dst.width =3D pix_in_scanline; + chunk.dst.height =3D 1; + ati_2d_do_blt(&chunk, s->use_pixman); + ati_set_dirty(&s->vga, &chunk); + idx +=3D pix_in_scanline; + col +=3D pix_in_scanline; + if (col >=3D ctx.dst.width) { + col =3D 0; + row +=3D 1; + } + } + + /* Track state of the overall blit for use by the next flush */ + s->host_data.row =3D row; + s->host_data.col =3D col; +} diff --git a/hw/display/ati_int.h b/hw/display/ati_int.h index ef474e366e..32d1e628d3 100644 --- a/hw/display/ati_int.h +++ b/hw/display/ati_int.h @@ -33,6 +33,8 @@ #define ATI_RAGE128_LINEAR_APER_SIZE (64 * MiB) #define ATI_R100_LINEAR_APER_SIZE (128 * MiB) =20 +#define ATI_HOST_DATA_ACC_BITS 128 + #define TYPE_ATI_VGA "ati-vga" OBJECT_DECLARE_SIMPLE_TYPE(ATIVGAState, ATI_VGA) =20 @@ -125,5 +127,6 @@ struct ATIVGAState { const char *ati_reg_name(int num); =20 void ati_2d_blt(ATIVGAState *s); +void ati_flush_host_data(ATIVGAState *s); =20 #endif /* ATI_INT_H */ diff --git a/hw/display/ati_regs.h b/hw/display/ati_regs.h index 48f15e9b1d..9d08d3e956 100644 --- a/hw/display/ati_regs.h +++ b/hw/display/ati_regs.h @@ -397,7 +397,11 @@ #define DST_32BPP 0x00000006 #define DP_DST_DATATYPE 0x0000000f #define DP_BRUSH_DATATYPE 0x00000f00 +#define SRC_MONO_FRGD_BKGD 0x00000000 +#define SRC_MONO_FRGD 0x00010000 +#define SRC_COLOR 0x00020000 #define DP_SRC_DATATYPE 0x00030000 +#define DP_BYTE_PIX_ORDER 0x40000000 =20 #define BRUSH_SOLIDCOLOR 0x00000d00 =20 --=20 2.52.0