change gpu's memory from cache to writecombine
This commit is contained in:
parent
46bdf9cd40
commit
005c8d3581
3 changed files with 27 additions and 8 deletions
|
|
@ -267,9 +267,12 @@
|
|||
/*
|
||||
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_ */
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
22
drivers/staging/rk29/vivante/hal/os/linux/kernel/gc_hal_kernel_os.c
Executable file → Normal file
22
drivers/staging/rk29/vivante/hal/os/linux/kernel/gc_hal_kernel_os.c
Executable file → Normal 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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue