From: Sven Schnelle <svens@stackframe.org>
To: "Helge Deller" <deller@gmx.de>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: qemu-devel@nongnu.org
Subject: [PATCH 1/3] hw/display/artist: fix cursor position
Date: Fri, 21 Jan 2022 23:16:17 +0100 [thread overview]
Message-ID: <20220121221619.1069447-2-svens@stackframe.org> (raw)
In-Reply-To: <20220121221619.1069447-1-svens@stackframe.org>
Register 0x300200 and 0x300208 seems to be used as scratch register
by HP-UX for cursor offset data. It writes a calculated value on X
startup, and later reads it back and uses this as offset for all
cursor movements. I couldn't figure how this number is calculated,
but forcing it to a fixed value fixes the cursor position problems
for all HP-UX versions.
Signed-off-by: Sven Schnelle <svens@stackframe.org>
---
hw/display/artist.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/hw/display/artist.c b/hw/display/artist.c
index 21b7fd1b44..7956a1a5c3 100644
--- a/hw/display/artist.c
+++ b/hw/display/artist.c
@@ -326,15 +326,8 @@ static void artist_rop8(ARTISTState *s, struct vram_buffer *buf,
static void artist_get_cursor_pos(ARTISTState *s, int *x, int *y)
{
- /*
- * Don't know whether these magic offset values are configurable via
- * some register. They are the same for all resolutions, so don't
- * bother about it.
- */
-
- *y = 0x47a - artist_get_y(s->cursor_pos);
- *x = ((artist_get_x(s->cursor_pos) - 338) / 2);
-
+ *y = 0x400 - artist_get_y(s->cursor_pos);
+ *x = (artist_get_x(s->cursor_pos) + 16) / 2;
if (*x > s->width) {
*x = 0;
}
@@ -1122,11 +1115,15 @@ static uint64_t artist_reg_read(void *opaque, hwaddr addr, unsigned size)
break;
case 0x300200:
- val = s->reg_300200;
- break;
-
case 0x300208:
- val = s->reg_300208;
+ /*
+ * Seems to be relevant to cursor position, likely a scratch register.
+ * HP-UX initializes this with different values depending on version.
+ * Best guess is that this number is generated from STI data or other
+ * registers. I couldn't figure out how this number is generated. For
+ * now hardcode it to a number generating a zero cursor offset.
+ */
+ val = 0x00f01000;
break;
case 0x300218:
--
2.34.1
next prev parent reply other threads:[~2022-01-21 22:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-21 22:16 [PATCH 0/3] hw/display/artist: cursor & buffer mode fixes Sven Schnelle
2022-01-21 22:16 ` Sven Schnelle [this message]
2022-01-21 22:16 ` [PATCH 2/3] hw/display/artist: allow to disable/enable cursor Sven Schnelle
2022-01-25 8:11 ` Gerd Hoffmann
2022-01-21 22:16 ` [PATCH 3/3] hw/display/artist: rewrite vram access mode handling Sven Schnelle
2022-01-25 8:25 ` Gerd Hoffmann
2022-01-25 16:29 ` Sven Schnelle
2022-01-26 9:08 ` Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220121221619.1069447-2-svens@stackframe.org \
--to=svens@stackframe.org \
--cc=deller@gmx.de \
--cc=f4bug@amsat.org \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).