Page MenuHomeFreeBSD

linsysfs: add drm render node
Needs ReviewPublic

Authored by val_packett.cool on Oct 18 2020, 2:34 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 5, 9:05 AM
Unknown Object (File)
Tue, Oct 29, 12:14 AM
Unknown Object (File)
Thu, Oct 17, 3:15 AM
Unknown Object (File)
Oct 2 2024, 6:00 AM
Unknown Object (File)
Sep 24 2024, 8:49 AM
Unknown Object (File)
Sep 24 2024, 4:24 AM
Unknown Object (File)
Sep 8 2024, 1:09 AM
Unknown Object (File)
Aug 21 2024, 7:56 AM

Details

Summary

Running glxgears (from linux-c7-*) against xwayland on amdgpu without disabling dri3 results in Mesa failing to look up device info, because it needs render node info:

stat("/sys/dev/char/226:128/device/drm", 0x7fffffffbfb0) = -1 ENOENT (No such file or directory)

This patch adds this directory.

While here, also s/dri_minor/drm_minor/, because the former seems like a typo, just compare the search results:
https://www.google.com/search?hl=en&q=%22DEVTYPE%3Ddri_minor%22
https://www.google.com/search?hl=en&q=%22DEVTYPE%3Ddrm_minor%22

Sponsored by: https://www.patreon.com/valpackett

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 49537
Build 46427: arc lint + arc unit

Event Timeline

trasz added inline comments.
sys/compat/linsysfs/linsysfs.c
565

I wonder if this hardcoded "226" could be replaced with a call to linux_driver_get_major_minor(), to make it more evident where it came from?

Otherwise looks good to me, although I have no way to test it (unless it can change things for Intel?)

sys/compat/linsysfs/linsysfs.c
565

Which GPU shouldn't really matter, I don't think..?

In https://github.com/FreeBSDDesktop/kms-drm/issues/248 you mentioned that you don't get the handle_to_fd error. Please post the strace of glxgears.

sys/compat/linsysfs/linsysfs.c
565

Here it is: https://gist.github.com/trasz/ed3ec17ea445d1d92f05aa87344f359e. It's run from a Linux chroot.

Ping?

Is there anything here that needs changing?

I don't really want to unhardcode the major number, it's simpler that way, it's already been there (MAJOR=226)

So, first of all: I have nothing against hardcoding the "226"; if the patch fixes things for you, please commit it.

The only (non) issue I might have is that I don't understand what it does. You've said it fixes the CentOS 7 glxgears from ports on Radeon; the same glxgears worked for me last time I've checked, and one difference is that I'm using integrated Intel graphics.

The only (non) issue I might have is that I don't understand what it does. You've said it fixes the CentOS 7 glxgears from ports on Radeon; the same glxgears worked for me last time I've checked, and one difference is that I'm using integrated Intel graphics.

Are you testing with Xorg on hardware? I'm testing with xwayland. It seems like on xorg a fallback from the render node to the card node is possible, this is from your trace:

stat("/sys/dev/char/226:128/device/drm", 0x7fffffffa790) = -1 ENOENT (No such file or directory)
stat("/sys/dev/char/226:0/device/drm", {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0

Ah, that explains the difference; yes, I'm testing it with plain Xorg. Thanks :-)

I have no idea if this is still required, but if it is: please go ahead.

This revision is now accepted and ready to land.Nov 13 2021, 2:38 PM

rebased patch, no functional changes. ping!

This revision now requires review to proceed.Feb 5 2023, 8:50 PM
sys/compat/linsysfs/linsysfs.c
378

what is 226? im not X expert.

sys/compat/linsysfs/linsysfs.c
378
sys/compat/linsysfs/linsysfs.c
378

Thanks, I got it, I read drm-kmod code, need some time to investigate it ))

sys/compat/linsysfs/linsysfs.c
378

ugh, in my setup (two GPU) this code is not worked, i915kms attached sysfs devices to the vgapci0 device which is nvidia gpu. I rewrote bus scan code, could you please test? https://people.freebsd.org/~dchagin/drm.patch

kernel need to be rebuild, as I dropped "drm" helper from vgapci code. 10x

sys/compat/linsysfs/linsysfs.c
378

I can't test right now.. Seems reasonable, probably makes sense to create a review here already