From nobody Fri Apr 3 17:34:44 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1774284913; cv=none; d=zohomail.com; s=zohoarc; b=PdD22Keg5xi2AVq/l4bU4gyy3I+96vAZ69l213dxmZo02lB+j6UFV1LZomERz37V9LH6Ecqh62+o2O1GciThoVM46G+n6G2fnKlgLCsnFz8Psyjy9IrwdX2vRBnPr65QGUKoHuf5GGkZ69q8fy0mOnZB1IV3u1NfdHAOiVOeA5g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774284913; h=Content-Type:Content-Transfer-Encoding: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:Cc; bh=DydaDApGQyKIZilhgXGoxyDZiKo9keH82dkobi0tCBY=; b=A6ZceA9F0G9d0ZyVD/BdXA9xbVKP4zV4mjNfd7xIKE8zc7mPUS1bKxNMqmygNcaVUjxNOxiNQePWNOIfz0p9Wzn6GydHr40UlSUgLGKmWJ1Bl7p2FVhT8W+BcOopzf2BW7a9DU4FMRUftCm98cC9/HJNExRbC75iL+6gN/ki+ZA= 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 1774284913814864.2765075294334; Mon, 23 Mar 2026 09:55:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w4iYZ-00087R-AN; Mon, 23 Mar 2026 12:55:11 -0400 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 1w4iYM-0007Vq-8K for qemu-devel@nongnu.org; Mon, 23 Mar 2026 12:54:59 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w4iYK-0000iE-C9 for qemu-devel@nongnu.org; Mon, 23 Mar 2026 12:54:58 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-43a03cb1df9so409488f8f.1 for ; Mon, 23 Mar 2026 09:54:55 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43b6470c239sm30915537f8f.27.2026.03.23.09.54.53 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 23 Mar 2026 09:54:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1774284894; x=1774889694; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=DydaDApGQyKIZilhgXGoxyDZiKo9keH82dkobi0tCBY=; b=klTm8mohRg+tQYjAqjxaAxZ57AfDe+29aoguGN/juTr7Kgn06d7iaXvkXmlFdp7jOc 4MCS35BfY+ziJslcMMzID40Ln3mwuMppBQeEqrt2ic00rDhYdRDnr1GDwwzx57RyiNlI 65A0W46gAsmlyXFkGob4H7OnB4PjXrJkCu1YeOUXYAbikwJ4+cozVYSvuqy31m1RI+pO iOGjMsT6hFY+pUe4atupQ+OmgmfipFUsiGVNxZV7TVJSbw47Lf4ivZEcf9wubo36tnyX VYJE1uInE/6WBHCVmcGaoA6U4FawGYAwvo/zAd8kynLg2ZhyqNdR1By+DYZwcXN9L3++ G7mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774284894; x=1774889694; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=DydaDApGQyKIZilhgXGoxyDZiKo9keH82dkobi0tCBY=; b=NQ9gw7JufmLBneAvwJwyLT99oYWo4N0h6YNKmiGxlCVB8sXfpV4krVQiN7vJ6PTeDY iQeCkRbRf8B0exGoFSdgC36e/hnlUSVdaN4QO37wN9YIhVPorsiAuAfoCoRlo955BeE0 Y/GOEkMCX4MOi9606HFBXWlJonjU7oo+UMkJWfU+qdxBYaKuoVSZ3SUuHKt8bi90u78u QhdOW592j11DuxhM1StOfv5Fmb3H5pSUPs8OuY0EpMBEv8v5dRrm8z3dGR5pvpCU6iGl A1tMGXIq3RIJjZ2zu2oma0um3rWMYRRwPTrCKf1iRZQBEg7pJnQoMASj6mfZ8RwMU2U1 o8GA== X-Gm-Message-State: AOJu0Yz5N131uNoa2DEzwpXSHMKAGh+0afeA0AM3Ju+wYT3ZLwgBBG0n 79QmUcwDiKjSJhcp5HM/uD4uL4wf9plXmBSPvHeJOccYj2MKw/pspHbTbMmUDVbXhe5wOfHn5kw JHPSY9A8= X-Gm-Gg: ATEYQzyUewZvykXHGXI8xg4YLkMw/U41dyxtLuIP8OL8PR4XhVXZFs59PcxG0zwPR87 u0NJUb42ZfnpMrHZTZb8dZpfV3gxgCJk/06i5O/pJqLACLcRiSZqSiAinv6BpTvT6dSqA6T6tq3 Y4Va86fAe2jX+enAk0Ordrd2r3+lDVFdkIUK6A5+gLetWhj9w/LsO5UBpjG3Y54SwIxu7JTMJBL CIGe52h+SGnrut44bJX+8DnGyek2aE4XGbfKh0hHV5EmdGjVwXEoBsSOLE3eduvy0xIA+aupJec G7OD33YxChMH7fATXkqlDmZsCbk4G9e59sNeUrXkvuoi5Ip69g8qt+8NHZJRI82TJBx+uCesv0A AFeNgDKgAiqUnlyzdatPMjaNo6ly0pqrqhyv7y/bgc7F0Vm4FprlHosbdriWK22623oxe1LM8Ba 0NSR6QtMfRTwKt4aIU3cm9pSMQLMeGPvo/RHCeoKRYk/MwX2G06ruhs8vf/W0ZjmZbR+xrLmaz X-Received: by 2002:a05:6000:420c:b0:439:c62a:6dc2 with SMTP id ffacd0b85a97d-43b6427973bmr20347789f8f.41.1774284894237; Mon, 23 Mar 2026 09:54:54 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 23/27] ati-vga: Simplify pointer image handling Date: Mon, 23 Mar 2026 17:52:14 +0100 Message-ID: <20260323165218.96607-24-philmd@linaro.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323165218.96607-1-philmd@linaro.org> References: <20260323165218.96607-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::436; envelope-from=philmd@linaro.org; helo=mail-wr1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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 @linaro.org) X-ZM-MESSAGEID: 1774284915327158502 From: BALATON Zoltan Rewrite reading of mouse pointer image. I am not sure this is entirely correct but appears to work at least on little endian host with PPC guests using little or big endian frame buffer (MorphOS and MacOS) but still produces broken pointer image with Linux where I am not sure if it is a guest driver bug or still missing something. Signed-off-by: BALATON Zoltan Message-ID: [PMD: Replaced BIT() -> BIT_ULL() in ati_cursor_draw_line()] Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/display/ati.c | 57 ++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/hw/display/ati.c b/hw/display/ati.c index f74dd1efc0b..c054c9aa7a2 100644 --- a/hw/display/ati.c +++ b/hw/display/ati.c @@ -141,27 +141,24 @@ static void ati_vga_switch_mode(ATIVGAState *s) /* Used by host side hardware cursor */ static void ati_cursor_define(ATIVGAState *s) { - uint8_t data[1024]; + uint64_t data[128]; uint32_t srcoff; - int i, j, idx =3D 0; =20 if ((s->regs.cur_offset & BIT(31)) || s->cursor_guest_mode) { return; /* Do not update cursor if locked or rendered by guest */ } /* FIXME handle cur_hv_offs correctly */ - srcoff =3D s->regs.cur_offset - - (s->regs.cur_hv_offs >> 16) - (s->regs.cur_hv_offs & 0xffff) * 16; - for (i =3D 0; i < 64; i++) { - for (j =3D 0; j < 8; j++, idx++) { - data[idx] =3D vga_read_byte(&s->vga, srcoff + i * 16 + j); - data[512 + idx] =3D vga_read_byte(&s->vga, srcoff + i * 16 + j= + 8); - } + srcoff =3D s->regs.cur_offset - (s->regs.cur_hv_offs >> 16) - + (s->regs.cur_hv_offs & 0xffff) * 16; + for (int i =3D 0; i < 64; i++, srcoff +=3D 16) { + data[i] =3D ldq_le_p(&s->vga.vram_ptr[srcoff]); + data[i + 64] =3D ldq_le_p(&s->vga.vram_ptr[srcoff + 8]); } if (!s->cursor) { s->cursor =3D cursor_alloc(64, 64); } cursor_set_mono(s->cursor, s->regs.cur_color1, s->regs.cur_color0, - &data[512], 1, &data[0]); + (uint8_t *)&data[64], 1, (uint8_t *)&data[0]); dpy_cursor_define(s->vga.con, s->cursor); } =20 @@ -196,9 +193,9 @@ static void ati_cursor_invalidate(VGACommonState *vga) static void ati_cursor_draw_line(VGACommonState *vga, uint8_t *d, int scr_= y) { ATIVGAState *s =3D container_of(vga, ATIVGAState, vga); - uint32_t srcoff; + uint32_t h, srcoff, color; + uint64_t abits, xbits, mask; uint32_t *dp =3D (uint32_t *)d; - int i, j, h, idx =3D 0; =20 if (!(s->regs.crtc_gen_cntl & CRTC2_CUR_EN) || scr_y < vga->hw_cursor_y || scr_y >=3D vga->hw_cursor_y + 64 || @@ -209,26 +206,24 @@ static void ati_cursor_draw_line(VGACommonState *vga,= uint8_t *d, int scr_y) srcoff =3D s->cursor_offset + (scr_y - vga->hw_cursor_y) * 16; dp =3D &dp[vga->hw_cursor_x]; h =3D ((s->regs.crtc_h_total_disp >> 16) + 1) * 8; - for (i =3D 0; i < 8; i++) { - uint32_t color; - uint8_t abits =3D vga_read_byte(vga, srcoff + i); - uint8_t xbits =3D vga_read_byte(vga, srcoff + i + 8); - for (j =3D 0; j < 8; j++, abits <<=3D 1, xbits <<=3D 1, idx++) { - if (vga->hw_cursor_x + idx >=3D h) { - return; /* end of screen, don't span to next line */ - } - if (abits & BIT(7)) { - if (xbits & BIT(7)) { - color =3D dp[idx] ^ 0xffffffff; /* complement */ - } else { - continue; /* transparent, no change */ - } - } else { - color =3D (xbits & BIT(7) ? s->regs.cur_color1 : - s->regs.cur_color0) | 0xff000000; - } - dp[idx] =3D color; + abits =3D ldq_be_p(&vga->vram_ptr[srcoff]); + xbits =3D ldq_be_p(&vga->vram_ptr[srcoff + 8]); + mask =3D BIT_ULL(63); + for (int i =3D 0; i < 64; i++, mask >>=3D 1) { + if (vga->hw_cursor_x + i >=3D h) { + return; /* end of screen, don't span to next line */ } + if (abits & mask) { + if (xbits & mask) { + color =3D dp[i] ^ 0xffffffff; /* complement */ + } else { + continue; /* transparent, no change */ + } + } else { + color =3D (xbits & mask ? s->regs.cur_color1 : + s->regs.cur_color0) | 0xff000000; + } + dp[i] =3D color; } } =20 --=20 2.53.0