Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 2 of 2 FirstFirst 12
Results 11 to 11 of 11

Thread: Raspberry Pi OpenGL issue with Kivy screenmanager

  1. #11
    Junior Member Newbie FrankGould's Avatar
    Join Date
    Jan 2018
    Greetings Dark Photon and others watching this thread. I have spent many hours researching and testing environments to establish the right OS build to isolate this bug that eventually consumes all graphic memory and crashes the Kivy app.

    Once I determined all Raspberry Pi linux builds exhibit this same problem that did NOT occur on Oracle VM Mint Linus (No glGetError messages), I began adding debug messages in shader.pyx that allowed me to isolate where certain actions causing a glGetError 0x502 (Invalid Operation) that I had suspected caused the eventual 0x505 out of memory errors.

    What I found was a “uniform” named “t” that passed a zero value (i.e. 0) immediately before an opacity named uniform was uploaded. Below is what I found in the logs.

    [DEBUG ] [Shader ] uploading uniform t (loc=2, value=0)
    [DEBUG ] [Shader ] uploading uniform opacity (loc=1, value=1.0)
    glGetError 0x502
    [DEBUG ] [Shader ] -> (gl:1282) opacity

    That prompted me to change shader.pyx to ignore these invalid “t0” uniforms and the app stopped generating the glGetError 0x502 errors; however, that did not stop the “memory leak” because eventually, like in 10 minutes, the app crashed with the 0x505 and then 0x506 (invalid frame buffer operation - same FBO error in Kivy log entries) error messages. I think this is also why shader.pyx reports 'Exception: Shader didnt link, check info log' because there is no memory to link.

    So, now I’ve collected several run logs that show memory usage during the period when 0x505 error messages are displaying on the console. Below are from the results while running 'vcdbg reloc' when these console 0x505 error messages are displayed (see run log named vcdbg reloc - Fresh Boot18Mar-crashingwithGC.txt for full snapshot).

    9.8M free memory in 9 free block(s)

    Of the many entries (like the two below with parenthetical values removed), these two appear to be the majority memory consumption candidates (as Dark Photon mentions above). The amount used varies throughout the log.

    [ 336] 0x375bf740: used 6.3M 'Texture blob'
    [ 840] 0x37c03760: used 1.5M ''

    Then, in one section, I found the following error messages.

    0x2c570da0: corrupt trailer (space -256 != 1572961)
    0x2c570da0: corrupt trailer (guards[0] = 0xffffff00)
    0x2c570da0: corrupt trailer (guards[1] = 0xffffff00)
    0x2c570da0: corrupt trailer (guards[2] = 0xffffff00)
    0x2c570da0: corrupt trailer (guards[3] = 0xffffff00)
    0x2c570da0: corrupt trailer (guards[4] = 0xffffff00)
    0x2c6f0e00: corrupt entry (space 0xffffff00)
    resynced at 0x2c6f0fe0 (skipped 480 bytes)

    I'm not sure what to do next other than read the GL runtime debug log to see if I can find what is going on in OpenGL and how to fix it in Kivy or I can try to figure out what screenmanager is doing when it issues the OpenGL commands (or whatever uniform upload is getting). My problem is not knowing how these graphic layers operate under Kivy and which might be suspect.

    Below is a recap of other suggestions from forums:

    1. vcgencmd get_mem gpu returned 512 always, which I defined in RPi config.
    2. There are screenmanager transitions that do not exhibit this same 0x502 error but eventually show glGetError 0x505 with low free memory.
    3. I have attempted these tests with different images with only two jpg files in low resolution but the same results eventually occur with 0x505.
    4. I was not able to free the GPU memory (tested using vcdbg reloc) using echo # > /proc/sys/vm/drop_caches.
    5. Got same results after changing RPi graphics to GL Driver (Full KMS) in raspi-config->Advanced->GL Driver.
    6. Got same results after installing gl4es, libgl1-mesa-dri, and xcompmgr.
    7. Generated a huge (>60K lines) realtime OpenGL Debug Kivy console log that shows many internal GL errors. This was enabled using os.environ['KIVY_GL_DEBUG'] = '1' in Kivy app.

    Things to try going forward:
    1. Finish setting up QEMU to allow others to see the execution to duplicate and maybe fix.
    2. Find a way to 1) free memory, 2) fix shader/screenmanager, 3) get dev support, 4) examine log to find module causing memory leak.

    Any other suggestions will be greatly appreciated by anyone and everyone.
    Last edited by FrankGould; Yesterday at 11:49 AM. Reason: Adding more details about GL log from Kivy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts