totalcross icon indicating copy to clipboard operation
totalcross copied to clipboard

Screen tearing using an touchscreen and raspberry pi

Open VicMisael opened this issue 4 years ago • 12 comments

Issue Title

Screen tearing using a touchscreen and raspberry pi

Describe the bug

When a screen transition is done, there's some screen tearing

To Reproduce

https://github.com/TotalCross/MedicinalCase Compile this code, and run in a raspberry pi with touchscreen, you should see the issue

Expected behavior

The screen should not tear and the transition should be smooth as possible

Screenshots or videos

ezgif com-gif-maker (1)

Devices:

Please complete the following information:

  • Device: Raspberry pi 4
  • OS: Linux Raspbian
  • OS Version: 10
  • TotalCross Version: 6.1.1

Additional Info

Maybe related to SDL

VicMisael avatar Nov 18 '20 17:11 VicMisael

This is a screen synchronizing issue. To fix this problem we need to either support double buffer or any kind of low level graphics synchronization when drawing the visuals

teras avatar Dec 09 '20 09:12 teras

Same issue here. Just purchased a Rpi4 with 8GB Ram and anything I deploy via TotalCross is lagging and delayed on the actual Rpi device. Are there any workarounds?

Dinosrules avatar Feb 01 '21 00:02 Dinosrules

Hi @Dinosrules , can you give us more info on that?

VicMisael avatar Feb 01 '21 11:02 VicMisael

Hello @VicMisael and thanks for replying. Basically the exact lagging behavior observed in the video posted above resembles with what I experience on the Rpi 4 with the 7" touchscreen. Any kind of transitions or even button touches are (and feel) delayed. No other app is lagging on the Rpi 4. The tests have been made with a few of the default apps from your repository such as the "home appliance" and "medical device". Both have the same lagging issues.

Dinosrules avatar Feb 01 '21 14:02 Dinosrules

Are you using version 7.0.0?

VicMisael avatar Feb 01 '21 14:02 VicMisael

I am using TotalCross through VSCode and the latest version I see in my extension is [0.0.13].

Dinosrules avatar Feb 01 '21 14:02 Dinosrules

You can have a look at the pom.xml, with on the dependency tag

VicMisael avatar Feb 01 '21 14:02 VicMisael

<dependencies> <dependency> <groupId>com.totalcross</groupId> <artifactId>totalcross-sdk</artifactId> <version>6.1.1</version> </dependency> <dependency> <groupId>com.totalcross.knowcode</groupId> <artifactId>KnowCodeXML</artifactId> <version>1.11</version> </dependency> </dependencies>

It appears that it is not 7.0.0. Can I change it manually or is there a more automated process to update?

Dinosrules avatar Feb 01 '21 14:02 Dinosrules

You can change it manually, when you package(is recommended to clean package when you change the version), Will be downloaded automatically

VicMisael avatar Feb 01 '21 14:02 VicMisael

I have changed to version 7.0.0 and the download worked when packaging, however the home-appliance demo screen is all white (in simulator). Adding more context below:

>>>>>>> CAUGHT UNHANDLED EXCEPTION IN EVENT THREAD: java.lang.NoSuchMethodError: totalcross.xml.XmlReader.parse([BII)V at com.totalcross.knowcode.parse.XmlContainerFactory.readXml(XmlContainerFactory.java:143) at com.totalcross.knowcode.parse.XmlContainerFactory.create(XmlContainerFactory.java:48) at com.totalcross.knowcode.parse.XmlContainerFactory.create(XmlContainerFactory.java:74) at com.totalcross.knowcode.ui.HomeApplianceXML.initUI(HomeApplianceXML.java:155) at totalcross.ui.MainWindow.startProgram(MainWindow.java:501) at totalcross.ui.MainWindow._onTimerTick(MainWindow.java:541) at totalcross.Launcher$WinTimer$1.run(Launcher.java:358) at totalcross.TCEventThread.privatePumpEvents(TCEventThread.java:59) at totalcross.TCEventThread.run(TCEventThread.java:33)

Update: Attempting to run on Rpi device throws errors as shown below:

Unhandled exception: java.lang.NoSuchMethodError: totalcross.xml.XmlReader parse([&B,I,I,). The current VM may not be compatible with this program OR there may be a bug in the Java compiler; try to upgrade or downgrade your JDK. Stack trace: com.totalcross.knowcode.parse.XmlContainerFactory.readXml 143 com.totalcross.knowcode.parse.XmlContainerFactory.create 48 com.totalcross.knowcode.parse.XmlContainerFactory.create 74 com.totalcross.knowcode.ui.HomeApplianceXML.initUI 155 totalcross.ui.MainWindow.startProgram 501 totalcross.ui.MainWindow._onTimerTick 541 Aborting program.Unhandled exception: java.lang.NoSuchMethodError: totalcross.xml.XmlReader parse([&B,I,I,). The current VM may not be compatible with this program OR there may be a bug in the Java compiler; try to upgrade or downgrade your JDK. Stack trace: com.totalcross.knowcode.parse.XmlContainerFactory.readXml 143 com.totalcross.knowcode.parse.XmlContainerFactory.create 48 com.totalcross.knowcode.parse.XmlContainerFactory.create 74 com.totalcross.knowcode.ui.HomeApplianceXML.initUI 155 totalcross.ui.MainWindow.startProgram 501 totalcross.ui.MainWindow._onTimerTick 541 Aborting program. exit code: 0

Update: I can confirm that this happens with both "appliance" and "medical device" demos.

Dinosrules avatar Feb 01 '21 14:02 Dinosrules

Oh sorry, you also have to change the knowcode xml 1.14

VicMisael avatar Feb 01 '21 17:02 VicMisael

The simulator works now. The deployment to Rpi 4 is causing a crash with 7.0.0, but using 7.0.1 works. The graphics performance is actually no different and the background transition is just as laggy as seen in the initial post of this issue. If you have any other recommendations I would appreciate it @VicMisael. Thank you again for your support!

Here is an excerpt from the Rpi device while running the app:

pi@raspberrypi:~/HomeApplianceXML $ ./HomeApplianceXML Testing video drivers... SDL_VIDEODRIVER available: x11 wayland dummy SDL_VIDEODRIVER selected : x11 SDL_DisplayMode #0: current display mode is 800x480x0 SDL_RENDER_DRIVER available: opengl opengles2 software SDL_RENDER_DRIVER selected : software SDL_PIXEL_FORMAT: SDL_PIXELFORMAT_RGB888 Warning! totalcross.io.IOException: Error Code: 13 - Permission denied totalcross.io.File.create totalcross.io.File.<C> 84 totalcross.io.File.<C> 89 totalcross.res.Resources.uiStyleChanged 282 totalcross.ui.MainWindow.setUIStyle 226 com.totalcross.knowcode.ui.HomeApplianceXML.<C> 143

System font does not support bold version System font does not support bold version System font does not support bold version System font does not support bold version System font does not support bold version starting read sensor

Dinosrules avatar Feb 01 '21 17:02 Dinosrules