destroyedlolo Posted May 10, 2020 Posted May 10, 2020 Hello, I'm currently running Gentoo on my BananaPIs (M1). I'm using one as graphical Dashboard using DirectFB. Unfortunately, DirectFB is deprecated, not anymore supported and facing some compilation issue. Time to change. I tried with SDL configured with KMS but it's crashing. I don't want to install X because it will take ages to compile without any garanty it will work at the end. So ... probably the time to change. So, is DirectFB still supported on Armbian ? If not, is SDL2 working without X support. If not, with X support ? And if so, is X accelerated ? Thanks Laurent
UniformBuffer Posted May 10, 2020 Posted May 10, 2020 From what i know, SDL can render without X if during the compilation, you specify "--enable-video-kmsdrm" in the configuration process. This will build the drm-kms backend and make possible to run application directly on tty. From a little search on the net: https://discourse.libsdl.org/t/can-we-now-use-sdl2-without-x11/23421
destroyedlolo Posted May 10, 2020 Author Posted May 10, 2020 It's what I did after having activated Lima support in Messa. But the pb is ... it's crashing as explained above. The pb is not gentoo or not gentoo, it's the lack of support with SDL when you're not using X and more when it's not on Raspberry. It's why I'm looking if it will work w/o cheating with binary distribution.
@lex Posted May 10, 2020 Posted May 10, 2020 (edited) A tip that might help, try to run SDL2 without X window (not in a console inside X11, kill the desktop or don't run Desktop at all). Build latest SDL2-2.0.12 which has support for OpenGLES2 on GBM. ./configure --enable-video-kmsdrm --disable-video-x11 It works with panfrost and should work with lima as well. It is just crazy fast. ./testgles2 --geometry 1980x1080 INFO: Screen bpp: 32 INFO: INFO: Vendor : panfrost INFO: Renderer : panfrost INFO: Version : OpenGL ES 2.0 Mesa 20.0.0-devel (git-0eb78a078e) INFO: 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_stencil8 GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_float_linear GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float 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_required_internalformat GL_OES_surfaceless_context GL_EXT_separate_shader_objects GL_EXT_compressed_ETC1_RGB8_sub_texture GL_EXT_draw_elements_base_vertex GL_EXT_texture_border_clamp GL_KHR_context_flush_control GL_OES_draw_elements_base_vertex GL_OES_texture_border_clamp GL_KHR_no_error GL_KHR_texture_compression_astc_sliced_3d GL_KHR_parallel_shader_compile INFO: INFO: SDL_GL_RED_SIZE: requested 5, got 8 INFO: SDL_GL_GREEN_SIZE: requested 5, got 8 INFO: SDL_GL_BLUE_SIZE: requested 5, got 8 INFO: SDL_GL_DEPTH_SIZE: requested 16, got 24 ^CINFO: 505.45 frames per second info: ./testdisplayinfo INFO: Using video target 'KMSDRM'. INFO: See 1 displays. INFO: 0: "0" (1920x1080, (0, 0)), 12 modes. ERROR: DPI: failed to query (That operation is not supported) INFO: CURRENT: fmt=SDL_PIXELFORMAT_ARGB8888 w=1920 h=1080 refresh=60 INFO: DESKTOP: fmt=SDL_PIXELFORMAT_ARGB8888 w=1920 h=1080 refresh=60 INFO: MODE 0: fmt=SDL_PIXELFORMAT_ARGB8888 w=1920 h=1080 refresh=60 INFO: MODE 1: fmt=SDL_PIXELFORMAT_ARGB8888 w=1920 h=1080 refresh=50 INFO: MODE 2: fmt=SDL_PIXELFORMAT_ARGB8888 w=1920 h=1080 refresh=30 INFO: MODE 3: fmt=SDL_PIXELFORMAT_ARGB8888 w=1920 h=1080 refresh=25 INFO: MODE 4: fmt=SDL_PIXELFORMAT_ARGB8888 w=1920 h=1080 refresh=24 INFO: MODE 5: fmt=SDL_PIXELFORMAT_ARGB8888 w=1280 h=1024 refresh=60 INFO: MODE 6: fmt=SDL_PIXELFORMAT_ARGB8888 w=1280 h=720 refresh=60 INFO: MODE 7: fmt=SDL_PIXELFORMAT_ARGB8888 w=1280 h=720 refresh=50 INFO: MODE 8: fmt=SDL_PIXELFORMAT_ARGB8888 w=1024 h=768 refresh=60 INFO: MODE 9: fmt=SDL_PIXELFORMAT_ARGB8888 w=800 h=600 refresh=60 INFO: MODE 10: fmt=SDL_PIXELFORMAT_ARGB8888 w=720 h=576 refresh=50 INFO: MODE 11: fmt=SDL_PIXELFORMAT_ARGB8888 w=720 h=480 refresh=60 INFO: Using vsync ./testgles --geometry 1980x1080 --vsync INFO: Screen bpp: 32 INFO: INFO: Vendor : panfrost INFO: Renderer : panfrost INFO: Version : OpenGL ES-CM 1.1 Mesa 20.0.0-devel (git-0eb78a078e) INFO: Extensions : GL_EXT_blend_minmax GL_EXT_multi_draw_arrays GL_EXT_texture_lod_bias GL_OES_byte_coordinates GL_OES_fixed_point GL_OES_stencil_wrap GL_OES_compressed_paletted_texture GL_OES_query_matrix GL_OES_read_format GL_OES_single_precision GL_OES_draw_texture GL_OES_point_size_array GL_OES_point_sprite 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_framebuffer_object GL_OES_mapbuffer GL_OES_rgb8_rgba8 GL_OES_stencil8 GL_OES_texture_env_crossbar GL_OES_texture_mirrored_repeat GL_OES_texture_npot GL_OES_EGL_image GL_OES_packed_depth_stencil GL_OES_texture_cube_map GL_APPLE_texture_max_level GL_EXT_discard_framebuffer GL_EXT_read_format_bgra GL_OES_blend_equation_separate GL_OES_blend_func_separate GL_OES_blend_subtract GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_vertex_array_object GL_EXT_map_buffer_range GL_KHR_debug GL_OES_required_internalformat GL_OES_surfaceless_context GL_EXT_compressed_ETC1_RGB8_sub_texture GL_KHR_no_error INFO: INFO: SDL_GL_RED_SIZE: requested 5, got 8 INFO: SDL_GL_GREEN_SIZE: requested 5, got 8 INFO: SDL_GL_BLUE_SIZE: requested 5, got 8 INFO: SDL_GL_DEPTH_SIZE: requested 16, got 24 ^CINFO: 60.05 frames per second Edited May 10, 2020 by @lex info + vsync
destroyedlolo Posted May 10, 2020 Author Posted May 10, 2020 X is not launched at all (as not installed ). You did your test on ARMbian only compiling SDL2 ? I think I found a solution using direct DRM/KMS + Cairo. But of it don't suite my need, I'll try ARMbian if you confime.
@lex Posted May 10, 2020 Posted May 10, 2020 The test was conducted on a NanoPi M4 with a full Mesa and SDL2 stack rebuilt from git in a non Armbian kernel. Armbian has better support for lima, but not sure if panfrost is in a better state than lima. You can get some ideas from here: https://forum.clockworkpi.com/t/help-with-mesa-lima-compilation-retroarch-freezing-screen-when-loading-a-saved-state/5228 Can you run: ./testgles2 --info all
jock Posted May 10, 2020 Posted May 10, 2020 I tried Lima on a rockchip based device with mesa coming with Ubuntu Focal but in X11. Indeed it was running, not plenty fast and yet with some graphical issues, but it works. I guess compiling latest mesa from sources may just make things better. Also Lima is currently used in development Libreelec (so no X11) with awesome results.
@lex Posted May 11, 2020 Posted May 11, 2020 4 hours ago, ning said: No one mentions Wayland? I can't remember if i enabled wayland anywhere during the mesa build but SDL2 tells me: INFO: Built-in video drivers: wayland, KMSDRM, dummy INFO: Video driver: KMSDRM but SDL2 assume this: --enable-video-wayland use Wayland video driver [[default=yes]]
Myy Posted May 12, 2020 Posted May 12, 2020 Just in case, I have a very small example that uses DRM and OpenGL ES : https://gist.github.com/Miouyouyou/89e9fe56a2c59bce7d4a18a858f389ef You'll have to compile it like this : gcc -o drmgl Linux_DRM_OpenGLES.c `pkg-config --cflags --libs libdrm` -lgbm -lEGL -lGLESv2 This will only throw a glClearColor on the screen, with a blueish tone. You might want to try it, if you want to check for DRM/KMS capabilities on your hardware. Note that if you have multiple /dev/dri/cardX nodes, you'll have to edit the source code accordingly : https://gist.github.com/Miouyouyou/89e9fe56a2c59bce7d4a18a858f389ef#file-linux_drm_opengles-c-L129 If your system crashes with KMS/DRM, could you try to get some logs from a serial console ?
destroyedlolo Posted May 12, 2020 Author Posted May 12, 2020 I found a good tutorial about low level programming on DRM/KMS. The only need is libdrm : working pretty well so I give up with DirectFB / SDL2. My only concerne is I'm not able to make LeMaker 3.5' LCD with 5.x kernel but it's another subject. THanks Laurent
Recommended Posts