From patchwork Mon May 16 14:49:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 12850945 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3E73FC433F5 for ; Mon, 16 May 2022 15:14:14 +0000 (UTC) Received: from localhost ([::1]:54540 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nqcQH-0006Qu-D5 for qemu-devel@archiver.kernel.org; Mon, 16 May 2022 11:14:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51086) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqc3f-0005q6-Ds for qemu-devel@nongnu.org; Mon, 16 May 2022 10:50:52 -0400 Received: from mout.gmx.net ([212.227.17.21]:58139) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqc2o-0008DA-UK for qemu-devel@nongnu.org; Mon, 16 May 2022 10:50:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1652712577; bh=5x4+C6mz6HEzsXk7Lu4h8DanGcn0kCUqL/Q4G/Hnrm8=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=N+hfRYkYcDz9uM5nO+yJGz6bw2EqyNZEUe8f+u+zCKMi7z/YSm/2qxcGNXdQRQLqT ETSFr6lNGQ6e0swPEaiZCJVU7BeMswOEDLwItXDmWSmldw3F7EuXuDlfowAvlnu8Yu KxJ0dkQxCwY2nt6+acGju50pQq/ykb2Q+a+m2xZg= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from p100.fritz.box ([92.116.160.68]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N6sit-1npISM0oHP-018HIT; Mon, 16 May 2022 16:49:37 +0200 From: Helge Deller To: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Mark Cave-Ayland , Sven Schnelle , qemu-devel@nongnu.org Cc: Stefano Repici , Helge Deller Subject: [PATCH v3 5/7] artist: Allow to turn cursor on or off Date: Mon, 16 May 2022 16:49:32 +0200 Message-Id: <20220516144934.36273-6-deller@gmx.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220516144934.36273-1-deller@gmx.de> References: <20220516144934.36273-1-deller@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:1JeoQlLY8M79t2fweTgXfPuSkkQZ7Z0NO6LmIDr9ZbduKyipU5r k98NIR7OQPxhaWxqmxSjPdihBmLfbRRegIzixQXbDKSOkjSnAMf4yK4ZSahb4GNbaEdXvQe Qs4cJ8+2qZn5lDoNu0yNlN+5/z7/B4c28AFa87Pm4RawfoduqsdVlEOkIvEyqNUILhqzLJj nqCjqIfQGRF8M5KGOUp3w== X-UI-Out-Filterresults: notjunk:1;V03:K0:MOen53g1oIY=:YNW8pizsuPczNWH1xWWKUE bk72qUSD4pQf1jBJ9wjLawzYhPLgqBhO8RUNYGtjdsUnW1KzD/ZdrgVakybQktqecQSLvLpSD yHCOz/GuHiHICWUXqQeyHogIQHrHysX0XcvddyUh+k9ZjgOaXlY7YVNHr8P+8Twx/+yqxbMxv ulKrveb9erPLaIkUQsTeswnF7+/6nFvKXfgn7QIZDwuq5yKGHioQygBE5uFt3V+M2d2U0m/Dc W0Pyw17fq/r9G1pfEau/AgiIGY1Rox6cNy6HGFbscu3DbiTK0wVuD0Dh0MkVfww/+w7nzHBzS 9KYhPig9X1NXUoXKPYyqLlGm5ak/LcnNrWiz4f+R9CMPjENuB1acJu+Ep94dCwQ6musr0eInA 6t/xWcScWVZu5xU6DtoSm6SqqeIGAgXx3r5GKujyEGNa4o9t9lTafoGctPWDmrxf4OdrVtK7B 4+hxg7q0esJ6YofCu1hdzjyhbDb00GYNc6aMyITYB4Qi1AA7taxozBG9cfUCzMCmCi8Q6Ox7L MnQUwuHrn8sJjobN8lID+4rh7gwrZyHGL3DuvVQ/pWwbjeCclREehz7pX44DO+KWXG0xBr6V+ zwO8UzyrwlS7IcIwdduicyoBTIKf21Dm2XG7fhdqihzYspK2CrRTX0/ulyLScvOQ79m0PeubX f3n3NA6S+eoCfxCNBRRB77JQAWMN4PeKwbsJvy7WjT0ta9PRp/hWOVqoEkWvQHa7yN4zsi8m6 aH21BW1xEsQGtumpFOpeOAgGj3a7zW9CiLoDb1RDp9MbfWhCZv5MXQI2moXwKSbLoj4Oqyjkk 3mWiM6oP0KiMflGQMhEF6caYg9pwmeq+TjmJMJE2sF8BxkWvEJww7filuAtpd+0nOjMiCkWD7 /CSmJqq8OsjsxPbUUGMrj81lsXTQjjOdA89kEAzfYFFJrjfLqREPgO84BncIuieurSREtdZnM HBQV/86HYqlMMR+t8nNskeWl7YcSbDTFWq6rUZ+jJ8Dcf8nJxDWSNcMXBeIo3HV5mDPBcHq4I qoc9Res8QquK3Bnr8MTYwDtBkDgfDA539itePgxTK9UQgqX1fPies3rydjg5Zwyd/V6F5Dtcm Ce7xPFqpoUfpXo= Received-SPF: pass client-ip=212.227.17.21; envelope-from=deller@gmx.de; helo=mout.gmx.net X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, FREEMAIL_FROM=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01, T_SPF_TEMPERROR=0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Bit 0x80 in the cursor_cntrl register specifies if the cursor should be visible. Prevent rendering the cursor if it's invisible. Signed-off-by: Helge Deller Acked-by: Mark Cave-Ayland --- hw/display/artist.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) -- 2.35.3 diff --git a/hw/display/artist.c b/hw/display/artist.c index 780cb15026..b8930b7c5a 100644 --- a/hw/display/artist.c +++ b/hw/display/artist.c @@ -353,10 +353,20 @@ static void artist_get_cursor_pos(ARTISTState *s, int *x, int *y) } } +static inline bool cursor_visible(ARTISTState *s) +{ + /* cursor is visible if bit 0x80 is set in cursor_cntrl */ + return s->cursor_cntrl & 0x80; +} + static void artist_invalidate_cursor(ARTISTState *s) { int x, y; + if (!cursor_visible(s)) { + return; + } + artist_get_cursor_pos(s, &x, &y); artist_invalidate_lines(&s->vram_buffer[ARTIST_BUFFER_AP], y, s->cursor_height); @@ -1218,6 +1228,10 @@ static void artist_draw_cursor(ARTISTState *s) struct vram_buffer *cursor0, *cursor1 , *buf; int cx, cy, cursor_pos_x, cursor_pos_y; + if (!cursor_visible(s)) { + return; + } + cursor0 = &s->vram_buffer[ARTIST_BUFFER_CURSOR1]; cursor1 = &s->vram_buffer[ARTIST_BUFFER_CURSOR2]; buf = &s->vram_buffer[ARTIST_BUFFER_AP];