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.

SK-AM62P-LP: Opengles Off Screen Rendering Loop Appears PVR_K: (Error)

Part Number: SK-AM62P-LP

Tool/software:

Problem Background:

What I want to do is output four UYUV-format images from the GPU to Gstreamer for encoding.
My implementation plan is to create an EGLImage using a DMA buffer and bind it to a texture. Then, attach the texture to an FBO for rendering, drawing the four images sequentially, and finally obtaining the UYUV output.
Since I have four outputs, and each output has a buffer queue with a buffer count of 3, I need to allocate 12 corresponding FBO, RBO, and EGLImage resources, switching between them during the loop drawing.


Problem:  After launching the program, the program will be killed by the system without any prompts. By checking the kernel printout in dmesg, we found PVR_K(Error).

  8802.message.txt

  • Hi,

    How are you compiling the GPU driver? Is it part of default SDK?

    Regards,
    Krunal

  • I did not compile the GPU driver, this part should be part of the SDK default

  • Okay, just to clarify my questions:

    1. Did you modify the Kernel and DTS entries? If yes, please share them?

    2. How did you rebuild the GPU driver? Is it using the Makefile in the SDK?

    3. Did you modify anything in the GPU driver? I am just trying to understand how to replicate the issue on my side.

    4. Additionally are the above errors after running your userpsace application? How aer you allocating memory and freeing the memory? 

    Regards,
    Krunal

  • 1.only modified one DTS file k3-am62p5-sk.dts 

    k3-am62p5-sk.dts.txt
    // SPDX-License-Identifier: GPL-2.0
    /*
     * Device Tree file for the AM62P5-SK
     * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
     *
     * Schematics: https://www.ti.com/lit/zip/sprr487
     */
    
    /dts-v1/;
    
    #include <dt-bindings/leds/common.h>
    #include <dt-bindings/gpio/gpio.h>
    #include <dt-bindings/net/ti-dp83867.h>
    #include "k3-am62p5.dtsi"
    
    / {
    	compatible = "ti,am62p5-sk", "ti,am62p5";
    	model = "Texas Instruments AM62P5 SK";
    
    	aliases {
    		serial0 = &wkup_uart0;
    		serial2 = &main_uart0;
    		serial3 = &main_uart1;
    		mmc0 = &sdhci0;
    		mmc1 = &sdhci1;
    		mmc2 = &sdhci2;
    		spi0 = &ospi0;
    		ethernet0 = &cpsw_port1;
    		ethernet1 = &cpsw_port2;
    		usb0 = &usb0;
    		usb1 = &usb1;
    	};
    
    	chosen {
    		#address-cells = <2>;
    		#size-cells = <2>;
    		ranges;
    
    		stdout-path = &main_uart0;
    		bootargs = "console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000 DTB_version=01.00.000 BLD_version=00.00.000 loglevel=0 root=/dev/mmcblk1p2 ro rootfstype=ext4 rootwait video=vfb:1920x1080,1920x3240,18";
    
    		framebuffer0: framebuffer@0 {
    			compatible = "simple-framebuffer";
    			power-domains = <&k3_pds 186 TI_SCI_PD_EXCLUSIVE>,
    					<&k3_pds 243 TI_SCI_PD_EXCLUSIVE>,	/* OLDI0 */
    					<&k3_pds 244 TI_SCI_PD_EXCLUSIVE>;	/* OLDI1 */
    			clocks = <&k3_clks 186 6>,
    				 <&dss0_vp1_clk>,
    				 <&k3_clks 186 2>;
    			display = <&dss0>;
    			status = "disabled";
    		};
    	};
    
    	memory@80000000 {
    		/* 1G RAM */
    		reg = <0x00000000 0x80000000 0x00000000 0x40000000>;
    		device_type = "memory";
    	};
    
    	reserved_memory: reserved-memory {
    		#address-cells = <2>;
    		#size-cells = <2>;
    		ranges;
    
    		linux,cma {
    			compatible = "shared-dma-pool";
    			reusable;
    			size = <0x00 0x10000000>;
    			linux,cma-default;
    		};
    
    		rtos_ipc_memory_region: rtos-ipc-memory@9b500000 {
    			compatible = "shared-dma-pool";
    			reg = <0x00 0x9b500000 0x00 0x00300000>;
    			no-map;
    		};
    
    		mcu_r5fss0_core0_dma_memory_region: mcu-r5fss-dma-memory-region@9b800000 {
    			compatible = "shared-dma-pool";
    			reg = <0x00 0x9b800000 0x00 0x00100000>;
    			no-map;
    		};
    
    		mcu_r5fss0_core0_memory_region: mcu-r5fss-memory-region@9b900000 {
    			compatible = "shared-dma-pool";
    			reg = <0x00 0x9b900000 0x00 0x00f00000>;
    			no-map;
    		};
    
    		wkup_r5fss0_core0_dma_memory_region: r5f-dma-memory@9c800000 {
    			compatible = "shared-dma-pool";
    			reg = <0x00 0x9c800000 0x00 0x00100000>;
    			no-map;
    		};
    
    		wkup_r5fss0_core0_memory_region: r5f-memory@9c900000 {
    			compatible = "shared-dma-pool";
    			reg = <0x00 0x9c900000 0x00 0x01e00000>;
    			no-map;
    		};
    
    		secure_tfa_ddr: tfa@9e780000 {
    			reg = <0x00 0x9e780000 0x00 0x80000>;
    			no-map;
    		};
    
    		secure_ddr: optee@9e800000 {
    			reg = <0x00 0x9e800000 0x00 0x01800000>; /* for OP-TEE */
    			no-map;
    		};
    	};
    
    	vmain_pd: regulator-0 {
    		/* TPS65988 PD CONTROLLER OUTPUT */
    		compatible = "regulator-fixed";
    		regulator-name = "vmain_pd";
    		regulator-min-microvolt = <5000000>;
    		regulator-max-microvolt = <5000000>;
    		regulator-always-on;
    		regulator-boot-on;
    		bootph-all;
    	};
    
    	vcc_5v0: regulator-1 {
    		/* Output of TPS630702RNMR */
    		compatible = "regulator-fixed";
    		regulator-name = "vcc_5v0";
    		regulator-min-microvolt = <5000000>;
    		regulator-max-microvolt = <5000000>;
    		vin-supply = <&vmain_pd>;
    		regulator-always-on;
    		regulator-boot-on;
    		bootph-all;
    	};
    
    	vdd_mmc1: regulator-2 {
    		/* TPS22918DBVR */
    		compatible = "regulator-fixed";
    		regulator-name = "vdd_mmc1";
    		regulator-min-microvolt = <3300000>;
    		regulator-max-microvolt = <3300000>;
    		regulator-boot-on;
    		enable-active-high;
    		//gpio = <&exp1 3 GPIO_ACTIVE_HIGH>;
    		bootph-all;
    	};
    
    	vddshv_sdio: regulator-3 {
    		compatible = "regulator-gpio";
    		regulator-name = "vddshv_sdio";
    		pinctrl-names = "default";
    		pinctrl-0 = <&vddshv_sdio_pins_default>;
    		regulator-min-microvolt = <1800000>;
    		regulator-max-microvolt = <3300000>;
    		regulator-boot-on;
    		gpios = <&main_gpio0 31 GPIO_ACTIVE_HIGH>;
    		states = <1800000 0x0>,
    			 <3300000 0x1>;
    		bootph-all;
    	};
    
    	leds {
    		compatible = "gpio-leds";
    		pinctrl-names = "default";
    		pinctrl-0 = <&usr_led_pins_default>;
    
    		led-0 {
    			label = "am62-sk:green:heartbeat";
    			gpios = <&main_gpio1 49 GPIO_ACTIVE_HIGH>;
    			linux,default-trigger = "heartbeat";
    			function = LED_FUNCTION_HEARTBEAT;
    			default-state = "off";
    		};
    	};
    
    	opp-table {
    		/* Add 1.4GHz OPP for am62p5-sk board. Requires VDD_CORE at 0v85 */
    		opp-1400000000 {
    			opp-hz = /bits/ 64 <1400000000>;
    			opp-supported-hw = <0x01 0x0004>;
    			clock-latency-ns = <6000000>;
    		};
    	};
    
    	tlv320_mclk: clk-0 {
    		#clock-cells = <0>;
    		compatible = "fixed-clock";
    		clock-frequency = <12288000>;
    	};
    
    	codec_audio: sound {
    		compatible = "simple-audio-card";
    		simple-audio-card,name = "AM62x-SKEVM";
    		simple-audio-card,widgets =
    			"Headphone",	"Headphone Jack",
    			"Line",		"Line In",
    			"Microphone",	"Microphone Jack";
    		simple-audio-card,routing =
    			"Headphone Jack",	"HPLOUT",
    			"Headphone Jack",	"HPROUT",
    			"LINE1L",		"Line In",
    			"LINE1R",		"Line In",
    			"MIC3R",		"Microphone Jack",
    			"Microphone Jack",	"Mic Bias";
    		simple-audio-card,format = "dsp_b";
    		simple-audio-card,bitclock-master = <&sound_master>;
    		simple-audio-card,frame-master = <&sound_master>;
    		simple-audio-card,bitclock-inversion;
    
    		simple-audio-card,cpu {
    			sound-dai = <&mcasp1>;
    		};
    
    		sound_master: simple-audio-card,codec {
    #if 0
    			sound-dai = <&tlv320aic3106>;
    #endif
    			clocks = <&tlv320_mclk>;
    		};
    	};
    
    	hdmi0: connector-hdmi {
    		compatible = "hdmi-connector";
    		label = "hdmi";
    		type = "a";
    #if 0
    		port {
    			hdmi_connector_in: endpoint {
    				remote-endpoint = <&sii9022_out>;
    			};
    		};
    #endif
    	};
    };
    
    &main_gpio0 {
    	bootph-all;
    };
    
    &main_gpio1 {
    	bootph-all;
    };
    
    &main_pmx0 {
    	bootph-all;
    
    	main_i2c0_pins_default: main-i2c0-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x01e0, PIN_INPUT_PULLUP, 0) /* (B25) I2C0_SCL */
    			AM62PX_IOPAD(0x01e4, PIN_INPUT_PULLUP, 0) /* (A24) I2C0_SDA */
    		>;
    	};
    
    	main_i2c1_pins_default: main-i2c1-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x01e8, PIN_INPUT_PULLUP, 0) /* (C24) I2C1_SCL */
    			AM62PX_IOPAD(0x01ec, PIN_INPUT_PULLUP, 0) /* (B24) I2C1_SDA */
    		>;
    		bootph-all;
    	};
    
    	main_i2c2_pins_default: main-i2c2-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x00b0, PIN_INPUT_PULLUP, 1) /* (T22) GPMC0_CSn2.I2C2_SCL */
    			AM62PX_IOPAD(0x00b4, PIN_INPUT_PULLUP, 1) /* (U25) GPMC0_CSn3.I2C2_SDA */
    		>;
    	};
    
    	main_gpio1_ioexp_intr_pins_default: main-gpio1-ioexp-intr-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x01d4, PIN_INPUT, 7) /* (C22) UART0_RTSn.GPIO1_23 */
    		>;
    	};
    
    	main_mcasp1_pins_default: main-mcasp1-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x0090, PIN_INPUT, 2) /* (U24) GPMC0_BE0n_CLE.MCASP1_ACLKX */
    			AM62PX_IOPAD(0x0098, PIN_INPUT, 2) /* (AA24) GPMC0_WAIT0.MCASP1_AFSX */
    			AM62PX_IOPAD(0x008c, PIN_OUTPUT, 2) /* (T25) GPMC0_WEn.MCASP1_AXR0 */
    			AM62PX_IOPAD(0x0084, PIN_INPUT, 2) /* (R25) GPMC0_ADVn_ALE.MCASP1_AXR2 */
    		>;
    	};
    
    	main_mdio1_pins_default: main-mdio1-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x0160, PIN_OUTPUT, 0) /* (F17) MDIO0_MDC */
    			AM62PX_IOPAD(0x015c, PIN_INPUT, 0) /* (F16) MDIO0_MDIO */
    		>;
    	};
    
    	mygpio0_pins_default: mygpio0-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x00a8, PIN_OUTPUT, 7) /* (T23) GPMC0_CSn0.GPIO0_41 */
    			AM62PX_IOPAD(0x00ac, PIN_INPUT, 7) /* (U23) GPMC0_CSn1.GPIO0_42 */
    			AM62PX_IOPAD(0x0108, PIN_OUTPUT_PULLUP, 7) /* (L21) MMC2_DAT3.GPIO0_65 */
    			AM62PX_IOPAD(0x010c, PIN_OUTPUT, 7) /* (L20) MMC2_DAT2.GPIO0_66 */
    			AM62PX_IOPAD(0x0110, PIN_OUTPUT_PULLUP, 7) /* (K22) MMC2_DAT1.GPIO0_67 */
    			AM62PX_IOPAD(0x0114, PIN_OUTPUT_PULLUP, 7) /* (K23) MMC2_DAT0.GPIO0_68 */
    			AM62PX_IOPAD(0x0124, PIN_OUTPUT_PULLUP, 7) /* (J25) MMC2_SDCD.GPIO0_71 */
    		>;
    		bootph-all;
    	};
    	mygpio1_pins_default: mygpio1-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x018c, PIN_OUTPUT_PULLUP, 7) /* (E17) RGMII2_RD2.GPIO1_5 */
    			AM62PX_IOPAD(0x0190, PIN_INPUT, 7) /* (C19) RGMII2_RD3.GPIO1_6 */
    			AM62PX_IOPAD(0x0194, PIN_INPUT, 7) /* (D25) MCASP0_AXR3.GPIO1_7 */
    			AM62PX_IOPAD(0x0198, PIN_OUTPUT, 7) /* (E25) MCASP0_AXR2.GPIO1_8 */
    			AM62PX_IOPAD(0x019c, PIN_INPUT, 7) /* (E24) MCASP0_AXR1.GPIO1_9 */
    			AM62PX_IOPAD(0x01a0, PIN_OUTPUT, 7) /* (F23) MCASP0_AXR0.GPIO1_10 */
    			AM62PX_IOPAD(0x01a4, PIN_INPUT, 7) /* (F24) MCASP0_ACLKX.GPIO1_11 */
    			AM62PX_IOPAD(0x01a8, PIN_OUTPUT_PULLUP, 7) /* (F25) MCASP0_AFSX.GPIO1_12 */
    			AM62PX_IOPAD(0x01ac, PIN_OUTPUT, 7) /* (G23) MCASP0_AFSR.GPIO1_13 */
    			AM62PX_IOPAD(0x01b0, PIN_OUTPUT, 7) /* (G20) MCASP0_ACLKR.GPIO1_14 */
    			AM62PX_IOPAD(0x01b4, PIN_OUTPUT, 7) /* (D20) SPI0_CS0.GPIO1_15 */
    			AM62PX_IOPAD(0x01b8, PIN_OUTPUT, 7) /* (E20) SPI0_CS1.GPIO1_16 */
    			AM62PX_IOPAD(0x01bc, PIN_OUTPUT, 7) /* (B21) SPI0_CLK.GPIO1_17 */
    			AM62PX_IOPAD(0x01c0, PIN_OUTPUT, 7) /* (B20) SPI0_D0.GPIO1_18 */
    			AM62PX_IOPAD(0x01c4, PIN_OUTPUT, 7) /* (C21) SPI0_D1.GPIO1_19 */
    		>;
    		bootph-all;
    	};
    
    	main_mmc1_pins_default: main-mmc1-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x023c, PIN_INPUT, 0) /* (H20) MMC1_CMD */
    			AM62PX_IOPAD(0x0234, PIN_OUTPUT, 0) /* (J24) MMC1_CLK */
    			AM62PX_IOPAD(0x0230, PIN_INPUT, 0) /* (H21) MMC1_DAT0 */
    			AM62PX_IOPAD(0x022c, PIN_INPUT_PULLUP, 0) /* (H23) MMC1_DAT1 */
    			AM62PX_IOPAD(0x0228, PIN_INPUT_PULLUP, 0) /* (H22) MMC1_DAT2 */
    			AM62PX_IOPAD(0x0224, PIN_INPUT_PULLUP, 0) /* (H25) MMC1_DAT3 */
    			AM62PX_IOPAD(0x0240, PIN_INPUT, 0) /* (D23) MMC1_SDCD */
    		>;
    		bootph-all;
    	};
    
    	// main_mmc2_pins_default: main-mmc2-default-pins {
    	// 	pinctrl-single,pins = <
    	// 		AM62PX_IOPAD(0x0120, PIN_INPUT, 0) /* (K24) MMC2_CMD */
    	// 		AM62PX_IOPAD(0x0118, PIN_OUTPUT, 0) /* (K21) MMC2_CLK */
    	// 		AM62PX_IOPAD(0x011C, PIN_INPUT, 0) /* () MMC2_CLKLB */
    	// 		AM62PX_IOPAD(0x0114, PIN_INPUT, 0) /* (K23) MMC2_DAT0 */
    	// 		AM62PX_IOPAD(0x0110, PIN_INPUT_PULLUP, 0) /* (K22) MMC2_DAT1 */
    	// 		AM62PX_IOPAD(0x010c, PIN_INPUT_PULLUP, 0) /* (L20) MMC2_DAT2 */
    	// 		AM62PX_IOPAD(0x0108, PIN_INPUT_PULLUP, 0) /* (L21) MMC2_DAT3 */
    	// 	>;
    	// 	bootph-all;
    	// };
    
    	main_rgmii1_pins_default: main-rgmii1-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x014c, PIN_INPUT, 0) /* (B15) RGMII1_RD0 */
    			AM62PX_IOPAD(0x0150, PIN_INPUT, 0) /* (B16) RGMII1_RD1 */
    			AM62PX_IOPAD(0x0154, PIN_INPUT, 0) /* (A14) RGMII1_RD2 */
    			AM62PX_IOPAD(0x0158, PIN_INPUT, 0) /* (B14) RGMII1_RD3 */
    			AM62PX_IOPAD(0x0148, PIN_INPUT, 0) /* (A16) RGMII1_RXC */
    			AM62PX_IOPAD(0x0144, PIN_INPUT, 0) /* (A15) RGMII1_RX_CTL */
    			AM62PX_IOPAD(0x0134, PIN_OUTPUT, 0) /* (A18) RGMII1_TD0 */
    			AM62PX_IOPAD(0x0138, PIN_OUTPUT, 0) /* (C17) RGMII1_TD1 */
    			AM62PX_IOPAD(0x013c, PIN_OUTPUT, 0) /* (A17) RGMII1_TD2 */
    			AM62PX_IOPAD(0x0140, PIN_OUTPUT, 0) /* (C16) RGMII1_TD3 */
    			AM62PX_IOPAD(0x0130, PIN_OUTPUT, 0) /* (B17) RGMII1_TXC */
    			AM62PX_IOPAD(0x012c, PIN_OUTPUT, 0) /* (B18) RGMII1_TX_CTL */
    		>;
    		bootph-all;
    	};
    
    	main_uart0_pins_default: main-uart0-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x1c8, PIN_INPUT, 0)	/* (A22) UART0_RXD */
    			AM62PX_IOPAD(0x1cc, PIN_OUTPUT, 0)	/* (B22) UART0_TXD */
    		>;
    		bootph-all;
    	};
    
    	main_uart1_pins_default: main-uart1-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x0194, PIN_INPUT, 2) /* (D25) MCASP0_AXR3.UART1_CTSn */
    			AM62PX_IOPAD(0x0198, PIN_OUTPUT, 2) /* (E25) MCASP0_AXR2.UART1_RTSn */
    			AM62PX_IOPAD(0x01ac, PIN_INPUT, 2) /* (G23) MCASP0_AFSR.UART1_RXD */
    			AM62PX_IOPAD(0x01b0, PIN_OUTPUT, 2) /* (G20) MCASP0_ACLKR.UART1_TXD */
    		>;
    		bootph-all;
    	};
    
    	main_usb1_pins_default: main-usb1-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x0258, PIN_INPUT, 0) /* (G21) USB1_DRVVBUS */
    		>;
    	};
    
    	main_wlirq_pins_default: main-wlirq-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x0128, PIN_INPUT, 7) /* (K25) MMC2_SDWP.GPIO0_72 */
    		>;
    	};
    
    	ospi0_pins_default: ospi0-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x0000, PIN_OUTPUT, 0) /* (P23) OSPI0_CLK */
    			AM62PX_IOPAD(0x002c, PIN_OUTPUT, 0) /* (M25) OSPI0_CSn0 */
    			AM62PX_IOPAD(0x000c, PIN_INPUT, 0) /* (L25) OSPI0_D0 */
    			AM62PX_IOPAD(0x0010, PIN_INPUT, 0) /* (N24) OSPI0_D1 */
    			AM62PX_IOPAD(0x0014, PIN_INPUT, 0) /* (N25) OSPI0_D2 */
    			AM62PX_IOPAD(0x0018, PIN_INPUT, 0) /* (M24) OSPI0_D3 */
    			AM62PX_IOPAD(0x001c, PIN_INPUT, 0) /* (N21) OSPI0_D4 */
    			AM62PX_IOPAD(0x0020, PIN_INPUT, 0) /* (N22) OSPI0_D5 */
    			AM62PX_IOPAD(0x0024, PIN_INPUT, 0) /* (P21) OSPI0_D6 */
    			AM62PX_IOPAD(0x0028, PIN_INPUT, 0) /* (N20) OSPI0_D7 */
    			AM62PX_IOPAD(0x0008, PIN_INPUT, 0) /* (P22) OSPI0_DQS */
    		>;
    		bootph-all;
    	};
    
    	qspi0_pins_default: ospi0-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x0000, PIN_OUTPUT, 0) /* (P23) OSPI0_CLK */
    			AM62PX_IOPAD(0x002c, PIN_OUTPUT, 0) /* (M25) OSPI0_CSn0 */
    			AM62PX_IOPAD(0x000c, PIN_INPUT, 0) /* (L25) OSPI0_D0 */
    			AM62PX_IOPAD(0x0010, PIN_INPUT, 0) /* (N24) OSPI0_D1 */
    			AM62PX_IOPAD(0x0014, PIN_INPUT, 0) /* (N25) OSPI0_D2 */
    			AM62PX_IOPAD(0x0018, PIN_INPUT, 0) /* (M24) OSPI0_D3 */
    		>;
    		bootph-all;
    	};
    
    	usr_led_pins_default: usr-led-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x0244, PIN_INPUT, 7) /* (D24) MMC1_SDWP.GPIO1_49 */
    		>;
    	};
    
    	vddshv_sdio_pins_default: vddshvr-sdio-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x007c, PIN_INPUT, 7) /* (Y25) GPMC0_CLK.GPIO0_31 */
    		>;
    		bootph-all;
    	};
    
    	wlan_en_pins_default: wlan-en-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x0124, PIN_INPUT, 7) /* (J25) MMC2_SDCD.GPIO0_71 */
    		>;
    	};
    
    	main_dpi_pins_default: main-dpi-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x0100, PIN_OUTPUT, 0) /* (W20) VOUT0_VSYNC */
    			AM62PX_IOPAD(0x00f8, PIN_OUTPUT, 0) /* (AC20) VOUT0_HSYNC */
    			AM62PX_IOPAD(0x0104, PIN_OUTPUT, 0) /* (Y21) VOUT0_PCLK */
    			AM62PX_IOPAD(0x00fc, PIN_OUTPUT, 0) /* (W21) VOUT0_DE */
    			AM62PX_IOPAD(0x00b8, PIN_OUTPUT, 0) /* (AE24) VOUT0_DATA0 */
    			AM62PX_IOPAD(0x00bc, PIN_OUTPUT, 0) /* (W23) VOUT0_DATA1 */
    			AM62PX_IOPAD(0x00c0, PIN_OUTPUT, 0) /* (AA23) VOUT0_DATA2 */
    			AM62PX_IOPAD(0x00c4, PIN_OUTPUT, 0) /* (Y23) VOUT0_DATA3 */
    			AM62PX_IOPAD(0x00c8, PIN_OUTPUT, 0) /* (AB23) VOUT0_DATA4 */
    			AM62PX_IOPAD(0x00cc, PIN_OUTPUT, 0) /* (AD23) VOUT0_DATA5 */
    			AM62PX_IOPAD(0x00d0, PIN_OUTPUT, 0) /* (AC23) VOUT0_DATA6 */
    			AM62PX_IOPAD(0x00d4, PIN_OUTPUT, 0) /* (AE23) VOUT0_DATA7 */
    			AM62PX_IOPAD(0x00d8, PIN_OUTPUT, 0) /* (AE22) VOUT0_DATA8 */
    			AM62PX_IOPAD(0x00dc, PIN_OUTPUT, 0) /* (AC22) VOUT0_DATA9 */
    			AM62PX_IOPAD(0x00e0, PIN_OUTPUT, 0) /* (W22) VOUT0_DATA10 */
    			AM62PX_IOPAD(0x00e4, PIN_OUTPUT, 0) /* (AE21) VOUT0_DATA11 */
    			AM62PX_IOPAD(0x00e8, PIN_OUTPUT, 0) /* (AD21) VOUT0_DATA12 */
    			AM62PX_IOPAD(0x00ec, PIN_OUTPUT, 0) /* (AC21) VOUT0_DATA13 */
    			AM62PX_IOPAD(0x00f0, PIN_OUTPUT, 0) /* (AA20) VOUT0_DATA14 */
    			AM62PX_IOPAD(0x00f4, PIN_OUTPUT, 0) /* (Y20) VOUT0_DATA15 */
    			AM62PX_IOPAD(0x005c, PIN_OUTPUT, 1) /* (AC25) GPMC0_AD8.VOUT0_DATA16 */
    			AM62PX_IOPAD(0x0060, PIN_OUTPUT, 1) /* (AB25) GPMC0_AD9.VOUT0_DATA17 */
    			AM62PX_IOPAD(0x0064, PIN_OUTPUT, 1) /* (AA25) GPMC0_AD10.VOUT0_DATA18 */
    			AM62PX_IOPAD(0x0068, PIN_OUTPUT, 1) /* (W24) GPMC0_AD11.VOUT0_DATA19 */
    			AM62PX_IOPAD(0x006c, PIN_OUTPUT, 1) /* (Y24) GPMC0_AD12.VOUT0_DATA20 */
    			AM62PX_IOPAD(0x0070, PIN_OUTPUT, 1) /* (AD25) GPMC0_AD13.VOUT0_DATA21 */
    			AM62PX_IOPAD(0x0074, PIN_OUTPUT, 1) /* (AB24) GPMC0_AD14.VOUT0_DATA22 */
    			AM62PX_IOPAD(0x0078, PIN_OUTPUT, 1) /* (AC24) GPMC0_AD15.VOUT0_DATA23 */
    			AM62PX_IOPAD(0x009c, PIN_OUTPUT, 1) /* (AD24) GPMC0_WAIT1.VOUT0_EXTPCLKIN */
    		>;
    	};
    };
    
    &main_i2c0 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_i2c0_pins_default>, <&mygpio0_pins_default>, <&mygpio1_pins_default>;
    	clock-frequency = <400000>;
    
    #if 0
    	typec_pd0: usb-power-controller@3f {
    		compatible = "ti,tps6598x";
    		reg = <0x3f>;
    
    		connector {
    			compatible = "usb-c-connector";
    			label = "USB-C";
    			self-powered;
    			data-role = "dual";
    			power-role = "sink";
    			ports {
    				#address-cells = <1>;
    				#size-cells = <0>;
    				port@0 {
    					reg = <0>;
    					usb_con_hs: endpoint {
    						remote-endpoint = <&usb0_hs_ep>;
    					};
    				};
    			};
    		};
    	};
    #endif
    };
    
    &main_i2c1 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_i2c1_pins_default>;
    	clock-frequency = <100000>;
    	bootph-all;
    
    #if 0
    	tlv320aic3106: audio-codec@1b {
    		#sound-dai-cells = <0>;
    		compatible = "ti,tlv320aic3106";
    		reg = <0x1b>;
    		ai3x-micbias-vg = <1>;  /* 2.0V */
    	};
    
    	exp1: gpio@22 {
    		compatible = "ti,tca6424";
    		reg = <0x22>;
    		gpio-controller;
    		#gpio-cells = <2>;
    		gpio-line-names = "OLDI_INT#", "x8_NAND_DETECT",
    				   "UART1_FET_SEL", "MMC1_SD_EN",
    				   "VPP_EN", "EXP_PS_3V3_EN",
    				   "UART1_FET_BUF_EN", "EXP_HAT_DETECT",
    				   "DSI_GPIO0", "DSI_GPIO1",
    				   "OLDI_EDID", "BT_UART_WAKE_SOC_3V3",
    				   "USB_TYPEA_OC_INDICATION", "CSI_GPIO0",
    				   "CSI_GPIO1", "WLAN_ALERTn",
    				   "HDMI_INTn", "TEST_GPIO2",
    				   "MCASP1_FET_EN", "MCASP1_BUF_BT_EN",
    				   "MCASP1_FET_SEL", "DSI_EDID",
    				   "PD_I2C_IRQ", "IO_EXP_TEST_LED";
    
    		interrupt-parent = <&main_gpio1>;
    		interrupts = <23 IRQ_TYPE_EDGE_FALLING>;
    		interrupt-controller;
    		#interrupt-cells = <2>;
    
    		pinctrl-names = "default";
    		pinctrl-0 = <&main_gpio1_ioexp_intr_pins_default>;
    		bootph-all;
    	};
    
    	exp2: gpio@23 {
    		compatible = "ti,tca6424";
    		reg = <0x23>;
    		gpio-controller;
    		#gpio-cells = <2>;
    		gpio-line-names = "BT_EN_SOC", "EXP_PS_5V0_EN",
    				   "", "",
    				   "", "",
    				   "", "",
    				   "WL_LT_EN", "",
    				   "TP3", "TP6",
    				   "TP4", "TP7",
    				   "TP5", "TP8",
    				   "SoC_I2C2_MCAN_SEL", "GPIO_HDMI_RSTn",
    				   "GPIO_CPSW2_RST", "GPIO_CPSW1_RST",
    				   "GPIO_OLDI_RSTn", "GPIO_AUD_RSTn",
    				   "GPIO_eMMC_RSTn", "SoC_WLAN_SDIO_RST";
    	};
    
    	sii9022: bridge-hdmi@3b {
    		compatible = "sil,sii9022";
    		reg = <0x3b>;
    		interrupt-parent = <&exp1>;
    		interrupts = <16 IRQ_TYPE_EDGE_FALLING>;
    		#sound-dai-cells = <0>;
    		sil,i2s-data-lanes = < 0 >;
    
    		hdmi_tx_ports: ports {
    			#address-cells = <1>;
    			#size-cells = <0>;
    
    			/*
    			 * HDMI can be serviced with 3 potential VPs -
    			 * (DSS0 VP1 / DSS1 VP0 / DSS1 VP1).
    			 * For now, we will service it with DSS0 VP1.
    			 */
    			port@0 {
    				reg = <0>;
    
    				sii9022_in: endpoint {
    					remote-endpoint = <&dss0_dpi1_out>;
    				};
    			};
    
    			port@1 {
    				reg = <1>;
    
    				sii9022_out: endpoint {
    					remote-endpoint = <&hdmi_connector_in>;
    				};
    			};
    		};
    	};
    #endif
    };
    
    &main_i2c2 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_i2c2_pins_default>;
    	clock-frequency = <400000>;
    };
    
    &sdhci0 {
    	status = "okay";
    	ti,driver-strength-ohm = <50>;
    	disable-wp;
    	bootph-all;
    };
    
    &sdhci1 {
    	/* SD/MMC */
    	status = "okay";
    	vmmc-supply = <&vdd_mmc1>;
    	vqmmc-supply = <&vddshv_sdio>;
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_mmc1_pins_default>;
    	disable-wp;
            sdhci-caps-mask = <0x00000007 0x00000000>;
    	bootph-all;
    };
    
    &cpsw3g {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_rgmii1_pins_default>;
    	bootph-all;
    };
    
    &cpsw_port1 {
    	phy-mode = "rgmii-rxid";
    	phy-handle = <&cpsw3g_phy0>;
    	bootph-all;
    };
    
    &cpsw_port2 {
    	phy-mode = "rgmii-rxid";
    	phy-handle = <&cpsw3g_phy1>;
    	bootph-all;
    };
    
    &cpsw3g_mdio {
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_mdio1_pins_default>;
        reset-gpios = <&main_gpio1 5 GPIO_ACTIVE_LOW>;
        reset-delay-us = <10000>;
    	status = "okay";
    	bootph-all;
    
    	cpsw3g_phy0: ethernet-phy@0 {
    		reg = <0>;
    		ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
    		ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
    		ti,min-output-impedance;
    	};
    
    	cpsw3g_phy1: ethernet-phy@1 {
    		reg = <1>;
    		ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
    		ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
    		ti,min-output-impedance;
    	};
    };
    
    &usbss0 {
    	status = "okay";
    	ti,vbus-divider;
    };
    
    &usbss1 {
    	status = "okay";
    	ti,vbus-divider;
    };
    
    &usb0 {
    	usb-role-switch;
    	#address-cells = <1>;
    	#size-cells = <0>;
    
    #if 0
    	port@0 {
    		reg = <0>;
    		usb0_hs_ep: endpoint {
    			remote-endpoint = <&usb_con_hs>;
    		};
    	};
    #endif
    };
    
    &usb1 {
    	dr_mode = "host";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_usb1_pins_default>;
    };
    
    &mcasp1 {
    	status = "okay";
    	#sound-dai-cells = <0>;
    
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_mcasp1_pins_default>;
    
    	op-mode = <0>;          /* MCASP_IIS_MODE */
    	tdm-slots = <2>;
    
    	serial-dir = <  /* 0: INACTIVE, 1: TX, 2: RX */
    	       1 0 2 0
    	       0 0 0 0
    	       0 0 0 0
    	       0 0 0 0
    	>;
    	tx-num-evt = <0>;
    	rx-num-evt = <0>;
    };
    
    &fss {
    	bootph-all;
    };
    
    &ospi0 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&qspi0_pins_default>;
    	bootph-all;
    
    #if 0
    	flash@0{
    		compatible = "jedec,spi-nor";
    		reg = <0x0>;
    		spi-tx-bus-width = <8>;
    		spi-rx-bus-width = <8>;
    		spi-max-frequency = <25000000>;
    		cdns,tshsl-ns = <60>;
    		cdns,tsd2d-ns = <60>;
    		cdns,tchsh-ns = <60>;
    		cdns,tslch-ns = <60>;
    		cdns,read-delay = <4>;
    		bootph-all;
    
    		partitions {
    			compatible = "fixed-partitions";
    			#address-cells = <1>;
    			#size-cells = <1>;
    			bootph-all;
    
    			partition@0 {
    				label = "ospi.tiboot3";
    				reg = <0x00 0x80000>;
    			};
    
    			partition@80000 {
    				label = "ospi.tispl";
    				reg = <0x80000 0x200000>;
    			};
    
    			partition@280000 {
    				label = "ospi.u-boot";
    				reg = <0x280000 0x400000>;
    			};
    
    			partition@680000 {
    				label = "ospi.env";
    				reg = <0x680000 0x40000>;
    			};
    
    			partition@6c0000 {
    				label = "ospi.env.backup";
    				reg = <0x6c0000 0x40000>;
    			};
    
    			partition@800000 {
    				label = "ospi.rootfs";
    				reg = <0x800000 0x37c0000>;
    			};
    
    			partition@3fc0000 {
    				label = "ospi.phypattern";
    				reg = <0x3fc0000 0x40000>;
    				bootph-all;
    			};
    		};
    	};
    #else
    	flash@0{
    		compatible = "jedec,spi-nor";
    		reg = <0x0>;
    		spi-tx-bus-width = <1>;
    		spi-rx-bus-width = <4>;
    		spi-max-frequency = <40000000>;
    		cdns,tshsl-ns = <60>;
    		cdns,tsd2d-ns = <60>;
    		cdns,tchsh-ns = <60>;
    		cdns,tslch-ns = <60>;
    		cdns,read-delay = <2>;
    		bootph-all;
    
    		partitions {
    			compatible = "fixed-partitions";
    			#address-cells = <1>;
    			#size-cells = <1>;
    			bootph-all;
    
    			partition@0 {
    				label = "ospi.tiboot3.stage1";
    				reg = <0x00 0x60000>;
    			};
    			partition@1 {
    				label = "ospi.tiboot3.stage2";
    				reg = <0x60000 0x60000>;
    			};
    			partition@2 {
    				label = "ospi.misc";
    				reg = <0xc0000 0x40000>;
    			};
    			partition@3 {
    				label = "ospi.mcu-app_a";
    				reg = <0x100000 0x100000>;
    			};
    			partition@4 {
    				label = "ospi.boot_a";
    				reg = <0x200000 0x100000>;
    			};
    			partition@5 {
    				label = "ospi.mcu-app_b";
    				reg = <0x300000 0x100000>;
    			};
    			partition@6 {
    				label = "ospi.boot_b";
    				reg = <0x400000 0x100000>;
    			};
    			partition@7 {
    				label = "ospi.HSM";
    				reg = <0x500000 0x100000>;
    			};
    			partition@8 {
    				label = "ospi.phypattern";
    				reg = <0x600000 0x200000>;
    			};
    			partition@9 {
    				label = "ospi.all";
    				reg = <0x000000 0x800000>;
    			};
    		};
    	};
    #endif
    };
    
    &mailbox0_cluster0 {
    	mbox_r5_0: mbox-r5-0 {
    		ti,mbox-rx = <0 0 0>;
    		ti,mbox-tx = <1 0 0>;
    	};
    };
    
    &mailbox0_cluster1 {
    	mbox_mcu_r5_0: mbox-mcu-r5-0 {
    		ti,mbox-rx = <0 0 0>;
    		ti,mbox-tx = <1 0 0>;
    	};
    };
    
    &wkup_r5fss0 {
    	status = "okay";
    };
    
    &wkup_r5fss0_core0 {
    	mboxes = <&mailbox0_cluster0 &mbox_r5_0>;
    	memory-region = <&wkup_r5fss0_core0_dma_memory_region>,
    			<&wkup_r5fss0_core0_memory_region>;
    };
    
    &mcu_r5fss0 {
    	status = "okay";
    };
    
    &mcu_r5fss0_core0 {
    	mboxes = <&mailbox0_cluster1 &mbox_mcu_r5_0>;
    	memory-region = <&mcu_r5fss0_core0_dma_memory_region>,
    			<&mcu_r5fss0_core0_memory_region>;
    };
    
    &main_uart0 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_uart0_pins_default>;
    	interrupts-extended = <&gic500 GIC_SPI 178 IRQ_TYPE_LEVEL_HIGH>,
    			<&main_pmx0 0x1c8>; /* (D14) UART0_RXD PADCONFIG114 */
    	interrupt-names = "irq", "wakeup";
    	status = "okay";
    	bootph-all;
    };
    
    &main_uart1 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_uart1_pins_default>;
    	/* Main UART1 is used by TIFS firmware */
    	status = "reserved";
    	bootph-all;
    };
    
    &mcu_pmx0 {
    	bootph-all;
    
    	wkup_uart0_pins_default: wkup-uart0-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_MCU_IOPAD(0x024, PIN_INPUT, 0)	/* (D8) WKUP_UART0_RXD */
    			AM62PX_MCU_IOPAD(0x028, PIN_OUTPUT, 0)	/* (D7) WKUP_UART0_TXD */
    		>;
    		bootph-all;
    	};
    };
    
    &wkup_uart0 {
    	/* WKUP UART0 is used by DM firmware */
    	pinctrl-names = "default";
    	pinctrl-0 = <&wkup_uart0_pins_default>;
    	status = "reserved";
    	bootph-all;
    };
    
    /* mcu_gpio0 and mcu_gpio_intr are reserved for mcu firmware usage */
    &mcu_gpio0 {
    	status = "reserved";
    };
    
    &mcu_gpio_intr {
    	status = "reserved";
    };
    
    &dss_oldi_io_ctrl {
    	bootph-all;
    };
    
    &dss0 {
    	bootph-all;
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_dpi_pins_default>;
    };
    
    &dss0_ports {
    	/* DSS0-VP2: DPI/HDMI Output */
    	hdmi0_dss: port@1 {
    		reg = <1>;
    
    #if 0
    		dss0_dpi1_out: endpoint {
    			remote-endpoint = <&sii9022_in>;
    		};
    #endif
    	};
    };
    
    #if 0
    &cpus {
                    /delete-node/ cpu@1;
                    /delete-node/ cpu@2;
                    /delete-node/ cpu@3;
    };
    
    &cluster0 {
                    /delete-node/ core1;
                    /delete-node/ core2;
                    /delete-node/ core3;
    };
    #endif
    &main_rti1 {
    	status = "disabled";
    };
    
    &main_rti2 {
    	status = "disabled";
    };
    
    &main_rti3 {
    	status = "disabled";
    };
    &codec_audio {
    	status = "disabled";
    };
    &usbss0 {
    	status = "disabled";
    };
    
    &usbss1 {
    	status = "disabled";
    };
    &mcasp1 {
    	status = "disabled";
    };
    
    &main_i2c1 {
    	#address-cells = <1>;
    	#size-cells = <0>;
    	status = "okay";
    
    	deser@27 {
    		compatible = "ti,ds90ub960-q1";
    		reg = <0x27>;
    
    		clock-names = "refclk";
    		clocks = <&clk_fusion_25M_fixed>;
    
    		i2c-alias-pool = <0x4a 0x4b 0x4c 0x4d 0x4e 0x4f>;
    
    		ports {
    			#address-cells = <1>;
    			#size-cells = <0>;
    
    			port@0 {
    				reg = <0>;
    				ub960_fpd3_0_in: endpoint {
    					remote-endpoint = <&ub953_0_out>;
    				};
    			};
    
    			port@1 {
    				reg = <1>;
    				ub960_fpd3_1_in: endpoint {
    					remote-endpoint = <&ub953_1_out>;
    				};
    			};
    
    			port@2 {
    				reg = <2>;
    				ub960_fpd3_2_in: endpoint {
    					remote-endpoint = <&ub953_2_out>;
    				};
    			};
    
    			port@3 {
    				reg = <3>;
    				ub960_fpd3_3_in: endpoint {
    					remote-endpoint = <&ub953_3_out>;
    				};
    			};
    
    			port@4 {
    				reg = <4>;
    				ds90ub960_0_csi_out: endpoint {
    					data-lanes = <1 2 3 4>;
    					clock-lanes = <0>;
    					link-frequencies = /bits/ 64 <800000000>;
    					remote-endpoint = <&csi2_phy0>;
    				};
    			};
    		};
    
    		links {
    			#address-cells = <1>;
    			#size-cells = <0>;
    
    			link@0 {
    				reg = <0>;
                    		i2c-alias = <0x40>;
    
    				ti,rx-mode = <3>;
    
    				serializer0: serializer {
    					compatible = "ti,ds90ub953-q1";
    					gpio-controller;
    					#gpio-cells = <2>;
    
    					#clock-cells = <0>;
    
    					ports {
    						#address-cells = <1>;
    						#size-cells = <0>;
    
    						port@0 {
    							reg = <0>;
    							ub953_0_in: endpoint {
    								clock-lanes = <0>;
    								data-lanes = <1 2>;
    								remote-endpoint = <&sensor_0_out>;
    							};
    						};
    
    						port@1 {
    							reg = <1>;
    							ub953_0_out: endpoint {
    								remote-endpoint = <&ub960_fpd3_0_in>;
    							};
    						};
    					};
    
    					i2c {
    						#address-cells = <1>;
    						#size-cells = <0>;
    
    						imx219_0@10 {
    							compatible = "sony,imx219";
    							reg = <0x10>;
    
    							clocks = <&clk_imx219_fixed_00>;
    							clock-names = "xclk";
    
    							port {
    								sensor_0_out: endpoint {
    									remote-endpoint = <&ub953_0_in>;
    									link-frequencies = /bits/ 64 <456000000>;
    									clock-lanes = <0>;
    									data-lanes = <1 2>;
    								};
    							};
    						};
    					};
    				};
    			};
    
    			link@1 {
    				reg = <1>;
    				i2c-alias = <0x45>;
    
    				ti,rx-mode = <3>;
    
    				serializer1: serializer {
    					compatible = "ti,ds90ub953-q1";
    					gpio-controller;
    					#gpio-cells = <2>;
    
    					#clock-cells = <0>;
    
    					ports {
    						#address-cells = <1>;
    						#size-cells = <0>;
    
    						port@0 {
    							reg = <0>;
    							ub953_1_in: endpoint {
    								clock-lanes = <0>;
    								data-lanes = <1 2>;
    								remote-endpoint = <&sensor_1_out>;
    							};
    						};
    
    						port@1 {
    							reg = <1>;
    							ub953_1_out: endpoint {
    								remote-endpoint = <&ub960_fpd3_1_in>;
    							};
    						};
    					};
    
    					i2c {
    						#address-cells = <1>;
    						#size-cells = <0>;
    
    						imx219_1@10 {
    							compatible = "sony,imx219";
    							reg = <0x10>;
    
    							clocks = <&clk_imx219_fixed_01>;
    							clock-names = "xclk";
    
    							port {
    								sensor_1_out: endpoint {
    									remote-endpoint = <&ub953_1_in>;
    									link-frequencies = /bits/ 64 <456000000>;
    									clock-lanes = <0>;
    									data-lanes = <1 2>;
    								};
    							};
    						};
    					};
    				};
    			};
    
    			link@2 {
    				reg = <2>;
    				i2c-alias = <0x46>;
    
    				ti,rx-mode = <3>;
    
    				serializer2: serializer {
    					compatible = "ti,ds90ub953-q1";
    					gpio-controller;
    					#gpio-cells = <2>;
    
    					#clock-cells = <0>;
    
    					ports {
    						#address-cells = <1>;
    						#size-cells = <0>;
    
    						port@0 {
    							reg = <0>;
    							ub953_2_in: endpoint {
    								clock-lanes = <0>;
    								data-lanes = <1 2>;
    								remote-endpoint = <&sensor_2_out>;
    							};
    						};
    
    						port@1 {
    							reg = <1>;
    							ub953_2_out: endpoint {
    								remote-endpoint = <&ub960_fpd3_2_in>;
    							};
    						};
    					};
    
    					i2c {
    						#address-cells = <1>;
    						#size-cells = <0>;
    
    						imx219_2@10 {
    							compatible = "sony,imx219";
    							reg = <0x10>;
    
    							clocks = <&clk_imx219_fixed_02>;
    							clock-names = "xclk";
    
    							port {
    								sensor_2_out: endpoint {
    									remote-endpoint = <&ub953_2_in>;
    									link-frequencies = /bits/ 64 <456000000>;
    									clock-lanes = <0>;
    									data-lanes = <1 2>;
    								};
    							};
    						};
    					};
    				};
    			};
    
    			link@3 {
    				reg = <3>;
    				i2c-alias = <0x47>;
    
    				ti,rx-mode = <3>;
    
    				serializer3: serializer {
    					compatible = "ti,ds90ub953-q1";
    					gpio-controller;
    					#gpio-cells = <2>;
    
    					#clock-cells = <0>;
    
    					ports {
    						#address-cells = <1>;
    						#size-cells = <0>;
    
    						port@0 {
    							reg = <0>;
    							ub953_3_in: endpoint {
    								clock-lanes = <0>;
    								data-lanes = <1 2>;
    								remote-endpoint = <&sensor_3_out>;
    							};
    						};
    
    						port@1 {
    							reg = <1>;
    							ub953_3_out: endpoint {
    								remote-endpoint = <&ub960_fpd3_3_in>;
    							};
    						};
    					};
    
    					i2c {
    						#address-cells = <1>;
    						#size-cells = <0>;
    
    						imx219_3@10 {
    							compatible = "sony,imx219";
    							reg = <0x10>;
    
    							clocks = <&clk_imx219_fixed_03>;
    							clock-names = "xclk";
    
    							port {
    								sensor_3_out: endpoint {
    									remote-endpoint = <&ub953_3_in>;
    									link-frequencies = /bits/ 64 <456000000>;
    									clock-lanes = <0>;
    									data-lanes = <1 2>;
    								};
    							};
    						};
    					};
    				};
    			};
    		};
    	};
    };
    
    
    &cdns_csi2rx0 {
    	ports {
    		#address-cells = <1>;
    		#size-cells = <0>;
    
    		csi0_port0: port@0 {
    			reg = <0>;
    			status = "okay";
    
    			csi2_phy0: endpoint {
    				remote-endpoint = <&ds90ub960_0_csi_out>;
    				data-lanes = <1 2 3 4>;
    				clock-lanes = <0>;
    				link-frequencies = /bits/ 64 <800000000>;
    			};
    		};
    	};
    };
    
    &ti_csi2rx0 {
    	status = "okay";
    };
    
    &dphy0 {
    	status = "okay";
    };
    
     not modify kernel.

    2. using the Makefile in the SDK

    3.no modification of GPU driver

    4.only alloc without free,because as the output of the GPU, this cache has been continuously used. The method of alloc memory refers to the API 

    appEglBindFrameBuffer in the TDA4 SDK.
    app_gl_egl_utils_linux.c
    /*
    Copyright (c) [2012 - 2019] Texas Instruments Incorporated
    
    All rights reserved not granted herein.
    
    Limited License.
    
     Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
     license under copyrights and patents it now or hereafter owns or controls to
     make,  have made, use, import, offer to sell and sell ("Utilize") this software
     subject to the terms herein.  With respect to the foregoing patent license,
     such license is granted  solely to the extent that any such patent is necessary
     to Utilize the software alone.  The patent license shall not apply to any
     combinations which include this software, other than combinations with devices
     manufactured by or for TI ("TI Devices").  No hardware patent is licensed
     hereunder.
    
     Redistributions must preserve existing copyright notices and reproduce this
     license (including the above copyright notice and the disclaimer and
     (if applicable) source code license limitations below) in the documentation
     and/or other materials provided with the distribution
    
     Redistribution and use in binary form, without modification, are permitted
     provided that the following conditions are met:
    
     * No reverse engineering, decompilation, or disassembly of this software
       is permitted with respect to any software provided in binary form.
    
     * Any redistribution and use are licensed by TI for use only with TI Devices.
    
     * Nothing shall obligate TI to provide you with source code for the software
       licensed and provided to you in object code.
    
     If software source code is provided to you, modification and redistribution of
     the source code are permitted provided that the following conditions are met:
    
     * Any redistribution and use of the source code, including any resulting
       derivative works, are licensed by TI for use only with TI Devices.
    
     * Any redistribution and use of any object code compiled from the source code
       and any resulting derivative works, are licensed by TI for use only with TI
       Devices.
    
     Neither the name of Texas Instruments Incorporated nor the names of its
     suppliers may be used to endorse or promote products derived from this software
     without specific prior written permission.
    
     DISCLAIMER.
    
     THIS SOFTWARE IS PROVIDED BY TI AND TI?S LICENSORS "AS IS" AND ANY EXPRESS OR
     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     IN NO EVENT SHALL TI AND TI?S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
     OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
     ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */
    
    #include <stdlib.h>
    #include <stdio.h>
    #include <string.h>
    
    #ifndef x86_64
    #include <fcntl.h>
    #include <unistd.h>
    #include <gbm.h>
    #include <xf86drm.h>
    #include <drm.h>
    #include <drm_fourcc.h>
    #endif
    
    #include <utils/opengl/include/app_gl_egl_utils.h>
    
    #define APP_EGL_MAX_TEXTURES        (20u)
    #define APP_EGL_MAX_RENDER_TEXTURES (20u)
    
    #define FOURCC(a, b, c, d) ((uint32_t)(uint8_t)(a) | ((uint32_t)(uint8_t)(b) << 8) | ((uint32_t)(uint8_t)(c) << 16) | ((uint32_t)(uint8_t)(d) << 24 ))
    #define FOURCC_STR(str)    FOURCC(str[0], str[1], str[2], str[3])
    
    typedef struct {
    
        uint32_t isAlloc;
        GLuint tex;
        EGLImageKHR img;
        GLuint   fboId;
        uint32_t dmaBufFd;
        uint32_t dmaBufFdOffset;
    
    } app_egl_tex_obj_t;
    
    typedef struct
    {
        EGLDisplay display;
        EGLNativeDisplayType nativeDisplay;
        EGLConfig config;
        EGLContext context;
        EGLSurface surface;
    
        app_egl_tex_obj_t texRender[APP_EGL_MAX_TEXTURES];
        app_egl_tex_obj_t tex[APP_EGL_MAX_TEXTURES];
    
        int drm_fd;
        struct gbm_device *gbm_dev;
        struct gbm_surface *gbm_surface;
        PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display;
        PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC create_platform_window_surface;
    
    } app_egl_obj_t;
    
    
    void appEglPrintGLString(const char *name, GLenum s)
    {
       const char *v = (const char *) glGetString(s);
    
       printf("EGL: GL %s = %s\n", name, v);
    }
    
    void appEglCheckGlError(const char* op)
    {
       GLint error;
    
       for (error = glGetError(); error; error = glGetError())
       {
           fprintf(stderr, "GL: after %s() glError (0x%x)\n", op, error);
       }
    }
    
    void appEglCheckEglError(const char* op, EGLBoolean returnVal)
    {
       EGLint error;
    
       if (returnVal != EGL_TRUE)
       {
           fprintf(stderr, "EGL: %s() returned %d\n", op, returnVal);
       }
    
       for (error = eglGetError(); error != EGL_SUCCESS; error = eglGetError())
       {
           fprintf(stderr, "EGL: after %s() eglError (0x%x)\n", op, error);
       }
    }
    
    static EGLBoolean has_extension(const char *const extensions_list,
            const char *const extension_searched)
    {
        const char *extension = extensions_list;
        const size_t extension_searched_length = strlen(extension_searched);
    
        if (!extension)
            return EGL_FALSE;
        if (!extension_searched_length)
            return EGL_TRUE;
    
        while (EGL_TRUE)
        {
            const size_t extension_length = strcspn(extension, " ");
    
            if (extension_length == extension_searched_length &&
                    strncmp(extension, extension_searched, extension_length) == 0)
            {
                return EGL_TRUE;
            }
    
            extension += extension_length;
    
            if ('\0' == *extension)
                return EGL_FALSE;
    
            extension += 1;
        }
    }
    
    static void appEglWindowResetTex(app_egl_tex_obj_t *tex_obj)
    {
        tex_obj->isAlloc = 0;
        tex_obj->img = 0;
        tex_obj->tex = 0;
        tex_obj->fboId = -1;
        tex_obj->dmaBufFd = -1;
        tex_obj->dmaBufFdOffset = 0;
    }
    
    int32_t appEglWindowBindContext(void *eglWindow)
    {
        int32_t ret = 0;
    
        app_egl_obj_t *obj = (app_egl_obj_t*)eglWindow;
    
        ret = eglMakeCurrent(obj->display, obj->surface,
                            obj->surface, obj->context);
        appEglCheckEglError("eglMakeCurrent", ret);
        if (ret != EGL_TRUE)
        {
            printf("EGL: ERROR: eglMakeCurrent() failed !!!\n");
        }
    
        return ret;
    }
    
    void *appEglWindowOpen()
    {
        const char *egl_platform_extensions;
        EGLint num_configs;
        EGLint majorVersion;
        EGLint minorVersion;
        int32_t ret = 0;
        uint32_t count;
    
        const EGLint attribs[] = {
           EGL_RED_SIZE, 8,
           EGL_GREEN_SIZE, 8,
           EGL_BLUE_SIZE, 8,
           EGL_ALPHA_SIZE, 8,
           EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
           EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT_KHR,
           EGL_DEPTH_SIZE, 16,
           EGL_NONE
        };
    
        EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE };
    
        app_egl_obj_t *obj;
    
        obj = malloc(sizeof(app_egl_obj_t));
        if(obj==NULL)
        {
            goto goto_error;
        }
        obj->drm_fd = -1;
        obj->gbm_dev = NULL;
        obj->gbm_surface = NULL;
        obj->surface = EGL_NO_SURFACE;
    
        for(count=0; count < APP_EGL_MAX_TEXTURES; count++)
        {
            appEglWindowResetTex(&obj->tex[count]);
        }
        for(count=0; count < APP_EGL_MAX_RENDER_TEXTURES; count++)
        {
            appEglWindowResetTex(&obj->texRender[count]);
        }
    
        obj->get_platform_display = (void *) eglGetProcAddress("eglGetPlatformDisplayEXT");
        if(!obj->get_platform_display)
        {
            printf("EGL: ERROR: eglGetProcAddress(\"eglGetPlatformDisplayEXT\") failed !!!\n");
            goto destroy_gbm_surface;
        }
    
        egl_platform_extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
    
        if (has_extension(egl_platform_extensions, "EGL_MESA_platform_surfaceless"))
        {
            obj->display = obj->get_platform_display(EGL_PLATFORM_SURFACELESS_MESA,
                    EGL_DEFAULT_DISPLAY, NULL);
        }
        else
        {
            obj->drm_fd = open("/dev/dri/by-path/platform-4a00000.dss-card", O_RDWR);
            if(obj->drm_fd < 0)
            {
                printf("EGL: ERROR: drmOpen() failed !!!\n");
                goto goto_error;
            }
    
            obj->gbm_dev = gbm_create_device(obj->drm_fd);
            if(!obj->gbm_dev)
            {
                printf("EGL: ERROR: gbm_create_device() failed !!!\n");
                goto close_fd;
            }
    
            obj->gbm_surface = gbm_surface_create(obj->gbm_dev,
                    1920, 1080, GBM_FORMAT_XRGB8888,
                    GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
            if(!obj->gbm_surface)
            {
                printf("EGL: ERROR: gbm_urface_create() failed !!!\n");
                goto destroy_gbm_device;
            }
    
    
            obj->create_platform_window_surface = (void *) eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT");
            if(!obj->create_platform_window_surface)
            {
                printf("EGL: ERROR: eglGetProcAddress(\"eglCreatePlatformWindowSurfaceEXT\") failed !!!\n");
                goto destroy_gbm_surface;
            }
    
            obj->display = obj->get_platform_display(EGL_PLATFORM_GBM_KHR, obj->gbm_dev, NULL);
            appEglCheckEglError("eglGetDisplay", EGL_TRUE);
            if (obj->display == EGL_NO_DISPLAY)
            {
                printf("EGL: ERROR: eglGetDisplay() returned EGL_NO_DISPLAY !!!\n");
                goto destroy_gbm_surface;
            }
        }
    
        ret = eglInitialize(obj->display, &majorVersion, &minorVersion);
        appEglCheckEglError("eglInitialize", ret);
        if (ret != EGL_TRUE)
        {
            printf("EGL: ERROR: eglInitialize() failed !!!\n");
            goto terminate_display;
        }
        printf("EGL: version %d.%d\n", majorVersion, minorVersion);
    
        if (!eglBindAPI(EGL_OPENGL_ES_API))
        {
            printf("EGL: ERROR: eglBindAPI(EGL_OPENGL_ES_API) failed !!!\n");
            goto terminate_display;
        }
    
        if (obj->gbm_surface)
        {
            if (!eglChooseConfig(obj->display, attribs, &obj->config, 1, &num_configs))
            {
                printf("EGL: eglChooseConfig() failed. Couldn't get an EGL visual config !!!\n");
                goto terminate_display;
            }
    
            obj->context = eglCreateContext(obj->display, obj->config, EGL_NO_CONTEXT, context_attribs);
        }
        else
        {
            /* with surfaceless platform, there is no need for config */
            obj->context = eglCreateContext(obj->display, EGL_NO_CONFIG_KHR,
                    EGL_NO_CONTEXT, context_attribs);
        }
        appEglCheckEglError("eglCreateContext", EGL_TRUE);
        if (obj->context == EGL_NO_CONTEXT)
        {
            printf("EGL: ERROR: eglCreateContext() failed !!!\n");
            goto terminate_display;
        }
    
        appEglPrintGLString("Version", GL_VERSION);
        appEglPrintGLString("Vendor", GL_VENDOR);
        appEglPrintGLString("Renderer", GL_RENDERER);
        appEglPrintGLString("Extensions", GL_EXTENSIONS);
    
        if (obj->gbm_surface)
        {
            obj->surface = obj->create_platform_window_surface(obj->display, obj->config, obj->gbm_surface, NULL);
            appEglCheckEglError("eglCreateWindowSurface", EGL_TRUE);
            if (obj->surface == EGL_NO_SURFACE)
            {
                printf("EGL: ERROR: eglCreateWindowSurface() failed !!!\n");
                goto destroy_context;
            }
        }
    
        ret = eglMakeCurrent(obj->display, obj->surface,
                            obj->surface, obj->context);
        appEglCheckEglError("eglMakeCurrent", ret);
        if (ret != EGL_TRUE)
        {
            printf("EGL: ERROR: eglMakeCurrent() failed !!!\n");
            goto destroy_surface;
        }
    
        return obj;
    
    destroy_surface:
        if (obj->surface != EGL_NO_SURFACE)
            eglDestroySurface(obj->display, obj->surface);
    destroy_context:
        eglDestroyContext(obj->display, obj->context);
    terminate_display:
        eglTerminate(obj->display);
    destroy_gbm_surface:
        if (obj->gbm_surface)
            gbm_surface_destroy(obj->gbm_surface);
    destroy_gbm_device:
        if (obj->gbm_dev)
            gbm_device_destroy(obj->gbm_dev);
    close_fd:
        if (obj->drm_fd != -1)
            close(obj->drm_fd);
    goto_error:
        if (obj)
            free(obj);
    
        return NULL;
    }
    
    void appEglSwap(void *eglWindow)
    {
        app_egl_obj_t *obj = (app_egl_obj_t*)eglWindow;
    
        if(obj)
        {
            eglSwapBuffers(obj->display, obj->surface);
            appEglCheckGlError("eglSwapBuffers");
    
            if (obj->gbm_surface)
            {
                struct gbm_bo *bo = gbm_surface_lock_front_buffer(obj->gbm_surface);
                gbm_surface_release_buffer(obj->gbm_surface, bo);
            }
        }
    }
    
    static EGLImageKHR appEglWindowCreateIMG(app_egl_obj_t *obj,
            app_egl_tex_prop_t *prop)
    {
        int32_t attrIdx = 0;
        EGLImageKHR image;
        EGLint attr[32];
        PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
    
        uint32_t num_planes = 1;
    
        if(prop->dataFormat==APP_EGL_DF_NV12)
        {
            num_planes = 2;
        }
    
        attr[attrIdx++] = EGL_LINUX_DRM_FOURCC_EXT;
        if (prop->dataFormat == APP_EGL_DF_NV12)
            attr[attrIdx++] = FOURCC_STR("NV12");
        else if (prop->dataFormat == APP_EGL_DF_YUYV)
            attr[attrIdx++] = FOURCC_STR("YUYV");
        else if (prop->dataFormat == APP_EGL_DF_UYVY)
            attr[attrIdx++] = FOURCC_STR("UYVY");
        else
            attr[attrIdx++] = FOURCC_STR("AB24");
    
        attr[attrIdx++] = EGL_WIDTH;
        attr[attrIdx++] = prop->width;
    
        attr[attrIdx++] = EGL_HEIGHT;
        attr[attrIdx++] = prop->height;
    
        attr[attrIdx++] = EGL_DMA_BUF_PLANE0_PITCH_EXT;
        attr[attrIdx++] = prop->pitch[0];
    
        if (num_planes>1)
        {
            attr[attrIdx++] = EGL_DMA_BUF_PLANE1_PITCH_EXT;
            attr[attrIdx++] = prop->pitch[1];
        }
    
        attr[attrIdx++] = EGL_DMA_BUF_PLANE0_OFFSET_EXT;
        attr[attrIdx++] = prop->dmaBufFdOffset[0];
    
        if (num_planes>1)
        {
            attr[attrIdx++] = EGL_DMA_BUF_PLANE1_OFFSET_EXT;
            attr[attrIdx++] = prop->dmaBufFdOffset[1];
        }
    
        attr[attrIdx++] = EGL_DMA_BUF_PLANE0_FD_EXT;
        attr[attrIdx++] = prop->dmaBufFd[0];
    
        if (num_planes>1)
        {
            attr[attrIdx++] = EGL_DMA_BUF_PLANE1_FD_EXT;
            attr[attrIdx++] = prop->dmaBufFd[1];
        }
    
        attr[attrIdx++] = EGL_NONE;
    
        eglCreateImageKHR =
            (PFNEGLCREATEIMAGEKHRPROC)eglGetProcAddress("eglCreateImageKHR");
    
        EGLDisplay disp = eglGetCurrentDisplay();
        appEglCheckEglError("eglGetCurrentDisplay()", EGL_TRUE);
        image = eglCreateImageKHR(disp, EGL_NO_CONTEXT,
                                    EGL_LINUX_DMA_BUF_EXT, NULL, attr);
        appEglCheckEglError("eglCreateImageKHR", EGL_TRUE);
    
        if (image == EGL_NO_IMAGE_KHR) {
            printf("EGL: ERROR: eglCreateImageKHR failed !!!\n");
        }
    
        return image;
    }
    
    /* target_type should be one of
     *   - GL_TEXTURE_2D
     *   - GL_TEXTURE_EXTERNAL_OES
     */
    static GLuint appEglWindowCreateTexture(GLint target_type)
    {
        GLuint texId;
    
        glGenTextures(1, &texId);
        appEglCheckGlError("glGenTextures");
    
        glBindTexture(target_type, texId);
        appEglCheckGlError("glBindTexture");
    
        glTexParameteri(target_type, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
        glTexParameteri(target_type, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
        appEglCheckGlError("glTexParameteri");
    
        return texId;
    }
    
    static int32_t appEglWindowSetupRenderTex(app_egl_obj_t *obj,
                            app_egl_tex_prop_t *prop, int32_t index)
    {
        int32_t status = 0;
        app_egl_tex_obj_t *tex_obj;
    
        tex_obj = &obj->texRender[index];
    
        appEglWindowResetTex(tex_obj);
    
        tex_obj->img = appEglWindowCreateIMG(obj, prop);
        if (tex_obj->img == EGL_NO_IMAGE_KHR) {
            printf("EGL: ERROR: appEglWindowCreateIMG failed !!!\n");
            status = -1;
        }
    
        if(status==0)
        {
            tex_obj->tex = appEglWindowCreateTexture(GL_TEXTURE_2D);
    
            glGenFramebuffers(1, &tex_obj->fboId);
            appEglCheckEglError("glGenFramebuffers", EGL_TRUE);
    
            glBindFramebuffer(GL_FRAMEBUFFER, tex_obj->fboId);
            appEglCheckEglError("glBindFramebuffer", EGL_TRUE);
    
            GLuint rboDepthStencil;
            glGenRenderbuffers(1, &rboDepthStencil);
            glBindRenderbuffer(GL_RENDERBUFFER, rboDepthStencil);
            glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, prop->width, prop->height);
            glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rboDepthStencil);
            glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rboDepthStencil);
    
            tex_obj->dmaBufFd = prop->dmaBufFd[0];
            tex_obj->dmaBufFdOffset = prop->dmaBufFdOffset[0];
            tex_obj->isAlloc = 1;
        }
    
        return status;
    }
    
    static int32_t appEglWindowSetupTex(app_egl_obj_t *obj, app_egl_tex_prop_t *prop, int32_t index)
    {
        PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
        int32_t status = 0;
        app_egl_tex_obj_t *tex_obj;
    
        tex_obj = &obj->tex[index];
    
        appEglWindowResetTex(tex_obj);
    
        glEGLImageTargetTexture2DOES =
            (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)eglGetProcAddress("glEGLImageTargetTexture2DOES");
    
        tex_obj->img = appEglWindowCreateIMG(obj, prop);
        if (tex_obj->img == EGL_NO_IMAGE_KHR) {
            printf("EGL: ERROR: appEglWindowCreateIMG failed !!!\n");
            status = -1;
        }
    
        if(status==0)
        {
            tex_obj->tex = appEglWindowCreateTexture(GL_TEXTURE_EXTERNAL_OES);
    
            glActiveTexture(GL_TEXTURE0);
            glBindTexture(GL_TEXTURE_EXTERNAL_OES, tex_obj->tex);
    
            glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, (GLeglImageOES)tex_obj->img);
            appEglCheckGlError("glEGLImageTargetTexture2DOES");
    
            tex_obj->dmaBufFd = prop->dmaBufFd[0];
            tex_obj->dmaBufFdOffset = prop->dmaBufFdOffset[0];
            tex_obj->isAlloc = 1;
        }
    
        return status;
    }
    
    /* Creates texture and eglimage objects
     */
    void appEglBindFrameBuffer(void *eglWindow, app_egl_tex_prop_t *prop)
    {
        int32_t texFound;
        int32_t texIndex;
        uint32_t i;
        PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
        PFNGLCLIPCONTROLEXTPROC glClipControlEXT;
        app_egl_obj_t *obj = (app_egl_obj_t*)eglWindow;
        app_egl_tex_obj_t *tex_obj;
    
        glEGLImageTargetTexture2DOES =
            (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)eglGetProcAddress("glEGLImageTargetTexture2DOES");
        glClipControlEXT =
                (PFNGLCLIPCONTROLEXTPROC)eglGetProcAddress("glClipControlEXT");
    
        texIndex = -1;
        texFound = 0;
    
        for(i = 0; i < APP_EGL_MAX_RENDER_TEXTURES; i++)
        {
            tex_obj = &obj->texRender[i];
    
            if(tex_obj->isAlloc
                && tex_obj->dmaBufFd == prop->dmaBufFd[0]
                && tex_obj->dmaBufFdOffset == prop->dmaBufFdOffset[0]
                )
            {
                texIndex = i;
                texFound = 1;
                break;
            }
        }
    
        if(!texFound)
        {
            /* find free slot amd create texture */
            for(i = 0; i < APP_EGL_MAX_RENDER_TEXTURES; i++)
            {
                tex_obj = &obj->texRender[i];
    
                if(!tex_obj->isAlloc)
                {
                    int32_t status;
    
                    status = appEglWindowSetupRenderTex(obj, prop, i);
                    if(status==0)
                    {
                        texIndex = i;
                        texFound = 1;
                    }
                    break;
                }
            }
        }
    
        if(texFound)
        {
            tex_obj = &obj->texRender[texIndex];
    
            glActiveTexture(GL_TEXTURE2);
            glBindTexture(GL_TEXTURE_2D, tex_obj->tex);
            appEglCheckEglError("glBindTexture", EGL_TRUE);
    
            glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES)tex_obj->img);
            appEglCheckEglError("glEGLImageTargetTexture2DOES", EGL_TRUE);
    
            glBindFramebuffer(GL_FRAMEBUFFER, tex_obj->fboId);
            appEglCheckEglError("glBindFramebuffer", EGL_TRUE);
    
            glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
                GL_TEXTURE_2D, tex_obj->tex, 0);
            appEglCheckEglError("glFramebufferTexture2D", EGL_TRUE);
    
            GLenum fbstatus = glCheckFramebufferStatus(GL_FRAMEBUFFER);
            if (fbstatus != GL_FRAMEBUFFER_COMPLETE)
                printf("EGL: ERROR: Frambuffer complete check failed 0x%x\n", fbstatus);
        }
        /* Binding FBO: move the origin to upper left */
        glClipControlEXT(GL_UPPER_LEFT_EXT, GL_NEGATIVE_ONE_TO_ONE_EXT);
    }
    
    GLuint appEglWindowGetTexYuv(void *eglWindow, app_egl_tex_prop_t *prop)
    {
        GLuint tex;
        int32_t texFound;
        uint32_t i;
        app_egl_obj_t *obj = (app_egl_obj_t*)eglWindow;
        app_egl_tex_obj_t *tex_obj;
    
        tex = 0;
        texFound = 0;
    
        for(i = 0; i < APP_EGL_MAX_TEXTURES; i++)
        {
            tex_obj = &obj->tex[i];
    
            if(tex_obj->isAlloc
                && tex_obj->dmaBufFd == prop->dmaBufFd[0]
                && tex_obj->dmaBufFdOffset == prop->dmaBufFdOffset[0]
                )
            {
                tex = tex_obj->tex;
                texFound = 1;
                break;
            }
        }
    
        if(!texFound)
        {
            /* find free slot amd create texture */
            for(i = 0; i < APP_EGL_MAX_TEXTURES; i++)
            {
                tex_obj = &obj->tex[i];
    
                if(!tex_obj->isAlloc)
                {
                    int32_t status;
    
                    status = appEglWindowSetupTex(obj, prop, i);
                    if(status==0)
                    {
                        tex = tex_obj->tex;
                    }
                    break;
                }
            }
        }
    
        return tex;
    }
    
    static void appEglWindowDestroyTex(app_egl_obj_t *obj, app_egl_tex_obj_t *tex_obj)
    {
        if(tex_obj->tex!=0)
        {
            glDeleteTextures(1, &tex_obj->tex);
            tex_obj->tex = 0;
        }
        if (tex_obj->img != 0)
        {
            PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
            eglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC)eglGetProcAddress("eglDestroyImageKHR");
    
            eglDestroyImageKHR(obj->display, tex_obj->img);
            tex_obj->img = 0;
        }
    }
    
    int32_t appEglWindowClose(void *eglWindow)
    {
        uint32_t count;
    
        app_egl_obj_t *obj = (app_egl_obj_t*)eglWindow;
    
        if(obj==NULL)
        {
            return -1;
        }
    
        eglMakeCurrent(obj->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
    
        for (count = 0; count < APP_EGL_MAX_RENDER_TEXTURES; count++)
        {
            appEglWindowDestroyTex(obj, &obj->texRender[count]);
        }
        for (count = 0; count < APP_EGL_MAX_TEXTURES; count++)
        {
            appEglWindowDestroyTex(obj, &obj->tex[count]);
        }
    
        if (obj->surface != EGL_NO_SURFACE)
            eglDestroySurface(obj->display, obj->surface);
        eglDestroyContext(obj->display, obj->context);
        eglTerminate(obj->display);
    
        if (obj->gbm_surface)
        {
            gbm_surface_destroy(obj->gbm_surface);
            gbm_device_destroy(obj->gbm_dev);
            close(obj->drm_fd);
        }
    
        free(obj);
    
        return 0;
    }
    
  • Another issue is that when I set the queue size to 2, I found that the program occupies around 300MB of memory, of which 100MB is CMA memory. I understand that the GPU will occupy CMA memory for the convenience of data interaction with the CPU, but why does the system memory occupy 200MB? There are no malloc or similar operations in the program, and more is the call of OpenGL ES API. Do these API occupy system memory?

  • Hi,

    I am not familiar with the TDA4 application and do you see similar issue with the code that we shared for colorconvert?

    Regards,
    Krunal

  • No, because the colorconvert demo is just the basic and simple implementation, it does not take into account the needs of 3D rendering and loop rendering, and using its EGL environment to do these things will result in errors.

  • Understood, the closet we can share was the surround view demo that was using EGL environment. Are you able to replicate your memory issues on that setup?

    Regards,
    Krunal

  • we can try it