All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -queue 0/2] loongson2f: add video acceleration support
@ 2009-11-11  5:59 Wu Zhangjin
  2009-11-11  5:59 ` [PATCH -queue 1/2] [loongson] 2f: Add CPU_SUPPORT_VIDEO_ACC Wu Zhangjin
  0 siblings, 1 reply; 3+ messages in thread
From: Wu Zhangjin @ 2009-11-11  5:59 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-mips, Wu Zhangjin

This patchset add video acceleration support for loongson2f family machines via
uncached accelerated TLB mapping.

We add a new option CPU_SUPPORT_VIDEO_ACC for loongson2f and it's successors,
so all of them can share this souce code via selecting this option.

Thanks!
	Wu Zhangjin

Wu Zhangjin (2):
  [loongson] 2f: Add CPU_SUPPORT_VIDEO_ACC
  [loongson] 2f: Improve video performance via uncached accelerated TLB
    map

 arch/mips/Kconfig               |    4 +++
 arch/mips/include/asm/pgtable.h |   13 +++++++++
 arch/mips/loongson/common/mem.c |   58 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 75 insertions(+), 0 deletions(-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH -queue 1/2] [loongson] 2f: Add CPU_SUPPORT_VIDEO_ACC
  2009-11-11  5:59 [PATCH -queue 0/2] loongson2f: add video acceleration support Wu Zhangjin
@ 2009-11-11  5:59 ` Wu Zhangjin
  2009-11-11  5:59   ` [PATCH -queue 2/2] [loongson] 2f: Improve video performance via uncached accelerated TLB map Wu Zhangjin
  0 siblings, 1 reply; 3+ messages in thread
From: Wu Zhangjin @ 2009-11-11  5:59 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-mips, Wu Zhangjin

Loongson2f support video acceleration.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 arch/mips/Kconfig |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 539c384..2e39609 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1318,6 +1318,9 @@ config CPU_LOONGSON2
 config SYS_HAS_CPU_LOONGSON2E
 	bool
 
+config CPU_SUPPORT_VIDEO_ACC
+	bool
+
 config CPU_SUPPORT_CPUFREQ
 	bool
 
@@ -1328,6 +1331,7 @@ config SYS_HAS_CPU_LOONGSON2F
 	bool
 	select CPU_SUPPORT_CPUFREQ
 	select CPU_SUPPORT_ADDRWINCFG if 64BIT
+	select CPU_SUPPORT_VIDEO_ACC
 
 config SYS_HAS_CPU_MIPS32_R1
 	bool
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH -queue 2/2] [loongson] 2f: Improve video performance via uncached accelerated TLB map
  2009-11-11  5:59 ` [PATCH -queue 1/2] [loongson] 2f: Add CPU_SUPPORT_VIDEO_ACC Wu Zhangjin
@ 2009-11-11  5:59   ` Wu Zhangjin
  0 siblings, 0 replies; 3+ messages in thread
From: Wu Zhangjin @ 2009-11-11  5:59 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-mips, Wu Zhangjin

Loongson2F support video acceleration, and need to enable Uncached
Accelerated TLB map.

Uncached Accelerated TLB map can greatly improve video performance.
Normally the Video memory can be accessed in Uncached Accelerated mode,
other peripheral spaces not.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 arch/mips/include/asm/pgtable.h |   13 +++++++++
 arch/mips/loongson/common/mem.c |   58 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h
index d6eb613..56b8621 100644
--- a/arch/mips/include/asm/pgtable.h
+++ b/arch/mips/include/asm/pgtable.h
@@ -390,6 +390,19 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma,
 #include <asm-generic/pgtable.h>
 
 /*
+ * uncached accelerated TLB map for video memory access
+ */
+#ifdef CONFIG_CPU_SUPPORT_VIDEO_ACC
+#define __HAVE_PHYS_MEM_ACCESS_PROT
+
+struct file;
+pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
+		unsigned long size, pgprot_t vma_prot);
+int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
+		unsigned long size, pgprot_t *vma_prot);
+#endif
+
+/*
  * We provide our own get_unmapped area to cope with the virtual aliasing
  * constraints placed on us by the cache architecture.
  */
diff --git a/arch/mips/loongson/common/mem.c b/arch/mips/loongson/common/mem.c
index 467a91e..cf19393 100644
--- a/arch/mips/loongson/common/mem.c
+++ b/arch/mips/loongson/common/mem.c
@@ -59,3 +59,61 @@ int __uncached_access(struct file *file, unsigned long addr)
 	    ((addr >= LOONGSON_MMIO_MEM_START) &&
 	     (addr < LOONGSON_MMIO_MEM_END));
 }
+
+#ifdef CONFIG_CPU_SUPPORT_VIDEO_ACC
+
+#include <linux/pci.h>
+#include <linux/sched.h>
+#include <asm/current.h>
+
+static unsigned long uca_start, uca_end;
+
+pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
+			      unsigned long size, pgprot_t vma_prot)
+{
+	unsigned long offset = pfn << PAGE_SHIFT;
+	unsigned long end = offset + size;
+
+	if (__uncached_access(file, offset)) {
+		if (((uca_start && offset) >= uca_start) &&
+		    (end <= uca_end))
+			return __pgprot((pgprot_val(vma_prot) &
+					 ~_CACHE_MASK) |
+					_CACHE_UNCACHED_ACCELERATED);
+		else
+			return pgprot_noncached(vma_prot);
+	}
+	return vma_prot;
+}
+
+static int __init find_vga_mem_init(void)
+{
+	struct pci_dev *dev = 0;
+	struct resource *r;
+	int idx;
+
+	if (uca_start)
+		return 0;
+
+	for_each_pci_dev(dev) {
+		if ((dev->class >> 8) == PCI_CLASS_DISPLAY_VGA) {
+			for (idx = 0; idx < PCI_NUM_RESOURCES; idx++) {
+				r = &dev->resource[idx];
+				if (!r->start && r->end)
+					continue;
+				if (r->flags & IORESOURCE_IO)
+					continue;
+				if (r->flags & IORESOURCE_MEM) {
+					uca_start = r->start;
+					uca_end = r->end;
+					return 0;
+				}
+			}
+		}
+	}
+
+	return 0;
+}
+
+late_initcall(find_vga_mem_init);
+#endif				/* !CONFIG_CPU_SUPPORT_VIDEO_ACC */
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-11-11  6:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-11  5:59 [PATCH -queue 0/2] loongson2f: add video acceleration support Wu Zhangjin
2009-11-11  5:59 ` [PATCH -queue 1/2] [loongson] 2f: Add CPU_SUPPORT_VIDEO_ACC Wu Zhangjin
2009-11-11  5:59   ` [PATCH -queue 2/2] [loongson] 2f: Improve video performance via uncached accelerated TLB map Wu Zhangjin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.