change gpu's memory from cache to writecombine
author杜坤明 <dkm@rockchip.com>
Tue, 22 Feb 2011 10:14:03 +0000 (18:14 +0800)
committer杜坤明 <dkm@rockchip.com>
Tue, 22 Feb 2011 10:14:03 +0000 (18:14 +0800)
drivers/staging/rk29/vivante/hal/inc/gc_hal_options.h
drivers/staging/rk29/vivante/hal/os/linux/kernel/gc_hal_kernel_driver.c
drivers/staging/rk29/vivante/hal/os/linux/kernel/gc_hal_kernel_os.c [changed mode: 0755->0644]

index 69f502aea631d407abcfb707497176626e802c96..6e480912cd9cb951c41ef2515f70564ac3292ec3 100755 (executable)
 /*
     gcdENABLE_MEM_CACHE
 
-    ÅäÖÃGPUËùʹÓõÄmemoryÊÇ·ñ±»ARM Cacheס
+    ÅäÖÃGPUËùʹÓõÄmemoryÊÇ·ñ±»ARM Cache»òWriteCombineס
+    1: Cached
+    2: WriteCombine
+    
 */
-#define gcdENABLE_MEM_CACHE                 1
+#define gcdENABLE_MEM_CACHE                 2
 
 #endif /* __gc_hal_options_h_ */
 
index 09eff0c3cd9ee27c62fdb77eae911143c84d6a74..e2b3d9df485f59b3e8be8f27bfcd3323d4655590 100755 (executable)
@@ -466,7 +466,11 @@ static int drv_mmap(struct file * filp, struct vm_area_struct * vma)
         return -ENOTTY;
     }
 
-#if !gcdENABLE_MEM_CACHE
+#if (2==gcdENABLE_MEM_CACHE)
+    vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
+#elif (1==gcdENABLE_MEM_CACHE)
+    // NULL
+#else
     vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 #endif
     vma->vm_flags    |= VM_IO | VM_DONTCOPY | VM_DONTEXPAND;
old mode 100755 (executable)
new mode 100644 (file)
index 4ff3144..e6e62a4
@@ -1023,7 +1023,11 @@ gckOS_MapMemory(
         }
 #else
 
-#if !gcdENABLE_MEM_CACHE
+#if (2==gcdENABLE_MEM_CACHE)
+        mdlMap->vma->vm_page_prot = pgprot_writecombine(mdlMap->vma->vm_page_prot);
+#elif (1==gcdENABLE_MEM_CACHE)
+    // NULL
+#else
         mdlMap->vma->vm_page_prot = pgprot_noncached(mdlMap->vma->vm_page_prot);
 #endif
         mdlMap->vma->vm_flags |= VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_RESERVED;
@@ -1394,7 +1398,11 @@ gckOS_AllocateNonPagedMemory(
         }
 #else
 
-#if !gcdENABLE_MEM_CACHE
+#if (2==gcdENABLE_MEM_CACHE)
+        mdlMap->vma->vm_page_prot = pgprot_writecombine(mdlMap->vma->vm_page_prot);
+#elif (1==gcdENABLE_MEM_CACHE)
+        // NULL
+#else
         mdlMap->vma->vm_page_prot = pgprot_noncached(mdlMap->vma->vm_page_prot);
 #endif
         mdlMap->vma->vm_flags |= VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_RESERVED;
@@ -3014,7 +3022,11 @@ gceSTATUS gckOS_LockPages(
 
         mdlMap->vma->vm_flags |= VM_RESERVED;
         /* Make this mapping non-cached. */
-#if !gcdENABLE_MEM_CACHE
+#if (2==gcdENABLE_MEM_CACHE)
+        mdlMap->vma->vm_page_prot = pgprot_writecombine(mdlMap->vma->vm_page_prot);
+#elif (1==gcdENABLE_MEM_CACHE)
+        // NULL
+#else
         mdlMap->vma->vm_page_prot = pgprot_noncached(mdlMap->vma->vm_page_prot);
 #endif
 
@@ -5403,7 +5415,7 @@ gckOS_CacheFlush(
     IN gctSIZE_T Bytes
     )
 {
-#if gcdENABLE_MEM_CACHE
+#if (1==gcdENABLE_MEM_CACHE)
     dmac_clean_range(Logical, Logical+Bytes);
 #endif
     return gcvSTATUS_OK;
@@ -5439,7 +5451,7 @@ gckOS_CacheInvalidate(
     IN gctSIZE_T Bytes
     )
 {
-#if gcdENABLE_MEM_CACHE
+#if (1==gcdENABLE_MEM_CACHE)
     dmac_flush_range(Logical, Logical+Bytes);
 #endif
     return gcvSTATUS_OK;