Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

matroxfb: perform a dummy read of M_STATUS

I had occasional screen corruption with the matrox framebuffer driver and
I found out that the reason for the corruption is that the hardware
blitter accesses the videoram while it is being written to.

The matrox driver has a macro WaitTillIdle() that should wait until the
blitter is idle, but it sometimes doesn't work. I added a dummy read
mga_inl(M_STATUS) to WaitTillIdle() to fix the problem. The dummy read
will flush the write buffer in the PCI chipset, and the next read of
M_STATUS will return the hardware status.

Since applying this patch, I had no screen corruption at all.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

authored by

Mikulas Patocka and committed by
Tomi Valkeinen
972754cf 80c68c1e

+1 -1
+1 -1
drivers/video/fbdev/matrox/matroxfb_base.h
··· 698 698 699 699 #define mga_fifo(n) do {} while ((mga_inl(M_FIFOSTATUS) & 0xFF) < (n)) 700 700 701 - #define WaitTillIdle() do {} while (mga_inl(M_STATUS) & 0x10000) 701 + #define WaitTillIdle() do { mga_inl(M_STATUS); do {} while (mga_inl(M_STATUS) & 0x10000); } while (0) 702 702 703 703 /* code speedup */ 704 704 #ifdef CONFIG_FB_MATROX_MILLENIUM