From nobody Tue Feb 10 20:30:20 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=1770065337; cv=none; d=zohomail.com; s=zohoarc; b=AIuCvR2NDbX7bkj5B5q1fWiY0me+3sMCg++siv9A5Sm7s5RZPN1EtaBT7EROqKS+h7rDsI1u7rI7SaFDkTTl85mYygm5bq5Xt2TdsGVc3bzhi1qCLuDb9UBDRWthIG3Xy9c2NujoY6vYB0NZToUR2VR8OVJMa40GRaYcCmYHbEM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770065337; 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=fOUovzOLUMyaxuLdbdnD5Z8HWqZ2abJbnyy+z2a/yhpUqiPBqxh5B5SHlDonvui6T3ECYn3hK+fmJi4nsV/51m4+KnlomleObQ1x+Fiwu8YB8plO6XQXEoEudZtJBagWneVgpv6UomI8LTSzOLUh2uVGulzsRlSyuE1RF0Uz2ag= 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 1770065337785658.5830756903595; Mon, 2 Feb 2026 12:48:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn0qC-0007Wz-Ng; Mon, 02 Feb 2026 15:48:12 -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 1vn0q1-0007Gu-VO for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:02 -0500 Received: from fhigh-b2-smtp.messagingengine.com ([202.12.124.153]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn0py-0001nr-Q1 for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:01 -0500 Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfhigh.stl.internal (Postfix) with ESMTP id 7BAE57A0096; Mon, 2 Feb 2026 15:47:56 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Mon, 02 Feb 2026 15:47:56 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Feb 2026 15:47:55 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id 3cb42c05; Mon, 2 Feb 2026 20:47:53 +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=1770065276; x= 1770151676; bh=laB0U4bo8HCPOWBM9uXAA+xB62yuJOctU/qX8DNsXjM=; b=D L+sOXwj9RRSK5NjnLmiNDI58YwGQ2wVIrXjLRbHp996Rel6FxrwXhIPVZhTuFv9s MVl4sR3FZl9RAq0/XH0EQPivLrsVIcsJQezTyJIv7l92P1YMql3uqwmFnFMNWC/p boYeHczN1Nj4q58jhlz/3umLF7OJu58EOUzoDg3oWtF3u33hjnG4wsfElXPJFMG4 uEORAm1HF08NQAf2HPFHhsQRIX3FoToiIavyTJefrFSZUwBXQbCnXFhwY2NcZ1G7 PeUw8DSD4I+cJufe73fxh7dhqtNzCMbkEVB4L+uCkrgZGKQHZ9gIuxMzVbYVAiZh mX/pQxJMbaqGAhmnoKmpA== 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=1770065276; x=1770151676; bh=l aB0U4bo8HCPOWBM9uXAA+xB62yuJOctU/qX8DNsXjM=; b=HjqWVdxBBWjdqVd/0 9Up8fzuohqonG/Mw5GBe+JKX+Api6GLLuMr8u6pe4PlEtv2y/h8AqjuP+aiEEo7L LHKOEaR2LWJqXiQ0XpXKPWrV4txaxwCvTZTPeIO7fAw7WPS/X7KNR76jBtzf5Cm+ IrY1EqCkfQVvxNY8Bo8faACgYtP/wzOk5dysi7BCzfBCePeYQyULHEq1N9sgEkC9 TClmPbzgwxb27sQ9JuPXJcnswkKpX/NmbZhEXY0mYiplr/0WDJrLvETHg1ITqMsW FBq9c/Lb7Fw23HiZrEK5VgEL40QPJJa+rdUY3E9ALX0moNUwaON9F+DXTRTH5Nty 4ir5g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddujeekieegucetufdoteggodetrf 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 v7 01/19] ati-vga: Fix framebuffer mapping by using hardware-correct aperture sizes Date: Mon, 2 Feb 2026 15:47:19 -0500 Message-ID: <20260202204738.3080092-2-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202204738.3080092-1-chad@jablonski.xyz> References: <20260202204738.3080092-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.153; envelope-from=chad@jablonski.xyz; helo=fhigh-b2-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: 1770065339877158500 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 Tue Feb 10 20:30:20 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=1770065403; cv=none; d=zohomail.com; s=zohoarc; b=VbsdswP5yGoSLo9TV1/8//bazPyClcBwj974Wmo+KHrnYA00wHRYLDxXAXK+wKVA/nJiwzg+dCjt8uIXTmTVxLPnDXj2pSV/wTMMKTQPbS/ia/d4HphfiKyR7cJaFegnTIpUtvviNc9OH857tFetOXXFjoFd3i5kWlv996sbrsQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770065403; 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=nK2y/Cyej38YimW5A/0xlwT5PakoNfhFvJJN991e98ubQ/ySWO0Y3WhXM6lJjFAw3Ks0MoM7LC0XoR+8ZJQL6byEjlgn9moNlZ/7/9Fu9lLvFRxsL+1RCIWlo1MZLTUyZw9OTtG0XulUi8C16fwRulxEDJ4Ra5vZdqwfvbTW8aY= 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 1770065403679766.2328113336729; Mon, 2 Feb 2026 12:50:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn0qZ-00083D-Kk; Mon, 02 Feb 2026 15:48:36 -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 1vn0q3-0007IS-8j for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:03 -0500 Received: from fout-b4-smtp.messagingengine.com ([202.12.124.147]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn0pz-0001nw-Ml for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:02 -0500 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.stl.internal (Postfix) with ESMTP id D5C901D00061; Mon, 2 Feb 2026 15:47:56 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Mon, 02 Feb 2026 15:47:56 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Feb 2026 15:47:56 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id d5c083bb; Mon, 2 Feb 2026 20:47:53 +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=1770065276; x= 1770151676; bh=ABtiVlaCZkrAUapG4ZkghRtl4BtewIcQLfaOOoKZZwo=; b=g I4Ygmf+0CTUmhPgGU98DLsZyMmoH1wdm79tRXtk0v2dzKYlyn0RotqNlLHQ+R/yn FyUzkMvgaEHK92V2ZKAUI5PuXJnoADS0ypCaLszgH7pCIL7Ib3OQ15fatokwiBBe raMj1+yjsFoi91cx6b+rJ+5w++ZNrs0PA5xDhc++ESUAPQZ2dZd5d/TaPVlrtmbv GGnOOREYH9ScDsM2WK0QZc/6ypBFS1QIHH4CeTkKinRsPUqhYrLehxMRS+JDjXPI OzOkRP96tqi8FG/+B23xVEhGDNq9I5yd9/Z+BssPO2A8fJX8XqDe9/m8lQbts+lt e6M+exgXi0tbUIwbIEY+A== 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=1770065276; x=1770151676; bh=A BtiVlaCZkrAUapG4ZkghRtl4BtewIcQLfaOOoKZZwo=; b=R6rHz9jqb+8HQcC86 kyKEKv9Gz9GlQhsaDudLyiSmoN2w/oriBUWqUk5uMm+f20dC9iHzHlHGvgQLBlil RvNpg9RMUV/ns2dkKcEQ902K+h8oUyPyn7sFQkWWkNThzv/kOIhf55irTJu/t87c KA5vhLcOyypfVUKUV12NnUDTE3srkeoYaYjW/3jDBx8vNUDk8MDp2Co4HnBWkVKU FcYUjm5oexRmPiwRbrfEXrM/02hcMxqAHaResXg/wM7E5D2yLdU+vn8BmCEsNAtq wGnvf65J4Q3YBiB8wsj2Wcpstt/xzN/r+xijY6hapFCA9z2dPnTZzAl7lJgvTNtt RhPVA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddujeekieegucetufdoteggodetrf 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 v7 02/19] ati-vga: Fix DST_PITCH and SRC_PITCH reads Date: Mon, 2 Feb 2026 15:47:20 -0500 Message-ID: <20260202204738.3080092-3-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202204738.3080092-1-chad@jablonski.xyz> References: <20260202204738.3080092-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.147; envelope-from=chad@jablonski.xyz; helo=fout-b4-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: 1770065405327154100 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 Tue Feb 10 20:30:20 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=1770065388; cv=none; d=zohomail.com; s=zohoarc; b=EZClh/t/S38y/v8lBoZJ3p1daOImUaRS2HitjqNbV8zSzuElu9uXIrRnR8f0Ec/5nZ2H1OF/B9e4MKduzeDLSKOTls8m56EDQuczl117JnyWSJhCBeOUgXlq6CXnEgi12Mt3TBMsUEEk0NpOGSgV2Hj+CoijstJOOTDUDSQeoh4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770065388; 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=gOPB7Kvxi/+TVVUr5k6oxVog3qo7WwiJMXS5tst74Vv28tc/ZDqHT3bzlqJq9K3dYm52HMhBMV5tAYMMoNKYP4a9ZX4ZpYxTBj3Rwoa4fgyo3dpBYwkSq44G7H5BHf9BCDJQpQM8EEjrh9qv067EQ6Leu0g1lUdQN39NWLbt8j4= 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 1770065388802415.8966028504791; Mon, 2 Feb 2026 12:49:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn0qZ-00082i-G3; Mon, 02 Feb 2026 15:48:35 -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 1vn0q1-0007Gh-T5 for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:02 -0500 Received: from fhigh-b2-smtp.messagingengine.com ([202.12.124.153]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn0pz-0001ny-4V for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:01 -0500 Received: from phl-compute-12.internal (phl-compute-12.internal [10.202.2.52]) by mailfhigh.stl.internal (Postfix) with ESMTP id 485B87A0103; Mon, 2 Feb 2026 15:47:57 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Mon, 02 Feb 2026 15:47:57 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Feb 2026 15:47:56 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id 5dcf922f; Mon, 2 Feb 2026 20:47:53 +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=1770065277; x= 1770151677; bh=UFSgWoKS6dct4PEaVxUuYg6ee7pN7SwnivHZWSj1kps=; b=m +Jpqk+RyIjheGwYRzQcM4qqq0Mhcp4QQMavEv1Xm+DPpwo8J8dghvkrtVzLxY/F4 6LB+WuCrgsXsTPVOhQILy39GorXgbMjNWjoN4ubz2984CxrUrnM3FzH3pypZcHJS 3BDXc/R/TZGq+tSq1kxq5t40fzzPLZ8SGwI0SYT5041LCd2t6ZFPpDIypm3WfRwR 7M5PBZcUMjb+L0Pbi5/aOryCy9hlwvncEpp8/BbJeltlu7ta7FEd3y9cIQIT5Oiu 2JCYsau0kZdcfZAPGLu0tfXJhQdHuimCK4V7A3c0bBlJDiUAp5G6bIhp1CJdmgcS 0gQbMhqQ6HOZ9Soxpr9qA== 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=1770065277; x=1770151677; bh=U FSgWoKS6dct4PEaVxUuYg6ee7pN7SwnivHZWSj1kps=; b=APl99w76l0Y1NGFME XElwOID5gFAX5qQeZ82YphAIO/FDh5Gmicyd1TvQ2wtOc7gt6PVCRucMWST3G2lE FF+fb/Ux4rumidRZ7SJpPKErD9+RcFFdqC99mqdA29gX+F2lBEXYcUFD+48mR5mE rrHfDiTJgEyUZLoSOXR1DaJzEZ8J3azF5kwm49ki2iw9gG23TfOVZon9TfqiFkYv gZMU8U4Nhjg+KNZwhr6Q5tNCjcRzDTMs/ElFE4WpqGf15DVU23S5iL87kZSsgMsA cC5SOS+S6kaaDyl6npl4mUc48qpInysyUkN5FFWsoOtPRIrsT3aqQp6ldsvUu/Z4 cR2aw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddujeekieefucetufdoteggodetrf 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 v7 03/19] ati-vga: Read aliased values from DP_GUI_MASTER_CNTL Date: Mon, 2 Feb 2026 15:47:21 -0500 Message-ID: <20260202204738.3080092-4-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202204738.3080092-1-chad@jablonski.xyz> References: <20260202204738.3080092-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.153; envelope-from=chad@jablonski.xyz; helo=fhigh-b2-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: 1770065391111154100 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 Tue Feb 10 20:30:20 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=1770065317; cv=none; d=zohomail.com; s=zohoarc; b=G3rnjtc5thmkGHYBqOXu5P5Plw8YN/8C7GOUA36iQoDUBCcZEnIuv4fiDVJaspKhm5McP/jiNBacpn2mezHzTos0pfjqj1+LUZqANuXEI69zc7C/U4Fv6oC0Qlgdohn/jxIAN5aV3pKULz3GNdC2oqijiMYN6NokQZQ/Gqmx8rs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770065317; 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=QA1nBTRbQCULZcYRpmtm2itas4CmV7yzUr4ST3dqwf3wdfmQ4Rd1lM3V9hfFbHu3BrjDy2ZM7CG6oOlM6C6u7V2pjZ2DwUTSwUdCzuDHhoQJpx5a3GtukRi2WJcSuDWuX8WPsipKXLyKY8SvmwLHg2kZgnlRj04EmsOH3g47GaY= 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 1770065317275248.00136338020377; Mon, 2 Feb 2026 12:48:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn0q3-0007II-DA; Mon, 02 Feb 2026 15:48:03 -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 1vn0q0-0007EW-EG for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:00 -0500 Received: from fhigh-b2-smtp.messagingengine.com ([202.12.124.153]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn0py-0001o3-QC for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:00 -0500 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfhigh.stl.internal (Postfix) with ESMTP id 9BE847A011C; Mon, 2 Feb 2026 15:47:57 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Mon, 02 Feb 2026 15:47:57 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Feb 2026 15:47:57 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id db4148c7; Mon, 2 Feb 2026 20:47:53 +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=1770065277; x= 1770151677; bh=iZFopa7BN2v/Wniu8RWnxAcgO5JG4vm8jdapubVGmHM=; b=p q33KUtD2/JoQsM23NjLpHkiB8tQizJ5+oGHeiKhzYg/gWZiySxWSQ1ssmdxhkAcV fLQ78sk6r5Amu250DFm92JRpkhoYWuosGYZ/9DW4Qx/w4PCf1FijdrStzjQLbanE rY96LkIecB8GPrw9R7AgDsTAy++vFBw29iI+XrOgJdDR4ntBH7e+5LCDd3V1mg3w 1HnK+YyWTmDEGYPo7kTG4Fw35HSVrytCI2cDj1Ch2CTfKna6lLBTmvSbJnehkSpc /AMeFkYq7BEji9OZAYByjnhwdge8Wwrzahygfy83XFOz41oEWzDwPUFUCncfSZmu vvnL/tozemkyrJzJ1KUqw== 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=1770065277; x=1770151677; bh=i ZFopa7BN2v/Wniu8RWnxAcgO5JG4vm8jdapubVGmHM=; b=XvUXC/ICTS7rIEZjP DPQtnYv51Rs2q8U+Q55TbqIX9WO7BzSl2ZPWXZ7Ik+npcZ3RtyQPe5dRzKNMnjWF MyC5rrV+viZ6CqER9hrNJwpyBHg4LIhoLpSNUQWzIrI/HVMx25nyKV11mqd6FY8L bAwU9J79CyXAb2FqKrq6jy3Smm4qIvjHBRyri2uQskyMF5K+LeTsrRRJ9eVNXaJF /Dr6LuQPTi2ID1QhTU7o9Gn08a9MAao2gM77hHYM9zN8PQa3bvhik6JMEVyk3UUm T//HWp44nQM9VodLNoqqQePYxwweilvJF2sMw3hf7a1yzXZqkfdPl/S4lBFMPpzV SQb5A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddujeekieegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg 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 v7 04/19] ati-vga: Latch src and dst pitch and offset on master_cntl default Date: Mon, 2 Feb 2026 15:47:22 -0500 Message-ID: <20260202204738.3080092-5-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202204738.3080092-1-chad@jablonski.xyz> References: <20260202204738.3080092-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.153; envelope-from=chad@jablonski.xyz; helo=fhigh-b2-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: 1770065320780154100 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 Tue Feb 10 20:30:20 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=1770065325; cv=none; d=zohomail.com; s=zohoarc; b=hKwnUKt+CC+iC06R4Xut3anPeugocSC8/x8Wa43v8dp87sMDR8B6g/DAoq+CaCZcEP48pEkXyaFziiSeU7sSTUZaimSl6JWPsY+6+ml0QmZGwVnfpSM+4teVXyCfHq2wjBr1l0EN+nC7XkVecQiV0X7VWprLCbiy2p762bCwDvs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770065325; 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=gP+r7R/ke3Ah80p7fdJIB078ryHsQfACzehsRm6eCUJ08WU5ppy9rbuI9XZa4lVVs009TugBBEeJXlrmIArlItgH/XAa4+2EgPV7244CenVHvrINGsMwAw8jIjqja/AXKVDjLb9LbRcPotQvnRf9/+qh/zhL+FQH5JHYf6QB0dE= 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 17700653254495.510751562306041; Mon, 2 Feb 2026 12:48:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn0qB-0007OP-EB; Mon, 02 Feb 2026 15:48:11 -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 1vn0q1-0007Gm-Th for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:02 -0500 Received: from fout-b4-smtp.messagingengine.com ([202.12.124.147]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn0py-0001oA-KP for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:01 -0500 Received: from phl-compute-07.internal (phl-compute-07.internal [10.202.2.47]) by mailfout.stl.internal (Postfix) with ESMTP id ED36F1D00099; Mon, 2 Feb 2026 15:47:57 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-07.internal (MEProxy); Mon, 02 Feb 2026 15:47:58 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Feb 2026 15:47:57 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id 91aae1be; Mon, 2 Feb 2026 20:47:53 +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=1770065277; x= 1770151677; bh=t09fhcpWk+aZIQ1AgyqKwCgGRfq7HEmlcpbHugFS7Os=; b=P gu53xuMOkUcgNGFc+Doyy0MNHDM/TuvumJmuikDV5d/FZUXWYKacQqFAFcG4Iieb JjMKDQlKvV/mRffUdMgavjXOXJkwxOkyyZc9NatWHxE68AaqPKUcic/EwNqZXZAb 1PFUUoHTJbC/u9V8FheDkaXv7goVScN68EX5TpN9tVRzq5hTQhUsYx2Twx9oE70B 5XOmxUvURMHK/OnjZA6LzlbZucRIrikAohCoYdpL9XgdhJ51H8tLgkjyE/rHaZZF DDxIkRqZGHPd2IOk9X1glydc/jpHxAnozdoKTC10WkwGlsi7rD7A9Qex8oZhZFPl GIcF30FFbhKW519EIM4Lw== 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=1770065277; x=1770151677; bh=t 09fhcpWk+aZIQ1AgyqKwCgGRfq7HEmlcpbHugFS7Os=; b=ngCnX/A4mOGLlCenu vT5VMHQhydCcSsacFjhyyDzTyLVn6fKhATExW3WBVKNzEkRqjpnNTVhIP1xeoieK C6WuV0QFXIIQ6+LpJK91h1cYPD0MoTIcPSUASuJGWP0+I4QUu3YtJOG/DSouq0v6 L3DUip4dybk0Mvf7HBLq0ht+jITthCmtGhZQmOTWys8d3Mu/2rnaizZDOYIAbHQt byB/Esr7mRoKu6MDOBsFqoaSz0fYTnmQVS3WUVZrpVPiPJZAlMm1nL3aNrq8XcgW 637GP9QNg4rTXfLlw9hYeOFTaR7y67Z7+lwSabHp55R4moER7DqyrrFjbZpxnXj8 HmRIw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddujeekieefucetufdoteggodetrf 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 v7 05/19] ati-vga: Implement foreground and background color register writes Date: Mon, 2 Feb 2026 15:47:23 -0500 Message-ID: <20260202204738.3080092-6-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202204738.3080092-1-chad@jablonski.xyz> References: <20260202204738.3080092-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.147; envelope-from=chad@jablonski.xyz; helo=fout-b4-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: 1770065328533154100 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 Tue Feb 10 20:30:20 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=1770065318; cv=none; d=zohomail.com; s=zohoarc; b=jALFhqGeu8nnYiPRwkPlATR7le78fou1q5zCb7cKW8yglbKJzpMdUSG8GsT2AHTsnGtJ1x/GD3b6XH4EbvZCVOuTAvn4zPODzcS8cuP7jfoukGdAw77JPaewu4hG7oYUtc62YtULe7eexSSVeVv2eDknxA6DD+So6MzLp3bS8aQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770065318; 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=guPPOO5gP6FbCaxdo8EjBTo31S00HfJSkcFKvJjKj/qewxkZX/2uk+/OgKqz46StP41kR1yuAOO5iQ3hl1ndfLy1g4SYafyOnf+LYmtVeFw8t5jYXGZyd6Dxj5EhILYwBGPWE/H2O2bf7MQybzVb8X2u0OnnGk+WUqphGP0mcgE= 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 177006531768861.48599501739659; Mon, 2 Feb 2026 12:48:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn0q9-0007NM-9p; Mon, 02 Feb 2026 15:48:09 -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 1vn0q2-0007HB-3t for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:02 -0500 Received: from fout-b4-smtp.messagingengine.com ([202.12.124.147]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn0pz-0001oH-4b for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:01 -0500 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.stl.internal (Postfix) with ESMTP id 42A441D000A0; Mon, 2 Feb 2026 15:47:58 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Mon, 02 Feb 2026 15:47:58 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Feb 2026 15:47:57 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id ce851c5b; Mon, 2 Feb 2026 20:47:53 +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=1770065278; x= 1770151678; bh=t0OpkvKmgs3r3p5IFcwqLrOzfIoWRJB1S+bWvMool0c=; b=m hsKPIMmbmDJIk3GT/gQtcfVSMh/fsaN72kRmb4SPKI0e+dgkPRTZ+VIl/lzEJ+SS Bcj16BUBOx02Zf84Ytq0Evq4u15qBJyjalpfsPfn/i2kc9IjLodrN+t+vtp0/GW/ uAHBRRQwuNyX88AG6X8O4B0qkUlmhcbOgpK2qdxDAHLotPlxiwVdDiy05tgkmsG3 8i4T66xUFpPXVhMm+hvUVDe6HLBvv6wqfiNn0sMuhU7d9/U6gJzgp7acMAPzVml4 1VmsmFg85uYachv7OTaSvsS9iSPzXBZtmJ0AQrBBTalWclQXIRwTny7otkEiQT+M 220lnJhQLgnqgYFRVAG9w== 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=1770065278; x=1770151678; bh=t 0OpkvKmgs3r3p5IFcwqLrOzfIoWRJB1S+bWvMool0c=; b=YwtnF/oNoTYq7rLr1 Gfwc5UPFRIN5KgtZfv/hEd0En0+gxb58VJc00+1Z7bUFldOfHghMmsBV5yN1qu4G vq8EhFKmyO6a4+F5m2qWqlkmGUNkIZcuGk8HL7XvX/gt1XUC+LDSGfAOymTOdIra IMp670UtvVymvMlW/fdFhjDRbkaDwlL7iBvf1IKyB/+db/EIMxvb0yze3HnaHi3u QaKHWLanensIYJXEB03fND+RvBce9HVNqbOymTI7KRoIbDc50skGTSy6Yc51nOs7 Bbtwiaeltx6xLvsXsleAf9bWUhfsmqx6ATPFYXopUp46bwHfpJMFhHGgWw+Nxz8Q hcgpg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddujeekieegucetufdoteggodetrf 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 v7 06/19] ati-vga: Add scissor clipping register support Date: Mon, 2 Feb 2026 15:47:24 -0500 Message-ID: <20260202204738.3080092-7-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202204738.3080092-1-chad@jablonski.xyz> References: <20260202204738.3080092-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.147; envelope-from=chad@jablonski.xyz; helo=fout-b4-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: 1770065320670158500 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 Tue Feb 10 20:30:20 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=1770065428; cv=none; d=zohomail.com; s=zohoarc; b=Sx8Ktu9PAmv0R+57QFPuQHP/Ffx6lguy9o6PU01WOasVjbcJU4gOKTMepMHjU+MV+Vyp2r6SfWN038uMjvbgmIyt+mf0raJaP9lXWW2D0tApTlnUyNwPnYfQvs8QWmXumE8SokPQk+1o1C8F6E6K4oqOqAMEs+KdZrZOFs41BYk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770065428; 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=h0qnMI07KY73P0x/U8rI8TIt22V4Q4gZeU8bAiKMKDpydF/vn4MrJGrMYqdgzV2IBfb7LAAjDkyUwUeGxvs5StJZ+EFg3A1ctAfNoG0w4UtPxHeF2zZyQkdxWDyzXTRz4b+/btNgzp2U+B9z6EslTSoPzkzEp3oZVIar+pXR5Ws= 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 1770065428427343.7698658486702; Mon, 2 Feb 2026 12:50:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn0qC-0007WH-KV; Mon, 02 Feb 2026 15:48:12 -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 1vn0q3-0007IT-8k for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:03 -0500 Received: from fout-b4-smtp.messagingengine.com ([202.12.124.147]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn0pz-0001oN-Bj for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:02 -0500 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id A74311D00094; Mon, 2 Feb 2026 15:47:58 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Mon, 02 Feb 2026 15:47:58 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Feb 2026 15:47:58 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id c7ba76d2; Mon, 2 Feb 2026 20:47:53 +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=1770065278; x= 1770151678; bh=jEmCW2CJeKwiBoliiD/nWnWhBy0/mPCAScNKxecv+dg=; b=R XYnXAIVWRxmBwewuAUVMTQru3DQCGzw9Dm6wSdsMmecxjremGlHtUbr/G1+cHZEg UaRuHRH1uvppMXb/zvZUpH8ExYDFf79hyRbnWYbJFuCYY0gGPkeLRynhENapXyt9 /dOjLi1ORPWIHOU7ZMlXruTPBnvEt6Y/nhosVoh6X/QC1nKUjL01bJFXYZgTxyIe 8tXP0HcM/bkn2mha6apKKEwZwDolYeweWhsMbGuJ0vHWUmTBEMEpP6o6/EqLUZTz W3O8Wdg6ECVr9TUMVdXMcI6eLyktQH95WAxc3ElpoaWsdYbm8kZa+RKlQjcaf7NU ApNj3pEaJlOLsvD40fBKg== 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=1770065278; x=1770151678; bh=j EmCW2CJeKwiBoliiD/nWnWhBy0/mPCAScNKxecv+dg=; b=K90OzCCvPU8T9JCLh jMx9kL/ZWrTwg/4y0cWVZnrFACMWfQR2iGx109L5l5wLvp0qeMj+3vinEA9EGLbl AV/xEJb39IT4VG53h3x6D/GlD9kpZVkwFO0Ih8DIIGl04Bva5sIaB9r3Ibpoq+tI I3ucVzapi8RQ8Mp09FZNHWfKZEx5zIbmaFLDLuX1532gduYVF08Fry0XhXVpiNpB 5Xc0rUNij7xb58zWnQg4rQC7hr4q0sfhvyTT3vHdhYVPebqEgOfGc0k42o5+tta7 maeND/ZCuaSIzX2XHc7KnKjT1qu8fNfSf+cpsfSnNEv5i3izR2a/iltRiqOf5fJY 5P3EA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddujeekieegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg gslhhonhhskhhirdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopegthhgrugesjhgrsghlohhnshhkihdrgiihiidprhgtphhtthhope hqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepsggrlhgrthho 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 v7 07/19] ati-vga: Remove dst_x/y updates after blit Date: Mon, 2 Feb 2026 15:47:25 -0500 Message-ID: <20260202204738.3080092-8-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202204738.3080092-1-chad@jablonski.xyz> References: <20260202204738.3080092-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.147; envelope-from=chad@jablonski.xyz; helo=fout-b4-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: 1770065429994158500 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 Tue Feb 10 20:30:20 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=1770065387; cv=none; d=zohomail.com; s=zohoarc; b=LRtkcU65s9YfH+TyRmf1e54GC31v08QvGdsDeqs+4NEZE1Dht58MoEI/eyBPCCojTiMZEAyJeGQDwD7lIAzDi+DSy9HpR5hdvhy3UYvr+CCsZKHBook0BC52pIwGVMf+l7hLETsiG4rSdaLofrVcZd+NWzdTEG+nNm9thhnw4Bk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770065387; 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=lJwdGWGm0WCYMn5yewhyAuzgs9lLPJTMXAV8nHZt22I=; b=NBxyhYEIb+qxvCK0UNCrU9uFKNynOrHJ30hZe/cYl14Qwj1B0nbNoMFtYbV9RhNI31Cnh7czjKTaHn4fjbxYSxtt3/j0PFS9bpadx1+Da7L59/BmTAReWArCOpR/kHYKE3w5+7dFKniJIKBCqi0+EUA3q+GcMLBxTLSXanXZdSI= 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 177006538734483.99857960903535; Mon, 2 Feb 2026 12:49:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn0qa-00085t-Rf; Mon, 02 Feb 2026 15:48:37 -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 1vn0q3-0007IR-8T for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:03 -0500 Received: from fhigh-b2-smtp.messagingengine.com ([202.12.124.153]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn0pz-0001oQ-My for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:02 -0500 Received: from phl-compute-07.internal (phl-compute-07.internal [10.202.2.47]) by mailfhigh.stl.internal (Postfix) with ESMTP id F00307A0129; Mon, 2 Feb 2026 15:47:58 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-07.internal (MEProxy); Mon, 02 Feb 2026 15:47:59 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Feb 2026 15:47:58 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id 945d8683; Mon, 2 Feb 2026 20:47:53 +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=1770065278; x= 1770151678; bh=lJwdGWGm0WCYMn5yewhyAuzgs9lLPJTMXAV8nHZt22I=; b=F nIa+SMtRgqleP/rpPN6xjNNcLPjbhoQdt1GBhOVKFiB8v0FfohfTX6lfbGxm+Mo6 E/krA7VY8geudR6sl45UIQpHt2BFdqaWI2fkNDNXz6lnaOj0jpkIWuy+WgeGt3B7 XURp/Ve+tWUuZ648ZXHpCDB6P2nQ57cONlJkUrkMa93BXD5Da1S9un8oKCqHhJVO axsC/Ex5YO9k7wdp/r8+MHmplT/1cH4WfKRZVXaJmpwjqhpqFFNSuRySs2mqHSVE LHWruF/PXJST/1ilTdJxqvrCRxk10ajb70o7MQoVj0r0deo3YDR7CN+tUM/8WXKG WUnpxXXclD9ky9cEaDiPQ== 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=1770065278; x=1770151678; bh=l JwdGWGm0WCYMn5yewhyAuzgs9lLPJTMXAV8nHZt22I=; b=Y0gHgpY/vf+6zSoWd SCqyoRgzVg7ssz0UPzQAm7U6MQFxayAAWMDlLy/fvjHy3XF53hkxal31dz2IO5jV BAx7fwGJmMT9rZlmrvMSZ9gY85bHZIVEpBfK+shMJoMQEgXR9yOsA5jbF4yGpLvW Typ342IAkG9p7H7yQkzVTUr+O6AkAM84kIemF1VttQl/MRUK6nFcs4nyKT++yfIU vT9Xkwn3rN0mCD3wIAb5AK0AzgSYEgt14tT8Gc8D7+3Z8TKtIarABd9ceL4SsrFZ izY4DsDzrPJnA+VB6OhIGl3x4dc/BeY9sOcC7X2SyedRQmIDr3ZjQvogqP8cXkBI csYqw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddujeekieefucetufdoteggodetrf 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 v7 08/19] ati-vga: Consolidate dirty region tracking in ati_2d_blt Date: Mon, 2 Feb 2026 15:47:26 -0500 Message-ID: <20260202204738.3080092-9-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202204738.3080092-1-chad@jablonski.xyz> References: <20260202204738.3080092-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.153; envelope-from=chad@jablonski.xyz; helo=fhigh-b2-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: 1770065387864158500 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 | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c index cfc7bf9789..5d24d11d7a 100644 --- a/hw/display/ati_2d.c +++ b/hw/display/ati_2d.c @@ -43,15 +43,29 @@ static int ati_bpp_from_datatype(ATIVGAState *s) } } =20 +static void ati_set_dirty(ATIVGAState *s, const uint8_t *dst_bits, + unsigned dst_y, unsigned dst_height, unsigned ro= p3) +{ + VGACommonState *vga =3D &s->vga; + DisplaySurface *ds =3D qemu_console_surface(vga->con); + unsigned dst_offset =3D dst_bits - vga->vram_ptr; + 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), + rop3 >> 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 + + dst_offset + dst_y * surface_stride(ds), + 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 +180,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 +222,14 @@ 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, s->regs.dst_height, + (s->regs.dp_mix & GMC_ROP3_MASK)); } --=20 2.52.0 From nobody Tue Feb 10 20:30:20 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=1770065373; cv=none; d=zohomail.com; s=zohoarc; b=mg89WnYmFI2P+nGxX7LeoAeug8wG4RlQFfWncCoZM4n9BX25sIYzzY2JNdXMTVTOxt/BIxXR43wsKIGL0QEwgARfRPhPr2K0t0abR9LU3+xyB/hWJovdMg7Oxj7cedKdo/nFJCcMp0fOhdqOzEU4LrpnK/AuDPu0ln2fgy5o8nQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770065373; 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=6bj5sIeQrzcgA+I7zOwDmSSTxJBOe/eU0fzJwdHATxE=; b=hBTtX0dzRUM7uNILF5pGp1Jv5HqWan65Bhmo2YlPQfXVEJGBCrGm9M2OXh6pVQ/HlEILehgLxxuUa4pcAgvZu1tpgoeqmo7W9TZfDn2j8TWndy9exkB+9Tii3sG9nal/5SKH49xc7bRm6m2QXfPS1c0X+wToiUefet4EfatMy38= 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 177006537270495.0100186851256; Mon, 2 Feb 2026 12:49:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn0qu-0000QB-N9; Mon, 02 Feb 2026 15:49: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 1vn0q5-0007Kx-Gf for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:07 -0500 Received: from fout-b4-smtp.messagingengine.com ([202.12.124.147]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn0q2-0001p0-7U for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:04 -0500 Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfout.stl.internal (Postfix) with ESMTP id 0C92F1D00115; Mon, 2 Feb 2026 15:47:59 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Mon, 02 Feb 2026 15:47:59 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Feb 2026 15:47:58 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id 3bf59918; Mon, 2 Feb 2026 20:47:53 +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=1770065278; x= 1770151678; bh=6bj5sIeQrzcgA+I7zOwDmSSTxJBOe/eU0fzJwdHATxE=; b=T 4gDb5+ykaSedoBGSK76T+e01GmHx4JhBbZ/b2PaJOoyMhAt+Kon9a1s0qeANdnoA SQdoqIPNx01ObwC0sJDc4DdTkOokJqS9FRxSEDASBux1ehOzRh1locZQ0I1MOXYu LtIPMaisCrz4YJmgKlG9bjIQx3vOGp9bqMUV6jxaiWQ3ozpVBbEY4xVuDIbyAQFs ie7hdGaDgDCX1ybOM7bL6A95B3emoyNk5lrAGgNiBUiQ43mUeTW00xegMKB7l8A8 P93iZFMeUwqlmfD3gNGlPULmeuOdXgU78rUpfk4+U5O8EONXRwgZwBlLemWnmzQq TLLRwdWzDgf4dGCedERDg== 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=1770065278; x=1770151678; bh=6 bj5sIeQrzcgA+I7zOwDmSSTxJBOe/eU0fzJwdHATxE=; b=XusZxB24FFUVHEpIL iHNbR92uxYHKgLqYTpCROOVpLi+q/QHMGMa7A2s/VuLuSOk6K5ks4d7H1P2aCWtY nNqqiQIIdUC71CZRt5BIfLs6Bc2yILTXJ/LmPG6dZYssbyWYivNmpcghWudQB81m L0suXNijRZ3RIh459JJDN9ApgzA1Prn9Njjbbch20CZstHV77NsIDprLLQCt6sc3 IRdcGY7VroEBVbyQo812mt42OrSKxpD4Qw1AzRcTkEFs6TgdUtbBe2zNwCsh/LBv f8xqHfytwoJC4TOU7DOzFx+0Sk44ahZyGKOawl7mkyteI8rgZjJrbJbjlhj+c6Jl 22CTQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddujeekieegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg 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 v7 09/19] ati-vga: Remove src and dst stride mutation in ati_2d_blt Date: Mon, 2 Feb 2026 15:47:27 -0500 Message-ID: <20260202204738.3080092-10-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202204738.3080092-1-chad@jablonski.xyz> References: <20260202204738.3080092-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.147; envelope-from=chad@jablonski.xyz; helo=fout-b4-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: 1770065373816158500 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 | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c index 5d24d11d7a..f6c65ef3cc 100644 --- a/hw/display/ati_2d.c +++ b/hw/display/ati_2d.c @@ -86,6 +86,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 @@ -119,6 +120,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) { @@ -126,18 +128,18 @@ 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)) { @@ -147,12 +149,14 @@ 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); } @@ -164,18 +168,17 @@ 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_stride; + j +=3D (src_y + s->regs.dst_height - 1 - y) + * src_stride; } memmove(&dst_bits[i], &src_bits[j], s->regs.dst_width * by= pp); } @@ -202,21 +205,21 @@ 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, filler)) #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 Tue Feb 10 20:30:20 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=1770065420; cv=none; d=zohomail.com; s=zohoarc; b=GnEp3notsYbX3xeLrAmjWcX34j/MasC+bpuzzyzZcINBwZi7TGUiK78L5oYbE0ecNe/uF+IYvNPPOOtTCIL5wPrb3SoB2uQFlknRSKiWFxjmKPUC2Z9rVgmeC9+blvAHJ4Zi/Qy9wjvKftPBk+JLsT8+dEu02FqVfqs5kbMmhZs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770065420; 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=Re/4vw/A5y7XSktGEE7m1zgFJMp9sr5wP54/GaUoWmE=; b=DiPMQU8AzZXFgGnDra/3/eVAwgKGC70wNtIihcLbqY7NMkniadvChziwFluThcw9gkii5mmp1W5BNdB3kjkIW3+2RLucrfsAlWlvYgbMte76aB9YghFYIgObwVhET8VhQBK0a0yzSM39427uNR0CiA2KbCt8RvtRpCdwQ8tFX+8= 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 1770065420142274.47682363353647; Mon, 2 Feb 2026 12:50:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn0qU-0007qM-IL; Mon, 02 Feb 2026 15:48:30 -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 1vn0q3-0007K3-JP for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:05 -0500 Received: from fhigh-b2-smtp.messagingengine.com ([202.12.124.153]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn0q0-0001oV-1b for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:03 -0500 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfhigh.stl.internal (Postfix) with ESMTP id 56D117A0165; Mon, 2 Feb 2026 15:47:59 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Mon, 02 Feb 2026 15:47:59 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Feb 2026 15:47:58 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id e6772d62; Mon, 2 Feb 2026 20:47:53 +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=1770065279; x= 1770151679; bh=Re/4vw/A5y7XSktGEE7m1zgFJMp9sr5wP54/GaUoWmE=; b=V Ch2fU9WHjPIQj2Sj7Z5aCRHLUNv8zJPDzSPmDgryOv00JD+kxwWKwt7v4dduLp7v 1DD4Ahim2uKAVjB4nhpIBp7FigJJGO+UPex2XPJrX/s+jnCIEnZpYZHb6bYwipl7 EtOkSz7KjVj5ptkuGIyCrLAcHGVmFhBu2b4Py4QdeAHc8doOEPECm75gVGRFllf5 kR6cwZl83u9Il5dAfcDh7JjC4j/bOi/df3Az8bHyhuZ5pQiF9K7ENoWDViTivmWd +BvShCq89gf3rjcXSMss2uQxDxbpBJ8emlZaDUJxFVQisvYAZ2NWgNj2x3Kz+2Ky ewaC6TXNm9UGBylyKy0Ag== 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=1770065279; x=1770151679; bh=R e/4vw/A5y7XSktGEE7m1zgFJMp9sr5wP54/GaUoWmE=; b=KAj0mZbZXJZq7DKSy opZODzlDAisJGPkEc1McSLMaBm1gXaq3VbeivpafzDVeqZvOHY20KlJKnI8Hp4JV G7ko6XI/pJwrZJZmKP6rQbHt0CAbUhxCxc1VfnNmwtGNe6auuOiqc5nJd52pU8CW mcviIOnGF7uJVl8VQn8quKBwhP+/f4IqZI7/AH0+MbeRo+ANZtG1FwCs9eCYx2zR ny3++hgLvJ5EBmuKDMb1suD/YUG4g82LnO9sMZT9iYdsJrRC/g7L6j7cy1C/0btm FDTGvSthNFPrsdhfqjnHk8iQrDPjfERtFn//7ehEWReyX5gWEWB+A8H1R2ZgeEEE pWcDA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddujeekieegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg gslhhonhhskhhirdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopegthhgrugesjhgrsghlohhnshhkihdrgiihiidprhgtphhtthhope hqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepsggrlhgrthho 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 v7 10/19] ati-vga: Use local variables for register values in ati_2d_blt Date: Mon, 2 Feb 2026 15:47:28 -0500 Message-ID: <20260202204738.3080092-11-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202204738.3080092-1-chad@jablonski.xyz> References: <20260202204738.3080092-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.153; envelope-from=chad@jablonski.xyz; helo=fhigh-b2-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: 1770065421861154100 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 | 102 ++++++++++++++++++++++++-------------------- 1 file changed, 56 insertions(+), 46 deletions(-) diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c index f6c65ef3cc..b763a4728d 100644 --- a/hw/display/ati_2d.c +++ b/hw/display/ati_2d.c @@ -66,10 +66,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"); @@ -80,7 +90,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; @@ -90,25 +100,25 @@ void ati_2d_blt(ATIVGAState *s) 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_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"); @@ -123,7 +133,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; } @@ -132,33 +142,31 @@ void ati_2d_blt(ATIVGAState *s) 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 @@ -168,19 +176,20 @@ 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) + i +=3D (dst_y + dst_height - 1 - y) * dst_stride; - j +=3D (src_y + s->regs.dst_height - 1 - y) + 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; @@ -191,36 +200,38 @@ 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, filler)) + 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); } } @@ -229,10 +240,9 @@ 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 - ati_set_dirty(s, dst_bits, dst_y, s->regs.dst_height, - (s->regs.dp_mix & GMC_ROP3_MASK)); + ati_set_dirty(s, dst_bits, dst_y, dst_height, rop3); } --=20 2.52.0 From nobody Tue Feb 10 20:30:20 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=1770065386; cv=none; d=zohomail.com; s=zohoarc; b=BqfGe+X9t5OoU1oYn9i9KFFAhNk3MSJqTQswLpY8fga7dbAQvYbxCUDow930DItq1XoonHYemjzqobWJX2k69T4rABSbkjKQVRjKboOxNs96slqOZPJJ6yvyZGiDIkuI5n5t+CTiA0tuYFYmrDR/I7LId93m3BVebo/hm4VWu3o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770065386; 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=gMwixMRjVmgBA8LRn70jMSWmqMmqnvbDSFw+DG0Gkg0=; b=mKlPI2jYGl6ccg6x1BiLdt50l86z9MAR1WPSpJ392nmPRbBhsIFXN1IrOYD3qI3Puc/9k4gVSkZP2yKm9rwI54yDExiQHyWZqsS5MDoD36Poit1U7o5in96fDnPNo+Nnt3sYOfUflZfmFsvawDravUGOcO1yo+UGc0HbLZtdpao= 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 1770065386482584.3463623933653; Mon, 2 Feb 2026 12:49:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn0rS-0001j8-72; Mon, 02 Feb 2026 15:49:30 -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 1vn0q7-0007MX-Bb for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:09 -0500 Received: from fout-b4-smtp.messagingengine.com ([202.12.124.147]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn0q2-0001oz-Vl for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:05 -0500 Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfout.stl.internal (Postfix) with ESMTP id AB5CC1D00103; Mon, 2 Feb 2026 15:47:59 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Mon, 02 Feb 2026 15:47:59 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Feb 2026 15:47:59 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id 0137ff56; Mon, 2 Feb 2026 20:47:53 +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=1770065279; x= 1770151679; bh=gMwixMRjVmgBA8LRn70jMSWmqMmqnvbDSFw+DG0Gkg0=; b=l qpYKDAtEo1KO6nvsi4Efm5phUyMRDzHIN5+XLgRR+LoQhSpZ+JJ2XOhxnWflHQ2R s8ToMyFGna2gqCGRB2ti1YEz39AdN5hws2mBUQ0WNS02pHBLcdlbVonHCVUkf9sL F+Wfipe9Wg2ehTGFgPVA59dpYGbN7namP15NzIajifUVg6MREcaGyQYciuSdJinV a8/tasyeZE69CajFzhQw0pmVkewHn2/1cEj5N7Zjdu6XOCeSgE8MLPEOu64wTpsv GU0nSsuY9/yy41ed94LP4xgtDNowQXV4I84RT3JKKLCLkz/WgfDRh2rYHLHuCdhJ Y0D3MUqqd9EBrTNREXx9w== 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=1770065279; x=1770151679; bh=g MwixMRjVmgBA8LRn70jMSWmqMmqnvbDSFw+DG0Gkg0=; b=kU37K3biA648Tt1cX yVFUWV3HezSJbBFImyB8sMpNi3pZhVnD7mYjij7ur+E4ZWU8OUd2R9+01je6I9KV WsIhDjxETLdwbBw2+e1UJRjQapAqEb4DGn58oxnvItP4CVX7yw0nRVMK/Q4j1h4X GWnoMaVW6EjltYfn/2MrrKWRPc2Z3xosNmS8ocB9GzOI1zAEFNWEHblzCKG9Adrd bXAm2FM5kokwGw49lguOzaLvHmm3gHMCbP6+gvx+yqjSQKyBSVsvGPPqjedTwMDq 2hpr0rBFD8eONLByONTwZ5RUegISByq2SbOeDNtlX8MH91xOQLP7WreyiVDFXRfx vHUOA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddujeekieegucetufdoteggodetrf 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 v7 11/19] ati-vga: Introduce ATI2DCtx struct for 2D blit context Date: Mon, 2 Feb 2026 15:47:29 -0500 Message-ID: <20260202204738.3080092-12-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202204738.3080092-1-chad@jablonski.xyz> References: <20260202204738.3080092-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.147; envelope-from=chad@jablonski.xyz; helo=fout-b4-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: 1770065387942158501 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 --- vram_end feels a little out of place to me in the ATI2DCtx struct but moving it into the ctx allows us to eventually remove ATIVGAState entirely. I also considered moving the dst validation that requires it outside of ati_2d_blt and making it the responsibility of the caller but that has its own downsides (forgetting to validate). In the end I left it in the ctx. --- hw/display/ati_2d.c | 231 ++++++++++++++++++++++++-------------------- 1 file changed, 128 insertions(+), 103 deletions(-) diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c index b763a4728d..390a5eef94 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,22 +44,38 @@ static int ati_bpp_from_datatype(ATIVGAState *s) } } =20 -static void ati_set_dirty(ATIVGAState *s, const uint8_t *dst_bits, - unsigned dst_y, unsigned dst_height, unsigned ro= p3) +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; + + 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); - unsigned dst_offset =3D dst_bits - vga->vram_ptr; + unsigned dst_offset =3D ctx->dst_bits - vga->vram_ptr; 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), - rop3 >> 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 + - dst_offset + dst_y * surface_stride(ds), - dst_height * surface_stride(ds)); + dst_offset + ctx->dst.y * surface_stride(d= s), + ctx->dst.height * surface_stride(ds)); } } =20 @@ -68,105 +85,113 @@ 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.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 + 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) { + 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, + ctx->src_bits, ctx->dst_bits, src_stride_words, dst_stride_words, - bpp, bpp, src_x, src_y, dst_x, dst_y, - dst_width, dst_height); + 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, + 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_words, dst_stride_words, - bpp, bpp, - src_x, src_y, dst_x, dst_y, - dst_width, dst_height); + ctx->bpp, ctx->bpp, + ctx->src.x, ctx->src.y, + ctx->dst.x, ctx->dst.y, + ctx->dst.width, ctx->dst.height); } 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, + ctx->dst.height); + fallback =3D !pixman_blt((uint32_t *)ctx->src_bits, tmp, src_stride_words, tmp_stride, - bpp, bpp, - src_x, src_y, 0, 0, - dst_width, dst_height); + 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, + fallback =3D !pixman_blt(tmp, (uint32_t *)ctx->dst_bits, tmp_stride, dst_stride_words, - bpp, bpp, - 0, 0, dst_x, dst_y, - dst_width, dst_height); + ctx->bpp, ctx->bpp, + 0, 0, ctx->dst.x, ctx->dst.y, + ctx->dst.width, ctx->dst.height); } g_free(tmp); } else @@ -175,21 +200,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; @@ -200,39 +225,39 @@ 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); } } } @@ -240,9 +265,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, dst_height, rop3); + ati_set_dirty(&s->vga, ctx); } --=20 2.52.0 From nobody Tue Feb 10 20:30:20 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=1770065353; cv=none; d=zohomail.com; s=zohoarc; b=VsmQ9YS9DT+wRMH102YuHk0DMrphzArP+J5wpGm4JYgqcGbit4GzR3Jl4AH2yoXAPD8LQKnA6zPr/y6FG1ATU+EfyW1RppmvyaGeaXY0UzZqI43ZXVURPg3UuOipCsrASnvBiuQiAMe6yXNmOJkgJCmp3aWBkEo4237iaZFkLcw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770065353; 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=SPK/W1oLlXR+cpV+Q0YuVaswxYS9cZBGUpMQqldutCc=; b=UOYTlvGaZKqZJ6BXBttuTKe+oHx5cBI25icXh5VRWcWNL3BSWMKKGenxMgPM7ZBBREG3XeRAEy/tT5kaKmytAd7YHX6Umu2vsS5sF8yupJD3ctsf3Dyy8oI2I4kXIDll4b2iW079gDyeEsj1nhPMaMoG2VMVbR9gC/4QjZfRvxE= 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 1770065353303422.84778182634386; Mon, 2 Feb 2026 12:49:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn0qD-0007Y5-CR; Mon, 02 Feb 2026 15:48:14 -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 1vn0q5-0007Kw-Gf for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:07 -0500 Received: from fhigh-b2-smtp.messagingengine.com ([202.12.124.153]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn0q0-0001og-Rp for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:04 -0500 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.stl.internal (Postfix) with ESMTP id C2CDE7A00DE; Mon, 2 Feb 2026 15:47:59 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Mon, 02 Feb 2026 15:47:59 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Feb 2026 15:47:59 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id af239bcc; Mon, 2 Feb 2026 20:47:53 +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=1770065279; x= 1770151679; bh=SPK/W1oLlXR+cpV+Q0YuVaswxYS9cZBGUpMQqldutCc=; b=f ohje4ebpIJwpnKiYIZBKj2EKEjE0ZaxEVUhqX8h7CL9JLezqnYT6sJQkZWrZguBu YLVFo+4H4j3XfF+5+VKVNkzwZlZ1V8Uo0EeSvcfnN3M4JA8E/ew6JwULw94C+7HA afkT0TghgGUEFKabzHjr/tCbVYI91STQ6GXSLQH5AP913tSTy/QtHBe41gMFv5K6 Azh4AouO9UBrOAXFlkJjXkIFcKDRtWAop6ZPft4o4sIMDxoIOq6U2tH4/dE5cIPN +0tbuwq20kTEFhJRW6JYmbthYjNjAgCeuPb8D/KvPOlQYpwyjlIRWkP85onsbCpI NqeKBvW+M5nGdWEVHmTJg== 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=1770065279; x=1770151679; bh=S PK/W1oLlXR+cpV+Q0YuVaswxYS9cZBGUpMQqldutCc=; b=vLy/LD+51LGlPlZi1 ysSQwOT1PbV7/BSXfyh9wDiGMZX7Fdd/lx0zUW/EVHfoFYl1YUhxFDtOjTtF+wtE NUQs8WzdlB02JUht5mkxkqSfDqW0UEWYZbndUE1Dmd8E1Ti5mQmlPEcXtxHdxqtk x9VWyohCu2rU6VdSAR20NmhCqqxSJ2spegKDnKcg8TtRuhq47Bq65O0hu/DJ4eFJ 7hYBo9wMLOHjeedouf0C5GirCgCXH0B126UFgeefcmA6c6jdt1+102ExuIcwKiB/ wUqXttiFqb92ZaCVEUfXlCbJDRJVxSa+J+btTJkM+3kIOUAmgD81E2jAGTTMWt/b Yw4Pg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddujeekieegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg 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 v7 12/19] ati-vga: Extract setup_2d_blt_ctx from ati_2d_blt Date: Mon, 2 Feb 2026 15:47:30 -0500 Message-ID: <20260202204738.3080092-13-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202204738.3080092-1-chad@jablonski.xyz> References: <20260202204738.3080092-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.153; envelope-from=chad@jablonski.xyz; helo=fhigh-b2-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: 1770065354782154100 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 | 76 ++++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c index 390a5eef94..525f20d83f 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: @@ -79,44 +79,66 @@ 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); - unsigned dst_offset =3D s->regs.dst_offset; - 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->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 + 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 @@ -124,32 +146,14 @@ void ati_2d_blt(ATIVGAState *s) 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, - 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 Tue Feb 10 20:30:20 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=1770065423; cv=none; d=zohomail.com; s=zohoarc; b=mbn5iga0t7WCePyu9TDj9Zbb/LlYsrpBuEkMOPLsG8g5BCYM1yZASxAUahJlnuj0gIY2UD/8OxeRz9ovQBcrnkCtTrif7M7l33NWG01fZppBZZmWXBOWQc6UibtOQIK5uXsrF9Vpb8SbEGiL1qFhQruphumAZMTLCZj0Lu/jcKQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770065423; 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=UqNwsCiSrH71LGk/v8LfcK0YBEsMqDLImOdauk74CLE=; b=DtQQTkZFsVH54zE4olDeQO+uptW+i1J04w02iYijhXV+d0m3LMopmus+FhRZo6FtKqXJEyZScPfKQky/x5G6ykqFtk1epJR8mby3ElITC3QoiGGi2pv4RrIgdOzlBh/JVTuNW9UBahxRegNFkSuCRie9Iw56RZruCwa57+qMwrk= 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 1770065423827761.0473927814407; Mon, 2 Feb 2026 12:50:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn0qE-0007Yu-NH; Mon, 02 Feb 2026 15:48:14 -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 1vn0q3-0007Jv-IR for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:05 -0500 Received: from fhigh-b2-smtp.messagingengine.com ([202.12.124.153]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn0q0-0001oh-RX for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:03 -0500 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.stl.internal (Postfix) with ESMTP id 0CB0A7A016C; Mon, 2 Feb 2026 15:48:00 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Mon, 02 Feb 2026 15:48:00 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Feb 2026 15:47:59 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id 455ec311; Mon, 2 Feb 2026 20:47:53 +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=1770065279; x= 1770151679; bh=UqNwsCiSrH71LGk/v8LfcK0YBEsMqDLImOdauk74CLE=; b=T z22I9Hn9pYxS583la0/gaZD52GCLXVqdxBciLtFcG4BrpJozD0Bmuo7QMHzRJJAZ sZqv++W3phrw1+e3gfAZxB2Dq+Oh5wZpWzXAESs2IXOUJw76N058C7GIdZaTpnJU 9zcTzk6d+/8dEM1/ZeB/K3/Jc88sJvnN05j+cTFOZgkSTHbtqJJiCZm2W9otL/Jx 1vL72XI3YBT80Nv9kZjM1PbuSlIWHylGR4Wkb5kX6YP3OSBNZixnzfhkhvZqueSn IFQncFNXgNv4A+yf/07uToSD+stMc2+iX3ZzERUBbrEFzfxwW8guHz+QL5VW69rT ghCALts54Pb1xptc0q8fQ== 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=1770065279; x=1770151679; bh=U qNwsCiSrH71LGk/v8LfcK0YBEsMqDLImOdauk74CLE=; b=HU3n5kfQi+egH1RXP GWHKTcVOZVZUTm0cAw9o6KPfqCLaMRK6vGbMZZtVB7s5sZjkIPZTLd2lcvEekNQf 4y200v1rFZUNKL3o1pjkELqNmljGxrURHZSyZzZIsGL+zMcjT2kFxDe+iR8x69b3 19ZDDJHXvmtugQPFrDuYPqdXw9nGnGEYtxWSUzTe/9f+/mbqKtxCHwzN/Lv2fDd7 8iVFl3iILJvOVWEV0i3mM1lJIyLNc4N6XG4bftOxgAQIcDGGiE/4JXKobN9gk2p2 Ta6JfY91/zi+jMzLJqn/C18rffNEWOcGZKPkOLLq6Gk7j+WJLEiuhmwX7smTitgE qrRBQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddujeekieegucetufdoteggodetrf 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 v7 13/19] ati-vga: Split ati_2d_do_blt from ati_2d_blt Date: Mon, 2 Feb 2026 15:47:31 -0500 Message-ID: <20260202204738.3080092-14-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202204738.3080092-1-chad@jablonski.xyz> References: <20260202204738.3080092-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.153; envelope-from=chad@jablonski.xyz; helo=fhigh-b2-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: 1770065425643154100 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 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c index 525f20d83f..4216986b6a 100644 --- a/hw/display/ati_2d.c +++ b/hw/display/ati_2d.c @@ -121,15 +121,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; @@ -275,3 +272,10 @@ void ati_2d_blt(ATIVGAState *s) =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); +} --=20 2.52.0 From nobody Tue Feb 10 20:30:20 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=1770065381; cv=none; d=zohomail.com; s=zohoarc; b=Hzie80Ua0S9e7P+MG5m6V9qrywucY3bX2BvX6oMDA0F5GHgBb7ijA55f5HUwSgSS8EZDMkXGH/CZKMwSq0+ct00Y/hMXLQR75vfIgr3Ize8jAAbTWkGt4EQ0tjjYh1HQ6ZkEJuOYxF62Na6xN0bD8trZ9zxz9nGW5mlF2hWobqg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770065381; 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=qSHmLXKNfNg2sdIpTDz+KjNqOgrCDOYvimFhzR98RCM=; b=jJfkQX02tFJFgmXu0HimRARzSDzgAh7IRgFBD1yohOMXFw93llRekMn5pX7cpaehyRknT7csXVvBaas4ZFNDdU5W8PtVvFw+ix9EpjXOS40FDbvMo3EAtZCG6i+LLbOJb7fu6UA4ypAjzHEtNMPRhWJgYjIxSOs01xXOVSYwBTY= 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 1770065381164350.53713445709855; Mon, 2 Feb 2026 12:49:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn0qZ-00082K-98; Mon, 02 Feb 2026 15:48:35 -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 1vn0q7-0007MO-BM for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:09 -0500 Received: from fhigh-b2-smtp.messagingengine.com ([202.12.124.153]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn0q3-0001p8-0j for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:05 -0500 Received: from phl-compute-12.internal (phl-compute-12.internal [10.202.2.52]) by mailfhigh.stl.internal (Postfix) with ESMTP id 5A16C7A011C; Mon, 2 Feb 2026 15:48:00 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-12.internal (MEProxy); Mon, 02 Feb 2026 15:48:00 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Feb 2026 15:47:59 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id 6ccf3d9a; Mon, 2 Feb 2026 20:47:53 +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=1770065280; x= 1770151680; bh=qSHmLXKNfNg2sdIpTDz+KjNqOgrCDOYvimFhzR98RCM=; b=R 48OosDU4hoFLiJGN69GPjQ/td9LG6nBGtV+lShguNaus8AvRXK++qPHi60hNlwY+ SLRRtIyk1QKjkppZUBd2vsp3Lkw0P2nbd6euAH+jskW8Ge1YBGAHiCGiIxsOclhI RsEh3xJp3CzXny78tDB7OrHT5kVcKPKfOb9jUzhQxCp/VXYPcLy5Hk4g8Ki0zVGD EdM4oyPeEXj7GceJeyuXTs8Y1HOQs+osq51umkX4Ci5GeH/BhPRFOACRJju/rbp2 //6Rm6wOcnjLcfwKYWccqikFOhcMV3s8+Uldggl1yR4Y7doOBTgUZMsC3r2qkKsg 0g4KpfxQEM0MO1MbwTXag== 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=1770065280; x=1770151680; bh=q SHmLXKNfNg2sdIpTDz+KjNqOgrCDOYvimFhzR98RCM=; b=PhiY1BHVoYn+N2hgu RC2wIrkbOWcIjyzUwpj3I04mAPBAIF0vodq72CjtVOdzb2Yuu88N74m71cChxNU7 ikNX7x0q1q0B04YwdnprcCTy/Ci3qzj4feDuI3kz8Ixc+6wDR5ABZ/hCN5WyxQ0o pHMcMhWhOAnFMr/ChH/vdjsan1/NlE0MQapYwqNAw3liUD914Og5yyU6C+aF+rhT LSzO+XaUExP89+lJL53Fh4uwL95rmk4gXBlYL3vpePZxjTgZ4WlSDd3F9FqM7Kj7 IEuIYFP0lTbMy6H5Gk6y2QQsNc34K2PTD8u2fMEHExOIpR6e20IRGc0jl9SmIOvZ E9RJw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddujeekieefucetufdoteggodetrf 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 v7 14/19] ati-vga: Pass use_pixman to ati_2d_do_blt Date: Mon, 2 Feb 2026 15:47:32 -0500 Message-ID: <20260202204738.3080092-15-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202204738.3080092-1-chad@jablonski.xyz> References: <20260202204738.3080092-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.153; envelope-from=chad@jablonski.xyz; helo=fhigh-b2-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: 1770065381804158500 Content-Type: text/plain; charset="utf-8" This is done in preparation for the removal of the ATIVGAState *s parameter. 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 4216986b6a..8397a4d1bb 100644 --- a/hw/display/ati_2d.c +++ b/hw/display/ati_2d.c @@ -121,12 +121,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(ATIVGAState *s, ATI2DCtx *ctx, uint8_t use_pixma= n) { /* 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; @@ -277,5 +277,5 @@ void ati_2d_blt(ATIVGAState *s) { ATI2DCtx ctx; setup_2d_blt_ctx(s, &ctx); - ati_2d_do_blt(s, &ctx); + ati_2d_do_blt(s, &ctx, s->use_pixman); } --=20 2.52.0 From nobody Tue Feb 10 20:30:20 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=1770065333; cv=none; d=zohomail.com; s=zohoarc; b=LWEfamyHriFiN8POn3D4fEVqYjo5tQQbvmme2YYUjtk0o0As1XvfpkzIJNHjUBCiVEeffqz7L3kJ6EGIhXVjyC+vrXAir+hGGkxH3wthc2/8Spdk7PFYAaYFjB4kqqbdQhxSMWSuzZWzt07s2hDhF5BDDEX2+EZ2+fkLGSI+qZM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770065333; 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=+MP/dkofv5no1P8Lu6mjU1EdbIDlKQHToIFYTTv9/lc=; b=ZMCSA4aaA+uOYY//MaRdoAF/DNandnhFdPkREeEpDfMx5ASmurHd19scVmMhlXt+eLHuqOuYWs9fVb8IX8mTQI5uvJS3n1R2AkuY1iDmpav+9j2vCKqmGp0W3sdxRP2CZ8lwtP01NJLXtBhkshlnle2SK3FEmDwujoZ/3faz0jA= 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 1770065333644975.535688276725; Mon, 2 Feb 2026 12:48:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn0qM-0007fQ-1i; Mon, 02 Feb 2026 15:48:22 -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 1vn0q5-0007Kv-Gb for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:07 -0500 Received: from fout-b4-smtp.messagingengine.com ([202.12.124.147]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn0q2-0001p1-8z for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:04 -0500 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id 76C4B1D0011E; Mon, 2 Feb 2026 15:48:00 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Mon, 02 Feb 2026 15:48:00 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Feb 2026 15:47:59 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id f503aa7e; Mon, 2 Feb 2026 20:47:53 +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=1770065280; x= 1770151680; bh=+MP/dkofv5no1P8Lu6mjU1EdbIDlKQHToIFYTTv9/lc=; b=b xOQOUVPXb3hQPPROfnX59zZskP5ke4RYtXv0kalmRLL6GmSLrpqUNbSxTqaWHsC5 ecqsUXrPIBFmaoPIdEdmPcZRMT8SgPUFbidJdNKcQuPCW/mayc7fXKXQ69aFy0v3 J/TjbvnNxyod5HEGFWptUeFUpuLdi0ISepR+gpnlC4RaoZ1awkJK1rF6B+adhbFO EKlCYn1GbR+oM1K3KVfuW/bsP9LQQurwxobs9BFiSQmsrwiKB1lZFcSMzlrzNwKn nGno8XM8G663RKAWNMH71yt+NJRq3v0kBR1egMjIGT9ZOFROmCZUvBZ3iFcOuqRK fq0PSnbvmpCsgtJOiDPxQ== 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=1770065280; x=1770151680; bh=+ MP/dkofv5no1P8Lu6mjU1EdbIDlKQHToIFYTTv9/lc=; b=DTmn6I975LAqfaYo2 BdzsjjbTlEYKIcxq/i6iq0Jk0nfMEke2ibvGgwfSNN3CANa4pvl5e+tFgvglcMfe l0SvGOqgrXGNvbxSoiaDfNIYZSEAiKbOY1AzcZ7RfsHE67PC2w9/+Re3gtqDcHiq 1KbT+0ichdXhCjxP5IA548bVt9/8bKLqe3AwHhrz4OJNeCKH4slt+XwK3WdYo8dr S2DvWDhAeYdG1rgvc1CpEsCk68kifAQNrU0eNaiGw2yWED/1X9xzMOyePBKxKvfI 8ks9heIxbzk9QKb3F/54tK/ntsyTvOXmWsVW+qDPDc6e6sDB095UeXa1PHEuw/m4 rM9CQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddujeekieegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg gslhhonhhskhhirdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopegthhgrugesjhgrsghlohhnshhkihdrgiihiidprhgtphhtthhope hqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepsggrlhgrthho 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 v7 15/19] ati-vga: Remove ATIVGAState param from ati_2d_do_blt Date: Mon, 2 Feb 2026 15:47:33 -0500 Message-ID: <20260202204738.3080092-16-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202204738.3080092-1-chad@jablonski.xyz> References: <20260202204738.3080092-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.147; envelope-from=chad@jablonski.xyz; helo=fout-b4-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: 1770065336666154100 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 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c index 8397a4d1bb..e1e48ac81f 100644 --- a/hw/display/ati_2d.c +++ b/hw/display/ati_2d.c @@ -121,7 +121,7 @@ static void setup_2d_blt_ctx(const ATIVGAState *s, ATI2= DCtx *ctx) (ctx->top_to_bottom ? 'v' : '^')); } =20 -static void ati_2d_do_blt(ATIVGAState *s, ATI2DCtx *ctx, uint8_t use_pixma= n) +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: */ @@ -269,13 +269,12 @@ static void ati_2d_do_blt(ATIVGAState *s, ATI2DCtx *c= tx, uint8_t use_pixman) ctx->rop3 >> 16); return; } - - ati_set_dirty(&s->vga, ctx); } =20 void ati_2d_blt(ATIVGAState *s) { ATI2DCtx ctx; setup_2d_blt_ctx(s, &ctx); - ati_2d_do_blt(s, &ctx, s->use_pixman); + ati_2d_do_blt(&ctx, s->use_pixman); + ati_set_dirty(&s->vga, &ctx); } --=20 2.52.0 From nobody Tue Feb 10 20:30:20 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=1770065480; cv=none; d=zohomail.com; s=zohoarc; b=KvNSWaJSX+hv5iReyfAJBj2evCiHnvNs5k21Zu19zhB5gHm/rPhZR6eideEIww2DL1NtH7uPEnTXoRb/eenJcoouS5SkSBEI3PcbAEBEax/L6JVciXDF/Sc57l204AGLb0qEVH5rSHvFAZRaPhrtCNQioN3hl8MAZyvGaaAzvjw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770065480; 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=gx3Da9YMvZQEvf4t7Zwfk28zoTGZPSETN0NVxxGKBm8=; b=chiV/+Qi/lbrcSzPiuzlxjsZjXvDebeDBgRWLh7CjREBPDdtIIuzKbRjX94OIiSmyYBy4bYPywvzPLCNPrTl1h24huXw/6MohIuT17+pNxpm0CoyMm6qXV7W8rC6L9EGDj+CzzjSGj8k3TQTrDrwHprICZhG/iRTE6ccCySllfs= 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 1770065480202165.70020847888338; Mon, 2 Feb 2026 12:51:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn0rC-00012m-Es; Mon, 02 Feb 2026 15:49:19 -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 1vn0q5-0007Ky-H9 for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:07 -0500 Received: from fout-b4-smtp.messagingengine.com ([202.12.124.147]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn0q2-0001p3-W6 for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:04 -0500 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id A62AB1D0012B; Mon, 2 Feb 2026 15:48:00 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Mon, 02 Feb 2026 15:48:00 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Feb 2026 15:48:00 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id 8f18439c; Mon, 2 Feb 2026 20:47:53 +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=1770065280; x= 1770151680; bh=gx3Da9YMvZQEvf4t7Zwfk28zoTGZPSETN0NVxxGKBm8=; b=n vppRLbXlPfOA6NTn3IqjMAAwIanI4tTifJNHzxj6E3q3jfPqNsP5mIZycXX7YRW8 G1qDgKT6c5JSxBQknbI36jaszRUKIBYuUg1j4HyIbED3It2TvNUaEJCbjQeQJ+Wa xwVwxLJXdAJSuSZCSsENbiEMBL4Km6uldm8o7P+FdAqqNnpfVx9WXhcLmnsHOef+ y7wVrKh32ngxWgIa6LpBz5zJ12np3JsHriu4BlSWmMVGBWXKLTuARvVdjwtOE82s TcZPPpZeGFyQMABy69odlRmNCtQCN12R2i/PVE6RvTT6Mn69eZmc4LjMEzkKl8QM qkCDSxYIHwbf0Y4JHY3Vg== 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=1770065280; x=1770151680; bh=g x3Da9YMvZQEvf4t7Zwfk28zoTGZPSETN0NVxxGKBm8=; b=MnykO9WIYlA7KxnTm pb7dSBGXFzfgPet2Rdyb6dj749oekkHn6vuPiJetFYoWnPRd0zqZWAsVkPyOrp7f N8CjNdy35SHM4mY8cmU8OubC7BNOsa/0bgV6UdHtebLntqnrbZtmknOFuNddL2My gscvgv8FCR5Lk2JL6CoKUja0DAtDDChuZmOsB+jbUwT1KAvB2YahLbgbKyFoLM3o ginb/x1DJpsaY/3ha7t9BNo97kQPVj0rncjxWHgwIICkdeLNQXoG9UScuU1m9Qpv gaF2MvQABgMbnAIpGAAvFQJBWdxclFlUMOZXROmgRCxG9J0+kf3Y+pF4OJQuufW3 bHSXQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddujeekieegucetufdoteggodetrf 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 v7 16/19] ati-vga: Move source bounds validation to ati_2d_blt Date: Mon, 2 Feb 2026 15:47:34 -0500 Message-ID: <20260202204738.3080092-17-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202204738.3080092-1-chad@jablonski.xyz> References: <20260202204738.3080092-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.147; envelope-from=chad@jablonski.xyz; helo=fout-b4-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: 1770065482212158500 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 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c index e1e48ac81f..4b16265733 100644 --- a/hw/display/ati_2d.c +++ b/hw/display/ati_2d.c @@ -152,14 +152,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, @@ -275,6 +267,14 @@ 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 Tue Feb 10 20:30:20 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=1770065411; cv=none; d=zohomail.com; s=zohoarc; b=ZpF0lrHpQj8piDV50AxGh5JmNyjyGmYJVh5EmxVzO/XZqGX1s4iiWGTJTuhUef7DxETDSWyxnnUbCqs2bjLyGSpZlU30ltmKaonCLS36dHB/mkaXY8lbSkMNb5m/SMS8PQWnJr7Dw3RItF5CNLALCksPxi90+ZUDQcbCnVG1LOY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770065411; 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=0lZr8XQmWGb15vpqX2+bUmT6P83W9+zZYeCJJBxjpI4=; b=fC0Y90xEQHd3dbLvrmECdSVT6tLAd3gx+1rkinqI/l/f8wNTI/jEpFvbFk3GJS3um04FyESbcTbrt8IVZNPESJmCdaq9s+mQp4eALTYkoJKNP+wAZLj7F1G76zekVhhOQwZk2iwk2KVWDSi7fM0Y1T1zhJyt0fIKdy3Ix8bm1lo= 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 177006541191781.54988059775928; Mon, 2 Feb 2026 12:50:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn0qQ-0007oC-RK; Mon, 02 Feb 2026 15:48:30 -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 1vn0q7-0007Mr-Cu for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:09 -0500 Received: from fout-b4-smtp.messagingengine.com ([202.12.124.147]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn0q3-0001pP-0y for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:05 -0500 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id 04CA81D00133; Mon, 2 Feb 2026 15:48:00 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Mon, 02 Feb 2026 15:48:01 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Feb 2026 15:48:00 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id 34aeabb7; Mon, 2 Feb 2026 20:47:53 +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=1770065280; x= 1770151680; bh=0lZr8XQmWGb15vpqX2+bUmT6P83W9+zZYeCJJBxjpI4=; b=B CIqOXMqAqlyZi86irNe5n579/Fqx2Q/73lI8Tb4ndMsyaaaTNY3T54GZ+BWg0Q3v ZExzjORBBas5VllE64G7YEGFVfOeirSakF27jfgan1s29itCZpNeTtN82WnYi7Y9 /HzuH2uQ4R79dp+eBvwcb236QkYi/N945GzF0SdnD9q3cP+cTnY1YLGi2mdbLYE5 oTTrWWUKrlNIDpZSqWL0ko31yiCY9nYQ4hStFQE69wfC46TIRHXYiK/Ey90iGD9a 46RtJBwCR796lIKW6NhhhO28d0dVvQWtDVtUrY8eJdm3XFZzv11x2VzMG5k04xUh +em3b/ZFVwUAW4gjEjncw== 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=1770065280; x=1770151680; bh=0 lZr8XQmWGb15vpqX2+bUmT6P83W9+zZYeCJJBxjpI4=; b=o5fcU4Tby+EzP+Cd9 ACVQHOvwvblEzfVaL4NdtCQVdLnS+GTdh4GjxghxPTDfV0dIUycUG4KMLwbBcNno AHVNAXMtJceKWRkWAe1xnK84MAwudcEvHab2KRl25qBE3GomX9fR45Wgy29+oizg xt2QhuwrBcV1vpuJF3Ik528KdNY45l9k+jXId21avUsrOHlR2HyJDgv3eUxujPv7 8LBCJpxmfAno9iwQtJchSQGgNdDHuc+ZufJ6ZpEsIhAg0w/5dsRrTEkp0JIRbP3n 1lvxRFunOr+WC1RqbI7s9lFor3P3XaV40UNYIp8ENhtVDfS0vSNL0BNbcqaRIQWQ sRhvw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddujeekieegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg gslhhonhhskhhirdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopegthhgrugesjhgrsghlohhnshhkihdrgiihiidprhgtphhtthhope hqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepsggrlhgrthho 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 v7 17/19] ati-vga: Implement scissor rectangle clipping for 2D operations Date: Mon, 2 Feb 2026 15:47:35 -0500 Message-ID: <20260202204738.3080092-18-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202204738.3080092-1-chad@jablonski.xyz> References: <20260202204738.3080092-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.147; envelope-from=chad@jablonski.xyz; helo=fout-b4-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: 1770065413520154100 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 4b16265733..b9fc9f3057 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; @@ -89,6 +90,11 @@ static void setup_2d_blt_ctx(const ATIVGAState *s, ATI2D= Ctx *ctx) ctx->palette =3D s->vga.palette; 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 ? @@ -127,6 +133,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; @@ -143,6 +150,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: { @@ -157,34 +180,34 @@ static void ati_2d_do_blt(ATI2DCtx *ctx, uint8_t use_= pixman) 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); + 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_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); + vis_src.x, vis_src.y, + vis_dst.x, vis_dst.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); + 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->dst.y, - ctx->dst.width, ctx->dst.height); + 0, 0, vis_dst.x, vis_dst.y, + vis_dst.width, vis_dst.height); } g_free(tmp); } else @@ -194,20 +217,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; @@ -236,20 +259,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); + 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)) + ctx->bpp, vis_dst.x, vis_dst.y, + vis_dst.width, vis_dst.height, 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 Tue Feb 10 20:30:20 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=1770065393; cv=none; d=zohomail.com; s=zohoarc; b=P4gJ6cYns2YV5r84PRXvLnmnEdq6pH78ShyHh1wybeDLnFLyXqUj5bwLGWX8QCIapOIQNu4wjd33IKjHygWHIpLbg3e7+hwRMMDl8Gr/4fPRi5s31QLrYXf/x0auUBd9YO7NMbBETjNRhHtx4gXuOre0NOmqqC7Ejx+ijX1L2qw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770065393; 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=L8N9nmJty6/q3njlBlqR1gsAbGDULXD3NfNCfhua1fswp62zj5fKmOvjpQ9nAKsyDVL5eyGW8D8JFZU4khRR85cd9WJ30rhqasaVidhcQFYkOSE4ccO0Lv1kBlx5AsVKNHpGRqWoaEegwGq2g+Hxp3IeVloURzRY/Op6SmUhg50= 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 1770065393950622.3558556369251; Mon, 2 Feb 2026 12:49:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn0qh-0008VH-J3; Mon, 02 Feb 2026 15:48:44 -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 1vn0q5-0007Kz-IN for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:07 -0500 Received: from fhigh-b2-smtp.messagingengine.com ([202.12.124.153]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn0q2-0001p2-6N for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:04 -0500 Received: from phl-compute-10.internal (phl-compute-10.internal [10.202.2.50]) by mailfhigh.stl.internal (Postfix) with ESMTP id 33D487A0085; Mon, 2 Feb 2026 15:48:01 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-10.internal (MEProxy); Mon, 02 Feb 2026 15:48:01 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Feb 2026 15:48:00 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id 733c1c8b; Mon, 2 Feb 2026 20:47:53 +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=1770065281; x= 1770151681; bh=yF27HNX02Ru9Co1eGRAH4G56t9l9sU85B21tcUxK7cQ=; b=K tnm2nzNNd5zLC+AmSpRbzlHmQRIn0lbBrleLXJcnHzL/aM8Tq4unwCZaUCT/KbNK vXAkp3qvWLEqy2NElkp3x1zMD71ewCfeCIg64WrPiuKEqlgFp0T4qOYbuyNcCRgT 8V5M+eyXZFekczm7lCqfC/xJoz+UlYVT6uLovn//cifHFLnUycogATVcDnRThbux OBzNccg191HugvgEqDV9mDkmXTgQ3+Lm1Miu1SOCNFRaMqyGK/6IG7TAyi7Kk2EC Gc7eMma8V0MElUf1hNk0yFnkCF4DIgwqPJBlB2DJBjtIsSOlgVa6/Op1ZIAFqXsN a/R1sr1lYYYLsPNo2d6cg== 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=1770065281; x=1770151681; bh=y F27HNX02Ru9Co1eGRAH4G56t9l9sU85B21tcUxK7cQ=; b=wCKmP7wU43C7HcsI5 oiqseIi5j3wXLHYLDoHuqLf6EG+CyYV0eiPAKtOkZYYyMhowq/Y4EZ8aWLRvZZru V+iedBy8bE+z6lKuapJeKEXY10uHNQnpb2b/KUQRvjD2dV7aWP3GoNkZ8P9Bo9DY CPBxtq9H+Ed76P3jnnslIuMLxLr6I+CankpBxZ4w/kEYg/VcnIBHZ9EEPbzBXKHg ZLt74RxtWG1Owg8jyIow8Efcrjjrm+RbuCgBpjyKFfLAo/cQli0OhDnHZ6bdWJ+5 acnPFYhdOcNA5XCAkT4jNYNTlR6ZL+CntdVZajiXt2WphdDkymvwp7EWtaaOq6WZ P+RTQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddujeekieefucetufdoteggodetrf 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 v7 18/19] ati-vga: Implement HOST_DATA register writes Date: Mon, 2 Feb 2026 15:47:36 -0500 Message-ID: <20260202204738.3080092-19-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202204738.3080092-1-chad@jablonski.xyz> References: <20260202204738.3080092-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.153; envelope-from=chad@jablonski.xyz; helo=fhigh-b2-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: 1770065395212154100 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 Tue Feb 10 20:30:20 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=1770065431; cv=none; d=zohomail.com; s=zohoarc; b=XV9w4sZh7PY1EdJW31/xvtTq/3aCCMBVLroC584AnMt/NJx97xz70KVitSNaht9syxQ7tmwxPZLKOsW+D0o2jbxiWv4ydnN48PSb/9IMyc323PWGrHn5SRs9G7n6Xld0Wcx2EMKDPWBzfBPCnr6VLz5qKvWa3pTvQXd98jhQBl0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770065431; 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=JWVVtkHhgh2zxANpbFwsWKWT3u3BmhZsOxPsQoOWRzg=; b=SPguZ31il4AJ8zNXd6f3jDYrCqK5jOIaH+29LcZXUXSQZ49xBksPik/poZfdu9GJkzEXRSTyvb/Fx0zd3/2SZ99zukEEKr0Z5xi0fVhfkfFBvFjB4nxBpi2WZFpYrhnkPCPVpttdL9wRFH2tkMiJ7Jr/lN5BSauKppwiyyKH4ws= 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 1770065431973400.1007094268482; Mon, 2 Feb 2026 12:50:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vn0rQ-0001SE-HW; Mon, 02 Feb 2026 15:49:28 -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 1vn0q7-0007Mn-Cf for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:09 -0500 Received: from fhigh-b2-smtp.messagingengine.com ([202.12.124.153]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vn0q3-0001pI-0y for qemu-devel@nongnu.org; Mon, 02 Feb 2026 15:48:05 -0500 Received: from phl-compute-10.internal (phl-compute-10.internal [10.202.2.50]) by mailfhigh.stl.internal (Postfix) with ESMTP id 6836C7A0116; Mon, 2 Feb 2026 15:48:01 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-10.internal (MEProxy); Mon, 02 Feb 2026 15:48:01 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Feb 2026 15:48:00 -0500 (EST) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id 16f08fdf; Mon, 2 Feb 2026 20:47:53 +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=1770065281; x= 1770151681; bh=JWVVtkHhgh2zxANpbFwsWKWT3u3BmhZsOxPsQoOWRzg=; b=s OGCkzaeI56mM5Rf4T9cjbC6DA3F8rk+5iXF7pxLviUinemGSBLJZG+hP+EC/r0Ck bda3RpIZYDltgJPIiD4b/mO0eo0woWLkAtKrZPTy1Tw6ZOnLjigcYTq8CWMyQEes g39E12YU4w75rEqJ5LMfaENXGl4PDL1Ba5ubjs+vzr8vSckhncdmvEiUzboCJTu3 psfCuSs5INnyrr9h1Ra1qxFh13LfToZ+RbAjylqxswEOoo6pCVJfLO3GhHjZMSCZ EsVamzMOD/TV5oujyJ8M4hPgqlIlKUbVQPYX/ZoA8Y+c+7TWFjjlOJoRugezIIEc IvE4X6I0pvHAxtvvxgszA== 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=1770065281; x=1770151681; bh=J WVVtkHhgh2zxANpbFwsWKWT3u3BmhZsOxPsQoOWRzg=; b=CXyodYObmD2Faw6DK EPXslIIXeXlKmhCoT0N6T+BEer0IFE0qvNKGhaLKZScdnObO7cEmO/GnKXNDMQ+6 fiGsT35be3S7EXYcdUv8YNb+rRwgheowLpuwwoaiOuRLGJTTe3JnJuVTtdEEr6u6 DGb3qT7DTLg5iGDU7cp3mFYcgeC280Mg8lMbaecm9rJA/Qyl+60qZZB5XD8BGafI hGEVuevERdY2rjsqu80E7lxNT7Wp013fxs+ckLDLmpIshDKOcUMVP7DpLV63YBaY kuSVt4B5KST/0Drx12L5yrXaSfFyWtDWBMUTd7wukRYCRe2gBMge/hpnuhRuQeVq XYhAw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddujeekieefucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvfevuf ffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeevhhgrugculfgrsghlohhnshhk ihcuoegthhgrugesjhgrsghlohhnshhkihdrgiihiieqnecuggftrfgrthhtvghrnhepgf eiteejhfelheefieetjefgleejfffhueffvdduieejgfeuueeuvddvkeejhfelnecuvehl uhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomheptghhrggusehjrg 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 v7 19/19] ati-vga: Implement HOST_DATA flush to VRAM Date: Mon, 2 Feb 2026 15:47:37 -0500 Message-ID: <20260202204738.3080092-20-chad@jablonski.xyz> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260202204738.3080092-1-chad@jablonski.xyz> References: <20260202204738.3080092-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.153; envelope-from=chad@jablonski.xyz; helo=fhigh-b2-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: 1770065434117158500 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 b9fc9f3057..cd757c10f8 100644 --- a/hw/display/ati_2d.c +++ b/hw/display/ati_2d.c @@ -289,6 +289,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 @@ -301,3 +306,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