* [Qemu-devel] Possible bug in cirrus_vga.c vs. HDR handling
@ 2012-07-25 2:52 Benjamin Herrenschmidt
0 siblings, 0 replies; only message in thread
From: Benjamin Herrenschmidt @ 2012-07-25 2:52 UTC (permalink / raw)
To: qemu-devel
Hi folks !
I was debugging a problem with 16bpp support, when I found out that
my attempts at writing to the Hidden DAC Register were not working.
The reason was that I (well, cirrusdrmfb really) was doing the sequence
READ, READ, READ, READ, WRITE (to the DAC mask register), which should
have worked, except that the code in qemu for reads does:
static int cirrus_read_hidden_dac(CirrusVGAState * s)
{
if (++s->cirrus_hidden_dac_lockindex == 5) {
s->cirrus_hidden_dac_lockindex = 0;
return s->cirrus_hidden_dac_data;
}
return 0xff;
}
(Note the *pre*increment)
And s->cirrus_hidden_dac_lockindex is initialized in cirrus_reset() to:
s->cirrus_hidden_dac_lockindex = 5;
So the first 4 reads cause it to go to 6,7,8,9... and never
actually wrap back, so the write doesn't work as it checks for
the value being exactly 4.
Now, that -might- mimmic the real HW (I've added a workaround to drmfb
that does a dummy write first), but it looks dubious to me.
Shouldn't we initialize the lockindex to 0 in reset ? or to 4 ?
Cheers,
Ben.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-07-25 2:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-25 2:52 [Qemu-devel] Possible bug in cirrus_vga.c vs. HDR handling Benjamin Herrenschmidt
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).