Project

General

Profile

Enabling llvmpipe through phone terminal?

Added by pete mars over 6 years ago

Hi

Is it possible to change the renderer back and forth from android to llvmpipe from within the phone (S2) itself? I tried to create a script:

#!/system/bin/sh

"grep -q "ro.libagl=1" /system/build.prop && sed "s/ro.libagl=1/ro.libagl=0/" -i /system/build.prop || sed "s/ro.libagl=0/ro.libagl=1/" -i /system/build.prop" 

reboot

to run from the phone terminal but it didn't work. Any help would be great so I can switch to llvmpipe and use Orfox on the go.

Thanks very much

Pete


Replies (11)

RE: Enabling llvmpipe through phone terminal? - Added by Thomas Kitchin over 6 years ago

Whatever the command was on the wiki, I tried it and it worked when originally switching to Replicant 6 (on my s2).

Be prepared to reflash the Replicant 6 zip, however, when the phone runs so slowly that rolling back the change using the phone terminal is an exercise in insanity.

I suppose you could write a script before hand with 0 switched to 1, but even running that would take a long time.

RE: Enabling llvmpipe through phone terminal? - Added by pete mars over 6 years ago

Out of interested why would it be insane? I have changed renderer back and forth many times through adb with no performance issues (other than llvmpipe running very slowly).

RE: Enabling llvmpipe through phone terminal? - Added by Thomas Kitchin over 6 years ago

You were asking about switching renderers from your phone (not from a computer via adb).

Obviously using a computer to run a shell script will not be bottlenecked by a slow UI and is not what I was talking about.

RE: Enabling llvmpipe through phone terminal? - Added by pete mars over 6 years ago

OK,

I see you're saying it would be incredibly slow if llvmpipe was running to then use the phone terminal to change renderer back to stock.

RE: Enabling llvmpipe through phone terminal? - Added by Wolfgang Wiedmeyer over 6 years ago

You forgot to mount the system partition writable at the beginning of the script:

mount -o rw,remount /system

I would also remove the " at the beginning and end of the command.

RE: Enabling llvmpipe through phone terminal? - Added by pete mars over 6 years ago

Wonderful, thanks. Working now

#!/system/bin/sh

mount -o rw,remount /system

grep -q "ro.libagl=1" /system/build.prop && sed "s/ro.libagl=1/ro.libagl=0/" -i /system/build.prop || sed "s/ro.libagl=0/ro.libagl=1/" -i /system/build.prop

mount -o ro,remount /system

reboot

I don't know if it's needed to remount the system partition as read only afterwards but I thought it would be safer. No issues running it with llvmpipe enabled, it switches back fine.

Pete

RE: Enabling llvmpipe through phone terminal? - Added by Jeremy Rand over 6 years ago

I've just submitted a patch for this purpose. https://redmine.replicant.us/issues/1832

It's not directly based on pete's script; I based it on my modem disable patch, but it should be mostly equivalent. The main differences are that my patch has separate scripts for enabling and disabling llvmpipe (I'm guessing some users won't know what they've currently got it set to), and that my patch reboots more gracefully (and therefore is less likely to cause data corruption or app errors).

RE: Enabling llvmpipe through phone terminal? - Added by pete mars over 6 years ago

Thanks for that Jeremy.

Can you explain the line

am start -a android.intent.action.REBOOT

and why this is preferable to

reboot

please.
Thanks

RE: Enabling llvmpipe through phone terminal? - Added by Fil Bergamo over 6 years ago

pete mars wrote:

Can you explain the line [...]
and why this is preferable to [...]

Someone correct me if I'm wrong, but I guess the basics are as follows:

the difference is that

am start -a android.intent.action.REBOOT

essentially calls android's "activity manager" with the intent to reboot.
Thus the activity manager automatically selects whatever app is registered for that intent (probably the "system process" itself), and it launches it for the same intent.
It's not much different than clicking a "share" button from inside any app, which in turn tells the activity manager to launch whatever application is registered to handle emails or sms or whatever else.

While

reboot

is a "lower-level" system command, which involves directly the linux kernel, on top of which the android system is built.
Thus, this call bypasses the upper layers, possibly preventing a clean and correct disposal of applications running on top of the android framework.

I could be wrong in some details, but I think the basic mechanism is more or less like that.

RE: Enabling llvmpipe through phone terminal? - Added by pete mars over 6 years ago

Thanks for the explanation. I guess it also lets over processes close themselves whilst 'reboot' kills the kernel and forces a shutdown? Or something like that.

RE: Enabling llvmpipe through phone terminal? - Added by Jeremy Rand over 6 years ago

Fil is correct -- basically the method of rebooting that I used gives apps a chance to shutdown gracefully (as though you clicked the reboot button in the Android GUI), whereas the reboot command might not give apps a chance to save any unsaved data.

    (1-11/11)