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.

Linux/BEAGLEBK: PVR:(Error): WSEGL_CreateWindowDrawable: Couldn't set CRTC

Part Number: BEAGLEBK
Other Parts Discussed in Thread: AM3358

Tool/software: Linux

Following related questions on this forum, I tried it all.

Updating libpvrDRMWSEGL.so.1.14.3699939 library, as suggested in other related questions, didn't work, because it was binary identical to the library that was already installed in the file system under /usr/lib.

Editing powervr.ini file didn't work as well. By the way, my /etc/powervr.ini file looks like this:

[default]
WindowSystem=libpvrDRMWSEGL.so
DefaultPixelFormat=RGB565

The SGX drivers (bc_example.ko and pvrsrvkm.ko) load just fine.

Also, I can run Qt applications under X11 smoothly and with the right colors. So, device tree configuration of the LCD display seems fine to me. Nevertheless, my LCD panel is 800x480, which is not compliant with the 32 boundary of the SGX driver. So, I wanna know if I have to do some dirty hacking on my device tree overlay to tilt the display dimensions to the next 32 boundary. 

I just wanted to run eglinfo to make sure I have a proper working SGX environment before I go into building Qt with OpenGL ES accelerated by SGX. 

  • Hi Bruno,

    Do you use AM335x TI PSDK Linux? If yes, which version?

    Regards,
    Pavel
  • Hi Pavel,

    I use a Debian LXQT stretch distro, running on the 4.9.78-ti-r94 kernel. By the way, SoC is AM3358. I downloaded the SGX drivers from this repo:

    repos.rcn-ee.net/.../

    I tried using the TI's Graphics SDK 5_01_01_02 but it seems that it doesn't work with most recent kernels. I don't know if this information is accurate, but I couldn't build working modules using the SDK and a lot of people using 4.4.x or 4.9.x kernels seem to face the same issue. That's why I downloaded the binaries instead of the sources. And the SGX drivers load just fine.

    I downloaded the userspace libraries, like libpvrDRMWSEGL.so and so on, from this repo:

    git.ti.com/.../omap5-sgx-ddk-um-linux

    These two links were recommended by Robert C. Nelson himself on this thread:

    github.com/.../8

    I'm far from being an expert on windowing systems and eglfs. So I'm pretty lost, because all the solutions proposed in other related questions didn't resolve my issue.

    Thanks in advance for your help, Pavel!

    Regards,
    Bruno.
  • Hi Bruno,

    Check this document -
    software-dl.ti.com/.../Foundational_Components_Graphics.html

    You need to round the display width resolution to nearest multiple of 32.

    Regards,
    Manisha
  • Hi Manisha,

    The display resolution are already multiples of 32, in both width and height. By the way, the dimensions of LCD panel are 800x480. I appended these lines into uEnv.txt: 

    setenv optargs video=HDMI-A-1:1024x768
    saveenv

    or with the appropriate dimensions:

    setenv optargs video=HDMI-A-1:800x480
    saveenv

    Both ways didn't make any difference.

    If you may find useful, I'm attaching the log files related to strace, dmesg and lsmod, generated by these commands:

    strace eglinfo &> strace.log
    dmesg | grep -i pvr &> dmesg.log
    lsmod &> lsmod.log

    8055.strace.log



    [   33.064663] pvrsrvkm: loading out-of-tree module taints kernel.
    [   33.886096] [drm] Initialized pvr 1.14.3699939 20110701 on minor 1
    [  310.607589] PVR_K: UM DDK-(3699939) and KM DDK-(3699939) match. [ OK ]
    



    Module                  Size  Used by
    bc_example              9019  0
    pvrsrvkm              438798  1 bc_example
    pruss_soc_bus           4788  0
    evdev                  13811  2
    uio_pdrv_genirq         4205  0
    uio                    11036  1 uio_pdrv_genirq
    usb_f_mass_storage     51462  2
    usb_f_acm               8610  2
    u_serial               13482  3 usb_f_acm
    usb_f_ecm              11619  2
    usb_f_rndis            26944  2
    u_ether                13962  2 usb_f_ecm,usb_f_rndis
    libcomposite           55456  16 usb_f_ecm,usb_f_acm,usb_f_mass_storage,usb_f_rndis
    iptable_nat             2512  0
    nf_conntrack_ipv4      12035  1
    nf_defrag_ipv4          2016  1 nf_conntrack_ipv4
    nf_nat_ipv4             6857  1 iptable_nat
    nf_nat                 18928  1 nf_nat_ipv4
    nf_conntrack          117486  3 nf_conntrack_ipv4,nf_nat_ipv4,nf_nat
    iptable_mangle          2303  0
    iptable_filter          2453  0
    spidev                  9322  0
    pru_rproc              14966  0
    pruss_intc              9092  1 pru_rproc
    pruss                  10889  1 pru_rproc
    tieqep                  9111  0
    ip_tables              14529  3 iptable_mangle,iptable_filter,iptable_nat
    x_tables               22165  3 iptable_mangle,ip_tables,iptable_filter
    



    I have environment variable LD_LIBRARY_PATH exported as:

    export LD_LIBRARY_PATH=/usr/lib

    , which is the path to the userspace libraries I mentioned before.

    Exporting environment variable DISPLAY=:0 or DISPLAY=:1 or not exporting at all doesn't make any difference as well.

    Thank you for your time.

    Regards,

    Bruno.

  • I am not sure exactly what you are trying to achieve but seems like X11 is running which has occupied DRM resource and hence the PVR settings of DRM planes fail. There can be only one DRM master.

  • Hi Manisha,

    What I'm trying to achieve is just run the "eglinfo" program, to ensure my GPU "environment" is really working. 

    I killed the X11 process but it kept restarting, because my display manager, which is LightDM, did so.

    Then, I stopped the lightdm.service and removed it from startup.

    When I rebooted, I tried to run the "eglinfo" program again and received the same error. This time, the usual desktop didn't show up and non X11 related processes were running, as expected, because I removed lightdm.service from startup, which prevented X11 to start as well. So, as you said, another process should have opened the device node under /dev/dri/card* and became DRM master.

    After this, I stopped the getty@.service and removed it from startup, in order to prevent the tty prompt login to be exhibited. Then, I tried to run the "elginfo" program again and received the same error. I really have no idea of which process I have to prevent on startup to avoid this issue. 

    When I ran the "lsof" command, no processes were acessing the /dev/dri/* files. So, as you suggested, it was a one-time configuration that ocuppied the DRM resource. 

    Thank you again for your help,

    Bruno.

  • Some useful information I collected while digging down on this issue:

    I have /dev/dri/card0 for tilcdc DRM driver and /dev/dri/card1 for pvrsrvkm DRM driver.

    So, it's likely that the tilcdc DRM driver became the DRM master, because, according to dmesg, it is inserted first, through a device tree overlay.

    If I remove all the tilcdc nodes of the overlay, leaving it to deal only with the pinmux information, I get the following error:

    PVR:(Error): WSEGL_InitialiseDisplay: Failed to open primary device: No such file or directory [0, ]
    Unable to initialise egl
        egl error 'EGL_NOT_INITIALIZED' (0x3001)

    It seems to me now that the solution revolves around building a proper .dts file that doesn't invoke the tilcdc DRM driver but that is able to tell the pvrsrvkm DRM driver that there is indeed a LCD display connected.

    Any help will be most appreciated.

    Thank you once again,

    Bruno.

  • Hi Bruno,

    tilcdc driver is based out of DRM framework. It is the resource that master manages. It doesn't become master of itself. Either the Windows manager like X11/wayland, QT framework or user application can become master of the resource.

    Regards,
    Manisha
  • Hi Manisha,

    Thanks for the clarification regarding the correct terminology of things. I'm really a newbie on this subject, as you noticed.

    I don't know if it is useful, but I'm attaching the overlay source that deals with the LCD display. This way you can see the relationship of the overlay with the tilcdc driver. This overlay really works because I can run Qt applications with the correct colors, resolution, and so on. (I changed the extension to .txt only to be able to upload it)

    /dts-v1/;
    /plugin/;
    
    / {
    	compatible = "ti,beaglebone", "ti,beaglebone-black", "ti,beaglebone-green";
    	part-number = "DISPLAY-00A0";
    	version = "00A0";
    
    	exclusive-use =
    
    		"P8.45",	/* lcd: lcd_data0 */
    		"P8.46",	/* lcd: lcd_data1 */
    		"P8.43",	/* lcd: lcd_data2 */
    		"P8.44",	/* lcd: lcd_data3 */
    		"P8.41",	/* lcd: lcd_data4 */
    		"P8.42",	/* lcd: lcd_data5 */
    		"P8.39",	/* lcd: lcd_data6 */
    		"P8.40",	/* lcd: lcd_data7 */
    		"P8.37",	/* lcd: lcd_data8 */
    		"P8.38",	/* lcd: lcd_data9 */
    		"P8.36",	/* lcd: lcd_data10 */
    		"P8.34",	/* lcd: lcd_data11 */
    		"P8.35",	/* lcd: lcd_data12 */
    		"P8.33",	/* lcd: lcd_data13 */
    		"P8.31",	/* lcd: lcd_data14 */
    		"P8.32",	/* lcd: lcd_data15 */
    
    		"P8.15",	/* lcd: lcd_data16 */
    		"P8.16",	/* lcd: lcd_data17 */
    		"P8.11",	/* lcd: lcd_data18 */
    		"P8.12",	/* lcd: lcd_data19 */
    		"P8.17",	/* lcd: lcd_data20 */
    		"P8.14",	/* lcd: lcd_data21 */
    		"P8.13",	/* lcd: lcd_data22 */
    		"P8.19",	/* lcd: lcd_data23 */
    
    		"P8.27",	/* lcd: lcd_vsync */
    		"P8.29",	/* lcd: lcd_hsync */
    		"P8.28",	/* lcd: lcd_pclk */
    		"P8.30",	/* lcd: lcd_data_enable */
    
    		"lcd";
    
    	fragment@0 {
    		target = <&am33xx_pinmux>;
    		__overlay__ {
    
    			lcd_pins: pinmux_lcd_pins {
    				pinctrl-single,pins = <	0xA0 0x8	/* lcd: lcd_data0 */
    							0xA4 0x8 	/* lcd: lcd_data1 */
    							0xA8 0x8 	/* lcd: lcd_data2 */
    							0xAC 0x8 	/* lcd: lcd_data3 */
    							0xB0 0x8 	/* lcd: lcd_data4 */
    							0xB4 0x8 	/* lcd: lcd_data5 */
    							0xB8 0x8 	/* lcd: lcd_data6 */
    							0xBC 0x8 	/* lcd: lcd_data7 */
    							0xC0 0x8 	/* lcd: lcd_data8 */
    							0xC4 0x8 	/* lcd: lcd_data9 */
    							0xC8 0x8 	/* lcd: lcd_data10 */
    							0xCC 0x8 	/* lcd: lcd_data11 */
    							0xD0 0x8 	/* lcd: lcd_data12 */
    							0xD4 0x8 	/* lcd: lcd_data13 */
    							0xD8 0x8 	/* lcd: lcd_data14 */
    							0xDC 0x8 	/* lcd: lcd_data15 */
    
    							0x3C 0x9 	/* lcd: lcd_data16 */
    							0x38 0x9 	/* lcd: lcd_data17 */
    							0x34 0x9 	/* lcd: lcd_data18 */
    							0x30 0x9 	/* lcd: lcd_data19 */
    							0x2C 0x9 	/* lcd: lcd_data20 */
    							0x28 0x9 	/* lcd: lcd_data21 */
    							0x24 0x9 	/* lcd: lcd_data22 */
    							0x20 0x9 	/* lcd: lcd_data23 */
    
    							0xE0 0x8 	/* lcd: lcd_vsync */
    							0xE4 0x8 	/* lcd: lcd_hsync */
    							0xE8 0x8 	/* lcd: lcd_pclk */
    							0xEC 0x8	/* lcd: lcd_data_enable */
    				>;
    			};
    
    		};
    	};
    
    
    	fragment@1 {
    		target = <&lcdc>;
    		__overlay__ {
    			status = "okay";
    			blue-and-red-wiring = "crossed";
    		};
    	};
    
    	fragment@2 {
    		target-path="/";
    		__overlay__ {
    
    			panel {
    				status = "okay";
    				compatible = "ti,tilcdc,panel";
    				pinctrl-names = "default";
    				pinctrl-0 = <&lcd_pins>;
    				panel-info {
    					ac-bias           = <255>;		/* AC Bias Pin Frequency */
    					ac-bias-intrpt    = <0>;		/* AC Bias Pin Transitions per Interrupt */
    					dma-burst-sz      = <16>;		/* DMA burst size */
    					bpp               = <24>;		/* Bits per pixel */
    					fdd               = <0x80>;		/* FIFO DMA Request Delay */
    					sync-edge         = <0>;		/* Horizontal and Vertical Sync Edge: 0=rising 1=falling */
    					sync-ctrl         = <0>;		/* Horizontal and Vertical Sync: Control: 0=ignore */
    					raster-order      = <1>;		/* Raster Data Order Select: 1=Most-to-least 0=Least-to-most */
    					fifo-th           = <0>;		/* DMA FIFO threshold */
    				};
    				display-timings {
    					native-mode = <&timing>;
    					timing: 800x480 {
    						clock-frequency = <33300000>;	/* Clock de dados */
                    				hactive         = <800>;	/* Resolução */
                    				vactive         = <480>;	/* Resolução */
                    				hfront-porch    = <16 210 354>; /* Timing (ver datasheet IL16122) */
                    				hback-porch     = <46>;		/* Timing (ver datasheet IL16122) */		
                    				hsync-len       = <1 20 40>;	/* Timing (ver datasheet IL16122) */
                    				vback-porch     = <23>;		/* Timing (ver datasheet IL16122) */
                    				vfront-porch    = <7 22 47>;	/* Timing (ver datasheet IL16122) */
                    				vsync-len       = <1 10	20>;	/* Timing (ver datasheet IL16122) */
                    				hsync-active    = <0>;		/* 'Hsync' ativo na borda de descida */
                    				vsync-active    = <0>;		/* 'Vsync' ativo na borda de descida */
                    				de-active       = <1>;		/* 'Data Enable' ativo em alto */
                    				pixelclk-active = <0>;		/* 'Data Clock' ativo na borda de descida */
    					};
    				};
    			};
    		};
    	};
    };
    

    How do I know which process became the master of the resource I need? The device node regarding the pvrsrvkm driver is /dev/dri/card1 and the "file" is not listed as currently open when running the "lsof" command. As I mentioned before, killing all X11 related processes didn't make the trick or even disabling all the LightDM related services. I'm assuming that the root of the issue is a permission related issue as you suggested.

    I'm really stuck at this point, because the solutions presented in related threads on this forum didn't apply to me and there is nothing useful about this specific issue besides the TI's forum. 

    Regards,

    Bruno.  

  • Hi Bruno,

    DTS file won't have information on the master. Please check all the running application in your devise and share the list. Also share complete dmesg log.

    Regards,
    Manisha
  • Hi Manisha,

    I managed to run the "elginfo" program, following this steps:

    1) If LightDM services are up, I run:

    killall Xorg

    , in order to free the resource, as you suggested. Previously, I was killing only the process whose name was Xorg. I don't need to stop LightDM services to make it work, which is nice. 

    2) Then, I run the following commands to load PVR modules correctly and set the userpace libraries path:

    export LD_LIBRARY_PATH=/usr/lib/
    /etc/init.d/rc.pvr start

    3) Then I can run the "eglinfo" program and other demos that shipped with the DDK downloaded from this repo: git.ti.com/.../omap5-sgx-ddk-um-linux

    Note that if the blue-and-red-wiring property is set to "crossed" at the DISPLAY-00A0.dts overlay, I need to set DefaultPixelFormat to RGB888 at powervr.ini. If the blue-and-red-wiring property is set to "straight", I need to set the DefaultPixelFormat to RGB565. This last configuration, as expected, makes the colors wrong, due to the AM3358 errata.

    Thank you really much for your help, Manisha.

    Regards,

    Bruno.