From nobody Tue Feb 10 08:26:52 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1530698183725664.4472824727046; Wed, 4 Jul 2018 02:56:23 -0700 (PDT) Received: from localhost ([::1]:44979 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1faeWD-00057L-IT for importer@patchew.org; Wed, 04 Jul 2018 05:56:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57282) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1faeOo-0008D9-Ao for qemu-devel@nongnu.org; Wed, 04 Jul 2018 05:48:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1faeOk-0003vg-J4 for qemu-devel@nongnu.org; Wed, 04 Jul 2018 05:48:34 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]:46770) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1faeOk-0003vI-BG for qemu-devel@nongnu.org; Wed, 04 Jul 2018 05:48:30 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id EB86A7456B9; Wed, 4 Jul 2018 11:48:27 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 732937456CB; Wed, 4 Jul 2018 11:48:27 +0200 (CEST) Message-Id: <7e1c5b2e14f70a7215ebff1f1ef27f793813b2f1.1530697258.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Date: Wed, 04 Jul 2018 11:40:58 +0200 To: qemu-devel@nongnu.org X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 152.66.115.2 Subject: [Qemu-devel] [PATCH v3 7/7] sm501: Set updated region dirty after 2D operation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Sebastian Bauer , Magnus Damm , Philippe Mathieu-Daude , Aurelien Jarno , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Set the changed memory region dirty after performed a 2D operation to ensure that the screen is updated properly. Signed-off-by: BALATON Zoltan --- v2: fixed to work with non-zero fb_addr hw/display/sm501.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 10ee008..3661a89 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -715,12 +715,16 @@ static void sm501_2d_operation(SM501State *s) /* 1 if rop2 source is the pattern, otherwise the source is the bitmap= */ int rop2_source_is_pattern =3D (s->twoD_control >> 14) & 0x1; int rop =3D s->twoD_control & 0xFF; + uint32_t src_base =3D s->twoD_source_base & 0x03FFFFFF; + uint32_t dst_base =3D s->twoD_destination_base & 0x03FFFFFF; =20 /* get frame buffer info */ - uint8_t *src =3D s->local_mem + (s->twoD_source_base & 0x03FFFFFF); - uint8_t *dst =3D s->local_mem + (s->twoD_destination_base & 0x03FFFFFF= ); + uint8_t *src =3D s->local_mem + src_base; + uint8_t *dst =3D s->local_mem + dst_base; int src_width =3D s->twoD_pitch & 0x1FFF; int dst_width =3D (s->twoD_pitch >> 16) & 0x1FFF; + int crt =3D (s->dc_crt_control & SM501_DC_CRT_CONTROL_SEL) ? 1 : 0; + int fb_len =3D get_width(s, crt) * get_height(s, crt) * get_bpp(s, crt= ); =20 if (addressing !=3D 0x0) { printf("%s: only XY addressing is supported.\n", __func__); @@ -821,6 +825,15 @@ static void sm501_2d_operation(SM501State *s) abort(); break; } + + if (dst_base >=3D get_fb_addr(s, crt) && + dst_base <=3D get_fb_addr(s, crt) + fb_len) { + int dst_len =3D MIN(fb_len, ((dst_y + operation_height - 1) * dst_= width + + dst_x + operation_width) * (1 << format_flags)); + if (dst_len) { + memory_region_set_dirty(&s->local_mem_region, dst_base, dst_le= n); + } + } } =20 static uint64_t sm501_system_config_read(void *opaque, hwaddr addr, --=20 2.7.6