This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3354: SGX Driver not starting

Part Number: AM3354

Hello,

I am trying to get the SGX driver to work for quite some time now, however with no real success.

I am using YOCTO zeus with the meta-ti layer. Linux kernel is 5.4.43-rt25.

I included the ti-sgx-ddk-km and ti-sgx-dd-um recipes in my image and was able to build pvrsrvkm.ko and pvrsrvctl.

local.conf:

IMAGE_INSTALL_append = " ti-sgx-ddk-km ti-sgx-ddk-um"

 

PREFERRED_PROVIDER_virtual/egl = "ti-sgx-ddk-um"

PREFERRED_PROVIDER_virtual/libgles1 = "ti-sgx-ddk-um"

PREFERRED_PROVIDER_virtual/libgles2 = "ti-sgx-ddk-um"

PREFERRED_PROVIDER_virtual/libgbm = "ti-sgx-ddk-um"

PREFERRED_PROVIDER_virtual/gpudriver = "ti-sgx-ddk-km"

On startup of my system, the kernel module seems to load OK:

[   25.239699] 000: pvrsrvkm: loading out-of-tree module taints kernel.

[   25.568382] 000: [drm] Initialized pvr 1.17.4948957 20110701 for 56000000.gpu on minor 1

However, when I try to start the user module with "pvrsrvctl --start --no-module", I get the following errors:

PVR:(Error): OpenServices: PVRDRMOpenRender failed [0, ]

PVR:(Error): PVRSRVInitSrvConnect: PVRSRVConnect failed [0, ]

PVR:(Error): SrvInit: PVRSRVInitSrvConnect failed (4) [0, ]

/usr/bin/pvrsrvctl: SrvInit failed (already initialized?) (err=PVRSRV_ERROR_INIT_FAILURE)

What can be the reason for this behaviour?

In my /sys/class/drm folder I find the following entries:

drwxr-xr-x 52 root root    0 Jan  1 00:00 ..

lrwxrwxrwx  1 root root    0 Jan  1 00:00 card0 -> ../../devices/platform/ocp/48000000.interconnect/48000000.interconnect:segment@300000/4830e000.target-module/4830e000.lcdc/drm/card0

lrwxrwxrwx  1 root root    0 Jan  1 00:00 card0-LVDS-1 -> ../../devices/platform/ocp/48000000.interconnect/48000000.interconnect:segment@300000/4830e000.target-module/4830e000.lcdc/drm/card0/card0-LVDS-1

lrwxrwxrwx  1 root root    0 Jan  1 00:00 card1 -> ../../devices/platform/ocp/ocp:target-module@56000000/56000000.gpu/drm/card1

lrwxrwxrwx  1 root root    0 Jan  1 00:03 renderD128 -> ../../devices/platform/ocp/ocp:target-module@56000000/56000000.gpu/drm/renderD128

-r--r--r--  1 root root 4.0K Jan  1 00:00 version

Under /dev/dri, however, there is only one card:

drwxr-xr-x 2 root root 60 Jan 1 00:00 by-path
crw-rw---- 1 root video 226, 0 Jan 1 00:00 card0

Could this mean that the render device node is not created? What could be the reason? How to fix this?

Kind regards

Dirk

  • Hi Dirk,

    In your DT, is the GPU status enabled? Also, if you take the stock filesystem from SDK7.3, do you see similar issue?

    Regards,
    Krunal

  • Hi Krunal,

    In your DT, is the GPU status enabled?

    I just checked the contents of my DT. It says:

    ...

    target-module@56000000 {
    compatible = "ti,sysc-omap2", "ti,sysc";
    clocks = <0x60 0x4 0x0>;
    clock-names = "fck";
    resets = <0x61 0x0>;
    reset-names = "rstctrl";
    #address-cells = <0x1>;
    #size-cells = <0x1>;
    ranges = <0x0 0x56000000 0x10000>;

    gpu@0 {
    compatible = "ti,am3352-sgx530", "img,sgx530";
    reg = <0x0 0x10000>;
    interrupts = <0x25>;
    clocks = <0x62>;
    clock-names = "fclk";
    };
    };

    sgx@0x56000000 {
    status = "okay";
    };

    ...

    So, I think, it is enabled.

    Also, if you take the stock filesystem from SDK7.3, do you see similar issue?

    Where do I get that from, and how to deal with it? Is it inside the yocto layer or will I have to download and install it seperately?

    Thanks a lot for your help!

    Best regards,

    Dirk

  • So,

    I finally figured it out myself.

    The reason for the error messages was the missing entries in /dev/dri, as I suspected.

    To overcome this problem, I frist tried to insert the missing device nodes manually by executing "mknod /dev/dri/card1 c 226 1" and "mknod /dev/dri/renderD128 c 226 128" (226 being the major number of the drm device).

    The next step was to give rw access to the two new nodes by issuing "chmode 660 /dev/dri/card1" and "chmod 660 /dev/dri/renderD128", respectively.

    After that, "pvrsrvctl --start --no-module" worked flawlessly. I coudl even start the glmark2-es-drm test program and enjoy SGX accelerated graphics with about 50 fps.

    Next, I was curious why these device nodes hadn't been created by the init system (sysvinit) in the first place.

    After some research, I found out, that the mdev init in /etc/rcS.d was done before the SGX kernel module was loaded, so the /sys/class/drm entries had not been populated yet. A manual restart of the mdev service from the command prompt resulted in the missing device nodes showing up in /dev/dri.

    Next thing to do was to re-oder the system init to make sure that the kenel module "pvrsrvkm.ko" was loaded before init of mdev.

    I still don't know why the system startup was garbled in that way, since I just did a normal yocto build, but I hope that my findings are useful for others facing the same problems.

    @TI: Please update module source code to give some more elaborate hints as to what went wrong in case of an error. 

    Happy Thanksgiving!