PinePhone app development
#1
okay, so my new PinePhone arrived, yay! and after a tricky challenge to get past the user registration screen, I am now ready to do some app development.  I have previous experience with iOS and Android, and currently playing around with Zig.  However I am new to Linux development, and from my brief bit of research I can see GUI options using SDL or GTK...  Do we currently have a 'getting started' as an App developer type resource?  maybe a template very basic GUI App? responding to orientation events, life cycle events etc, or is someone able to give me some pointers please?  Something low level like single header C libs linking into my Zig would be ideal.  i.e. I have no interest in giant frameworks with dependency hell.  Alternative approach would be something like a unikernal template with a framebuffer starting point?  I am open to suggestions Smile
  Reply
#2
The native framework to develop for Plasma Mobile would be Kirigami, see https://develop.kde.org/docs/getting-started/kirigami/ for a tutorial.
  Reply
#3
Thanks, is plasma the most popular distro that people are actively using? because from what I am seeing so far it seems to be quite laggy in terms of responsiveness, and the included kirigami? apps seem to take a good few seconds to start up. On the other hand I have no idea what performance to expect from the device...

I was also having some issues with screen brightness 'auto'? dimming last night, such that the screen would not stay illuminated for more than a second. So I built a null modem cable and found a couple errors via the serial console (but only shows boot) but guessing there are log files somewhere. But I have since been reading quite a few community comments reccomending to replace the included OS, but from my brief research it seems like there is no solid stable winner currently? So I am feeling a bit lost with all the options, but at the same time it is also amazing to have a phone with so many options Smile and since I am hoping to write some apps, I am also now wondering how portable are apps between all these OS options.

Are there other app developers around here? because some of the boards here look quiet, and I am not into these modern proprietary platforms. Or has everyone moved on to the RISC-V shinny toys Smile

PS thanks for your comments regarding Nuttx, it doesnt seem to support OpenGL ES 2 yet, so might wait a while on that option.
  Reply
#4
(05-04-2023, 03:29 AM)WhiteHexagon Wrote: Thanks, is plasma the most popular distro that people are actively using?
It is hard to tell what is actually the most popular.

Plasma Mobile (on Manjaro) is what you get preinstalled by default if you order directly from Pine64. The EU store overwrites it with Phosh for some reason (at least the Manjaro option is Phosh, they offer 2 other distros, Mobian and PostmarketOS, but I think those are also shipped with Phosh – not that I really cared because I dd'ed my existing installation from my first, now broken PinePhone on top of it anyway). What other resellers preinstall, I have no idea.

I get the impression that most users here on this forum are running Phosh. I myself run Plasma Mobile. I run Plasma Desktop on my desktop and notebook computers, so Plasma Mobile was the logical choice, plus it came preinstalled on my first PinePhone.

Quote:because from what I am seeing so far it seems to be quite laggy in terms of responsiveness, and the included kirigami? apps seem to take a good few seconds to start up.  On the other hand I have no idea what performance to expect from the device...
Well, the lagginess is mostly due to the hardware, I think. The Allwinner A64 is pretty slow by today's standards. I would not expect Phosh to be much (if at all) faster, at least the Phosh apps on Plasma Mobile are no faster than the Plasma Mobile / Kirigami ones in my experience. (Compare, e.g., Geary with Angelfish.) Minimalist stuff like SXMO is probably much faster, but also much less user-friendly.

Quote:I was also having some issues with screen brightness 'auto'? dimming last night, such that the screen would not stay illuminated for more than a second.  So I built a null modem cable and found a couple errors via the serial console (but only shows boot) but guessing there are log files somewhere.  But I have since been reading quite a few community comments reccomending to replace the included OS, but from my brief research it seems like there is no solid stable winner currently?  So I am feeling a bit lost with all the options, but at the same time it is also amazing to have a phone with so many options Smile  and since I am hoping to write some apps, I am also now wondering how portable are apps between all these OS options.
The first thing I would do is to update the shipped OS to the current packages. But do not use Discover for that, it will likely break your installation! (PackageKit is not well supported on Arch and Manjaro.) Instead, best run "sudo pacman -Syu" on the command line, then reboot, then run "sudo pacman -S pamac-gtk pamac-mobile-integration", and then you can use Pamac-GTK for your future system updates.
  Reply
#5
Thanks Kevin, I really appreciate your input. I spent a couple days down rabbit holes learning more about the device and SoC, and various development options, and starting to get a feel for things. Meantime it was sat on my desk and I noticed it seems to go flat very quickly, even with no simm, wifi, ble. Together with the performance issues I am starting to think maybe a RTOS is actually the right choice for this device... on the other hand I like the idea of having linux available and quite tempted to get the keyboard accessory Smile

Do you know if WASM is a supported option for app development, ie has a fast enough browser with WASM enabled? ideally exposing both canvas and WebGL... big ask maybe, but I think webGL(v1) is openGL ES 2, which the Mali GPU seems to support... and maybe the mali openVG support is being used for canvas2D? Probably wishful thinking, but that might give me a more performant App environment...

[edit] btw I did take on board your advice with OS updates, and appreciate the instructions, but I think it is important for me to first understand the delivered 'Beta' experience, assuming this is what will ship on the final device? and what my potential app users will first experience, and how that will translate to support work for me. Although maybe the 'beta' is hardware side only.
  Reply
#6
(05-07-2023, 04:30 AM)WhiteHexagon Wrote: Do you know if WASM is a supported option for app development, ie has a fast enough browser with WASM enabled? ideally exposing both canvas and WebGL...  big ask maybe, but I think webGL(v1) is openGL ES 2, which the Mali GPU seems to support...  and maybe the mali openVG support is being used for canvas2D?  Probably wishful thinking, but that might give me a more performant App environment...

I don't know, but I would be VERY surprised if an app in a web browser would be faster then a native app.
  Reply
#7
(05-07-2023, 06:34 AM)diederik Wrote: I don't know, but I would be VERY surprised if an app in a web browser would be faster then a native app.

Kirigami seems to be using QtQuick? and that seems to be using OpenGL or Metal.  I think Mali400 only has 'OpenGL ES' and OpenVG, so maybe the performance issue with these apps is that they are hitting a software rendering pipeline?   At least on a Raspberry Pi I have been getting some good performance with WebGL and canvas2d stuff.  Browsers tend to be quite well optimized on the rendering level at least.  I guess I wont know until I start trying it, but being new to Linux phone development I wanted to get a feel for the current approaches in use by more experienced app developers.
  Reply
#8
(05-07-2023, 04:30 AM)WhiteHexagon Wrote: Do you know if WASM is a supported option for app development, ie has a fast enough browser with WASM enabled? ideally exposing both canvas and WebGL...  big ask maybe, but I think webGL(v1) is openGL ES 2, which the Mali GPU seems to support...  and maybe the mali openVG support is being used for canvas2D?  Probably wishful thinking, but that might give me a more performant App environment...
Angelfish supports WASM out of the box. See for yourself: https://boyan.io/wasm-wheel/ (and note that the slow spinning wheel is actually JavaScript, not WASM, only the pseudorandom number generators in different programming languages are using WASM).

But I doubt it will be faster than the native frameworks. WASM is a virtual CPU with a virtual architecture that always has to be emulated in software.

For QtQuick performance, make sure you are using the QtQuick Compiler when building your application. (It has been part of the FOSS Qt releases for several releases now, and most if not all of Plasma Mobile uses it by default.) OpenGL ES is supported, that is not the issue.

(05-07-2023, 04:30 AM)WhiteHexagon Wrote: [edit] btw I did take on board your advice with OS updates, and appreciate the instructions, but I think it is important for me to first understand the delivered 'Beta' experience, assuming this is what will ship on the final device? and what my potential app users will first experience, and how that will translate to support work for me.  Although maybe the 'beta' is hardware side only.
The advice for your users must also be to upgrade the OS first thing. The version shipped on the devices is very outdated, and they will run into errors very quickly trying to install anything from the repository. (Keep in mind that Manjaro is a rolling release distribution, so packages built against the old libraries on the preinstalled image are no longer available, because the repository has long moved on.) Trying to officially support anything other than a fully updated system (sudo pacman -Syu) is a lost cause. (Experienced users may or may not be able to get your application to run on an old shipped snapshot, but it is definitely not worth the effort.) Plus, the old shipped version also has several bugs that have since been fixed.
  Reply
#9
Thanks for the information! I do listen and learn Smile So I finally managed to get an updated fairly stable environment, and even got the latest version of Zig installed (something my not-so-old macos device cant do!).

So back to my App development Smile

Since I prefer Zig to C++, I decided to have a look at building a wayland application to get a feel for things. I started with a 'C' example I found online, however it seg.faults having failed to received a wayland 'wl_shell' message. (I am new to linux so I hope I am getting the terminology correct). So firstly is plasma wayland based? The 'registry' is pumping out lots of other messages / interfaces but not that one.

Anyone have experience with wayland on plasma that can point me in the right direction please?

btw I found a different example that uses wayland and LWGL by lupyuen that looks very interesting, but that is ubuntu based and fails to compile due to Xwindows dependency (I think!).

cheers Peter
(Plasma 5.27.4 Manjaro 6.1.21-1)
  Reply
#10
I also now tried with  ArchLinux Plasma, same missing 'wl_shell' segfault.  I found some tip about having to enable a compositor?


Code:
export $(dbus-launch)
kwin_wayland --xwayland


but this also fails, but sounds like maybe wayland is already running, very confusing:


Code:
No backend specified through command line argument, trying auto resolution
unable to lock lockfile /run/user/1000/wayland-0.lock, maybe another compositor is running
kwin_core: Failed to activate /org/freedesktop/login1/session/_33 session. Maybe another compositor is running?
kwin_wayland_drm: failed to open drm device at "/dev/dri/card0"
kwin_wayland_drm: failed to open drm device at "/dev/dri/card1"
kwin_wayland_drm: No suitable DRM devices have been found
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Struggle to install LibreOffice on the PinePhone Peter Gamma 49 26,823 Yesterday, 05:50 PM
Last Post: Peter Gamma
  Possible Free Backup Carrier for PinePhone PineFone 0 28 Yesterday, 03:45 PM
Last Post: PineFone
  Using Signal on PinePhone in mid-2023? dante404 47 16,377 05-03-2024, 02:19 AM
Last Post: dragonhospital
  Slarm64 on PinePhone [Unofficial Slackware ARM - 64 bit] acid andy 38 26,857 04-23-2024, 10:29 AM
Last Post: donchurch
Wink PINEPHONE not booting Touchwood 2 705 02-23-2024, 07:27 AM
Last Post: Touchwood
  Slack on PinePhone Adam Seline 5 5,729 12-20-2023, 07:20 AM
Last Post: nickolas
  Which word processor to choose for the Pinephone? Peter Gamma 8 2,468 11-23-2023, 01:06 AM
Last Post: Peter Gamma
  openSUSE for Pinephone Alefnode 75 105,262 11-17-2023, 08:37 AM
Last Post: Uturn
  Genode- Sculpt OS for the PinePhone (non Linux) Surehand53 1 1,203 11-04-2023, 07:23 PM
Last Post: tllim
  Abiword as a office mobile word processor for the Pinephone? Peter Gamma 11 2,862 10-24-2023, 08:57 AM
Last Post: Peter Gamma

Forum Jump:


Users browsing this thread: 1 Guest(s)