[DEV]Possible way of enabling mali400 dynamic memory use and allocation - Sony Xperia P, U, Sola, Go

I did find this https://groups.google.com/forum/#!topic/linux-sunxi/dYCL84IQH_Yù
In short: changing an option you can have mali do dynamic ram allocation that means it uses only ram that it REALLY needs, not some hardcoded number like 192. So when it is not needing so much ram, system has more free ram. Everyone likes having more usable ram right?
Pasting relevant parts
Siarhei Siamashka said:
After this fix, Mali400 GPU is configured to use up to 256 MiB of
normal memory when CONFIG_SUNXI_MALI_RESERVED_MEM is not enabled.
When CONFIG_SUNXI_MALI_RESERVED_MEM is enabled, it uses 64 MiB of
reserved memory and up to 192 MiB of normal memory (same as before).
Click to expand...
Click to collapse
and this
Mali has MMU and does not strictly need any physically contiguous
memory reservation. Most users will likely prefer more flexible
memory allocation instead of always wasting 64 MiB (even when Mali
is not used or needs much less).
CONFIG_SUNXI_MALI_RESERVED_MEM option is still available and can
be enabled if needed (for performance or some other reasons).
Click to expand...
Click to collapse
I wanted to ask if something like this is doable for our Xperia devices here that have a mali400 (U, Sola, Go and P). And if yes, how can we do this? Or at least try to see if it works.
Is it an option that has to be set in a config file when compiling kernel? Can it be set as build prop or init.d or whatever?
I'm not a dev and I don't have the environment/skill to compile anything so unless it is something easy I'm probably not going to make it myself.
High hopes for this though... :laugh:

@95A31 @percy_g2 @DevSwift1

I looked to our kernel codes now, it's possible to apply it but I don't know, it shouldn't be that easy :/

if the choice of pre-allocating ram for mali was because of "safety" reasons like avoiding potential hacks to pirate stuff or sidestep limitations imposed by licensing or whatever (like for example some of the Xposed Framework's modules that allow youtube content over HDMI port or whatever), it can just be a matter of disabling settings.
Or maybe they pushed it into production before the drivers were stable enough for dynamic ram allocation to work reliably.
Some people running linux on arm boards with a mali400 gpu already recommend to build kernels disabling that option to "maximize available memory".
http://www.malaya-digital.org/make-...-an-external-usb-hard-disk-over-your-network/
pasting relevant part here (note that this is for compiling linux-on-arm kernel and for a different device, stuff may or may not apply to our phones):
9] To maximize available memory, edit .config and look for the line having "CONFIG_CMDLINE". Then edit the line to become::
CONFIG_CMDLINE="[email protected] console=ttyS0,115200 sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_no_mali_mem_reserve sunxi_fb_mem_reserve=8"
10] Look for CONFIG_SUNXI_MALI_RESERVED_MEM, CONFIG_MALI, and CONFIG_MALI400 in .config . Set them to "n" :
CONFIG_SUNXI_MALI_RESERVED_MEM=n
CONFIG_MALI=n
CONFIG_MALI400=n
Click to expand...
Click to collapse
Besides, I don't see why the heck a non-HD-resolution phone must keep 192 mb of dedicated gpu ram when anything else (desktop/laptop or console) can do perfectly fine with full HD resolutions and hardware accelerated h.264 decoding with a crappy card that has only 64mb of ram (and the hardware accelerator, of course).

Make more of a difference if we had a rom that actually used the leaked sources so it doesn't run like ****.
However I'd like this still as I don't game on my phone at all, so it's pointless for the gpu to use so much on mine.

Are there some devs working on it at the moment? It would be just great to have some MB's more RAM

I comparet our kernel with this one and they are totally different. AFAIK is not possible.

95A31 said:
I comparet our kernel with this one and they are totally different. AFAIK is not possible.
Click to expand...
Click to collapse
But it's still in AOSP todo, so we can hope? I think this can radically change our user experience, isn't it?

Our board uses only 32MB of RAM for Mali, not 64MB

Garcia98 said:
Our board uses only 32MB of RAM for Mali, not 64MB
Click to expand...
Click to collapse
then why we have only 392 mb out of 512? i know that some mbs are dedicated to the gpu, but 120mb to gpu????

alexhdkn said:
then why we have only 392 mb out of 512? i know that some mbs are dedicated to the gpu, but 120mb to gpu????
Click to expand...
Click to collapse
In Xperia U 15MB are used for memory debugger, 1MB for shared memory, 16MB for modem, 1MB for ISSW, 64MB (may vary) for hardware, 32MB are reserved for Mali and then 383MB (may vary) are available for the system

Regarding dynamic memory allocation, I don't think that using it would be a good idea, as it can lead to allocation failures, memory leaks and other logical errors. I'm sure that there is a reason why Igloo Community don't apply Mali dynamic memory allocation to Snowball
BTW, you can read here the opinion of a professional about dynamic memory allocation in real time systems: http://www.mentor.com/embedded-soft...10b6e1-f9e9-4d87-8c88-6ced717a9f7a?cmpid=8688 :good:

Said professional even goes further advising against the practice - but yet it landed on sunxi 3.4 branches, with dev even sounding almost shocked by the senselessness of the previous state of affair.
My educate guess is that if Igloo Community never lift a finger, is just because they were axed before such a secondary issue could become relevant, in the grand scheme of things.

Related

Parallella super computer, compiling android?

Does anyone know if the computer spoken about here http://www.kickstarter.com/projects...a-supercomputer-for-everyone?ref=home_popular would be able to compile android if it were running linux??
You would need to get all the tools for teh build system running for arm. I'm pretty sure most of it has been done (gcc, python, bash) because there is a ubuntu built for the arm cpu. The specs on that thing even say it will come with ubuntu on it,. I'm not sure if the jdk is done yet for arm.
I think you're gonna hit a wall with 1GB of ram easily. The operating system youre using will probably take up 1/4 to 1/3 of it. Go around and look at the requirements to build projects like firefox and openoffice. Last time I saw it, firefox needed like 3GB of ram for the linker. You can get a huge SD card and use it as swap space, but thats gonna slow down all those 64 cores. Next up is the disk interface. It has usb2, which is capped at 480MB/s [citation needed]. It doesn't benefit you at all that your cpu can build a bunch of source files at once if it gets bottlenecked at reading those source files from and writing the object files to the hard drive.
I say you probably will be able to get it to build android, but it wont be lightning fast, or really even remarkably fast. By the time you buy that thing for $99, and a keyboard, mouse, usb HDD, SD card, HDMI monitor, and whatever else you need to actually use it, you could have bought a "traditional" computer that has SATA and > 1GB of ram.
noneabove said:
Does anyone know if the computer spoken about here http://www.kickstarter.com/projects...a-supercomputer-for-everyone?ref=home_popular would be able to compile android if it were running linux??
Click to expand...
Click to collapse
No, it will not.
Compiling isn't a task suitable for such a parallel computer. Compiling is mostly I/O intense, not CPU intense, hence you would not gain anything here, even if you'd be able to distribute the compiling task to multiple cores, which is by itself not a trivial task if we are talking about more than a handful of cores.
Also, you don't need a project like this to run a parallel super computer. You can run in parallel on modern graphics cards today. E.g. get a NVIDIA GPU and start using CUDA, and you'll get the idea what it's all about.
Parallel supercomputing is more suitable for specific CPU intense task such as FFT, flow analysis, brute forcing crypto, neural nets and such, where you've got a relative limited amount of data in comparison to the amount CPU needed.
As has been said, much return (financial and performance) and less work to implement with CUDA.
example of the outrageous performance of a system CUDA:
with a password cracking software, with a core i5 was 125 000 operations / s ... to enable support Cuda software, has become more than 8 million / s

[Q] Are There any Kernels That Prepare more RAM for GPU

This came across my thoughts when I was doing research on dedicated RAM for system and GPU. I want to play Amazing Spiderman on my Xperia Mini but it doesn't seem to start and I believe its because of my CPU clock and my RAM. I have over 200MB of free RAM and I was wondering if there is any way I can dedicate some more to the GPU, with the use of a kernel. If there are any other method to doing so please tell me.:good::laugh:
I don't really think it's possible, but hey I'm not so into the advanced kernel developing stuff
Rage kernel but i think there is no increase in performance.
Ajmini said:
This came across my thoughts when I was doing research on dedicated RAM for system and GPU. I want to play Amazing Spiderman on my Xperia Mini but it doesn't seem to start and I believe its because of my CPU clock and my RAM. I have over 200MB of free RAM and I was wondering if there is any way I can dedicate some more to the GPU, with the use of a kernel. If there are any other method to doing so please tell me.:good::laugh:
Click to expand...
Click to collapse
Im running the game without lags on ics and panic kernel
Sent from my SK17i using xda app-developers app
You can't put more RAM to GPU. It is not possible. Not even on regular PCs.
as far as i know regular pc can add more ram by running hyper memory but only if the vga card support it
Someguyfromhell said:
You can't put more RAM to GPU. It is not possible. Not even on regular PCs.
Click to expand...
Click to collapse
Its possible to do on pc/laptop that use a gpu that is integrated on the chipset. For example, Intel hd series that share the amount of gpu memory with system ram...btw the base amount of gMemory for Intel hd series is 256mb and can go up to 1.8gb+ if I'm not mistaken.Also depends on the amount of system ram.
As for smartphone it should be able to do the same because the gpu is integrated on the chipset too...idk much about android so cant really tell

[Q] Fine tuning swap usage

Hey guys,
I have an HTC One V, which is a pretty low-mem device at 512MB RAM. I've been using a normal 256MB swap partition on my SD card with swappiness set to 100 and default minfree settings. This has already given me fantastic results, now I can switch between 4 running programs without having to reload any of them. Before the swap script 2 was the maximum, and even that wasn't always true. Basically I had no multitasking.
Now, I've been checking my memory usage in detail. It seems that when idle, there is about 80MB of free RAM, and around 80MB of swap space is being used. It seems that even though I have 256MB of swap space available, Android never really goes above using ~80. Is there a setting I can fine tune somewhere that would lead to better use of the swap space? From my limited understanding, it seems that in theory Android could store at least two or three more background apps on the swap partition instead of killing them. Which, of course, would lead to much better multitasking.
I'm also aware that using the full 256 megs might actually hurt performance, but I still want the OS to use more than 80.
Please don't flame me if this question has been asked before, I tried to search, but I only found threads discussing the value of vm.swappiness.
TRY TO USE KERNEL TUNER.
AS WELL AS INCREASE SWAPPINESS TO 128 MB.
BUT OS TAKES ONLY AS MUCH RAM IT WANTS U NO NEED TO WORRY THAT IT IS NOT PROPERLY UTILISED.
Hit thanks.....
caius112 said:
Hey guys,
I have an HTC One V, which is a pretty low-mem device at 512MB RAM. I've been using a normal 256MB swap partition on my SD card with swappiness set to 100 and default minfree settings. This has already given me fantastic results, now I can switch between 4 running programs without having to reload any of them. Before the swap script 2 was the maximum, and even that wasn't always true. Basically I had no multitasking.
Now, I've been checking my memory usage in detail. It seems that when idle, there is about 80MB of free RAM, and around 80MB of swap space is being used. It seems that even though I have 256MB of swap space available, Android never really goes above using ~80. Is there a setting I can fine tune somewhere that would lead to better use of the swap space? From my limited understanding, it seems that in theory Android could store at least two or three more background apps on the swap partition instead of killing them. Which, of course, would lead to much better multitasking.
I'm also aware that using the full 256 megs might actually hurt performance, but I still want the OS to use more than 80.
Please don't flame me if this question has been asked before, I tried to search, but I only found threads discussing the value of vm.swappiness.
Click to expand...
Click to collapse
Disclaimer: This is somewhat speculative.
The vm.swappiness is in principle what you are looking for, talking about Linux swap. Unfortunately, for you right now, the Andorid uses "application level swapping", i.e. the Android ActivityManager (userspace task) kills of app's when the memory gets low. Since Android normally don't utilize swapspace, there's a possibility ActivityManager doesn't looks at the size of the total virtual memory (including backed by swap), but only the physical memory installed. If so, it will continue killing app's at the same memory threshold as before, despite of the increased virtual memory size, hence not utilizing the increased virtual memory particularly well. This sounds as what you are describing.
You'll need to check the source ApplicationManager.java to examine the internals here.

Qualcomm hardware cryptographic engine doesn´t work on Z5C?

Hello,
i just got my Z5C yesterday and so far i´m more than happy. But there is one issue:
I use the AOSP Full disk encryption on the phone but it seems like the native Qualcomm hardware cryptographic engine doesn´t work well - i benchmarked the internal storage before and after, here are the results:
Before: read ~ 200 MB/s write: ~ 120 MB/s
After: read ~ 120 MB/s write: ~ 120 MB/s
(Benchmarked by A1 SD Bench)
I´m using a FDE on my windows 10 Notebook with an e-drive resulting in like 5% performance loss. The decrease in read-speed on the Z5C is noticable. What do you think, is there something wrong or is this a normal behaviour?
Cheers
I don't know if this helps, but it seems that the Nexus 5X and 6P won't use hardware encryption according to this:
DB> Encryption is software accelerated. Specifically the ARMv8 as part of 64-bit support has a number of instructions that provides better performance than the AES hardware options on the SoC.
Click to expand...
Click to collapse
Source: The Nexus 5X And 6P Have Software-Accelerated Encryption, But The Nexus Team Says It's Better Than Hardware Encryption
So maybe, Sony is following the same path...
Sadly they don't, it seems like the write-speed decrease is just on the same level as the N6 back then. Let's hope that they include the bibs in the kernel by the marshmellow update.
Why would they use Qualcomms own crappy crypto engine, if the standard Cortex-A57 is really fast with AES thanks to NEON and possibly additional, newer optimizations/instructions? AFAIK the latter are supported in newer Linux kernels per default, so there's no need to use additional libraries to enable support or the Qualcomm crypto stuff.
But it would be nice, if someone with actual insight and detailed knowledge about this could say a few words for clarification.
Neither i got insight nor big knowledge, but i benchmarked the system and like 60% loss in reading speed doesn't feels like a optimized kernel either :/
Qualcomm is a no go. On android plaform, only Exynos 7420(not sure about 5xxx series) real get used h/w encry and decry engine and no speed down.
TheEndHK said:
Qualcomm is a no go. On android plaform, only Exynos 7420(not sure about 5xxx series) real get used h/w encry and decry engine and no speed down.
Click to expand...
Click to collapse
That's not only off topic, it's also wrong. The Exynos SoCs don't have a substantially different crypto engine or "better"/"faster" crypto/hashing acceleration via the ARM cores. If anything, the Samsung guys are smart enough to optimize their software so it makes use of the good hardware. This seems to be missing here, but for no obvious reason.
xaps said:
That's not only off topic, it's also wrong. The Exynos SoCs don't have a substantially different crypto engine or "better"/"faster" crypto/hashing acceleration via the ARM cores. If anything, the Samsung guys are smart enough to optimize their software so it makes use of the good hardware. This seems to be missing here, but for no obvious reason.
Click to expand...
Click to collapse
I agreed all ARMv8-A cpu support hardware AES and SHA. Both Exynos 7420 and S810 should also got that ability but it turns out doesn't work on Z5c now which is a fact. I'm sure S6 got it working but not sure about on other S810 phones or might be Qualcomm missing driver support.
TheEndHK said:
Both Exynos 7420 and S810 should also got that ability but it turns out doesn't work on Z5c now which is a fact.
Click to expand...
Click to collapse
Please show us the kernel source code proving that fact.
What you call "fact" is the result of a simple before and after comparison done with a flash memory benchmark app run by one person on one device. To draw the conclusion that the only reason for the shown result is that the Z5(c) can't do HW acceleration of AES or SHA is a bit far-fetched, don't you think?
xaps said:
Please show us the kernel source code proving that fact.
What you call "fact" is the result of a simple before and after comparison done with a flash memory benchmark app run by one person on one device. To draw the conclusion that the only reason for the shown result is that the Z5(c) can't do HW acceleration of AES or SHA is a bit far-fetched, don't you think?
Click to expand...
Click to collapse
I've got a S6 and no slower after encry/decry and we had a thread discussing about it on S6 board.
I don't own a Z5c now bcoz my living place HK not yet started to sell it(I come to here bcoz considering to sell my S6 and Z1c and swap to Z5c later) so I can't test it but according to OP, there is a substantial slow down.
All ARMv8-A should support hardware AES/SHA, it is not just a cached benchmark result on S6. That's real.
A few things to ponder...
This is confusing. I was always under the impression that decryption (reads) are usually a tad bit faster then encryption writes. This at least seems true for TrueCrypt benchmarks. But that may be comparing apples and oranges.
A few thoughts...
In some other thread it was mentioned that the Z5C optimizes RAM usage by doing internal on the fly compression / decompression to make very efficient usage of the RAM. As cryptotext usually is incompressible could this be a source of the slowdown on flash R/W. Could this be a source of the problem (either by actual slowdown or confusing the measurement of the benchmarking tool?)
These days the SSD flash controllers also do transparent compression of data before writing to reduce wear on the flash. If you send a huge ASCII plaintext file into the write queue the write speed will be ridiculously high, if you send incompressible data like video the write speed rate goes way down. This happens on hardware level, not taking any cryptop/decrypto operations on the OS level into account.
Is there maybe a similar function in todays smartphone flash controllers?
Can I ask the OP, in what situations do you notice the slower read rate on the crypted device? Not so long ago when spinning rust disks were still the norm in desktop and laptop computers read rates of 120 MB were totally out of reach. What kind of usage do you have on your smartphone that you actually notice the lag? Is it when loading huge games or PDF files or something similar?

Question Vram question

I just got my s23 ultra. The vram was turned on to 8gb. Is that needed? Should I keep it going? I have the 512gb model with 12gb of ram already.
If you need that much ram you can use it but be aware that trying to use an ssd as ram, even a top spec ssd isn't anywhere near as fast as slow ra
fil.lujan said:
I just got my s23 ultra. The vram was turned on to 8gb. Is that needed? Should I keep it going? I have the 512gb model with 12gb of ram already.
Click to expand...
Click to collapse
I also own an S23 Ultra. Where did you find the VRAM info?
Mind that VRAM stands for Virtual RAM and should be the RAM available for your GPU, not the overall RAM of your device.
elementXI said:
I also own an S23 Ultra. Where did you find the VRAM info?
Mind that VRAM stands for Virtual RAM and should be the RAM available for your GPU, not the overall RAM of your device.
Click to expand...
Click to collapse
That's not right. The soc for these devices share RAM between cpu and gpu. There is no dedicated gpu RAM. Vram is simply virtual RAM on your ssd that is super slow compared to your actual ram
He means RAM plus...
Thanks all, I disabled it, I just wasn't sure why it was on by default. 12Gb will be plenty for me.
spart0n said:
That's not right. The soc for these devices share RAM between cpu and gpu. There is no dedicated gpu RAM. Vram is simply virtual RAM on your ssd that is super slow compared to your actual ram
Click to expand...
Click to collapse
Never said it was dedicated to the GPU. I said it was "the RAM available for your GPU".
Thanks, @aureum.
In that case, it means that a defined amount the device's storage, which by default comes at 8GB, of "RAM Plus" which by default is 8GB, in support of the actual RAM.
@fil.lujan I suggest you don't disable the RAM Plus option. Leave it on at 8GB. It just takes 8GB from your storage and should be pretty unsignificant on the 512GB variant.
RAM plus is working as swap on windows, when you reach max RAM it should goes to RAM plus... However i read that ram plus is not for actual processing, only hibernate the apps for faster reloading them to RAM when needed, Some users od 22u point that disabling ram plus speed up the device I try it on my 23u and did not see any improvement when disabled so i left it at 8GB.
aureum said:
Some users od 22u point that disabling ram plus speed up the device I try it on my 23u and did not see any improvement when disabled so i left it at 8GB.
Click to expand...
Click to collapse
Considering how the SoC on this smartphone is already a beast, I don't see how it would be that impactful (in term of raw numbers).
But 12GB RAM is already enough for most users, topping to 12+8GB seems a little overkill.
UFS 4.0 is equivlant to Lpddr4 speed but allitle slower
And Ram plus aka V Ram will only be used when you have allot of apps open in back ground to prevent app restarts so it doesn't need to be as fast as the actual ram
elementXI said:
@fil.lujan I suggest you don't disable the RAM Plus option. Leave it on at 8GB. It just takes 8GB from your storage and should be pretty unsignificant on the 512GB variant.
Click to expand...
Click to collapse
It's worth shutting it off and seeing if it has any performance impact. Previous phones all suffered noticeable penalties and honestly with 12GB, it's not needed.
EtherealRemnant said:
It's worth shutting it off and seeing if it has any performance impact. Previous phones all suffered noticeable penalties and honestly with 12GB, it's not needed.
Click to expand...
Click to collapse
Well, I'd agree with you for older devices. Thought, the S23 Ultra is packed with high-performance UFS 4.0 storage. At worst, there would be the slightest performance impact (if none at all). Hence, I believe this time the pros are higher than the cons when keeping RAM Plus active, from my perspective.

Categories

Resources