4

The title already implies the question, so what is blocking the execution from the sample program in this repo https://github.com/dvdhrm/docs/tree/master/drm-howto

It's a simple program showing KMS in action, so I downloaded it, compiled it and gave it a run. This was the output:

michael@lord:~/Downloads/docs/drm-howto$ sudo ./modeset
[sudo] password for michael: 
using card '/dev/dri/card0'
mode for connector 59 is 1920x1080
ignoring unused connector 68
ignoring unused connector 71
ignoring unused connector 75
cannot set CRTC for connector 59 (13): Permission denied
exiting

Also note that I have a running X11 session on my machine. It seems X is already using the device /dev/dri/card0 and blocks it for all other programs.

Here is my video card:

michael@lord:~/Downloads/docs/drm-howto$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 620 (rev 07)

I have also added i915.modeset=1 into /etc/initramfs-tools/modules and rebuilt it with sudo update-initramfs -u so it loads the driver from inside my kernel and not from the xorg side.

There is also the possibility that my driver doesn't support KMS but lspci has shown that I only have an internal intel graphics card installed. So I sticked with the xorg core display driver package which is installed by default from xserver-xorg-core.

None of these changes have taken affect. The only way I can execute those examples is by killing the xorg session and let it run in tty.

Any ideas?

Jani
  • 853
  • 8
  • 20
Michael
  • 177
  • 2
  • 15

2 Answers2

4

It works as expected. Only DRM-Master is allowed to do modesetting, and there can only be one DRM-Master. X is already master.

You can become master using drmSetMaster() or implicitly by opening the the primary device node when there is no current master. (The example code becomes DRM-Master implicitly.)

See also the drm-kms(7) man page.

Jani
  • 853
  • 8
  • 20
1

To execute any modeset application first disable the display server by

sudo systemctl stop gdm3

sudo systemctl stop lightdm

switch to command line through eighter CTL + ALT + F1, CTL + ALT + F2, CTL + ALT + F3

and execute $ sudo ./modeset

Akash Gajjar
  • 94
  • 2
  • 8
  • In fact I just used `CTL + ALT + F2` and then ran the demo, it worked even without `sudo`. One thing is that it took me 10 seconds to switch back to X after the demo completed. – exebook Feb 25 '23 at 20:01