Hello,
I have made some experimental implementations to get resources by using DRM_IOCTL_MODE_GETRESOURCES ioctl call from kernel drm api in order to get frame buffer by using /dev/dri/card1 which requires mode setting option.In order to activate modesetting, I did followings:
1-sudo nano /etc/modprobe.d/zz-nvidia-modeset.conf
2-Added line : options nvidia_384_drm modeset=1
3-sudo update-initramfs -u
4-Reboot the PC.
5-After rebootof PC, I checked modesetting from command :sudo cat /sys/module/nvidia_drm/parameters/modeset and output is Y.
For nvidia-drm if I do not set modesetting to 1, I got invalid argument error while requesting DRM_IOCTL_MODE_GETRESOURCES ioctl .If I set modesetting option to 1 then I get invalid argument error while opening /dev/dri/card1. Do you have any idea what to check since I struggled with that errors?
Please see some details for debugging purposes:
lsmod | grep nvidia
nvidia_uvm 671744 0
nvidia_drm 45056 3
nvidia_modeset 860160 12 nvidia_drm
nvidia 13160448 990 nvidia_uvm,nvidia_modeset
drm_kms_helper 172032 2 nvidia_drm,i915
drm 401408 6 drm_kms_helper,nvidia_drm,i915
lspci | grep -i nvidia
01:00.0 VGA compatible controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Mobile] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GP107GL High Definition Audio Controller (rev a1)
ls -la /sys/class/drm/
total 0
drwxr-xr-x 2 root root 0 Kas 30 07:52 .
drwxr-xr-x 71 root root 0 Kas 30 11:27 …
lrwxrwxrwx 1 root root 0 Kas 30 07:52 card0 → …/…/devices/pci0000:00/0000:00:02.0/drm/card0
lrwxrwxrwx 1 root root 0 Kas 30 07:52 card0-DP-1 → …/…/devices/pci0000:00/0000:00:02.0/drm/card0/card0-DP-1
lrwxrwxrwx 1 root root 0 Kas 30 07:52 card0-eDP-1 → …/…/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1
lrwxrwxrwx 1 root root 0 Kas 30 07:52 card0-HDMI-A-1 → …/…/devices/pci0000:00/0000:00:02.0/drm/card0/card0-HDMI-A-1
lrwxrwxrwx 1 root root 0 Kas 30 07:52 card1 → …/…/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1
lrwxrwxrwx 1 root root 0 Kas 30 07:52 card1-HDMI-A-2 → …/…/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1/card1-HDMI-A-2
lrwxrwxrwx 1 root root 0 Kas 30 07:52 renderD128 → …/…/devices/pci0000:00/0000:00:02.0/drm/renderD128
lrwxrwxrwx 1 root root 0 Kas 30 07:52 renderD129 → …/…/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/renderD129
-r–r–r-- 1 root root 4096 Kas 30 07:52 version
cat /etc/X11/xorg.conf
Section “ServerLayout”
Identifier “layout”
Screen 0 “nvidia”
Inactive “intel”
EndSection
Section “Device”
Identifier “intel”
Driver “modesetting”
BusID “PCI:0@0:2:0”
Option “AccelMethod” “None”
EndSection
Section “Screen”
Identifier “intel”
Device “intel”
EndSection
Section “Device”
Identifier “nvidia”
Driver “nvidia”
BusID “PCI:1@0:0:0”
Option “ConstrainCursor” “off”
EndSection
Section “Screen”
Identifier “nvidia”
Device “nvidia”
Option “AllowEmptyInitialConfiguration” “on”
Option “IgnoreDisplayDevices” “CRT”
EndSection
uname -r
4.15.0-123-generic
nvidia-smi
Mon Nov 30 12:17:31 2020
±----------------------------------------------------------------------------+
| NVIDIA-SMI 384.130 Driver Version: 384.130 |
|-------------------------------±---------------------±---------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 1050 Off | 00000000:01:00.0 Off | N/A |
| N/A 55C P3 N/A / N/A | 544MiB / 4038MiB | 0% Default |
±------------------------------±---------------------±---------------------+
±----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 1436 G /usr/lib/xorg/Xorg 264MiB |
| 0 3098 G compiz 159MiB |
| 0 3331 G …AAAAAAAAAAAAAAgAAAAAAAAA --shared-files 46MiB |
| 0 3423 G …quest-channel-token=8449538418699101532 61MiB |
| 0 3924 G /usr/lib/firefox/firefox 1MiB |
| 0 4802 G /usr/lib/firefox/firefox 1MiB |
| 0 5248 G /usr/lib/firefox/firefox 1MiB |
| 0 5805 G /usr/lib/firefox/firefox 1MiB |
| 0 5849 G /usr/lib/firefox/firefox 1MiB |
| 0 6024 G /usr/lib/firefox/firefox 1MiB |
±----------------------------------------------------------------------------+
cat /etc/modprobe.d/blacklist.conf
This file lists those modules which we don’t want to be loaded by
alias expansion, usually so some other driver will be loaded for the
device instead.
evbug is a debug tool that should be loaded explicitly
blacklist evbug
these drivers are very simple, the HID drivers are usually preferred
blacklist usbmouse
blacklist usbkbd
replaced by e100
blacklist eepro100
replaced by tulip
blacklist de4x5
causes no end of confusion by creating unexpected network interfaces
blacklist eth1394
snd_intel8x0m can interfere with snd_intel8x0, doesn’t seem to support much
hardware on its own (Ubuntu bug #2011, #6810)
blacklist snd_intel8x0m
Conflicts with dvb driver (which is better for handling this device)
blacklist snd_aw2
Causes trackpads to stop working on Lenovo 11e 2nd gen (Ubuntu: #1802135)
and Lenovo x240 to hang on boot (Ubuntu: #1802689)
blacklist i2c_i801
replaced by p54pci
blacklist prism54
replaced by b43 and ssb.
blacklist bcm43xx
most apps now use garmin usb driver directly (Ubuntu: #114565)
blacklist garmin_gps
replaced by asus-laptop (Ubuntu: #184721)
blacklist asus_acpi
low-quality, just noise when being used for sound playback, causes
hangs at desktop session start (Ubuntu: #246969)
blacklist snd_pcsp
ugly and loud noise, getting on everyone’s nerves; this should be done by a
nice pulseaudio bing (Ubuntu: #77010)
blacklist pcspkr
EDAC driver for amd76x clashes with the agp driver preventing the aperture
from being initialised (Ubuntu: #297750). Blacklist so that the driver
continues to build and is installable for the few cases where its
really needed.
blacklist amd76x_edac
There is also /dev/dri/renderdx which does not require any modeseting permissions but has limited options.so Is there a way to copy frame buffer of an application by using render nodes ?
Best Regards