summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2014-05-15 06:58:24 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-06-30 20:11:56 -0700
commit4d7d9fb81084361ece363d6038bde2fdf9e9d510 (patch)
treed1f805194a61efd4c8761beecfe7a573b0344d33
parent04e0002916df7668303e9ec855709327352fc9a2 (diff)
downloadlinux-stable-4d7d9fb81084361ece363d6038bde2fdf9e9d510.tar.gz
linux-stable-4d7d9fb81084361ece363d6038bde2fdf9e9d510.tar.bz2
linux-stable-4d7d9fb81084361ece363d6038bde2fdf9e9d510.zip
matroxfb: perform a dummy read of M_STATUS
commit 972754cfaee94d6e25acf94a497bc0a864d91b7e upstream. 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> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/video/matrox/matroxfb_base.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h
index 556d96ce40bf..89a8a89a5eb2 100644
--- a/drivers/video/matrox/matroxfb_base.h
+++ b/drivers/video/matrox/matroxfb_base.h
@@ -698,7 +698,7 @@ void matroxfb_unregister_driver(struct matroxfb_driver* drv);
#define mga_fifo(n) do {} while ((mga_inl(M_FIFOSTATUS) & 0xFF) < (n))
-#define WaitTillIdle() do {} while (mga_inl(M_STATUS) & 0x10000)
+#define WaitTillIdle() do { mga_inl(M_STATUS); do {} while (mga_inl(M_STATUS) & 0x10000); } while (0)
/* code speedup */
#ifdef CONFIG_FB_MATROX_MILLENIUM