From nobody Tue Feb 10 09:59:30 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 1530697842395256.97579669900654; Wed, 4 Jul 2018 02:50:42 -0700 (PDT) Received: from localhost ([::1]:44943 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1faeQj-0000lL-FL for importer@patchew.org; Wed, 04 Jul 2018 05:50:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1faeOo-0008D3-9F 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 1faeOj-0003vD-Fj for qemu-devel@nongnu.org; Wed, 04 Jul 2018 05:48:34 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]:46740) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1faeOj-0003uS-4u for qemu-devel@nongnu.org; Wed, 04 Jul 2018 05:48:29 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id CE6567456C9; Wed, 4 Jul 2018 11:48:27 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 6F2FF7456CA; Wed, 4 Jul 2018 11:48:27 +0200 (CEST) Message-Id: <6694adb928f6b76e418a10115d8d143927a3cbf8.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 6/7] sm501: Fix support for non-zero frame buffer start address 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" Display updates and drawing hardware cursor did not work when frame buffer address was non-zero. Fix this by taking the frame buffer address into account in these cases. This fixes screen dragging on AmigaOS. Based on patch by Sebastian Bauer. Signed-off-by: Sebastian Bauer Signed-off-by: BALATON Zoltan --- v2: fixed crash with Linux setting extra bits and log unimplemented case hw/display/sm501.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index ebd1390..10ee008 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -586,6 +586,11 @@ static uint32_t get_local_mem_size_index(uint32_t size) return index; } =20 +static ram_addr_t get_fb_addr(SM501State *s, int crt) +{ + return (crt ? s->dc_crt_fb_addr : s->dc_panel_fb_addr) & 0x3FFFFF0; +} + static inline int get_width(SM501State *s, int crt) { int width =3D crt ? s->dc_crt_h_total : s->dc_panel_h_total; @@ -688,7 +693,8 @@ static inline void hwc_invalidate(SM501State *s, int cr= t) start *=3D w * bpp; end *=3D w * bpp; =20 - memory_region_set_dirty(&s->local_mem_region, start, end - start); + memory_region_set_dirty(&s->local_mem_region, + get_fb_addr(s, crt) + start, end - start); } =20 static void sm501_2d_operation(SM501State *s) @@ -1213,6 +1219,9 @@ static void sm501_disp_ctrl_write(void *opaque, hwadd= r addr, break; case SM501_DC_PANEL_FB_ADDR: s->dc_panel_fb_addr =3D value & 0x8FFFFFF0; + if (value & 0x8000000) { + qemu_log_mask(LOG_UNIMP, "Panel external memory not supported\= n"); + } break; case SM501_DC_PANEL_FB_OFFSET: s->dc_panel_fb_offset =3D value & 0x3FF03FF0; @@ -1273,6 +1282,9 @@ static void sm501_disp_ctrl_write(void *opaque, hwadd= r addr, break; case SM501_DC_CRT_FB_ADDR: s->dc_crt_fb_addr =3D value & 0x8FFFFFF0; + if (value & 0x8000000) { + qemu_log_mask(LOG_UNIMP, "CRT external memory not supported\n"= ); + } break; case SM501_DC_CRT_FB_OFFSET: s->dc_crt_fb_offset =3D value & 0x3FF03FF0; @@ -1615,7 +1627,7 @@ static void sm501_update_display(void *opaque) draw_hwc_line_func *draw_hwc_line =3D NULL; int full_update =3D 0; int y_start =3D -1; - ram_addr_t offset =3D 0; + ram_addr_t offset; uint32_t *palette; uint8_t hwc_palette[3 * 3]; uint8_t *hwc_src =3D NULL; @@ -1672,9 +1684,10 @@ static void sm501_update_display(void *opaque) } =20 /* draw each line according to conditions */ + offset =3D get_fb_addr(s, crt); snap =3D memory_region_snapshot_and_clear_dirty(&s->local_mem_region, offset, width * height * src_bpp, DIRTY_MEMORY_VGA); - for (y =3D 0, offset =3D 0; y < height; y++, offset +=3D width * src_b= pp) { + for (y =3D 0; y < height; y++, offset +=3D width * src_bpp) { int update, update_hwc; =20 /* check if hardware cursor is enabled and we're within its range = */ --=20 2.7.6