From nobody Tue Apr 21 14:40:18 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=1776459526; cv=none; d=zohomail.com; s=zohoarc; b=EOcTlhiyIf1ldS7rEwR7fxzilf90F/DuOKg6phhYSBsfkmgs2RvBKhALOW5KeP5hb/Kl7H7CHukzIvea4BcNYHUitCcEAggmxrkxZ5q/8oluMs+DewAAsqUivqADLIoZD0Fntf/IPg9c/sCzpdACxJzAhKOBxpntPb77Xgpo92c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776459526; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=oLnh0vhJ5B/i4EgnfEpvEqOHlg6psmVAusdckEyJs84=; b=Kpa478kQzdJcxpG0kpc0CJ5mYG14OLDwKkSMPqzxeBAeYoVDj/CZyRlaGJn3MKQwL1YfC9CWzDMVaAHUvT4pnInVxsuIjAXNOl5nfOlZ7YHxMy4GLKy9pUYMzDpDzpTS6GFaFzT8//ANZ4CbrG+C7kUL5vITWfOxFsRUiZ5nrNk= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17764595264181022.0741325282953; Fri, 17 Apr 2026 13:58:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wDqGI-0000et-VT; Fri, 17 Apr 2026 16:58:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDqGH-0000dS-GV for qemu-devel@nongnu.org; Fri, 17 Apr 2026 16:58:01 -0400 Received: from fhigh-b6-smtp.messagingengine.com ([202.12.124.157]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDqGE-0002fD-Ou for qemu-devel@nongnu.org; Fri, 17 Apr 2026 16:58:00 -0400 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.stl.internal (Postfix) with ESMTP id 45A8B7A0160; Fri, 17 Apr 2026 16:57:57 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Fri, 17 Apr 2026 16:57:57 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 17 Apr 2026 16:57:55 -0400 (EDT) Received: from localhost (chomposaur [local]) by chomposaur (OpenSMTPD) with ESMTPA id cf87f365; Fri, 17 Apr 2026 20:57:55 +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:message-id:mime-version:reply-to:subject :subject:to:to; s=fm1; t=1776459477; x=1776545877; bh=oLnh0vhJ5B /i4EgnfEpvEqOHlg6psmVAusdckEyJs84=; b=EwqXnBJNAAHx7ATUndEXhu/PUh pszb+L3HI3ffSmPc7bhjk6mp3fvg4oGLq578SoiZtWK37RC6NTXS+1Uwv1PKdDqK DaYhDZ3ByDrfFcSb/0ShG+V9VyasRZCQxp4ZrubS4K4Qdegvi/18z5ucDWebCHKb SL45zl9NpetM/WYjaVur9g1vtAFHIM5+WhLbaWLAD4kA322jKPgqic9WXYnoSEHk UOWrQjV0ip75xKlkGGPw4LwRFaDm/8kW2npnxQzm15RUL2vAX0W+ZT99Mf2oI/th 3NQ1hgMdYmppi2Bt5r/05eJ8kUl8piw7itzNQGeAlXWmHZPvbdiXE1zraFFQ== 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:message-id:mime-version:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1776459477; x=1776545877; bh=oLnh0vhJ5B/i4EgnfEpvEqOHlg6psmVAusd ckEyJs84=; b=XQRj68knn3q7O8l5kEkues8n2bMyN4xWvxgVlCUPTODJHM+NAgB AaYegj2UP6ABgcbhNKw8NaV6TfcngH9y99UTRmwnYoV6knyxNOL/nTrqbCQfz5+q gpO+Sy521C8XcdrAgajcqwifO9knXtrrbNXTlMSrAeVWZNkqiWnTf7ttf5KV56i1 aESjyJVusOfrul+7EBFZ+1fDbRCTHRVahjA2fqDbvtQdl3RQxL8VWt/DEtWAN5bU gZOAgnbGUi6sVk2OEujCL8Z9czPg2mK+gaRIc5HpmEWekYpbDsyovqMtUfP1VYVQ 3QOG7fiHKFsWeJ7mQX11nsgPEhdwW7sZBxA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdehtdeltdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlh cuvffnffculdejtddmnecujfgurhephffvvefufffkofgggfestdekredtredttdenucfh rhhomhepvehhrgguucflrggslhhonhhskhhiuceotghhrggusehjrggslhhonhhskhhird ighiiiqeenucggtffrrghtthgvrhhnpefhteeugfeujeelteeggfeigeevjeelgeegudfg uedvheeghfffudffledukeeiveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpegthhgrugesjhgrsghlohhnshhkihdrgiihiidpnhgspghrtghp thhtohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepsggrlhgrthhonhesvg hikhdrsghmvgdrhhhupdhrtghpthhtohepqhgvmhhuqdguvghvvghlsehnohhnghhnuhdr ohhrghdprhgtphhtthhopegthhgrugesjhgrsghlohhnshhkihdrgiihii X-ME-Proxy: Feedback-ID: ib26944c1:Fastmail From: Chad Jablonski To: qemu-devel@nongnu.org Cc: BALATON Zoltan , Chad Jablonski Subject: [PATCH] ati-vga: fix ati_set_dirty address calculation Date: Fri, 17 Apr 2026 16:57:52 -0400 Message-ID: <20260417205752.3932801-1-chad@jablonski.xyz> X-Mailer: git-send-email 2.53.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=202.12.124.157; envelope-from=chad@jablonski.xyz; helo=fhigh-b6-smtp.messagingengine.com X-Spam_score_int: 17 X-Spam_score: 1.7 X-Spam_bar: + X-Spam_report: (1.7 / 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.498, FROM_SUSPICIOUS_NTLD_FP=1.997, PDS_OTHER_BAD_TLD=1.997, 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: 1776459529413154100 Content-Type: text/plain; charset="utf-8" When using a virtual desktop any amount of scrolling would cause ati_set_dirty to set the wrong region of memory as dirty and screen updates are missed. This is because the previous implementation used vga->vbe_start_addr in the dirty address calculation. It works when it's zero but as soon as the virtual desktop is involved it's often non-zero. The first issue is that vga->vbe_start_addr is a word offset and was being added to byte offsets. But regardless, the vbe_start_address affects the scan out and not the framebuffer. We shouldn't need to apply an offset for it at all when thinking about dirty tracking. The second is that a bounds check was also being performed to ensure that the dirty memory was within the visible screen. With the virtual desktop this isn't actually what we want. Updates can and will happen outside of the visible screen area. Those should be marked dirty. Signed-off-by: Chad Jablonski --- hw/display/ati_2d.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c index 504d1c5708..dc33b014eb 100644 --- a/hw/display/ati_2d.c +++ b/hw/display/ati_2d.c @@ -71,17 +71,11 @@ static void ati_set_dirty(VGACommonState *vga, const AT= I2DCtx *ctx) DisplaySurface *ds =3D qemu_console_surface(vga->con); =20 (void)ds; - 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), - 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 + ctx->dst_offset + - ctx->dst.y * ctx->dst_stride, - ctx->dst.height * ctx->dst_stride); - } + DPRINTF("%p ds: %p %d %d rop: %x\n", vga->vram_ptr, surface_data(ds), + surface_stride(ds), surface_bits_per_pixel(ds), ctx->rop3 >> 1= 6); + memory_region_set_dirty(&vga->vram, + ctx->dst_offset + ctx->dst.y * ctx->dst_stride, + ctx->dst.height * ctx->dst_stride); } =20 static void setup_2d_blt_ctx(const ATIVGAState *s, ATI2DCtx *ctx) --=20 2.53.0