change gpu's memory from cache to writecombine

This commit is contained in:
杜坤明
2011-02-22 18:14:03 +08:00
parent 46bdf9cd40
commit 005c8d3581
3 changed files with 27 additions and 8 deletions

View File

@@ -267,9 +267,12 @@
/*
gcdENABLE_MEM_CACHE
<20><><EFBFBD><EFBFBD>GPU<50><55>ʹ<EFBFBD>õ<EFBFBD>memory<72>Ƿ<EFBFBD><C7B7><EFBFBD>ARM Cacheס
<20><><EFBFBD><EFBFBD>GPU<50><55>ʹ<EFBFBD>õ<EFBFBD>memory<72>Ƿ<EFBFBD><C7B7><EFBFBD>ARM Cache<EFBFBD><EFBFBD>WriteCombineס
1: Cached
2: WriteCombine
*/
#define gcdENABLE_MEM_CACHE 1
#define gcdENABLE_MEM_CACHE 2
#endif /* __gc_hal_options_h_ */

View File

@@ -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;

View File

@@ -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;