dvdhrm / docs Goto Github PK
View Code? Open in Web Editor NEWAPI Documentations, HowTos and Tutorials
API Documentations, HowTos and Tutorials
Hi,
I'm trying to handle hot unplug of a display properly.
I hooked up a udev rule that fires on plug/unplug that is initially working fine. However after the first unplug that is handled, udev stops generating drm events. This makes me think I didn't close / free something when handling the unplug.
That is on Intel Gen 11 integrated graphics. Some code works fine on AMD Ryzen.
thx
Hi,
DRM how to enable the alpha channel?
In my work, I will take the UI which is build on Qt5 QML with eglfs_kms_egldevice plugin onto the video .
And the UI background should be transparent.
When I set the color transparent in the UI , the UI background will be white on the screen.
so ,I think is it passible to enable the alpha channel with DRM/KMS cmd ?
Hi @dvdhrm,
This project was my life saver when I started my gbm project. Would you happen to have plan to catch up latest atomic mode setting API. drmModeAtomicCommit
Best, DS
The compiler executes on the virtual machine (vmware ubuntu 18.04), but only the first color is displayed and no more changes .
In modeset.c example, the process finally draw with random color in RGB domain. Can we configure plane to accept YUV domain for rendering? I have a YUV sample image for rendering but I don't have any transforming process to avoid distortion.
Worked on x86_64 however.
This is the precise setups: https://github.com/************/linux-kernel-module-cheat/tree/a64b276e9c02719a3e620c75aaa1ec490b240851#drm
I have copoied modeset.c in that repo in tree: https://github.com/************/linux-kernel-module-cheat/blob/16de55dd2f89ae44c1ee0fee1c39d23ee2b36b13/kernel_module/user/libdrm_modeset.c at revision: fad7c32
kmscube however worked fine for both x86_64 and aarch64, so maybe it is a bug here?
I am new to DRM programming, this is an excellent example. Unfortunately, I could not get it work under zcu102 platform.
ret = drmModeSetCrtc(fd, iter->crtc, iter->fb, 0, 0,
&iter->conn, 1, &iter->mode);
if (ret)
fprintf(stderr, "cannot set CRTC for connector %u (%d): %m\n",
iter->conn, errno);
here ret
is -22, it means "invalid argument".
I spent some time to investigate, by comparing it with modetest.c
in libdrm, I modify the following lines, it works. But I don't know exactly why.
diff --git a/drm-howto/modeset.c b/drm-howto/modeset.c
index d2e56aa..58b2db5 100644
--- a/drm-howto/modeset.c
+++ b/drm-howto/modeset.c
@@ -447,7 +447,7 @@ static int modeset_create_fb(int fd, struct modeset_dev *dev)
memset(&creq, 0, sizeof(creq));
creq.width = dev->width;
creq.height = dev->height;
- creq.bpp = 32;
+ creq.bpp = 24;
ret = drmIoctl(fd, DRM_IOCTL_MODE_CREATE_DUMB, &creq);
if (ret < 0) {
fprintf(stderr, "cannot create dumb buffer (%d): %m\n",
@@ -459,7 +459,7 @@ static int modeset_create_fb(int fd, struct modeset_dev *dev)
dev->handle = creq.handle;
/* create framebuffer object for the dumb-buffer */
- ret = drmModeAddFB(fd, dev->width, dev->height, 24, 32, dev->stride,
+ ret = drmModeAddFB(fd, dev->width, dev->height, 24, 24, dev->stride,
dev->handle, &dev->fb);
if (ret) {
fprintf(stderr, "cannot create framebuffer (%d): %m\n",
@@ -630,6 +630,10 @@ static uint8_t next_color(bool *up, uint8_t cur, unsigned int mod)
* beyond the scope of this document.
*/
+struct color_rgb24 {
+ unsigned int value:24;
+} __attribute__((__packed__));
+
static void modeset_draw(void)
{
uint8_t r, g, b;
@@ -651,9 +655,9 @@ static void modeset_draw(void)
for (iter = modeset_list; iter; iter = iter->next) {
for (j = 0; j < iter->height; ++j) {
for (k = 0; k < iter->width; ++k) {
- off = iter->stride * j + k * 4;
- *(uint32_t*)&iter->map[off] =
- (r << 16) | (g << 8) | b;
+ off = iter->stride * j + k * 3;
+ ((struct color_rgb24 *)&iter->map[off])
+ ->value = (r << 16) | (g << 8) | b;
}
}
}
Hey @dvdhrm,
I'm try to run this amazing project and my output is :
root@MY-VirtualBox:/home/MY/Desktop/docs-master/drm-howto# ./modeset-vsyncusing card '/dev/dri/card0'
mode for connector 26 is 1920x1080
cannot set CRTC for connector 26 (13): Permission denied
cannot flip CRTC for connector 26 (13): Permission denied
wait for pending page-flip to complete...
exiting
I wonder if there is a way to make it work on the new screens we have today ( not only on CRTC ).
Thank you for sharing your knowledge!
hi, I'm encountering cannot set CRTC for connector 71 (13): Permission denied, I'm trying to use drmSetMaster to gain control over the hw, but this call remain gives me permission denied error. what could be the problem? Thank you in advance!
I'm using the drmModeAddFB() call which requests to add the framebuffer using RGB as the default pixel format, which for some displays seem to be wrong (red and blue are inverted because of the display using BGR colorspace).
Can the correct display colorspace be detected in some way?
IIRC the encoder should take care of adapting the pixel data properly, but for some reason that doesn't happen here...
Thanks to these example programs I have been able to add a simple DRM driver to my small 2D graphics library MGRX and it works. But the examples assume a 32 bit XRGB color format instead of searching for supported color formats, indeed there is another issue here that was resolved changing the color format to a 24 or 16 bit format. Is there a way to pre-know the supported color formats for every mode?
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.