flxzt / rnote

Sketch and take handwritten notes.
https://rnote.flxzt.net
GNU General Public License v3.0
8.19k stars 282 forks source link

Android Version #390

Open memtech3 opened 1 year ago

memtech3 commented 1 year ago

It would be super cool if there was an Android version of the full rnote. In another feature request (#245) , a commenter mentioned compiling to webassembly to bring android support. I think as long as the compiled webassembly version was distributed as a PWA that could be installed and used offline that would satisfy this feature request

Some context: I am a college student and my day to day loadout is a laptop (non touch) and android tablet with stylus (Galaxy Tab S6 Lite) as it is more convenient than carrying my wired Wacom tablet around to classes.

pktiuk commented 1 year ago

As a first step of checking doability of this task it should be checked whether base libraries (like GTK4) can be compiled into webassembly.

To check convergence and web browser compatibility you can run the current application with GTK4 Broadway backend.

The GDK Broadway backend provides support for displaying GTK applications in a web browser, using HTML5 and web sockets.

phoronix news about broadway

Shahin-rmz commented 1 year ago

I can help with Kivy if this is helpful!

pktiuk commented 1 year ago

@Shahin-rmz How using Kivy is supposed to help? Kivy is Python framework, but Rnote is written with Rust and GTK4.
Do I miss something?

dbrandonjohnson commented 1 year ago

I'm uncertain if this would help: https://github.com/tauri-apps/tauri-mobile

Beryesa commented 1 year ago

I wonder if there can be a file-format compatible side project for android. I haven't taken a look at the source code yet but if the core logic and gtk bindings are modularly implemented, maybe a rust+flutter branch can be maintained without too much effort. (High likely much easier than trying to get any gtk on android?)

I don't have enough knowledge in either of them but in the case of no interest/time, perhaps I can try to step up and contribute, saving students from searching endlessly for a proper but cross platform foss annotation software, myself included, at some time in the future (next year?), together :3

DeltriDev commented 7 months ago

How is this going? Is there a android/web version in development?

mistune commented 7 months ago

Trying to build this in version 0.8.2 where most of the dependencies in termux are available without manually building the dependencies. I'm currently stuck with the package gettext-sys. I pasted the logs here, hopefully someone more knowledgeable can help debug this. https://github.com/termux/termux-packages/issues/17655#issuecomment-2016687563

EDIT: Tried compiling in a Fedora environment but seems Termux crashes during the last package to be compiled.

EDIT2: Somebody compiled this for aarch64 and just installed it from there.

EDIT3: Running this on Termux-x11 + Hardware Acceleration through virgl and I am getting close to native performance on my tablet.

DeltriDev commented 7 months ago

Trying to build this in version 0.8.2 where most of the dependencies in termux are available without manually building the dependencies. I'm currently stuck with the package gettext-sys. I pasted the logs here, hopefully someone more knowledgeable can help debug this. termux/termux-packages#17655 (comment)

EDIT: Tried compiling in a Fedora environment but seems Termux crashes during the last package to be compiled.

EDIT2: Somebody compiled this for aarch64 and just installed it from there.

EDIT3: Running this on Termux-x11 + Hardware Acceleration through virgl and I am getting close to native performance on my tablet.

that's great! is there a build somewhere or do i have to build this myself? i would rather not

mistune commented 7 months ago

@DeltriDev I used the build here https://fedora.pkgs.org/39/terra/rnote-0:0.10.1-1.fc39.aarch64.rpm.html.

PhilDevProg commented 3 months ago

If someone makes a Flutter version in the future, maybe the flutter_rust_bridge could be helpful for reusing code instead of having to rewrite everything.

PhilDevProg commented 2 months ago

Someone's working on an Android backend for Gtk: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/7555

sound-friend commented 2 months ago

man i would love to see something like this just so i can check my notes on my phone!!

EDLLT commented 1 month ago

https://github.com/termux/termux-packages/pull/21524

I managed to get RNote to work in Android natively(no proot/chroot) through termux with hardware acceleration

sound-friend commented 1 month ago

could you let us know how you did it? what's the performance like?

EDLLT commented 1 month ago

could you let us know how you did it? what's the performance like?

Performance is much more better than chroot and proot, especially for large rnote files

Also it responds correctly to touch for panning/zooming and pen for writing

I did it by patching rnote and several crates to compile against Android's bionic libc(Check PR above)

Soon enough once the merging with termux packages is done, installing rnote will be as easy as "pkg install rnote"

If you're in the termux discord or rnote dev matrix channel then you'll find that I've sent a short video there demonstrating rnote

EDLLT commented 1 month ago

could you let us know how you did it? what's the performance like?

Performance is much more better than chroot and proot, especially for large rnote files

Also it responds correctly to touch for panning/zooming and pen for writing

I did it by patching rnote and several crates to compile against Android's bionic libc(Check PR above)

Soon enough once the merging with termux packages is done, installing rnote will be as easy as "pkg install rnote"

If you're in the termux discord or rnote dev matrix channel then you'll find that I've sent a short video there demonstrating rnote

If you're interested in how to setup termux then read these in order

https://github.com/EDLLT/Termux-Desktops/blob/main/Documentation/terminology.md

https://github.com/EDLLT/Termux-Desktops/blob/main/Documentation/native/termux_native.md

https://github.com/EDLLT/Termux-Desktops/blob/main/Documentation/HardwareAcceleration.md#hardware-acceleration-in-native-termux--

(When setting up hardware acceleration, use zink instead of kgsl since that's still being developed)

mistune commented 1 month ago

termux/termux-packages#21524

I managed to get RNote to work in Android natively(no proot/chroot) through termux with hardware acceleration

Is this in the repos now? Doing a pkg search rnote does not show rnote yet

relma2 commented 1 month ago

The pull request to get rnote onto the termux repos has been merged! I am running pkg install rnote in termux right now

relma2 commented 1 month ago

Ok, running into several issues. Will go home and resume troubleshooting.

sound-friend commented 1 month ago

when i run it it says it can't find the package... interesting

relma2 commented 1 month ago

when i run it it says it can't find the package... interesting

Install the x11 repo first with pkg install x11-repo

relma2 commented 1 month ago

@sound-friend , @EDLLT , and I were in the termux discord the other night getting EDLLT's packaging of Rnote to work in Termux. It... kind of works, the application loads, but there are several issues. The steps I did to get it """working""" were:

  1. Install Termux from F-Droid (NOT the Google Play store!!)
  2. Install the Termux-X11 Nightly Apk fron Github
  3. In Termux, run pkg install x11-repo to enable the X11 Repo of packages
  4. Run pkg install rnote xfce4 to install Rnote and the XFCE Desktop Environment
  5. Run the XFCE Desktop Environment with termux-x11 :1 -xstartup "dbus-launch --exit-with-session xfce4-session"
  6. Back in Termux, install Hardware acceleration with pkg install mesa-vulkan-icd-freedreno-dri3
  7. Open the Termux X11 App. You should see an XFCE Desktop environment running with a little mouse wallpaper.
  8. In a Terminal WITHIN THE XFCE ENVIRONMENT (not termux), run MESA_LOADER_DRIVER_OVERRIDE=zink rnote
  9. Rnote opens! You can draw on it, but maximizing the window causes the app to segfault. Pen pressure also does not work.

Tl;dr -- this approach is nowhere near a functioning "android version" of Rnote. We should probably look into compiling GTK natively on Android or something; this approach uses too many workarounds and the app doesen't have full functionality and segfaults.

PhilDevProg commented 1 month ago

@sound-friend , @EDLLT , and I were in the termux discord the other night getting EDLLT's packaging of Rnote to work in Termux. It... kind of works, the application loads, but there are several issues. The steps I did to get it """working""" were:

  1. Install Termux from F-Droid (NOT the Google Play store!!)
  2. Install the Termux-X11 Nightly Apk fron Github
  3. In Termux, run pkg install x11-repo to enable the X11 Repo of packages
  4. Run pkg install rnote xfce4 to install Rnote and the XFCE Desktop Environment
  5. Run the XFCE Desktop Environment with termux-x11 :1 -xstartup "dbus-launch --exit-with-session xfce4-session"
  6. Back in Termux, install Hardware acceleration with pkg install mesa-vulkan-icd-freedreno-dri3
  7. Open the Termux X11 App. You should see an XFCE Desktop environment running with a little mouse wallpaper.
  8. In a Terminal WITHIN THE XFCE ENVIRONMENT (not termux), run MESA_LOADER_DRIVER_OVERRIDE=zink rnote
  9. Rnote opens! You can draw on it, but maximizing the window causes the app to segfault. Pen pressure also does not work.

Tl;dr -- this approach is nowhere near a functioning "android version" of Rnote. We should probably look into compiling GTK natively on Android or something; this approach uses too many workarounds and the app doesen't have full functionality and segfaults.

There seems to be a problem with the Zink driver on my device (Pixel 8a): https://github.com/user-attachments/assets/a22b6b0f-e744-471d-85e9-5129678f909c

When I run Rnote without `MESA_LOADER_DRIVER_OVERRIDE=zink, this doesn't happen.

relma2 commented 1 month ago

When I run Rnote without `MESA_LOADER_DRIVER_OVERRIDE=zink, this doesn't happen.

Yeah, zink has a lot of issues. When I run without zink, I don't get the segfault on maximizing the window

EDLLT commented 1 month ago

@sound-friend , @EDLLT , and I were in the termux discord the other night getting EDLLT's packaging of Rnote to work in Termux. It... kind of works, the application loads, but there are several issues. The steps I did to get it """working""" were:

  1. Install Termux from F-Droid (NOT the Google Play store!!)
  2. Install the Termux-X11 Nightly Apk fron Github
  3. In Termux, run pkg install x11-repo to enable the X11 Repo of packages
  4. Run pkg install rnote xfce4 to install Rnote and the XFCE Desktop Environment
  5. Run the XFCE Desktop Environment with termux-x11 :1 -xstartup "dbus-launch --exit-with-session xfce4-session"
  6. Back in Termux, install Hardware acceleration with pkg install mesa-vulkan-icd-freedreno-dri3
  7. Open the Termux X11 App. You should see an XFCE Desktop environment running with a little mouse wallpaper.
  8. In a Terminal WITHIN THE XFCE ENVIRONMENT (not termux), run MESA_LOADER_DRIVER_OVERRIDE=zink rnote
  9. Rnote opens! You can draw on it, but maximizing the window causes the app to segfault. Pen pressure also does not work.

Tl;dr -- this approach is nowhere near a functioning "android version" of Rnote. We should probably look into compiling GTK natively on Android or something; this approach uses too many workarounds and the app doesen't have full functionality and segfaults.

There seems to be a problem with the Zink driver on my device (Pixel 8a): https://github.com/user-attachments/assets/a22b6b0f-e744-471d-85e9-5129678f909c

When I run Rnote without `MESA_LOADER_DRIVER_OVERRIDE=zink, this doesn't happen.

Zink hardware acceleration is for Adreno GPUs, from my Google search, the Pixel 8a has a Mali GPU

In your case, running without zink makes it use llvmpipe which is a software rasterizer to run using the CPU(cpus are not designed for rendering so it's slow)

Instead, you could setup VirGL(Virtual opengl) for termux, it's a bit more complicated than zink so you'd need to ask people in the termux discord server)

PhilDevProg commented 1 month ago

Zink hardware acceleration is for Adreno GPUs, from my Google search, the Pixel 8a has a Mali GPU

In your case, running without zink makes it use llvmpipe which is a software rasterizer to run using the CPU(cpus are not designed for rendering so it's slow)

Instead, you could setup VirGL(Virtual opengl) for termux, it's a bit more complicated than zink so you'd need to ask people in the termux discord server)

Thanks for that tip. I got it working by using the following commands: pkg install virglrenderer-android virgl_test_server_android & and then started Rnote with this: GALLIUM_DRIVER=virpipe MESA_GL_VERSION_OVERRIDE=4.0 rnote

But it does crash when opening the side bar or the open file dialog (but opening files via the file manager works) with this error message:

../src/src/gallium/auxiliary/cso_cache/cso_context.c:407: void cso_unbind_context(struct cso_context *): assertion "maxsam <= PIPE_MAX_SAMPLERS" failed
Aborted
mistune commented 1 month ago

Tried the following on two devices. You might have to test which one will work for your device. Run glmark2 to verify that hardware acceleration is working

Installation

Zink

pkg update && pkg upgrade -y && pkg install rnote xfce4 glmark2 angle-android mesa-zink-dev virglrenderer-android virglrenderer-mesa-zink vulkan-loader-android xorg-xrandr 

Turnip

pkg update && pkg upgrade -y && pkg install rnote xfce4 glmark2 mesa-vulkan-icd-freedreno-dri3

Start XFCE4

termux-x11 :1 -xstartup "dbus-launch --exit-with-session xfce4-session"

Run program

Zink

GALLIUM_DRIVER=zink MESA_GL_VERSION_OVERRIDE=4.0 rnote

Turnip

MESA_LOADER_DRIVER_OVERRIDE=zink rnote