embear-engineering / drm-framebuffer Goto Github PK
View Code? Open in Web Editor NEWA simple application which can be used to test a Linux DRM device
License: GNU General Public License v3.0
A simple application which can be used to test a Linux DRM device
License: GNU General Public License v3.0
.../home/drm-framebuffer # dd if=/dev/urandom | ./drm-framebuffer -d /dev/dri/card0 -c DSI-1
Could not get master role for DRM.
and How to use ffmpeg? To get image or videos off of a drm based device such as my phone
$ ./drm-framebuffer -d /dev/dri/by-path/platform-gpu-card -c HMDI-A-1
Could not find preferred resolution
when I use -r:
$ ./drm-framebuffer -d /dev/dri/by-path/platform-gpu-card -c HMDI-A-1 -r
1280x720
Hey there,
I ran into your code by chance, compiled it for my pi, it works great!
Reason why I'm here: I have 2 displays on a headless raspberry pi, I just couldn't get fbi to send its output to a specific drm connector, as both screens appear under the same framebuffer with the default raspberry pi driver. Your code did the trick.
I was thinking, wouldn't it be nice if drm-framebuffer could refresh the framebuffer as soon as a new image is passed to it? Right now it collects the framebuffer data, displays it, and then wait until it gets killed. I'll try to see if I can tweak your code and do a pull when I get a chance.
Thanks.
I had a crash in release_framebuffer() when I try to use an unconnected connector.
Using valgrind, I tracked it down to the use of uninitialized data. I will provide a pull-request with a simple fix.
$ valgrind ./drm-framebuffer -d /dev/dri/card0 -c HDMI-A-1
==51253== Memcheck, a memory error detector
==51253== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==51253== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==51253== Command: ./drm-framebuffer -d /dev/dri/card0 -c HDMI-A-1
==51253==
Could not find preferred resolution
==51253== Conditional jump or move depends on uninitialised value(s)
==51253== at 0x10AF0E: release_framebuffer (framebuffer.c:49)
==51253== by 0x10B523: get_framebuffer (framebuffer.c:189)
==51253== by 0x10AE84: main (main.c:276)
Does this require a specific version of the kernel? I'm trying to XCC but no luck so far.
make
aarch64-poky-linux-gcc -march=armv8-a+crc+crypto -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/fsl-imx-wayland/5.15-kirkstone/sysroots/armv8a-poky-linux -I "../opt/fsl-imx-wayland/5.15-kirkstone/sysroots/armv8a-poky-linux/usr/include/" -c main.c -O2 -pipe -g -feliminate-unused-debug-types
aarch64-poky-linux-gcc -march=armv8-a+crc+crypto -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/fsl-imx-wayland/5.15-kirkstone/sysroots/armv8a-poky-linux -O2 -pipe -g -feliminate-unused-debug-types -o drm-framebuffer -I "../opt/fsl-imx-wayland/5.15-kirkstone/sysroots/armv8a-poky-linux/usr/include/" main.o framebuffer.o -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-z,relro,-z,now
/opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: main.o: in functionfill_framebuffer_from_stdin': /home/serstech/drm-framebuffer/main.c:194: undefined reference to
drmSetMaster'
/opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/main.c:200: undefined reference todrmModeSetCrtc' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/main.c:201: undefined reference to
drmModeSetCrtc'
/opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/main.c:202: undefined reference todrmDropMaster' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: main.o: in function
get_resolution':
/home/serstech/drm-framebuffer/main.c:123: undefined reference todrmModeGetResources' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/main.c:134: undefined reference to
drmModeGetConnectorCurrent'
/opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/main.c:144: undefined reference todrmModeFreeConnector' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: main.o: in function
list_resources':
/home/serstech/drm-framebuffer/main.c:59: undefined reference todrmModeGetResources' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/main.c:71: undefined reference to
drmModeGetConnectorCurrent'
/opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/main.c:79: undefined reference todrmModeGetEncoder' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/main.c:85: undefined reference to
drmModeFreeEncoder'
/opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/main.c:86: undefined reference todrmModeFreeConnector' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/main.c:105: undefined reference to
drmModeFreeResources'
/opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: main.o: in functionget_resolution': /home/serstech/drm-framebuffer/main.c:170: undefined reference to
drmModeFreeConnector'
/opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/main.c:171: undefined reference todrmModeFreeResources' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: framebuffer.o: in function
release_framebuffer':
/home/serstech/drm-framebuffer/framebuffer.c:51: undefined reference todrmSetMaster' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:54: undefined reference to
drmModeSetCrtc'
/opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:55: undefined reference todrmModeFreeCrtc' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:61: undefined reference to
drmModeFreeConnector'
/opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:58: undefined reference todrmModeGetFB' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:58: undefined reference to
drmModeFreeFB'
/opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: framebuffer.o: in functionget_framebuffer': /home/serstech/drm-framebuffer/framebuffer.c:86: undefined reference to
drmModeGetResources'
/opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:97: undefined reference todrmModeGetConnectorCurrent' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:107: undefined reference to
drmModeFreeConnector'
/opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:141: undefined reference todrmModeAddFB' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:148: undefined reference to
drmModeGetEncoder'
/opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:156: undefined reference todrmModeGetCrtc' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:163: undefined reference to
drmIoctl'
/opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:177: undefined reference todrmDropMaster' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:186: undefined reference to
drmModeFreeEncoder'
/opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:186: undefined reference todrmModeFreeEncoder' /opt/fsl-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/11.2.0/real-ld: /home/serstech/drm-framebuffer/framebuffer.c:186: undefined reference to
drmModeFreeEncoder'
collect2: error: ld returned 1 exit status
make: *** [Makefile:14: all] Error 1
$ sudo ./drm-framebuffer -d /dev/dri/card0 -l
Could not get drm resources
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.