Raspberry Pi 4 video corruption

What I’m trying to do:
Create a dashboard with a Raspberry Pi 4 and a Samsung TV.

What’s not working:
I’m seeing some really weird video corruption with the Pi4. The cursor is fine, but starting any applications causes some (shredding?) of everything but the cursor.

What I’ve tried:

  • Adjusting video RAM allocation
  • Applications: Firefox, Chromium, and feh, and all produce garbage on the screen. Cursor looks fine, though, even with everything else being nasty.
  • Window managers: I’ve tried using xfce4 and matchbox window managers, and I get the same result.
  • Different monitors: I’ve tried a Samsung monitor, a Dell monitor, and a cheap little 1200x800 display from Amazon.
  • Different cables

A little more about the app config:

  • Using docker-compose to run 3 containers.
    • One is proprietary stuff, unrelated to framebuffer weirdness. No special privs, just running an app in a container, periodically writing to resin data volume.
    • Second container is running a Flask app
    • Third container is dedicated to the display, running Xorg, matchbox, and Firefox.
  • I’m using the balenalib/raspberrypi4-64-ubuntu-python:3.7-bionic base image for all containers.

output from glxinfo:

name of display: :0
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /root/.drirc: No such file or directory.
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /root/.drirc: No such file or directory.
libGL: MESA-LOADER: device is not located on the PCI bus
libGL: using driver vc4 for 4
libGL: MESA-LOADER: dlopen(/usr/lib/aarch64-linux-gnu/dri/vc4_dri.so)
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /root/.drirc: No such file or directory.
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /root/.drirc: No such file or directory.
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /root/.drirc: No such file or directory.
libGL: Using DRI3 for screen 0
display: :0  screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4
server glx extensions:
    GLX_ARB_create_context, GLX_ARB_create_context_profile, 
    GLX_ARB_fbconfig_float, GLX_ARB_framebuffer_sRGB, GLX_ARB_multisample, 
    GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile, 
    GLX_EXT_fbconfig_packed_float, GLX_EXT_framebuffer_sRGB, 
    GLX_EXT_import_context, GLX_EXT_libglvnd, GLX_EXT_texture_from_pixmap, 
    GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_INTEL_swap_event, 
    GLX_MESA_copy_sub_buffer, GLX_OML_swap_method, GLX_SGIS_multisample, 
    GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_SGIX_visual_select_group, 
    GLX_SGI_make_current_read, GLX_SGI_swap_control
client glx vendor string: Mesa Project and SGI
client glx version string: 1.4
client glx extensions:
    GLX_ARB_context_flush_control, GLX_ARB_create_context, 
    GLX_ARB_create_context_profile, GLX_ARB_create_context_robustness, 
    GLX_ARB_fbconfig_float, GLX_ARB_framebuffer_sRGB, 
    GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_buffer_age, 
    GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile, 
    GLX_EXT_fbconfig_packed_float, GLX_EXT_framebuffer_sRGB, 
    GLX_EXT_import_context, GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info, 
    GLX_EXT_visual_rating, GLX_INTEL_swap_event, GLX_MESA_copy_sub_buffer, 
    GLX_MESA_multithread_makecurrent, GLX_MESA_query_renderer, 
    GLX_MESA_swap_control, GLX_OML_swap_method, GLX_OML_sync_control, 
    GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, 
    GLX_SGIX_visual_select_group, GLX_SGI_make_current_read, 
    GLX_SGI_swap_control, GLX_SGI_video_sync
GLX version: 1.4
GLX extensions:
    GLX_ARB_create_context, GLX_ARB_create_context_profile, 
    GLX_ARB_fbconfig_float, GLX_ARB_framebuffer_sRGB, 
    GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_buffer_age, 
    GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile, 
    GLX_EXT_fbconfig_packed_float, GLX_EXT_framebuffer_sRGB, 
    GLX_EXT_import_context, GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info, 
    GLX_EXT_visual_rating, GLX_INTEL_swap_event, GLX_MESA_copy_sub_buffer, 
    GLX_MESA_query_renderer, GLX_MESA_swap_control, GLX_OML_swap_method, 
    GLX_OML_sync_control, GLX_SGIS_multisample, GLX_SGIX_fbconfig, 
    GLX_SGIX_pbuffer, GLX_SGIX_visual_select_group, GLX_SGI_make_current_read, 
    GLX_SGI_swap_control, GLX_SGI_video_sync
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Broadcom (0x14e4)
    Device: VC4 V3D 2.1 (0xffffffff)
    Version: 19.0.8
    Accelerated: yes
    Video memory: 1806MB
    Unified memory: yes
    Preferred profile: compat (0x2)
    Max core profile version: 0.0
    Max compat profile version: 2.1
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 2.0
OpenGL vendor string: Broadcom
OpenGL renderer string: VC4 V3D 2.1
OpenGL version string: 2.1 Mesa 19.0.8
OpenGL shading language version string: 1.20
OpenGL extensions:
    GL_AMD_shader_trinary_minmax, GL_APPLE_packed_pixels, 
    GL_ARB_ES2_compatibility, GL_ARB_buffer_storage, 
    GL_ARB_clear_buffer_object, GL_ARB_color_buffer_float, 
    GL_ARB_compressed_texture_pixel_storage, GL_ARB_copy_buffer, 
    GL_ARB_debug_output, GL_ARB_depth_texture, GL_ARB_draw_buffers, 
    GL_ARB_draw_elements_base_vertex, GL_ARB_explicit_attrib_location, 
    GL_ARB_explicit_uniform_location, GL_ARB_fragment_coord_conventions, 
    GL_ARB_fragment_program, GL_ARB_fragment_program_shadow, 
    GL_ARB_fragment_shader, GL_ARB_framebuffer_object, 
    GL_ARB_framebuffer_sRGB, GL_ARB_get_program_binary, 
    GL_ARB_get_texture_sub_image, GL_ARB_half_float_pixel, 
    GL_ARB_half_float_vertex, GL_ARB_internalformat_query, 
    GL_ARB_internalformat_query2, GL_ARB_invalidate_subdata, 
    GL_ARB_map_buffer_alignment, GL_ARB_map_buffer_range, GL_ARB_multi_bind, 
    GL_ARB_multisample, GL_ARB_multitexture, GL_ARB_occlusion_query, 
    GL_ARB_occlusion_query2, GL_ARB_pixel_buffer_object, 
    GL_ARB_point_parameters, GL_ARB_point_sprite, 
    GL_ARB_program_interface_query, GL_ARB_provoking_vertex, 
    GL_ARB_robustness, GL_ARB_sampler_objects, GL_ARB_separate_shader_objects, 
    GL_ARB_shader_objects, GL_ARB_shading_language_100, GL_ARB_shadow, 
    GL_ARB_sync, GL_ARB_texture_barrier, GL_ARB_texture_border_clamp, 
    GL_ARB_texture_compression, GL_ARB_texture_cube_map, 
    GL_ARB_texture_env_add, GL_ARB_texture_env_combine, 
    GL_ARB_texture_env_crossbar, GL_ARB_texture_env_dot3, 
    GL_ARB_texture_mirrored_repeat, GL_ARB_texture_multisample, 
    GL_ARB_texture_non_power_of_two, GL_ARB_texture_rectangle, 
    GL_ARB_texture_storage, GL_ARB_texture_storage_multisample, 
    GL_ARB_texture_swizzle, GL_ARB_transpose_matrix, 
    GL_ARB_vertex_array_object, GL_ARB_vertex_attrib_binding, 
    GL_ARB_vertex_buffer_object, GL_ARB_vertex_program, GL_ARB_vertex_shader, 
    GL_ARB_window_pos, GL_ATI_blend_equation_separate, GL_ATI_draw_buffers, 
    GL_ATI_fragment_shader, GL_ATI_separate_stencil, 
    GL_ATI_texture_env_combine3, GL_EXT_abgr, GL_EXT_bgra, 
    GL_EXT_blend_color, GL_EXT_blend_equation_separate, 
    GL_EXT_blend_func_separate, GL_EXT_blend_minmax, GL_EXT_blend_subtract, 
    GL_EXT_compiled_vertex_array, GL_EXT_copy_texture, 
    GL_EXT_draw_range_elements, GL_EXT_fog_coord, GL_EXT_framebuffer_blit, 
    GL_EXT_framebuffer_multisample, GL_EXT_framebuffer_multisample_blit_scaled, 
    GL_EXT_framebuffer_object, GL_EXT_framebuffer_sRGB, 
    GL_EXT_gpu_program_parameters, GL_EXT_multi_draw_arrays, 
    GL_EXT_packed_depth_stencil, GL_EXT_packed_pixels, 
    GL_EXT_pixel_buffer_object, GL_EXT_point_parameters, 
    GL_EXT_provoking_vertex, GL_EXT_rescale_normal, GL_EXT_secondary_color, 
    GL_EXT_separate_specular_color, GL_EXT_shader_integer_mix, 
    GL_EXT_shadow_funcs, GL_EXT_stencil_two_side, GL_EXT_stencil_wrap, 
    GL_EXT_subtexture, GL_EXT_texture, GL_EXT_texture3D, 
    GL_EXT_texture_cube_map, GL_EXT_texture_edge_clamp, 
    GL_EXT_texture_env_add, GL_EXT_texture_env_combine, 
    GL_EXT_texture_env_dot3, GL_EXT_texture_lod_bias, GL_EXT_texture_object, 
    GL_EXT_texture_rectangle, GL_EXT_texture_sRGB, GL_EXT_texture_sRGB_decode, 
    GL_EXT_texture_swizzle, GL_EXT_vertex_array, GL_IBM_multimode_draw_arrays, 
    GL_IBM_rasterpos_clip, GL_IBM_texture_mirrored_repeat, 
    GL_INGR_blend_func_separate, GL_KHR_context_flush_control, GL_KHR_debug, 
    GL_KHR_no_error, GL_KHR_texture_compression_astc_ldr, 
    GL_KHR_texture_compression_astc_sliced_3d, GL_MESA_pack_invert, 
    GL_MESA_window_pos, GL_NV_blend_square, GL_NV_fog_distance, 
    GL_NV_light_max_exponent, GL_NV_packed_depth_stencil, 
    GL_NV_texgen_reflection, GL_NV_texture_barrier, 
    GL_NV_texture_env_combine4, GL_NV_texture_rectangle, GL_OES_EGL_image, 
    GL_OES_read_format, GL_SGIS_generate_mipmap, GL_SGIS_texture_border_clamp, 
    GL_SGIS_texture_edge_clamp, GL_SGIS_texture_lod, GL_SUN_multi_draw_arrays

OpenGL ES profile version string: OpenGL ES 2.0 Mesa 19.0.8
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 1.0.16
OpenGL ES profile extensions:
    GL_APPLE_texture_max_level, GL_EXT_blend_minmax, 
    GL_EXT_compressed_ETC1_RGB8_sub_texture, GL_EXT_discard_framebuffer, 
    GL_EXT_draw_buffers, GL_EXT_draw_elements_base_vertex, GL_EXT_frag_depth, 
    GL_EXT_map_buffer_range, GL_EXT_multi_draw_arrays, 
    GL_EXT_occlusion_query_boolean, GL_EXT_read_format_bgra, 
    GL_EXT_separate_shader_objects, GL_EXT_texture_border_clamp, 
    GL_EXT_texture_format_BGRA8888, GL_EXT_unpack_subimage, 
    GL_KHR_context_flush_control, GL_KHR_debug, GL_KHR_no_error, 
    GL_KHR_texture_compression_astc_ldr, 
    GL_KHR_texture_compression_astc_sliced_3d, GL_NV_draw_buffers, 
    GL_NV_fbo_color_attachments, GL_NV_read_buffer, GL_NV_read_depth, 
    GL_NV_read_depth_stencil, GL_NV_read_stencil, GL_OES_EGL_image, 
    GL_OES_EGL_image_external, GL_OES_EGL_sync, 
    GL_OES_compressed_ETC1_RGB8_texture, GL_OES_depth24, GL_OES_depth_texture, 
    GL_OES_draw_elements_base_vertex, GL_OES_element_index_uint, 
    GL_OES_fbo_render_mipmap, GL_OES_get_program_binary, GL_OES_mapbuffer, 
    GL_OES_packed_depth_stencil, GL_OES_required_internalformat, 
    GL_OES_rgb8_rgba8, GL_OES_stencil8, GL_OES_surfaceless_context, 
    GL_OES_texture_3D, GL_OES_texture_border_clamp, GL_OES_texture_npot, 
    GL_OES_vertex_array_object, GL_OES_vertex_half_float

234 GLX Visuals
    visual  x   bf lv rg d st  colorbuffer  sr ax dp st accumbuffer  ms  cav
  id dep cl sp  sz l  ci b ro  r  g  b  a F gb bf th cl  r  g  b  a ns b eat
----------------------------------------------------------------------------
...

288 GLXFBConfigs:
    visual  x   bf lv rg d st  colorbuffer  sr ax dp st accumbuffer  ms  cav
  id dep cl sp  sz l  ci b ro  r  g  b  a F gb bf th cl  r  g  b  a ns b eat
----------------------------------------------------------------------------
...

Output from glxgears:

Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.
GL_RENDERER   = VC4 V3D 2.1
GL_VERSION    = 2.1 Mesa 19.0.8
GL_VENDOR     = Broadcom
GL_EXTENSIONS = GL_ARB_multisample GL_EXT_abgr GL_EXT_bgra GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_copy_texture GL_EXT_subtexture GL_EXT_texture_object GL_EXT_vertex_array GL_EXT_compiled_vertex_array GL_EXT_texture GL_EXT_texture3D GL_IBM_rasterpos_clip GL_ARB_point_parameters GL_EXT_draw_range_elements GL_EXT_packed_pixels GL_EXT_point_parameters GL_EXT_rescale_normal GL_EXT_separate_specular_color GL_EXT_texture_edge_clamp GL_SGIS_generate_mipmap GL_SGIS_texture_border_clamp GL_SGIS_texture_edge_clamp GL_SGIS_texture_lod GL_ARB_framebuffer_sRGB GL_ARB_multitexture GL_EXT_framebuffer_sRGB GL_IBM_multimode_draw_arrays GL_IBM_texture_mirrored_repeat GL_ARB_texture_cube_map GL_ARB_texture_env_add GL_ARB_transpose_matrix GL_EXT_blend_func_separate GL_EXT_fog_coord GL_EXT_multi_draw_arrays GL_EXT_secondary_color GL_EXT_texture_env_add GL_EXT_texture_lod_bias GL_INGR_blend_func_separate GL_NV_blend_square GL_NV_light_max_exponent GL_NV_texgen_reflection GL_NV_texture_env_combine4 GL_SUN_multi_draw_arrays GL_ARB_texture_border_clamp GL_ARB_texture_compression GL_EXT_framebuffer_object GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_MESA_window_pos GL_NV_packed_depth_stencil GL_NV_texture_rectangle GL_ARB_depth_texture GL_ARB_occlusion_query GL_ARB_shadow GL_ARB_texture_env_combine GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 GL_ARB_texture_mirrored_repeat GL_ARB_window_pos GL_ATI_fragment_shader GL_EXT_stencil_two_side GL_EXT_texture_cube_map GL_NV_fog_distance GL_APPLE_packed_pixels GL_ARB_draw_buffers GL_ARB_fragment_program GL_ARB_fragment_shader GL_ARB_shader_objects GL_ARB_vertex_program GL_ARB_vertex_shader GL_ATI_draw_buffers GL_ATI_texture_env_combine3 GL_EXT_shadow_funcs GL_EXT_stencil_wrap GL_MESA_pack_invert GL_ARB_fragment_program_shadow GL_ARB_half_float_pixel GL_ARB_occlusion_query2 GL_ARB_point_sprite GL_ARB_shading_language_100 GL_ARB_sync GL_ARB_texture_non_power_of_two GL_ARB_vertex_buffer_object GL_ATI_blend_equation_separate GL_EXT_blend_equation_separate GL_OES_read_format GL_ARB_color_buffer_float GL_ARB_pixel_buffer_object GL_ARB_texture_rectangle GL_EXT_pixel_buffer_object GL_EXT_texture_rectangle GL_EXT_texture_sRGB GL_ARB_framebuffer_object GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_EXT_packed_depth_stencil GL_ARB_vertex_array_object GL_ATI_separate_stencil GL_EXT_gpu_program_parameters GL_EXT_texture_sRGB_decode GL_OES_EGL_image GL_ARB_copy_buffer GL_ARB_half_float_vertex GL_ARB_map_buffer_range GL_ARB_texture_swizzle GL_EXT_texture_swizzle GL_ARB_ES2_compatibility GL_ARB_debug_output GL_ARB_draw_elements_base_vertex GL_ARB_explicit_attrib_location GL_ARB_fragment_coord_conventions GL_ARB_provoking_vertex GL_ARB_sampler_objects GL_ARB_texture_multisample GL_EXT_provoking_vertex GL_NV_texture_barrier GL_ARB_get_program_binary GL_ARB_robustness GL_ARB_separate_shader_objects GL_ARB_compressed_texture_pixel_storage GL_ARB_internalformat_query GL_ARB_map_buffer_alignment GL_ARB_texture_storage GL_EXT_framebuffer_multisample_blit_scaled GL_AMD_shader_trinary_minmax GL_ARB_clear_buffer_object GL_ARB_explicit_uniform_location GL_ARB_invalidate_subdata GL_ARB_program_interface_query GL_ARB_texture_storage_multisample GL_ARB_vertex_attrib_binding GL_KHR_debug GL_KHR_texture_compression_astc_ldr GL_ARB_buffer_storage GL_ARB_internalformat_query2 GL_ARB_multi_bind GL_EXT_shader_integer_mix GL_ARB_get_texture_sub_image GL_ARB_texture_barrier GL_KHR_context_flush_control GL_KHR_no_error GL_KHR_texture_compression_astc_sliced_3d 
VisualID 409, 0x199
Draw call returned Invalid argument.  Expect corruption.
354 frames in 5.0 seconds = 70.658 FPS
301 frames in 5.0 seconds = 60.016 FPS
301 frames in 5.0 seconds = 60.017 FPS
301 frames in 5.0 seconds = 60.021 FPS
301 frames in 5.0 seconds = 60.016 FPS

I’m getting to the end of what I know to try. Advice appreciated!

Xorg log output:

[    16.714] 
X.Org X Server 1.19.6
Release Date: 2017-12-20
[    16.715] X Protocol Version 11, Revision 0
[    16.715] Build Operating System: Linux 4.4.0-148-generic aarch64 Ubuntu
[    16.715] Current Operating System: Linux ba21fdd332cd 4.19.66 #1 SMP PREEMPT Wed Aug 28 14:43:47 UTC 2019 aarch64
[    16.715] Kernel command line: coherent_pool=1M 8250.nr_uarts=0 cma=64M cma=256M video=HDMI-A-1:1024x768@60 smsc95xx.macaddr=DC:A6:32:02:92:59 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  dwc_otg.lpm_enable=0 console=null rootfstype=ext4 rootwait vt.global_cursor_default=0 root=PARTUUID=bab0a5c2-02 rootwait
[    16.715] Build Date: 03 June 2019  08:11:53AM
[    16.715] xorg-server 2:1.19.6-1ubuntu4.3 (For technical support please see http://www.ubuntu.com/support) 
[    16.715] Current version of pixman: 0.34.0
[    16.715]    Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
[    16.715] Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[    16.715] (==) Log file: "/var/log/Xorg.0.log", Time: Wed Oct  9 20:13:21 2019
[    16.759] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[    16.769] (==) No Layout section.  Using the first Screen section.
[    16.769] (==) No screen section available. Using defaults.
[    16.769] (**) |-->Screen "Default Screen Section" (0)
[    16.769] (**) |   |-->Monitor "<default monitor>"
[    16.778] (==) No monitor specified for screen "Default Screen Section".
        Using a default monitor configuration.
[    16.778] (==) Automatically adding devices
[    16.778] (==) Automatically enabling devices
[    16.778] (==) Automatically adding GPU devices
[    16.778] (==) Automatically binding GPU devices
[    16.795] (==) Max clients allowed: 256, resource mask: 0x1fffff
[    17.111] (WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.
[    17.549]    Entry deleted from font path.
[    17.549] (WW) The directory "/usr/share/fonts/X11/100dpi/" does not exist.
[    17.549]    Entry deleted from font path.
[    17.549] (WW) The directory "/usr/share/fonts/X11/75dpi/" does not exist.
[    17.549]    Entry deleted from font path.
[    17.549] (WW) The directory "/usr/share/fonts/X11/Type1" does not exist.
[    17.549]    Entry deleted from font path.
[    17.550] (WW) The directory "/usr/share/fonts/X11/100dpi" does not exist.
[    17.550]    Entry deleted from font path.
[    17.550] (WW) The directory "/usr/share/fonts/X11/75dpi" does not exist.
[    17.550]    Entry deleted from font path.
[    17.550] (==) FontPath set to:
        /usr/share/fonts/X11/misc,
        built-ins
[    17.550] (==) ModulePath set to "/usr/lib/xorg/modules"
[    17.550] (II) The server relies on udev to provide the list of input devices.
        If no devices become available, reconfigure udev or disable AutoAddDevices.
[    17.550] (II) Loader magic: 0x556525b010
[    17.550] (II) Module ABI versions:
[    17.550]    X.Org ANSI C Emulation: 0.4
[    17.550]    X.Org Video Driver: 23.0
[    17.550]    X.Org XInput driver : 24.1
[    17.550]    X.Org Server Extension : 10.0
[    17.553] (--) using VT number 2

[    17.553] (II) systemd-logind: logind integration requires -keeptty and -keeptty was not provided, disabling logind integration
[    17.556] (II) xfree86: Adding drm device (/dev/dri/card1)
[    17.566] (II) xfree86: Adding drm device (/dev/dri/card0)
[    17.568] (II) no primary bus or device found
[    17.568]    falling back to /sys/devices/platform/soc/soc:gpu/drm/card1
[    17.568] (II) LoadModule: "glx"
[    17.649] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[    18.180] (II) Module glx: vendor="X.Org Foundation"
[    18.180]    compiled for 1.19.6, module version = 1.0.0
[    18.180]    ABI class: X.Org Server Extension, version 10.0
[    18.180] (==) Matched modesetting as autoconfigured driver 0
[    18.180] (==) Matched fbdev as autoconfigured driver 1
[    18.180] (==) Assigned the driver to the xf86ConfigLayout
[    18.180] (II) LoadModule: "modesetting"
[    18.212] (II) Loading /usr/lib/xorg/modules/drivers/modesetting_drv.so
[    18.222] (II) Module modesetting: vendor="X.Org Foundation"
[    18.222]    compiled for 1.19.6, module version = 1.19.6
[    18.222]    Module class: X.Org Video Driver
[    18.222]    ABI class: X.Org Video Driver, version 23.0
[    18.222] (II) LoadModule: "fbdev"
[    18.223] (II) Loading /usr/lib/xorg/modules/drivers/fbdev_drv.so
[    18.238] (II) Module fbdev: vendor="X.Org Foundation"
[    18.238]    compiled for 1.19.3, module version = 0.4.4
[    18.238]    Module class: X.Org Video Driver
[    18.238]    ABI class: X.Org Video Driver, version 23.0
[    18.238] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[    18.238] (II) FBDEV: driver for framebuffer: fbdev
[    18.298] (II) modeset(0): using drv /dev/dri/card1
[    18.332] (WW) Falling back to old probe method for fbdev
[    18.332] (II) Loading sub module "fbdevhw"
[    18.332] (II) LoadModule: "fbdevhw"
[    18.332] (II) Loading /usr/lib/xorg/modules/libfbdevhw.so
[    18.360] (II) Module fbdevhw: vendor="X.Org Foundation"
[    18.360]    compiled for 1.19.6, module version = 0.0.2
[    18.360]    ABI class: X.Org Video Driver, version 23.0
[    18.364] (II) modeset(0): Creating default Display subsection in Screen section
        "Default Screen Section" for depth/fbbpp 24/32
[    18.364] (==) modeset(0): Depth 24, (==) framebuffer bpp 32
[    18.364] (==) modeset(0): RGB weight 888
[    18.364] (==) modeset(0): Default visual is TrueColor
[    18.364] (II) Loading sub module "glamoregl"
[    18.364] (II) LoadModule: "glamoregl"
[    18.366] (II) Loading /usr/lib/xorg/modules/libglamoregl.so
[    18.462] (II) Module glamoregl: vendor="X.Org Foundation"
[    18.463]    compiled for 1.19.6, module version = 1.0.0
[    18.463]    ABI class: X.Org ANSI C Emulation, version 0.4
[    18.463] (II) glamor: OpenGL accelerated X.org driver based.
[    19.616] (II) glamor: EGL version 1.4:
[    19.670] (II) modeset(0): glamor initialized
[    19.671] (II) modeset(0): Output HDMI-1 has no monitor section
[    19.672] (II) modeset(0): EDID for output HDMI-1
[    19.672] (II) modeset(0): Printing probed modes for output HDMI-1
[    19.672] (II) modeset(0): Modeline "1024x768"x60.0   64.13  1024 1080 1184 1344  768 769 772 795 -hsync +vsync (47.7 kHz)
[    19.672] (II) modeset(0): Output HDMI-1 connected
[    19.672] (II) modeset(0): Using exact sizes for initial modes
[    19.672] (II) modeset(0): Output HDMI-1 using initial mode 1024x768 +0+0
[    19.672] (==) modeset(0): Using gamma correction (1.0, 1.0, 1.0)
[    19.672] (==) modeset(0): DPI set to (96, 96)
[    19.672] (II) Loading sub module "fb"
[    19.672] (II) LoadModule: "fb"
[    19.673] (II) Loading /usr/lib/xorg/modules/libfb.so
[    19.682] (II) Module fb: vendor="X.Org Foundation"
[    19.682]    compiled for 1.19.6, module version = 1.0.0
[    19.682]    ABI class: X.Org ANSI C Emulation, version 0.4
[    19.682] (II) UnloadModule: "fbdev"
[    19.682] (II) Unloading fbdev
[    19.682] (II) UnloadSubModule: "fbdevhw"
[    19.682] (II) Unloading fbdevhw
[    19.682] (==) Depth 24 pixmap format is 32 bpp
[    19.889] (==) modeset(0): Backing store enabled
[    19.889] (==) modeset(0): Silken mouse enabled
[    19.893] (II) modeset(0): RandR 1.2 enabled, ignore the following RandR disabled message.
[    20.000] (==) modeset(0): DPMS enabled
[    20.000] (II) modeset(0): [DRI2] Setup complete
[    20.000] (II) modeset(0): [DRI2]   DRI driver: vc4
[    20.000] (II) modeset(0): [DRI2]   VDPAU driver: vc4
[    20.000] (--) RandR disabled
[    20.012] (II) SELinux: Disabled on system
[    20.018] (II) AIGLX: enabled GLX_MESA_copy_sub_buffer
[    20.018] (II) AIGLX: enabled GLX_ARB_create_context
[    20.018] (II) AIGLX: enabled GLX_ARB_create_context_profile
[    20.018] (II) AIGLX: enabled GLX_EXT_create_context_es{,2}_profile
[    20.018] (II) AIGLX: enabled GLX_INTEL_swap_event
[    20.018] (II) AIGLX: enabled GLX_SGI_swap_control
[    20.018] (II) AIGLX: enabled GLX_EXT_framebuffer_sRGB
[    20.019] (II) AIGLX: enabled GLX_ARB_fbconfig_float
[    20.019] (II) AIGLX: enabled GLX_EXT_fbconfig_packed_float
[    20.019] (II) AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects
[    20.020] (II) AIGLX: Loaded and initialized vc4
[    20.021] (II) GLX: Initialized DRI2 GL provider for screen 0
[    20.031] (II) modeset(0): Damage tracking initialized
[    20.031] (II) modeset(0): Setting screen physical size to 270 x 203
[    20.442] (II) modeset(0): Disabling kernel dirty updates, not required.
[    20.583] (II) modeset(0): RandR 1.2 enabled, ignore the following RandR disabled message.
[    20.681] (==) modeset(0): DPMS enabled
[    20.681] (II) modeset(0): [DRI2] Setup complete
[    20.681] (II) modeset(0): [DRI2]   DRI driver: vc4
[    20.682] (II) modeset(0): [DRI2]   VDPAU driver: vc4
[    20.682] (--) RandR disabled
[    20.690] (II) SELinux: Disabled on system
[    20.696] (II) AIGLX: enabled GLX_MESA_copy_sub_buffer
[    20.696] (II) AIGLX: enabled GLX_ARB_create_context
[    20.696] (II) AIGLX: enabled GLX_ARB_create_context_profile
[    20.696] (II) AIGLX: enabled GLX_EXT_create_context_es{,2}_profile
[    20.696] (II) AIGLX: enabled GLX_INTEL_swap_event
[    20.696] (II) AIGLX: enabled GLX_SGI_swap_control
[    20.696] (II) AIGLX: enabled GLX_EXT_framebuffer_sRGB
[    20.696] (II) AIGLX: enabled GLX_ARB_fbconfig_float
[    20.696] (II) AIGLX: enabled GLX_EXT_fbconfig_packed_float
[    20.696] (II) AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects
[    20.698] (II) AIGLX: Loaded and initialized vc4
[    20.698] (II) GLX: Initialized DRI2 GL provider for screen 0
[    20.699] (II) modeset(0): Damage tracking initialized
[    20.699] (II) modeset(0): Setting screen physical size to 270 x 203
[    20.978] (II) modeset(0): RandR 1.2 enabled, ignore the following RandR disabled message.
[    21.064] (==) modeset(0): DPMS enabled
[    21.065] (II) modeset(0): [DRI2] Setup complete
[    21.065] (II) modeset(0): [DRI2]   DRI driver: vc4
[    21.065] (II) modeset(0): [DRI2]   VDPAU driver: vc4
[    21.065] (--) RandR disabled
[    21.073] (II) SELinux: Disabled on system
[    21.079] (II) AIGLX: enabled GLX_MESA_copy_sub_buffer
[    21.079] (II) AIGLX: enabled GLX_ARB_create_context
[    21.080] (II) AIGLX: enabled GLX_ARB_create_context_profile
[    21.080] (II) AIGLX: enabled GLX_EXT_create_context_es{,2}_profile
[    21.080] (II) AIGLX: enabled GLX_INTEL_swap_event
[    21.080] (II) AIGLX: enabled GLX_SGI_swap_control
[    21.080] (II) AIGLX: enabled GLX_EXT_framebuffer_sRGB
[    21.080] (II) AIGLX: enabled GLX_ARB_fbconfig_float
[    21.080] (II) AIGLX: enabled GLX_EXT_fbconfig_packed_float
[    21.080] (II) AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects
[    21.082] (II) AIGLX: Loaded and initialized vc4
[    21.082] (II) GLX: Initialized DRI2 GL provider for screen 0
[    21.082] (II) modeset(0): Damage tracking initialized
[    21.082] (II) modeset(0): Setting screen physical size to 270 x 203
[    21.363] (II) modeset(0): RandR 1.2 enabled, ignore the following RandR disabled message.
[    21.448] (==) modeset(0): DPMS enabled
[    21.448] (II) modeset(0): [DRI2] Setup complete
[    21.448] (II) modeset(0): [DRI2]   DRI driver: vc4
[    21.448] (II) modeset(0): [DRI2]   VDPAU driver: vc4
[    21.448] (--) RandR disabled
[    21.456] (II) SELinux: Disabled on system
[    21.462] (II) AIGLX: enabled GLX_MESA_copy_sub_buffer
[    21.462] (II) AIGLX: enabled GLX_ARB_create_context
[    21.462] (II) AIGLX: enabled GLX_ARB_create_context_profile
[    21.462] (II) AIGLX: enabled GLX_EXT_create_context_es{,2}_profile
[    21.462] (II) AIGLX: enabled GLX_INTEL_swap_event
[    21.463] (II) AIGLX: enabled GLX_SGI_swap_control
[    21.463] (II) AIGLX: enabled GLX_EXT_framebuffer_sRGB
[    21.463] (II) AIGLX: enabled GLX_ARB_fbconfig_float
[    21.463] (II) AIGLX: enabled GLX_EXT_fbconfig_packed_float
[    21.463] (II) AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects
[    21.464] (II) AIGLX: Loaded and initialized vc4
[    21.465] (II) GLX: Initialized DRI2 GL provider for screen 0
[    21.465] (II) modeset(0): Damage tracking initialized
[    21.465] (II) modeset(0): Setting screen physical size to 270 x 203
[    21.773] (II) modeset(0): RandR 1.2 enabled, ignore the following RandR disabled message.
[    21.864] (==) modeset(0): DPMS enabled
[    21.864] (II) modeset(0): [DRI2] Setup complete
[    21.864] (II) modeset(0): [DRI2]   DRI driver: vc4
[    21.864] (II) modeset(0): [DRI2]   VDPAU driver: vc4
[    21.864] (--) RandR disabled
[    21.873] (II) SELinux: Disabled on system
[    21.879] (II) AIGLX: enabled GLX_MESA_copy_sub_buffer
[    21.879] (II) AIGLX: enabled GLX_ARB_create_context
[    21.879] (II) AIGLX: enabled GLX_ARB_create_context_profile
[    21.879] (II) AIGLX: enabled GLX_EXT_create_context_es{,2}_profile
[    21.879] (II) AIGLX: enabled GLX_INTEL_swap_event
[    21.879] (II) AIGLX: enabled GLX_SGI_swap_control
[    21.879] (II) AIGLX: enabled GLX_EXT_framebuffer_sRGB
[    21.879] (II) AIGLX: enabled GLX_ARB_fbconfig_float
[    21.879] (II) AIGLX: enabled GLX_EXT_fbconfig_packed_float
[    21.879] (II) AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects
[    21.881] (II) AIGLX: Loaded and initialized vc4
[    21.881] (II) GLX: Initialized DRI2 GL provider for screen 0
[    21.882] (II) modeset(0): Damage tracking initialized
[    21.882] (II) modeset(0): Setting screen physical size to 270 x 203
[    22.161] (II) modeset(0): RandR 1.2 enabled, ignore the following RandR disabled message.
[    22.248] (==) modeset(0): DPMS enabled
[    22.248] (II) modeset(0): [DRI2] Setup complete
[    22.248] (II) modeset(0): [DRI2]   DRI driver: vc4
[    22.248] (II) modeset(0): [DRI2]   VDPAU driver: vc4
[    22.248] (--) RandR disabled
[    22.264] (II) SELinux: Disabled on system
[    22.270] (II) AIGLX: enabled GLX_MESA_copy_sub_buffer
[    22.270] (II) AIGLX: enabled GLX_ARB_create_context
[    22.270] (II) AIGLX: enabled GLX_ARB_create_context_profile
[    22.270] (II) AIGLX: enabled GLX_EXT_create_context_es{,2}_profile
[    22.270] (II) AIGLX: enabled GLX_INTEL_swap_event
[    22.270] (II) AIGLX: enabled GLX_SGI_swap_control
[    22.270] (II) AIGLX: enabled GLX_EXT_framebuffer_sRGB
[    22.270] (II) AIGLX: enabled GLX_ARB_fbconfig_float
[    22.270] (II) AIGLX: enabled GLX_EXT_fbconfig_packed_float
[    22.270] (II) AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects
[    22.272] (II) AIGLX: Loaded and initialized vc4
[    22.272] (II) GLX: Initialized DRI2 GL provider for screen 0
[    22.273] (II) modeset(0): Damage tracking initialized
[    22.273] (II) modeset(0): Setting screen physical size to 270 x 203
[    27.748] (II) modeset(0): Disabling kernel dirty updates, not required.

And so I’m wondering… is the VC4 driver here compiled for Pi 3 or 4?

Hello @ashmastaflash , could you please share the Dockerfile of the container running X11 ?

Hi @zvin, Here’s my Dockerfile:


FROM balenalib/raspberrypi4-64-ubuntu-python:3.7-bionic

ENV container docker
ENV DEBIAN_FRONTEND noninteractive
ENV DISPLAY ":0"
ENV DBUS_SYSTEM_BUS_ADDRESS "unix:path=/host/run/dbus/system_bus_socket"
ENV UDEV "1"
ENV URL "http://dashboard:5000"

COPY ./depends/os_packages /var/os_packages

RUN apt-get update && \
    apt-get dist-upgrade -y && \
    cat /var/os_packages | xargs apt-get install -y --no-install-recommends  && \
    rm -rf /var/lib/apt/lists/*

COPY ./config/xserverrc /etc/X11/xinit/xserverrc

RUN systemctl mask \
    dev-hugepages.mount \
    sys-fs-fuse-connections.mount \
    sys-kernel-config.mount \
    display-manager.service \
    getty@.service \
    systemd-logind.service \
    systemd-remount-fs.service \
    getty.target \
    graphical.target

RUN systemctl enable /lib/systemd/system/upower.service


COPY ./source/entrypoint.sh /usr/bin/entrypoint.sh
COPY ./config/balena.service /etc/systemd/system/balena.service

RUN systemctl enable /etc/systemd/system/balena.service

STOPSIGNAL 37

ENTRYPOINT ["/usr/bin/entrypoint.sh"]

RUN echo "export DISPLAY=:0" >> /root/.bashrc

# Move to app dir
WORKDIR /usr/src/app

# Move app to filesystem
COPY ./source/display.sh /usr/src/app/

ENV INITSYSTEM on

# Start app
CMD ["/usr/src/app/display.sh"]

And here are the packages that are being loaded via the os_packages file:

apt-utils
chromium-browser
curl
dbus
dbus-x11
fbset
feh
firefox
fonts-freefont-ttf
gtk3-engines-xfce
libcap-dev
libdbus-1-dev
libexpat-dev
libgtk-3-bin
libxss1
libxtst-dev
libxv1
lsb-release
matchbox-window-manager
mesa-utils
mesa-utils-extra
psmisc
systemd-sysv
upower
wget
x11-utils
x11-xserver-utils
xdg-utils
xfce4
xorg
xserver-xorg-core
xserver-xorg-input-all
xserver-xorg-legacy
xserver-xorg-video-fbdev
xserver-xorg-video-vesa

Thanks for taking a look!

@ashmastaflash could you please try running this https://github.com/balena-io-playground/x11-window-manager and check if the video output has issues?

And can you share your /mnt/boot/config.txt file. I think there was some overlay that needed enabling for the pi4 as well

Hi @zubairlk,

Here are the contents of the config.txt file:

arm_64bit=1
avoid_warnings=1
disable_splash=1
dtoverlay=vc4-fkms-v3d
dtparam=i2c_arm=on
dtparam=spi=on
dtparam=audio=on
gpu_mem=128
hdmi_force_hotplug=1

Hi @zvin I was able to get the project you referenced to work! I’ll begin adapting that to fit my application. Thanks a bunch for your help!

Hey, glad you sorted it :slight_smile:

Hey, I’m experiencing the same kind of problems. Do you have any tips how to overcome this issue?

Hey @Andreas.Andersson, what exactly are you experiencing? Can you share any of your project? Or have you give a try to the suggestions above, that seemed to have solved things for @ashmastaflash? Cheers!

Hi, I’m experiencing the same “tearing” when I’m starting my Electron Application. It’s built from the balena-electronjs project, but now running on a Raspberry Pi 4. The cursor is working fine, but the application itself is “tearing”. I can’t even get the original electronjs to work at this moment.

My guess is that there’s no GPU acceleration to Pi4 yet, which is likely the case. For the Pi4 you might want to try switching to a 32-bit base image as well. If you take https://github.com/balena-io/resin-electronjs and change the FROM lines %%BALENA_MACHINE_NAME%% to raspberrypi3 (even for the Pi4), can you try if it’s any better? There are 2 FROM lines, just to be clear. Maybe switching to 32-bit ARM image will unblock you. Let us know if you have tried.

1 Like

Hi @Andreas.Andersson the project mentioned above solved my problem, and gave me a starting point for porting my logic to a new, working base. In trying to troubleshoot, my code became overly complicated. I never spent the time to try to understand where mine went wrong- I just started again with the working project (https://github.com/balena-io-playground/x11-window-manager).

Hi, this works almost perfectly. The application is now rendering as normal. No more tearing. The only thing is that the USB-Devices are not recognized when running the raspberrypi3 image.

Hi @andreas-andersson it sounds like prehaps udev is not running in the container. could you ssh into the container and run udevadm trigger and see if that make the usb devices responsive

Hi @shaunmulligan , I ran the command and the output of lsusb and it still showing Bus 001 Device 011: ID 222a:0001 for every USB-device I connect.

if you run ps -aux in the container do you see the udev process running? Also could you try setting a device environment variable on the balenaCloud dashboard called UDEV with a value of 1. That should in theory make the udev run in the container and populate /dev correctly in the container. if thats not happening, then there is maybe a bug somewhere in the container entrypoint.

1 Like

The UDEV device environment variable works perfectly! Thanks alot!