29 lines
1.1 KiB
Diff
29 lines
1.1 KiB
Diff
From b30d458202bc0304c705eb081b12ead860584bea Mon Sep 17 00:00:00 2001
|
|
From: Keith Packard <keithp@keithp.com>
|
|
Date: Wed, 16 Apr 2008 19:10:52 +0000
|
|
Subject: 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.
|
|
---
|
|
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
|
|
|
|
--
|
|
cgit v0.7.2-37-g538c
|
|
|