问题描述:
使用的是友善之臂官网的 2017.11 uboot ,内核是LTS 5.15.101,参考了下面两个帖子的方法在内核进行了修改,但是无法在/dev设备列表下找到mali设备
https://whycan.com/t_3512.html
https://whycan.com/t_3675.html
gpu dts 配置:
mali: gpu@1c40000 {
compatible = "allwinner,sun8i-h3-mali", "arm,mali-400";
reg = <0x01c40000 0x10000>;
interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "gp",
"gpmmu",
"pp0",
"ppmmu0",
"pp1",
"ppmmu1",
"pmu";
clocks = <&ccu CLK_BUS_GPU>, <&ccu CLK_GPU>;
clock-names = "bus", "core";
resets = <&ccu RST_BUS_GPU>;
operating-points-v2 = <&gpu_opp_table>;
};
&mali {
status = "okay";
};
内核设置:
日志:内核已成功加载lima,但是没有结点
[ 1.148467] lima 1c40000.gpu: gp - mali400 version major 1 minor 1
[ 1.154737] lima 1c40000.gpu: pp0 - mali400 version major 1 minor 1
[ 1.161060] lima 1c40000.gpu: pp1 - mali400 version major 1 minor 1
[ 1.167372] lima 1c40000.gpu: l2 cache 64K, 4-way, 64byte cache line, 64bit external bus
[ 1.175964] lima 1c40000.gpu: bus rate = 200000000
[ 1.180788] lima 1c40000.gpu: mod rate = 297000000
[ 1.185695] lima 1c40000.gpu: dev_pm_opp_set_regulators: no regulator (mali) found: -19
[ 1.194149] lima 1c40000.gpu: Failed to register cooling device
[ 1.200472] [drm] Initialized lima 1.1.0 20191231 for 1c40000.gpu on minor 0
[ 1.215685] loop: module loaded
使用kmscube测试结果:找不到DRM
离线
后续:不知咋了,kmscube可以用了,但是还是没有mali结点。按照下面的全志官网链接进行用户端配置
https://linux-sunxi.org/Mali_binary_driver#Installing_the_UMP_.28Unified_Memory_Provider.29_userspace_library
https://linux-sunxi.org/Xorg
奇怪的是,这个只能在串口输入才有效果,在Xshell连接以太网输入则说找不到设备
串口端:
root@BIPLAB:~# kmscube
Using display 0x704aa8 with EGL version 1.4
===================================
EGL information:
version: "1.4"
vendor: "Mesa Project"
client extensions: "EGL_EXT_device_base EGL_EXT_device_enumeration EGL_EXT_device_query EGL_EXT_platform_base EGL_KHR_client_get_all_proc_addresses EGL_EXT_client_extensions EGL_KHR_debug EGL_EXT_platform_device EGL_EXT_platform_wayland EGL_KHR_platform_wayland EGL_EXT_platform_x11 EGL_KHR_platform_x11 EGL_EXT_platform_xcb EGL_MESA_platform_gbm EGL_KHR_platform_gbm EGL_MESA_platform_surfaceless"
display extensions: "EGL_ANDROID_blob_cache EGL_ANDROID_native_fence_sync 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_context_flush_control 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_partial_update 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 "
===================================
OpenGL ES 2.x information:
version: "OpenGL ES 2.0 Mesa 22.2.5"
shading language version: "OpenGL ES GLSL ES 1.0.16"
vendor: "lima"
renderer: "Mali400"
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_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_OES_get_program_binary GL_APPLE_texture_max_level GL_EXT_discard_framebuffer GL_EXT_read_format_bgra GL_NV_pack_subimage GL_EXT_frag_depth GL_NV_fbo_color_attachments GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_vertex_array_object GL_ANGLE_pack_reverse_row_order 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_NV_pixel_buffer_object 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_EXT_blend_func_extended GL_KHR_no_error GL_KHR_texture_compression_astc_sliced_3d GL_EXT_multisampled_render_to_texture GL_EXT_multisampled_render_to_texture2 GL_EXT_clip_control GL_KHR_parallel_shader_compile GL_MESA_bgra "
===================================
Rendered 91 frames in 2.030616 sec (44.813991 fps)
Rendered 178 frames in 4.043505 sec (44.021216 fps)
Rendered 270 frames in 6.074668 sec (44.446873 fps)
Rendered 358 frames in 8.090041 sec (44.251938 fps)
Rendered 444 frames in 10.102625 sec (43.948972 fps)
Rendered 536 frames in 12.133522 sec (44.175139 fps)
Rendered 625 frames in 14.149311 sec (44.171762 fps)
Rendered 715 frames in 16.178541 sec (44.194343 fps)
Xshell端连接网线:
h3_tinyscan@BIPLAB:~$ kmscube
no drm device found!
could not open drm device
failed to initialize legacy DRM
后面继续报错:
DRM_IOCTL_MODE_CREATE_DUMB failed: Cannot allocate memory
Segmentation fault
glmark2:
Error: main: Could not initialize canvas
glmark2-drm:
root@BIPLAB:/home/h3_tinyscan/glmark2/build/src# glmark2-drm
Warning: DRM_CAP_ASYNC_PAGE_FLIP not supported, falling back to 'mailbox' mode for SwapInterval(0).
DRM_IOCTL_MODE_CREATE_DUMB failed: Cannot allocate memory
Segmentation fault
和kmscube报一样的错误
离线
我又来更新了
找到问题,在设备树里面修改CMA大小,原来是64MB,改成128就可以成功运行了,参考下面几个连接。估计是因为使用2K屏的原因?
https://retropie.org.uk/forum/topic/24436/drm_ioctl_mode_create_dumb-failed-cannot-allocate-memory/18
https://community.toradex.com/t/problem-allocating-kms-memory-drm-ioctl-mode-create-dumb/16356
https://developer.toradex.com/software/linux-resources/linux-features/contiguous-memory-allocator-cma-linux/
https://blog.csdn.net/kickxxx/article/details/54631535
DTS设备树中的修改:
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;
cma: linux,cma {
compatible = "shared-dma-pool"; //采用DMA的方式使用预留的内存
reusable; //将预留的内存区域用作默认的CMA内存池
size = <0x8000000>;//128MB
alignment = <0x2000>;
linux,cma-default;
};
};
glmaek2成功跑分:
root@BIPLAB:/home/h3_tinyscan# glmark2-drm
Warning: DRM_CAP_ASYNC_PAGE_FLIP not supported, falling back to 'mailbox' mode for SwapInterval(0).
=======================================================
glmark2 2023.01
=======================================================
OpenGL Information
GL_VENDOR: lima
GL_RENDERER: Mali400
GL_VERSION: 2.1 Mesa 22.2.5
Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=24 stencil=0 samples=0
Surface Size: 1024x768 fullscreen
=======================================================
[build] use-vbo=false: FPS: 291 FrameTime: 3.445 ms
[build] use-vbo=true: FPS: 247 FrameTime: 4.050 ms
[texture] texture-filter=nearest: FPS: 254 FrameTime: 3.947 ms
[texture] texture-filter=linear: FPS: 249 FrameTime: 4.019 ms
[texture] texture-filter=mipmap: FPS: 264 FrameTime: 3.801 ms
[shading] shading=gouraud: FPS: 198 FrameTime: 5.063 ms
[shading] shading=blinn-phong-inf: FPS: 155 FrameTime: 6.455 ms
[shading] shading=phong: FPS: 124 FrameTime: 8.100 ms
[shading] shading=cel: FPS: 92 FrameTime: 10.918 ms
[bump] bump-render=high-poly: FPS: 91 FrameTime: 11.082 ms
[bump] bump-render=normals: FPS: 209 FrameTime: 4.806 ms
[bump] bump-render=height: FPS: 184 FrameTime: 5.458 ms
[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 59 FrameTime: 16.971 ms
[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 19 FrameTime: 55.230 ms
[pulsar] light=false:quads=5:texture=false: FPS: 320 FrameTime: 3.131 ms
[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 22 FrameTime: 47.367 ms
[desktop] effect=shadow:windows=4: FPS: 109 FrameTime: 9.239 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 38 FrameTime: 26.406 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 39 FrameTime: 26.286 ms
[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 58 FrameTime: 17.522 ms
[ideas] speed=duration: FPS: 89 FrameTime: 11.293 ms
[jellyfish] <default>: FPS: 67 FrameTime: 15.112 ms
Error: SceneTerrain requires Vertex Texture Fetch support, but GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS is 0
[terrain] <default>: Unsupported
[shadow] <default>: FPS: 71 FrameTime: 14.133 ms
[refract] <default>: FPS: 12 FrameTime: 88.318 ms
[conditionals] fragment-steps=0:vertex-steps=0: FPS: 229 FrameTime: 4.370 ms
[conditionals] fragment-steps=5:vertex-steps=0: FPS: 123 FrameTime: 8.144 ms
[conditionals] fragment-steps=0:vertex-steps=5: FPS: 216 FrameTime: 4.645 ms
[function] fragment-complexity=low:fragment-steps=5: FPS: 159 FrameTime: 6.315 ms
[function] fragment-complexity=medium:fragment-steps=5: FPS: 89 FrameTime: 11.242 ms
[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 155 FrameTime: 6.477 ms
[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 153 FrameTime: 6.567 ms
[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 65 FrameTime: 15.515 ms
=======================================================
glmark2 Score: 138
=======================================================
视频演示:
这里报两个错不知啥意思,后面再解决吧:
Warning: DRM_CAP_ASYNC_PAGE_FLIP not supported, falling back to 'mailbox' mode for SwapInterval(0).
Error: SceneTerrain requires Vertex Texture Fetch support, but GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS is 0
离线