telegramdesktop / tdesktop

Telegram Desktop messaging app
https://desktop.telegram.org/
Other
26.13k stars 5.18k forks source link

aarch64 and armhf version of telegram-desktop crash on attempt to render animated sticker #6647

Closed RussianNeuroMancer closed 4 years ago

RussianNeuroMancer commented 5 years ago
### Steps to reproduce 1. Install aarch64 version ob Ubuntu 19.10 (on devboard, laptop or qemu virtual machine) 2. Install telegram-desktop from system repository 3. Try to send any animated sticker ### Expected behaviour Telegram doesn't crash on attempt to render sticker animation ### Actual behaviour Telegram crash on attempt to render sticker animation ### Configuration **Operating system:** Ubuntu 19.10 **Version of Telegram Desktop:** 1.8.8 **Used theme**: dark theme [gdb.log](https://github.com/telegramdesktop/tdesktop/files/3693129/gdb.log)
TheHolyLoli commented 4 years ago

@industrium Install my snap and check if it works for you. arm64 doesn't build in snapcraft.io(launchpad) though. here is the log. arm64.log @ilya-fedin can you check this? snap package built successfully in PR though

TheHolyLoli commented 4 years ago

without neon optimizations sticker preview panel uses 80 percent cpu and is a little laggy at first though :(

ilya-fedin commented 4 years ago

here is the log.

Meh. Looks like aarch64 version doesn't have non-neon idctdsp (I have no idea what it is) https://github.com/FFmpeg/FFmpeg/blob/release/4.2/libavcodec/arm/Makefile#L20 https://github.com/FFmpeg/FFmpeg/blob/release/4.2/libavcodec/aarch64/Makefile#L44

ilya-fedin commented 4 years ago

without neon optimizations sticker preview panel uses 80 percent cpu and is a little laggy at first though :(

At first though rlottie should parse stickers, then ffmpeg-based cache comes into play. I.e. if you have lags only at first though, it is rlottie rather than ffmpeg.

ilya-fedin commented 4 years ago

You can also build with -DDESKTOP_APP_LOTTIE_USE_CACHE=OFF and compare.

ilya-fedin commented 4 years ago

Just filled a bug report to ffmpeg: https://trac.ffmpeg.org/ticket/8565#ticket

TheHolyLoli commented 4 years ago

You can also build with -DDESKTOP_APP_LOTTIE_USE_CACHE=OFF and compare.

i'll try it

TheHolyLoli commented 4 years ago

At first though rlottie should parse stickers, then ffmpeg-based cache comes into play. I.e. if you have lags only at first though, it is rlottie rather than ffmpeg.

i can't reproduce it again i guess it cached now.i don't think it's a big problem since raspberry pi is weak though and AFAIK these are mp4 h264 stickers maybe?it takes a split second to load, and they start playing

ilya-fedin commented 4 years ago

i can't reproduce it again i guess it cached now.

~It is RAM-only and resets when tdesktop is closed~ UPD: no

TheHolyLoli commented 4 years ago

It is RAM-only and resets when tdesktop is closed

When loading for the first time, for a split second it gets laggy or doesn't start playing(im not sure about this) and then plays smoothly. im going to try turning lottie off though and compare them.

industrium commented 4 years ago

@industrium Install my snap and check if it works for you.

Already tested: everything works.

ilya-fedin commented 4 years ago

Maybe --disable-dct ffmpeg config flag can fix the build on aarch64, but I don't know what it can affect

TheHolyLoli commented 4 years ago

I'm waiting for armhf and arm64 builds in launchpad.i'll test this afterward. it takes around another hour to finish what is this config flag?

TheHolyLoli commented 4 years ago

You can also build with -DDESKTOP_APP_LOTTIE_USE_CACHE=OFF and compare.

@ilya-fedin amd64.log what's this time? this one happened in amd64

ilya-fedin commented 4 years ago

what is this config flag?

configure script describes it as disable DCT code idctdsp

ilya-fedin commented 4 years ago

what's this time?

cmake failed to build :thinking: Have you definitely added the flag to the configflags of the telegram part, not cmake?

TheHolyLoli commented 4 years ago

@ilya-fedin yes i386 built successfully ill rebuild it again maybe just a bug with cmake.because error says compiler internal error

ilya-fedin commented 4 years ago

i386 built successfully

Maybe some random fail, as on github :)

TheHolyLoli commented 4 years ago

@ilya-fedin does telegram even run on ppc64el? maybe we can add architecture to snapcraft.yaml so launchpad doesnt waste time on s390x arch that is not even supported?

architectures:
  - build-on: [<build arch 1>, <build arch 2>]
    run-on: [<run arch 1>, <run arch 2>]

more info just in case you wanted to read more : https://snapcraft.io/docs/architectures

ilya-fedin commented 4 years ago

does telegram even run on ppc64el?

As far as I know, yes

s390x arch that is not even supported?

yes, big-endians doesn't work

maybe we can add architecture to snapcraft.yaml

Would be good

TheHolyLoli commented 4 years ago

You can also build with -DDESKTOP_APP_LOTTIE_USE_CACHE=OFF and compare.

Does this affect video playback?because videos play like frame by frame.its soo laggy

ilya-fedin commented 4 years ago

You can also build with -DDESKTOP_APP_LOTTIE_USE_CACHE=OFF and compare.

Does this affect video playback?because videos play like frame by frame.its soo laggy

No, only stickers.

ilya-fedin commented 4 years ago

Maybe these ffmpeg config flags will help:

--enable-mmal
--enable-omx
--enable-omx-rpi
TheHolyLoli commented 4 years ago

@industrium can you update your snap package? sudo refresh alish-tdesktop --edge? it comes with rlottie disabled. for me stickers are like before.i can't feel any difference EDIT: sticker panel feels so slow now.i guess we should leave rlottie on

Johnnynator commented 4 years ago

does telegram even run on ppc64el?

As far as I know, yes

Can confirm, it runs fine on ppc64le

TheHolyLoli commented 4 years ago

--enable-mmal

https://github.com/AliDjango/tdesktop/runs/500131035

ilya-fedin commented 4 years ago

https://github.com/AliDjango/tdesktop/runs/500131035

I don''t know what is needed for mmal, but for omx libomxil-bellagio-dev is needed in build -packages and libomxil-bellagio0 is needed in stage-packages

TheHolyLoli commented 4 years ago

mmal files are in raspberrypi/userland github repository so for mmal we should do this.where should i add these lines?

git clone --depth=1 https://github.com/raspberrypi/firmware mmalheaders
git clone --depth=1 https://github.com/raspberrypi/userland piuserland
cp -a mmalheaders/opt/vc/include/* /usr/include/
cp -a mmalheaders/opt/vc/lib/* /usr/lib/
cp -a piuserland/interface/* /usr/include/
ilya-fedin commented 4 years ago

You should create a separate part mmal and make it a dependecy of ffmpeg part with after But, I think, the first thing is to check if aarch64 will work with --disable-dct, after that you can try to compile with omx and only after that experimenting with mmal.

TheHolyLoli commented 4 years ago

of course but i don't have aarch64 to test it.we may need someone with rpi 3/4(or other 64bit devices) with 64bit os to check if it has any kind of side effects

ilya-fedin commented 4 years ago

we may need someone with rpi 3 or 4 with 64bit os to check if it has any kind of side effects

I.e. you want to say it is successfully built?

TheHolyLoli commented 4 years ago

I mean if it builds successfully we must check if it actually works and doesn't crash.

ilya-fedin commented 4 years ago

I mean if it builds successfully we must check if it actually works and doesn't crash.

Anyway, we should try to build it, because it is unknown if it will build or not. After that, we can think about testing.

p3732 commented 4 years ago

I mean if it builds successfully we must check if it actually works and doesn't crash.

I am here if you need to test. Although I can't guarantee that errors with graphics libraries won't stem from the graphics driver not working (it's a PinebookPro for which the firmware drivers are only semi-stable).

ilya-fedin commented 4 years ago

Just filled a bug report to ffmpeg: https://trac.ffmpeg.org/ticket/8565#ticket

They fixed it! 🥳

Aokromes commented 4 years ago

that was fast.

TheHolyLoli commented 4 years ago

that was fast lol. I'll try PR#7355 again to check if it works.

ilya-fedin commented 4 years ago

Don't forget that these changes will not appear on their own in version 4.2 and that they must be backported (or wait for a new version).

industrium commented 4 years ago

@industrium can you update your snap package? sudo refresh alish-tdesktop --edge? it comes with rlottie disabled. for me stickers are like before.i can't feel any difference EDIT: sticker panel feels so slow now.i guess we should leave rlottie on

What the goal is to install build w/o rlottie?

TheHolyLoli commented 4 years ago

What the goal is to install build w/o rlottie?

Good question. Just wanted to see how difference the performance is. stickers felt a little laggy at first and just wanted to check if rlottie is the culprit. it's ok now.you don't need to test if you don't want to.performance is not good without rlottie. edge package is replaced though so ...

TheHolyLoli commented 4 years ago

Don't forget that these changes will not appear on their own in version 4.2 and that they must be backported (or wait for a new version).

latest build

i used master branch instead of 4.2 and everything build successfully including arm64.now its up to you to decide what to do.we can wait until 4,3 comes out or make our own fork of 4.2 with arm64 fix.

ilya-fedin commented 4 years ago

I'm trying to backport changes

ilya-fedin commented 4 years ago

@AliDjango can you try to build this variant? https://github.com/ilya-fedin/tdesktop/commit/86b8a909adb9fb42b8e6d2619f655364762ed202

TheHolyLoli commented 4 years ago

built successfully

ilya-fedin commented 4 years ago

I am here if you need to test.

@p3732 can you test @AliDjango's aarch64 build? snap install --edge alish-tdesktop

ilya-fedin commented 4 years ago

If anyone else want to test aarch64 build - you're welcome

p3732 commented 4 years ago

@p3732 can you test @AliDjango's aarch64 build? snap install --edge alish-tdesktop

Don't actually have the device with me, gonna do it tomorrow evening (Europe).

p3732 commented 4 years ago

Tried testing but again ran into #7144. Tried everything, but this time not even installing the ubuntu-patched fontconfig helped. I guess this way I am of no use to the sticker testing...

ilya-fedin commented 4 years ago

@AliDjango can you remove -DDESKTOP_APP_USE_PACKAGED_FONTS=OFF and add fonts-open-sans to stage-packages?

ilya-fedin commented 4 years ago

Ok :)