[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Issue with Pygame + Waveshare 3.5" HDMI display



Thanks you for very detailed instructions.

>0) try different bit depths than 32.
I tried 8, 16, 32. It didn't help.

>1) try building pygame with SDL2.
Built it. It even doesn't return the list of modes. Here is the result:
pi@raspberrypi:~ $ sudo python3 test.py
pygame 1.9.5.dev0
Hello from the pygame community. https://www.pygame.org/contribute.html
error: XDG_RUNTIME_DIR not set in the environment.
None
None
0
error: XDG_RUNTIME_DIR not set in the environment.
Traceback (most recent call last):
  File "test.py", line 17, in <module>
    screen = pygame.display.set_mode((w, h))
pygame.error: No available video device

>2) instructions on how to debug things and get stack traces.
Tried to debug, here is the result:
pi@raspberrypi:~ $ sudo gdb python3
GNU gdb (Raspbian 7.12-6) 7.12.0.20161007-git
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python3...(no debugging symbols found)...done.
(gdb) run test.py
Starting program: /usr/bin/python3 test.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
[New Thread 0x741e5470 (LWP 973)]
[New Thread 0x7394f470 (LWP 974)]
fbcon
<VideoInfo(hw = 1, wm = 0,video_mem = 600
         blit_hw = 0, blit_hw_CC = 0, blit_hw_A = 0,
         blit_sw = 0, blit_sw_CC = 0, blit_sw_A = 0,
         bitsize  = 32, bytesize = 4,
         masks =  (16711680, 65280, 255, 0),
         shifts = (16, 8, 0, 0),
         losses =  (0, 0, 0, 8),
         current_w = 480, current_h = 320
>

[(1600, 1200), (1280, 1024), (1024, 1024), (1280, 960), (1152, 864), (1024, 768), (800, 600), (768, 576), (640, 480)]
0
Thread 1 "python3" received signal SIGSEGV, Segmentation fault.
0x769ff104 in SDL_FillRect () from /usr/lib/arm-linux-gnueabihf/libSDL-1.2.so.0
(gdb) backtrace full
#0  0x769ff104 in SDL_FillRect () from /usr/lib/arm-linux-gnueabihf/libSDL-1.2.so.0
No symbol table info available.
#1  0x76a01ae4 in SDL_SetVideoMode () from /usr/lib/arm-linux-gnueabihf/libSDL-1.2.so.0
No symbol table info available.
Backtrace stopped: Cannot access memory at address 0x65001152

While trying to compile pygame with debug messages got too many issues.

>3) ask your vendor for support.
Sure, I did that already. Though I'm not sure if that's the issue with the touchscreen.

Thanks!


On Wed, Nov 21, 2018 at 11:46 PM René Dudfield <renesd@xxxxxxxxx> wrote:
Hello,

Things to try in order of easiest to do...

0) try different bit depths than 32.
1) try building pygame with SDL2.
2) instructions on how to debug things and get stack traces.
3) ask your vendor for support.


1) try building pygame with SDL2.

Some things are still buggy, but a lot of things work (maybe enough for your program).
I recall 'reading on the interwebs' that 'the raspberry pi touch screen does not work with pygame'.


2) instructions on how to debug things.

try this:
$ gdb python yourscript.py

Then when it segfaults, you should get a backtrace.
You can type `backtrace full` to see the trace, where it should show where it fails.

The best resources on how to debug in Debian and with GDB are here:
You will probably need to install pygame and SDL with debug symbols...
I don't think Debian/Ubuntu/Raspberian make pygame or libsdl debug builds... (see with this command)
$ apt-cache search libsdl | grep dbg

So we need to build pygame from source...

# install pygame dependencies (might be slightly different on rasperian... I dunno).
sudo apt-get build-dep python-pygame libsdl1.2debian libsdl-image1.2 libsdl-mixer1.2 libsdl-ttf2.0-0 python3

sudo apt-get install git python3-dev python3-setuptools python3-numpy python3-opengl
sudo apt-get install libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsmpeg-dev
sudo apt-get install libsdl1.2-dev libportmidi-dev libtiff5-dev libx11-6 libx11-dev fluid-soundfont-gm
sudo apt-get install timgm6mb-soundfont xfonts-base xfonts-100dpi xfonts-75dpi xfonts-cyrillic fontconfig fonts-freefont-ttf libfreetype6-dev gdb

$ git clone git@xxxxxxxxxx:pygame/pygame.git
$ python setup.py -config -auto
# Edit `Setup` file. Add -g to the DEBUG= line.
DEBUG= -g
$ python -m pip uninstall pygame
$ python setup.py install pygame

You may also need to install the dependencies of SDL with debug symbols.
Remember... this guide is available if you get stuck:
    https://wiki.debian.org/HowToGetABacktrace


I don't think Debian/Ubuntu/Raspberian make libsdl debug builds... (see with this command)
$ apt-cache search libsdl | grep dbg

If they are not there, it's sort of easy to make your own...
# get gdb.
$ sudo apt-get install build-essential fakeroot gdb
$ sudo apt-get build-dep libsdl1.2debian libsdl-image1.2 libsdl-mixer1.2 libsdl-ttf2.0-0

$ DEB_BUILD_OPTIONS="nostrip noopt" fakeroot apt-get -b source libsdl1.2debian
$ ls -lat *.deb
$ sudo dpkg -i libsdl1.2*.deb

You may want to install the python with debug symbols as well.
$ sudo apt-get install python3-dbg


Also, you may want to try building SDL-1.2 from source using the 'SDL-1.2' bugfix branch.




On Thu, Nov 22, 2018 at 5:29 AM Go Peppy <peppy.player@xxxxxxxxx> wrote:
It's not a regular exception.  How can I get that stack trace?
I've tried: hdmi_cvt 480 320 59 6 0 0 0
The result was the same.

On Wed, Nov 21, 2018 at 7:07 PM Luke Paireepinart <rabidpoobear@xxxxxxxxx> wrote:
Should the third parameter to hdmi_cvt of 60 really be 59 since that matches the refresh rate in the other list?

On Wed, Nov 21, 2018, 7:39 PM Ian Mallett <ian@xxxxxxxxxxxxxx wrote:
According to the linked issue, you say it segfaults. That should definitely not happen; can you provide a stack trace?