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

drmOpen Failure in jetson orin #15

Open
eulercat opened this issue Jun 14, 2024 · 8 comments
Open

drmOpen Failure in jetson orin #15

eulercat opened this issue Jun 14, 2024 · 8 comments

Comments

@eulercat
Copy link

eulercat commented Jun 14, 2024

I've tried to call drmOpen() like the following.
drmOpen("drm-nvdc', nullptr);

Since it failed and I noticed the device driver error occurred before in the kernel logs.

nvdc: open: No such file or directory
nvdc: failed to open '/dev/tegra_dc_ctrl'.

https://github.com/OE4T/linux-tegra-5.10/blob/oe4t-patches-l4t-r35.4.ga/nvidia/drivers/video/tegra/dc/dc.c#L113

static const struct of_device_id tegra_display_of_match[] = {
	{.compatible = "nvidia,tegra210-dc", .data = &t21x_hw_data },
	{.compatible = "nvidia,tegra186-dc", .data = &t18x_hw_data },
	{.compatible = "nvidia,tegra194-dc", .data = &t19x_hw_data },
	{ },
};

Kernel couldn't find the compatible device node, hence it couldn't create the device node, consequently drm seemed not working properly because it couldn't interface with the display-controller device.

I've checked the device tree for jetson-orin, it didn't have the compatible devices , but it had tegra234-display.
jetson-xavior has nvidia,tegra194-dc, but orin doesn't. So the currently nvidia/driver/video and nvidia/driver/drm might work on jetson-xavior, but it will fail on jetson-orin.

Please let me know if I miss-understood.

@eulercat
Copy link
Author

@madisongh
Copy link
Member

I'm no expert on this, but my understanding is that for Orin/t23x, NVIDIA has dumped the old nvdc approach, and moved all the drivers out of tree - repo here. You can read the Jetson Linux documentation, particularly the sections on graphics and windows systems, for a bit more information on how to use it.

@eulercat
Copy link
Author

eulercat commented Jun 14, 2024

@madisongh Thanks for response.
I made a target image for jetson-orin via https://github.com/OE4T/meta-tegra/tree/kirkstone.
meta-tegra includes device drivers distributed only in binary format and installed together with the kernel. Required kernel modules were loaded properly.

$ lsmod | grep nv
nvidia_drm             69632  0
nvidia_modeset       1171456  1 nvidia_drm
nvidia               1458176  1 nvidia_modeset
nvgpu                2666496  0
nvmap                 221184  1 nvgpu

I also confirmed that libdrm_nvdc.so, the libdrm for nvidia, was linked in the process calling drmOpen().

0x0000000000000001 (NEEDED)             Shared library: [libdrm.so.2]
$ ls /usr/lib/libdrm.so.2 -l
lrwxrwxrwx 1 root root 14 Mar  9  2018 /usr/lib/libdrm.so.2 -> libdrm_nvdc.so

Regardless the above dc driver error messages, if drmOpen("drm-nvdc", NULL) succeed, it will be no problem.
But I'm still facing the problem.

@eulercat
Copy link
Author

@madisongh
Copy link
Member

I'd suggest looking at some example code from NVIDIA - either the L4T graphics demos or the Jetson Multimedia API sample code - to see how to make this work for you. For example, in the Multimedia API code, I see this:

  drm_fd = drmOpen(DRM_DEVICE_NAME, NULL);
  if (drm_fd < 0)
    drm_fd = open("/dev/dri/card0", O_RDWR, 0);
  if (drm_fd == -1) {
    COMP_ERROR_MSG("Couldn't open device");
    goto error;
  }

where DRM_DEVICE_NAME is "drm-nvdc". I think this is how they handle working with both their pre-t23x NVDC implementation and the newer, more standard, DRM interface.

@eulercat
Copy link
Author

Thank you so much, @madisongh.
I'll try your suggestion.

@eulercat
Copy link
Author

eulercat commented Jun 17, 2024

@madisongh
I deleted the comment I left a little while ago. I will leave a comment again after further review.

It succeeded to get drm device info from drmModeGetResources() via fd from open('/dev/dri/card0',...). However after that it's failing on calling eglStreamConsumerOutputEXT and eglCreateStreamProducerSurfaceKHR.

The old nvidia board only supported eglStream instead of gbm, so I'm trying that method.
Has jetson-agx-orin-devkit changed to use gbm?

@madisongh
Copy link
Member

Has jetson-agx-orin-devkit changed to use gbm?

I think it's fairer to say that NVIDIA has been transitioning to using GBM, under the hood, with the R35.x series BSP. That applies to both Orin and Xavier platforms, although it does look like with Orin they just never implemented the old method. That's about as much as I know, though. Hopefully you'll find what you need in the Jetson Linux docs and NVIDIA's example code I mentioned earlier.

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

No branches or pull requests

2 participants