Lazarus

Programming => General => Topic started by: DidaJI on November 19, 2019, 10:27:45 am

Title: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: DidaJI on November 19, 2019, 10:27:45 am
Hello,
I run Lazarus version 2.1 (svn: 62276) on raspberry pi 4 with last Buster. Everything basically works, compilation is much faster than on PI 3B+.
But I have a problem with the IDE response speed. If there are more components on the Form, even switching between them becomes very slow. (two second and more...) If I take the same sd card and put it in Raspberry PI 3B+, this switching of components is much faster. It is very annoying and slows down the work.

Another problem is with color when the font size is large. For example, if I put a Label to Form and set the font size to 150, the color is black, for example, it looks like the attached picture. Part of the text is black and part of the text is white. On raspberry pi 3 everything is all right again. If you compile a large font program on Raspberry PI 4 and then run it on PI3, then everything is all right again. Problem is only on PI4.

Does anyone have similar experience or does it work well?
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: MarkMLl on November 19, 2019, 11:18:16 am
The fact that it differs between different systems makes it difficult to pin it down to Lazarus (or, more specifically, the LCL) rather than the X11 server (which might be reacting badly to something the LCL is asking it to do... which doesn't necessarily make it an LCL problem).

What widget set are you using? How big is the screen? Is there any difference in e.g. the colour depth (bits per pixel) on the two systems?

Can you tie it down to any particular component (e.g. TPaintBox) on your form? I've got a couple of projects (on an AMD64 KDE desktop using gtk2) where I suspect this might be a CPU glutton.

Are you able to login to the RPi using VNC, and does that change the behaviour? Historically, there were a few X11 apps including Lazarus and Firefox which generated excessive input (mouse etc.) calls, this problem was recognisable since the different input handling on VNC fixed it.

MarkMLl
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: DidaJI on November 19, 2019, 11:45:02 am
Hello MarkMLI, thank's for your quick reply.

I test on the same SD card on the same monitor. I just switch SD card from RPI3 to RPI4. Resolution is 2560x1440. Color depth I do not know how to solve RPI, I never changed it. I will try which components could affect it most and write it here. However, to raise the problem with the color of large fonts, just put a Label on a blank Form and it works poorly.
I will also try it through VNC.

Thank you very much for your reaction, I'll get back with what I find out.

Zdenek.
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: DidaJI on November 19, 2019, 11:56:22 am
Thus, the response speed and poor color rendering are the same bad via VNC from another computer.
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: DidaJI on November 19, 2019, 12:08:38 pm
So TImage component has the biggest influence on the IDE response speed to Raspberry PI 4. I have more of them on the form, their gradual withdrawal speed increases until it reaches normal. On Raspberry PI, however, it works normally with all images on the Form.

Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: DidaJI on November 19, 2019, 12:14:47 pm
Basically, only need to take one TImage component, put it on the Form and set up Align: alClient. Neither does it have to load any image to this one TImage and at that moment can be observed in the IDE lag. Small, but it's there.
Another Image components lead to more and more slow down.
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: DidaJI on November 19, 2019, 12:27:21 pm
I made a video where I can see it well: https://www.youtube.com/watch?v=KBmExC-ICD8&feature=youtu.be
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: DidaJI on November 19, 2019, 12:53:18 pm
And here is a video that shows the problem with the color of the large font: https://www.youtube.com/watch?v=TOAQdGOXvCo&feature=youtu.be

I'm sorry for the quality, I record it from my screen by smartphone.
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: MarkMLl on November 19, 2019, 04:42:42 pm
I believe I've seen design-time performance problems related to a TImage or similar control running on a PC (KDE plus GTK2 widgets). However I'd not investigated in enough depth to raise it on Mantis etc.

MarkMLl
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: Thaddy on November 19, 2019, 05:45:39 pm
Problem is only on PI4.
Yes. seems you have to do:
Code: Bash  [Select]
  1. sudo apt-get update && sudo apt-get dist-upgrade -y
(even that takes some manual intervention)

Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: MarkMLl on November 19, 2019, 08:24:58 pm
Probably better to do all three steps, i.e. update, upgrade and finally dist-upgrade. There's also a Raspbian-specific command to update the linker etc., sorry but I don't have one running at the moment so can't remember what it's called.

However, OP hasn't told us exactly what OS he's running, i.e. whether it's Raspbian Buster or generic Debian Buster which I think runs on later RPi4s. He also hasn't told us whether it's a version that is explicitly qualified for running on an RPi4 or if it's a slightly older one.

But I still believe that I've seen a similar IDE slowdown on a standard PC.

MarkMLl
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: DidaJI on November 19, 2019, 09:10:54 pm
I believe I've seen design-time performance problems related to a TImage or similar control running on a PC (KDE plus GTK2 widgets). However I'd not investigated in enough depth to raise it on Mantis etc.

MarkMLl


Tomorrow I'll try it on a PC. But it is definitely much faster on RPI 3B+ than on RPI 4.
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: DidaJI on November 19, 2019, 09:15:56 pm
Problem is only on PI4.
Yes. seems you have to do:
Code: Bash  [Select]
  1. sudo apt-get update && sudo apt-get dist-upgrade -y
(even that takes some manual intervention)

I run it on RPI 4 with the latest raspbian Buster:

Installation on SD card from here: https://www.raspberrypi.org/downloads/raspbian/ (Raspbian Buster with desktop), after installation:
apt-get install update
apt-get install upgrade
apt-get dist-upgrade
rpi-update


Zdenek.

Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: BosseB on November 21, 2019, 10:54:58 am
I run it on RPI 4 with the latest raspbian Buster:

Installation on SD card from here: https://www.raspberrypi.org/downloads/raspbian/ (Raspbian Buster with desktop), after installation:
apt-get install update
apt-get install upgrade
apt-get dist-upgrade
rpi-update

Zdenek.
No. These are the commands:
sudo apt update
sudo apt upgrade
sudo reboot
sudo apt update
sudo apt dist-upgrade (provided the previous sudo apt update indicated a fully up to date system)
sudo reboot

You do not "install" update or upgrade...
And you need sudo.

Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: MarkMLl on November 21, 2019, 11:57:13 am
No. These are the commands:
sudo apt update
sudo apt upgrade
sudo apt reboot
sudo apt update
sudo apt dist-upgrade (provided the previous sudo apt update indicated a fully up to date system)
sudo reboot

You do not "install" update or upgrade...
And you need sudo.

Yes and no. I agree that the "install" was spurious. You either need sudo on each command or you need to be running in a root-owned shell, that's why experienced unix users often show a prompt character at the start of each command- and get annoyed at unseasoned wiki editors who insist on removing them.

You don't need the second update, since the versions of available packages won't be changed by the upgrade. There is no  apt reboot  command, and a reboot at this point probably isn't necessary.

You might need the rpi-update command, it brings the lower-level loader and the kernel to a version nearer to the "bleeding edge", and this might be necessary if making sure that Raspbian has been updated for newer hardware.

You might find that rpi-update, and to a lesser extent upgrade and dist-upgrade, restart the SSH daemon. As a result if possible issue these commands either from the local console (i.e. physically connected screen and keyboard) or use the (GNU) screen command to make sure that they run to completion even if the session is interrupted.

MarkMLl
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: Thaddy on November 21, 2019, 12:29:29 pm
Raspbian Buster was (is) a moving target since it was released before Debian Buster, Hence it is essential to keep it up-to-date, which by now it is. Early adopters should do what I wrote
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: MarkMLl on November 21, 2019, 12:36:47 pm
I agree, but the release notes indicate that Raspbian Buster has always supported the RPi4, unlike some of the other ones where new hardware was introduced during the lifetime of the OS.

I don't know the extent to which a standard  apt upgrade  will bring the loader (Videocore firmware etc.) up to date, or if an  rpi-update  is mandatory for this.

MarkMLl
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: DidaJI on November 26, 2019, 08:23:02 am
I run it on RPI 4 with the latest raspbian Buster:

Installation on SD card from here: https://www.raspberrypi.org/downloads/raspbian/ (Raspbian Buster with desktop), after installation:
apt-get install update
apt-get install upgrade
apt-get dist-upgrade
rpi-update

Zdenek.
No. These are the commands:
sudo apt update
sudo apt upgrade
sudo reboot
sudo apt update
sudo apt dist-upgrade (provided the previous sudo apt update indicated a fully up to date system)
sudo reboot

You do not "install" update or upgrade...
And you need sudo.

Sorry, "install", I wrote "install" there by mistake, I normally do not put it there. I don't have "sudo" before every command because I used "sudo su" at the beginning.

Zdenek.
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: DidaJI on November 26, 2019, 08:36:02 am
Is there anyone who has installed Lazarus on Raspberry PI4 and could try it? Just open empty Form and put TImage on it and copy 10 times and try switch individual TImage in Component List. Or just switch them by clicking on them in the Form. It's a 10-second job.

Thank's: Zdenek.
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: Thaddy on November 26, 2019, 08:59:19 am
No problem. Done. No problems found.
I used:
- RPi4/4GB running from a fast sandisk 64GB USB3 stick, booted from a sandisk cat 10 16GB micro sd card.
- Raspbian Buster with all patches. No swap (well, not a serious one: 128 MB)
- FPC version   3.3.1-r43569
- Lazarus version 2.1.0
- Offical USB-C Powersupply
Both FPC and Lazarus built from source on the Raspberry Pi itself.

Speed problems are often caused by:
- a 1 GB without enough swap
- a proper swap (equal to the hardware memory) but on a slow medium
- FPC and/or Lazarus built with debug information (never do that, unless you develop for the compiler or the IDE).
- Not updating Rasbian enough!!! There are almost weekly speed related updates. Plz run sudo apt update && sudo apt dist-upgrade -y  if you did not do so already.
- An under-powered powersupply (RPi4 will throttle down!!! if starved, do you see the lightning image in the top right corner? That indicates not enough amps)
[edit]
Just repeated the test on a RPi 3b + 1 GB swap and there there is a noticable slowdown, but not unworkable.
That Pi is also running Pihole and a webserver, so there are less resources available.
This Pi has also the same storage configuration, except not running on USB3 speed of course. (stick and sd are the same, though)
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: krolikbest on November 26, 2019, 09:09:00 am
I don't have RPi4 but RPi3, power supply orginal for RPi (Extreme 3Amp) and Raspbian Stretch, Laz 1.6. On the form 11 images and switching between them is without problems.
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: Thaddy on November 26, 2019, 09:12:18 am
I don't have RPi4 but RPi3, power supply orginal for RPi (Extreme 3Amp) and Raspbian Stretch, Laz 1.6. On the form 11 images and switching between them is without problems.
I suspect he did not update enough: Raspbian Buster was released a bit premature and there have been many speed tweaks specifically for the RPi4.
Staying current is essential and makes a huge difference, especially for the RPi4. Raspbian Buster for the RPi3 is different and was already quite mature because the speed optimizations were already done. That was (and to a certain extend still is) not the case for the new RPi4 hardware.
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: BosseB on November 26, 2019, 09:29:10 am
- Not updating Rasbian enough!!! There are almost weekly speed related updates. Plz run sudo apt update && sudo apt dist-upgrade -y  if you did not do so already.
I also update my RPi4B regularly, when I checked today there was only 1 update available (for Bluetooth which I don't use).
Upgraded it anyway.
But how does one know if there is a dist-upgrade available???
On Ubuntu it is shown whenever one logs on via PuTTY...
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: Thaddy on November 26, 2019, 09:47:30 am
But how does one know if there is a dist-upgrade available???
Running dist-upgrade is not strictly necessary all the time, upgrade is often enough, but it is my habit, except on vital systems where I only run upgrade..
If you run sudo update it will report how many updates are available.

@DidaJI
Can you report your hardware in the exact same manner as I did above?
Can you report how you installed FPC and Lazarus?
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: DidaJI on November 26, 2019, 12:31:51 pm
No problem. Done. No problems found.
I used:
- RPi4/4GB running from a fast sandisk 64GB USB3 stick, booted from a sandisk cat 10 16GB micro sd card.
- Raspbian Buster with all patches. No swap (well, not a serious one: 128 MB)
- FPC version   3.3.1-r43569
- Lazarus version 2.1.0
- Offical USB-C Powersupply
Both FPC and Lazarus built from source on the Raspberry Pi itself.

Speed problems are often caused by:
- a 1 GB without enough swap
- a proper swap (equal to the hardware memory) but on a slow medium
- FPC and/or Lazarus built with debug information (never do that, unless you develop for the compiler or the IDE).
- Not updating Rasbian enough!!! There are almost weekly speed related updates. Plz run sudo apt update && sudo apt dist-upgrade -y  if you did not do so already.
- An under-powered powersupply (RPi4 will throttle down!!! if starved, do you see the lightning image in the top right corner? That indicates not enough amps)
[edit]
Just repeated the test on a RPi 3b + 1 GB swap and there there is a noticable slowdown, but not unworkable.
That Pi is also running Pihole and a webserver, so there are less resources available.
This Pi has also the same storage configuration, except not running on USB3 speed of course. (stick and sd are the same, though)


Thanks for the test! I also have RPI4 with 4GB RAM. The only difference I see is that I have all on the SD card (SanDisk Extreme) and those on USB. I don't think it could be that, but I'll try.

Zdenek.
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: DidaJI on November 26, 2019, 12:36:04 pm
No problem. Done. No problems found.
I used:
- RPi4/4GB running from a fast sandisk 64GB USB3 stick, booted from a sandisk cat 10 16GB micro sd card.
- Raspbian Buster with all patches. No swap (well, not a serious one: 128 MB)
- FPC version   3.3.1-r43569
- Lazarus version 2.1.0
- Offical USB-C Powersupply
Both FPC and Lazarus built from source on the Raspberry Pi itself.

Speed problems are often caused by:
- a 1 GB without enough swap
- a proper swap (equal to the hardware memory) but on a slow medium
- FPC and/or Lazarus built with debug information (never do that, unless you develop for the compiler or the IDE).
- Not updating Rasbian enough!!! There are almost weekly speed related updates. Plz run sudo apt update && sudo apt dist-upgrade -y  if you did not do so already.
- An under-powered powersupply (RPi4 will throttle down!!! if starved, do you see the lightning image in the top right corner? That indicates not enough amps)
[edit]
Just repeated the test on a RPi 3b + 1 GB swap and there there is a noticable slowdown, but not unworkable.
That Pi is also running Pihole and a webserver, so there are less resources available.
This Pi has also the same storage configuration, except not running on USB3 speed of course. (stick and sd are the same, though)

Could you please try the color font size problem in "TLabel"? Put the "Label" on the Form, set the font size to 150 and the color to be red. Do you see it correctly? Upper and lower case character?

Thank's: Zdenek.
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: DidaJI on November 26, 2019, 02:36:48 pm
But how does one know if there is a dist-upgrade available???
Running dist-upgrade is not strictly necessary all the time, upgrade is often enough, but it is my habit, except on vital systems where I only run upgrade..
If you run sudo update it will report how many updates are available.

@DidaJI
Can you report your hardware in the exact same manner as I did above?
Can you report how you installed FPC and Lazarus?

I have:
Raspberry PI4 with 4GB RAM
Linux RPI-Devel2 4.19.75-v7l+ #1270 SMP Tue Sep 24 18:51:41 BST 2019 armv7l GNU/Linux
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian

Lazarus: 2.1.0
Date: 27.09.2019
FPC: 3.3.1
SVN revision: Unversioned directory

- I don't know why it doesn't tell me the FPC revision.

I use my own 5V / 3A converter for power supply and power is not via USB connector, but via pins. Reducing performance due to low power is not a problem, my compilation goes much faster than on RPI3. Only the motion in the lazarus editor is slow.
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: DidaJI on November 26, 2019, 04:12:49 pm
Here is another video where the speed problem is displayed sequentially on RPI4 and RPI3. I only pressed the down arrow on the keyboard at the same speed.
It's the same SD card inserted in RPI4 and RPI3B+.

Video: https://www.youtube.com/watch?v=4w6XBMxzS0o (https://www.youtube.com/watch?v=4w6XBMxzS0o)
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: DidaJI on November 26, 2019, 06:08:38 pm
@Thaddy:
I cloned my SD card on a USB 3.0 SSD disk and boot system out of it. Unfortunately, the speed in the graphical environment is still the same ...

Zdenek.
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: DidaJI on November 27, 2019, 07:05:14 am
Here it is nice to see that switching Buttons is cool until you put an Image on the form. Then, switching components becomes unusable.

Video: https://www.youtube.com/watch?v=rUItOqTz96U&feature=youtu.be
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: Thaddy on November 27, 2019, 07:17:40 am
Here it is nice to see that switching Buttons is cool until you put an Image on the form. Then, switching components becomes unusable.

Video: https://www.youtube.com/watch?v=rUItOqTz96U&feature=youtu.be
The bad news is I can reproduce that now. The good news is that there is work being done to the performance of the OpenGL back-end for the videocore V1.
It has not yet reached the same level of optimizations of the videocore 1V but that is a matter of time.
If you are adventurous, you can follow the development and try the trunk version of the OpenGL back-end.
It is the overlapping images that cause the problem, if they are nicely separated there is no issue.
Eventually the videocore V1 back-end should be *much* faster based on specs.

Note (to be sure) you do not need to use opengl or opengles yourself: this is abstracted away in the  X renderer.

One note that worries me slightly: you write you are sharing code between 3 and 4? I would not do that. Compile for 3 and 4 separately.
The 3 does not use MESA drivers, but EGL on top of broadcom blobs for the X renderer, the 4 has proper MESA drivers, but are not fully optimized into the X renderer yet.

One way to test it is to compile the Opengles and OpenGL examples that come with FPC. (skip the glx examples: these do not work fat enough yet)
You will note that you get twice the framerate compared to RPi3, so it is the x-renderer that does not yet use all available speed.
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: DidaJI on December 13, 2019, 09:52:08 am
So now I eliminate the problem with the speed of graphics in Lazarus, now I'm running about 10 times faster. A problem with poor color rendering of large fonts has also been resolved!

In config.txt, just comment "dtoverlay=vc4-fkms-v3d".

Now it goes all perfectly and faster than RPI3B+

@Thaddy, thank you very much for kicking with rendering graphics. That helped me.

Zdenek.
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: BosseB on December 13, 2019, 10:12:43 am
I just looked in my config.txt on an RPi4B with 4GB RAM running the standard desktop.
Here is what I found at the very bottom:

Code: [Select]
[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
#dtoverlay=vc4-fkms-v3d

So do you mean that it should be disabled for all versions except pi4?
Or should I comment out the active line for my pi4 too?
And what are the ramifications? I.e. how can I see if I am suffering from this issue?
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: DidaJI on December 13, 2019, 10:28:49 am
@BosseB

Take a simple test on this my video: https://www.youtube.com/watch?v=KBmExC-ICD8&feature=youtu.be

If you can switch between TImage components as slowly as I do on video, then you have the same problem as me.

The second test, put on the Form one Label with some text, set font to red and increase the font to >150. If all letters are not red, you have the same problem again: https://www.youtube.com/watch?v=TOAQdGOXvCo&feature=youtu.be

To disable it, you must also disable the parameter in the [PI4] section.

Zdenek.
Title: Re: Lazarus on Raspberry Pi 4 IDE response speed problem
Post by: JurVO123 on December 29, 2019, 01:52:35 pm
Hi,

With the suggestions of DidaJI, I am running a data-acquisition system.
On RPI4 it runs OK, but the GUI freezes after an hour or so, while the same app works perfect on PI3B+ for weeks running.

Any other suggestions?

Regards Jur