diff options
author | Keith Packard <keithp@keithp.com> | 2008-04-16 12:10:52 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2008-04-16 12:11:18 -0700 |
commit | b30d458202bc0304c705eb081b12ead860584bea (patch) | |
tree | 31b8ccbbc7680927cc668adc72206393423c135e | |
parent | a3b63c43b960e3b37e1b303214e63c5155192a5d (diff) |
Kludge around linux bug and turn off write-through and cache-disable bits
When mmaping the PCI device, the kernel turns on the write-through and
cache-disable bits in the allocated PTEs. This disables write-combining mode
and dramatically reduces write bandwidth to the frame buffer. While that
should be fixed in the kernel, we'll kludge around it here by using mprotect
to rewrite the PTEs and get those bits turned off.
-rw-r--r-- | src/linux_sysfs.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/linux_sysfs.c b/src/linux_sysfs.c index 873dc02..78584d6 100644 --- a/src/linux_sysfs.c +++ b/src/linux_sysfs.c @@ -558,6 +558,9 @@ pci_device_linux_sysfs_map_range(struct pci_device *dev, strerror(errno), errno); /* err = errno;*/ } + /* KLUDGE ALERT -- rewrite the PTEs to turn off the CD and WT bits */ + mprotect (map->memory, map->size, PROT_NONE); + mprotect (map->memory, map->size, PROT_READ|PROT_WRITE); } #endif |