New ofxAddon: ofxRPI4Window

Started a new addon to allow rendering with OF 0.11 without X on the RPI4

No Keyboard/Mouse support and only OpenGL ES 2 (haven’t tried 3 but the RPI4 supports it)

Contributors and testers welcome!

8 Likes

wow!! thank you for share!
I don’t even have rPi4 but can’t wait to test with this :slight_smile:

@jvcleave wow awesome.
Thats pretty huge?

Do you have a sense of how much is different from the current EGL Window approach?
( ie would it be minimal changes to get working? )

I haven’t tried integrating the manual mouse/keyboard stuff that ofAppEGLWindow uses but assuming that works I wouldn’t think it would be too difficult.

@theo if you take a look at it - most of the stuff lives in setup, draw and swapBuffers

Thanks for the pointers, @jvcleave I’ll take a look.
Awesome that you got this working!

Theo

Awesome work!

On a side note - would there be a reason why ofxOMXCamera / ofxOMXPlayer shouldn’t be integrated into OF main yet?

currently ofxOMXCamera / ofxOMXPlayer (texture mode anyway) are broken on the RPI4 as the OpenMax stuff no longer works with the new drivers

Hey @jvcleave

I was giving this a try with 0.11.0.
I believe I followed all the instructions correctly including commenting out those lines. Using GL driver with fake KMS and disabling GLFW in the config.

I get the window rect detected correctly but then get a failed to add service, perhaps it is already in use message.

I am not in X just in the CLI.

Did you see this error at all on your end?

you did the comment out ofSetupOpenGL part?

Thanks, I did yes!
I have fiddled with this Pi so much though, something could be weird.
I’ll try a clean install.

Thanks!

ok let me know. I did see that error but mostly when trying to use the OpenMax stuff.

I don’t think I changed anything in /boot/config.txt but here is mine just in case

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

[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
gpu_mem=256
start_x=1

thanks @jvcleave I did a fresh install and followed the instructions and it works great.
@mattc @steeley - take a look at this add-on if you want a WIP non-X solution for RPI4.

Thanks will give it a go. RPI4 has been a complete nightmare, even if you use a desktop install.

Sadly it doesn’t work here…
OF compiles ok but examples fail because RPI4Window.h can’t find gbm.h

Fixed - need to install libgbm-dev

I can get this to compile and run (only as sudo) but nothing appears. I’m running on a fresh install of raspberry pi os. Followed the instructions on the repository and installed libgbm-dev. Here’s the output (running as sudo followed by running not as sudo). Does anyone have any pointers to where I might be going wrong please?

VER ID IS 10
using newer build and GLFW window
[notice ] CTOR CALLED WITH settings
[notice ] currentWindowRect: 0, 0, 0, 3840, 2160
[verbose] ofShader: checkAndCreateProgram(): creating GLSL program
[verbose] ofShader: setupShaderFromSource(): GL_VERTEX_SHADER shader compiled
[verbose] ofShader: setupShaderFromSource(): GL_FRAGMENT_SHADER shader compiled
[verbose] ofShader: linkProgram(): attaching GL_FRAGMENT_SHADER shader to program 1
[verbose] ofShader: linkProgram(): attaching GL_VERTEX_SHADER shader to program 1
[verbose] ofShader: checkProgramLinkStatus(): program 1 linked
[notice ] -----EGL-----
[notice ] EGL_CLIENT_APIS = OpenGL OpenGL_ES 
[notice ] EGL_VENDOR = Mesa Project
[notice ] EGL_VERSION = 1.4
[notice ] EGL_EXTENSIONS = EGL_ANDROID_blob_cache EGL_EXT_buffer_age EGL_EXT_image_dma_buf_import EGL_EXT_image_dma_buf_import_modifiers EGL_KHR_cl_event2 EGL_KHR_config_attribs EGL_KHR_create_context EGL_KHR_create_context_no_error EGL_KHR_fence_sync EGL_KHR_get_all_proc_addresses EGL_KHR_gl_colorspace EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_no_config_context EGL_KHR_reusable_sync EGL_KHR_surfaceless_context EGL_EXT_pixel_format_float EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_drm_image EGL_MESA_image_dma_buf_export EGL_MESA_query_driver EGL_WL_bind_wayland_display 
[notice ] GL_SHADING_LANGUAGE_VERSION   = OpenGL ES GLSL ES 3.10
[notice ] GL_RENDERER = V3D 4.2
[notice ] GL_VERSION  = OpenGL ES 3.1 Mesa 19.3.2
[notice ] GL_VENDOR   = Broadcom
[notice ] -------------
[verbose] GL INFO
[verbose]   version: "OpenGL ES 3.1 Mesa 19.3.2"
[verbose]   shading language version: "OpenGL ES GLSL ES 3.10"
[verbose]   vendor: "Broadcom"
[verbose]   renderer: "V3D 4.2"
[verbose]   extensions: "GL_EXT_blend_minmax GL_EXT_multi_draw_arrays GL_EXT_texture_format_BGRA8888 GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth24 GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_mapbuffer GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_stencil8 GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float GL_EXT_texture_sRGB_decode GL_OES_EGL_image GL_OES_depth_texture GL_OES_packed_depth_stencil GL_EXT_texture_type_2_10_10_10_REV GL_OES_get_program_binary GL_APPLE_texture_max_level GL_EXT_discard_framebuffer GL_EXT_read_format_bgra GL_EXT_frag_depth GL_NV_fbo_color_attachments GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_vertex_array_object GL_EXT_occlusion_query_boolean GL_EXT_texture_rg GL_EXT_unpack_subimage GL_NV_draw_buffers GL_NV_read_buffer GL_NV_read_depth GL_NV_read_depth_stencil GL_NV_read_stencil GL_EXT_draw_buffers GL_EXT_map_buffer_range GL_KHR_debug GL_KHR_texture_compression_astc_ldr GL_OES_depth_texture_cube_map GL_OES_required_internalformat GL_OES_surfaceless_context GL_EXT_color_buffer_float GL_EXT_sRGB_write_control GL_EXT_separate_shader_objects GL_EXT_shader_implicit_conversions GL_EXT_shader_integer_mix GL_EXT_base_instance GL_EXT_compressed_ETC1_RGB8_sub_texture GL_EXT_draw_elements_base_vertex GL_EXT_primitive_bounding_box GL_EXT_shader_io_blocks GL_EXT_texture_border_clamp GL_EXT_texture_norm16 GL_KHR_context_flush_control GL_NV_image_formats GL_OES_draw_elements_base_vertex GL_OES_primitive_bounding_box GL_OES_shader_io_blocks GL_OES_texture_border_clamp GL_OES_texture_stencil8 GL_OES_texture_storage_multisample_2d_array GL_EXT_buffer_storage GL_EXT_float_blend GL_KHR_no_error GL_KHR_texture_compression_astc_sliced_3d GL_OES_EGL_image_external_essl3 GL_OES_shader_image_atomic GL_MESA_shader_integer_functions GL_KHR_parallel_shader_compile GL_MESA_framebuffer_flip_y GL_EXT_texture_query_lod "
[verbose] ===================================

[notice ] currentRes: 2
[verbose] ofShader: checkAndCreateProgram(): creating GLSL program
[verbose] ofShader: setupShaderFromSource(): GL_VERTEX_SHADER shader compiled
[verbose] ofShader: setupShaderFromSource(): GL_FRAGMENT_SHADER shader compiled
[verbose] ofShader: linkProgram(): attaching GL_FRAGMENT_SHADER shader to program 4
[verbose] ofShader: linkProgram(): attaching GL_VERTEX_SHADER shader to program 4
[verbose] ofShader: checkProgramLinkStatus(): program 4 linked
[verbose] ofShader: checkAndCreateProgram(): creating GLSL program
[verbose] ofShader: setupShaderFromSource(): GL_VERTEX_SHADER shader compiled
[verbose] ofShader: setupShaderFromSource(): GL_FRAGMENT_SHADER shader compiled
[verbose] ofShader: linkProgram(): attaching GL_FRAGMENT_SHADER shader to program 7
[verbose] ofShader: linkProgram(): attaching GL_VERTEX_SHADER shader to program 7
[verbose] ofShader: checkProgramLinkStatus(): program 7 linked
[verbose] ofShader: checkAndCreateProgram(): creating GLSL program
[verbose] ofShader: setupShaderFromSource(): GL_VERTEX_SHADER shader compiled
[verbose] ofShader: setupShaderFromSource(): GL_FRAGMENT_SHADER shader compiled
[verbose] ofShader: linkProgram(): attaching GL_FRAGMENT_SHADER shader to program 10
[verbose] ofShader: linkProgram(): attaching GL_VERTEX_SHADER shader to program 10
[verbose] ofShader: checkProgramLinkStatus(): program 10 linked
[verbose] ofShader: checkAndCreateProgram(): creating GLSL program
[verbose] ofShader: setupShaderFromSource(): GL_VERTEX_SHADER shader compiled
[verbose] ofShader: setupShaderFromSource(): GL_FRAGMENT_SHADER shader compiled
[verbose] ofShader: linkProgram(): attaching GL_FRAGMENT_SHADER shader to program 13
[verbose] ofShader: linkProgram(): attaching GL_VERTEX_SHADER shader to program 13
[verbose] ofShader: checkProgramLinkStatus(): program 13 linked
[notice ] currentRes: 3
^Cmake: *** [/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:191: RunRelease] Interrupt

if I don’t run it as sudo I get:

failed to export dumb buffer: Permission denied
Failed to create scanout resource
[notice ] eglSwapBuffers failed: EGL_BAD_ACCESS
Segmentation fault
make: *** [/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:191: RunRelease] Error 139

Did you disable X?