Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeBSD support #118

Open
h-2 opened this issue Apr 16, 2020 · 8 comments
Open

FreeBSD support #118

h-2 opened this issue Apr 16, 2020 · 8 comments

Comments

@h-2
Copy link

h-2 commented Apr 16, 2020

Has someone worked on FreeBSD support or thought about this? Can you estimate how difficult it would be to port this application? i.e. how much of the code depends on Linux-kernel specifics and how much would be shared code (mesa, Xorg, Wayland, Nvidia-driver, ...)?

Thank you!

@rockowitz
Copy link
Owner

rockowitz commented Apr 17, 2020 via email

@h-2
Copy link
Author

h-2 commented Apr 17, 2020

Thank you for the long answer. I have tried to find out more regarding FreeBSD's state of i2c support / exposure, but I don't know yet what to look for exactly and my other sources of information have not been very helpful.

This is the FreeBSD kernel-source directory for i2c:
https://github.com/freebsd/freebsd/tree/master/sys/modules/i2c
Do you see anything there that goes in the right direction?

There are also the following two packages

i2c-tools-4.1                  Heterogeneous set of I2C tools
iichid-0.0.1                   Generic FreeBSD HID layer for I2C and USB devices

I have tried stupid loading of all modules and seeing if new devices pop up in dmesg or /dev/ but without luck so far.

I have no experience with device drivers, but if you think that most of what I need is in there somewhere and just needs to be rewired correctly, I could maybe start looking into that since I might have some spare time soon.

@rockowitz
Copy link
Owner

rockowitz commented Apr 18, 2020 via email

@rockowitz
Copy link
Owner

A stripped down version of ddcutil, in branch 1.0.0-dev, builds on FreeBSD. .configure option --enable-targetbsd sets the appropriate iftests in the code.

However, no /dev/iic devices exist either for the video card or smbus. I believe I'm loading all the relevant kernel modules. Here's partial output from kldstat:

Id Refs Address                Size Name
 1   76 0xffffffff80200000  2448d90 kernel
 2    1 0xffffffff82649000     3a38 iicsmb.ko
 3    3 0xffffffff8264d000     2f18 smbus.ko
 4    5 0xffffffff82650000     6da0 iicbus.ko
 5    1 0xffffffff82657000     4d50 iicbb.ko
 6    1 0xffffffff8265c000     3910 iic.ko
       ...
 8    1 0xffffffff82664000     2e70 smb.ko
 9    1 0xffffffff82821000     494c linprocfs.ko
10    4 0xffffffff82826000     3178 linux_common.ko
11    1 0xffffffff8282a000     1eae linsysfs.ko
       ...
13    1 0xffffffff82835000   250464 amdgpu.ko
       ...
15    5 0xffffffff82afd000    10eb0 linuxkpi.ko
        ...
19    1 0xffffffff82b32000      670 iicdev.ko
        ...
23    1 0xffffffff82b3a000    3df60 linux.ko
24    1 0xffffffff82b78000    35b20 linux64.ko

The situation is the same if a Nvidia card is installed and the nvidia.ko module is loaded.

Interestingly, if I install a Hauppauge WinTV card and load its driver, /dev/iic devices for the card do appear.

I'm sure there's something trivial that this BSD newbie is missing. I'm hoping someone familiar with FreeBSD can clue me in on what to do. @rastermann, since Enlightenment builds for FreeBSD, perhaps someone on your team who is familiar with FreeBSD can help.

@h-2
Copy link
Author

h-2 commented Dec 14, 2020

Thank you so much for looking into this!

Interestingly I do not even have iicdev.ko on my system. In any case, I will open an issue in the FreeBSD bug tracker for this and see if someone can help.

@cemeyer
Copy link

cemeyer commented Dec 15, 2020

A looked into this a couple weeks ago. Support for I2C ioctls depends on the GPU driver.

The Nvidia GPU driver comes in two pieces: a binary blob, which is actually bit-for-bit identical with the Linux driver; and a set of platform-abstraction source code which is compiled to make the complete driver. The Linux platform-abstraction code exposes the DDC/I2C interface to userspace; the FreeBSD one does not. This is a shortcoming in the Nvidia driver, but one that we could theoretically address by porting over logic from the Linux driver.

As far as other GPU drivers (Intel, AMD), I don't know if they expose I2C ioctls to userspace or not.

There was a little bit of discussion of this topic at the November 2020 Devsummit, possibly during the 14.0 Planning session on Friday (but I'm not sure).

@rockowitz
Copy link
Owner

@cemeyer Thank you for the detailed note. I see that "DDC monitor control support (ddccontrol)" is listed in the "Want" section of the notes from the 14.0 Planning session. @h-2 Thanks for planning to post a bug report.

Obviously, the FreeBSD port is on hold until the driver support is there.

@h-2
Copy link
Author

h-2 commented Dec 15, 2020

Here is the issue in the FreeBSD tracker: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=251844

This is a shortcoming in the Nvidia driver, but one that we could theoretically address by porting over logic from the Linux driver.

As I already mentioned over at the FreeBSD tracker, I would be very willing to test such things but likely lack the experience to contribute initial code myself.

As far as other GPU drivers (Intel, AMD), I don't know if they expose I2C ioctls to userspace or not.

Andriy stated that they used to provide this, but don't anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants