2 2
naseeb

HW acceleration through x server not working

Recommended Posts

I have Rockchip 3288 board.

 

As per the link: http://opensource.rock-chips.com/wiki_Graphics

Quote

Rockchip have a custom Xserver which have enable glamor 2D acceleration

 

I checked the log at /var/log/Xorg.0.log and found glamor initialization failed.  There is also log which says EGL_MESA_drm_image required, i checked x-server code and found this message lead to glamor initialization failed.

 

 

Apart from these when i run glxinfo, it shows 

Quote

name of display: :0.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_texture_from_pixmap, GLX_EXT_visual_info, 
    GLX_EXT_visual_rating, 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
client glx vendor string: Mesa Project and SGI
client glx version string: 1.4
client glx extensions:

 

It means direct rendering is enabled. But when i run glxgears it consumed almost 18% CPU( So i think glxgear is not able to use GPU and performing all tasks at CPU). 

 

What i am to do:

I have created a application which can decode H264 video using MPP and give me NV12 data, now i need to render this using hw( using opengl and xlib but not drm).

Problem with DRM is that it render data on full screen and hide everything.  I want to render through X-window and using GPU. 

 

I have done lot of R&D and strongly feel there must be rockchip specific driver(may be EGL layer) missing due to which opengl is not able to use DRI. I have searched rockchip-linux repository on github but nothing found there.

 

Kindly suggest how to use GPU for rendering NV12 data.

 

Edited by naseeb
submit by mistake

Share this post


Link to post
Share on other sites

Performance is same with es2gears too. 

I ran es2_info command, it showed

Quote

GL_RENDERER: llvmpipe (LLVM 6.0, 128 bits)

 

means Software rasterizer is used.  I did some homework and found that i need to replace mesa specific libGL, libEGL with rockchip specific version. Further i  searched and found that GL and EGL are implemented in userspace library libMali.so 

 

I downloaded libmali(libmali-midgard-t76x-r14p0-r1p0-x11-fbdev.so) from github: https://github.com/rockchip-linux/libmali/tree/29mirror/lib/arm-linux-gnueabihf 

 

Which all library should i softlink to this library? and I am not sure if Mali kernel driver is present in my image(i guess it is present as DRM is able to use GPU). I found that image i have is not module supported. All drivers are part of kernel itself.

I hope kernel has mali driver and if i get userspace layer ready, i will be able to use GPU.

 

If i miss any information which can help solving my issue, please let me know.

Share this post


Link to post
Share on other sites

I softlinked libmali-midgard-t76x-r14p0-r1p0-x11-fbdev.so to libGLESv2.so.2 and when ran es2gears found below error

 

Quote

file /dev/mali0 is not of a compatible version (user 10.6, kernel 10.4)
ERROR: The DDK is not compatible with any of the Mali GPUs on the system.
The DDK was built for 0x750 r1p0 status range [0..15], but none of the GPUs matched:
file /dev/mali0 is not of a compatible version (user 10.6, kernel 10.4)
EGLUT: failed to initialize EGL display

 

where to find compatible version of libmali ??

Share this post


Link to post
Share on other sites

I have also tried to install libmali-rk-midgard-t76x-r14p0-r0p0.deb package from repository https://github.com/rockchip-linux/rk-rootfs-build/tree/master/packages/armhf/libmali

When reboot the board, display manager doesn't start.

 

GPU Info:

Quote

ubuntu@localhost:~$ cd /sys/devices/platform/*.gpu
ubuntu@localhost:/sys/devices/platform/ffa30000.gpu$ cat gpuinfo
Mali-T76x MP4 r0p0 0x0750

 

for the same reason i am chosing r0p0 packages or .so file but NO luck.

Share this post


Link to post
Share on other sites

One more thing i found in dmesg:

 

Quote

[ 6.477477] I : [File] : drivers/gpu/arm/mali400/mali/linux/mali_kernel_linux.c; [Line] : 414; [Func] : mali_module_init(); svn_rev_string_from_arm of this mali_ko is '-c2c22e1', rk_ko_ver is '5', built at '17:51:36', on 'Sep 9 2017'.
[ 6.477763] Mali: Mali device driver loaded

 

How to find libmali.so compatible to rk_ko_ver '5'. 

I have searched a lot and have big hope from Rockchip forum and open community.

Share this post


Link to post
Share on other sites

I think the RK glamour xserver module has lead you down the wrong path. It has nothing to do with 3D acceleration and needs to be used with RKs customised xserver, it won’t work with a standard Ubuntu xserver. I would forget about glamour 2D acceleration, it doesn’t add much functionality and causes a lot of instability problems

 

Can you do an “armbianmonitor -u” and paste the output url?

 

You basically need to match the versions of kernel and userspace (libmali) code and make sure you have selected a version of libmali with the functionality you want. They don’t need to match exactly but be close enough the support the same function calls

 

If you look at older commits for the RK Mali repo you will be able to download an older version to match what I presume is your 4.4 kernel image. There is more info here 

 

Share this post


Link to post
Share on other sites
Quote

I think the RK glamour xserver module has lead you down the wrong path. It has nothing to do with 3D acceleration and needs to be used with RKs customised xserver, it won’t work with a standard Ubuntu xserver. I would forget about glamour 2D acceleration, it doesn’t add much functionality and causes a lot of instability problems

Oky. If i leave glamor then what is the other way, where i can open X11 window and render NV12 data over it using GPU.  I need to composite display buffer with many multimedia application's offscreen buffers. I think x-server and display manager will handle it at their level. And if i use DRM then i have to perform the composition(and first i need to learn it which i feel time consuming).  @botfap. Please suggest some solution here.

 

Quote

Can you do an “armbianmonitor -u” and paste the output url?

http://ix.io/1naH

 

Meantime i am checking old commit from RK Mali repo.

Share this post


Link to post
Share on other sites

This:

which comes from this: https://forum.armbian.com/topic/6506-tutorial-3d-video-acceleration-and-opencl-in-rk3288-boards-with-new-44-default-kernel/

 

can be useful to you. Using that script you get all the fancy things needed to enable glamor in X11 session (drivers, patches, and other things...)

It works only with Xenial and I'm not totally sure what it does under the hood, but surely it would be nice to have something which works out of the box.

By the way, glamor has poor performance for the 2D X server: general applications are quite slow to render, the terminal emulator is painfully slow when scrolling for example.

Nonetheless it enables hardware acceleration and those applications which can render in EGL surfaces themselves, like Chromium, or games or multimedia players works very well.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
2 2