headless GBM

本文介绍了一种在Linux环境下使用OpenGLContext进行绘图的方法,通过直接渲染接口(DRI)和通用缓冲区管理器(gbm)创建绘图上下文。文章深入探讨了利用dma_buf进行纹理导入的技术细节,提供了多个参考资料链接,涵盖从基础概念到具体实现案例的广泛内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

  通过下面的代码  建立了一个OpenGL Context,可以绘图

int fd;
fd = open("/dev/dri/card0", O_RDWR);
struct gbm_device *gbm;
gbm = gbm_create_device(fd);
EGLDisplay dpy;
dpy = eglGetDisplay(gbm);
EGLContext ctx;
eglBindAPI(EGL_OPENGL_API);
ctx = eglCreateContext(dpy, NULL, EGL_NO_CONTEXT, NULL);
eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, ctx);

参考资料中不是headless,依赖于modeset及其connector资源。 

后续主要搜集 dma_buf

参考资料

http://virtuousgeek.org/blog/index.php/jbarnes/2011/10/31/writing_stanalone_programs_with_egl_and_

https://patchwork.kernel.org/patch/8348041/  qemu的补丁,通过dma_buf  import  texture

https://blogs.igalia.com/elima/tag/gpu/

https://elinux.org/images/a/a8/DMA_Buffer_Sharing-_An_Introduction.pdf

https://github.com/wayland-project/weston/blob/master/clients/simple-dmabuf-egl.c

https://gstreamer.freedesktop.org/data/events/gstreamer-conference/2012/omap-dmabuf-gstcon2012.pdf

 

[root@iZbp11irq8z6b1plo30y63Z trunk]# ffplay rtmp://121.43.231.156:1936/live/livestream ffplay version 3.4.13 Copyright (c) 2003-2023 the FFmpeg developers built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-44) configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --extra-ldflags='-Wl,-z,relro ' --extra-cflags=' ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-fontconfig --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcdio --enable-libdrm --enable-indev=jack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libopus --disable-encoder=libopus --enable-libpulse --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzvbi --enable-avfilter --enable-avresample --enable-libmodplug --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-libmfx --enable-runtime-cpudetect libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 pci id for fd 4: 1013:00b8, driver (null) gbm: failed to open any driver (search paths /usr/lib64/dri) gbm: Last dlopen error: /usr/lib64/dri/kms_swrast_dri.so: cannot open shared object file: No such file or directory failed to load driver: kms_swrast gbm: failed to open any driver (search paths /usr/lib64/dri) gbm: Last dlopen error: /usr/lib64/dri/swrast_dri.so: cannot open shared object file: No such file or directory failed to load swrast driver Could not initialize SDL - displayIndex must be in the range 0 - -1 (Did you set the DISPLAY variable?) [root@iZbp11irq8z6b1plo30y63Z trunk]# 什么意思?
最新发布
03-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

proware

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值