海思平台的内存分为两部分,一部分给系统使用,另外的一部分给多媒体使用。可以通过cat /proc/meminfo查看系统内存和cat /proc/media-mem 查看多媒体内存使用情况。
/proc # cat /proc/meminfo
MemTotal: 255192 kB
MemFree: 103232 kB
Buffers: 25328 kB
Cached: 36888 kB
SwapCached: 0 kB
Active: 74936 kB
Inactive: 56008 kB
Active(anon): 68900 kB
Inactive(anon): 272 kB
Active(file): 6036 kB
Inactive(file): 55736 kB
Unevictable: 0 kB
Mlocked: 0 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 255192 kB
LowFree: 103232 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 4320 kB
Writeback: 0 kB
AnonPages: 68748 kB
Mapped: 7032 kB
Shmem: 444 kB
Slab: 9440 kB
SReclaimable: 5632 kB
SUnreclaim: 3808 kB
KernelStack: 1000 kB
PageTables: 748 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 127596 kB
Committed_AS: 648944 kB
VmallocTotal: 761856 kB
VmallocUsed: 57556 kB
VmallocChunk: 688216 kB
多媒体内存:
/proc # cat /proc/media-mem
+---ZONE: PHYS(0x90000000, 0x9FFFFFFF), GFP=0, nBYTES=262144KB, NAME="anonymous"
|-MMB: phys(0x90000000, 0x90000FFF), kvirt=0x (null), flags=0x00000000, length=4KB, name="SYS_DCI_coef"
|-MMB: phys(0x90001000, 0x90003FFF), kvirt=0x (null), flags=0x00000000, length=12KB, name="SYS_scale_coef"
|-MMB: phys(0x90004000, 0x90006FFF), kvirt=0x (null), flags=0x00000000, length=12KB, name="SYS_scale_coef"
|-MMB: phys(0x90007000, 0x90086FFF), kvirt=0x (null), flags=0x00000000, length=512KB, name="TDE_MemPool"
|-MMB: phys(0x90087000, 0x900D7FFF), kvirt=0x (null), flags=0x00000000, length=324KB, name="VGS_NodeBuf"
|-MMB: phys(0x900D8000, 0x90128FFF), kvirt=0x (null), flags=0x00000000, length=324KB, name="VGS_VpssNodeBuf"
|-MMB: phys(0x90129000, 0x9012BFFF), kvirt=0x (null), flags=0x00000000, length=12KB, name="RgnModInfo"
|-MMB: phys(0x9012C000, 0x90134FFF), kvirt=0x (null), flags=0x00000000, length=36KB, name="vpss_drv_queue"
|-MMB: phys(0x90135000, 0x9013DFFF), kvirt=0x (null), flags=0x00000000, length=36KB, name="RgnModInfo"
|-MMB: phys(0x9013E000, 0x90146FFF), kvirt=0x (null), flags=0x00000000, length=36KB, name="RgnModInfo"
|-MMB: phys(0x90147000, 0x90169FFF), kvirt=0x (null), flags=0x00000000, length=140KB, name="RgnModInfo"
|-MMB: phys(0x9016A000, 0x9018CFFF), kvirt=0x (null), flags=0x00000000, length=140KB, name="RgnModInfo"
|-MMB: phys(0x9018D000, 0x901AFFFF), kvirt=0x (null), flags=0x00000000, length=140KB, name="RgnModInfo"
|-MMB: phys(0x901B0000, 0x901D2FFF), kvirt=0x (null), flags=0x00000000, length=140KB, name="RgnModInfo"
|-MMB: phys(0x901D3000, 0x901DBFFF), kvirt=0x (null), flags=0x00000000, length=36KB, name="VoCoef"
|-MMB: phys(0x901DC000, 0x901E3FFF), kvirt=0x (null), flags=0x00000000, length=32KB, name="RgnModInfo"
|-MMB: phys(0x901E4000, 0x901EBFFF), kvirt=0x (null), flags=0x00000000, length=32KB, name="RgnModInfo"
|-MMB: phys(0x901EC000, 0x901F3FFF), kvirt=0x (null), flags=0x00000000, length=32KB, name="RgnModInfo"
|-MMB: phys(0x901F4000, 0x909DCFFF), kvirt=0x (null), flags=0x00000000, length=8100KB, name="hifb_layer0"
|-MMB: phys(0x909DD000, 0x90B71FFF), kvirt=0x (null), flags=0x00000000, length=1620KB, name="hifb_layer1"
|-MMB: phys(0x90B72000, 0x90B91FFF), kvirt=0x (null), flags=0x00000000, length=128KB, name="hifb_layer2"
|-MMB: phys(0x90B92000, 0x90B96FFF), kvirt=0x (null), flags=0x00000000, length=20KB, name="RgnModInfo"
|-MMB: phys(0x90B97000, 0x90BCBFFF), kvirt=0x (null), flags=0x00000000, length=212KB, name="IVE_QUEUE"
|-MMB: phys(0x90BCC000, 0x90BCCFFF), kvirt=0x (null), flags=0x00000000, length=4KB, name="IVE_TEMP_NODE"
|-MMB: phys(0x90BCD000, 0x92BD6FFF), kvirt=0x (null), flags=0x00000000, length=32808KB, name="VbPool"
|-MMB: phys(0x92BD7000, 0x94BE0FFF), kvirt=0x (null), flags=0x00000000, length=32808KB, name="VbPool"
|-MMB: phys(0x94BE1000, 0x95A1DFFF), kvirt=0x (null), flags=0x00000000, length=14580KB, name="VbPool"
|-MMB: phys(0x95A1E000, 0x9685AFFF), kvirt=0x (null), flags=0x00000000, length=14580KB, name="VbPool"
|-MMB: phys(0x9685B000, 0x96D34FFF), kvirt=0x (null), flags=0x00000000, length=4968KB, name="VbPool"
|-MMB: phys(0x96D35000, 0x96D35FFF), kvirt=0x (null), flags=0x00000000, length=4KB, name="Grp RgnLuma buf"
|-MMB: phys(0x96D36000, 0x96D36FFF), kvirt=0x (null), flags=0x00000000, length=4KB, name="Chn RgnLuma buf"
|-MMB: phys(0x96D37000, 0x96D39FFF), kvirt=0x (null), flags=0x00000000, length=12KB, name="model buf"
|-MMB: phys(0x96D3A000, 0x96EA9FFF), kvirt=0x (null), flags=0x00000000, length=1472KB, name="Ref&Mad buf"
|-MMB: phys(0x96EAA000, 0x96EAAFFF), kvirt=0x (null), flags=0x00000000, length=4KB, name="Dci buf"
|-MMB: phys(0x96EAB000, 0x9701AFFF), kvirt=0x (null), flags=0x00000000, length=1472KB, name="Ref&Mad buf"
|-MMB: phys(0x9701B000, 0x9701BFFF), kvirt=0x (null), flags=0x00000000, length=4KB, name="Dci buf"
|-MMB: phys(0x9701C000, 0x9701CFFF), kvirt=0x (null), flags=0x00000000, length=4KB, name="Grp RgnLuma buf"
|-MMB: phys(0x9701D000, 0x9701DFFF), kvirt=0x (null), flags=0x00000000, length=4KB, name="Chn RgnLuma buf"
|-MMB: phys(0x9701E000, 0x97020FFF), kvirt=0x (null), flags=0x00000000, length=12KB, name="model buf"
|-MMB: phys(0x97021000, 0x97022FFF), kvirt=0x (null), flags=0x00000000, length=8KB, name="AI(0) DMABuf"
|-MMB: phys(0x97023000, 0x9707CFFF), kvirt=0x (null), flags=0x00000000, length=360KB, name="AI(0) FrmBuf"
|-MMB: phys(0x9707D000, 0x97244FFF), kvirt=0x (null), flags=0x00000000, length=1824KB, name="[VOU]VSD(2)"
|-MMB: phys(0x97245000, 0x97408FFF), kvirt=0x (null), flags=0x00000000, length=1808KB, name="h264e0_Str"
|-MMB: phys(0x97409000, 0x9740DFFF), kvirt=0x (null), flags=0x00000000, length=20KB, name="h264e0_Ct"
|-MMB: phys(0x9740E000, 0x976B4FFF), kvirt=0x (null), flags=0x00000000, length=2716KB, name="h264e0_RcnVb"
|-MMB: phys(0x976B5000, 0x976BFFFF), kvirt=0x (null), flags=0x00000000, length=44KB, name="RgnPinPon"
|-MMB: phys(0x976C0000, 0x976D3FFF), kvirt=0x (null), flags=0x00000000, length=80KB, name="RgnPinPon"
|-MMB: phys(0x976D4000, 0x976EAFFF), kvirt=0x (null), flags=0x00000000, length=92KB, name="RgnPinPon"
|-MMB: phys(0x976EB000, 0x976F3FFF), kvirt=0x (null), flags=0x00000000, length=36KB, name="RgnPinPon"
|-MMB: phys(0x976F4000, 0x976FCFFF), kvirt=0x (null), flags=0x00000000, length=36KB, name="RgnPinPon"
|-MMB: phys(0x976FD000, 0x97704FFF), kvirt=0x (null), flags=0x00000000, length=32KB, name="RgnPinPon"
|-MMB: phys(0x97705000, 0x9770AFFF), kvirt=0x (null), flags=0x00000000, length=24KB, name="RgnPinPon"
|-MMB: phys(0x9770B000, 0x97747FFF), kvirt=0x (null), flags=0x00000000, length=244KB, name="AENC(0)StrmBuf"
|-MMB: phys(0x97748000, 0x9774FFFF), kvirt=0x (null), flags=0x00000000, length=32KB, name="AENC(0) CirBuf"
|-MMB: phys(0x97750000, 0x97750FFF), kvirt=0x (null), flags=0x00000000, length=4KB, name="DevCutPower"
---MMZ_USE_INFO:
total size=262144KB(256MB),used=122180KB(119MB + 324KB),remain=139964KB(136MB + 700KB),zone_number=1,block_number=55
/proc #
我的DDR是512M的,256M分配给了系统使用,256M分配给了多媒体。
系统内存设置:
系统内存分配,也就是分配给linux系统使用的,也包括用户的应用程序,这部分的参数设置是在uboot中完成,然后uboot传递给kernel。如下命令,mem设置的就是系统内存。
setenv bootargs 'mem=256M console=ttyAMA0,115200 root=/dev/mtdblock2 rootfstype=jffs2 mtdparts=hi_sfc:1M(boot),4M(kernel),8M(rootfs),4M(app&data),4M(data),2M(parameter),8M(updatefs)'
多媒体内存设置:
多媒体内存是在海思平台用来编码解码操作是使用的内存,他的设置是在文件系统/lib/modules/driver_ko 目录下的load文件中完成。
####################Variables Definition##########################
AD_TYPE=6134 # ad type
mem_total=512; # 512M, total mem
mem_start=0x80000000; # phy mem start
os_mem_size=256; # 256M, os mem
mmz_start=0x90000000; # mmz start addr
mmz_size=256M; # 256M, mmz size
##################################################################
mmz_size 设置的就是多媒体内存。这里需要多注意一点,系统内存os_mem_size在这里是不能设置成功的,需要在到boot里面设置。系统内存+多媒体内存=物理内存。设置小了浪费内存,设置大了易出现异常。