diff --git a/bsp/meta-openeuler-bsp/conf/layer.conf b/bsp/meta-openeuler-bsp/conf/layer.conf index 4bce50cc39b5e0750338764a894ab40714b885a5..42caa1db665211528b2b955302876bb5fd6968a9 100644 --- a/bsp/meta-openeuler-bsp/conf/layer.conf +++ b/bsp/meta-openeuler-bsp/conf/layer.conf @@ -22,3 +22,12 @@ raspberrypi:${LAYERDIR}/raspberrypi/*/*/*.bbappend \ #enable find .inc under raspberrypi/, included in .bb BBPATH:append = ":${LAYERDIR}/raspberrypi" + +#enable .bb under rockchip/ when exist meta-rockchip +BBFILES_DYNAMIC += " \ +rockchip:${LAYERDIR}/rockchip/*/*/*.bb \ +rockchip:${LAYERDIR}/rockchip/*/*/*.bbappend \ +" + +#enable find .inc under rockchip/, included in .bb +BBPATH:append = ":${LAYERDIR}/rockchip" diff --git a/bsp/meta-openeuler-bsp/conf/machine/openeuler-ok3568.conf b/bsp/meta-openeuler-bsp/conf/machine/openeuler-ok3568.conf new file mode 100644 index 0000000000000000000000000000000000000000..528e7ba00f17fbf96fed986ff559d56652d77b53 --- /dev/null +++ b/bsp/meta-openeuler-bsp/conf/machine/openeuler-ok3568.conf @@ -0,0 +1,8 @@ +RK3568_KERNEL_DTB_NAME ?= "OK3568-C-linux.dtb" +KERNEL_DEVICETREE = "rockchip/${RK3568_KERNEL_DTB_NAME}" + +UBOOT_MACHINE = "evb-rk3568_defconfig" + +CMDLINE_SERIAL = "console=tty1 console=ttyFIQ0,115200" +SERIAL_CONSOLES = "115200;ttyFIQ0" +AUTO-EXPAND-FS = "1" \ No newline at end of file diff --git a/bsp/meta-openeuler-bsp/rockchip/recipes-core/auto-expand-fs/auto-expand-fs.bb b/bsp/meta-openeuler-bsp/rockchip/recipes-core/auto-expand-fs/auto-expand-fs.bb new file mode 100644 index 0000000000000000000000000000000000000000..c7d82b2c16ac6ba419cabdca67ff542f4f5c4d86 --- /dev/null +++ b/bsp/meta-openeuler-bsp/rockchip/recipes-core/auto-expand-fs/auto-expand-fs.bb @@ -0,0 +1,39 @@ +SUMMARY = "Automatic file system expansion" +DESCRIPTION = "Expand file system to use all the space on the card at first boot" +SECTION = "base" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +RDEPENDS:${PN} = "parted util-linux-findmnt e2fsprogs-resize2fs" + +# As the recipe doesn't inherit systemd.bbclass, we need to set this variable +# manually to avoid unnecessary postinst/preinst generated. +python __anonymous() { + if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): + d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1") +} + +inherit update-rc.d + +# init_resize.sh: perform the partition resize +# resize2fs_once: resize file system at first boot +# reference: https://github.com/RPi-Distro/raspi-config/blob/master/usr/lib/raspi-config/init_resize.sh +SRC_URI = "file://init_resize.sh \ + file://resize2fs_once \ + " + +INITSCRIPT_NAME = "resize2fs_once" +INITSCRIPT_PARAMS = "defaults" + +S = "${WORKDIR}" + +FILES:${PN} = "/usr/lib/init_resize.sh ${sysconfdir}/init.d/resize2fs_once" + +do_install () { + install -d ${D}${sysconfdir}/init.d/ + install -d ${D}/usr/lib/ + install -m 0755 ${WORKDIR}/resize2fs_once ${D}${sysconfdir}/init.d/ + install -m 0755 ${WORKDIR}/init_resize.sh ${D}/usr/lib/ +} + +ALLOW_EMPTY:${PN} = "1" diff --git a/bsp/meta-openeuler-bsp/rockchip/recipes-core/auto-expand-fs/files/init_resize.sh b/bsp/meta-openeuler-bsp/rockchip/recipes-core/auto-expand-fs/files/init_resize.sh new file mode 100644 index 0000000000000000000000000000000000000000..1a9ab693ec405ef8b82d9b64715b8faa6825083a --- /dev/null +++ b/bsp/meta-openeuler-bsp/rockchip/recipes-core/auto-expand-fs/files/init_resize.sh @@ -0,0 +1,209 @@ +#!/bin/sh + +reboot_pi () { + umount /boot + mount / -o remount,rw + rm -r /boot + mount / -o remount,ro + sync + if [ "$NOOBS" = "1" ]; then + if [ "$NEW_KERNEL" = "1" ]; then + reboot -f "$BOOT_PART_NUM" + sleep 5 + else + echo "$BOOT_PART_NUM" > "/sys/module/${BCM_MODULE}/parameters/reboot_part" + fi + fi + reboot -f + sleep 5 + exit 0 +} + +check_commands () { + for COMMAND in grep cut sed parted fdisk findmnt; do + if ! command -v $COMMAND > /dev/null; then + FAIL_REASON="$COMMAND not found" + return 1 + fi + done + return 0 +} + +check_noobs () { + if [ "$BOOT_PART_NUM" = "1" ]; then + NOOBS=0 + else + NOOBS=1 + fi +} + +get_variables () { + ROOT_PART_DEV=$(findmnt / -o source -n) + ROOT_PART_NAME=$(echo "$ROOT_PART_DEV" | cut -d "/" -f 3) + ROOT_DEV_NAME=$(echo /sys/block/*/"${ROOT_PART_NAME}" | cut -d "/" -f 4) + ROOT_DEV="/dev/${ROOT_DEV_NAME}" + ROOT_PART_NUM=$(cat "/sys/block/${ROOT_DEV_NAME}/${ROOT_PART_NAME}/partition") + + BOOT_PART_DEV=$(findmnt /boot -o source -n) + BOOT_PART_NAME=$(echo "$BOOT_PART_DEV" | cut -d "/" -f 3) + BOOT_DEV_NAME=$(echo /sys/block/*/"${BOOT_PART_NAME}" | cut -d "/" -f 4) + BOOT_PART_NUM=$(cat "/sys/block/${BOOT_DEV_NAME}/${BOOT_PART_NAME}/partition") + + OLD_DISKID=$(fdisk -l "$ROOT_DEV" | sed -n 's/Disk identifier: 0x\([^ ]*\)/\1/p') + + check_noobs + + ROOT_DEV_SIZE=$(cat "/sys/block/${ROOT_DEV_NAME}/size") + TARGET_END=$((ROOT_DEV_SIZE - 1)) + + PARTITION_TABLE=$(parted -m "$ROOT_DEV" unit s print | tr -d 's') + + LAST_PART_NUM=$(echo "$PARTITION_TABLE" | tail -n 1 | cut -d ":" -f 1) + + ROOT_PART_LINE=$(echo "$PARTITION_TABLE" | grep -e "^${ROOT_PART_NUM}:") + ROOT_PART_START=$(echo "$ROOT_PART_LINE" | cut -d ":" -f 2) + ROOT_PART_END=$(echo "$ROOT_PART_LINE" | cut -d ":" -f 3) + + if [ "$NOOBS" = "1" ]; then + EXT_PART_LINE=$(echo "$PARTITION_TABLE" | grep ":::;" | head -n 1) + EXT_PART_NUM=$(echo "$EXT_PART_LINE" | cut -d ":" -f 1) + EXT_PART_START=$(echo "$EXT_PART_LINE" | cut -d ":" -f 2) + EXT_PART_END=$(echo "$EXT_PART_LINE" | cut -d ":" -f 3) + fi +} + +fix_partuuid() { + mount -o remount,rw "$ROOT_PART_DEV" + mount -o remount,rw "$BOOT_PART_DEV" + DISKID="$(tr -dc 'a-f0-9' < /dev/hwrng | dd bs=1 count=8 2>/dev/null)" + fdisk "$ROOT_DEV" > /dev/null < /dev/kmsg + sleep 5 +else + echo "Could not expand filesystem: ${FAIL_REASON}" > /dev/kmsg + sleep 5 +fi + +reboot_pi diff --git a/bsp/meta-openeuler-bsp/rockchip/recipes-core/auto-expand-fs/files/resize2fs_once b/bsp/meta-openeuler-bsp/rockchip/recipes-core/auto-expand-fs/files/resize2fs_once new file mode 100644 index 0000000000000000000000000000000000000000..0e6ef95339a35b7e42a9ec689ddf996964a8d25a --- /dev/null +++ b/bsp/meta-openeuler-bsp/rockchip/recipes-core/auto-expand-fs/files/resize2fs_once @@ -0,0 +1,15 @@ +#! /bin/sh + +case "$1" in + start) + echo "Starting resize2fs_once." + ROOT_DEV=$(findmnt / -o source -n) && + resize2fs $ROOT_DEV && + rm /etc/init.d/resize2fs_once && + echo "done" + ;; + *) + echo "Usage: $0 start" >&2 + exit 1 + ;; +esac diff --git a/bsp/meta-openeuler-bsp/rockchip/recipes-core/images/ok3568.inc b/bsp/meta-openeuler-bsp/rockchip/recipes-core/images/ok3568.inc new file mode 100644 index 0000000000000000000000000000000000000000..ad7cddcc95882e11168dd25f4c3a4d88f112704a --- /dev/null +++ b/bsp/meta-openeuler-bsp/rockchip/recipes-core/images/ok3568.inc @@ -0,0 +1,15 @@ +#image configuration for aarch64 +require rk3568.inc + +IMAGE_INSTALL:remove = " \ +-packagegroup-core-base-utils \ +" + +# make no login +set_permissions_from_rootfs:append() { + cd "${IMAGE_ROOTFS}" + if [ -f ./etc/inittab ]; then + sed -i "s#respawn:/sbin/getty.*#respawn:-/bin/sh#g" ./etc/inittab + fi + cd - +} \ No newline at end of file diff --git a/bsp/meta-openeuler-bsp/rockchip/recipes-core/images/openeuler-image.bbappend b/bsp/meta-openeuler-bsp/rockchip/recipes-core/images/openeuler-image.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..dd9be26dac6c00c112e62fc08cdbfca18cb5be3e --- /dev/null +++ b/bsp/meta-openeuler-bsp/rockchip/recipes-core/images/openeuler-image.bbappend @@ -0,0 +1 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" \ No newline at end of file diff --git a/bsp/meta-rockchip/recipes-core/images/rk3568.inc b/bsp/meta-openeuler-bsp/rockchip/recipes-core/images/rk3568.inc similarity index 92% rename from bsp/meta-rockchip/recipes-core/images/rk3568.inc rename to bsp/meta-openeuler-bsp/rockchip/recipes-core/images/rk3568.inc index e46394d86fda5af4ac0411984e2532538d6a4a8c..72898dff45503a29f7fedeeab0b6d78e4e9cd237 100644 --- a/bsp/meta-rockchip/recipes-core/images/rk3568.inc +++ b/bsp/meta-openeuler-bsp/rockchip/recipes-core/images/rk3568.inc @@ -1,8 +1,3 @@ -IMAGE_FSTYPES = "ext4" -IMAGE_FSTYPES:remove = "iso" -IMAGE_FSTYPES_DEBUGFS = "ext4" -INITRAMFS_MAXSIZE = "476591" - delete_unneeded_from_rootfs() { set -x test -d "${OUTPUT_DIR}" || mkdir -p "${OUTPUT_DIR}" @@ -26,3 +21,9 @@ copy_rk3568_distro() { set +x } IMAGE_POSTPROCESS_COMMAND += "copy_rk3568_distro;" + + +#IMAGE_FEATURES += "splash" +IMAGE_FSTYPES = "ext4" +IMAGE_FSTYPES:remove = "iso" +IMAGE_FSTYPES_DEBUGFS = "ext4" \ No newline at end of file diff --git a/bsp/meta-rockchip/recipes-core/packagegroups/packagegroup-base.bbappend b/bsp/meta-openeuler-bsp/rockchip/recipes-core/packagegroups/packagegroup-base.bbappend similarity index 61% rename from bsp/meta-rockchip/recipes-core/packagegroups/packagegroup-base.bbappend rename to bsp/meta-openeuler-bsp/rockchip/recipes-core/packagegroups/packagegroup-base.bbappend index 55cc63ee5ebd443275e6d65bbd042e59fb0aaf9b..e0f6613648c0745ce342ccac782eb2bfe4e3a5e0 100644 --- a/bsp/meta-rockchip/recipes-core/packagegroups/packagegroup-base.bbappend +++ b/bsp/meta-openeuler-bsp/rockchip/recipes-core/packagegroups/packagegroup-base.bbappend @@ -1,5 +1,3 @@ RDEPENDS:packagegroup-base:append = " \ -e2fsprogs-resize2fs \ wpa-supplicant \ -wififirmware \ " diff --git a/bsp/meta-rockchip/recipes-core/packagegroups/packagegroup-core-boot.bbappend b/bsp/meta-openeuler-bsp/rockchip/recipes-core/packagegroups/packagegroup-core-boot.bbappend similarity index 35% rename from bsp/meta-rockchip/recipes-core/packagegroups/packagegroup-core-boot.bbappend rename to bsp/meta-openeuler-bsp/rockchip/recipes-core/packagegroups/packagegroup-core-boot.bbappend index 5f611934cf2dc72bcb46c34bf02803d3c024ec9a..0a4d09f50a1856be58083a2b99e0f2e4b47c407b 100644 --- a/bsp/meta-rockchip/recipes-core/packagegroups/packagegroup-core-boot.bbappend +++ b/bsp/meta-openeuler-bsp/rockchip/recipes-core/packagegroups/packagegroup-core-boot.bbappend @@ -1,3 +1,6 @@ +RDEPENDS:${PN} += " \ + ${@oe.utils.conditional("AUTO-EXPAND-FS", "1", "auto-expand-fs", "", d)} \ +" # we add bootfile RDEPENDS:${PN} += " \ bootfile \ diff --git a/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/config/ok3568/defconfig-kernel b/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/config/ok3568/defconfig-kernel new file mode 100644 index 0000000000000000000000000000000000000000..e8589a2a271d3342a20c182ddd02569d96ec1cd6 --- /dev/null +++ b/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/config/ok3568/defconfig-kernel @@ -0,0 +1,605 @@ +CONFIG_DEFAULT_HOSTNAME="localhost" +CONFIG_SYSVIPC=y +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_PREEMPT_VOLUNTARY=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=18 +CONFIG_CGROUPS=y +CONFIG_CGROUP_SCHED=y +CONFIG_CFS_BANDWIDTH=y +CONFIG_CGROUP_FREEZER=y +CONFIG_CPUSETS=y +CONFIG_CGROUP_DEVICE=y +CONFIG_CGROUP_CPUACCT=y +CONFIG_NAMESPACES=y +CONFIG_USER_NS=y +CONFIG_BLK_DEV_INITRD=y +# CONFIG_ROCKCHIP_ONE_INITRD is not set +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_EMBEDDED=y +# CONFIG_COMPAT_BRK is not set +CONFIG_PROFILING=y +CONFIG_ARCH_ROCKCHIP=y +CONFIG_PCI=y +CONFIG_PCIEPORTBUS=y +CONFIG_PCIE_DW_ROCKCHIP=y +# CONFIG_ARM64_ERRATUM_826319 is not set +# CONFIG_ARM64_ERRATUM_827319 is not set +# CONFIG_ARM64_ERRATUM_824069 is not set +# CONFIG_ARM64_ERRATUM_819472 is not set +# CONFIG_ARM64_ERRATUM_832075 is not set +# CONFIG_CAVIUM_ERRATUM_22375 is not set +# CONFIG_CAVIUM_ERRATUM_23154 is not set +CONFIG_SCHED_MC=y +CONFIG_NR_CPUS=8 +CONFIG_HZ_300=y +CONFIG_SECCOMP=y +CONFIG_ARMV8_DEPRECATED=y +CONFIG_SWP_EMULATION=y +CONFIG_CP15_BARRIER_EMULATION=y +CONFIG_SETEND_EMULATION=y +# CONFIG_EFI is not set +CONFIG_COMPAT=y +CONFIG_PM_DEBUG=y +CONFIG_PM_ADVANCED_DEBUG=y +CONFIG_WQ_POWER_EFFICIENT_DEFAULT=y +CONFIG_ENERGY_MODEL=y +CONFIG_CPU_IDLE=y +CONFIG_ARM_CPUIDLE=y +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +CONFIG_CPU_FREQ_GOV_USERSPACE=y +CONFIG_CPU_FREQ_GOV_ONDEMAND=y +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y +CONFIG_CPUFREQ_DT=y +CONFIG_ARM_ROCKCHIP_CPUFREQ=y +CONFIG_ARM_SCMI_PROTOCOL=y +CONFIG_ROCKCHIP_SIP=y +CONFIG_ARM64_CRYPTO=y +CONFIG_CRYPTO_SHA1_ARM64_CE=y +CONFIG_CRYPTO_SHA2_ARM64_CE=y +CONFIG_CRYPTO_GHASH_ARM64_CE=y +CONFIG_CRYPTO_AES_ARM64_CE_CCM=y +CONFIG_CRYPTO_AES_ARM64_CE_BLK=y +CONFIG_MODULES=y +CONFIG_MODULE_FORCE_LOAD=y +CONFIG_MODULE_UNLOAD=y +CONFIG_MODULE_FORCE_UNLOAD=y +CONFIG_PARTITION_ADVANCED=y +# CONFIG_COMPACTION is not set +CONFIG_DEFAULT_MMAP_MIN_ADDR=32768 +CONFIG_CMA=y +CONFIG_ZSMALLOC=y +CONFIG_NET=y +CONFIG_PACKET=y +CONFIG_UNIX=y +CONFIG_XFRM_USER=y +CONFIG_NET_KEY=y +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +CONFIG_IP_ADVANCED_ROUTER=y +CONFIG_IP_MROUTE=y +CONFIG_SYN_COOKIES=y +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +# CONFIG_INET_DIAG is not set +# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET6_XFRM_MODE_TUNNEL is not set +# CONFIG_INET6_XFRM_MODE_BEET is not set +# CONFIG_IPV6_SIT is not set +CONFIG_NETFILTER=y +CONFIG_NF_CONNTRACK=y +CONFIG_IP_NF_IPTABLES=y +CONFIG_IP_NF_FILTER=y +CONFIG_IP_NF_NAT=y +CONFIG_IP_NF_TARGET_MASQUERADE=y +CONFIG_IP_NF_TARGET_NETMAP=y +CONFIG_IP_NF_TARGET_REDIRECT=y +CONFIG_IP_NF_MANGLE=y +CONFIG_CAN=y +CONFIG_CAN_ROCKCHIP=y +CONFIG_CANFD_ROCKCHIP=y +CONFIG_BT=y +CONFIG_BT_RFCOMM=y +CONFIG_BT_HIDP=y +CONFIG_BT_HCIBTUSB=y +CONFIG_BT_HCIUART=y +CONFIG_BT_HCIUART_ATH3K=y +CONFIG_BT_HCIBFUSB=y +CONFIG_BT_HCIVHCI=y +CONFIG_BT_MRVL=y +CONFIG_BT_MRVL_SDIO=y +CONFIG_NL80211_TESTMODE=y +CONFIG_CFG80211_DEBUGFS=y +CONFIG_CFG80211_WEXT=y +CONFIG_MAC80211_LEDS=y +CONFIG_MAC80211_DEBUGFS=y +CONFIG_MAC80211_DEBUG_MENU=y +CONFIG_MAC80211_VERBOSE_DEBUG=y +CONFIG_RFKILL=y +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_DEBUG_DEVRES=y +CONFIG_DMA_CMA=y +CONFIG_CONNECTOR=y +CONFIG_MTD=y +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_BLOCK=y +CONFIG_MTD_UBI=y +CONFIG_ZRAM=y +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=1 +CONFIG_BLK_DEV_NVME=y +CONFIG_SRAM=y +CONFIG_BLK_DEV_SD=y +CONFIG_BLK_DEV_SR=y +CONFIG_SCSI_SCAN_ASYNC=y +CONFIG_SCSI_SPI_ATTRS=y +CONFIG_ATA=y +CONFIG_SATA_AHCI=y +CONFIG_SATA_AHCI_PLATFORM=y +# CONFIG_ATA_SFF is not set +CONFIG_MD=y +CONFIG_NETDEVICES=y +# CONFIG_NET_VENDOR_3COM is not set +# CONFIG_NET_VENDOR_ADAPTEC is not set +# CONFIG_NET_VENDOR_AGERE is not set +# CONFIG_NET_VENDOR_ALTEON is not set +# CONFIG_NET_VENDOR_AMD is not set +# CONFIG_NET_VENDOR_ARC is not set +# CONFIG_NET_VENDOR_ATHEROS is not set +# CONFIG_NET_VENDOR_BROADCOM is not set +# CONFIG_NET_VENDOR_BROCADE is not set +# CONFIG_NET_VENDOR_CAVIUM is not set +# CONFIG_NET_VENDOR_CHELSIO is not set +# CONFIG_NET_VENDOR_CISCO is not set +# CONFIG_NET_VENDOR_DEC is not set +# CONFIG_NET_VENDOR_DLINK is not set +# CONFIG_NET_VENDOR_EMULEX is not set +# CONFIG_NET_VENDOR_EZCHIP is not set +# CONFIG_NET_VENDOR_HISILICON is not set +# CONFIG_NET_VENDOR_HP is not set +CONFIG_E1000E=y +# CONFIG_NET_VENDOR_MARVELL is not set +# CONFIG_NET_VENDOR_MELLANOX is not set +# CONFIG_NET_VENDOR_MICREL is not set +# CONFIG_NET_VENDOR_MICROCHIP is not set +# CONFIG_NET_VENDOR_MYRI is not set +# CONFIG_NET_VENDOR_NATSEMI is not set +# CONFIG_NET_VENDOR_NVIDIA is not set +# CONFIG_NET_VENDOR_OKI is not set +# CONFIG_NET_VENDOR_QLOGIC is not set +# CONFIG_NET_VENDOR_QUALCOMM is not set +# CONFIG_NET_VENDOR_RDC is not set +# CONFIG_NET_VENDOR_REALTEK is not set +# CONFIG_NET_VENDOR_RENESAS is not set +# CONFIG_NET_VENDOR_ROCKER is not set +# CONFIG_NET_VENDOR_SAMSUNG is not set +# CONFIG_NET_VENDOR_SEEQ is not set +# CONFIG_NET_VENDOR_SILAN is not set +# CONFIG_NET_VENDOR_SIS is not set +# CONFIG_NET_VENDOR_SMSC is not set +CONFIG_STMMAC_ETH=y +# CONFIG_NET_VENDOR_SUN is not set +# CONFIG_NET_VENDOR_SYNOPSYS is not set +# CONFIG_NET_VENDOR_TEHUTI is not set +# CONFIG_NET_VENDOR_TI is not set +# CONFIG_NET_VENDOR_VIA is not set +# CONFIG_NET_VENDOR_WIZNET is not set +CONFIG_REALTEK_PHY=y +CONFIG_ROCKCHIP_PHY=y +CONFIG_USB_RTL8150=y +CONFIG_USB_RTL8152=y +CONFIG_USB_NET_CDC_MBIM=y +# CONFIG_USB_NET_NET1080 is not set +# CONFIG_USB_NET_CDC_SUBSET is not set +# CONFIG_USB_NET_ZAURUS is not set +CONFIG_WL_ROCKCHIP=y +CONFIG_WIFI_BUILD_MODULE=y +CONFIG_WIFI_LOAD_DRIVER_WHEN_KERNEL_BOOTUP=y +CONFIG_MXMWIFIEX=m +CONFIG_USB_NET_RNDIS_WLAN=y +CONFIG_INPUT_FF_MEMLESS=y +CONFIG_INPUT_EVDEV=y +CONFIG_KEYBOARD_ADC=y +# CONFIG_KEYBOARD_ATKBD is not set +CONFIG_KEYBOARD_GPIO=y +CONFIG_KEYBOARD_GPIO_POLLED=y +CONFIG_KEYBOARD_CROS_EC=y +# CONFIG_MOUSE_PS2 is not set +CONFIG_MOUSE_CYAPA=y +CONFIG_MOUSE_ELAN_I2C=y +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_ATMEL_MXT=y +CONFIG_TOUCHSCREEN_GOODIX=y +CONFIG_TOUCHSCREEN_GSLX680_VR=y +CONFIG_TOUCHSCREEN_GSL3673=y +CONFIG_TOUCHSCREEN_ELAN=y +CONFIG_TOUCHSCREEN_WACOM_W9013=y +CONFIG_TOUCHSCREEN_EDT_FT5X06=y +CONFIG_TOUCHSCREEN_USB_COMPOSITE=y +CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5=y +CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_DEVICETREE_SUPPORT=y +CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_I2C=y +CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_DEVICE_ACCESS=y +CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_LOADER=y +CONFIG_ROCKCHIP_REMOTECTL=y +CONFIG_ROCKCHIP_REMOTECTL_PWM=y +CONFIG_INPUT_MISC=y +CONFIG_INPUT_UINPUT=y +CONFIG_INPUT_RK805_PWRKEY=y +# CONFIG_SERIO is not set +CONFIG_VT_HW_CONSOLE_BINDING=y +# CONFIG_LEGACY_PTYS is not set +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +# CONFIG_SERIAL_8250_PCI is not set +CONFIG_SERIAL_8250_NR_UARTS=10 +CONFIG_SERIAL_8250_RUNTIME_UARTS=10 +CONFIG_SERIAL_8250_DW=y +CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_HW_RANDOM=y +CONFIG_HW_RANDOM_ROCKCHIP=y +CONFIG_TCG_TPM=y +CONFIG_TCG_TIS_I2C_INFINEON=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_RK3X=y +CONFIG_I2C_CROS_EC_TUNNEL=y +CONFIG_SPI=y +CONFIG_SPI_BITBANG=y +CONFIG_SPI_ROCKCHIP=y +CONFIG_SPI_SPIDEV=y +CONFIG_PINCTRL_RK805=y +CONFIG_GPIO_SYSFS=y +CONFIG_GPIO_GENERIC_PLATFORM=y +CONFIG_POWER_AVS=y +CONFIG_ROCKCHIP_IODOMAIN=y +CONFIG_POWER_RESET_GPIO=y +CONFIG_POWER_RESET_GPIO_RESTART=y +CONFIG_SYSCON_REBOOT_MODE=y +CONFIG_BATTERY_SBS=y +CONFIG_CHARGER_GPIO=y +CONFIG_CHARGER_BQ24735=y +CONFIG_BATTERY_RK817=y +CONFIG_CHARGER_RK817=y +CONFIG_THERMAL=y +CONFIG_THERMAL_WRITABLE_TRIPS=y +CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR=y +CONFIG_THERMAL_GOV_FAIR_SHARE=y +CONFIG_THERMAL_GOV_STEP_WISE=y +CONFIG_CPU_THERMAL=y +CONFIG_ROCKCHIP_THERMAL=y +CONFIG_WATCHDOG=y +CONFIG_DW_WATCHDOG=y +CONFIG_MFD_CROS_EC=y +CONFIG_MFD_RK618=y +CONFIG_MFD_RK628=y +CONFIG_MFD_RK808=y +CONFIG_MFD_TPS6586X=y +CONFIG_FUSB_30X=y +CONFIG_REGULATOR=y +CONFIG_REGULATOR_DEBUG=y +CONFIG_REGULATOR_FIXED_VOLTAGE=y +CONFIG_REGULATOR_ACT8865=y +CONFIG_REGULATOR_FAN53555=y +CONFIG_REGULATOR_GPIO=y +CONFIG_REGULATOR_LP8752=y +CONFIG_REGULATOR_MP8865=y +CONFIG_REGULATOR_PWM=y +CONFIG_REGULATOR_RK808=y +CONFIG_REGULATOR_TPS65132=y +CONFIG_REGULATOR_TPS6586X=y +CONFIG_REGULATOR_XZ3216=y +CONFIG_MEDIA_SUPPORT=y +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_CEC_SUPPORT=y +CONFIG_MEDIA_CONTROLLER=y +CONFIG_VIDEO_V4L2_SUBDEV_API=y +CONFIG_MEDIA_USB_SUPPORT=y +CONFIG_USB_VIDEO_CLASS=y +# CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV is not set +# CONFIG_USB_GSPCA is not set +CONFIG_V4L_PLATFORM_DRIVERS=y +CONFIG_SOC_CAMERA=n +CONFIG_VIDEO_ROCKCHIP_ISP1=n +CONFIG_VIDEO_ROCKCHIP_ISP=n +CONFIG_V4L_MEM2MEM_DRIVERS=n +CONFIG_VIDEO_ROCKCHIP_RGA=n +# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set +CONFIG_VIDEO_VM149C=n +CONFIG_VIDEO_TC35874X=n +CONFIG_VIDEO_RK628_CSI=n +CONFIG_VIDEO_LT6911UXC=n +CONFIG_VIDEO_LT8619C=n +CONFIG_VIDEO_OS04A10=n +CONFIG_VIDEO_OV4689=n +CONFIG_VIDEO_OV5695=n +CONFIG_VIDEO_OV7251=n +CONFIG_VIDEO_OV13850=n +CONFIG_VIDEO_GC8034=n +# CONFIG_VGA_ARB is not set +CONFIG_DRM=y +CONFIG_DRM_IGNORE_IOTCL_PERMIT=y +CONFIG_DRM_LOAD_EDID_FIRMWARE=n +CONFIG_DRM_ROCKCHIP=y +CONFIG_ROCKCHIP_ANALOGIX_DP=n +CONFIG_ROCKCHIP_CDN_DP=n +CONFIG_ROCKCHIP_DW_HDMI=y +CONFIG_ROCKCHIP_DW_MIPI_DSI=y +CONFIG_ROCKCHIP_INNO_HDMI=y +CONFIG_ROCKCHIP_LVDS=n +CONFIG_ROCKCHIP_DRM_TVE=n +CONFIG_ROCKCHIP_RGB=n +CONFIG_DRM_ROCKCHIP_RK618=y +CONFIG_DRM_PANEL_SIMPLE=y +CONFIG_DRM_SII902X=y +CONFIG_DRM_DW_HDMI_I2S_AUDIO=y +CONFIG_DRM_DW_HDMI_CEC=y +CONFIG_MALI400=y +CONFIG_MALI450=y + +# console output HDMI +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +CONFIG_FONT_SUPPORT=y +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y + +# CONFIG_MALI400_PROFILING is not set +CONFIG_MALI_SHARED_INTERRUPTS=y +CONFIG_MALI_DT=y +CONFIG_MALI_DEVFREQ=y +CONFIG_MALI_MIDGARD=y +CONFIG_MALI_EXPERT=y +CONFIG_MALI_PLATFORM_THIRDPARTY=y +CONFIG_MALI_PLATFORM_THIRDPARTY_NAME="rk" +CONFIG_MALI_DEBUG=y +CONFIG_MALI_PWRSOFT_765=y +CONFIG_MALI_BIFROST=y +CONFIG_MALI_PLATFORM_NAME="rk" +CONFIG_BACKLIGHT_LCD_SUPPORT=y +# CONFIG_LCD_CLASS_DEVICE is not set +CONFIG_BACKLIGHT_CLASS_DEVICE=y +CONFIG_BACKLIGHT_PWM=y +CONFIG_ROCKCHIP_RGA2=y +CONFIG_ROCKCHIP_MPP_SERVICE=y +CONFIG_ROCKCHIP_MPP_RKVDEC=y +CONFIG_ROCKCHIP_MPP_RKVDEC2=y +CONFIG_ROCKCHIP_MPP_RKVENC=y +CONFIG_ROCKCHIP_MPP_VDPU1=y +CONFIG_ROCKCHIP_MPP_VEPU1=y +CONFIG_ROCKCHIP_MPP_VDPU2=y +CONFIG_ROCKCHIP_MPP_VEPU2=y +CONFIG_ROCKCHIP_MPP_IEP2=y +CONFIG_ROCKCHIP_MPP_JPGDEC=y +CONFIG_SOUND=y +CONFIG_SND=y +CONFIG_SND_HRTIMER=y +CONFIG_SND_DYNAMIC_MINORS=y +# CONFIG_SND_SUPPORT_OLD_API is not set +CONFIG_SND_SEQUENCER=y +CONFIG_SND_SEQ_DUMMY=y +# CONFIG_SND_PCI is not set +# CONFIG_SND_SPI is not set +# CONFIG_SND_USB_AUDIO is not set +CONFIG_SND_SOC=y +CONFIG_SND_SOC_ROCKCHIP=y +CONFIG_SND_SOC_ROCKCHIP_I2S_TDM=y +CONFIG_SND_SOC_ROCKCHIP_PDM=y +CONFIG_SND_SOC_ROCKCHIP_SPDIF=y +CONFIG_SND_SOC_ROCKCHIP_MAX98090=y +CONFIG_SND_SOC_ROCKCHIP_MULTICODECS=y +CONFIG_SND_SOC_ROCKCHIP_RT5645=y +CONFIG_SND_SOC_ROCKCHIP_RT5651_RK628=y +CONFIG_SND_SOC_ROCKCHIP_HDMI=y +CONFIG_SND_SOC_DUMMY_CODEC=y +CONFIG_SND_SOC_ES7202=y +CONFIG_SND_SOC_ES7243E=y +CONFIG_SND_SOC_ES8311=y +CONFIG_SND_SOC_ES8316=y +CONFIG_SND_SOC_RK3328=y +CONFIG_SND_SOC_RK817=y +CONFIG_SND_SOC_RK_CODEC_DIGITAL=y +CONFIG_SND_SOC_RT5616=y +CONFIG_SND_SOC_RT5640=y +CONFIG_SND_SOC_SPDIF=y +CONFIG_SND_SIMPLE_CARD=y +CONFIG_HID_BATTERY_STRENGTH=y +CONFIG_HIDRAW=y +CONFIG_UHID=y +CONFIG_HID_KENSINGTON=y +CONFIG_HID_MULTITOUCH=y +CONFIG_USB_HIDDEV=y +CONFIG_I2C_HID=y +CONFIG_USB_ANNOUNCE_NEW_DEVICES=y +# CONFIG_USB_DEFAULT_PERSIST is not set +CONFIG_USB_OTG=y +CONFIG_USB_MON=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_ROOT_HUB_TT=y +CONFIG_USB_EHCI_HCD_PLATFORM=y +CONFIG_USB_OHCI_HCD=y +# CONFIG_USB_OHCI_HCD_PCI is not set +CONFIG_USB_OHCI_HCD_PLATFORM=y +CONFIG_USB_ACM=y +CONFIG_USB_STORAGE=y +CONFIG_USB_UAS=y +CONFIG_USB_DWC3=y +CONFIG_USB_DWC2=y +CONFIG_USB_SERIAL=y +CONFIG_USB_SERIAL_GENERIC=y +CONFIG_USB_SERIAL_CP210X=y +CONFIG_USB_SERIAL_FTDI_SIO=y +CONFIG_USB_SERIAL_KEYSPAN=y +CONFIG_USB_SERIAL_PL2303=y +CONFIG_USB_SERIAL_OTI6858=y +CONFIG_USB_SERIAL_QUALCOMM=y +CONFIG_USB_SERIAL_SIERRAWIRELESS=y +CONFIG_USB_SERIAL_OPTION=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_DEBUG_FILES=y +CONFIG_USB_GADGET_VBUS_DRAW=500 +CONFIG_USB_CONFIGFS=y +CONFIG_USB_CONFIGFS_UEVENT=y +CONFIG_USB_CONFIGFS_ACM=y +CONFIG_USB_CONFIGFS_MASS_STORAGE=y +CONFIG_USB_CONFIGFS_F_FS=y +CONFIG_USB_CONFIGFS_F_UVC=y +CONFIG_USB_MASS_STORAGE=m +CONFIG_MMC=y +CONFIG_MMC_BLOCK_MINORS=32 +CONFIG_MMC_TEST=y +CONFIG_SDIO_KEEPALIVE=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_PLTFM=y +CONFIG_MMC_SDHCI_OF_ARASAN=y +CONFIG_MMC_SDHCI_OF_DWCMSHC=y +CONFIG_MMC_DW=y +CONFIG_MMC_DW_ROCKCHIP=y +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +CONFIG_LEDS_GPIO=y +CONFIG_LEDS_IS31FL32XX=y +CONFIG_LEDS_TRIGGER_TIMER=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +CONFIG_LEDS_TRIGGER_GPIO=y +CONFIG_LEDS_TRIGGER_DEFAULT_ON=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_DRV_PCF8563=y +CONFIG_DMADEVICES=y +CONFIG_PL330_DMA=y +CONFIG_STAGING=y +CONFIG_FIQ_DEBUGGER=y +CONFIG_FIQ_DEBUGGER_NO_SLEEP=y +CONFIG_FIQ_DEBUGGER_CONSOLE=y +CONFIG_FIQ_DEBUGGER_CONSOLE_DEFAULT_ENABLE=y +CONFIG_FIQ_DEBUGGER_TRUST_ZONE=y +CONFIG_RK_CONSOLE_THREAD=y +CONFIG_COMMON_CLK_RK808=y +CONFIG_COMMON_CLK_SCMI=y +CONFIG_MAILBOX=y +CONFIG_ROCKCHIP_IOMMU=y +CONFIG_CPU_PX30=y +CONFIG_CPU_RK1808=y +CONFIG_CPU_RK3328=y +CONFIG_CPU_RK3399=y +CONFIG_CPU_RK3568=y +CONFIG_ROCKCHIP_PM_DOMAINS=y +CONFIG_ROCKCHIP_PVTM=y +CONFIG_ROCKCHIP_SUSPEND_MODE=y +CONFIG_ROCKCHIP_VENDOR_STORAGE_UPDATE_LOADER=y +CONFIG_DEVFREQ_GOV_PERFORMANCE=y +CONFIG_DEVFREQ_GOV_POWERSAVE=y +CONFIG_DEVFREQ_GOV_USERSPACE=y +CONFIG_ARM_ROCKCHIP_BUS_DEVFREQ=y +CONFIG_ARM_ROCKCHIP_DMC_DEVFREQ=y +CONFIG_ARM_ROCKCHIP_DMC_DEBUG=y +CONFIG_DEVFREQ_EVENT_ROCKCHIP_NOCP=y +CONFIG_MEMORY=y +CONFIG_IIO=y +CONFIG_IIO_BUFFER=y +CONFIG_IIO_KFIFO_BUF=y +CONFIG_IIO_TRIGGER=y +CONFIG_ROCKCHIP_SARADC=y +CONFIG_SENSORS_ISL29018=y +CONFIG_SENSORS_TSL2563=y +CONFIG_TSL2583=y +CONFIG_IIO_SYSFS_TRIGGER=y +CONFIG_PWM=y +CONFIG_PWM_ROCKCHIP=y +CONFIG_PHY_ROCKCHIP_CSI2_DPHY=n +CONFIG_PHY_ROCKCHIP_DP=n +CONFIG_PHY_ROCKCHIP_EMMC=y +CONFIG_PHY_ROCKCHIP_INNO_HDMI_PHY=n +CONFIG_PHY_ROCKCHIP_INNO_MIPI_DPHY=n +CONFIG_PHY_ROCKCHIP_INNO_USB2=y +CONFIG_PHY_ROCKCHIP_INNO_USB3=y +CONFIG_PHY_ROCKCHIP_INNO_VIDEO_COMBO_PHY=y +CONFIG_PHY_ROCKCHIP_NANENG_COMBO_PHY=n +CONFIG_PHY_ROCKCHIP_NANENG_EDP=n +CONFIG_PHY_ROCKCHIP_PCIE=y +CONFIG_PHY_ROCKCHIP_SNPS_PCIE3=y +CONFIG_PHY_ROCKCHIP_TYPEC=y +CONFIG_PHY_ROCKCHIP_USB=y +CONFIG_ANDROID=y +CONFIG_ROCKCHIP_EFUSE=y +CONFIG_ROCKCHIP_OTP=y +CONFIG_TEE=y +CONFIG_OPTEE=y +CONFIG_RK_FLASH=y +CONFIG_RK_SFC_NAND=y +CONFIG_RK_SFC_NAND_MTD=y +CONFIG_RK_SFC_NOR=y +CONFIG_RK_SFC_NOR_MTD=y +CONFIG_RK_HEADSET=y +CONFIG_ROCKCHIP_RKNPU=y +CONFIG_EXT4_FS=y +CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_EXT4_FS_SECURITY=y +CONFIG_XFS_FS=y +# CONFIG_DNOTIFY is not set +CONFIG_FUSE_FS=y +CONFIG_ISO9660_FS=y +CONFIG_JOLIET=y +CONFIG_ZISOFS=y +CONFIG_VFAT_FS=y +CONFIG_FAT_DEFAULT_CODEPAGE=936 +CONFIG_FAT_DEFAULT_IOCHARSET="utf8" +CONFIG_NTFS_FS=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_JFFS2_FS=y +CONFIG_UBIFS_FS=y +CONFIG_UBIFS_FS_ADVANCED_COMPR=y +CONFIG_SQUASHFS=y +CONFIG_PSTORE=y +CONFIG_PSTORE_CONSOLE=y +CONFIG_PSTORE_RAM=y +CONFIG_NFS_FS=y +CONFIG_NFS_V3_ACL=y +CONFIG_NFS_V4=y +CONFIG_NFS_SWAP=y +CONFIG_NLS_DEFAULT="utf8" +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_CODEPAGE_936=y +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +CONFIG_NLS_UTF8=y +CONFIG_UNICODE=y +# CONFIG_CRYPTO_ECHAINIV is not set +CONFIG_CRYPTO_SHA512=y +CONFIG_CRYPTO_TWOFISH=y +CONFIG_CRYPTO_ANSI_CPRNG=y +CONFIG_CRYPTO_USER_API_HASH=y +CONFIG_CRYPTO_USER_API_SKCIPHER=y +CONFIG_CRYPTO_DEV_ROCKCHIP=y +CONFIG_CRC_CCITT=y +CONFIG_CRC_T10DIF=y +CONFIG_CRC7=y +# CONFIG_XZ_DEC_X86 is not set +# CONFIG_XZ_DEC_POWERPC is not set +# CONFIG_XZ_DEC_IA64 is not set +# CONFIG_XZ_DEC_SPARC is not set +CONFIG_PRINTK_TIME=y +CONFIG_DYNAMIC_DEBUG=y +CONFIG_DEBUG_INFO=y +CONFIG_MAGIC_SYSRQ=y +CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0 +CONFIG_SCHEDSTATS=y +CONFIG_DEBUG_SPINLOCK=y +CONFIG_DEBUG_CREDENTIALS=y +CONFIG_RCU_CPU_STALL_TIMEOUT=60 +CONFIG_FUNCTION_TRACER=y +CONFIG_BLK_DEV_IO_TRACE=y +CONFIG_LKDTM=y +CONFIG_LOCALVERSION_AUTO=n +CONFIG_DWMAC_RK_AUTO_DELAYLINE=y +CONFIG_ROCKCHIP_VENDOR_STORAGE=y +CONFIG_ROCKCHIP_MMC_VENDOR_STORAGE=y +CONFIG_ROCKCHIP_MTD_VENDOR_STORAGE=y diff --git a/bsp/meta-rockchip/recipes-kernel/linux/files/config/ryd-3568/defconfig-kernel b/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/config/ryd-3568/defconfig-kernel similarity index 99% rename from bsp/meta-rockchip/recipes-kernel/linux/files/config/ryd-3568/defconfig-kernel rename to bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/config/ryd-3568/defconfig-kernel index 3a7eda4c29a7f9d2d8b34acff84a7ff8571a1831..ae347700c40fd19e8f016f0c1c1fe03f762e9921 100644 --- a/bsp/meta-rockchip/recipes-kernel/linux/files/config/ryd-3568/defconfig-kernel +++ b/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/config/ryd-3568/defconfig-kernel @@ -1411,7 +1411,7 @@ CONFIG_ALLOW_DEV_COREDUMP=y CONFIG_DEV_COREDUMP=y # CONFIG_DEBUG_DRIVER is not set CONFIG_DEBUG_DEVRES=y -# CONFIG_DEBUG_TEST_DRIVER:remove is not set +# CONFIG_DEBUG_TEST_DRIVER_REMOVE is not set # CONFIG_TEST_ASYNC_DRIVER_PROBE is not set CONFIG_GENERIC_CPU_AUTOPROBE=y CONFIG_GENERIC_CPU_VULNERABILITIES=y diff --git a/bsp/meta-rockchip/recipes-kernel/linux/files/logo/logo.bmp b/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/logo/logo.bmp similarity index 100% rename from bsp/meta-rockchip/recipes-kernel/linux/files/logo/logo.bmp rename to bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/logo/logo.bmp diff --git a/bsp/meta-rockchip/recipes-kernel/linux/files/logo/logo_kernel.bmp b/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/logo/logo_kernel.bmp similarity index 100% rename from bsp/meta-rockchip/recipes-kernel/linux/files/logo/logo_kernel.bmp rename to bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/logo/logo_kernel.bmp diff --git a/bsp/meta-rockchip/recipes-kernel/linux/files/patches/0000-rk3568-kernel.patch.gz b/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/patches/0000-rk3568-kernel.patch.gz similarity index 100% rename from bsp/meta-rockchip/recipes-kernel/linux/files/patches/0000-rk3568-kernel.patch.gz rename to bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/patches/0000-rk3568-kernel.patch.gz diff --git a/bsp/meta-rockchip/recipes-kernel/linux/files/patches/0001-rk3568-8897-dts.patch b/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/patches/0001-rk3568-8897-dts.patch similarity index 100% rename from bsp/meta-rockchip/recipes-kernel/linux/files/patches/0001-rk3568-8897-dts.patch rename to bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/patches/0001-rk3568-8897-dts.patch diff --git a/bsp/meta-rockchip/recipes-kernel/linux/files/patches/0002-fix-fiq_debugger.patch b/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/patches/0002-fix-fiq_debugger.patch similarity index 100% rename from bsp/meta-rockchip/recipes-kernel/linux/files/patches/0002-fix-fiq_debugger.patch rename to bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/patches/0002-fix-fiq_debugger.patch diff --git a/bsp/meta-rockchip/recipes-kernel/linux/files/patches/0002-ryd-gpio-control.patch b/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/patches/0002-ryd-gpio-control.patch similarity index 100% rename from bsp/meta-rockchip/recipes-kernel/linux/files/patches/0002-ryd-gpio-control.patch rename to bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/patches/0002-ryd-gpio-control.patch diff --git a/bsp/meta-rockchip/recipes-kernel/linux/files/patches/0003-ok3568-support-mcs.patch b/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/patches/0003-ok3568-support-mcs.patch similarity index 100% rename from bsp/meta-rockchip/recipes-kernel/linux/files/patches/0003-ok3568-support-mcs.patch rename to bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/patches/0003-ok3568-support-mcs.patch diff --git a/bsp/meta-rockchip/recipes-kernel/linux/files/tools/its_config b/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/tools/its_config similarity index 100% rename from bsp/meta-rockchip/recipes-kernel/linux/files/tools/its_config rename to bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/tools/its_config diff --git a/bsp/meta-rockchip/recipes-kernel/linux/files/tools/mkimage b/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/tools/mkimage similarity index 100% rename from bsp/meta-rockchip/recipes-kernel/linux/files/tools/mkimage rename to bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/tools/mkimage diff --git a/bsp/meta-rockchip/recipes-kernel/linux/files/tools/mkimg b/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/tools/mkimg similarity index 100% rename from bsp/meta-rockchip/recipes-kernel/linux/files/tools/mkimg rename to bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/tools/mkimg diff --git a/bsp/meta-rockchip/recipes-kernel/linux/linux-openeuler-rt.bbappend b/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/linux-openeuler-rt.bbappend similarity index 100% rename from bsp/meta-rockchip/recipes-kernel/linux/linux-openeuler-rt.bbappend rename to bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/linux-openeuler-rt.bbappend diff --git a/bsp/meta-rockchip/recipes-kernel/linux/linux-openeuler.bbappend b/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/linux-openeuler.bbappend similarity index 100% rename from bsp/meta-rockchip/recipes-kernel/linux/linux-openeuler.bbappend rename to bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/linux-openeuler.bbappend diff --git a/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/linux-rockchip.inc b/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/linux-rockchip.inc new file mode 100644 index 0000000000000000000000000000000000000000..b5ff7ba2ab00492ac107169abf0acdf40358755b --- /dev/null +++ b/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/linux-rockchip.inc @@ -0,0 +1,45 @@ +# add recipes-kernel path to find patch and defconfig +FILESEXTRAPATHS:append := "${THISDIR}/files/:" +# add patch prebuild tools and logo +SRC_URI:append = " \ + file://config/ \ + file://patches/0000-rk3568-kernel.patch.gz;name=rk3568-kernel-patch \ + file://tools \ + file://logo \ +" + +# patches for ryd-3568 +SRC_URI:append:ryd-3568 = " \ + file://patches/0001-rk3568-8897-dts.patch \ + file://patches/0002-ryd-gpio-control.patch \ + " +# mcs patch for ok3568 devicetree +SRC_URI:append = " \ + ${@bb.utils.contains('MCS_FEATURES', 'openamp', 'file://patches/0003-ok3568-support-mcs.patch', '', d)} \ +" + +# more support of device is comming. so we documented this patch md5sum. +SRC_URI[rk3568-kernel-patch.md5sum] = "7643792b2483b3156dbc349d6fd41ef9" + +# add patch tool to solve patch apply +PATCHTOOL = "git" + +OPENEULER_KERNEL_CONFIG = "../config/${MACHINE}/defconfig-kernel" + +# add method to do_compile task to produce bootable Image +do_compile:append:rk3568(){ + cp ../logo/* ./ + scripts/mkkrnlimg ${KERNEL_OUTPUT_DIR}/Image kernel.img + ../tools/mkimg --dtb ${RK3568_KERNEL_DTB_NAME} + sed -e "s:path_to_kernel:${WORKDIR}\/build:g" -e "s:dtb_name:${RK3568_KERNEL_DTB_NAME}:g" \ + ${WORKDIR}/tools/its_config > .tmp_its_config + ../tools/mkimage -f .tmp_its_config -E -p 0x800 boot.img + rm -rf .tmp_its_config +} + +# add boot.img to $D +do_install:append(){ + cp ${B}/boot.img ${D}/boot +} +PACKAGES += "bootfile" +FILES:bootfile="/boot/boot.img" diff --git a/bsp/meta-rockchip/LICENSE b/bsp/meta-rockchip/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..e57d3b900695e30fa89d55f02ffd07fbff75b280 --- /dev/null +++ b/bsp/meta-rockchip/LICENSE @@ -0,0 +1,5 @@ +All metadata files (including, but not limited to bb, bbappend, +bbclass, inc and conf files) are MIT licensed unless otherwise stated. +Source code included in tree for individual recipes is under the +LICENSE stated in the associated recipe (.bb file) unless otherwise +stated. diff --git a/bsp/meta-rockchip/README b/bsp/meta-rockchip/README deleted file mode 100644 index 2bb106eb45ad3427c6a32eb7680cbcae4900af9c..0000000000000000000000000000000000000000 --- a/bsp/meta-rockchip/README +++ /dev/null @@ -1,41 +0,0 @@ -This README file contains information on the contents of the meta-rockchip layer. - -Please see the corresponding sections below for details. - -Dependencies -============ - - URI: - branch: - - URI: - branch: - - . - . - . - -Patches -======= - -Please submit any patches against the meta-rockchip layer to the xxxx mailing list (xxxx@zzzz.org) -and cc: the maintainer: - -Maintainer: XXX YYYYYY - -Table of Contents -================= - - I. Adding the meta-rockchip layer to your build - II. Misc - - -I. Adding the meta-rockchip layer to your build -================================================= - -Run 'bitbake-layers add-layer meta-rockchip' - -II. Misc -======== - ---- replace with specific information about the meta-rockchip layer --- diff --git a/bsp/meta-rockchip/README.md b/bsp/meta-rockchip/README.md new file mode 100644 index 0000000000000000000000000000000000000000..9e78e23302bba34defe10a4e39433fa52bb25c28 --- /dev/null +++ b/bsp/meta-rockchip/README.md @@ -0,0 +1,165 @@ +# meta-rockchip + +Yocto BSP layer for the Rockchip SOC boards + - wiki . + +This README file contains information on building and booting the meta-rockchip BSP layers. + +Please see the corresponding sections below for details. + +## Dependencies + +This layer depends on: + +* URI: git://git.yoctoproject.org/poky +* branch: kirkstone + +* URI: git://git.openembedded.org/meta-openembedded +* layers: meta-oe +* branch: kirkstone + +## Table of Contents + +I. Configure yocto/oe Environment + +II. Building meta-rockchip BSP Layers + +III. Booting your Device + +IV. Tested Hardwares + +V. Supporting new Machine + +### I. Configure yocto/oe Environment + +In order to build an image with BSP support for a given release, you need to download the corresponding layers described in the "Dependencies" section. Be sure that everything is in the same directory. + +```shell +~ $ mkdir yocto; cd yocto +~/yocto $ git clone git://git.yoctoproject.org/poky -b kirkstone +~/yocto $ git clone git://git.openembedded.org/meta-openembedded.git -b kirkstone +``` + +And put the meta-rockchip layer here too. + +Then you need to source the configuration script: + +```shell +~/yocto $ source poky/oe-init-build-env +``` + +Having done that, you can build a image for a rockchip board by adding the location of the meta-rockchip layer to bblayers.conf, along with any other layers needed. + +For example: + +```makefile +# build/conf/bblayers.conf +BBLAYERS ?= " \ + ${TOPDIR}/../meta-rockchip \ + ${TOPDIR}/../poky/meta \ + ${TOPDIR}/../poky/meta-poky \ + ${TOPDIR}/../poky/meta-yocto-bsp \ + ${TOPDIR}/../meta-openembedded/meta-oe \ +``` + +To enable a particular machine, you need to add a MACHINE line naming the BSP to the local.conf file: + +```makefile + MACHINE = "xxx" +``` + +All supported machines can be found in meta-rockchip/conf/machine. + +### II. Building meta-rockchip BSP Layers + +You should then be able to build a image as such: + +```shell +$ bitbake core-image-minimal +``` + +At the end of a successful build, you should have an .wic image in `/path/to/yocto/build/tmp/deploy/images//`, also with an rockchip firmware image: `update.img`. + +### III. Booting your Device + +Under Linux, you can use upgrade_tool: to flash the image: + +1. Put your device into rockusb mode: + +2. If it's maskrom rockusb mode, try to enter miniloader rockusb mode: + +```shell +$ sudo upgrade_tool db /loader.bin +``` + +3. Flash the image (wic image or rockchip firmware image) + +```shell +$ sudo upgrade_tool wl 0 /.wic # For wic image +``` + +```shell +$ sudo upgrade_tool uf /update.img # For rockchip firmware image +``` + +### IV. Tested Hardwares + +The following undergo regular basic testing with their respective MACHINE types. + +* px3se evb board + +* rk3308 evb board + +* rk3326 evb board + +* px30 evb board + +* rk3328 evb board + +* rk3288 evb board + +* rk3399 sapphire excavator board + +* rk3399pro evb board + +### V. Supporting new Machine + +To support new machine, you can either add new machine config in meta-rockchip/conf/machine, or choose a similar existing machine and override it's configurations in local config file. + +In general, a new machine needs to specify it's u-boot config, kernel config, kernel device tree and wifi/bt firmware: + +For example: + +```makefile +KBUILD_DEFCONFIG = "rk3326_linux_defconfig" +KERNEL_DEVICETREE = "rockchip/rk3326-evb-lp3-v10-linux.dtb" +UBOOT_MACHINE = "evb-rk3326_defconfig" +RK_WIFIBT_FIRMWARES = " \ + rkwifibt-firmware-ap6212a1-wifi \ + rkwifibt-firmware-ap6212a1-bt \ + brcm-tools \ +" +``` + +If you want to use your own local u-boot and kernel sources, a simple way is to override related configurations in local config file. + +For example using the kernel/ and u-boot/ in the same directory of meta-rockchip: + +```makefile +# build/conf/local.conf +SRC_URI:pn-linux-rockchip = " \ + git://${TOPDIR}/../kernel;protocol=file;usehead=1 \ + file://cgroups.cfg \ +" +SRCREV:pn-linux-rockchip = "${AUTOREV}" +KBRANCH = "HEAD" + +SRC_URI:pn-u-boot = " \ + git://${TOPDIR}/../u-boot;protocol=file;usehead=1 \ +" +SRCREV:pn-u-boot = "${AUTOREV}" +``` + +## Maintainers + +* Jeffy Chen `` diff --git a/bsp/meta-rockchip/classes/auto-patch.bbclass b/bsp/meta-rockchip/classes/auto-patch.bbclass new file mode 100644 index 0000000000000000000000000000000000000000..41b2f04b436dcff4531d4e39d44af0756946b3ef --- /dev/null +++ b/bsp/meta-rockchip/classes/auto-patch.bbclass @@ -0,0 +1,20 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +CURDIR := "${THISDIR}/" +PATCHPATH ?= "${@d.getVar('CURDIR') + d.getVar('BPN') + '_' + d.getVar('PV')}" + +python () { + dir = d.getVar('PATCHPATH') or '' + if not os.path.isdir(dir): + return + + bb.parse.mark_dependency(d, dir) + + files = os.listdir(dir) + files.sort() + for file in files: + if file.endswith('.patch'): + d.appendVar('SRC_URI', ' file://' + dir + '/' + file) + bb.debug(2, 'Adding patch: ' + file + ' for ' + dir) +} diff --git a/bsp/meta-rockchip/classes/freeze-rev.bbclass b/bsp/meta-rockchip/classes/freeze-rev.bbclass new file mode 100644 index 0000000000000000000000000000000000000000..434d3afa3406ae714cbc7960ade928636c9cafc7 --- /dev/null +++ b/bsp/meta-rockchip/classes/freeze-rev.bbclass @@ -0,0 +1,35 @@ +# Copyright (C) 2020, Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +BB_FILE := "${FILE}" + +python () { + import glob + import subprocess + + if d.getVar('FREEZE_REV') != '1': + return + + if d.getVar('PN').startswith('nativesdk'): + return + + file = d.getVar('BB_FILE') + fetcher = bb.fetch2.Fetch(d.getVar('SRC_URI').split(), d) + urldata = fetcher.ud + for u in urldata: + if not urldata[u].method.supports_srcrev(): + continue + + ud = urldata[u] + for name in ud.names: + autoinc, rev = getattr(ud.method, 'sortable_revision')(ud, d, name) + + var = 'SRCREV' + if name != 'default': + var += '_' + name + + cmd = 'sed -i "/<%s>/s/=.*/= \\"%s\\"/" %s' % (var, rev, file) + subprocess.call(cmd, shell=True) + + bb.debug(2, 'Freezing %s to %s in %s' % (var, rev, file)) +} diff --git a/bsp/meta-rockchip/classes/local-git.bbclass b/bsp/meta-rockchip/classes/local-git.bbclass new file mode 100644 index 0000000000000000000000000000000000000000..7b9358481008be87c6024a780cfb991116dc93c7 --- /dev/null +++ b/bsp/meta-rockchip/classes/local-git.bbclass @@ -0,0 +1,34 @@ +# Copyright (C) 2021, Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +#python () { +# from bb.fetch2 import git +# from bb.fetch2 import Fetch +# from bb.fetch2 import runfetchcmd +# import shlex +# +# git = git.Git() +# bb.fetch2.get_srcrev(d) +# fetcher = Fetch(d.getVar('SRC_URI').split(), d) +# urldata = fetcher.ud +# for u in urldata: +# if not urldata[u].method.supports_srcrev(): +# continue +# +# ud = urldata[u] +# if ud.proto.lower() != 'file' or ud.type != 'git': +# continue +# +# if not os.path.exists(ud.clonedir): +# continue +# +# repourl = git._get_repo_url(ud) +# +# # Try an early full fetching +# fetch_cmd = "LANG=C %s fetch %s" % (ud.basecmd, shlex.quote(repourl)) +# try: +# runfetchcmd(fetch_cmd, d, workdir=ud.clonedir) +# except bb.fetch2.FetchError: +# # Ignoring errors +# return +#} diff --git a/bsp/meta-rockchip/conf/layer.conf b/bsp/meta-rockchip/conf/layer.conf index d183d32b2feda57667f9585c18d53a81699f2830..10d30a0eac38d13d66f93469d4923a434e64dff5 100644 --- a/bsp/meta-rockchip/conf/layer.conf +++ b/bsp/meta-rockchip/conf/layer.conf @@ -1,19 +1,32 @@ +# Copyright (c) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + # We have a conf and classes directory, add to BBPATH BBPATH .= ":${LAYERDIR}" # We have recipes-* directories, add to BBFILES BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ - ${LAYERDIR}/recipes-*/*/*.bbappend" + ${LAYERDIR}/recipes-*/*/*.bbappend" + +BBFILES_DYNAMIC += " \ + browser-layer:${LAYERDIR}/dynamic-layers/recipes-browser/*/*.bbappend \ + chromium-browser-layer:${LAYERDIR}/dynamic-layers/recipes-browser/*/*.bbappend \ + qt5-layer:${LAYERDIR}/dynamic-layers/recipes-qt/*/*.bbappend \ +" BBFILE_COLLECTIONS += "rockchip" BBFILE_PATTERN_rockchip := "^${LAYERDIR}/" -BBFILE_PRIORITY_rockchip = "6" +BBFILE_PRIORITY_rockchip = "9" -LAYERDEPENDS_rockchip = "core" -LAYERSERIES_COMPAT_rockchip = "kirkstone" +RKBASE = '${@os.path.normpath("${LAYERDIR}")}' +BB_BASEHASH_IGNORE_VARS:append = " RKBASE" -# enable .bb under qt5-layer/ when exist meta-qt5 -BBFILES_DYNAMIC += " \ -qt5-layer:${LAYERDIR}/dynamic-layers/qt5-layer/recipes-*/*/*.bb \ -qt5-layer:${LAYERDIR}/dynamic-layers/qt5-layer/recipes-*/*/*.bbappend \ -" +# Additional license directories. +LICENSE_PATH += "${LAYERDIR}/licenses" + +LAYERDEPENDS_rockchip = "core openembedded-layer" + +# This should only be incremented on significant changes that will +# cause compatibility issues with other layers +LAYERVERSION_rockchip = "1" +LAYERSERIES_COMPAT_rockchip = "kirkstone" diff --git a/bsp/meta-rockchip/conf/machine/include/px30.inc b/bsp/meta-rockchip/conf/machine/include/px30.inc new file mode 100644 index 0000000000000000000000000000000000000000..28c1e0cbf0630567aea4dcf9272054d7c29118a6 --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/include/px30.inc @@ -0,0 +1,12 @@ +# Copyright (c) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +SOC_FAMILY ?= "px30" +require conf/machine/include/rockchip-arm64-common.inc + +KBUILD_DEFCONFIG = "px30_linux_defconfig" + +MALI_GPU := "bifrost-g31" +MALI_VERSION ?= "g2p0" + +RK_ISP_VERSION := "1" diff --git a/bsp/meta-rockchip/conf/machine/include/px3se.inc b/bsp/meta-rockchip/conf/machine/include/px3se.inc new file mode 100644 index 0000000000000000000000000000000000000000..9eaca5b996464e1088c74735f83bef02c0220750 --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/include/px3se.inc @@ -0,0 +1,10 @@ +# Copyright (c) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +SOC_FAMILY ?= "px3se" +require conf/machine/include/arm/armv7a/tune-cortexa7.inc +require conf/machine/include/rockchip-common.inc + +MALI_GPU := "utgard-400" +MALI_VERSION ?= "r7p0" +MALI_SUBVERSION := "r1p1" diff --git a/bsp/meta-rockchip/conf/machine/include/rk3288.inc b/bsp/meta-rockchip/conf/machine/include/rk3288.inc new file mode 100644 index 0000000000000000000000000000000000000000..74be4b5a1cff6f218ccdea83d6b34ae183951293 --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/include/rk3288.inc @@ -0,0 +1,12 @@ +# Copyright (c) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +SOC_FAMILY ?= "rk3288" +require conf/machine/include/arm/armv7a/tune-cortexa17.inc +require conf/machine/include/rockchip-common.inc + +MALI_GPU := "midgard-t76x" +MALI_VERSION ?= "r18p0" +MALI_SUBVERSION := "${@bb.utils.contains('MACHINE_FEATURES', 'rk3288w', 'r1p0', 'r0p0', d)}" + +RK_ISP_VERSION := "1" diff --git a/bsp/meta-rockchip/conf/machine/include/rk3308.inc b/bsp/meta-rockchip/conf/machine/include/rk3308.inc new file mode 100644 index 0000000000000000000000000000000000000000..2e04668f560e34996621bf535684258fd89ab754 --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/include/rk3308.inc @@ -0,0 +1,11 @@ +# Copyright (c) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +SOC_FAMILY ?= "rk3308" +require conf/machine/include/rockchip-arm64-common.inc + +RK_USE_COMPRESSED_KERNEL = "1" + +KBUILD_DEFCONFIG = "rk3308_linux_defconfig" + +RK_LOADER_BACKUP_NUM = "2" diff --git a/bsp/meta-rockchip/conf/machine/include/rk3326.inc b/bsp/meta-rockchip/conf/machine/include/rk3326.inc new file mode 100644 index 0000000000000000000000000000000000000000..1a9e5b85c87369d997dab6f3e9983810e9a3cb1b --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/include/rk3326.inc @@ -0,0 +1,7 @@ +# Copyright (c) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +SOC_FAMILY ?= "rk3326" +require conf/machine/include/px30.inc + +KBUILD_DEFCONFIG = "rk3326_linux_defconfig" diff --git a/bsp/meta-rockchip/conf/machine/include/rk3328.inc b/bsp/meta-rockchip/conf/machine/include/rk3328.inc new file mode 100644 index 0000000000000000000000000000000000000000..7c8806699b0690fb39fb413e6e486abbea19f6b1 --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/include/rk3328.inc @@ -0,0 +1,8 @@ +# Copyright (c) 2020, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +SOC_FAMILY ?= "rk3328" +require conf/machine/include/rockchip-arm64-common.inc + +MALI_GPU := "utgard-450" +MALI_VERSION ?= "r7p0" diff --git a/bsp/meta-rockchip/conf/machine/include/rk3399.inc b/bsp/meta-rockchip/conf/machine/include/rk3399.inc new file mode 100644 index 0000000000000000000000000000000000000000..e806d830ab62931ad7a2fb4f9a822212c16325d1 --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/include/rk3399.inc @@ -0,0 +1,13 @@ +# Copyright (c) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +SOC_FAMILY ?= "rk3399" +PREFERRED_VERSION_linux-rockchip ?= "4.19%" +LINUXLIBCVERSION ?= "4.19-custom%" + +require conf/machine/include/rockchip-arm64-common.inc + +MALI_GPU := "midgard-t86x" +MALI_VERSION ?= "r18p0" + +RK_ISP_VERSION := "1" diff --git a/bsp/meta-rockchip/conf/machine/include/rk3562.inc b/bsp/meta-rockchip/conf/machine/include/rk3562.inc new file mode 100644 index 0000000000000000000000000000000000000000..9ff9ad71b9ef9757e7cac2977bdc135716c8a00c --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/include/rk3562.inc @@ -0,0 +1,8 @@ +# Copyright (c) 2023, Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +SOC_FAMILY ?= "rk3562" +PREFERRED_VERSION_linux-rockchip ?= "5.10%" +LINUXLIBCVERSION ?= "5.10-custom%" + +require conf/machine/include/rk356x.inc diff --git a/bsp/meta-rockchip/conf/machine/include/rk3568.inc b/bsp/meta-rockchip/conf/machine/include/rk3568.inc deleted file mode 100644 index afe4a58d47c2f1bb7f8242a4f893a9f9b12998b6..0000000000000000000000000000000000000000 --- a/bsp/meta-rockchip/conf/machine/include/rk3568.inc +++ /dev/null @@ -1,34 +0,0 @@ -require conf/machine/include/arm/armv8-2a/tune-cortexa55.inc -MACHINE_FEATURES += "efi pci vc4graphics" -MACHINEOVERRIDES =. "rk3568:march64le:" -DEFAULTTUNE = "aarch64" - -require conf/multilib.conf -# currently, don't support 32 bit libs -MULTILIBS = "" - -ROOTFS_PACKAGE_ARCH = "aarch64" - -# set IMAGETYPE and dtb -KERNEL_IMAGETYPE = "Image" -# choose dtb file -RK3568_KERNEL_DTB_NAME ?= "OK3568-C-linux.dtb" -KERNEL_DEVICETREE = "rockchip/${RK3568_KERNEL_DTB_NAME}" -ENABLE_UART = "1" -# serial port enabled in ok3568 -CMDLINE_SERIAL = "console=tty1 console=ttyFIQ0,115200" -SERIAL_CONSOLES = "115200;ttyFIQ0" - -# arm and arm64 both support -mlittle-endian so no -# need to consider compat32. -TUNE_CCARGS .= " -mlittle-endian" -IMAGE_INSTALL:append = " kernel-modules" - -# auto load module during startup -KERNEL_MODULE_AUTOLOAD = "mlan moal " - -# set MCS_FEATURES -# rk3568 only supports the "openamp" mechanism, -# and client os only supports uniproton, rtt -MCS_FEATURES = "openamp" -MCS_FEATURES := "${@bb.utils.contains('DISTRO_FEATURES', 'mcs', '${MCS_FEATURES}', '', d)}" diff --git a/bsp/meta-rockchip/conf/machine/include/rk356x.inc b/bsp/meta-rockchip/conf/machine/include/rk356x.inc new file mode 100644 index 0000000000000000000000000000000000000000..3c2f0cb8280cadd5880676355fedb617547e5f33 --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/include/rk356x.inc @@ -0,0 +1,13 @@ +# Copyright (c) 2020, Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +SOC_FAMILY ?= "rk3568" +PREFERRED_VERSION_linux-rockchip ?= "4.19%" +LINUXLIBCVERSION ?= "4.19-custom%" + +require conf/machine/include/rockchip-arm64-common.inc + +MALI_GPU := "bifrost-g52" +MALI_VERSION ?= "g2p0" + +RK_ISP_VERSION := "2.1" diff --git a/bsp/meta-rockchip/conf/machine/include/rk3588.inc b/bsp/meta-rockchip/conf/machine/include/rk3588.inc new file mode 100644 index 0000000000000000000000000000000000000000..565f1da7d413cfe84311cff5c45bdab88d9e581c --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/include/rk3588.inc @@ -0,0 +1,13 @@ +# Copyright (c) 2021, Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +SOC_FAMILY ?= "rk3588" +PREFERRED_VERSION_linux-rockchip ?= "5.10%" +LINUXLIBCVERSION ?= "5.10-custom%" + +require conf/machine/include/rockchip-arm64-common.inc + +MALI_GPU := "valhall-g610" +MALI_VERSION ?= "g6p0" + +RK_ISP_VERSION := "3.0" diff --git a/bsp/meta-rockchip/conf/machine/include/rockchip-arm64-common.inc b/bsp/meta-rockchip/conf/machine/include/rockchip-arm64-common.inc new file mode 100644 index 0000000000000000000000000000000000000000..ec07b08edf39b534c7cd78f70355f00948297501 --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/include/rockchip-arm64-common.inc @@ -0,0 +1,9 @@ +# Copyright (c) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +require conf/machine/include/rockchip-common.inc +include conf/machine/include/arm/arch-armv8a.inc + +SERIAL_CONSOLES = "1500000;ttyFIQ0" + +RK_USE_COMPRESSED_KERNEL = "0" diff --git a/bsp/meta-rockchip/conf/machine/include/rockchip-common.inc b/bsp/meta-rockchip/conf/machine/include/rockchip-common.inc new file mode 100644 index 0000000000000000000000000000000000000000..b8c8d48ec5bd9ea286cbc87ba16ed04b322954df --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/include/rockchip-common.inc @@ -0,0 +1,223 @@ +# Copyright (c) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +require conf/machine/include/soc-family.inc + +MACHINE_EXTRA_RRECOMMENDS:append = " \ + ${RK_WIFIBT_FIRMWARES} \ + kernel-modules \ +" + +RK_ISP_VERSION := "" + +SERIAL_CONSOLES ?= "115200;ttyFIQ0" +KERNEL_IMAGETYPE ?= "Image" +KBUILD_DEFCONFIG ?= "rockchip_linux_defconfig" +MACHINEOVERRIDES .= ":rockchip" + +PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot" + +PREFERRED_PROVIDER_virtual/kernel ?= "linux-rockchip" + +# Prefer using Rockchip BSP kernel 4.4 +#PREFERRED_VERSION_linux-rockchip ?= "4.19%" +#LINUXLIBCVERSION ?= "4.19-custom%" +PREFERRED_VERSION_linux-rockchip ?= "4.4%" +LINUXLIBCVERSION ?= "4.4-custom%" + +# Custom kernel might not support newest python +# PACKAGECONFIG:remove:pn-perf = "scripting" + +PREFERRED_PROVIDER_virtual/xserver ?= "xserver-xorg" +XSERVER ?= " \ + xserver-xorg \ + xf86-video-modesetting \ + xserver-xorg-module-exa \ + " + +PREFERRED_PROVIDER_virtual/egl ?= "rockchip-libmali" +PREFERRED_PROVIDER_virtual/libgles1 ?= "rockchip-libmali" +PREFERRED_PROVIDER_virtual/libgles2 ?= "rockchip-libmali" +PREFERRED_PROVIDER_virtual/libgles3 ?= "rockchip-libmali" +PREFERRED_PROVIDER_virtual/libopencl ?= "rockchip-libmali" +PREFERRED_PROVIDER_virtual/libgbm ?= "rockchip-libmali" +PACKAGECONFIG:pn-wayland ?= "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'no-egl', '', d)}" + +DEPENDS:append:pn-mesa-gl = " rockchip-libmali" + +PREFERRED_PROVIDER_virtual/libgl ?= "mesa-gl" +PREFERRED_PROVIDER_virtual/mesa ?= "mesa-gl" + +PREFERRED_RPROVIDER_lib32-initd-functions = "lib32-initscripts" + +export RK_ROOTDEV_UUID ?= "614e0000-0000-4b53-8000-1d28000054a9" +export RK_PARTITION_GROW ?= "1" + +RK_USE_COMPRESSED_KERNEL ?= "1" +RDEPENDS:${KERNEL_PACKAGE_NAME}-base = "" + +IMAGE_FSTYPES:remove = "iso live" +export RK_ROOTFS_TYPE ?= "ext4" + +IMAGE_FSTYPES:append = " ${RK_ROOTFS_TYPE} wic" +WKS_FILE ?= "generic-gptdisk.wks.in" + +# Some partitons, e.g. trust, are allowed to be optional. +do_fixup_wks[depends] += " \ + virtual/kernel:do_deploy \ + virtual/bootloader:do_deploy \ +" +do_fixup_wks() { + [ -f "${WKS_FULL_PATH}" ] || return + + IMAGES=$(grep -o "[^=]*\.img" "${WKS_FULL_PATH}") + + for image in ${IMAGES};do + if [ ! -f "${DEPLOY_DIR_IMAGE}/${image}" ];then + echo "${image} not provided, ignoring it." + sed -i "/file=${image}/d" "${WKS_FULL_PATH}" + fi + done +} +# addtask do_fixup_wks after do_write_wks_template before do_image_wic + +RK_POST_ROOTFS_SCRIPTS ?= "" +RK_OVERLAY_DIRS ?= "" +BB_BASEHASH_IGNORE_VARS:append = " RK_POST_ROOTFS_SCRIPTS RK_OVERLAY_DIRS" + +# e.g. "oem:/oem userdata:/userdata" +RK_EXTRA_VOLUMES ?= "" + +# ROOTFS_POSTPROCESS_COMMAND:append = " do_post_rootfs;" +do_rootfs[depends] += "rsync-native:do_populate_sysroot" +do_post_rootfs() { + # Rockchip BSP rkwifibt drivers would use custom firmware directories + for dir in vendor system;do + firmware_dir=${IMAGE_ROOTFS}/${dir}/etc/ + mkdir -p ${firmware_dir} + ln -sf /lib/firmware ${firmware_dir} + done + + for overlay in ${RK_OVERLAY_DIRS};do + [ -d "${overlay}" ] || continue + echo "Installing overlay: ${overlay}..." + rsync -av --chmod=u=rwX,go=rX "${overlay}/" "${IMAGE_ROOTFS}" + done + + for script in ${RK_POST_ROOTFS_SCRIPTS};do + [ -f "${script}" ] || continue + echo "Running script: ${script}..." + cd "${script%/*}" + "${script}" "${IMAGE_ROOTFS}" + done +} + +IMAGE_POSTPROCESS_COMMAND:append = " link_rootfs_image;" +link_rootfs_image() { + ln -sf "${IMAGE_LINK_NAME}.${RK_ROOTFS_TYPE}" \ + "${IMGDEPLOYDIR}/rootfs.img" +} + +IMAGE_POSTPROCESS_COMMAND:append = " gen_rkparameter;" +gen_rkparameter() { + if [ ! -f "${DEPLOY_DIR_IMAGE}/loader.bin" ];then + echo "Skip making Rockchip parameter." + return + fi + + IMAGE="${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.wic" + if [ ! -f "${IMAGE}" ];then + echo "${IMAGE} not found." + return + fi + + cd "${IMGDEPLOYDIR}" + + OUT="${IMAGE_LINK_NAME}.parameter" + ln -sf "${OUT}" parameter + + echo "Generating ${OUT}..." + + echo "# IMAGE_NAME: $(readlink ${IMAGE})" > "${OUT}" + echo "FIRMWARE_VER: 1.0" >> "${OUT}" + echo "TYPE: GPT" >> "${OUT}" + echo -n "CMDLINE: mtdparts=rk29xxnand:" >> "${OUT}" + sgdisk -p "${IMAGE}" | grep -E "^ +[0-9]" | while read line;do + NAME=$(echo ${line} | cut -f 7 -d ' ') + START=$(echo ${line} | cut -f 2 -d ' ') + END=$(echo ${line} | cut -f 3 -d ' ') + SIZE=$(expr ${END} - ${START} + 1) + printf "0x%08x@0x%08x(%s)," ${SIZE} ${START} ${NAME} >> "${OUT}" + done + echo >> "${OUT}" + + if [ "$RK_PARTITION_GROW" = "1" ];then + sed -i "s/[^,]*\(@[^,]*\)),$/-\1:grow)/" "${OUT}" + fi + + echo "uuid: rootfs=${RK_ROOTDEV_UUID}" >> "${OUT}" +} + +IMAGE_POSTPROCESS_COMMAND:append = " gen_rkupdateimg;" +do_image[depends] += "rk-binary-native:do_populate_sysroot" +gen_rkupdateimg() { + if [ ! -f "${DEPLOY_DIR_IMAGE}/loader.bin" ];then + echo "Skip packing Rockchip update image." + return + fi + + IMAGE="${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.wic" + if [ ! -f "${IMAGE}" ];then + echo "${IMAGE} not found." + return + fi + + cd "${IMGDEPLOYDIR}" + + RK_IMAGES="loader.bin uboot.env uboot.img trust.img boot.img" + + # Create temporary symlinks, because the tool would crash with abs pathes + for img in ${RK_IMAGES};do + f="${DEPLOY_DIR_IMAGE}/${img}" + [ -f "${f}" ] && ln -sf "${f}" . + done + + OUT="${IMAGE_LINK_NAME}.package-file" + ln -sf "${OUT}" package-file + + echo "Generating ${OUT}..." + + echo "# IMAGE_NAME: $(readlink ${IMAGE})" > "${OUT}" + echo "package-file package-file" >> "${OUT}" + echo "bootloader loader.bin" >> "${OUT}" + echo "parameter parameter" >> "${OUT}" + grep -o "([^)^:]*" parameter | tr -d "(" | while read NAME;do + echo -n "${NAME} " >> "${OUT}" + case "${NAME}" in + uboot-env) + echo "uboot.env" >> "${OUT}" + ;; + root*|system*) + echo "rootfs.img" >> "${OUT}" + ;; + *) + echo "${NAME}.img" >> "${OUT}" + ;; + esac + done + + PSEUDO_DISABLED=1 + afptool -pack ./ update.raw.img + rkImageMaker -RK$(hexdump -s 21 -n 4 -e '4/1 "%c"' loader.bin | rev) \ + loader.bin update.raw.img "${IMAGE_LINK_NAME}.update.img" \ + -os_type:androidos + ln -sf "${IMAGE_LINK_NAME}.update.img" update.img + + rm -rf ${RK_IMAGES} update.raw.img +} + +IMAGE_POSTPROCESS_COMMAND:append = " link_latest_image;" +link_latest_image() { + rm -rf "${TOPDIR}/latest" + ln -sf "${DEPLOY_DIR_IMAGE}" "${TOPDIR}/latest" +} diff --git a/bsp/meta-rockchip/conf/machine/ok3568.conf b/bsp/meta-rockchip/conf/machine/ok3568.conf index 5118f8ff3e8694b4e87185f3db82c5affe6e7a60..6d04a685f460e8082e1b1d05069fab84792570dd 100644 --- a/bsp/meta-rockchip/conf/machine/ok3568.conf +++ b/bsp/meta-rockchip/conf/machine/ok3568.conf @@ -1,2 +1 @@ -require conf/machine/include/rk3568.inc -KERNEL_MODULE_AUTOLOAD:append = " ${@bb.utils.contains('MCS_FEATURES', 'openamp', 'mcs_km', '', d)} " +require conf/machine/rockchip-rk3566-evb.conf diff --git a/bsp/meta-rockchip/conf/machine/rockchip-px30-evb.conf b/bsp/meta-rockchip/conf/machine/rockchip-px30-evb.conf new file mode 100644 index 0000000000000000000000000000000000000000..1cd9366c18b99e7801e5b3ce117d1610ac5f8305 --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/rockchip-px30-evb.conf @@ -0,0 +1,17 @@ +# Copyright (c) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +#@TYPE: Machine +#@NAME: PX30 EVB + +require conf/machine/include/px30.inc + +KERNEL_DEVICETREE = "rockchip/px30-evb-ddr3-v10-linux.dtb" + +UBOOT_MACHINE = "evb-px30_defconfig" + +RK_WIFIBT_FIRMWARES = " \ + rkwifibt-firmware-ap6212a1-wifi \ + rkwifibt-firmware-ap6212a1-bt \ + brcm-tools \ +" diff --git a/bsp/meta-rockchip/conf/machine/rockchip-px3se-evb.conf b/bsp/meta-rockchip/conf/machine/rockchip-px3se-evb.conf new file mode 100644 index 0000000000000000000000000000000000000000..864f722534657e6ffbb2a04d8d1c5379a75d6e16 --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/rockchip-px3se-evb.conf @@ -0,0 +1,17 @@ +# Copyright (c) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +#@TYPE: Machine +#@NAME: PX3SE EVB + +require conf/machine/include/px3se.inc + +KERNEL_DEVICETREE = "px3se-evb.dtb" + +UBOOT_MACHINE = "evb-px3se_defconfig" +RK_TEE_ADDR = "0x68400000" + +RK_WIFIBT_FIRMWARES = " \ + rkwifibt-firmware-rtl8723ds-bt \ + rtl-tools \ +" diff --git a/bsp/meta-rockchip/conf/machine/rockchip-rk3288-evb-act8846.conf b/bsp/meta-rockchip/conf/machine/rockchip-rk3288-evb-act8846.conf new file mode 100644 index 0000000000000000000000000000000000000000..65bceedbdd847bd814c36044d07cdee2d619e249 --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/rockchip-rk3288-evb-act8846.conf @@ -0,0 +1,9 @@ +# Copyright (c) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +#@TYPE: Machine +#@NAME: RK3288 ACT8846 EVB + +require conf/machine/rockchip-rk3288-evb.conf + +KERNEL_DEVICETREE = "rk3288-evb-act8846.dtb" diff --git a/bsp/meta-rockchip/conf/machine/rockchip-rk3288-evb.conf b/bsp/meta-rockchip/conf/machine/rockchip-rk3288-evb.conf new file mode 100644 index 0000000000000000000000000000000000000000..231f805bedd4a440ece0a3b3b15246864228c3f5 --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/rockchip-rk3288-evb.conf @@ -0,0 +1,17 @@ +# Copyright (c) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +#@TYPE: Machine +#@NAME: RK3288 EVB + +require conf/machine/include/rk3288.inc + +KERNEL_DEVICETREE = "rk3288-evb-rk808-linux.dtb" + +UBOOT_MACHINE = "rk3288_defconfig" +RK_TEE_ADDR = "0x08400000" + +RK_WIFIBT_FIRMWARES = " \ + rkwifibt-firmware \ + brcm-tools \ +" diff --git a/bsp/meta-rockchip/conf/machine/rockchip-rk3308-evb-aarch32.conf b/bsp/meta-rockchip/conf/machine/rockchip-rk3308-evb-aarch32.conf new file mode 100644 index 0000000000000000000000000000000000000000..7023633b4fd3991aad40829659e02a53a5d68d87 --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/rockchip-rk3308-evb-aarch32.conf @@ -0,0 +1,14 @@ +# Copyright (c) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +#@TYPE: Machine +#@NAME: RK3308 EVB aarch32 + +DEFAULTTUNE ?= "armv7vethf-neon" +require conf/machine/rockchip-rk3308-evb.conf + +KBUILD_DEFCONFIG = "rk3308_linux_aarch32_defconfig" +KERNEL_DEVICETREE = "rk3308-evb-dmic-pdm-v11-aarch32.dtb" +KERNEL_IMAGETYPE = "zImage" + +UBOOT_MACHINE = "evb-aarch32-rk3308_defconfig" diff --git a/bsp/meta-rockchip/conf/machine/rockchip-rk3308-evb.conf b/bsp/meta-rockchip/conf/machine/rockchip-rk3308-evb.conf new file mode 100644 index 0000000000000000000000000000000000000000..35afcc26aef21da43b7986140732fc9cf916f12d --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/rockchip-rk3308-evb.conf @@ -0,0 +1,17 @@ +# Copyright (c) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +#@TYPE: Machine +#@NAME: RK3308 EVB + +require conf/machine/include/rk3308.inc + +KERNEL_DEVICETREE = "rockchip/rk3308-evb-dmic-pdm-v11.dtb" + +UBOOT_MACHINE = "evb-rk3308_defconfig" + +RK_WIFIBT_FIRMWARES = " \ + rkwifibt-firmware-ap6255-wifi \ + rkwifibt-firmware-ap6255-bt \ + brcm-tools \ +" diff --git a/bsp/meta-rockchip/conf/machine/rockchip-rk3326-evb.conf b/bsp/meta-rockchip/conf/machine/rockchip-rk3326-evb.conf new file mode 100644 index 0000000000000000000000000000000000000000..1fc2f9dba7aade7f182925e56a38755d05d19a05 --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/rockchip-rk3326-evb.conf @@ -0,0 +1,17 @@ +# Copyright (c) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +#@TYPE: Machine +#@NAME: RK3326 EVB + +require conf/machine/include/rk3326.inc + +KERNEL_DEVICETREE = "rockchip/rk3326-evb-lp3-v10-linux.dtb" + +UBOOT_MACHINE = "evb-rk3326_defconfig" + +RK_WIFIBT_FIRMWARES = " \ + rkwifibt-firmware-ap6212a1-wifi \ + rkwifibt-firmware-ap6212a1-bt \ + brcm-tools \ +" diff --git a/bsp/meta-rockchip/conf/machine/rockchip-rk3328-evb.conf b/bsp/meta-rockchip/conf/machine/rockchip-rk3328-evb.conf new file mode 100644 index 0000000000000000000000000000000000000000..080d31fa47fbd174a89b09d3925c077d3be88255 --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/rockchip-rk3328-evb.conf @@ -0,0 +1,17 @@ +# Copyright (c) 2020, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +#@TYPE: Machine +#@NAME: RK3328 EVB + +require conf/machine/include/rk3328.inc + +KERNEL_DEVICETREE = "rockchip/rk3328-evb.dtb" + +UBOOT_MACHINE = "rk3328_defconfig" + +RK_WIFIBT_FIRMWARES = " \ + rkwifibt-firmware-ap6356-wifi \ + rkwifibt-firmware-ap6356-bt \ + brcm-tools \ +" diff --git a/bsp/meta-rockchip/conf/machine/rockchip-rk3399-sapphire-excavator.conf b/bsp/meta-rockchip/conf/machine/rockchip-rk3399-sapphire-excavator.conf new file mode 100644 index 0000000000000000000000000000000000000000..f945ca2cccc3e43144243b4214523d38cc688dc2 --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/rockchip-rk3399-sapphire-excavator.conf @@ -0,0 +1,21 @@ +# Copyright (c) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +#@TYPE: Machine +#@NAME: RK3399 Sapphire Excavator + +require conf/machine/include/rk3399.inc + +KERNEL_DEVICETREE = "rockchip/rk3399-sapphire-excavator-linux.dtb" + +UBOOT_MACHINE = "evb-rk3399_defconfig" + +RK_WIFIBT_FIRMWARES = " \ + rkwifibt-firmware-ap6354-wifi \ + rkwifibt-firmware-ap6354-bt \ + brcm-tools \ +" + +MACHINE_EXTRA_RRECOMMENDS:append = " \ + linux-firmware-rk-cdndp \ +" diff --git a/bsp/meta-rockchip/conf/machine/rockchip-rk3399pro-evb.conf b/bsp/meta-rockchip/conf/machine/rockchip-rk3399pro-evb.conf new file mode 100644 index 0000000000000000000000000000000000000000..6f99180f601e6a94d8b4e569290dea55cea7159b --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/rockchip-rk3399pro-evb.conf @@ -0,0 +1,22 @@ +# Copyright (c) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +#@TYPE: Machine +#@NAME: RK3399pro EVB + +require conf/machine/include/rk3399.inc + +KERNEL_DEVICETREE = "rockchip/rk3399pro-evb-v11-linux.dtb" + +UBOOT_MACHINE = "rk3399pro_defconfig" + +RK_WIFIBT_FIRMWARES = " \ + rkwifibt-firmware-ap6354-wifi \ + rkwifibt-firmware-ap6354-bt \ + brcm-tools \ +" + +MACHINE_EXTRA_RRECOMMENDS:append = " \ + linux-firmware-rk-cdndp \ + rockchip-npu \ +" diff --git a/bsp/meta-rockchip/conf/machine/rockchip-rk3562-evb.conf b/bsp/meta-rockchip/conf/machine/rockchip-rk3562-evb.conf new file mode 100644 index 0000000000000000000000000000000000000000..4481ab1607862157ea1ade1696ff23e331027b91 --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/rockchip-rk3562-evb.conf @@ -0,0 +1,17 @@ +# Copyright (c) 2023, Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +#@TYPE: Machine +#@NAME: RK3562 EVB + +require conf/machine/include/rk3562.inc + +KERNEL_DEVICETREE = "rockchip/rk3562-evb1-lp4x-v10-linux.dtb" + +UBOOT_MACHINE = "rk3562_defconfig" + +RK_WIFIBT_FIRMWARES = " \ + rkwifibt-firmware-ap6275s-wifi \ + rkwifibt-firmware-ap6275-bt \ + brcm-tools \ +" diff --git a/bsp/meta-rockchip/conf/machine/rockchip-rk3566-evb.conf b/bsp/meta-rockchip/conf/machine/rockchip-rk3566-evb.conf new file mode 100644 index 0000000000000000000000000000000000000000..776351a43f0427c02a433a0490628131bd4ba1fe --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/rockchip-rk3566-evb.conf @@ -0,0 +1,21 @@ +# Copyright (c) 2020, Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +#@TYPE: Machine +#@NAME: RK3566 EVB + +require conf/machine/include/rk356x.inc + +KERNEL_DEVICETREE = "rockchip/rk3566-evb2-lp4x-v10-linux.dtb" + +UBOOT_MACHINE = "rk3568_defconfig" + +RK_WIFIBT_FIRMWARES = " \ + rkwifibt-firmware-ap6398s-wifi \ + rkwifibt-firmware-ap6398s-bt \ + brcm-tools \ +" + +MACHINE_EXTRA_RRECOMMENDS:append = " \ + drm-cursor \ +" diff --git a/bsp/meta-rockchip/conf/machine/rockchip-rk3568-evb.conf b/bsp/meta-rockchip/conf/machine/rockchip-rk3568-evb.conf new file mode 100644 index 0000000000000000000000000000000000000000..044307ce99b3eb956691c4e3309ee113c2d02bfc --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/rockchip-rk3568-evb.conf @@ -0,0 +1,9 @@ +# Copyright (c) 2020, Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +#@TYPE: Machine +#@NAME: RK3568 EVB + +require conf/machine/rockchip-rk3566-evb.conf + +KERNEL_DEVICETREE = "rockchip/rk3568-evb1-ddr4-v10-linux.dtb" diff --git a/bsp/meta-rockchip/conf/machine/rockchip-rk3588-evb.conf b/bsp/meta-rockchip/conf/machine/rockchip-rk3588-evb.conf new file mode 100644 index 0000000000000000000000000000000000000000..1af1dd3b296795fa23f77a53ddaa2afef1d6b430 --- /dev/null +++ b/bsp/meta-rockchip/conf/machine/rockchip-rk3588-evb.conf @@ -0,0 +1,17 @@ +# Copyright (c) 2021, Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +#@TYPE: Machine +#@NAME: RK3588 EVB + +require conf/machine/include/rk3588.inc + +KERNEL_DEVICETREE = "rockchip/rk3588-evb1-lp4-v10-linux.dtb" + +UBOOT_MACHINE = "rk3588_defconfig" + +RK_WIFIBT_FIRMWARES = " \ + rkwifibt-firmware-ap6275p-wifi \ + rkwifibt-firmware-ap6275-bt \ + brcm-tools \ +" diff --git a/bsp/meta-rockchip/conf/machine/ryd-3568.conf b/bsp/meta-rockchip/conf/machine/ryd-3568.conf deleted file mode 100644 index 0fe7cbb8c6632766e685044cc6456218f79bf6da..0000000000000000000000000000000000000000 --- a/bsp/meta-rockchip/conf/machine/ryd-3568.conf +++ /dev/null @@ -1,2 +0,0 @@ -require conf/machine/include/rk3568.inc -RK3568_KERNEL_DTB_NAME = "rk3568-8897-ddr4-v1-linux-hdmi.dtb" diff --git a/bsp/meta-rockchip/dynamic-layers/qt5-layer/recipes-qt/qt5/qtbase_%.bbappend b/bsp/meta-rockchip/dynamic-layers/qt5-layer/recipes-qt/qt5/qtbase_%.bbappend deleted file mode 100644 index df452b9f5b10a3d2b59600a43e5a5be4e64a51c5..0000000000000000000000000000000000000000 --- a/bsp/meta-rockchip/dynamic-layers/qt5-layer/recipes-qt/qt5/qtbase_%.bbappend +++ /dev/null @@ -1,19 +0,0 @@ -PACKAGECONFIG_GL = "${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'gl', \ - bb.utils.contains('DISTRO_FEATURES', 'opengl', 'eglfs gles2', \ - '', d), d)}" -PACKAGECONFIG_GL:append = "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', ' kms', '', d)}" -PACKAGECONFIG_GL:append = " gbm" -PACKAGECONFIG_FONTS = "fontconfig" -PACKAGECONFIG:append = " libinput examples tslib xkbcommon" -PACKAGECONFIG:remove = "tests" - -OE_QTBASE_EGLFS_DEVICE_INTEGRATION = "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', '', 'eglfs_brcm', d)}" - -do_configure:prepend() { - # Add the appropriate EGLFS_DEVICE_INTEGRATION - if [ "${@d.getVar('OE_QTBASE_EGLFS_DEVICE_INTEGRATION')}" != "" ]; then - echo "EGLFS_DEVICE_INTEGRATION = ${OE_QTBASE_EGLFS_DEVICE_INTEGRATION}" >> ${S}/mkspecs/oe-device-extra.pri - fi -} -RDEPENDS:${PN}:append = "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', '', ' userland', d)}" -DEPENDS:append = "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', '', ' userland', d)}" diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium-%.bbappend b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium-%.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..5f9d9958b81727d5d65fd430caee4d3432e9b698 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium-%.bbappend @@ -0,0 +1,42 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +MAJ_VER = "${@oe.utils.trim_version("${PV}", 3)}" +PATCHPATH = "${CURDIR}/chromium_${MAJ_VER}" +inherit auto-patch + +PACKAGECONFIG ??= "use-egl use-linux-v4l2 proprietary-codecs" +PACKAGECONFIG[use-linux-v4l2] = "use_v4l2_codec=true use_v4lplugin=true use_linux_v4l2_only=true" + +GN_ARGS:append = " is_debug=false is_official_build=false fatal_linker_warnings=false" + +CHROMIUM_EXTRA_ARGS:append = " --no-sandbox --gpu-sandbox-start-early --ignore-gpu-blacklist --ignore-gpu-blocklist --enable-accelerated-video-decode" + +# TODO: Revisit once VDA and VEA are not dependent on Vaapi on linux +CHROMIUM_EXTRA_ARGS:append = " --enable-features=VaapiVideoDecoder,VaapiVideoEncoder" + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +# Fixup v8_qemu_wrapper library search path for component build +# see https://github.com/OSSystems/meta-browser/issues/314 +do_configure:append() { + WRAPPER=${B}/v8-qemu-wrapper.sh + [ -e ${WRAPPER} ] && + sed -i "s#\(LD_LIBRARY_PATH=\)#\1${B}:#" ${WRAPPER} +} + +INSANE_SKIP:${PN} = "already-stripped" + +SRC_URI:append = " file://chromium-init.sh" + +do_install:append () { + install -d ${D}${sysconfdir}/init.d/ + install -m 0755 ${WORKDIR}/chromium-init.sh ${D}${sysconfdir}/init.d/ +} + +inherit update-rc.d + +INITSCRIPT_NAME = "chromium-init.sh" +INITSCRIPT_PARAMS = "start 99 S ." + +FILES:${PN}:append = " ${sysconfdir}/init.d" diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium-x11_%.bbappend b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium-x11_%.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..ee1595d1924b081591b90ffbff65c8b2812a2a50 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium-x11_%.bbappend @@ -0,0 +1,4 @@ +# Copyright (C) 2021, Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +DEPENDS:append = " libxshmfence libxkbcommon" diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0001-Add-support-for-V4L2VDA-on-Linux.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0001-Add-support-for-V4L2VDA-on-Linux.patch new file mode 100644 index 0000000000000000000000000000000000000000..9558b6cece4ee958bb5273efd9b291bc4a4d7c1b --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0001-Add-support-for-V4L2VDA-on-Linux.patch @@ -0,0 +1,464 @@ +From ae44d20b10973d16f7aa0bf94f30c7a1c7ee8ad0 Mon Sep 17 00:00:00 2001 +From: Maksim Sisov +Date: Wed, 31 Jul 2019 09:56:24 +0300 +Subject: [PATCH 01/15] Add support for V4L2VDA on Linux + +This patch enables hardware assisted video decoding via the +Chromium V4L2VDA. Including changes when Linux is used. In +order to use this, use_linux_v4l2_only flag should be set +to true. + +Signed-off-by: Ryo Kodama + +fixup! avoid building not declared formats + +"FRAME", "_SLICE", "V4L2_PIX_FMT_VP9" are not defined in mainline + Linux headers. This patch avoids building these formats. + +Signed-off-by: Ryo Kodama + +fixup! add V4L2_PIX_FMT_VP9 support back again as it is now +included in mainline Linux kernel. This allows VP9 codec +to work with upstream kernel and v4l2 vda. Tested on db820c +with Venus v4l2 driver. + +Signed-off-by: Peter Griffin +Signed-off-by: Stanimir Varbanov +Signed-off-by: Jeffy Chen +--- + .../gpu_mjpeg_decode_accelerator_factory.cc | 3 +- + media/gpu/BUILD.gn | 1 + + media/gpu/args.gni | 4 ++ + .../gpu_video_decode_accelerator_factory.cc | 8 +++ + .../gpu_video_decode_accelerator_factory.h | 2 + + media/gpu/v4l2/BUILD.gn | 43 ++++++------ + media/gpu/v4l2/generic_v4l2_device.cc | 4 ++ + media/gpu/v4l2/v4l2_device.cc | 66 +++++++++++++++++++ + media/gpu/v4l2/v4l2_video_decoder.cc | 7 ++ + 9 files changed, 118 insertions(+), 20 deletions(-) + +diff --git a/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc b/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc +index 3772b8ef0..dece6b77f 100644 +--- a/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc ++++ b/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc +@@ -13,7 +13,8 @@ + #include "media/base/media_switches.h" + #include "media/gpu/buildflags.h" + +-#if BUILDFLAG(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY) ++#if BUILDFLAG(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY) && \ ++ !BUILDFLAG(USE_LINUX_V4L2) + #define USE_V4L2_MJPEG_DECODE_ACCELERATOR + #endif + +diff --git a/media/gpu/BUILD.gn b/media/gpu/BUILD.gn +index cd9e94809..a3cfa38e0 100644 +--- a/media/gpu/BUILD.gn ++++ b/media/gpu/BUILD.gn +@@ -20,6 +20,7 @@ buildflag_header("buildflags") { + "USE_VAAPI_IMAGE_CODECS=$use_vaapi_image_codecs", + "USE_V4L2_CODEC=$use_v4l2_codec", + "USE_LIBV4L2=$use_v4lplugin", ++ "USE_LINUX_V4L2=$use_linux_v4l2_only", + "USE_VAAPI_X11=$use_vaapi_x11", + ] + } +diff --git a/media/gpu/args.gni b/media/gpu/args.gni +index bb2ff0797..da20cff79 100644 +--- a/media/gpu/args.gni ++++ b/media/gpu/args.gni +@@ -21,6 +21,10 @@ declare_args() { + # platforms which have v4l2 hardware encoder / decoder. + use_v4l2_codec = false + ++ # Indicates that only definitions available in the mainline linux kernel ++ # will be used. ++ use_linux_v4l2_only = false ++ + # Indicates if Video4Linux2 AML encoder is used. This is used for AML + # platforms which have v4l2 hardware encoder + use_v4l2_codec_aml = false +diff --git a/media/gpu/gpu_video_decode_accelerator_factory.cc b/media/gpu/gpu_video_decode_accelerator_factory.cc +index 6687b1186..951478638 100644 +--- a/media/gpu/gpu_video_decode_accelerator_factory.cc ++++ b/media/gpu/gpu_video_decode_accelerator_factory.cc +@@ -29,7 +29,9 @@ + #include "ui/gl/gl_implementation.h" + #elif BUILDFLAG(USE_V4L2_CODEC) + #include "media/gpu/v4l2/v4l2_device.h" ++#if !BUILDFLAG(USE_LINUX_V4L2) + #include "media/gpu/v4l2/v4l2_slice_video_decode_accelerator.h" ++#endif + #include "media/gpu/v4l2/v4l2_video_decode_accelerator.h" + #include "ui/gl/gl_surface_egl.h" + #endif +@@ -64,10 +66,12 @@ gpu::VideoDecodeAcceleratorCapabilities GetDecoderCapabilitiesInternal( + GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( + V4L2VideoDecodeAccelerator::GetSupportedProfiles(), + &capabilities.supported_profiles); ++#if !BUILDFLAG(USE_LINUX_V4L2) + GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( + V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles(), + &capabilities.supported_profiles); + #endif ++#endif + #elif BUILDFLAG(IS_MAC) + capabilities.supported_profiles = + VTVideoDecodeAccelerator::GetSupportedProfiles(workarounds); +@@ -146,8 +150,10 @@ GpuVideoDecodeAcceleratorFactory::CreateVDA( + &GpuVideoDecodeAcceleratorFactory::CreateVaapiVDA, + #elif BUILDFLAG(USE_V4L2_CODEC) + &GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA, ++#if !BUILDFLAG(USE_LINUX_V4L2) + &GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA, + #endif ++#endif + + #if BUILDFLAG(IS_MAC) + &GpuVideoDecodeAcceleratorFactory::CreateVTVDA, +@@ -207,6 +213,7 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA( + return decoder; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + std::unique_ptr + GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA( + const gpu::GpuDriverBugWorkarounds& /*workarounds*/, +@@ -222,6 +229,7 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA( + return decoder; + } + #endif ++#endif + + #if BUILDFLAG(IS_MAC) + std::unique_ptr +diff --git a/media/gpu/gpu_video_decode_accelerator_factory.h b/media/gpu/gpu_video_decode_accelerator_factory.h +index b2e1390c5..5a714eb80 100644 +--- a/media/gpu/gpu_video_decode_accelerator_factory.h ++++ b/media/gpu/gpu_video_decode_accelerator_factory.h +@@ -104,11 +104,13 @@ class MEDIA_GPU_EXPORT GpuVideoDecodeAcceleratorFactory { + const gpu::GpuDriverBugWorkarounds& workarounds, + const gpu::GpuPreferences& gpu_preferences, + MediaLog* media_log) const; ++#if !BUILDFLAG(USE_LINUX_V4L2) + std::unique_ptr CreateV4L2SliceVDA( + const gpu::GpuDriverBugWorkarounds& workarounds, + const gpu::GpuPreferences& gpu_preferences, + MediaLog* media_log) const; + #endif ++#endif + #if BUILDFLAG(IS_MAC) + std::unique_ptr CreateVTVDA( + const gpu::GpuDriverBugWorkarounds& workarounds, +diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn +index 0322bbf7f..e7a8743d4 100644 +--- a/media/gpu/v4l2/BUILD.gn ++++ b/media/gpu/v4l2/BUILD.gn +@@ -28,9 +28,6 @@ source_set("v4l2") { + "buffer_affinity_tracker.h", + "generic_v4l2_device.cc", + "generic_v4l2_device.h", +- "v4l2_decode_surface.cc", +- "v4l2_decode_surface.h", +- "v4l2_decode_surface_handler.h", + "v4l2_device.cc", + "v4l2_device.h", + "v4l2_device_poller.cc", +@@ -39,8 +36,6 @@ source_set("v4l2") { + "v4l2_framerate_control.h", + "v4l2_image_processor_backend.cc", + "v4l2_image_processor_backend.h", +- "v4l2_slice_video_decode_accelerator.cc", +- "v4l2_slice_video_decode_accelerator.h", + "v4l2_stateful_workaround.cc", + "v4l2_stateful_workaround.h", + "v4l2_status.h", +@@ -56,24 +51,34 @@ source_set("v4l2") { + "v4l2_video_decoder_backend.h", + "v4l2_video_decoder_backend_stateful.cc", + "v4l2_video_decoder_backend_stateful.h", +- "v4l2_video_decoder_backend_stateless.cc", +- "v4l2_video_decoder_backend_stateless.h", +- "v4l2_video_decoder_delegate_h264.cc", +- "v4l2_video_decoder_delegate_h264.h", +- "v4l2_video_decoder_delegate_h264_legacy.cc", +- "v4l2_video_decoder_delegate_h264_legacy.h", +- "v4l2_video_decoder_delegate_vp8.cc", +- "v4l2_video_decoder_delegate_vp8.h", +- "v4l2_video_decoder_delegate_vp8_legacy.cc", +- "v4l2_video_decoder_delegate_vp8_legacy.h", +- "v4l2_video_decoder_delegate_vp9_chromium.cc", +- "v4l2_video_decoder_delegate_vp9_chromium.h", +- "v4l2_video_decoder_delegate_vp9_legacy.cc", +- "v4l2_video_decoder_delegate_vp9_legacy.h", + "v4l2_video_encode_accelerator.cc", + "v4l2_video_encode_accelerator.h", + ] + ++ if (!use_linux_v4l2_only) { ++ sources += [ ++ "v4l2_decode_surface.cc", ++ "v4l2_decode_surface.h", ++ "v4l2_decode_surface_handler.h", ++ "v4l2_slice_video_decode_accelerator.cc", ++ "v4l2_slice_video_decode_accelerator.h", ++ "v4l2_video_decoder_backend_stateless.cc", ++ "v4l2_video_decoder_backend_stateless.h", ++ "v4l2_video_decoder_delegate_h264.cc", ++ "v4l2_video_decoder_delegate_h264.h", ++ "v4l2_video_decoder_delegate_h264_legacy.cc", ++ "v4l2_video_decoder_delegate_h264_legacy.h", ++ "v4l2_video_decoder_delegate_vp8.cc", ++ "v4l2_video_decoder_delegate_vp8.h", ++ "v4l2_video_decoder_delegate_vp8_legacy.cc", ++ "v4l2_video_decoder_delegate_vp8_legacy.h", ++ "v4l2_video_decoder_delegate_vp9_chromium.cc", ++ "v4l2_video_decoder_delegate_vp9_chromium.h", ++ "v4l2_video_decoder_delegate_vp9_legacy.cc", ++ "v4l2_video_decoder_delegate_vp9_legacy.h", ++ ] ++ } ++ + libs = [ + "EGL", + "GLESv2", +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index b64c9bd0f..92ec1b607 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -441,7 +441,11 @@ bool GenericV4L2Device::OpenDevicePath(const std::string& path, Type type) { + return false; + + #if BUILDFLAG(USE_LIBV4L2) ++#if BUILDFLAG(USE_LINUX_V4L2) ++ if ( ++#else + if (type == Type::kEncoder && ++#endif + HANDLE_EINTR(v4l2_fd_open(device_fd_.get(), V4L2_DISABLE_CONVERSION)) != + -1) { + DVLOGF(3) << "Using libv4l2 for " << path; +diff --git a/media/gpu/v4l2/v4l2_device.cc b/media/gpu/v4l2/v4l2_device.cc +index eecefc676..1ef6e659e 100644 +--- a/media/gpu/v4l2/v4l2_device.cc ++++ b/media/gpu/v4l2/v4l2_device.cc +@@ -853,7 +853,9 @@ void V4L2WritableBufferRef::SetConfigStore(uint32_t config_store) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK(buffer_data_); + ++#if !BUILDFLAG(USE_LINUX_V4L2) + buffer_data_->v4l2_buffer_.config_store = config_store; ++#endif + } + + V4L2ReadableBuffer::V4L2ReadableBuffer(const struct v4l2_buffer& v4l2_buffer, +@@ -996,10 +998,12 @@ V4L2Queue::V4L2Queue(scoped_refptr dev, + return; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + if (reqbufs.capabilities & V4L2_BUF_CAP_SUPPORTS_REQUESTS) { + supports_requests_ = true; + DVLOGF(4) << "Queue supports request API."; + } ++#endif + } + + V4L2Queue::~V4L2Queue() { +@@ -1539,6 +1543,23 @@ std::string V4L2Device::GetDriverName() { + // static + uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + bool slice_based) { ++#if BUILDFLAG(USE_LINUX_V4L2) ++ if (slice_based) { ++ LOG(ERROR) << "Slice not supported"; ++ return 0; ++ } ++ ++ if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { ++ return V4L2_PIX_FMT_H264; ++ } else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) { ++ return V4L2_PIX_FMT_VP8; ++ } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) { ++ return V4L2_PIX_FMT_VP9; ++ } else { ++ DVLOGF(1) << "Unsupported profile: " << GetProfileName(profile); ++ return 0; ++ } ++#else + if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { + if (slice_based) + return V4L2_PIX_FMT_H264_SLICE; +@@ -1558,8 +1579,10 @@ uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + DVLOGF(1) << "Unsupported profile: " << GetProfileName(profile); + return 0; + } ++#endif + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + namespace { + + VideoCodecProfile V4L2ProfileToVideoCodecProfile(VideoCodec codec, +@@ -1606,9 +1629,11 @@ VideoCodecProfile V4L2ProfileToVideoCodecProfile(VideoCodec codec, + } + + } // namespace ++#endif + + std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + uint32_t pix_fmt) { ++#if !BUILDFLAG(USE_LINUX_V4L2) + auto get_supported_profiles = [this]( + VideoCodec codec, + std::vector* profiles) { +@@ -1679,6 +1704,27 @@ std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + VLOGF(1) << "Unhandled pixelformat " << FourccToString(pix_fmt); + return {}; + } ++#else ++ std::vector profiles; ++ switch (pix_fmt) { ++ case V4L2_PIX_FMT_H264: ++ profiles = { ++ H264PROFILE_BASELINE, ++ H264PROFILE_MAIN, ++ H264PROFILE_HIGH, ++ }; ++ break; ++ case V4L2_PIX_FMT_VP8: ++ profiles = {VP8PROFILE_ANY}; ++ break; ++ case V4L2_PIX_FMT_VP9: ++ profiles = {VP9PROFILE_PROFILE0}; ++ break; ++ default: ++ VLOGF(1) << "Unhandled pixelformat " << FourccToString(pix_fmt); ++ return {}; ++ } ++#endif + + // Erase duplicated profiles. + std::sort(profiles.begin(), profiles.end()); +@@ -2346,10 +2392,14 @@ bool V4L2Request::ApplyCtrls(struct v4l2_ext_controls* ctrls) { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + ctrls->which = V4L2_CTRL_WHICH_REQUEST_VAL; + ctrls->request_fd = request_fd_.get(); + + return true; ++#else ++ return false; ++#endif + } + + bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) { +@@ -2361,10 +2411,14 @@ bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + buffer->flags |= V4L2_BUF_FLAG_REQUEST_FD; + buffer->request_fd = request_fd_.get(); + + return true; ++#else ++ return false; ++#endif + } + + bool V4L2Request::Submit() { +@@ -2375,7 +2429,11 @@ bool V4L2Request::Submit() { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + return HANDLE_EINTR(ioctl(request_fd_.get(), MEDIA_REQUEST_IOC_QUEUE)) == 0; ++#else ++ return false; ++#endif + } + + bool V4L2Request::IsCompleted() { +@@ -2418,6 +2476,7 @@ bool V4L2Request::Reset() { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + // Reinit the request to make sure we can use it for a new submission. + if (HANDLE_EINTR(ioctl(request_fd_.get(), MEDIA_REQUEST_IOC_REINIT)) < 0) { + VPLOGF(1) << "Failed to reinit request."; +@@ -2425,6 +2484,9 @@ bool V4L2Request::Reset() { + } + + return true; ++#else ++ return false; ++#endif + } + + V4L2RequestRefBase::V4L2RequestRefBase(V4L2RequestRefBase&& req_base) { +@@ -2499,6 +2561,7 @@ V4L2RequestsQueue::~V4L2RequestsQueue() { + absl::optional V4L2RequestsQueue::CreateRequestFD() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + ++#if !BUILDFLAG(USE_LINUX_V4L2) + int request_fd; + int ret = HANDLE_EINTR( + ioctl(media_fd_.get(), MEDIA_IOC_REQUEST_ALLOC, &request_fd)); +@@ -2508,6 +2571,9 @@ absl::optional V4L2RequestsQueue::CreateRequestFD() { + } + + return base::ScopedFD(request_fd); ++#else ++ return absl::nullopt; ++#endif + } + + absl::optional V4L2RequestsQueue::GetFreeRequest() { +diff --git a/media/gpu/v4l2/v4l2_video_decoder.cc b/media/gpu/v4l2/v4l2_video_decoder.cc +index db6495221..f5807b619 100644 +--- a/media/gpu/v4l2/v4l2_video_decoder.cc ++++ b/media/gpu/v4l2/v4l2_video_decoder.cc +@@ -28,7 +28,10 @@ + #include "media/gpu/macros.h" + #include "media/gpu/v4l2/v4l2_status.h" + #include "media/gpu/v4l2/v4l2_video_decoder_backend_stateful.h" ++ ++#if !BUILDFLAG(USE_LINUX_V4L2) + #include "media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h" ++#endif + + namespace media { + +@@ -46,7 +49,9 @@ constexpr size_t kNumInputBuffers = 8; + + // Input format V4L2 fourccs this class supports. + constexpr uint32_t kSupportedInputFourccs[] = { ++#if !BUILDFLAG(USE_LINUX_V4L2) + V4L2_PIX_FMT_H264_SLICE, V4L2_PIX_FMT_VP8_FRAME, V4L2_PIX_FMT_VP9_FRAME, ++#endif + V4L2_PIX_FMT_H264, V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, + }; + +@@ -318,6 +323,7 @@ V4L2Status V4L2VideoDecoder::InitializeBackend() { + << " and fourcc: " << FourccToString(input_format_fourcc); + backend_ = std::make_unique( + this, device_, profile_, color_space_, decoder_task_runner_); ++#if !BUILDFLAG(USE_LINUX_V4L2) + } else { + DCHECK_EQ(preferred_api_and_format.first, kStateless); + VLOGF(1) << "Using a stateless API for profile: " +@@ -325,6 +331,7 @@ V4L2Status V4L2VideoDecoder::InitializeBackend() { + << " and fourcc: " << FourccToString(input_format_fourcc); + backend_ = std::make_unique( + this, device_, profile_, color_space_, decoder_task_runner_); ++#endif + } + + if (!backend_->Initialize()) { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0002-Add-mmap-via-libv4l-to-generic_v4l2_device.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0002-Add-mmap-via-libv4l-to-generic_v4l2_device.patch new file mode 100644 index 0000000000000000000000000000000000000000..042391f559161263ea6633fcdb33b5de280a172e --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0002-Add-mmap-via-libv4l-to-generic_v4l2_device.patch @@ -0,0 +1,49 @@ +From fca55707c3242d7e257850dbd6509c9e9ffc3736 Mon Sep 17 00:00:00 2001 +From: Damian Hobson-Garcia +Date: Wed, 21 Mar 2018 13:18:17 +0200 +Subject: [PATCH 02/15] Add mmap via libv4l to generic_v4l2_device + +Issue #437 +--- + media/gpu/v4l2/generic_v4l2_device.cc | 10 ++++++++++ + media/gpu/v4l2/v4l2.sig | 2 ++ + 2 files changed, 12 insertions(+) + +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index 92ec1b607..b9da0b3cd 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -125,10 +125,20 @@ void* GenericV4L2Device::Mmap(void* addr, + int flags, + unsigned int offset) { + DCHECK(device_fd_.is_valid()); ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_mmap(addr, len, prot, flags, device_fd_.get(), offset); ++#endif + return mmap(addr, len, prot, flags, device_fd_.get(), offset); + } + + void GenericV4L2Device::Munmap(void* addr, unsigned int len) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) { ++ v4l2_munmap(addr, len); ++ return; ++ } ++#endif + munmap(addr, len); + } + +diff --git a/media/gpu/v4l2/v4l2.sig b/media/gpu/v4l2/v4l2.sig +index 4269fb48d..71b5b3787 100644 +--- a/media/gpu/v4l2/v4l2.sig ++++ b/media/gpu/v4l2/v4l2.sig +@@ -8,3 +8,5 @@ + LIBV4L_PUBLIC int v4l2_close(int fd); + LIBV4L_PUBLIC int v4l2_ioctl(int fd, unsigned long int request, ...); + LIBV4L_PUBLIC int v4l2_fd_open(int fd, int v4l2_flags); ++LIBV4L_PUBLIC void *v4l2_mmap(void *start, size_t length, int prot, int flags, int fd, int64_t offset); ++LIBV4L_PUBLIC int v4l2_munmap(void *_start, size_t length); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0003-media-capture-linux-Support-libv4l2-plugins.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0003-media-capture-linux-Support-libv4l2-plugins.patch new file mode 100644 index 0000000000000000000000000000000000000000..9b6b24de1e6d12aa1e2ca34410cfc867264e13fd --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0003-media-capture-linux-Support-libv4l2-plugins.patch @@ -0,0 +1,178 @@ +From ff57d463710996e0c84feca9ca0520b7bc2505bb Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 1 Jul 2019 10:37:35 +0800 +Subject: [PATCH 03/15] media: capture: linux: Support libv4l2 plugins + +Allow using libv4l2 plugins for linux v4l2 capture devices. + +Signed-off-by: Jeffy Chen +--- + media/capture/BUILD.gn | 14 +++++ + .../video/linux/v4l2_capture_device_impl.cc | 52 ++++++++++++++++++- + .../video/linux/v4l2_capture_device_impl.h | 11 ++++ + 3 files changed, 76 insertions(+), 1 deletion(-) + +diff --git a/media/capture/BUILD.gn b/media/capture/BUILD.gn +index a1170459b..d6ef4d977 100644 +--- a/media/capture/BUILD.gn ++++ b/media/capture/BUILD.gn +@@ -2,6 +2,7 @@ + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. + ++import("//build/buildflag_header.gni") + import("//build/config/chromeos/ui_mode.gni") + import("//build/config/features.gni") + import("//build/config/ui.gni") +@@ -18,6 +19,14 @@ group("capture") { + ] + } + ++buildflag_header("buildflags") { ++ header = "buildflags.h" ++ ++ flags = [ ++ "USE_LIBV4L2=$use_v4lplugin", ++ ] ++} ++ + component("capture_switches") { + defines = [ "CAPTURE_IMPLEMENTATION" ] + sources = [ +@@ -266,6 +275,11 @@ component("capture_lib") { + "video/linux/video_capture_device_linux.cc", + "video/linux/video_capture_device_linux.h", + ] ++ public_deps += [ ":buildflags" ] ++ ++ if (use_v4lplugin) { ++ deps += [ "//media/gpu/v4l2:libv4l2_stubs" ] ++ } + } + + if (is_chromeos_ash) { +diff --git a/media/capture/video/linux/v4l2_capture_device_impl.cc b/media/capture/video/linux/v4l2_capture_device_impl.cc +index c9040f5de..d05d1179e 100644 +--- a/media/capture/video/linux/v4l2_capture_device_impl.cc ++++ b/media/capture/video/linux/v4l2_capture_device_impl.cc +@@ -10,19 +10,61 @@ + #include + #include + ++#if BUILDFLAG(USE_LIBV4L2) ++// Auto-generated for dlopen libv4l2 libraries ++#include "media/gpu/v4l2/v4l2_stubs.h" ++#include "third_party/v4l-utils/lib/include/libv4l2.h" ++ ++#include "base/files/file_path.h" ++ ++using media_gpu_v4l2::kModuleV4l2; ++using media_gpu_v4l2::InitializeStubs; ++using media_gpu_v4l2::StubPathMap; ++ ++static const base::FilePath::CharType kV4l2Lib[] = ++ FILE_PATH_LITERAL("/usr/lib/libv4l2.so"); ++#endif ++ + namespace media { + + V4L2CaptureDeviceImpl::~V4L2CaptureDeviceImpl() = default; + ++V4L2CaptureDeviceImpl::V4L2CaptureDeviceImpl() { ++#if BUILDFLAG(USE_LIBV4L2) ++ StubPathMap paths; ++ paths[kModuleV4l2].push_back(kV4l2Lib); ++ ++ has_libv4l2_ = InitializeStubs(paths); ++#endif ++} ++ + int V4L2CaptureDeviceImpl::open(const char* device_name, int flags) { +- return ::open(device_name, flags); ++ int fd = ::open64(device_name, flags); ++ if (fd < 0) ++ return fd; ++ ++#if BUILDFLAG(USE_LIBV4L2) ++ use_libv4l2_ = false; ++ if (has_libv4l2_ && v4l2_fd_open(fd, V4L2_DISABLE_CONVERSION) != -1) { ++ use_libv4l2_ = true; ++ } ++#endif ++ return fd; + } + + int V4L2CaptureDeviceImpl::close(int fd) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_close(fd); ++#endif + return ::close(fd); + } + + int V4L2CaptureDeviceImpl::ioctl(int fd, int request, void* argp) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_ioctl(fd, request, argp); ++#endif + return ::ioctl(fd, request, argp); + } + +@@ -32,10 +74,18 @@ void* V4L2CaptureDeviceImpl::mmap(void* start, + int flags, + int fd, + off_t offset) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_mmap(start, length, prot, flags, fd, offset); ++#endif + return ::mmap(start, length, prot, flags, fd, offset); + } + + int V4L2CaptureDeviceImpl::munmap(void* start, size_t length) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_munmap(start, length); ++#endif + return ::munmap(start, length); + } + +diff --git a/media/capture/video/linux/v4l2_capture_device_impl.h b/media/capture/video/linux/v4l2_capture_device_impl.h +index 936c8b093..f96c2d434 100644 +--- a/media/capture/video/linux/v4l2_capture_device_impl.h ++++ b/media/capture/video/linux/v4l2_capture_device_impl.h +@@ -8,6 +8,7 @@ + #include + #include + ++#include "media/capture/buildflags.h" + #include "media/capture/capture_export.h" + #include "media/capture/video/linux/v4l2_capture_device.h" + +@@ -17,6 +18,8 @@ namespace media { + // V4L2 APIs. + class CAPTURE_EXPORT V4L2CaptureDeviceImpl : public V4L2CaptureDevice { + public: ++ V4L2CaptureDeviceImpl(); ++ + int open(const char* device_name, int flags) override; + int close(int fd) override; + int ioctl(int fd, int request, void* argp) override; +@@ -32,6 +35,14 @@ class CAPTURE_EXPORT V4L2CaptureDeviceImpl : public V4L2CaptureDevice { + + private: + ~V4L2CaptureDeviceImpl() override; ++ ++#if BUILDFLAG(USE_LIBV4L2) ++ // Has libv4l2. ++ bool has_libv4l2_; ++ // Use libv4l2 when operating |fd|. ++ bool use_libv4l2_; ++#endif ++ + }; + + } // namespace media +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0004-cld3-Avoid-unaligned-accesses.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0004-cld3-Avoid-unaligned-accesses.patch new file mode 100644 index 0000000000000000000000000000000000000000..1c7bf8a369f814a4935fcde7c4f43699d8ffe0aa --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0004-cld3-Avoid-unaligned-accesses.patch @@ -0,0 +1,46 @@ +From 86f2890dffa60e2afb66640df578031535d44978 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 27 Mar 2020 17:48:20 +0800 +Subject: [PATCH 04/15] cld3: Avoid unaligned accesses + +Although the unaligned memory accesses are enabled, somehow i still hit +the SIGBUS: +[23496.643138] Unhandled fault: alignment fault (0x92000021) at 0x00000000b182e636 +Received signal 7 BUS_ADRALN 0000b182e636 + +Signed-off-by: Jeffy Chen +--- + third_party/cld_3/src/src/script_span/port.h | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/third_party/cld_3/src/src/script_span/port.h b/third_party/cld_3/src/src/script_span/port.h +index 2b3bc515a..1d437babf 100644 +--- a/third_party/cld_3/src/src/script_span/port.h ++++ b/third_party/cld_3/src/src/script_span/port.h +@@ -78,11 +78,23 @@ namespace CLD2 { + // + // This is a mess, but there's not much we can do about it. + ++#if 0 + #define UNALIGNED_LOAD16(_p) (*reinterpret_cast(_p)) + #define UNALIGNED_LOAD32(_p) (*reinterpret_cast(_p)) + + #define UNALIGNED_STORE16(_p, _val) (*reinterpret_cast(_p) = (_val)) + #define UNALIGNED_STORE32(_p, _val) (*reinterpret_cast(_p) = (_val)) ++#else ++inline uint32 UNALIGNED_LOAD32(const void *p) { ++ uint32 t; ++ memcpy(&t, p, sizeof t); ++ return t; ++} ++ ++inline void UNALIGNED_STORE32(void *p, uint32 v) { ++ memcpy(p, &v, sizeof v); ++} ++#endif + + // TODO(sesse): NEON supports unaligned 64-bit loads and stores. + // See if that would be more efficient on platforms supporting it, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0005-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0005-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch new file mode 100644 index 0000000000000000000000000000000000000000..c28cc04239b55ac84617703cc2c50989f4d82b8d --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0005-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch @@ -0,0 +1,29 @@ +From ef62e0316c2af86285e4c77f74ac4927ad2ebed3 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 10 Apr 2020 16:16:08 +0800 +Subject: [PATCH 05/15] media: gpu: v4l2: Use POLLIN for pending event + +The v4l-rkmpp is using eventfd to fake poll events which not supporting +POLLPRI. + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/generic_v4l2_device.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index b9da0b3cd..64aa8c6de 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -115,7 +115,7 @@ bool GenericV4L2Device::Poll(bool poll_device, bool* event_pending) { + VPLOGF(1) << "poll() failed"; + return false; + } +- *event_pending = (pollfd != -1 && pollfds[pollfd].revents & POLLPRI); ++ *event_pending = (pollfd != -1 && pollfds[pollfd].revents & POLLIN); + return true; + } + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0006-media-capture-linux-Prefer-using-the-first-device.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0006-media-capture-linux-Prefer-using-the-first-device.patch new file mode 100644 index 0000000000000000000000000000000000000000..37c32cf98f2fe2b397510ff73ba8c093d5947a5d --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0006-media-capture-linux-Prefer-using-the-first-device.patch @@ -0,0 +1,32 @@ +From d7ac82dec64e9a1e8116c5e230e5c0325c9f768b Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 5 Nov 2020 12:22:52 +0800 +Subject: [PATCH 06/15] media: capture: linux: Prefer using the first device + +Somehow the newest chromium would prefer using the last device in some +cases, e.g. apprtc. + +Let's reverse the device array to workaround it. + +Signed-off-by: Jeffy Chen +--- + .../capture/video/linux/video_capture_device_factory_linux.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/media/capture/video/linux/video_capture_device_factory_linux.cc b/media/capture/video/linux/video_capture_device_factory_linux.cc +index 7c90f5c46..1351093ed 100644 +--- a/media/capture/video/linux/video_capture_device_factory_linux.cc ++++ b/media/capture/video/linux/video_capture_device_factory_linux.cc +@@ -197,7 +197,8 @@ void VideoCaptureDeviceFactoryLinux::GetDevicesInfo( + continue; + } + +- devices_info.emplace_back(VideoCaptureDeviceDescriptor( ++ // HACK: Somehow the newest chromium would prefer using the last device in some cases, e.g. apprtc ++ devices_info.emplace(devices_info.begin(), VideoCaptureDeviceDescriptor( + display_name, unique_id, model_id, + VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE, GetControlSupport(fd.get()), + VideoCaptureTransportType::OTHER_TRANSPORT, facing_mode)); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0007-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0007-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch new file mode 100644 index 0000000000000000000000000000000000000000..aa512f11666ecbab97e6564d54584a9b35290adc --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0007-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch @@ -0,0 +1,67 @@ +From 15db811806b2c5a0450ce0a788f9228136957764 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 28 Sep 2020 20:02:00 +0800 +Subject: [PATCH 07/15] media: gpu: v4l2: Fix compile error when ozone not + enabled + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/BUILD.gn | 5 ++++- + media/gpu/v4l2/generic_v4l2_device.cc | 7 +++++++ + 2 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn +index abd856983..f20f18c30 100644 +--- a/media/gpu/v4l2/BUILD.gn ++++ b/media/gpu/v4l2/BUILD.gn +@@ -108,9 +108,12 @@ source_set("v4l2") { + "//media/parsers", + "//third_party/libyuv", + "//ui/gfx/geometry", +- "//ui/ozone", + ] + ++ if (use_ozone) { ++ deps += [ "//ui/ozone" ] ++ } ++ + if (use_v4lplugin) { + deps += [ ":libv4l2_stubs" ] + } +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index 64aa8c6de..11cf9c967 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -34,8 +34,11 @@ + #include "ui/gl/egl_util.h" + #include "ui/gl/gl_bindings.h" + #include "ui/gl/gl_image_native_pixmap.h" ++ ++#if defined(USE_OZONE) + #include "ui/ozone/public/ozone_platform.h" + #include "ui/ozone/public/surface_factory_ozone.h" ++#endif + + #if BUILDFLAG(USE_LIBV4L2) + // Auto-generated for dlopen libv4l2 libraries +@@ -303,6 +306,9 @@ scoped_refptr GenericV4L2Device::CreateGLImage( + const gfx::Size& size, + const Fourcc fourcc, + gfx::NativePixmapHandle handle) const { ++#if !defined(USE_OZONE) ++ return nullptr; ++#else + DVLOGF(3); + DCHECK(CanCreateEGLImageFrom(fourcc)); + +@@ -337,6 +343,7 @@ scoped_refptr GenericV4L2Device::CreateGLImage( + bool ret = image->Initialize(std::move(pixmap)); + DCHECK(ret); + return image; ++#endif + } + + EGLBoolean GenericV4L2Device::DestroyEGLImage(EGLDisplay egl_display, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0008-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0008-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch new file mode 100644 index 0000000000000000000000000000000000000000..6b95985a38062d60cdf0d9d14692a847bec4d015 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0008-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch @@ -0,0 +1,29 @@ +From 387296b7ef10e87a64175f0275d4eeae588d072d Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 20 May 2021 01:05:29 +0800 +Subject: [PATCH 08/15] ui: events: ozone: Define SW_PEN_INSERTED for old + kernel headers + +Signed-off-by: Jeffy Chen +--- + ui/events/ozone/evdev/event_converter_evdev_impl.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/ui/events/ozone/evdev/event_converter_evdev_impl.cc b/ui/events/ozone/evdev/event_converter_evdev_impl.cc +index c2df35976..2660882a0 100644 +--- a/ui/events/ozone/evdev/event_converter_evdev_impl.cc ++++ b/ui/events/ozone/evdev/event_converter_evdev_impl.cc +@@ -31,6 +31,10 @@ namespace { + const int kKeyReleaseValue = 0; + const int kKeyRepeatValue = 2; + ++#ifndef SW_PEN_INSERTED ++#define SW_PEN_INSERTED 0x0f /* set = pen inserted */ ++#endif ++ + // Values for the EV_SW code. + const int kSwitchStylusInserted = SW_PEN_INSERTED; + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0009-Create-new-fence-when-there-s-no-in-fences.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0009-Create-new-fence-when-there-s-no-in-fences.patch new file mode 100644 index 0000000000000000000000000000000000000000..c38154bdee63b397400beb0c4256a7966aba48bd --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0009-Create-new-fence-when-there-s-no-in-fences.patch @@ -0,0 +1,60 @@ +From 3d4c2ca055e6978c06490c6a913f73cd3a1f2eb3 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 01:29:11 +0800 +Subject: [PATCH 09/15] Create new fence when there's no in-fences + +There're cases that in-fences are not provided. + +Signed-off-by: Jeffy Chen +--- + .../wayland/gpu/gbm_surfaceless_wayland.cc | 21 +++++++++++++++++-- + 1 file changed, 19 insertions(+), 2 deletions(-) + +diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +index d3cd40217..f56d3ecf0 100644 +--- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc ++++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +@@ -30,6 +30,12 @@ static constexpr size_t kMaxSolidColorBuffers = 12; + + static constexpr gfx::Size kSolidColorBufferSize{4, 4}; + ++void WaitForEGLFence(EGLDisplay display, EGLSyncKHR fence) { ++ eglClientWaitSyncKHR(display, fence, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, ++ EGL_FOREVER_KHR); ++ eglDestroySyncKHR(display, fence); ++} ++ + void WaitForGpuFences(std::vector> fences) { + for (auto& fence : fences) + fence->Wait(); +@@ -209,14 +215,25 @@ void GbmSurfacelessWayland::SwapBuffersAsync( + return; + } + +- base::OnceClosure fence_wait_task; + std::vector> fences; ++ // Uset in-fences provided in the overlays. If there are none, we insert our ++ // own fence and wait. + for (auto& plane : frame->planes) { + if (plane.second.gpu_fence) + fences.push_back(std::move(plane.second.gpu_fence)); + } + +- fence_wait_task = base::BindOnce(&WaitForGpuFences, std::move(fences)); ++ base::OnceClosure fence_wait_task; ++ if (!fences.empty()) { ++ fence_wait_task = base::BindOnce(&WaitForGpuFences, std::move(fences)); ++ } else { ++ // TODO(fangzhoug): the following should be replaced by a per surface flush ++ // as it gets implemented in GL drivers. ++ EGLSyncKHR fence = InsertFence(has_implicit_external_sync_); ++ CHECK_NE(fence, EGL_NO_SYNC_KHR) << "eglCreateSyncKHR failed"; ++ ++ fence_wait_task = base::BindOnce(&WaitForEGLFence, GetDisplay(), fence); ++ } + + base::OnceClosure fence_retired_callback = base::BindOnce( + &GbmSurfacelessWayland::FenceRetired, weak_factory_.GetWeakPtr(), frame); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0010-HACK-ozone-wayland-Force-disable-implicit-external-s.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0010-HACK-ozone-wayland-Force-disable-implicit-external-s.patch new file mode 100644 index 0000000000000000000000000000000000000000..1351a17d9348d9c67fc925d03c8ed2264cb3c59b --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0010-HACK-ozone-wayland-Force-disable-implicit-external-s.patch @@ -0,0 +1,30 @@ +From 16eef460684d0629b53baff6efc1d5d4a3cad97a Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 01:41:57 +0800 +Subject: [PATCH 10/15] HACK: [ozone/wayland]: Force disable implicit external + sync + +The Mali's implicit external sync seems broken. + +Signed-off-by: Jeffy Chen +--- + ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +index f56d3ecf0..e99f273ad 100644 +--- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc ++++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +@@ -229,7 +229,8 @@ void GbmSurfacelessWayland::SwapBuffersAsync( + } else { + // TODO(fangzhoug): the following should be replaced by a per surface flush + // as it gets implemented in GL drivers. +- EGLSyncKHR fence = InsertFence(has_implicit_external_sync_); ++ // HACK: The Mali's implicit external sync seems broken. ++ EGLSyncKHR fence = InsertFence(/* has_implicit_external_sync_ */ false); + CHECK_NE(fence, EGL_NO_SYNC_KHR) << "eglCreateSyncKHR failed"; + + fence_wait_task = base::BindOnce(&WaitForEGLFence, GetDisplay(), fence); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0011-HACK-media-capture-linux-Allow-camera-without-suppor.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0011-HACK-media-capture-linux-Allow-camera-without-suppor.patch new file mode 100644 index 0000000000000000000000000000000000000000..2b9dc9f36dfe69eaf25dd6c3a234180eee3231a1 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0011-HACK-media-capture-linux-Allow-camera-without-suppor.patch @@ -0,0 +1,35 @@ +From b425e9e17d27e479160c5c59ba99fca6fcfe9a3c Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 07:25:58 +0800 +Subject: [PATCH 11/15] HACK: media: capture: linux: Allow camera without + supported format + +The chromium would only accept discrete frame sizes. + +Hack it to make Rockchip ISP camera working. + +Signed-off-by: Jeffy Chen +--- + .../video/linux/video_capture_device_factory_linux.cc | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/media/capture/video/linux/video_capture_device_factory_linux.cc b/media/capture/video/linux/video_capture_device_factory_linux.cc +index 1351093ed..e1320551f 100644 +--- a/media/capture/video/linux/video_capture_device_factory_linux.cc ++++ b/media/capture/video/linux/video_capture_device_factory_linux.cc +@@ -192,10 +192,8 @@ void VideoCaptureDeviceFactoryLinux::GetDevicesInfo( + + VideoCaptureFormats supported_formats; + GetSupportedFormatsForV4L2BufferType(fd.get(), &supported_formats); +- if (supported_formats.empty()) { +- DVLOG(1) << "No supported formats: " << unique_id; +- continue; +- } ++ if (supported_formats.empty()) ++ LOG(WARNING) << "No supported formats: " << unique_id; + + // HACK: Somehow the newest chromium would prefer using the last device in some cases, e.g. apprtc + devices_info.emplace(devices_info.begin(), VideoCaptureDeviceDescriptor( +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0012-content-gpu-Only-depend-dri-for-X11.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0012-content-gpu-Only-depend-dri-for-X11.patch new file mode 100644 index 0000000000000000000000000000000000000000..edcc3517f2045c6fd545709e37539bd9dcbd8401 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0012-content-gpu-Only-depend-dri-for-X11.patch @@ -0,0 +1,26 @@ +From 90517408a8d712aa5fdcea8434a82e45effd234f Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 22 Nov 2021 15:59:49 +0800 +Subject: [PATCH 12/15] content: gpu: Only depend dri for X11 + +Signed-off-by: Jeffy Chen +--- + content/gpu/BUILD.gn | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/content/gpu/BUILD.gn b/content/gpu/BUILD.gn +index f0cc370d1..8b7ed3ec6 100644 +--- a/content/gpu/BUILD.gn ++++ b/content/gpu/BUILD.gn +@@ -134,7 +134,7 @@ target(link_target_type, "gpu_sources") { + } + + # Use DRI on desktop Linux builds. +- if (current_cpu != "s390x" && current_cpu != "ppc64" && is_linux && ++ if (current_cpu != "s390x" && current_cpu != "ppc64" && is_linux && ozone_platform_x11 && + (!is_chromecast || is_cast_desktop_build)) { + configs += [ "//build/config/linux/dri" ] + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0013-blink-rtc-Force-disabling-optimized-video-scaling.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0013-blink-rtc-Force-disabling-optimized-video-scaling.patch new file mode 100644 index 0000000000000000000000000000000000000000..014108eb7b6f936c188b696748ed33ea717b27a4 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0013-blink-rtc-Force-disabling-optimized-video-scaling.patch @@ -0,0 +1,31 @@ +From 25a2048700b6cd3f10dc411d43fe6b099e23b830 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 1 Dec 2021 18:27:06 +0800 +Subject: [PATCH 13/15] blink: rtc: Force disabling optimized video scaling + +This would break VEA when encoder requires special coded size: +https://bugs.chromium.org/p/chromium/issues/detail?id=1193457#c6 + +Signed-off-by: Jeffy Chen +--- + .../renderer/platform/peerconnection/rtc_video_encoder.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc b/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc +index adda739e2..901c6dd4c 100644 +--- a/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc ++++ b/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc +@@ -1221,6 +1221,10 @@ void RTCVideoEncoder::Impl::EncodeOneFrame() { + #else + false; + #endif ++ ++ // https://bugs.chromium.org/p/chromium/issues/detail?id=1193457#c6 ++ optimized_scaling = false; ++ + if (optimized_scaling) { + DCHECK_EQ(buffer->type(), webrtc::VideoFrameBuffer::Type::kNative); + auto scaled_buffer = buffer->Scale(input_visible_size_.width(), +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0014-HACK-media-Disable-chromeos-direct-video-decoder-by-.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0014-HACK-media-Disable-chromeos-direct-video-decoder-by-.patch new file mode 100644 index 0000000000000000000000000000000000000000..0143c1a35c22c7ef395a1276ea0196a636b4e3a2 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0014-HACK-media-Disable-chromeos-direct-video-decoder-by-.patch @@ -0,0 +1,29 @@ +From 4716be83e7ec5be89b9d751678afb3d06b8e1d79 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 16 Mar 2022 12:14:02 +0800 +Subject: [PATCH 14/15] HACK: media: Disable chromeos direct video decoder by + default + +Revisit once V4L2 video decoder is supported on linux. + +Signed-off-by: Jeffy Chen +--- + media/base/media_switches.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc +index 71b1563c8..5c69297ae 100644 +--- a/media/base/media_switches.cc ++++ b/media/base/media_switches.cc +@@ -727,7 +727,7 @@ const base::Feature kUseRealColorSpaceForAndroidVideo{ + // experiment with direct VideoDecoder path on Linux Desktop. + // TODO(b/159825227): remove when the direct video decoder is fully launched. + const base::Feature kUseChromeOSDirectVideoDecoder{ +- "UseChromeOSDirectVideoDecoder", base::FEATURE_ENABLED_BY_DEFAULT}; ++ "UseChromeOSDirectVideoDecoder", base::FEATURE_DISABLED_BY_DEFAULT}; + + #if BUILDFLAG(IS_CHROMEOS) + // ChromeOS has one of two VideoDecoder implementations active based on +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0015-media-gpu-v4l2-Non-blocking-initialize.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0015-media-gpu-v4l2-Non-blocking-initialize.patch new file mode 100644 index 0000000000000000000000000000000000000000..9f646149d61ee6e03983794c1efe310cba62470e --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_100.0.4896/0015-media-gpu-v4l2-Non-blocking-initialize.patch @@ -0,0 +1,126 @@ +From 2ddb7454bbda83d960524db23c586bd1505d62c6 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 21 Mar 2022 18:30:22 +0800 +Subject: [PATCH 15/15] media/gpu/v4l2: Non-blocking initialize + +See: +https://bugs.chromium.org/p/chromium/issues/detail?id=1308345 + +Signed-off-by: Jeffy Chen +--- + .../gpu/v4l2/v4l2_video_encode_accelerator.cc | 35 +++++++++---------- + .../gpu/v4l2/v4l2_video_encode_accelerator.h | 4 +-- + 2 files changed, 17 insertions(+), 22 deletions(-) + +diff --git a/media/gpu/v4l2/v4l2_video_encode_accelerator.cc b/media/gpu/v4l2/v4l2_video_encode_accelerator.cc +index 46ac323cf..75c4eebba 100644 +--- a/media/gpu/v4l2/v4l2_video_encode_accelerator.cc ++++ b/media/gpu/v4l2/v4l2_video_encode_accelerator.cc +@@ -261,25 +261,15 @@ bool V4L2VideoEncodeAccelerator::Initialize(const Config& config, + return false; + } + +- bool result = false; +- base::WaitableEvent done; + encoder_task_runner_->PostTask( + FROM_HERE, base::BindOnce(&V4L2VideoEncodeAccelerator::InitializeTask, +- weak_this_, config, &result, &done)); +- done.Wait(); +- return result; ++ weak_this_, config)); ++ return true; + } + +-void V4L2VideoEncodeAccelerator::InitializeTask(const Config& config, +- bool* result, +- base::WaitableEvent* done) { ++void V4L2VideoEncodeAccelerator::InitializeTask(const Config& config) { + DCHECK_CALLED_ON_VALID_SEQUENCE(encoder_sequence_checker_); + +- // Signal the event when leaving the method. +- base::ScopedClosureRunner signal_event( +- base::BindOnce(&base::WaitableEvent::Signal, base::Unretained(done))); +- *result = false; +- + native_input_mode_ = + config.storage_type.value_or(Config::StorageType::kShmem) == + Config::StorageType::kGpuMemoryBuffer; +@@ -294,6 +284,7 @@ void V4L2VideoEncodeAccelerator::InitializeTask(const Config& config, + + if (!SetFormats(config.input_format, config.output_profile)) { + VLOGF(1) << "Failed setting up formats"; ++ NOTIFY_ERROR(kPlatformFailureError); + return; + } + +@@ -307,6 +298,7 @@ void V4L2VideoEncodeAccelerator::InitializeTask(const Config& config, + VideoFrame::NumPlanes(config.input_format))); + if (!input_layout) { + VLOGF(1) << "Invalid image processor input layout"; ++ NOTIFY_ERROR(kPlatformFailureError); + return; + } + +@@ -316,6 +308,7 @@ void V4L2VideoEncodeAccelerator::InitializeTask(const Config& config, + encoder_input_visible_rect_, + encoder_input_visible_rect_)) { + VLOGF(1) << "Failed to create image processor"; ++ NOTIFY_ERROR(kPlatformFailureError); + return; + } + +@@ -327,16 +320,23 @@ void V4L2VideoEncodeAccelerator::InitializeTask(const Config& config, + VLOGF(1) << "Failed to reconfigure v4l2 encoder driver with the " + << "ImageProcessor output buffer: " + << ip_output_buffer_size.ToString(); ++ NOTIFY_ERROR(kPlatformFailureError); + return; + } + } + +- if (!InitInputMemoryType(config)) ++ if (!InitInputMemoryType(config)) { ++ NOTIFY_ERROR(kPlatformFailureError); + return; +- if (!InitControls(config)) ++ } ++ if (!InitControls(config)) { ++ NOTIFY_ERROR(kPlatformFailureError); + return; +- if (!CreateOutputBuffers()) ++ } ++ if (!CreateOutputBuffers()) { ++ NOTIFY_ERROR(kPlatformFailureError); + return; ++ } + + encoder_state_ = kInitialized; + RequestEncodingParametersChangeTask( +@@ -369,9 +369,6 @@ void V4L2VideoEncodeAccelerator::InitializeTask(const Config& config, + child_task_runner_->PostTask( + FROM_HERE, + base::BindOnce(&Client::NotifyEncoderInfoChange, client_, encoder_info)); +- +- // Finish initialization. +- *result = true; + } + + bool V4L2VideoEncodeAccelerator::CreateImageProcessor( +diff --git a/media/gpu/v4l2/v4l2_video_encode_accelerator.h b/media/gpu/v4l2/v4l2_video_encode_accelerator.h +index a8f0693c7..acb6ff418 100644 +--- a/media/gpu/v4l2/v4l2_video_encode_accelerator.h ++++ b/media/gpu/v4l2/v4l2_video_encode_accelerator.h +@@ -198,9 +198,7 @@ class MEDIA_GPU_EXPORT V4L2VideoEncodeAccelerator + uint32_t framerate); + + // Do several initializations (e.g. set up format) on |encoder_task_runner_|. +- void InitializeTask(const Config& config, +- bool* result, +- base::WaitableEvent* done); ++ void InitializeTask(const Config& config); + + // Set up formats and initialize the device for them. + bool SetFormats(VideoPixelFormat input_format, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0001-Add-support-for-V4L2VDA-on-Linux.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0001-Add-support-for-V4L2VDA-on-Linux.patch new file mode 100644 index 0000000000000000000000000000000000000000..79bd48698900cbca39331a8df99f38468c161979 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0001-Add-support-for-V4L2VDA-on-Linux.patch @@ -0,0 +1,463 @@ +From 8c13cc78f1deb0d3b22eb50021e57f73ed43173b Mon Sep 17 00:00:00 2001 +From: Maksim Sisov +Date: Wed, 31 Jul 2019 09:56:24 +0300 +Subject: [PATCH 01/15] Add support for V4L2VDA on Linux + +This patch enables hardware assisted video decoding via the +Chromium V4L2VDA. Including changes when Linux is used. In +order to use this, use_linux_v4l2_only flag should be set +to true. + +Signed-off-by: Ryo Kodama + +fixup! avoid building not declared formats + +"FRAME", "_SLICE", "V4L2_PIX_FMT_VP9" are not defined in mainline + Linux headers. This patch avoids building these formats. + +Signed-off-by: Ryo Kodama + +fixup! add V4L2_PIX_FMT_VP9 support back again as it is now +included in mainline Linux kernel. This allows VP9 codec +to work with upstream kernel and v4l2 vda. Tested on db820c +with Venus v4l2 driver. + +Signed-off-by: Peter Griffin +Signed-off-by: Stanimir Varbanov +Signed-off-by: Jeffy Chen +--- + .../gpu_mjpeg_decode_accelerator_factory.cc | 3 +- + media/gpu/BUILD.gn | 1 + + media/gpu/args.gni | 4 ++ + .../gpu_video_decode_accelerator_factory.cc | 8 +++ + .../gpu_video_decode_accelerator_factory.h | 2 + + media/gpu/v4l2/BUILD.gn | 42 ++++++------ + media/gpu/v4l2/generic_v4l2_device.cc | 4 ++ + media/gpu/v4l2/v4l2_device.cc | 66 +++++++++++++++++++ + media/gpu/v4l2/v4l2_video_decoder.cc | 7 ++ + 9 files changed, 115 insertions(+), 22 deletions(-) + +diff --git a/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc b/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc +index 3772b8ef0..dece6b77f 100644 +--- a/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc ++++ b/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc +@@ -13,7 +13,8 @@ + #include "media/base/media_switches.h" + #include "media/gpu/buildflags.h" + +-#if BUILDFLAG(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY) ++#if BUILDFLAG(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY) && \ ++ !BUILDFLAG(USE_LINUX_V4L2) + #define USE_V4L2_MJPEG_DECODE_ACCELERATOR + #endif + +diff --git a/media/gpu/BUILD.gn b/media/gpu/BUILD.gn +index 78d151fa6..101e2e4f9 100644 +--- a/media/gpu/BUILD.gn ++++ b/media/gpu/BUILD.gn +@@ -20,6 +20,7 @@ buildflag_header("buildflags") { + "USE_VAAPI_IMAGE_CODECS=$use_vaapi_image_codecs", + "USE_V4L2_CODEC=$use_v4l2_codec", + "USE_LIBV4L2=$use_v4lplugin", ++ "USE_LINUX_V4L2=$use_linux_v4l2_only", + "USE_VAAPI_X11=$use_vaapi_x11", + ] + } +diff --git a/media/gpu/args.gni b/media/gpu/args.gni +index bb2ff0797..da20cff79 100644 +--- a/media/gpu/args.gni ++++ b/media/gpu/args.gni +@@ -21,6 +21,10 @@ declare_args() { + # platforms which have v4l2 hardware encoder / decoder. + use_v4l2_codec = false + ++ # Indicates that only definitions available in the mainline linux kernel ++ # will be used. ++ use_linux_v4l2_only = false ++ + # Indicates if Video4Linux2 AML encoder is used. This is used for AML + # platforms which have v4l2 hardware encoder + use_v4l2_codec_aml = false +diff --git a/media/gpu/gpu_video_decode_accelerator_factory.cc b/media/gpu/gpu_video_decode_accelerator_factory.cc +index 6687b1186..951478638 100644 +--- a/media/gpu/gpu_video_decode_accelerator_factory.cc ++++ b/media/gpu/gpu_video_decode_accelerator_factory.cc +@@ -29,7 +29,9 @@ + #include "ui/gl/gl_implementation.h" + #elif BUILDFLAG(USE_V4L2_CODEC) + #include "media/gpu/v4l2/v4l2_device.h" ++#if !BUILDFLAG(USE_LINUX_V4L2) + #include "media/gpu/v4l2/v4l2_slice_video_decode_accelerator.h" ++#endif + #include "media/gpu/v4l2/v4l2_video_decode_accelerator.h" + #include "ui/gl/gl_surface_egl.h" + #endif +@@ -64,10 +66,12 @@ gpu::VideoDecodeAcceleratorCapabilities GetDecoderCapabilitiesInternal( + GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( + V4L2VideoDecodeAccelerator::GetSupportedProfiles(), + &capabilities.supported_profiles); ++#if !BUILDFLAG(USE_LINUX_V4L2) + GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( + V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles(), + &capabilities.supported_profiles); + #endif ++#endif + #elif BUILDFLAG(IS_MAC) + capabilities.supported_profiles = + VTVideoDecodeAccelerator::GetSupportedProfiles(workarounds); +@@ -146,8 +150,10 @@ GpuVideoDecodeAcceleratorFactory::CreateVDA( + &GpuVideoDecodeAcceleratorFactory::CreateVaapiVDA, + #elif BUILDFLAG(USE_V4L2_CODEC) + &GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA, ++#if !BUILDFLAG(USE_LINUX_V4L2) + &GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA, + #endif ++#endif + + #if BUILDFLAG(IS_MAC) + &GpuVideoDecodeAcceleratorFactory::CreateVTVDA, +@@ -207,6 +213,7 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA( + return decoder; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + std::unique_ptr + GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA( + const gpu::GpuDriverBugWorkarounds& /*workarounds*/, +@@ -222,6 +229,7 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA( + return decoder; + } + #endif ++#endif + + #if BUILDFLAG(IS_MAC) + std::unique_ptr +diff --git a/media/gpu/gpu_video_decode_accelerator_factory.h b/media/gpu/gpu_video_decode_accelerator_factory.h +index b2e1390c5..5a714eb80 100644 +--- a/media/gpu/gpu_video_decode_accelerator_factory.h ++++ b/media/gpu/gpu_video_decode_accelerator_factory.h +@@ -104,11 +104,13 @@ class MEDIA_GPU_EXPORT GpuVideoDecodeAcceleratorFactory { + const gpu::GpuDriverBugWorkarounds& workarounds, + const gpu::GpuPreferences& gpu_preferences, + MediaLog* media_log) const; ++#if !BUILDFLAG(USE_LINUX_V4L2) + std::unique_ptr CreateV4L2SliceVDA( + const gpu::GpuDriverBugWorkarounds& workarounds, + const gpu::GpuPreferences& gpu_preferences, + MediaLog* media_log) const; + #endif ++#endif + #if BUILDFLAG(IS_MAC) + std::unique_ptr CreateVTVDA( + const gpu::GpuDriverBugWorkarounds& workarounds, +diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn +index 65e5f58d1..bde4c169d 100644 +--- a/media/gpu/v4l2/BUILD.gn ++++ b/media/gpu/v4l2/BUILD.gn +@@ -28,9 +28,6 @@ source_set("v4l2") { + "buffer_affinity_tracker.h", + "generic_v4l2_device.cc", + "generic_v4l2_device.h", +- "v4l2_decode_surface.cc", +- "v4l2_decode_surface.h", +- "v4l2_decode_surface_handler.h", + "v4l2_device.cc", + "v4l2_device.h", + "v4l2_device_poller.cc", +@@ -39,8 +36,6 @@ source_set("v4l2") { + "v4l2_framerate_control.h", + "v4l2_image_processor_backend.cc", + "v4l2_image_processor_backend.h", +- "v4l2_slice_video_decode_accelerator.cc", +- "v4l2_slice_video_decode_accelerator.h", + "v4l2_stateful_workaround.cc", + "v4l2_stateful_workaround.h", + "v4l2_status.h", +@@ -56,26 +51,31 @@ source_set("v4l2") { + "v4l2_video_decoder_backend.h", + "v4l2_video_decoder_backend_stateful.cc", + "v4l2_video_decoder_backend_stateful.h", +- "v4l2_video_decoder_backend_stateless.cc", +- "v4l2_video_decoder_backend_stateless.h", +- "v4l2_video_decoder_delegate_h264.cc", +- "v4l2_video_decoder_delegate_h264.h", +- "v4l2_video_decoder_delegate_h264_legacy.cc", +- "v4l2_video_decoder_delegate_h264_legacy.h", +- "v4l2_video_decoder_delegate_vp8.cc", +- "v4l2_video_decoder_delegate_vp8.h", +- "v4l2_video_decoder_delegate_vp8_legacy.cc", +- "v4l2_video_decoder_delegate_vp8_legacy.h", +- "v4l2_video_decoder_delegate_vp9.cc", +- "v4l2_video_decoder_delegate_vp9.h", +- "v4l2_video_decoder_delegate_vp9_chromium.cc", +- "v4l2_video_decoder_delegate_vp9_chromium.h", +- "v4l2_video_decoder_delegate_vp9_legacy.cc", +- "v4l2_video_decoder_delegate_vp9_legacy.h", + "v4l2_video_encode_accelerator.cc", + "v4l2_video_encode_accelerator.h", + ] + ++ if (!use_linux_v4l2_only) { ++ sources += [ ++ "v4l2_video_decoder_backend_stateless.cc", ++ "v4l2_video_decoder_backend_stateless.h", ++ "v4l2_video_decoder_delegate_h264.cc", ++ "v4l2_video_decoder_delegate_h264.h", ++ "v4l2_video_decoder_delegate_h264_legacy.cc", ++ "v4l2_video_decoder_delegate_h264_legacy.h", ++ "v4l2_video_decoder_delegate_vp8.cc", ++ "v4l2_video_decoder_delegate_vp8.h", ++ "v4l2_video_decoder_delegate_vp8_legacy.cc", ++ "v4l2_video_decoder_delegate_vp8_legacy.h", ++ "v4l2_video_decoder_delegate_vp9.cc", ++ "v4l2_video_decoder_delegate_vp9.h", ++ "v4l2_video_decoder_delegate_vp9_chromium.cc", ++ "v4l2_video_decoder_delegate_vp9_chromium.h", ++ "v4l2_video_decoder_delegate_vp9_legacy.cc", ++ "v4l2_video_decoder_delegate_vp9_legacy.h", ++ ] ++ } ++ + libs = [ + "EGL", + "GLESv2", +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index a6fe9d914..becf30c9c 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -440,7 +440,11 @@ bool GenericV4L2Device::OpenDevicePath(const std::string& path, Type type) { + return false; + + #if BUILDFLAG(USE_LIBV4L2) ++#if BUILDFLAG(USE_LINUX_V4L2) ++ if ( ++#else + if (type == Type::kEncoder && ++#endif + HANDLE_EINTR(v4l2_fd_open(device_fd_.get(), V4L2_DISABLE_CONVERSION)) != + -1) { + DVLOGF(3) << "Using libv4l2 for " << path; +diff --git a/media/gpu/v4l2/v4l2_device.cc b/media/gpu/v4l2/v4l2_device.cc +index de2800fda..866c79e4d 100644 +--- a/media/gpu/v4l2/v4l2_device.cc ++++ b/media/gpu/v4l2/v4l2_device.cc +@@ -853,7 +853,9 @@ void V4L2WritableBufferRef::SetConfigStore(uint32_t config_store) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK(buffer_data_); + ++#if !BUILDFLAG(USE_LINUX_V4L2) + buffer_data_->v4l2_buffer_.config_store = config_store; ++#endif + } + + V4L2ReadableBuffer::V4L2ReadableBuffer(const struct v4l2_buffer& v4l2_buffer, +@@ -996,10 +998,12 @@ V4L2Queue::V4L2Queue(scoped_refptr dev, + return; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + if (reqbufs.capabilities & V4L2_BUF_CAP_SUPPORTS_REQUESTS) { + supports_requests_ = true; + DVLOGF(4) << "Queue supports request API."; + } ++#endif + } + + V4L2Queue::~V4L2Queue() { +@@ -1539,6 +1543,23 @@ std::string V4L2Device::GetDriverName() { + // static + uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + bool slice_based) { ++#if BUILDFLAG(USE_LINUX_V4L2) ++ if (slice_based) { ++ LOG(ERROR) << "Slice not supported"; ++ return 0; ++ } ++ ++ if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { ++ return V4L2_PIX_FMT_H264; ++ } else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) { ++ return V4L2_PIX_FMT_VP8; ++ } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) { ++ return V4L2_PIX_FMT_VP9; ++ } else { ++ DVLOGF(1) << "Unsupported profile: " << GetProfileName(profile); ++ return 0; ++ } ++#else + if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { + if (slice_based) + return V4L2_PIX_FMT_H264_SLICE; +@@ -1558,8 +1579,10 @@ uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + DVLOGF(1) << "Unsupported profile: " << GetProfileName(profile); + return 0; + } ++#endif + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + namespace { + + VideoCodecProfile V4L2ProfileToVideoCodecProfile(VideoCodec codec, +@@ -1606,9 +1629,11 @@ VideoCodecProfile V4L2ProfileToVideoCodecProfile(VideoCodec codec, + } + + } // namespace ++#endif + + std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + uint32_t pix_fmt) { ++#if !BUILDFLAG(USE_LINUX_V4L2) + auto get_supported_profiles = [this]( + VideoCodec codec, + std::vector* profiles) { +@@ -1679,6 +1704,27 @@ std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + VLOGF(1) << "Unhandled pixelformat " << FourccToString(pix_fmt); + return {}; + } ++#else ++ std::vector profiles; ++ switch (pix_fmt) { ++ case V4L2_PIX_FMT_H264: ++ profiles = { ++ H264PROFILE_BASELINE, ++ H264PROFILE_MAIN, ++ H264PROFILE_HIGH, ++ }; ++ break; ++ case V4L2_PIX_FMT_VP8: ++ profiles = {VP8PROFILE_ANY}; ++ break; ++ case V4L2_PIX_FMT_VP9: ++ profiles = {VP9PROFILE_PROFILE0}; ++ break; ++ default: ++ VLOGF(1) << "Unhandled pixelformat " << FourccToString(pix_fmt); ++ return {}; ++ } ++#endif + + // Erase duplicated profiles. + std::sort(profiles.begin(), profiles.end()); +@@ -2346,10 +2392,14 @@ bool V4L2Request::ApplyCtrls(struct v4l2_ext_controls* ctrls) { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + ctrls->which = V4L2_CTRL_WHICH_REQUEST_VAL; + ctrls->request_fd = request_fd_.get(); + + return true; ++#else ++ return false; ++#endif + } + + bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) { +@@ -2361,10 +2411,14 @@ bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + buffer->flags |= V4L2_BUF_FLAG_REQUEST_FD; + buffer->request_fd = request_fd_.get(); + + return true; ++#else ++ return false; ++#endif + } + + bool V4L2Request::Submit() { +@@ -2375,7 +2429,11 @@ bool V4L2Request::Submit() { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + return HANDLE_EINTR(ioctl(request_fd_.get(), MEDIA_REQUEST_IOC_QUEUE)) == 0; ++#else ++ return false; ++#endif + } + + bool V4L2Request::IsCompleted() { +@@ -2418,6 +2476,7 @@ bool V4L2Request::Reset() { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + // Reinit the request to make sure we can use it for a new submission. + if (HANDLE_EINTR(ioctl(request_fd_.get(), MEDIA_REQUEST_IOC_REINIT)) < 0) { + VPLOGF(1) << "Failed to reinit request."; +@@ -2425,6 +2484,9 @@ bool V4L2Request::Reset() { + } + + return true; ++#else ++ return false; ++#endif + } + + V4L2RequestRefBase::V4L2RequestRefBase(V4L2RequestRefBase&& req_base) { +@@ -2499,6 +2561,7 @@ V4L2RequestsQueue::~V4L2RequestsQueue() { + absl::optional V4L2RequestsQueue::CreateRequestFD() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + ++#if !BUILDFLAG(USE_LINUX_V4L2) + int request_fd; + int ret = HANDLE_EINTR( + ioctl(media_fd_.get(), MEDIA_IOC_REQUEST_ALLOC, &request_fd)); +@@ -2508,6 +2571,9 @@ absl::optional V4L2RequestsQueue::CreateRequestFD() { + } + + return base::ScopedFD(request_fd); ++#else ++ return absl::nullopt; ++#endif + } + + absl::optional V4L2RequestsQueue::GetFreeRequest() { +diff --git a/media/gpu/v4l2/v4l2_video_decoder.cc b/media/gpu/v4l2/v4l2_video_decoder.cc +index 057b28663..1df3f1a5c 100644 +--- a/media/gpu/v4l2/v4l2_video_decoder.cc ++++ b/media/gpu/v4l2/v4l2_video_decoder.cc +@@ -28,7 +28,10 @@ + #include "media/gpu/macros.h" + #include "media/gpu/v4l2/v4l2_status.h" + #include "media/gpu/v4l2/v4l2_video_decoder_backend_stateful.h" ++ ++#if !BUILDFLAG(USE_LINUX_V4L2) + #include "media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h" ++#endif + + namespace media { + +@@ -46,7 +49,9 @@ constexpr size_t kNumInputBuffers = 8; + + // Input format V4L2 fourccs this class supports. + constexpr uint32_t kSupportedInputFourccs[] = { ++#if !BUILDFLAG(USE_LINUX_V4L2) + V4L2_PIX_FMT_H264_SLICE, V4L2_PIX_FMT_VP8_FRAME, V4L2_PIX_FMT_VP9_FRAME, ++#endif + V4L2_PIX_FMT_H264, V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, + }; + +@@ -320,6 +325,7 @@ V4L2Status V4L2VideoDecoder::InitializeBackend() { + << " and fourcc: " << FourccToString(input_format_fourcc); + backend_ = std::make_unique( + this, device_, profile_, color_space_, decoder_task_runner_); ++#if !BUILDFLAG(USE_LINUX_V4L2) + } else { + DCHECK_EQ(preferred_api_and_format.first, kStateless); + VLOGF(1) << "Using a stateless API for profile: " +@@ -327,6 +333,7 @@ V4L2Status V4L2VideoDecoder::InitializeBackend() { + << " and fourcc: " << FourccToString(input_format_fourcc); + backend_ = std::make_unique( + this, device_, profile_, color_space_, decoder_task_runner_); ++#endif + } + + if (!backend_->Initialize()) { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0002-Add-mmap-via-libv4l-to-generic_v4l2_device.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0002-Add-mmap-via-libv4l-to-generic_v4l2_device.patch new file mode 100644 index 0000000000000000000000000000000000000000..7049fed4e99715788362b4d28a40bdae89483719 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0002-Add-mmap-via-libv4l-to-generic_v4l2_device.patch @@ -0,0 +1,49 @@ +From 0ebd7a7e56c7f756e85f0d60f7f849ac96b195d4 Mon Sep 17 00:00:00 2001 +From: Damian Hobson-Garcia +Date: Wed, 21 Mar 2018 13:18:17 +0200 +Subject: [PATCH 02/15] Add mmap via libv4l to generic_v4l2_device + +Issue #437 +--- + media/gpu/v4l2/generic_v4l2_device.cc | 10 ++++++++++ + media/gpu/v4l2/v4l2.sig | 2 ++ + 2 files changed, 12 insertions(+) + +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index becf30c9c..a3fe307c8 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -124,10 +124,20 @@ void* GenericV4L2Device::Mmap(void* addr, + int flags, + unsigned int offset) { + DCHECK(device_fd_.is_valid()); ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_mmap(addr, len, prot, flags, device_fd_.get(), offset); ++#endif + return mmap(addr, len, prot, flags, device_fd_.get(), offset); + } + + void GenericV4L2Device::Munmap(void* addr, unsigned int len) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) { ++ v4l2_munmap(addr, len); ++ return; ++ } ++#endif + munmap(addr, len); + } + +diff --git a/media/gpu/v4l2/v4l2.sig b/media/gpu/v4l2/v4l2.sig +index 4269fb48d..71b5b3787 100644 +--- a/media/gpu/v4l2/v4l2.sig ++++ b/media/gpu/v4l2/v4l2.sig +@@ -8,3 +8,5 @@ + LIBV4L_PUBLIC int v4l2_close(int fd); + LIBV4L_PUBLIC int v4l2_ioctl(int fd, unsigned long int request, ...); + LIBV4L_PUBLIC int v4l2_fd_open(int fd, int v4l2_flags); ++LIBV4L_PUBLIC void *v4l2_mmap(void *start, size_t length, int prot, int flags, int fd, int64_t offset); ++LIBV4L_PUBLIC int v4l2_munmap(void *_start, size_t length); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0003-media-capture-linux-Support-libv4l2-plugins.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0003-media-capture-linux-Support-libv4l2-plugins.patch new file mode 100644 index 0000000000000000000000000000000000000000..47d54de0f131f27f73cce7f7795f9e2af4d91f71 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0003-media-capture-linux-Support-libv4l2-plugins.patch @@ -0,0 +1,178 @@ +From 0b6fbe128cd3b39ff8d16f3ebd621e2b8b687898 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 1 Jul 2019 10:37:35 +0800 +Subject: [PATCH 03/15] media: capture: linux: Support libv4l2 plugins + +Allow using libv4l2 plugins for linux v4l2 capture devices. + +Signed-off-by: Jeffy Chen +--- + media/capture/BUILD.gn | 14 +++++ + .../video/linux/v4l2_capture_device_impl.cc | 52 ++++++++++++++++++- + .../video/linux/v4l2_capture_device_impl.h | 11 ++++ + 3 files changed, 76 insertions(+), 1 deletion(-) + +diff --git a/media/capture/BUILD.gn b/media/capture/BUILD.gn +index 3f80b62cb..3c6559339 100644 +--- a/media/capture/BUILD.gn ++++ b/media/capture/BUILD.gn +@@ -2,6 +2,7 @@ + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. + ++import("//build/buildflag_header.gni") + import("//build/config/chromeos/ui_mode.gni") + import("//build/config/features.gni") + import("//build/config/ui.gni") +@@ -18,6 +19,14 @@ group("capture") { + ] + } + ++buildflag_header("buildflags") { ++ header = "buildflags.h" ++ ++ flags = [ ++ "USE_LIBV4L2=$use_v4lplugin", ++ ] ++} ++ + component("capture_switches") { + defines = [ "CAPTURE_IMPLEMENTATION" ] + sources = [ +@@ -266,6 +275,11 @@ component("capture_lib") { + "video/linux/video_capture_device_linux.cc", + "video/linux/video_capture_device_linux.h", + ] ++ public_deps += [ ":buildflags" ] ++ ++ if (use_v4lplugin) { ++ deps += [ "//media/gpu/v4l2:libv4l2_stubs" ] ++ } + } + + if (is_chromeos_ash) { +diff --git a/media/capture/video/linux/v4l2_capture_device_impl.cc b/media/capture/video/linux/v4l2_capture_device_impl.cc +index c9040f5de..d05d1179e 100644 +--- a/media/capture/video/linux/v4l2_capture_device_impl.cc ++++ b/media/capture/video/linux/v4l2_capture_device_impl.cc +@@ -10,19 +10,61 @@ + #include + #include + ++#if BUILDFLAG(USE_LIBV4L2) ++// Auto-generated for dlopen libv4l2 libraries ++#include "media/gpu/v4l2/v4l2_stubs.h" ++#include "third_party/v4l-utils/lib/include/libv4l2.h" ++ ++#include "base/files/file_path.h" ++ ++using media_gpu_v4l2::kModuleV4l2; ++using media_gpu_v4l2::InitializeStubs; ++using media_gpu_v4l2::StubPathMap; ++ ++static const base::FilePath::CharType kV4l2Lib[] = ++ FILE_PATH_LITERAL("/usr/lib/libv4l2.so"); ++#endif ++ + namespace media { + + V4L2CaptureDeviceImpl::~V4L2CaptureDeviceImpl() = default; + ++V4L2CaptureDeviceImpl::V4L2CaptureDeviceImpl() { ++#if BUILDFLAG(USE_LIBV4L2) ++ StubPathMap paths; ++ paths[kModuleV4l2].push_back(kV4l2Lib); ++ ++ has_libv4l2_ = InitializeStubs(paths); ++#endif ++} ++ + int V4L2CaptureDeviceImpl::open(const char* device_name, int flags) { +- return ::open(device_name, flags); ++ int fd = ::open64(device_name, flags); ++ if (fd < 0) ++ return fd; ++ ++#if BUILDFLAG(USE_LIBV4L2) ++ use_libv4l2_ = false; ++ if (has_libv4l2_ && v4l2_fd_open(fd, V4L2_DISABLE_CONVERSION) != -1) { ++ use_libv4l2_ = true; ++ } ++#endif ++ return fd; + } + + int V4L2CaptureDeviceImpl::close(int fd) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_close(fd); ++#endif + return ::close(fd); + } + + int V4L2CaptureDeviceImpl::ioctl(int fd, int request, void* argp) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_ioctl(fd, request, argp); ++#endif + return ::ioctl(fd, request, argp); + } + +@@ -32,10 +74,18 @@ void* V4L2CaptureDeviceImpl::mmap(void* start, + int flags, + int fd, + off_t offset) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_mmap(start, length, prot, flags, fd, offset); ++#endif + return ::mmap(start, length, prot, flags, fd, offset); + } + + int V4L2CaptureDeviceImpl::munmap(void* start, size_t length) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_munmap(start, length); ++#endif + return ::munmap(start, length); + } + +diff --git a/media/capture/video/linux/v4l2_capture_device_impl.h b/media/capture/video/linux/v4l2_capture_device_impl.h +index 936c8b093..f96c2d434 100644 +--- a/media/capture/video/linux/v4l2_capture_device_impl.h ++++ b/media/capture/video/linux/v4l2_capture_device_impl.h +@@ -8,6 +8,7 @@ + #include + #include + ++#include "media/capture/buildflags.h" + #include "media/capture/capture_export.h" + #include "media/capture/video/linux/v4l2_capture_device.h" + +@@ -17,6 +18,8 @@ namespace media { + // V4L2 APIs. + class CAPTURE_EXPORT V4L2CaptureDeviceImpl : public V4L2CaptureDevice { + public: ++ V4L2CaptureDeviceImpl(); ++ + int open(const char* device_name, int flags) override; + int close(int fd) override; + int ioctl(int fd, int request, void* argp) override; +@@ -32,6 +35,14 @@ class CAPTURE_EXPORT V4L2CaptureDeviceImpl : public V4L2CaptureDevice { + + private: + ~V4L2CaptureDeviceImpl() override; ++ ++#if BUILDFLAG(USE_LIBV4L2) ++ // Has libv4l2. ++ bool has_libv4l2_; ++ // Use libv4l2 when operating |fd|. ++ bool use_libv4l2_; ++#endif ++ + }; + + } // namespace media +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0004-cld3-Avoid-unaligned-accesses.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0004-cld3-Avoid-unaligned-accesses.patch new file mode 100644 index 0000000000000000000000000000000000000000..ce5242b477263066d1701a946e94f6f4cfec6f46 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0004-cld3-Avoid-unaligned-accesses.patch @@ -0,0 +1,46 @@ +From 6894ae99e384bbfd9f41b8199cefdb6312ad4cb8 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 27 Mar 2020 17:48:20 +0800 +Subject: [PATCH 04/15] cld3: Avoid unaligned accesses + +Although the unaligned memory accesses are enabled, somehow i still hit +the SIGBUS: +[23496.643138] Unhandled fault: alignment fault (0x92000021) at 0x00000000b182e636 +Received signal 7 BUS_ADRALN 0000b182e636 + +Signed-off-by: Jeffy Chen +--- + third_party/cld_3/src/src/script_span/port.h | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/third_party/cld_3/src/src/script_span/port.h b/third_party/cld_3/src/src/script_span/port.h +index 2b3bc515a..1d437babf 100644 +--- a/third_party/cld_3/src/src/script_span/port.h ++++ b/third_party/cld_3/src/src/script_span/port.h +@@ -78,11 +78,23 @@ namespace CLD2 { + // + // This is a mess, but there's not much we can do about it. + ++#if 0 + #define UNALIGNED_LOAD16(_p) (*reinterpret_cast(_p)) + #define UNALIGNED_LOAD32(_p) (*reinterpret_cast(_p)) + + #define UNALIGNED_STORE16(_p, _val) (*reinterpret_cast(_p) = (_val)) + #define UNALIGNED_STORE32(_p, _val) (*reinterpret_cast(_p) = (_val)) ++#else ++inline uint32 UNALIGNED_LOAD32(const void *p) { ++ uint32 t; ++ memcpy(&t, p, sizeof t); ++ return t; ++} ++ ++inline void UNALIGNED_STORE32(void *p, uint32 v) { ++ memcpy(p, &v, sizeof v); ++} ++#endif + + // TODO(sesse): NEON supports unaligned 64-bit loads and stores. + // See if that would be more efficient on platforms supporting it, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0005-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0005-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch new file mode 100644 index 0000000000000000000000000000000000000000..21fa5d06a31b798c82368154c364df1a89fef2cc --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0005-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch @@ -0,0 +1,29 @@ +From 18cce79077f74306f70db39e5b2675287669b50c Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 10 Apr 2020 16:16:08 +0800 +Subject: [PATCH 05/15] media: gpu: v4l2: Use POLLIN for pending event + +The v4l-rkmpp is using eventfd to fake poll events which not supporting +POLLPRI. + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/generic_v4l2_device.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index a3fe307c8..eb756a914 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -114,7 +114,7 @@ bool GenericV4L2Device::Poll(bool poll_device, bool* event_pending) { + VPLOGF(1) << "poll() failed"; + return false; + } +- *event_pending = (pollfd != -1 && pollfds[pollfd].revents & POLLPRI); ++ *event_pending = (pollfd != -1 && pollfds[pollfd].revents & POLLIN); + return true; + } + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0006-media-capture-linux-Prefer-using-the-first-device.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0006-media-capture-linux-Prefer-using-the-first-device.patch new file mode 100644 index 0000000000000000000000000000000000000000..0f02b4e9f583e04570ca711d224bb6c6211f79c1 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0006-media-capture-linux-Prefer-using-the-first-device.patch @@ -0,0 +1,32 @@ +From c9b71b1f6a490affc31060d2a4117ac9ca18851a Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 5 Nov 2020 12:22:52 +0800 +Subject: [PATCH 06/15] media: capture: linux: Prefer using the first device + +Somehow the newest chromium would prefer using the last device in some +cases, e.g. apprtc. + +Let's reverse the device array to workaround it. + +Signed-off-by: Jeffy Chen +--- + .../capture/video/linux/video_capture_device_factory_linux.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/media/capture/video/linux/video_capture_device_factory_linux.cc b/media/capture/video/linux/video_capture_device_factory_linux.cc +index 7c90f5c46..1351093ed 100644 +--- a/media/capture/video/linux/video_capture_device_factory_linux.cc ++++ b/media/capture/video/linux/video_capture_device_factory_linux.cc +@@ -197,7 +197,8 @@ void VideoCaptureDeviceFactoryLinux::GetDevicesInfo( + continue; + } + +- devices_info.emplace_back(VideoCaptureDeviceDescriptor( ++ // HACK: Somehow the newest chromium would prefer using the last device in some cases, e.g. apprtc ++ devices_info.emplace(devices_info.begin(), VideoCaptureDeviceDescriptor( + display_name, unique_id, model_id, + VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE, GetControlSupport(fd.get()), + VideoCaptureTransportType::OTHER_TRANSPORT, facing_mode)); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0007-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0007-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch new file mode 100644 index 0000000000000000000000000000000000000000..61a599d8321e5c58e25d4c49ae28090ec51f5dba --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0007-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch @@ -0,0 +1,67 @@ +From 5230a8dc81e62bf04f650b184eedda5fb83d1867 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 28 Sep 2020 20:02:00 +0800 +Subject: [PATCH 07/15] media: gpu: v4l2: Fix compile error when ozone not + enabled + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/BUILD.gn | 5 ++++- + media/gpu/v4l2/generic_v4l2_device.cc | 7 +++++++ + 2 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn +index bde4c169d..0df1f12af 100644 +--- a/media/gpu/v4l2/BUILD.gn ++++ b/media/gpu/v4l2/BUILD.gn +@@ -104,9 +104,12 @@ source_set("v4l2") { + "//media/parsers", + "//third_party/libyuv", + "//ui/gfx/geometry", +- "//ui/ozone", + ] + ++ if (use_ozone) { ++ deps += [ "//ui/ozone" ] ++ } ++ + if (use_v4lplugin) { + deps += [ ":libv4l2_stubs" ] + } +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index eb756a914..55901af1a 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -33,8 +33,11 @@ + #include "ui/gl/egl_util.h" + #include "ui/gl/gl_bindings.h" + #include "ui/gl/gl_image_native_pixmap.h" ++ ++#if defined(USE_OZONE) + #include "ui/ozone/public/ozone_platform.h" + #include "ui/ozone/public/surface_factory_ozone.h" ++#endif + + #if BUILDFLAG(USE_LIBV4L2) + // Auto-generated for dlopen libv4l2 libraries +@@ -302,6 +305,9 @@ scoped_refptr GenericV4L2Device::CreateGLImage( + const gfx::Size& size, + const Fourcc fourcc, + gfx::NativePixmapHandle handle) const { ++#if !defined(USE_OZONE) ++ return nullptr; ++#else + DVLOGF(3); + DCHECK(CanCreateEGLImageFrom(fourcc)); + +@@ -336,6 +342,7 @@ scoped_refptr GenericV4L2Device::CreateGLImage( + bool ret = image->Initialize(std::move(pixmap)); + DCHECK(ret); + return image; ++#endif + } + + EGLBoolean GenericV4L2Device::DestroyEGLImage(EGLDisplay egl_display, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0008-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0008-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch new file mode 100644 index 0000000000000000000000000000000000000000..22d8936dc2bf5510d1230ab3ae23025331f8c0d7 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0008-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch @@ -0,0 +1,29 @@ +From 642171700f3f50e3d38a627339a44381fa933eaa Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 20 May 2021 01:05:29 +0800 +Subject: [PATCH 08/15] ui: events: ozone: Define SW_PEN_INSERTED for old + kernel headers + +Signed-off-by: Jeffy Chen +--- + ui/events/ozone/evdev/event_converter_evdev_impl.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/ui/events/ozone/evdev/event_converter_evdev_impl.cc b/ui/events/ozone/evdev/event_converter_evdev_impl.cc +index c2df35976..2660882a0 100644 +--- a/ui/events/ozone/evdev/event_converter_evdev_impl.cc ++++ b/ui/events/ozone/evdev/event_converter_evdev_impl.cc +@@ -31,6 +31,10 @@ namespace { + const int kKeyReleaseValue = 0; + const int kKeyRepeatValue = 2; + ++#ifndef SW_PEN_INSERTED ++#define SW_PEN_INSERTED 0x0f /* set = pen inserted */ ++#endif ++ + // Values for the EV_SW code. + const int kSwitchStylusInserted = SW_PEN_INSERTED; + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0009-Create-new-fence-when-there-s-no-in-fences.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0009-Create-new-fence-when-there-s-no-in-fences.patch new file mode 100644 index 0000000000000000000000000000000000000000..25fa52b1e0adbc2bdf828bd6b99045f01b5fc9a6 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0009-Create-new-fence-when-there-s-no-in-fences.patch @@ -0,0 +1,60 @@ +From 449627f0307a095a8b7f9a732a67613ef93e2906 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 01:29:11 +0800 +Subject: [PATCH 09/15] Create new fence when there's no in-fences + +There're cases that in-fences are not provided. + +Signed-off-by: Jeffy Chen +--- + .../wayland/gpu/gbm_surfaceless_wayland.cc | 21 +++++++++++++++++-- + 1 file changed, 19 insertions(+), 2 deletions(-) + +diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +index 8c096e3dd..2a9a88cf7 100644 +--- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc ++++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +@@ -32,6 +32,12 @@ static constexpr size_t kMaxSolidColorBuffers = 12; + + static constexpr gfx::Size kSolidColorBufferSize{4, 4}; + ++void WaitForEGLFence(EGLDisplay display, EGLSyncKHR fence) { ++ eglClientWaitSyncKHR(display, fence, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, ++ EGL_FOREVER_KHR); ++ eglDestroySyncKHR(display, fence); ++} ++ + void WaitForGpuFences(std::vector> fences) { + for (auto& fence : fences) + fence->Wait(); +@@ -211,14 +217,25 @@ void GbmSurfacelessWayland::SwapBuffersAsync( + return; + } + +- base::OnceClosure fence_wait_task; + std::vector> fences; ++ // Uset in-fences provided in the overlays. If there are none, we insert our ++ // own fence and wait. + for (auto& plane : frame->planes) { + if (plane.second.gpu_fence) + fences.push_back(std::move(plane.second.gpu_fence)); + } + +- fence_wait_task = base::BindOnce(&WaitForGpuFences, std::move(fences)); ++ base::OnceClosure fence_wait_task; ++ if (!fences.empty()) { ++ fence_wait_task = base::BindOnce(&WaitForGpuFences, std::move(fences)); ++ } else { ++ // TODO(fangzhoug): the following should be replaced by a per surface flush ++ // as it gets implemented in GL drivers. ++ EGLSyncKHR fence = InsertFence(has_implicit_external_sync_); ++ CHECK_NE(fence, EGL_NO_SYNC_KHR) << "eglCreateSyncKHR failed"; ++ ++ fence_wait_task = base::BindOnce(&WaitForEGLFence, GetDisplay(), fence); ++ } + + base::OnceClosure fence_retired_callback = base::BindOnce( + &GbmSurfacelessWayland::FenceRetired, weak_factory_.GetWeakPtr(), frame); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0010-HACK-ozone-wayland-Force-disable-implicit-external-s.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0010-HACK-ozone-wayland-Force-disable-implicit-external-s.patch new file mode 100644 index 0000000000000000000000000000000000000000..d7d797246b3e08efdde0a2bcf2ca365afd3d499c --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0010-HACK-ozone-wayland-Force-disable-implicit-external-s.patch @@ -0,0 +1,30 @@ +From 7dd0dfaa33f5efdb9fb0f527ae2a4452b20dd358 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 01:41:57 +0800 +Subject: [PATCH 10/15] HACK: [ozone/wayland]: Force disable implicit external + sync + +The Mali's implicit external sync seems broken. + +Signed-off-by: Jeffy Chen +--- + ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +index 2a9a88cf7..bb9e1d28b 100644 +--- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc ++++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +@@ -231,7 +231,8 @@ void GbmSurfacelessWayland::SwapBuffersAsync( + } else { + // TODO(fangzhoug): the following should be replaced by a per surface flush + // as it gets implemented in GL drivers. +- EGLSyncKHR fence = InsertFence(has_implicit_external_sync_); ++ // HACK: The Mali's implicit external sync seems broken. ++ EGLSyncKHR fence = InsertFence(/* has_implicit_external_sync_ */ false); + CHECK_NE(fence, EGL_NO_SYNC_KHR) << "eglCreateSyncKHR failed"; + + fence_wait_task = base::BindOnce(&WaitForEGLFence, GetDisplay(), fence); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0011-HACK-media-capture-linux-Allow-camera-without-suppor.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0011-HACK-media-capture-linux-Allow-camera-without-suppor.patch new file mode 100644 index 0000000000000000000000000000000000000000..b5632770abb6824e7811a4cdaf7155ba7e5bf37e --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0011-HACK-media-capture-linux-Allow-camera-without-suppor.patch @@ -0,0 +1,35 @@ +From dd2e0a6516dbc764e2ea744a54108a651b2e6f4a Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 07:25:58 +0800 +Subject: [PATCH 11/15] HACK: media: capture: linux: Allow camera without + supported format + +The chromium would only accept discrete frame sizes. + +Hack it to make Rockchip ISP camera working. + +Signed-off-by: Jeffy Chen +--- + .../video/linux/video_capture_device_factory_linux.cc | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/media/capture/video/linux/video_capture_device_factory_linux.cc b/media/capture/video/linux/video_capture_device_factory_linux.cc +index 1351093ed..e1320551f 100644 +--- a/media/capture/video/linux/video_capture_device_factory_linux.cc ++++ b/media/capture/video/linux/video_capture_device_factory_linux.cc +@@ -192,10 +192,8 @@ void VideoCaptureDeviceFactoryLinux::GetDevicesInfo( + + VideoCaptureFormats supported_formats; + GetSupportedFormatsForV4L2BufferType(fd.get(), &supported_formats); +- if (supported_formats.empty()) { +- DVLOG(1) << "No supported formats: " << unique_id; +- continue; +- } ++ if (supported_formats.empty()) ++ LOG(WARNING) << "No supported formats: " << unique_id; + + // HACK: Somehow the newest chromium would prefer using the last device in some cases, e.g. apprtc + devices_info.emplace(devices_info.begin(), VideoCaptureDeviceDescriptor( +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0012-content-gpu-Only-depend-dri-for-X11.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0012-content-gpu-Only-depend-dri-for-X11.patch new file mode 100644 index 0000000000000000000000000000000000000000..be820fa9e97ac4cc10fa6b7e6c05a6797e831557 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0012-content-gpu-Only-depend-dri-for-X11.patch @@ -0,0 +1,26 @@ +From 58a82223ec1cc57b56673ca7a1f0caa02fadea60 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 22 Nov 2021 15:59:49 +0800 +Subject: [PATCH 12/15] content: gpu: Only depend dri for X11 + +Signed-off-by: Jeffy Chen +--- + content/gpu/BUILD.gn | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/content/gpu/BUILD.gn b/content/gpu/BUILD.gn +index f0cc370d1..8b7ed3ec6 100644 +--- a/content/gpu/BUILD.gn ++++ b/content/gpu/BUILD.gn +@@ -134,7 +134,7 @@ target(link_target_type, "gpu_sources") { + } + + # Use DRI on desktop Linux builds. +- if (current_cpu != "s390x" && current_cpu != "ppc64" && is_linux && ++ if (current_cpu != "s390x" && current_cpu != "ppc64" && is_linux && ozone_platform_x11 && + (!is_chromecast || is_cast_desktop_build)) { + configs += [ "//build/config/linux/dri" ] + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0013-blink-rtc-Force-disabling-optimized-video-scaling.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0013-blink-rtc-Force-disabling-optimized-video-scaling.patch new file mode 100644 index 0000000000000000000000000000000000000000..2b862e91b5c52003931e7c079709cb77326ad27f --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0013-blink-rtc-Force-disabling-optimized-video-scaling.patch @@ -0,0 +1,31 @@ +From efbbf561fa4de9af3d4cf98edee38fe4b325e346 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 1 Dec 2021 18:27:06 +0800 +Subject: [PATCH 13/15] blink: rtc: Force disabling optimized video scaling + +This would break VEA when encoder requires special coded size: +https://bugs.chromium.org/p/chromium/issues/detail?id=1193457#c6 + +Signed-off-by: Jeffy Chen +--- + .../renderer/platform/peerconnection/rtc_video_encoder.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc b/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc +index 5f488e48b..844ee6928 100644 +--- a/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc ++++ b/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc +@@ -1222,6 +1222,10 @@ void RTCVideoEncoder::Impl::EncodeOneFrame() { + #else + false; + #endif ++ ++ // https://bugs.chromium.org/p/chromium/issues/detail?id=1193457#c6 ++ optimized_scaling = false; ++ + if (optimized_scaling) { + DCHECK_EQ(buffer->type(), webrtc::VideoFrameBuffer::Type::kNative); + auto scaled_buffer = buffer->Scale(input_visible_size_.width(), +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0014-HACK-media-Disable-chromeos-direct-video-decoder-by-.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0014-HACK-media-Disable-chromeos-direct-video-decoder-by-.patch new file mode 100644 index 0000000000000000000000000000000000000000..c224673360440b2d38efe215a702fa5172da6e98 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0014-HACK-media-Disable-chromeos-direct-video-decoder-by-.patch @@ -0,0 +1,29 @@ +From c580acaff99854680c4625fff41a8521aecaf660 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 16 Mar 2022 12:14:02 +0800 +Subject: [PATCH 14/15] HACK: media: Disable chromeos direct video decoder by + default + +Revisit once V4L2 video decoder is supported on linux. + +Signed-off-by: Jeffy Chen +--- + media/base/media_switches.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc +index 36d638adb..2f6eb79f2 100644 +--- a/media/base/media_switches.cc ++++ b/media/base/media_switches.cc +@@ -735,7 +735,7 @@ const base::Feature kUseRealColorSpaceForAndroidVideo{ + // experiment with direct VideoDecoder path on Linux Desktop. + // TODO(b/159825227): remove when the direct video decoder is fully launched. + const base::Feature kUseChromeOSDirectVideoDecoder{ +- "UseChromeOSDirectVideoDecoder", base::FEATURE_ENABLED_BY_DEFAULT}; ++ "UseChromeOSDirectVideoDecoder", base::FEATURE_DISABLED_BY_DEFAULT}; + + #if BUILDFLAG(IS_CHROMEOS) + // ChromeOS has one of two VideoDecoder implementations active based on +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0015-media-gpu-v4l2-Non-blocking-initialize.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0015-media-gpu-v4l2-Non-blocking-initialize.patch new file mode 100644 index 0000000000000000000000000000000000000000..1136114caa6731c9afeb14fe59c65c2caeed0887 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_101.0.4951/0015-media-gpu-v4l2-Non-blocking-initialize.patch @@ -0,0 +1,126 @@ +From ede4260fcee7a7b022604ef303285c128c078609 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 21 Mar 2022 18:30:22 +0800 +Subject: [PATCH 15/15] media/gpu/v4l2: Non-blocking initialize + +See: +https://bugs.chromium.org/p/chromium/issues/detail?id=1308345 + +Signed-off-by: Jeffy Chen +--- + .../gpu/v4l2/v4l2_video_encode_accelerator.cc | 35 +++++++++---------- + .../gpu/v4l2/v4l2_video_encode_accelerator.h | 4 +-- + 2 files changed, 17 insertions(+), 22 deletions(-) + +diff --git a/media/gpu/v4l2/v4l2_video_encode_accelerator.cc b/media/gpu/v4l2/v4l2_video_encode_accelerator.cc +index 0edf56412..488e05828 100644 +--- a/media/gpu/v4l2/v4l2_video_encode_accelerator.cc ++++ b/media/gpu/v4l2/v4l2_video_encode_accelerator.cc +@@ -272,25 +272,15 @@ bool V4L2VideoEncodeAccelerator::Initialize( + return false; + } + +- bool result = false; +- base::WaitableEvent done; + encoder_task_runner_->PostTask( + FROM_HERE, base::BindOnce(&V4L2VideoEncodeAccelerator::InitializeTask, +- weak_this_, config, &result, &done)); +- done.Wait(); +- return result; ++ weak_this_, config)); ++ return true; + } + +-void V4L2VideoEncodeAccelerator::InitializeTask(const Config& config, +- bool* result, +- base::WaitableEvent* done) { ++void V4L2VideoEncodeAccelerator::InitializeTask(const Config& config) { + DCHECK_CALLED_ON_VALID_SEQUENCE(encoder_sequence_checker_); + +- // Signal the event when leaving the method. +- base::ScopedClosureRunner signal_event( +- base::BindOnce(&base::WaitableEvent::Signal, base::Unretained(done))); +- *result = false; +- + native_input_mode_ = + config.storage_type.value_or(Config::StorageType::kShmem) == + Config::StorageType::kGpuMemoryBuffer; +@@ -305,6 +295,7 @@ void V4L2VideoEncodeAccelerator::InitializeTask(const Config& config, + + if (!SetFormats(config.input_format, config.output_profile)) { + VLOGF(1) << "Failed setting up formats"; ++ NOTIFY_ERROR(kPlatformFailureError); + return; + } + +@@ -318,6 +309,7 @@ void V4L2VideoEncodeAccelerator::InitializeTask(const Config& config, + VideoFrame::NumPlanes(config.input_format))); + if (!input_layout) { + VLOGF(1) << "Invalid image processor input layout"; ++ NOTIFY_ERROR(kPlatformFailureError); + return; + } + +@@ -327,6 +319,7 @@ void V4L2VideoEncodeAccelerator::InitializeTask(const Config& config, + encoder_input_visible_rect_, + encoder_input_visible_rect_)) { + VLOGF(1) << "Failed to create image processor"; ++ NOTIFY_ERROR(kPlatformFailureError); + return; + } + +@@ -338,16 +331,23 @@ void V4L2VideoEncodeAccelerator::InitializeTask(const Config& config, + VLOGF(1) << "Failed to reconfigure v4l2 encoder driver with the " + << "ImageProcessor output buffer: " + << ip_output_buffer_size.ToString(); ++ NOTIFY_ERROR(kPlatformFailureError); + return; + } + } + +- if (!InitInputMemoryType(config)) ++ if (!InitInputMemoryType(config)) { ++ NOTIFY_ERROR(kPlatformFailureError); + return; +- if (!InitControls(config)) ++ } ++ if (!InitControls(config)) { ++ NOTIFY_ERROR(kPlatformFailureError); + return; +- if (!CreateOutputBuffers()) ++ } ++ if (!CreateOutputBuffers()) { ++ NOTIFY_ERROR(kPlatformFailureError); + return; ++ } + + encoder_state_ = kInitialized; + RequestEncodingParametersChangeTask( +@@ -380,9 +380,6 @@ void V4L2VideoEncodeAccelerator::InitializeTask(const Config& config, + child_task_runner_->PostTask( + FROM_HERE, + base::BindOnce(&Client::NotifyEncoderInfoChange, client_, encoder_info)); +- +- // Finish initialization. +- *result = true; + } + + bool V4L2VideoEncodeAccelerator::CreateImageProcessor( +diff --git a/media/gpu/v4l2/v4l2_video_encode_accelerator.h b/media/gpu/v4l2/v4l2_video_encode_accelerator.h +index d414a327d..ce6cad5ab 100644 +--- a/media/gpu/v4l2/v4l2_video_encode_accelerator.h ++++ b/media/gpu/v4l2/v4l2_video_encode_accelerator.h +@@ -200,9 +200,7 @@ class MEDIA_GPU_EXPORT V4L2VideoEncodeAccelerator + uint32_t framerate); + + // Do several initializations (e.g. set up format) on |encoder_task_runner_|. +- void InitializeTask(const Config& config, +- bool* result, +- base::WaitableEvent* done); ++ void InitializeTask(const Config& config); + + // Set up formats and initialize the device for them. + bool SetFormats(VideoPixelFormat input_format, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0001-Add-support-for-V4L2VDA-on-Linux.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0001-Add-support-for-V4L2VDA-on-Linux.patch new file mode 100644 index 0000000000000000000000000000000000000000..5f1460200af1403d1f56d367ea1ca69f9bdf70b1 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0001-Add-support-for-V4L2VDA-on-Linux.patch @@ -0,0 +1,462 @@ +From 6b68dd8ef6cd64487be9a6503cd82a409a31656c Mon Sep 17 00:00:00 2001 +From: Maksim Sisov +Date: Wed, 31 Jul 2019 09:56:24 +0300 +Subject: [PATCH 01/14] Add support for V4L2VDA on Linux + +This patch enables hardware assisted video decoding via the +Chromium V4L2VDA. Including changes when Linux is used. In +order to use this, use_linux_v4l2_only flag should be set +to true. + +Signed-off-by: Ryo Kodama + +fixup! avoid building not declared formats + +"FRAME", "_SLICE", "V4L2_PIX_FMT_VP9" are not defined in mainline + Linux headers. This patch avoids building these formats. + +Signed-off-by: Ryo Kodama + +fixup! add V4L2_PIX_FMT_VP9 support back again as it is now +included in mainline Linux kernel. This allows VP9 codec +to work with upstream kernel and v4l2 vda. Tested on db820c +with Venus v4l2 driver. + +Signed-off-by: Peter Griffin +Signed-off-by: Stanimir Varbanov +Signed-off-by: Jeffy Chen +--- + .../gpu_mjpeg_decode_accelerator_factory.cc | 3 +- + media/gpu/BUILD.gn | 1 + + media/gpu/args.gni | 4 ++ + .../gpu_video_decode_accelerator_factory.cc | 8 +++ + .../gpu_video_decode_accelerator_factory.h | 2 + + media/gpu/v4l2/BUILD.gn | 41 ++++++------ + media/gpu/v4l2/generic_v4l2_device.cc | 4 ++ + media/gpu/v4l2/v4l2_device.cc | 66 +++++++++++++++++++ + media/gpu/v4l2/v4l2_video_decoder.cc | 7 ++ + 9 files changed, 116 insertions(+), 20 deletions(-) + +diff --git a/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc b/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc +index 3772b8ef0..dece6b77f 100644 +--- a/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc ++++ b/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc +@@ -13,7 +13,8 @@ + #include "media/base/media_switches.h" + #include "media/gpu/buildflags.h" + +-#if BUILDFLAG(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY) ++#if BUILDFLAG(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY) && \ ++ !BUILDFLAG(USE_LINUX_V4L2) + #define USE_V4L2_MJPEG_DECODE_ACCELERATOR + #endif + +diff --git a/media/gpu/BUILD.gn b/media/gpu/BUILD.gn +index 52c22c3fd..8ca11e1c8 100644 +--- a/media/gpu/BUILD.gn ++++ b/media/gpu/BUILD.gn +@@ -20,6 +20,7 @@ buildflag_header("buildflags") { + "USE_VAAPI_IMAGE_CODECS=$use_vaapi_image_codecs", + "USE_V4L2_CODEC=$use_v4l2_codec", + "USE_LIBV4L2=$use_v4lplugin", ++ "USE_LINUX_V4L2=$use_linux_v4l2_only", + "USE_VAAPI_X11=$use_vaapi_x11", + ] + } +diff --git a/media/gpu/args.gni b/media/gpu/args.gni +index bb2ff0797..da20cff79 100644 +--- a/media/gpu/args.gni ++++ b/media/gpu/args.gni +@@ -21,6 +21,10 @@ declare_args() { + # platforms which have v4l2 hardware encoder / decoder. + use_v4l2_codec = false + ++ # Indicates that only definitions available in the mainline linux kernel ++ # will be used. ++ use_linux_v4l2_only = false ++ + # Indicates if Video4Linux2 AML encoder is used. This is used for AML + # platforms which have v4l2 hardware encoder + use_v4l2_codec_aml = false +diff --git a/media/gpu/gpu_video_decode_accelerator_factory.cc b/media/gpu/gpu_video_decode_accelerator_factory.cc +index 98f1e2ee7..b7cfffabb 100644 +--- a/media/gpu/gpu_video_decode_accelerator_factory.cc ++++ b/media/gpu/gpu_video_decode_accelerator_factory.cc +@@ -29,7 +29,9 @@ + #include "ui/gl/gl_implementation.h" + #elif BUILDFLAG(USE_V4L2_CODEC) + #include "media/gpu/v4l2/v4l2_device.h" ++#if !BUILDFLAG(USE_LINUX_V4L2) + #include "media/gpu/v4l2/v4l2_slice_video_decode_accelerator.h" ++#endif + #include "media/gpu/v4l2/v4l2_video_decode_accelerator.h" + #include "ui/gl/gl_surface_egl.h" + #endif +@@ -64,10 +66,12 @@ gpu::VideoDecodeAcceleratorCapabilities GetDecoderCapabilitiesInternal( + GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( + V4L2VideoDecodeAccelerator::GetSupportedProfiles(), + &capabilities.supported_profiles); ++#if !BUILDFLAG(USE_LINUX_V4L2) + GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( + V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles(), + &capabilities.supported_profiles); + #endif ++#endif + #elif BUILDFLAG(IS_MAC) + capabilities.supported_profiles = + VTVideoDecodeAccelerator::GetSupportedProfiles(workarounds); +@@ -146,8 +150,10 @@ GpuVideoDecodeAcceleratorFactory::CreateVDA( + &GpuVideoDecodeAcceleratorFactory::CreateVaapiVDA, + #elif BUILDFLAG(USE_V4L2_CODEC) + &GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA, ++#if !BUILDFLAG(USE_LINUX_V4L2) + &GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA, + #endif ++#endif + + #if BUILDFLAG(IS_MAC) + &GpuVideoDecodeAcceleratorFactory::CreateVTVDA, +@@ -207,6 +213,7 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA( + return decoder; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + std::unique_ptr + GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA( + const gpu::GpuDriverBugWorkarounds& /*workarounds*/, +@@ -222,6 +229,7 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA( + return decoder; + } + #endif ++#endif + + #if BUILDFLAG(IS_MAC) + std::unique_ptr +diff --git a/media/gpu/gpu_video_decode_accelerator_factory.h b/media/gpu/gpu_video_decode_accelerator_factory.h +index b2e1390c5..5a714eb80 100644 +--- a/media/gpu/gpu_video_decode_accelerator_factory.h ++++ b/media/gpu/gpu_video_decode_accelerator_factory.h +@@ -104,11 +104,13 @@ class MEDIA_GPU_EXPORT GpuVideoDecodeAcceleratorFactory { + const gpu::GpuDriverBugWorkarounds& workarounds, + const gpu::GpuPreferences& gpu_preferences, + MediaLog* media_log) const; ++#if !BUILDFLAG(USE_LINUX_V4L2) + std::unique_ptr CreateV4L2SliceVDA( + const gpu::GpuDriverBugWorkarounds& workarounds, + const gpu::GpuPreferences& gpu_preferences, + MediaLog* media_log) const; + #endif ++#endif + #if BUILDFLAG(IS_MAC) + std::unique_ptr CreateVTVDA( + const gpu::GpuDriverBugWorkarounds& workarounds, +diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn +index 50d81e483..3a47d1166 100644 +--- a/media/gpu/v4l2/BUILD.gn ++++ b/media/gpu/v4l2/BUILD.gn +@@ -28,9 +28,6 @@ source_set("v4l2") { + "buffer_affinity_tracker.h", + "generic_v4l2_device.cc", + "generic_v4l2_device.h", +- "v4l2_decode_surface.cc", +- "v4l2_decode_surface.h", +- "v4l2_decode_surface_handler.h", + "v4l2_device.cc", + "v4l2_device.h", + "v4l2_device_poller.cc", +@@ -39,8 +36,6 @@ source_set("v4l2") { + "v4l2_framerate_control.h", + "v4l2_image_processor_backend.cc", + "v4l2_image_processor_backend.h", +- "v4l2_slice_video_decode_accelerator.cc", +- "v4l2_slice_video_decode_accelerator.h", + "v4l2_stateful_workaround.cc", + "v4l2_stateful_workaround.h", + "v4l2_utils.cc", +@@ -55,24 +50,32 @@ source_set("v4l2") { + "v4l2_video_decoder_backend.h", + "v4l2_video_decoder_backend_stateful.cc", + "v4l2_video_decoder_backend_stateful.h", +- "v4l2_video_decoder_backend_stateless.cc", +- "v4l2_video_decoder_backend_stateless.h", +- "v4l2_video_decoder_delegate_h264.cc", +- "v4l2_video_decoder_delegate_h264.h", +- "v4l2_video_decoder_delegate_h264_legacy.cc", +- "v4l2_video_decoder_delegate_h264_legacy.h", +- "v4l2_video_decoder_delegate_vp8.cc", +- "v4l2_video_decoder_delegate_vp8.h", +- "v4l2_video_decoder_delegate_vp8_legacy.cc", +- "v4l2_video_decoder_delegate_vp8_legacy.h", +- "v4l2_video_decoder_delegate_vp9.cc", +- "v4l2_video_decoder_delegate_vp9.h", +- "v4l2_video_decoder_delegate_vp9_legacy.cc", +- "v4l2_video_decoder_delegate_vp9_legacy.h", + "v4l2_video_encode_accelerator.cc", + "v4l2_video_encode_accelerator.h", + ] + ++ if (!use_linux_v4l2_only) { ++ sources += [ ++ "v4l2_slice_video_decode_accelerator.cc", ++ "v4l2_slice_video_decode_accelerator.h", ++ "v4l2_video_decoder_backend_stateless.cc", ++ "v4l2_video_decoder_backend_stateless.h", ++ "v4l2_video_decoder_delegate_h264.cc", ++ "v4l2_video_decoder_delegate_h264.h", ++ "v4l2_video_decoder_delegate_h264_legacy.cc", ++ "v4l2_video_decoder_delegate_h264_legacy.h", ++ "v4l2_video_decoder_delegate_vp8.cc", ++ "v4l2_video_decoder_delegate_vp8.h", ++ "v4l2_video_decoder_delegate_vp8_legacy.cc", ++ "v4l2_video_decoder_delegate_vp8_legacy.h", ++ "v4l2_video_decoder_delegate_vp9.cc", ++ "v4l2_video_decoder_delegate_vp9.h", ++ "v4l2_video_decoder_delegate_vp9_legacy.cc", ++ "v4l2_video_decoder_delegate_vp9_legacy.h", ++ ] ++ } ++ ++ + libs = [ + "EGL", + "GLESv2", +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index a6fe9d914..becf30c9c 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -440,7 +440,11 @@ bool GenericV4L2Device::OpenDevicePath(const std::string& path, Type type) { + return false; + + #if BUILDFLAG(USE_LIBV4L2) ++#if BUILDFLAG(USE_LINUX_V4L2) ++ if ( ++#else + if (type == Type::kEncoder && ++#endif + HANDLE_EINTR(v4l2_fd_open(device_fd_.get(), V4L2_DISABLE_CONVERSION)) != + -1) { + DVLOGF(3) << "Using libv4l2 for " << path; +diff --git a/media/gpu/v4l2/v4l2_device.cc b/media/gpu/v4l2/v4l2_device.cc +index de2800fda..866c79e4d 100644 +--- a/media/gpu/v4l2/v4l2_device.cc ++++ b/media/gpu/v4l2/v4l2_device.cc +@@ -853,7 +853,9 @@ void V4L2WritableBufferRef::SetConfigStore(uint32_t config_store) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK(buffer_data_); + ++#if !BUILDFLAG(USE_LINUX_V4L2) + buffer_data_->v4l2_buffer_.config_store = config_store; ++#endif + } + + V4L2ReadableBuffer::V4L2ReadableBuffer(const struct v4l2_buffer& v4l2_buffer, +@@ -996,10 +998,12 @@ V4L2Queue::V4L2Queue(scoped_refptr dev, + return; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + if (reqbufs.capabilities & V4L2_BUF_CAP_SUPPORTS_REQUESTS) { + supports_requests_ = true; + DVLOGF(4) << "Queue supports request API."; + } ++#endif + } + + V4L2Queue::~V4L2Queue() { +@@ -1539,6 +1543,23 @@ std::string V4L2Device::GetDriverName() { + // static + uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + bool slice_based) { ++#if BUILDFLAG(USE_LINUX_V4L2) ++ if (slice_based) { ++ LOG(ERROR) << "Slice not supported"; ++ return 0; ++ } ++ ++ if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { ++ return V4L2_PIX_FMT_H264; ++ } else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) { ++ return V4L2_PIX_FMT_VP8; ++ } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) { ++ return V4L2_PIX_FMT_VP9; ++ } else { ++ DVLOGF(1) << "Unsupported profile: " << GetProfileName(profile); ++ return 0; ++ } ++#else + if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { + if (slice_based) + return V4L2_PIX_FMT_H264_SLICE; +@@ -1558,8 +1579,10 @@ uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + DVLOGF(1) << "Unsupported profile: " << GetProfileName(profile); + return 0; + } ++#endif + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + namespace { + + VideoCodecProfile V4L2ProfileToVideoCodecProfile(VideoCodec codec, +@@ -1606,9 +1629,11 @@ VideoCodecProfile V4L2ProfileToVideoCodecProfile(VideoCodec codec, + } + + } // namespace ++#endif + + std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + uint32_t pix_fmt) { ++#if !BUILDFLAG(USE_LINUX_V4L2) + auto get_supported_profiles = [this]( + VideoCodec codec, + std::vector* profiles) { +@@ -1679,6 +1704,27 @@ std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + VLOGF(1) << "Unhandled pixelformat " << FourccToString(pix_fmt); + return {}; + } ++#else ++ std::vector profiles; ++ switch (pix_fmt) { ++ case V4L2_PIX_FMT_H264: ++ profiles = { ++ H264PROFILE_BASELINE, ++ H264PROFILE_MAIN, ++ H264PROFILE_HIGH, ++ }; ++ break; ++ case V4L2_PIX_FMT_VP8: ++ profiles = {VP8PROFILE_ANY}; ++ break; ++ case V4L2_PIX_FMT_VP9: ++ profiles = {VP9PROFILE_PROFILE0}; ++ break; ++ default: ++ VLOGF(1) << "Unhandled pixelformat " << FourccToString(pix_fmt); ++ return {}; ++ } ++#endif + + // Erase duplicated profiles. + std::sort(profiles.begin(), profiles.end()); +@@ -2346,10 +2392,14 @@ bool V4L2Request::ApplyCtrls(struct v4l2_ext_controls* ctrls) { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + ctrls->which = V4L2_CTRL_WHICH_REQUEST_VAL; + ctrls->request_fd = request_fd_.get(); + + return true; ++#else ++ return false; ++#endif + } + + bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) { +@@ -2361,10 +2411,14 @@ bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + buffer->flags |= V4L2_BUF_FLAG_REQUEST_FD; + buffer->request_fd = request_fd_.get(); + + return true; ++#else ++ return false; ++#endif + } + + bool V4L2Request::Submit() { +@@ -2375,7 +2429,11 @@ bool V4L2Request::Submit() { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + return HANDLE_EINTR(ioctl(request_fd_.get(), MEDIA_REQUEST_IOC_QUEUE)) == 0; ++#else ++ return false; ++#endif + } + + bool V4L2Request::IsCompleted() { +@@ -2418,6 +2476,7 @@ bool V4L2Request::Reset() { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + // Reinit the request to make sure we can use it for a new submission. + if (HANDLE_EINTR(ioctl(request_fd_.get(), MEDIA_REQUEST_IOC_REINIT)) < 0) { + VPLOGF(1) << "Failed to reinit request."; +@@ -2425,6 +2484,9 @@ bool V4L2Request::Reset() { + } + + return true; ++#else ++ return false; ++#endif + } + + V4L2RequestRefBase::V4L2RequestRefBase(V4L2RequestRefBase&& req_base) { +@@ -2499,6 +2561,7 @@ V4L2RequestsQueue::~V4L2RequestsQueue() { + absl::optional V4L2RequestsQueue::CreateRequestFD() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + ++#if !BUILDFLAG(USE_LINUX_V4L2) + int request_fd; + int ret = HANDLE_EINTR( + ioctl(media_fd_.get(), MEDIA_IOC_REQUEST_ALLOC, &request_fd)); +@@ -2508,6 +2571,9 @@ absl::optional V4L2RequestsQueue::CreateRequestFD() { + } + + return base::ScopedFD(request_fd); ++#else ++ return absl::nullopt; ++#endif + } + + absl::optional V4L2RequestsQueue::GetFreeRequest() { +diff --git a/media/gpu/v4l2/v4l2_video_decoder.cc b/media/gpu/v4l2/v4l2_video_decoder.cc +index 7f4c9f244..e887fb896 100644 +--- a/media/gpu/v4l2/v4l2_video_decoder.cc ++++ b/media/gpu/v4l2/v4l2_video_decoder.cc +@@ -27,7 +27,10 @@ + #include "media/gpu/macros.h" + #include "media/gpu/v4l2/v4l2_status.h" + #include "media/gpu/v4l2/v4l2_video_decoder_backend_stateful.h" ++ ++#if !BUILDFLAG(USE_LINUX_V4L2) + #include "media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h" ++#endif + + namespace media { + +@@ -45,7 +48,9 @@ constexpr size_t kNumInputBuffers = 8; + + // Input format V4L2 fourccs this class supports. + constexpr uint32_t kSupportedInputFourccs[] = { ++#if !BUILDFLAG(USE_LINUX_V4L2) + V4L2_PIX_FMT_H264_SLICE, V4L2_PIX_FMT_VP8_FRAME, V4L2_PIX_FMT_VP9_FRAME, ++#endif + V4L2_PIX_FMT_H264, V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, + }; + +@@ -319,6 +324,7 @@ V4L2Status V4L2VideoDecoder::InitializeBackend() { + << " and fourcc: " << FourccToString(input_format_fourcc); + backend_ = std::make_unique( + this, device_, profile_, color_space_, decoder_task_runner_); ++#if !BUILDFLAG(USE_LINUX_V4L2) + } else { + DCHECK_EQ(preferred_api_and_format.first, kStateless); + VLOGF(1) << "Using a stateless API for profile: " +@@ -326,6 +332,7 @@ V4L2Status V4L2VideoDecoder::InitializeBackend() { + << " and fourcc: " << FourccToString(input_format_fourcc); + backend_ = std::make_unique( + this, device_, profile_, color_space_, decoder_task_runner_); ++#endif + } + + if (!backend_->Initialize()) { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0002-Add-mmap-via-libv4l-to-generic_v4l2_device.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0002-Add-mmap-via-libv4l-to-generic_v4l2_device.patch new file mode 100644 index 0000000000000000000000000000000000000000..9e72cc135522bb03d7490abc92791f9db4bf03b9 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0002-Add-mmap-via-libv4l-to-generic_v4l2_device.patch @@ -0,0 +1,49 @@ +From c14f394663afbe51d973965d975fd9f1a0f8b105 Mon Sep 17 00:00:00 2001 +From: Damian Hobson-Garcia +Date: Wed, 21 Mar 2018 13:18:17 +0200 +Subject: [PATCH 02/14] Add mmap via libv4l to generic_v4l2_device + +Issue #437 +--- + media/gpu/v4l2/generic_v4l2_device.cc | 10 ++++++++++ + media/gpu/v4l2/v4l2.sig | 2 ++ + 2 files changed, 12 insertions(+) + +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index becf30c9c..a3fe307c8 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -124,10 +124,20 @@ void* GenericV4L2Device::Mmap(void* addr, + int flags, + unsigned int offset) { + DCHECK(device_fd_.is_valid()); ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_mmap(addr, len, prot, flags, device_fd_.get(), offset); ++#endif + return mmap(addr, len, prot, flags, device_fd_.get(), offset); + } + + void GenericV4L2Device::Munmap(void* addr, unsigned int len) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) { ++ v4l2_munmap(addr, len); ++ return; ++ } ++#endif + munmap(addr, len); + } + +diff --git a/media/gpu/v4l2/v4l2.sig b/media/gpu/v4l2/v4l2.sig +index 4269fb48d..71b5b3787 100644 +--- a/media/gpu/v4l2/v4l2.sig ++++ b/media/gpu/v4l2/v4l2.sig +@@ -8,3 +8,5 @@ + LIBV4L_PUBLIC int v4l2_close(int fd); + LIBV4L_PUBLIC int v4l2_ioctl(int fd, unsigned long int request, ...); + LIBV4L_PUBLIC int v4l2_fd_open(int fd, int v4l2_flags); ++LIBV4L_PUBLIC void *v4l2_mmap(void *start, size_t length, int prot, int flags, int fd, int64_t offset); ++LIBV4L_PUBLIC int v4l2_munmap(void *_start, size_t length); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0003-media-capture-linux-Support-libv4l2-plugins.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0003-media-capture-linux-Support-libv4l2-plugins.patch new file mode 100644 index 0000000000000000000000000000000000000000..3b0737957046980fe3fefaacebf25fe81bc7e40b --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0003-media-capture-linux-Support-libv4l2-plugins.patch @@ -0,0 +1,178 @@ +From c6242784b74945b89bbe35395f3c7ca766218977 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 1 Jul 2019 10:37:35 +0800 +Subject: [PATCH 03/14] media: capture: linux: Support libv4l2 plugins + +Allow using libv4l2 plugins for linux v4l2 capture devices. + +Signed-off-by: Jeffy Chen +--- + media/capture/BUILD.gn | 14 +++++ + .../video/linux/v4l2_capture_device_impl.cc | 52 ++++++++++++++++++- + .../video/linux/v4l2_capture_device_impl.h | 11 ++++ + 3 files changed, 76 insertions(+), 1 deletion(-) + +diff --git a/media/capture/BUILD.gn b/media/capture/BUILD.gn +index 3f80b62cb..3c6559339 100644 +--- a/media/capture/BUILD.gn ++++ b/media/capture/BUILD.gn +@@ -2,6 +2,7 @@ + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. + ++import("//build/buildflag_header.gni") + import("//build/config/chromeos/ui_mode.gni") + import("//build/config/features.gni") + import("//build/config/ui.gni") +@@ -18,6 +19,14 @@ group("capture") { + ] + } + ++buildflag_header("buildflags") { ++ header = "buildflags.h" ++ ++ flags = [ ++ "USE_LIBV4L2=$use_v4lplugin", ++ ] ++} ++ + component("capture_switches") { + defines = [ "CAPTURE_IMPLEMENTATION" ] + sources = [ +@@ -266,6 +275,11 @@ component("capture_lib") { + "video/linux/video_capture_device_linux.cc", + "video/linux/video_capture_device_linux.h", + ] ++ public_deps += [ ":buildflags" ] ++ ++ if (use_v4lplugin) { ++ deps += [ "//media/gpu/v4l2:libv4l2_stubs" ] ++ } + } + + if (is_chromeos_ash) { +diff --git a/media/capture/video/linux/v4l2_capture_device_impl.cc b/media/capture/video/linux/v4l2_capture_device_impl.cc +index c9040f5de..d05d1179e 100644 +--- a/media/capture/video/linux/v4l2_capture_device_impl.cc ++++ b/media/capture/video/linux/v4l2_capture_device_impl.cc +@@ -10,19 +10,61 @@ + #include + #include + ++#if BUILDFLAG(USE_LIBV4L2) ++// Auto-generated for dlopen libv4l2 libraries ++#include "media/gpu/v4l2/v4l2_stubs.h" ++#include "third_party/v4l-utils/lib/include/libv4l2.h" ++ ++#include "base/files/file_path.h" ++ ++using media_gpu_v4l2::kModuleV4l2; ++using media_gpu_v4l2::InitializeStubs; ++using media_gpu_v4l2::StubPathMap; ++ ++static const base::FilePath::CharType kV4l2Lib[] = ++ FILE_PATH_LITERAL("/usr/lib/libv4l2.so"); ++#endif ++ + namespace media { + + V4L2CaptureDeviceImpl::~V4L2CaptureDeviceImpl() = default; + ++V4L2CaptureDeviceImpl::V4L2CaptureDeviceImpl() { ++#if BUILDFLAG(USE_LIBV4L2) ++ StubPathMap paths; ++ paths[kModuleV4l2].push_back(kV4l2Lib); ++ ++ has_libv4l2_ = InitializeStubs(paths); ++#endif ++} ++ + int V4L2CaptureDeviceImpl::open(const char* device_name, int flags) { +- return ::open(device_name, flags); ++ int fd = ::open64(device_name, flags); ++ if (fd < 0) ++ return fd; ++ ++#if BUILDFLAG(USE_LIBV4L2) ++ use_libv4l2_ = false; ++ if (has_libv4l2_ && v4l2_fd_open(fd, V4L2_DISABLE_CONVERSION) != -1) { ++ use_libv4l2_ = true; ++ } ++#endif ++ return fd; + } + + int V4L2CaptureDeviceImpl::close(int fd) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_close(fd); ++#endif + return ::close(fd); + } + + int V4L2CaptureDeviceImpl::ioctl(int fd, int request, void* argp) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_ioctl(fd, request, argp); ++#endif + return ::ioctl(fd, request, argp); + } + +@@ -32,10 +74,18 @@ void* V4L2CaptureDeviceImpl::mmap(void* start, + int flags, + int fd, + off_t offset) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_mmap(start, length, prot, flags, fd, offset); ++#endif + return ::mmap(start, length, prot, flags, fd, offset); + } + + int V4L2CaptureDeviceImpl::munmap(void* start, size_t length) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_munmap(start, length); ++#endif + return ::munmap(start, length); + } + +diff --git a/media/capture/video/linux/v4l2_capture_device_impl.h b/media/capture/video/linux/v4l2_capture_device_impl.h +index 936c8b093..f96c2d434 100644 +--- a/media/capture/video/linux/v4l2_capture_device_impl.h ++++ b/media/capture/video/linux/v4l2_capture_device_impl.h +@@ -8,6 +8,7 @@ + #include + #include + ++#include "media/capture/buildflags.h" + #include "media/capture/capture_export.h" + #include "media/capture/video/linux/v4l2_capture_device.h" + +@@ -17,6 +18,8 @@ namespace media { + // V4L2 APIs. + class CAPTURE_EXPORT V4L2CaptureDeviceImpl : public V4L2CaptureDevice { + public: ++ V4L2CaptureDeviceImpl(); ++ + int open(const char* device_name, int flags) override; + int close(int fd) override; + int ioctl(int fd, int request, void* argp) override; +@@ -32,6 +35,14 @@ class CAPTURE_EXPORT V4L2CaptureDeviceImpl : public V4L2CaptureDevice { + + private: + ~V4L2CaptureDeviceImpl() override; ++ ++#if BUILDFLAG(USE_LIBV4L2) ++ // Has libv4l2. ++ bool has_libv4l2_; ++ // Use libv4l2 when operating |fd|. ++ bool use_libv4l2_; ++#endif ++ + }; + + } // namespace media +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0004-cld3-Avoid-unaligned-accesses.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0004-cld3-Avoid-unaligned-accesses.patch new file mode 100644 index 0000000000000000000000000000000000000000..a6510b0e1e85b3cd997c0685a0bd2e8ff63cf2b5 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0004-cld3-Avoid-unaligned-accesses.patch @@ -0,0 +1,46 @@ +From 18fd4f46599980f3faa08e7b00a39e904f20bc94 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 27 Mar 2020 17:48:20 +0800 +Subject: [PATCH 04/14] cld3: Avoid unaligned accesses + +Although the unaligned memory accesses are enabled, somehow i still hit +the SIGBUS: +[23496.643138] Unhandled fault: alignment fault (0x92000021) at 0x00000000b182e636 +Received signal 7 BUS_ADRALN 0000b182e636 + +Signed-off-by: Jeffy Chen +--- + third_party/cld_3/src/src/script_span/port.h | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/third_party/cld_3/src/src/script_span/port.h b/third_party/cld_3/src/src/script_span/port.h +index 2b3bc515a..1d437babf 100644 +--- a/third_party/cld_3/src/src/script_span/port.h ++++ b/third_party/cld_3/src/src/script_span/port.h +@@ -78,11 +78,23 @@ namespace CLD2 { + // + // This is a mess, but there's not much we can do about it. + ++#if 0 + #define UNALIGNED_LOAD16(_p) (*reinterpret_cast(_p)) + #define UNALIGNED_LOAD32(_p) (*reinterpret_cast(_p)) + + #define UNALIGNED_STORE16(_p, _val) (*reinterpret_cast(_p) = (_val)) + #define UNALIGNED_STORE32(_p, _val) (*reinterpret_cast(_p) = (_val)) ++#else ++inline uint32 UNALIGNED_LOAD32(const void *p) { ++ uint32 t; ++ memcpy(&t, p, sizeof t); ++ return t; ++} ++ ++inline void UNALIGNED_STORE32(void *p, uint32 v) { ++ memcpy(p, &v, sizeof v); ++} ++#endif + + // TODO(sesse): NEON supports unaligned 64-bit loads and stores. + // See if that would be more efficient on platforms supporting it, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0005-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0005-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch new file mode 100644 index 0000000000000000000000000000000000000000..3c6bfb36c8ee63d566e2b3bb785181d3830b2eca --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0005-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch @@ -0,0 +1,29 @@ +From bb98abf98e94848fa352df5edff3d5461f004196 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 10 Apr 2020 16:16:08 +0800 +Subject: [PATCH 05/14] media: gpu: v4l2: Use POLLIN for pending event + +The v4l-rkmpp is using eventfd to fake poll events which not supporting +POLLPRI. + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/generic_v4l2_device.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index a3fe307c8..eb756a914 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -114,7 +114,7 @@ bool GenericV4L2Device::Poll(bool poll_device, bool* event_pending) { + VPLOGF(1) << "poll() failed"; + return false; + } +- *event_pending = (pollfd != -1 && pollfds[pollfd].revents & POLLPRI); ++ *event_pending = (pollfd != -1 && pollfds[pollfd].revents & POLLIN); + return true; + } + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0006-media-capture-linux-Prefer-using-the-first-device.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0006-media-capture-linux-Prefer-using-the-first-device.patch new file mode 100644 index 0000000000000000000000000000000000000000..501e8313456218aba1970bba45203e12a9c1a7e8 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0006-media-capture-linux-Prefer-using-the-first-device.patch @@ -0,0 +1,32 @@ +From 5d9c996760b3d7050bddb5c296c368869bc14dbc Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 5 Nov 2020 12:22:52 +0800 +Subject: [PATCH 06/14] media: capture: linux: Prefer using the first device + +Somehow the newest chromium would prefer using the last device in some +cases, e.g. apprtc. + +Let's reverse the device array to workaround it. + +Signed-off-by: Jeffy Chen +--- + .../capture/video/linux/video_capture_device_factory_linux.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/media/capture/video/linux/video_capture_device_factory_linux.cc b/media/capture/video/linux/video_capture_device_factory_linux.cc +index 7c90f5c46..1351093ed 100644 +--- a/media/capture/video/linux/video_capture_device_factory_linux.cc ++++ b/media/capture/video/linux/video_capture_device_factory_linux.cc +@@ -197,7 +197,8 @@ void VideoCaptureDeviceFactoryLinux::GetDevicesInfo( + continue; + } + +- devices_info.emplace_back(VideoCaptureDeviceDescriptor( ++ // HACK: Somehow the newest chromium would prefer using the last device in some cases, e.g. apprtc ++ devices_info.emplace(devices_info.begin(), VideoCaptureDeviceDescriptor( + display_name, unique_id, model_id, + VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE, GetControlSupport(fd.get()), + VideoCaptureTransportType::OTHER_TRANSPORT, facing_mode)); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0007-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0007-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch new file mode 100644 index 0000000000000000000000000000000000000000..681f61c26e64b6fdb9563279d8064d71ab78bb7e --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0007-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch @@ -0,0 +1,67 @@ +From 4b76e301fc197b2499d725c0ce950f11f0e2866d Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 28 Sep 2020 20:02:00 +0800 +Subject: [PATCH 07/14] media: gpu: v4l2: Fix compile error when ozone not + enabled + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/BUILD.gn | 5 ++++- + media/gpu/v4l2/generic_v4l2_device.cc | 7 +++++++ + 2 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn +index 3a47d1166..800a42faa 100644 +--- a/media/gpu/v4l2/BUILD.gn ++++ b/media/gpu/v4l2/BUILD.gn +@@ -105,9 +105,12 @@ source_set("v4l2") { + "//media/parsers", + "//third_party/libyuv", + "//ui/gfx/geometry", +- "//ui/ozone", + ] + ++ if (use_ozone) { ++ deps += [ "//ui/ozone" ] ++ } ++ + if (use_v4lplugin) { + deps += [ ":libv4l2_stubs" ] + } +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index eb756a914..55901af1a 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -33,8 +33,11 @@ + #include "ui/gl/egl_util.h" + #include "ui/gl/gl_bindings.h" + #include "ui/gl/gl_image_native_pixmap.h" ++ ++#if defined(USE_OZONE) + #include "ui/ozone/public/ozone_platform.h" + #include "ui/ozone/public/surface_factory_ozone.h" ++#endif + + #if BUILDFLAG(USE_LIBV4L2) + // Auto-generated for dlopen libv4l2 libraries +@@ -302,6 +305,9 @@ scoped_refptr GenericV4L2Device::CreateGLImage( + const gfx::Size& size, + const Fourcc fourcc, + gfx::NativePixmapHandle handle) const { ++#if !defined(USE_OZONE) ++ return nullptr; ++#else + DVLOGF(3); + DCHECK(CanCreateEGLImageFrom(fourcc)); + +@@ -336,6 +342,7 @@ scoped_refptr GenericV4L2Device::CreateGLImage( + bool ret = image->Initialize(std::move(pixmap)); + DCHECK(ret); + return image; ++#endif + } + + EGLBoolean GenericV4L2Device::DestroyEGLImage(EGLDisplay egl_display, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0008-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0008-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch new file mode 100644 index 0000000000000000000000000000000000000000..214a782c0ab314a223fe7a6dce92e81196d8d485 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0008-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch @@ -0,0 +1,29 @@ +From 4d73a2a5bb0c8013f0bec4b7d044f86ae09f9be9 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 20 May 2021 01:05:29 +0800 +Subject: [PATCH 08/14] ui: events: ozone: Define SW_PEN_INSERTED for old + kernel headers + +Signed-off-by: Jeffy Chen +--- + ui/events/ozone/evdev/event_converter_evdev_impl.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/ui/events/ozone/evdev/event_converter_evdev_impl.cc b/ui/events/ozone/evdev/event_converter_evdev_impl.cc +index 4ad96a19d..f22ee1536 100644 +--- a/ui/events/ozone/evdev/event_converter_evdev_impl.cc ++++ b/ui/events/ozone/evdev/event_converter_evdev_impl.cc +@@ -31,6 +31,10 @@ namespace { + const int kKeyReleaseValue = 0; + const int kKeyRepeatValue = 2; + ++#ifndef SW_PEN_INSERTED ++#define SW_PEN_INSERTED 0x0f /* set = pen inserted */ ++#endif ++ + // Values for the EV_SW code. + const int kSwitchStylusInserted = SW_PEN_INSERTED; + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0009-Create-new-fence-when-there-s-no-in-fences.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0009-Create-new-fence-when-there-s-no-in-fences.patch new file mode 100644 index 0000000000000000000000000000000000000000..944d4b8981ee2aa77eb4a9d6b580d39436d5f65b --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0009-Create-new-fence-when-there-s-no-in-fences.patch @@ -0,0 +1,62 @@ +From 890b3afc591b71ae1e96d1a050d1958539db22b0 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 01:29:11 +0800 +Subject: [PATCH 09/14] Create new fence when there's no in-fences + +There're cases that in-fences are not provided. + +Signed-off-by: Jeffy Chen +--- + .../wayland/gpu/gbm_surfaceless_wayland.cc | 21 +++++++++++++++++-- + 1 file changed, 19 insertions(+), 2 deletions(-) + +diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +index 752200e2c..7568f89ce 100644 +--- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc ++++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +@@ -31,6 +31,12 @@ static constexpr size_t kMaxSolidColorBuffers = 12; + + static constexpr gfx::Size kSolidColorBufferSize{4, 4}; + ++void WaitForEGLFence(EGLDisplay display, EGLSyncKHR fence) { ++ eglClientWaitSyncKHR(display, fence, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, ++ EGL_FOREVER_KHR); ++ eglDestroySyncKHR(display, fence); ++} ++ + void WaitForGpuFences(std::vector> fences) { + for (auto& fence : fences) + fence->Wait(); +@@ -215,8 +221,9 @@ void GbmSurfacelessWayland::SwapBuffersAsync( + return; + } + +- base::OnceClosure fence_wait_task; + std::vector> fences; ++ // Uset in-fences provided in the overlays. If there are none, we insert our ++ // own fence and wait. + for (auto& config : frame->configs) { + if (!config.access_fence_handle.is_null()) { + fences.push_back(std::make_unique( +@@ -225,7 +232,17 @@ void GbmSurfacelessWayland::SwapBuffersAsync( + } + } + +- fence_wait_task = base::BindOnce(&WaitForGpuFences, std::move(fences)); ++ base::OnceClosure fence_wait_task; ++ if (!fences.empty()) { ++ fence_wait_task = base::BindOnce(&WaitForGpuFences, std::move(fences)); ++ } else { ++ // TODO(fangzhoug): the following should be replaced by a per surface flush ++ // as it gets implemented in GL drivers. ++ EGLSyncKHR fence = InsertFence(has_implicit_external_sync_); ++ CHECK_NE(fence, EGL_NO_SYNC_KHR) << "eglCreateSyncKHR failed"; ++ ++ fence_wait_task = base::BindOnce(&WaitForEGLFence, GetDisplay(), fence); ++ } + + base::OnceClosure fence_retired_callback = base::BindOnce( + &GbmSurfacelessWayland::FenceRetired, weak_factory_.GetWeakPtr(), frame); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0010-HACK-ozone-wayland-Force-disable-implicit-external-s.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0010-HACK-ozone-wayland-Force-disable-implicit-external-s.patch new file mode 100644 index 0000000000000000000000000000000000000000..08152c23d45f600a5fa572d314506f8c5676c68e --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0010-HACK-ozone-wayland-Force-disable-implicit-external-s.patch @@ -0,0 +1,34 @@ +From c2ae381fe294793f6361202307967526c3df7bff Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 01:41:57 +0800 +Subject: [PATCH 10/14] HACK: [ozone/wayland]: Force disable implicit external + sync + +The Mali's implicit external sync seems broken. + +Signed-off-by: Jeffy Chen +--- + ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +index 7568f89ce..bb5d46d43 100644 +--- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc ++++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +@@ -238,10 +238,11 @@ void GbmSurfacelessWayland::SwapBuffersAsync( + } else { + // TODO(fangzhoug): the following should be replaced by a per surface flush + // as it gets implemented in GL drivers. +- EGLSyncKHR fence = InsertFence(has_implicit_external_sync_); ++ // HACK: The Mali's implicit external sync seems broken. ++ EGLSyncKHR fence = InsertFence(/* has_implicit_external_sync_ */ false); + CHECK_NE(fence, EGL_NO_SYNC_KHR) << "eglCreateSyncKHR failed"; + +- fence_wait_task = base::BindOnce(&WaitForEGLFence, GetDisplay(), fence); ++ fence_wait_task = base::BindOnce(&WaitForEGLFence, GetEGLDisplay(), fence); + } + + base::OnceClosure fence_retired_callback = base::BindOnce( +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0011-HACK-media-capture-linux-Allow-camera-without-suppor.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0011-HACK-media-capture-linux-Allow-camera-without-suppor.patch new file mode 100644 index 0000000000000000000000000000000000000000..e7fc2dbf6ca2c0452af5f6d9c5aa894b85cf6fcd --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0011-HACK-media-capture-linux-Allow-camera-without-suppor.patch @@ -0,0 +1,35 @@ +From 16230ae6d4789345a0e331de595996822cec0e08 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 07:25:58 +0800 +Subject: [PATCH 11/14] HACK: media: capture: linux: Allow camera without + supported format + +The chromium would only accept discrete frame sizes. + +Hack it to make Rockchip ISP camera working. + +Signed-off-by: Jeffy Chen +--- + .../video/linux/video_capture_device_factory_linux.cc | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/media/capture/video/linux/video_capture_device_factory_linux.cc b/media/capture/video/linux/video_capture_device_factory_linux.cc +index 1351093ed..e1320551f 100644 +--- a/media/capture/video/linux/video_capture_device_factory_linux.cc ++++ b/media/capture/video/linux/video_capture_device_factory_linux.cc +@@ -192,10 +192,8 @@ void VideoCaptureDeviceFactoryLinux::GetDevicesInfo( + + VideoCaptureFormats supported_formats; + GetSupportedFormatsForV4L2BufferType(fd.get(), &supported_formats); +- if (supported_formats.empty()) { +- DVLOG(1) << "No supported formats: " << unique_id; +- continue; +- } ++ if (supported_formats.empty()) ++ LOG(WARNING) << "No supported formats: " << unique_id; + + // HACK: Somehow the newest chromium would prefer using the last device in some cases, e.g. apprtc + devices_info.emplace(devices_info.begin(), VideoCaptureDeviceDescriptor( +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0012-content-gpu-Only-depend-dri-for-X11.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0012-content-gpu-Only-depend-dri-for-X11.patch new file mode 100644 index 0000000000000000000000000000000000000000..68b9be624c4742e7feaa8098687e25e5f30e4172 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0012-content-gpu-Only-depend-dri-for-X11.patch @@ -0,0 +1,26 @@ +From c23306c9d06971e7ae9606ec8c363e1158f753d5 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 22 Nov 2021 15:59:49 +0800 +Subject: [PATCH 12/14] content: gpu: Only depend dri for X11 + +Signed-off-by: Jeffy Chen +--- + content/gpu/BUILD.gn | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/content/gpu/BUILD.gn b/content/gpu/BUILD.gn +index 1a6063b03..303f30271 100644 +--- a/content/gpu/BUILD.gn ++++ b/content/gpu/BUILD.gn +@@ -136,7 +136,7 @@ target(link_target_type, "gpu_sources") { + + # Use DRI on desktop Linux builds. + if (current_cpu != "s390x" && current_cpu != "ppc64" && is_linux && +- !is_castos) { ++ !is_castos && ozone_platform_x11) { + configs += [ "//build/config/linux/dri" ] + } + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0013-HACK-media-Disable-chromeos-direct-video-decoder-by-.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0013-HACK-media-Disable-chromeos-direct-video-decoder-by-.patch new file mode 100644 index 0000000000000000000000000000000000000000..f91417a725ae505043efe55f32a1d5ebefa24d51 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0013-HACK-media-Disable-chromeos-direct-video-decoder-by-.patch @@ -0,0 +1,29 @@ +From b0fcb21a1c1b2b0aba7e8aa3cbcc8f5fd97fe1f5 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 16 Mar 2022 12:14:02 +0800 +Subject: [PATCH 13/14] HACK: media: Disable chromeos direct video decoder by + default + +Revisit once V4L2 video decoder is supported on linux. + +Signed-off-by: Jeffy Chen +--- + media/base/media_switches.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc +index 1559ee320..6095719f5 100644 +--- a/media/base/media_switches.cc ++++ b/media/base/media_switches.cc +@@ -778,7 +778,7 @@ const base::Feature kUseRealColorSpaceForAndroidVideo{ + // experiment with direct VideoDecoder path on Linux Desktop. + // TODO(b/159825227): remove when the direct video decoder is fully launched. + const base::Feature kUseChromeOSDirectVideoDecoder{ +- "UseChromeOSDirectVideoDecoder", base::FEATURE_ENABLED_BY_DEFAULT}; ++ "UseChromeOSDirectVideoDecoder", base::FEATURE_DISABLED_BY_DEFAULT}; + + #if defined(ARCH_CPU_ARM_FAMILY) + // Some architectures have separate image processor hardware that +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0014-Fix-build-with-use_gtk-false.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0014-Fix-build-with-use_gtk-false.patch new file mode 100644 index 0000000000000000000000000000000000000000..8c3ed9ab54fac3f3324ad184c65e36d21eca6281 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0014-Fix-build-with-use_gtk-false.patch @@ -0,0 +1,218 @@ +From d72c6d7f59aaf74d7ba64664fad3acc774e50324 Mon Sep 17 00:00:00 2001 +From: Tom Anderson +Date: Sat, 21 May 2022 00:39:44 +0000 +Subject: [PATCH 14/14] Fix build with use_gtk=false + +shell_dialog_linux still needs to get built even for non-gtk builds. It +was originally changed in [1] to fix a build with use_dbus=false. This +CL unconditionally includes shell_dialog_linux on Linux, but adds a +check for use_dbus before including select_file_dialog_linux_portal.cc. + +[1] https://chromium-review.googlesource.com/c/chromium/src/+/3462233 + +R=sky + +Bug: None +Change-Id: I54c39f52175e0c4b0784d15822e0fc4125f9e47d +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3656243 +Commit-Queue: Thomas Anderson +Reviewed-by: Scott Violet +Auto-Submit: Thomas Anderson +Commit-Queue: Scott Violet +Cr-Commit-Position: refs/heads/main@{#1006054} +--- + ui/shell_dialogs/BUILD.gn | 23 ++++--- + ui/shell_dialogs/shell_dialog_linux.cc | 88 ++++++++++++++++---------- + 2 files changed, 67 insertions(+), 44 deletions(-) + +diff --git a/ui/shell_dialogs/BUILD.gn b/ui/shell_dialogs/BUILD.gn +index e1b3041dc..192251bad 100644 +--- a/ui/shell_dialogs/BUILD.gn ++++ b/ui/shell_dialogs/BUILD.gn +@@ -3,7 +3,7 @@ + # found in the LICENSE file. + + import("//build/config/chromeos/ui_mode.gni") +-import("//build/config/linux/gtk/gtk.gni") ++import("//build/config/features.gni") + import("//build/config/ui.gni") + import("//testing/test.gni") + +@@ -41,23 +41,28 @@ component("shell_dialogs") { + "//url", + ] + +- if (is_chromeos || (is_linux && !use_gtk)) { ++ if (is_chromeos || is_chromecast) { + sources += [ "shell_dialog_stub.cc" ] +- } else if (is_linux) { ++ } ++ ++ if (is_linux && !is_chromecast) { + sources += [ + "select_file_dialog_linux.cc", + "select_file_dialog_linux.h", + "select_file_dialog_linux_kde.cc", + "select_file_dialog_linux_kde.h", +- "select_file_dialog_linux_portal.cc", +- "select_file_dialog_linux_portal.h", + "shell_dialog_linux.cc", + "shell_dialog_linux.h", + ] +- deps += [ +- "//components/dbus/thread_linux", +- "//dbus", +- ] ++ deps += [ "//components/dbus/thread_linux" ] ++ if (use_dbus) { ++ defines += [ "USE_DBUS" ] ++ sources += [ ++ "select_file_dialog_linux_portal.cc", ++ "select_file_dialog_linux_portal.h", ++ ] ++ deps += [ "//dbus" ] ++ } + } + + if (is_mac) { +diff --git a/ui/shell_dialogs/shell_dialog_linux.cc b/ui/shell_dialogs/shell_dialog_linux.cc +index 0f5fa2e55..078fd3b1b 100644 +--- a/ui/shell_dialogs/shell_dialog_linux.cc ++++ b/ui/shell_dialogs/shell_dialog_linux.cc +@@ -10,14 +10,26 @@ + #include "build/chromeos_buildflags.h" + #include "ui/shell_dialogs/select_file_dialog_linux.h" + #include "ui/shell_dialogs/select_file_dialog_linux_kde.h" +-#include "ui/shell_dialogs/select_file_dialog_linux_portal.h" + #include "ui/shell_dialogs/select_file_policy.h" + ++#if defined(USE_DBUS) ++#include "ui/shell_dialogs/select_file_dialog_linux_portal.h" ++#endif ++ ++namespace ui { ++ + namespace { + +-ui::ShellDialogLinux* g_shell_dialog_linux = nullptr; ++ShellDialogLinux* g_shell_dialog_linux = nullptr; + +-enum FileDialogChoice { kUnknown, kToolkit, kKde, kPortal }; ++enum FileDialogChoice { ++ kUnknown, ++ kToolkit, ++ kKde, ++#if defined(USE_DBUS) ++ kPortal, ++#endif ++}; + + FileDialogChoice dialog_choice_ = kUnknown; + +@@ -26,14 +38,43 @@ std::string& KDialogVersion() { + return *version; + } + +-} // namespace ++FileDialogChoice GetFileDialogChoice() { ++#if defined(USE_DBUS) ++ // Check to see if the portal is available. ++ if (SelectFileDialogLinuxPortal::IsPortalAvailable()) ++ return kPortal; ++ // Make sure to kill the portal connection. ++ SelectFileDialogLinuxPortal::DestroyPortalConnection(); ++#endif ++ ++ // Check to see if KDE is the desktop environment. ++ std::unique_ptr env(base::Environment::Create()); ++ base::nix::DesktopEnvironment desktop = ++ base::nix::GetDesktopEnvironment(env.get()); ++ if (desktop == base::nix::DESKTOP_ENVIRONMENT_KDE3 || ++ desktop == base::nix::DESKTOP_ENVIRONMENT_KDE4 || ++ desktop == base::nix::DESKTOP_ENVIRONMENT_KDE5) { ++ // Check to see if the user dislikes the KDE file dialog. ++ if (!env->HasVar("NO_CHROME_KDE_FILE_DIALOG")) { ++ // Check to see if the KDE dialog works. ++ if (SelectFileDialogLinux::CheckKDEDialogWorksOnUIThread( ++ KDialogVersion())) { ++ return kKde; ++ } ++ } ++ } + +-namespace ui { ++ return kToolkit; ++} ++ ++} // namespace + + ShellDialogLinux::ShellDialogLinux() = default; + + ShellDialogLinux::~ShellDialogLinux() { ++#if defined(USE_DBUS) + SelectFileDialogLinuxPortal::DestroyPortalConnection(); ++#endif + } + + void ShellDialogLinux::SetInstance(ShellDialogLinux* instance) { +@@ -45,50 +86,27 @@ const ShellDialogLinux* ShellDialogLinux::instance() { + } + + void ShellDialogLinux::Initialize() { ++#if defined(USE_DBUS) + SelectFileDialogLinuxPortal::StartAvailabilityTestInBackground(); ++#endif + } + + SelectFileDialog* CreateSelectFileDialog( + SelectFileDialog::Listener* listener, + std::unique_ptr policy) { +- if (dialog_choice_ == kUnknown) { +- // Start out assuming we are going to use dialogs from the toolkit. +- dialog_choice_ = kToolkit; +- +- // Check to see if the portal is available. +- if (SelectFileDialogLinuxPortal::IsPortalAvailable()) { +- dialog_choice_ = kPortal; +- } else { +- // Make sure to kill the portal connection. +- SelectFileDialogLinuxPortal::DestroyPortalConnection(); +- +- // Check to see if KDE is the desktop environment. +- std::unique_ptr env(base::Environment::Create()); +- base::nix::DesktopEnvironment desktop = +- base::nix::GetDesktopEnvironment(env.get()); +- if (desktop == base::nix::DESKTOP_ENVIRONMENT_KDE3 || +- desktop == base::nix::DESKTOP_ENVIRONMENT_KDE4 || +- desktop == base::nix::DESKTOP_ENVIRONMENT_KDE5) { +- // Check to see if the user dislikes the KDE file dialog. +- if (!env->HasVar("NO_CHROME_KDE_FILE_DIALOG")) { +- // Check to see if the KDE dialog works. +- if (SelectFileDialogLinux::CheckKDEDialogWorksOnUIThread( +- KDialogVersion())) { +- dialog_choice_ = kKde; +- } +- } +- } +- } +- } ++ if (dialog_choice_ == kUnknown) ++ dialog_choice_ = GetFileDialogChoice(); + +- const ui::ShellDialogLinux* shell_dialogs = ui::ShellDialogLinux::instance(); ++ const ShellDialogLinux* shell_dialogs = ShellDialogLinux::instance(); + switch (dialog_choice_) { + case kToolkit: + if (!shell_dialogs) + break; + return shell_dialogs->CreateSelectFileDialog(listener, std::move(policy)); ++#if defined(USE_DBUS) + case kPortal: + return new SelectFileDialogLinuxPortal(listener, std::move(policy)); ++#endif + case kKde: { + std::unique_ptr env(base::Environment::Create()); + base::nix::DesktopEnvironment desktop = +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0015-libgav1-Enable-parser-on-arm32-as-well.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0015-libgav1-Enable-parser-on-arm32-as-well.patch new file mode 100644 index 0000000000000000000000000000000000000000..b49b57afeeb02b418077d8f0ca3f33b80e9716f7 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_103.0.5060/0015-libgav1-Enable-parser-on-arm32-as-well.patch @@ -0,0 +1,24 @@ +From a14a9fb3f75ddc8df074b3773c7ed837cddf373c Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 6 Sep 2022 18:24:32 +0800 +Subject: [PATCH] libgav1: Enable parser on arm32 as well + +Signed-off-by: Jeffy Chen +--- + third_party/libgav1/options.gni | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/third_party/libgav1/options.gni b/third_party/libgav1/options.gni +index 5e0fe7ea3..bd6a4a572 100644 +--- a/third_party/libgav1/options.gni ++++ b/third_party/libgav1/options.gni +@@ -13,5 +13,5 @@ declare_args() { + use_libgav1_parser = + (is_chromeos || is_linux || is_win) && + (target_cpu == "x86" || target_cpu == "x64" || +- target_cpu == "arm64" || target_cpu == "ppc64") ++ target_cpu == "arm" || target_cpu == "arm64" || target_cpu == "ppc64") + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0001-Add-support-for-V4L2VDA-on-Linux.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0001-Add-support-for-V4L2VDA-on-Linux.patch new file mode 100644 index 0000000000000000000000000000000000000000..d558b296c56847002ab7f7266224df3b15d26588 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0001-Add-support-for-V4L2VDA-on-Linux.patch @@ -0,0 +1,462 @@ +From c6ff41b9cb383dd8c180c239119719a5abbdc6db Mon Sep 17 00:00:00 2001 +From: Maksim Sisov +Date: Wed, 31 Jul 2019 09:56:24 +0300 +Subject: [PATCH 01/17] Add support for V4L2VDA on Linux + +This patch enables hardware assisted video decoding via the +Chromium V4L2VDA. Including changes when Linux is used. In +order to use this, use_linux_v4l2_only flag should be set +to true. + +Signed-off-by: Ryo Kodama + +fixup! avoid building not declared formats + +"FRAME", "_SLICE", "V4L2_PIX_FMT_VP9" are not defined in mainline + Linux headers. This patch avoids building these formats. + +Signed-off-by: Ryo Kodama + +fixup! add V4L2_PIX_FMT_VP9 support back again as it is now +included in mainline Linux kernel. This allows VP9 codec +to work with upstream kernel and v4l2 vda. Tested on db820c +with Venus v4l2 driver. + +Signed-off-by: Peter Griffin +Signed-off-by: Stanimir Varbanov +Signed-off-by: Jeffy Chen +--- + .../gpu_mjpeg_decode_accelerator_factory.cc | 3 +- + media/gpu/BUILD.gn | 1 + + media/gpu/args.gni | 4 ++ + .../gpu_video_decode_accelerator_factory.cc | 8 +++ + .../gpu_video_decode_accelerator_factory.h | 2 + + media/gpu/v4l2/BUILD.gn | 41 ++++++------ + media/gpu/v4l2/generic_v4l2_device.cc | 4 ++ + media/gpu/v4l2/v4l2_device.cc | 66 +++++++++++++++++++ + media/gpu/v4l2/v4l2_video_decoder.cc | 7 ++ + 9 files changed, 116 insertions(+), 20 deletions(-) + +diff --git a/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc b/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc +index 3772b8ef0..dece6b77f 100644 +--- a/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc ++++ b/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc +@@ -13,7 +13,8 @@ + #include "media/base/media_switches.h" + #include "media/gpu/buildflags.h" + +-#if BUILDFLAG(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY) ++#if BUILDFLAG(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY) && \ ++ !BUILDFLAG(USE_LINUX_V4L2) + #define USE_V4L2_MJPEG_DECODE_ACCELERATOR + #endif + +diff --git a/media/gpu/BUILD.gn b/media/gpu/BUILD.gn +index 71d39a337..a62c95fc7 100644 +--- a/media/gpu/BUILD.gn ++++ b/media/gpu/BUILD.gn +@@ -20,6 +20,7 @@ buildflag_header("buildflags") { + "USE_VAAPI_IMAGE_CODECS=$use_vaapi_image_codecs", + "USE_V4L2_CODEC=$use_v4l2_codec", + "USE_LIBV4L2=$use_v4lplugin", ++ "USE_LINUX_V4L2=$use_linux_v4l2_only", + "USE_VAAPI_X11=$use_vaapi_x11", + ] + } +diff --git a/media/gpu/args.gni b/media/gpu/args.gni +index bb2ff0797..da20cff79 100644 +--- a/media/gpu/args.gni ++++ b/media/gpu/args.gni +@@ -21,6 +21,10 @@ declare_args() { + # platforms which have v4l2 hardware encoder / decoder. + use_v4l2_codec = false + ++ # Indicates that only definitions available in the mainline linux kernel ++ # will be used. ++ use_linux_v4l2_only = false ++ + # Indicates if Video4Linux2 AML encoder is used. This is used for AML + # platforms which have v4l2 hardware encoder + use_v4l2_codec_aml = false +diff --git a/media/gpu/gpu_video_decode_accelerator_factory.cc b/media/gpu/gpu_video_decode_accelerator_factory.cc +index 98f1e2ee7..b7cfffabb 100644 +--- a/media/gpu/gpu_video_decode_accelerator_factory.cc ++++ b/media/gpu/gpu_video_decode_accelerator_factory.cc +@@ -29,7 +29,9 @@ + #include "ui/gl/gl_implementation.h" + #elif BUILDFLAG(USE_V4L2_CODEC) + #include "media/gpu/v4l2/v4l2_device.h" ++#if !BUILDFLAG(USE_LINUX_V4L2) + #include "media/gpu/v4l2/v4l2_slice_video_decode_accelerator.h" ++#endif + #include "media/gpu/v4l2/v4l2_video_decode_accelerator.h" + #include "ui/gl/gl_surface_egl.h" + #endif +@@ -64,10 +66,12 @@ gpu::VideoDecodeAcceleratorCapabilities GetDecoderCapabilitiesInternal( + GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( + V4L2VideoDecodeAccelerator::GetSupportedProfiles(), + &capabilities.supported_profiles); ++#if !BUILDFLAG(USE_LINUX_V4L2) + GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( + V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles(), + &capabilities.supported_profiles); + #endif ++#endif + #elif BUILDFLAG(IS_MAC) + capabilities.supported_profiles = + VTVideoDecodeAccelerator::GetSupportedProfiles(workarounds); +@@ -146,8 +150,10 @@ GpuVideoDecodeAcceleratorFactory::CreateVDA( + &GpuVideoDecodeAcceleratorFactory::CreateVaapiVDA, + #elif BUILDFLAG(USE_V4L2_CODEC) + &GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA, ++#if !BUILDFLAG(USE_LINUX_V4L2) + &GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA, + #endif ++#endif + + #if BUILDFLAG(IS_MAC) + &GpuVideoDecodeAcceleratorFactory::CreateVTVDA, +@@ -207,6 +213,7 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA( + return decoder; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + std::unique_ptr + GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA( + const gpu::GpuDriverBugWorkarounds& /*workarounds*/, +@@ -222,6 +229,7 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA( + return decoder; + } + #endif ++#endif + + #if BUILDFLAG(IS_MAC) + std::unique_ptr +diff --git a/media/gpu/gpu_video_decode_accelerator_factory.h b/media/gpu/gpu_video_decode_accelerator_factory.h +index b2e1390c5..5a714eb80 100644 +--- a/media/gpu/gpu_video_decode_accelerator_factory.h ++++ b/media/gpu/gpu_video_decode_accelerator_factory.h +@@ -104,11 +104,13 @@ class MEDIA_GPU_EXPORT GpuVideoDecodeAcceleratorFactory { + const gpu::GpuDriverBugWorkarounds& workarounds, + const gpu::GpuPreferences& gpu_preferences, + MediaLog* media_log) const; ++#if !BUILDFLAG(USE_LINUX_V4L2) + std::unique_ptr CreateV4L2SliceVDA( + const gpu::GpuDriverBugWorkarounds& workarounds, + const gpu::GpuPreferences& gpu_preferences, + MediaLog* media_log) const; + #endif ++#endif + #if BUILDFLAG(IS_MAC) + std::unique_ptr CreateVTVDA( + const gpu::GpuDriverBugWorkarounds& workarounds, +diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn +index 6a635eff4..73365b306 100644 +--- a/media/gpu/v4l2/BUILD.gn ++++ b/media/gpu/v4l2/BUILD.gn +@@ -28,9 +28,6 @@ source_set("v4l2") { + "buffer_affinity_tracker.h", + "generic_v4l2_device.cc", + "generic_v4l2_device.h", +- "v4l2_decode_surface.cc", +- "v4l2_decode_surface.h", +- "v4l2_decode_surface_handler.h", + "v4l2_device.cc", + "v4l2_device.h", + "v4l2_device_poller.cc", +@@ -39,8 +36,6 @@ source_set("v4l2") { + "v4l2_framerate_control.h", + "v4l2_image_processor_backend.cc", + "v4l2_image_processor_backend.h", +- "v4l2_slice_video_decode_accelerator.cc", +- "v4l2_slice_video_decode_accelerator.h", + "v4l2_stateful_workaround.cc", + "v4l2_stateful_workaround.h", + "v4l2_utils.cc", +@@ -55,24 +50,32 @@ source_set("v4l2") { + "v4l2_video_decoder_backend.h", + "v4l2_video_decoder_backend_stateful.cc", + "v4l2_video_decoder_backend_stateful.h", +- "v4l2_video_decoder_backend_stateless.cc", +- "v4l2_video_decoder_backend_stateless.h", +- "v4l2_video_decoder_delegate_h264.cc", +- "v4l2_video_decoder_delegate_h264.h", +- "v4l2_video_decoder_delegate_h264_legacy.cc", +- "v4l2_video_decoder_delegate_h264_legacy.h", +- "v4l2_video_decoder_delegate_vp8.cc", +- "v4l2_video_decoder_delegate_vp8.h", +- "v4l2_video_decoder_delegate_vp8_legacy.cc", +- "v4l2_video_decoder_delegate_vp8_legacy.h", +- "v4l2_video_decoder_delegate_vp9.cc", +- "v4l2_video_decoder_delegate_vp9.h", +- "v4l2_video_decoder_delegate_vp9_legacy.cc", +- "v4l2_video_decoder_delegate_vp9_legacy.h", + "v4l2_video_encode_accelerator.cc", + "v4l2_video_encode_accelerator.h", + ] + ++ if (!use_linux_v4l2_only) { ++ sources += [ ++ "v4l2_slice_video_decode_accelerator.cc", ++ "v4l2_slice_video_decode_accelerator.h", ++ "v4l2_video_decoder_backend_stateless.cc", ++ "v4l2_video_decoder_backend_stateless.h", ++ "v4l2_video_decoder_delegate_h264.cc", ++ "v4l2_video_decoder_delegate_h264.h", ++ "v4l2_video_decoder_delegate_h264_legacy.cc", ++ "v4l2_video_decoder_delegate_h264_legacy.h", ++ "v4l2_video_decoder_delegate_vp8.cc", ++ "v4l2_video_decoder_delegate_vp8.h", ++ "v4l2_video_decoder_delegate_vp8_legacy.cc", ++ "v4l2_video_decoder_delegate_vp8_legacy.h", ++ "v4l2_video_decoder_delegate_vp9.cc", ++ "v4l2_video_decoder_delegate_vp9.h", ++ "v4l2_video_decoder_delegate_vp9_legacy.cc", ++ "v4l2_video_decoder_delegate_vp9_legacy.h", ++ ] ++ } ++ ++ + libs = [ + "EGL", + "GLESv2", +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index a6fe9d914..becf30c9c 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -440,7 +440,11 @@ bool GenericV4L2Device::OpenDevicePath(const std::string& path, Type type) { + return false; + + #if BUILDFLAG(USE_LIBV4L2) ++#if BUILDFLAG(USE_LINUX_V4L2) ++ if ( ++#else + if (type == Type::kEncoder && ++#endif + HANDLE_EINTR(v4l2_fd_open(device_fd_.get(), V4L2_DISABLE_CONVERSION)) != + -1) { + DVLOGF(3) << "Using libv4l2 for " << path; +diff --git a/media/gpu/v4l2/v4l2_device.cc b/media/gpu/v4l2/v4l2_device.cc +index 241b328fd..e0489a104 100644 +--- a/media/gpu/v4l2/v4l2_device.cc ++++ b/media/gpu/v4l2/v4l2_device.cc +@@ -853,7 +853,9 @@ void V4L2WritableBufferRef::SetConfigStore(uint32_t config_store) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK(buffer_data_); + ++#if !BUILDFLAG(USE_LINUX_V4L2) + buffer_data_->v4l2_buffer_.config_store = config_store; ++#endif + } + + V4L2ReadableBuffer::V4L2ReadableBuffer(const struct v4l2_buffer& v4l2_buffer, +@@ -996,10 +998,12 @@ V4L2Queue::V4L2Queue(scoped_refptr dev, + return; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + if (reqbufs.capabilities & V4L2_BUF_CAP_SUPPORTS_REQUESTS) { + supports_requests_ = true; + DVLOGF(4) << "Queue supports request API."; + } ++#endif + } + + V4L2Queue::~V4L2Queue() { +@@ -1539,6 +1543,23 @@ std::string V4L2Device::GetDriverName() { + // static + uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + bool slice_based) { ++#if BUILDFLAG(USE_LINUX_V4L2) ++ if (slice_based) { ++ LOG(ERROR) << "Slice not supported"; ++ return 0; ++ } ++ ++ if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { ++ return V4L2_PIX_FMT_H264; ++ } else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) { ++ return V4L2_PIX_FMT_VP8; ++ } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) { ++ return V4L2_PIX_FMT_VP9; ++ } else { ++ DVLOGF(1) << "Unsupported profile: " << GetProfileName(profile); ++ return 0; ++ } ++#else + if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { + if (slice_based) + return V4L2_PIX_FMT_H264_SLICE; +@@ -1558,8 +1579,10 @@ uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + DVLOGF(1) << "Unsupported profile: " << GetProfileName(profile); + return 0; + } ++#endif + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + namespace { + + VideoCodecProfile V4L2ProfileToVideoCodecProfile(VideoCodec codec, +@@ -1606,9 +1629,11 @@ VideoCodecProfile V4L2ProfileToVideoCodecProfile(VideoCodec codec, + } + + } // namespace ++#endif + + std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + uint32_t pix_fmt) { ++#if !BUILDFLAG(USE_LINUX_V4L2) + auto get_supported_profiles = [this]( + VideoCodec codec, + std::vector* profiles) { +@@ -1679,6 +1704,27 @@ std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + VLOGF(1) << "Unhandled pixelformat " << FourccToString(pix_fmt); + return {}; + } ++#else ++ std::vector profiles; ++ switch (pix_fmt) { ++ case V4L2_PIX_FMT_H264: ++ profiles = { ++ H264PROFILE_BASELINE, ++ H264PROFILE_MAIN, ++ H264PROFILE_HIGH, ++ }; ++ break; ++ case V4L2_PIX_FMT_VP8: ++ profiles = {VP8PROFILE_ANY}; ++ break; ++ case V4L2_PIX_FMT_VP9: ++ profiles = {VP9PROFILE_PROFILE0}; ++ break; ++ default: ++ VLOGF(1) << "Unhandled pixelformat " << FourccToString(pix_fmt); ++ return {}; ++ } ++#endif + + // Erase duplicated profiles. + std::sort(profiles.begin(), profiles.end()); +@@ -2348,10 +2394,14 @@ bool V4L2Request::ApplyCtrls(struct v4l2_ext_controls* ctrls) { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + ctrls->which = V4L2_CTRL_WHICH_REQUEST_VAL; + ctrls->request_fd = request_fd_.get(); + + return true; ++#else ++ return false; ++#endif + } + + bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) { +@@ -2363,10 +2413,14 @@ bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + buffer->flags |= V4L2_BUF_FLAG_REQUEST_FD; + buffer->request_fd = request_fd_.get(); + + return true; ++#else ++ return false; ++#endif + } + + bool V4L2Request::Submit() { +@@ -2377,7 +2431,11 @@ bool V4L2Request::Submit() { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + return HANDLE_EINTR(ioctl(request_fd_.get(), MEDIA_REQUEST_IOC_QUEUE)) == 0; ++#else ++ return false; ++#endif + } + + bool V4L2Request::IsCompleted() { +@@ -2420,6 +2478,7 @@ bool V4L2Request::Reset() { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + // Reinit the request to make sure we can use it for a new submission. + if (HANDLE_EINTR(ioctl(request_fd_.get(), MEDIA_REQUEST_IOC_REINIT)) < 0) { + VPLOGF(1) << "Failed to reinit request."; +@@ -2427,6 +2486,9 @@ bool V4L2Request::Reset() { + } + + return true; ++#else ++ return false; ++#endif + } + + V4L2RequestRefBase::V4L2RequestRefBase(V4L2RequestRefBase&& req_base) { +@@ -2501,6 +2563,7 @@ V4L2RequestsQueue::~V4L2RequestsQueue() { + absl::optional V4L2RequestsQueue::CreateRequestFD() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + ++#if !BUILDFLAG(USE_LINUX_V4L2) + int request_fd; + int ret = HANDLE_EINTR( + ioctl(media_fd_.get(), MEDIA_IOC_REQUEST_ALLOC, &request_fd)); +@@ -2510,6 +2573,9 @@ absl::optional V4L2RequestsQueue::CreateRequestFD() { + } + + return base::ScopedFD(request_fd); ++#else ++ return absl::nullopt; ++#endif + } + + absl::optional V4L2RequestsQueue::GetFreeRequest() { +diff --git a/media/gpu/v4l2/v4l2_video_decoder.cc b/media/gpu/v4l2/v4l2_video_decoder.cc +index 3f0b0fdcf..b95d84ad1 100644 +--- a/media/gpu/v4l2/v4l2_video_decoder.cc ++++ b/media/gpu/v4l2/v4l2_video_decoder.cc +@@ -28,7 +28,10 @@ + #include "media/gpu/macros.h" + #include "media/gpu/v4l2/v4l2_status.h" + #include "media/gpu/v4l2/v4l2_video_decoder_backend_stateful.h" ++ ++#if !BUILDFLAG(USE_LINUX_V4L2) + #include "media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h" ++#endif + + namespace media { + +@@ -46,7 +49,9 @@ constexpr size_t kNumInputBuffers = 8; + + // Input format V4L2 fourccs this class supports. + constexpr uint32_t kSupportedInputFourccs[] = { ++#if !BUILDFLAG(USE_LINUX_V4L2) + V4L2_PIX_FMT_H264_SLICE, V4L2_PIX_FMT_VP8_FRAME, V4L2_PIX_FMT_VP9_FRAME, ++#endif + V4L2_PIX_FMT_H264, V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, + }; + +@@ -322,6 +327,7 @@ V4L2Status V4L2VideoDecoder::InitializeBackend() { + << " and fourcc: " << FourccToString(input_format_fourcc); + backend_ = std::make_unique( + this, device_, profile_, color_space_, decoder_task_runner_); ++#if !BUILDFLAG(USE_LINUX_V4L2) + } else { + DCHECK_EQ(preferred_api_and_format.first, kStateless); + VLOGF(1) << "Using a stateless API for profile: " +@@ -329,6 +335,7 @@ V4L2Status V4L2VideoDecoder::InitializeBackend() { + << " and fourcc: " << FourccToString(input_format_fourcc); + backend_ = std::make_unique( + this, device_, profile_, color_space_, decoder_task_runner_); ++#endif + } + + if (!backend_->Initialize()) { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0002-Add-mmap-via-libv4l-to-generic_v4l2_device.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0002-Add-mmap-via-libv4l-to-generic_v4l2_device.patch new file mode 100644 index 0000000000000000000000000000000000000000..f5cb4c00ca5b75215284b20e69edb66890abdc4a --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0002-Add-mmap-via-libv4l-to-generic_v4l2_device.patch @@ -0,0 +1,49 @@ +From ca52328200d202eff51e3bdb0b1a54b4d717c4c4 Mon Sep 17 00:00:00 2001 +From: Damian Hobson-Garcia +Date: Wed, 21 Mar 2018 13:18:17 +0200 +Subject: [PATCH 02/17] Add mmap via libv4l to generic_v4l2_device + +Issue #437 +--- + media/gpu/v4l2/generic_v4l2_device.cc | 10 ++++++++++ + media/gpu/v4l2/v4l2.sig | 2 ++ + 2 files changed, 12 insertions(+) + +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index becf30c9c..a3fe307c8 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -124,10 +124,20 @@ void* GenericV4L2Device::Mmap(void* addr, + int flags, + unsigned int offset) { + DCHECK(device_fd_.is_valid()); ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_mmap(addr, len, prot, flags, device_fd_.get(), offset); ++#endif + return mmap(addr, len, prot, flags, device_fd_.get(), offset); + } + + void GenericV4L2Device::Munmap(void* addr, unsigned int len) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) { ++ v4l2_munmap(addr, len); ++ return; ++ } ++#endif + munmap(addr, len); + } + +diff --git a/media/gpu/v4l2/v4l2.sig b/media/gpu/v4l2/v4l2.sig +index 4269fb48d..71b5b3787 100644 +--- a/media/gpu/v4l2/v4l2.sig ++++ b/media/gpu/v4l2/v4l2.sig +@@ -8,3 +8,5 @@ + LIBV4L_PUBLIC int v4l2_close(int fd); + LIBV4L_PUBLIC int v4l2_ioctl(int fd, unsigned long int request, ...); + LIBV4L_PUBLIC int v4l2_fd_open(int fd, int v4l2_flags); ++LIBV4L_PUBLIC void *v4l2_mmap(void *start, size_t length, int prot, int flags, int fd, int64_t offset); ++LIBV4L_PUBLIC int v4l2_munmap(void *_start, size_t length); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0003-media-capture-linux-Support-libv4l2-plugins.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0003-media-capture-linux-Support-libv4l2-plugins.patch new file mode 100644 index 0000000000000000000000000000000000000000..12dea87c8d881c9fd833a6f49a53f5f203dda3f9 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0003-media-capture-linux-Support-libv4l2-plugins.patch @@ -0,0 +1,178 @@ +From 5fbece9fa1763af70c9e4346af2ac10b0dec0af7 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 1 Jul 2019 10:37:35 +0800 +Subject: [PATCH 03/17] media: capture: linux: Support libv4l2 plugins + +Allow using libv4l2 plugins for linux v4l2 capture devices. + +Signed-off-by: Jeffy Chen +--- + media/capture/BUILD.gn | 14 +++++ + .../video/linux/v4l2_capture_device_impl.cc | 52 ++++++++++++++++++- + .../video/linux/v4l2_capture_device_impl.h | 11 ++++ + 3 files changed, 76 insertions(+), 1 deletion(-) + +diff --git a/media/capture/BUILD.gn b/media/capture/BUILD.gn +index 3f80b62cb..3c6559339 100644 +--- a/media/capture/BUILD.gn ++++ b/media/capture/BUILD.gn +@@ -2,6 +2,7 @@ + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. + ++import("//build/buildflag_header.gni") + import("//build/config/chromeos/ui_mode.gni") + import("//build/config/features.gni") + import("//build/config/ui.gni") +@@ -18,6 +19,14 @@ group("capture") { + ] + } + ++buildflag_header("buildflags") { ++ header = "buildflags.h" ++ ++ flags = [ ++ "USE_LIBV4L2=$use_v4lplugin", ++ ] ++} ++ + component("capture_switches") { + defines = [ "CAPTURE_IMPLEMENTATION" ] + sources = [ +@@ -266,6 +275,11 @@ component("capture_lib") { + "video/linux/video_capture_device_linux.cc", + "video/linux/video_capture_device_linux.h", + ] ++ public_deps += [ ":buildflags" ] ++ ++ if (use_v4lplugin) { ++ deps += [ "//media/gpu/v4l2:libv4l2_stubs" ] ++ } + } + + if (is_chromeos_ash) { +diff --git a/media/capture/video/linux/v4l2_capture_device_impl.cc b/media/capture/video/linux/v4l2_capture_device_impl.cc +index c9040f5de..d05d1179e 100644 +--- a/media/capture/video/linux/v4l2_capture_device_impl.cc ++++ b/media/capture/video/linux/v4l2_capture_device_impl.cc +@@ -10,19 +10,61 @@ + #include + #include + ++#if BUILDFLAG(USE_LIBV4L2) ++// Auto-generated for dlopen libv4l2 libraries ++#include "media/gpu/v4l2/v4l2_stubs.h" ++#include "third_party/v4l-utils/lib/include/libv4l2.h" ++ ++#include "base/files/file_path.h" ++ ++using media_gpu_v4l2::kModuleV4l2; ++using media_gpu_v4l2::InitializeStubs; ++using media_gpu_v4l2::StubPathMap; ++ ++static const base::FilePath::CharType kV4l2Lib[] = ++ FILE_PATH_LITERAL("/usr/lib/libv4l2.so"); ++#endif ++ + namespace media { + + V4L2CaptureDeviceImpl::~V4L2CaptureDeviceImpl() = default; + ++V4L2CaptureDeviceImpl::V4L2CaptureDeviceImpl() { ++#if BUILDFLAG(USE_LIBV4L2) ++ StubPathMap paths; ++ paths[kModuleV4l2].push_back(kV4l2Lib); ++ ++ has_libv4l2_ = InitializeStubs(paths); ++#endif ++} ++ + int V4L2CaptureDeviceImpl::open(const char* device_name, int flags) { +- return ::open(device_name, flags); ++ int fd = ::open64(device_name, flags); ++ if (fd < 0) ++ return fd; ++ ++#if BUILDFLAG(USE_LIBV4L2) ++ use_libv4l2_ = false; ++ if (has_libv4l2_ && v4l2_fd_open(fd, V4L2_DISABLE_CONVERSION) != -1) { ++ use_libv4l2_ = true; ++ } ++#endif ++ return fd; + } + + int V4L2CaptureDeviceImpl::close(int fd) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_close(fd); ++#endif + return ::close(fd); + } + + int V4L2CaptureDeviceImpl::ioctl(int fd, int request, void* argp) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_ioctl(fd, request, argp); ++#endif + return ::ioctl(fd, request, argp); + } + +@@ -32,10 +74,18 @@ void* V4L2CaptureDeviceImpl::mmap(void* start, + int flags, + int fd, + off_t offset) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_mmap(start, length, prot, flags, fd, offset); ++#endif + return ::mmap(start, length, prot, flags, fd, offset); + } + + int V4L2CaptureDeviceImpl::munmap(void* start, size_t length) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_munmap(start, length); ++#endif + return ::munmap(start, length); + } + +diff --git a/media/capture/video/linux/v4l2_capture_device_impl.h b/media/capture/video/linux/v4l2_capture_device_impl.h +index 936c8b093..f96c2d434 100644 +--- a/media/capture/video/linux/v4l2_capture_device_impl.h ++++ b/media/capture/video/linux/v4l2_capture_device_impl.h +@@ -8,6 +8,7 @@ + #include + #include + ++#include "media/capture/buildflags.h" + #include "media/capture/capture_export.h" + #include "media/capture/video/linux/v4l2_capture_device.h" + +@@ -17,6 +18,8 @@ namespace media { + // V4L2 APIs. + class CAPTURE_EXPORT V4L2CaptureDeviceImpl : public V4L2CaptureDevice { + public: ++ V4L2CaptureDeviceImpl(); ++ + int open(const char* device_name, int flags) override; + int close(int fd) override; + int ioctl(int fd, int request, void* argp) override; +@@ -32,6 +35,14 @@ class CAPTURE_EXPORT V4L2CaptureDeviceImpl : public V4L2CaptureDevice { + + private: + ~V4L2CaptureDeviceImpl() override; ++ ++#if BUILDFLAG(USE_LIBV4L2) ++ // Has libv4l2. ++ bool has_libv4l2_; ++ // Use libv4l2 when operating |fd|. ++ bool use_libv4l2_; ++#endif ++ + }; + + } // namespace media +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0004-cld3-Avoid-unaligned-accesses.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0004-cld3-Avoid-unaligned-accesses.patch new file mode 100644 index 0000000000000000000000000000000000000000..e1c167a06085a5b17f9242e5e7673b32599cb1c0 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0004-cld3-Avoid-unaligned-accesses.patch @@ -0,0 +1,46 @@ +From 8defbc643a5f57c2289d16138924cd776ed784bf Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 27 Mar 2020 17:48:20 +0800 +Subject: [PATCH 04/17] cld3: Avoid unaligned accesses + +Although the unaligned memory accesses are enabled, somehow i still hit +the SIGBUS: +[23496.643138] Unhandled fault: alignment fault (0x92000021) at 0x00000000b182e636 +Received signal 7 BUS_ADRALN 0000b182e636 + +Signed-off-by: Jeffy Chen +--- + third_party/cld_3/src/src/script_span/port.h | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/third_party/cld_3/src/src/script_span/port.h b/third_party/cld_3/src/src/script_span/port.h +index 2b3bc515a..1d437babf 100644 +--- a/third_party/cld_3/src/src/script_span/port.h ++++ b/third_party/cld_3/src/src/script_span/port.h +@@ -78,11 +78,23 @@ namespace CLD2 { + // + // This is a mess, but there's not much we can do about it. + ++#if 0 + #define UNALIGNED_LOAD16(_p) (*reinterpret_cast(_p)) + #define UNALIGNED_LOAD32(_p) (*reinterpret_cast(_p)) + + #define UNALIGNED_STORE16(_p, _val) (*reinterpret_cast(_p) = (_val)) + #define UNALIGNED_STORE32(_p, _val) (*reinterpret_cast(_p) = (_val)) ++#else ++inline uint32 UNALIGNED_LOAD32(const void *p) { ++ uint32 t; ++ memcpy(&t, p, sizeof t); ++ return t; ++} ++ ++inline void UNALIGNED_STORE32(void *p, uint32 v) { ++ memcpy(p, &v, sizeof v); ++} ++#endif + + // TODO(sesse): NEON supports unaligned 64-bit loads and stores. + // See if that would be more efficient on platforms supporting it, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0005-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0005-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch new file mode 100644 index 0000000000000000000000000000000000000000..af12b705a4ed2dcb61aa6a2fb9005d753884898c --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0005-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch @@ -0,0 +1,29 @@ +From 8c9eb38c01929daf2fb460ab49b18bedd86500da Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 10 Apr 2020 16:16:08 +0800 +Subject: [PATCH 05/17] media: gpu: v4l2: Use POLLIN for pending event + +The v4l-rkmpp is using eventfd to fake poll events which not supporting +POLLPRI. + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/generic_v4l2_device.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index a3fe307c8..eb756a914 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -114,7 +114,7 @@ bool GenericV4L2Device::Poll(bool poll_device, bool* event_pending) { + VPLOGF(1) << "poll() failed"; + return false; + } +- *event_pending = (pollfd != -1 && pollfds[pollfd].revents & POLLPRI); ++ *event_pending = (pollfd != -1 && pollfds[pollfd].revents & POLLIN); + return true; + } + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0006-media-capture-linux-Prefer-using-the-first-device.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0006-media-capture-linux-Prefer-using-the-first-device.patch new file mode 100644 index 0000000000000000000000000000000000000000..961e68a5caecddb8dcd6a0a28ead5ada579a0a06 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0006-media-capture-linux-Prefer-using-the-first-device.patch @@ -0,0 +1,32 @@ +From be17a4bc7b1c436c870f390c96f2b71be4cb9ff9 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 5 Nov 2020 12:22:52 +0800 +Subject: [PATCH 06/17] media: capture: linux: Prefer using the first device + +Somehow the newest chromium would prefer using the last device in some +cases, e.g. apprtc. + +Let's reverse the device array to workaround it. + +Signed-off-by: Jeffy Chen +--- + .../capture/video/linux/video_capture_device_factory_linux.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/media/capture/video/linux/video_capture_device_factory_linux.cc b/media/capture/video/linux/video_capture_device_factory_linux.cc +index 7c90f5c46..1351093ed 100644 +--- a/media/capture/video/linux/video_capture_device_factory_linux.cc ++++ b/media/capture/video/linux/video_capture_device_factory_linux.cc +@@ -197,7 +197,8 @@ void VideoCaptureDeviceFactoryLinux::GetDevicesInfo( + continue; + } + +- devices_info.emplace_back(VideoCaptureDeviceDescriptor( ++ // HACK: Somehow the newest chromium would prefer using the last device in some cases, e.g. apprtc ++ devices_info.emplace(devices_info.begin(), VideoCaptureDeviceDescriptor( + display_name, unique_id, model_id, + VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE, GetControlSupport(fd.get()), + VideoCaptureTransportType::OTHER_TRANSPORT, facing_mode)); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0007-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0007-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch new file mode 100644 index 0000000000000000000000000000000000000000..0b467324595e25b8cdd4cdbf56a791cbab5b2aa2 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0007-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch @@ -0,0 +1,67 @@ +From 74672c7bae36aad5b0e750a225846cc2cf2265a7 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 28 Sep 2020 20:02:00 +0800 +Subject: [PATCH 07/17] media: gpu: v4l2: Fix compile error when ozone not + enabled + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/BUILD.gn | 5 ++++- + media/gpu/v4l2/generic_v4l2_device.cc | 7 +++++++ + 2 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn +index 73365b306..a1da564f2 100644 +--- a/media/gpu/v4l2/BUILD.gn ++++ b/media/gpu/v4l2/BUILD.gn +@@ -105,9 +105,12 @@ source_set("v4l2") { + "//media/parsers", + "//third_party/libyuv", + "//ui/gfx/geometry", +- "//ui/ozone", + ] + ++ if (use_ozone) { ++ deps += [ "//ui/ozone" ] ++ } ++ + if (use_v4lplugin) { + deps += [ ":libv4l2_stubs" ] + } +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index eb756a914..55901af1a 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -33,8 +33,11 @@ + #include "ui/gl/egl_util.h" + #include "ui/gl/gl_bindings.h" + #include "ui/gl/gl_image_native_pixmap.h" ++ ++#if defined(USE_OZONE) + #include "ui/ozone/public/ozone_platform.h" + #include "ui/ozone/public/surface_factory_ozone.h" ++#endif + + #if BUILDFLAG(USE_LIBV4L2) + // Auto-generated for dlopen libv4l2 libraries +@@ -302,6 +305,9 @@ scoped_refptr GenericV4L2Device::CreateGLImage( + const gfx::Size& size, + const Fourcc fourcc, + gfx::NativePixmapHandle handle) const { ++#if !defined(USE_OZONE) ++ return nullptr; ++#else + DVLOGF(3); + DCHECK(CanCreateEGLImageFrom(fourcc)); + +@@ -336,6 +342,7 @@ scoped_refptr GenericV4L2Device::CreateGLImage( + bool ret = image->Initialize(std::move(pixmap)); + DCHECK(ret); + return image; ++#endif + } + + EGLBoolean GenericV4L2Device::DestroyEGLImage(EGLDisplay egl_display, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0008-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0008-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch new file mode 100644 index 0000000000000000000000000000000000000000..7176e1ba1da5e2c5fc2c8e5b57fbf7fee9e807e9 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0008-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch @@ -0,0 +1,29 @@ +From 9e82e1ad8be9cb9f0838c0e657ab1a8f04278882 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 20 May 2021 01:05:29 +0800 +Subject: [PATCH 08/17] ui: events: ozone: Define SW_PEN_INSERTED for old + kernel headers + +Signed-off-by: Jeffy Chen +--- + ui/events/ozone/evdev/event_converter_evdev_impl.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/ui/events/ozone/evdev/event_converter_evdev_impl.cc b/ui/events/ozone/evdev/event_converter_evdev_impl.cc +index 60835c6af..9ee4719f6 100644 +--- a/ui/events/ozone/evdev/event_converter_evdev_impl.cc ++++ b/ui/events/ozone/evdev/event_converter_evdev_impl.cc +@@ -31,6 +31,10 @@ namespace { + const int kKeyReleaseValue = 0; + const int kKeyRepeatValue = 2; + ++#ifndef SW_PEN_INSERTED ++#define SW_PEN_INSERTED 0x0f /* set = pen inserted */ ++#endif ++ + // Values for the EV_SW code. + const int kSwitchStylusInserted = SW_PEN_INSERTED; + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0009-Create-new-fence-when-there-s-no-in-fences.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0009-Create-new-fence-when-there-s-no-in-fences.patch new file mode 100644 index 0000000000000000000000000000000000000000..1dd8028a87a87bff71977aa774da4cb83b91e04b --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0009-Create-new-fence-when-there-s-no-in-fences.patch @@ -0,0 +1,62 @@ +From d799502fe7622c6515af60033685be456976ee7c Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 01:29:11 +0800 +Subject: [PATCH 09/17] Create new fence when there's no in-fences + +There're cases that in-fences are not provided. + +Signed-off-by: Jeffy Chen +--- + .../wayland/gpu/gbm_surfaceless_wayland.cc | 21 +++++++++++++++++-- + 1 file changed, 19 insertions(+), 2 deletions(-) + +diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +index 1bfdcd2d5..0d95037ed 100644 +--- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc ++++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +@@ -31,6 +31,12 @@ static constexpr size_t kMaxSolidColorBuffers = 12; + + static constexpr gfx::Size kSolidColorBufferSize{4, 4}; + ++void WaitForEGLFence(EGLDisplay display, EGLSyncKHR fence) { ++ eglClientWaitSyncKHR(display, fence, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, ++ EGL_FOREVER_KHR); ++ eglDestroySyncKHR(display, fence); ++} ++ + void WaitForGpuFences(std::vector> fences) { + for (auto& fence : fences) + fence->Wait(); +@@ -231,8 +237,9 @@ void GbmSurfacelessWayland::SwapBuffersAsync( + return; + } + +- base::OnceClosure fence_wait_task; + std::vector> fences; ++ // Uset in-fences provided in the overlays. If there are none, we insert our ++ // own fence and wait. + for (auto& config : frame->configs) { + if (!config.access_fence_handle.is_null()) { + fences.push_back(std::make_unique( +@@ -241,7 +248,17 @@ void GbmSurfacelessWayland::SwapBuffersAsync( + } + } + +- fence_wait_task = base::BindOnce(&WaitForGpuFences, std::move(fences)); ++ base::OnceClosure fence_wait_task; ++ if (!fences.empty()) { ++ fence_wait_task = base::BindOnce(&WaitForGpuFences, std::move(fences)); ++ } else { ++ // TODO(fangzhoug): the following should be replaced by a per surface flush ++ // as it gets implemented in GL drivers. ++ EGLSyncKHR fence = InsertFence(has_implicit_external_sync_); ++ CHECK_NE(fence, EGL_NO_SYNC_KHR) << "eglCreateSyncKHR failed"; ++ ++ fence_wait_task = base::BindOnce(&WaitForEGLFence, GetDisplay(), fence); ++ } + + base::OnceClosure fence_retired_callback = base::BindOnce( + &GbmSurfacelessWayland::FenceRetired, weak_factory_.GetWeakPtr(), frame); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0010-HACK-ozone-wayland-Force-disable-implicit-external-s.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0010-HACK-ozone-wayland-Force-disable-implicit-external-s.patch new file mode 100644 index 0000000000000000000000000000000000000000..4e0a8ad49e5fea0136e6fb6e2171ba3f037cbddf --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0010-HACK-ozone-wayland-Force-disable-implicit-external-s.patch @@ -0,0 +1,34 @@ +From 1806bb01880ce06cf8e163b750febe3d40ac5fdc Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 01:41:57 +0800 +Subject: [PATCH 10/17] HACK: [ozone/wayland]: Force disable implicit external + sync + +The Mali's implicit external sync seems broken. + +Signed-off-by: Jeffy Chen +--- + ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +index 0d95037ed..66a1bfbde 100644 +--- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc ++++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +@@ -254,10 +254,11 @@ void GbmSurfacelessWayland::SwapBuffersAsync( + } else { + // TODO(fangzhoug): the following should be replaced by a per surface flush + // as it gets implemented in GL drivers. +- EGLSyncKHR fence = InsertFence(has_implicit_external_sync_); ++ // HACK: The Mali's implicit external sync seems broken. ++ EGLSyncKHR fence = InsertFence(/* has_implicit_external_sync_ */ false); + CHECK_NE(fence, EGL_NO_SYNC_KHR) << "eglCreateSyncKHR failed"; + +- fence_wait_task = base::BindOnce(&WaitForEGLFence, GetDisplay(), fence); ++ fence_wait_task = base::BindOnce(&WaitForEGLFence, GetEGLDisplay(), fence); + } + + base::OnceClosure fence_retired_callback = base::BindOnce( +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0011-HACK-media-capture-linux-Allow-camera-without-suppor.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0011-HACK-media-capture-linux-Allow-camera-without-suppor.patch new file mode 100644 index 0000000000000000000000000000000000000000..49f6de868a29b6341aa7a48992b855f7236b9358 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0011-HACK-media-capture-linux-Allow-camera-without-suppor.patch @@ -0,0 +1,35 @@ +From c8cd9cc752b757377872bacc431e4d41ab45951c Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 07:25:58 +0800 +Subject: [PATCH 11/17] HACK: media: capture: linux: Allow camera without + supported format + +The chromium would only accept discrete frame sizes. + +Hack it to make Rockchip ISP camera working. + +Signed-off-by: Jeffy Chen +--- + .../video/linux/video_capture_device_factory_linux.cc | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/media/capture/video/linux/video_capture_device_factory_linux.cc b/media/capture/video/linux/video_capture_device_factory_linux.cc +index 1351093ed..e1320551f 100644 +--- a/media/capture/video/linux/video_capture_device_factory_linux.cc ++++ b/media/capture/video/linux/video_capture_device_factory_linux.cc +@@ -192,10 +192,8 @@ void VideoCaptureDeviceFactoryLinux::GetDevicesInfo( + + VideoCaptureFormats supported_formats; + GetSupportedFormatsForV4L2BufferType(fd.get(), &supported_formats); +- if (supported_formats.empty()) { +- DVLOG(1) << "No supported formats: " << unique_id; +- continue; +- } ++ if (supported_formats.empty()) ++ LOG(WARNING) << "No supported formats: " << unique_id; + + // HACK: Somehow the newest chromium would prefer using the last device in some cases, e.g. apprtc + devices_info.emplace(devices_info.begin(), VideoCaptureDeviceDescriptor( +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0012-content-gpu-Only-depend-dri-for-X11.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0012-content-gpu-Only-depend-dri-for-X11.patch new file mode 100644 index 0000000000000000000000000000000000000000..756f77015d2091702f773a3802bd4e12beb36f37 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0012-content-gpu-Only-depend-dri-for-X11.patch @@ -0,0 +1,26 @@ +From 2f73bce0fa6d67c219cfcdebe9d140dcf4e27fe8 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 22 Nov 2021 15:59:49 +0800 +Subject: [PATCH 12/17] content: gpu: Only depend dri for X11 + +Signed-off-by: Jeffy Chen +--- + content/gpu/BUILD.gn | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/content/gpu/BUILD.gn b/content/gpu/BUILD.gn +index 250c7712a..426330af9 100644 +--- a/content/gpu/BUILD.gn ++++ b/content/gpu/BUILD.gn +@@ -134,7 +134,7 @@ target(link_target_type, "gpu_sources") { + + # Use DRI on desktop Linux builds. + if (current_cpu != "s390x" && current_cpu != "ppc64" && is_linux && +- !is_castos) { ++ !is_castos && ozone_platform_x11) { + configs += [ "//build/config/linux/dri" ] + } + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0013-HACK-media-Disable-chromeos-direct-video-decoder-by-.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0013-HACK-media-Disable-chromeos-direct-video-decoder-by-.patch new file mode 100644 index 0000000000000000000000000000000000000000..6e07388dc3537e3e2f176fa66c559e98e90c9734 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0013-HACK-media-Disable-chromeos-direct-video-decoder-by-.patch @@ -0,0 +1,29 @@ +From a9a168fa7befcf55dbb3f2c5a62b0d25a3706128 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 16 Mar 2022 12:14:02 +0800 +Subject: [PATCH 13/17] HACK: media: Disable chromeos direct video decoder by + default + +Revisit once V4L2 video decoder is supported on linux. + +Signed-off-by: Jeffy Chen +--- + media/base/media_switches.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc +index 0362b7b70..60c69224d 100644 +--- a/media/base/media_switches.cc ++++ b/media/base/media_switches.cc +@@ -794,7 +794,7 @@ const base::Feature kUseRealColorSpaceForAndroidVideo{ + // experiment with direct VideoDecoder path on Linux Desktop. + // TODO(b/159825227): remove when the direct video decoder is fully launched. + const base::Feature kUseChromeOSDirectVideoDecoder{ +- "UseChromeOSDirectVideoDecoder", base::FEATURE_ENABLED_BY_DEFAULT}; ++ "UseChromeOSDirectVideoDecoder", base::FEATURE_DISABLED_BY_DEFAULT}; + + // Limit the number of concurrent hardware decoder instances on ChromeOS. + const base::Feature kLimitConcurrentDecoderInstances{ +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0014-page_characteristics-in-base-should-be-exported.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0014-page_characteristics-in-base-should-be-exported.patch new file mode 100644 index 0000000000000000000000000000000000000000..f5590582b9f4a2129811166f8464d5502c878f8e --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0014-page_characteristics-in-base-should-be-exported.patch @@ -0,0 +1,58 @@ +From 8ce23d5fae2f523753547c9d656aeeb29914976e Mon Sep 17 00:00:00 2001 +From: Qi Tiezheng +Date: Fri, 29 Jul 2022 14:50:19 +0000 +Subject: [PATCH 14/17] page_characteristics in base should be exported + +Cross compiling Chromium for linux arm64 may fails, +partition_alloc::internal::page_characteristics is used on arm64 +in inline function PageAllocationGranularityShift() + +[42925/82488] SOLINK ./libwtf.so +FAILED: libwtf.so libwtf.so.TOC +python3 "../../build/toolchain/gcc_solink_wrapper.py" --readelf="../../third_party/llvm-build/Release+Asserts/bin/llvm-readelf" --nm="../../third_party/llvm-build/Release+Asserts/bin/llvm-nm" --sofile="./libwtf.so" --tocfile="./libwtf.so.TOC" --output="./libwtf.so" -- ../../third_party/llvm-build/Release+Asserts/bin/clang++ -shared -Wl,-soname="libwtf.so" -Werror -fuse-ld=lld -Wl,--fatal-warnings -Wl,--build-id -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,--color-diagnostics -Wl,--no-call-graph-profile-sort --target=aarch64-linux-gnu -no-canonical-prefixes -rdynamic -Wl,-z,defs -Wl,--as-needed -nostdlib++ --sysroot=../../build/linux/debian_stretch_arm64-sysroot -Wl,-rpath=\$ORIGIN -Wl,--gdb-index -L../../build/linux/debian_stretch_arm64-sysroot/usr/lib/aarch64-linux-gnu -o "./libwtf.so" @"./libwtf.so.rsp" +ld.lld: error: undefined symbol: partition_alloc::internal::page_characteristics +>>> referenced by page_allocator_constants.h:0 (../../base/allocator/partition_allocator/page_allocator_constants.h:0) +>>> obj/third_party/blink/renderer/platform/wtf/wtf/partitions.o:(partition_alloc::internal::PageAllocationGranularity()) +>>> referenced by page_allocator_constants.h:0 (../../base/allocator/partition_allocator/page_allocator_constants.h:0) +>>> obj/third_party/blink/renderer/platform/wtf/wtf/partitions.o:(partition_alloc::internal::PageAllocationGranularity()) +>>> referenced by page_allocator_constants.h:0 (../../base/allocator/partition_allocator/page_allocator_constants.h:0) +>>> obj/third_party/blink/renderer/platform/wtf/wtf/partitions.o:(partition_alloc::internal::PageAllocationGranularity()) +>>> referenced 3 more times +clang++: error: linker command failed with exit code 1 (use -v to see invocation) +[43049/82488] ACTION //third_party/blink/renderer/bindings:generate_bindings_all(//build/toolchain/linux:clang_x64_v8_arm64) + +Bug: 1346491 +Change-Id: Ie5ce8d9cea0b3eff2303f8fe372eb2e3773e8839 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3780440 +Auto-Submit: Qi Tiezheng +Reviewed-by: Takashi Sakamoto +Commit-Queue: Benoit Lize +Reviewed-by: Benoit Lize +Cr-Commit-Position: refs/heads/main@{#1029784} +--- + base/allocator/partition_allocator/page_allocator_constants.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/base/allocator/partition_allocator/page_allocator_constants.h b/base/allocator/partition_allocator/page_allocator_constants.h +index 5ed440c3f..004dcfd96 100644 +--- a/base/allocator/partition_allocator/page_allocator_constants.h ++++ b/base/allocator/partition_allocator/page_allocator_constants.h +@@ -7,6 +7,7 @@ + + #include + ++#include "base/allocator/partition_allocator/partition_alloc_base/component_export.h" + #include "base/allocator/partition_allocator/partition_alloc_base/compiler_specific.h" + #include "build/build_config.h" + +@@ -45,6 +46,7 @@ struct PageCharacteristics { + std::atomic size; + std::atomic shift; + }; ++PA_COMPONENT_EXPORT(PARTITION_ALLOC) + extern PageCharacteristics page_characteristics; + + } // namespace partition_alloc::internal +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0015-libgav1-Enable-parser-on-arm32-as-well.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0015-libgav1-Enable-parser-on-arm32-as-well.patch new file mode 100644 index 0000000000000000000000000000000000000000..dfcefe795fb3a2c74cfd623153cf354eff626115 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0015-libgav1-Enable-parser-on-arm32-as-well.patch @@ -0,0 +1,24 @@ +From 0b84b4c2bb019a508ec2e917a43e72e61f24122a Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 6 Sep 2022 18:24:32 +0800 +Subject: [PATCH 15/17] libgav1: Enable parser on arm32 as well + +Signed-off-by: Jeffy Chen +--- + third_party/libgav1/options.gni | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/third_party/libgav1/options.gni b/third_party/libgav1/options.gni +index 5e0fe7ea3..bd6a4a572 100644 +--- a/third_party/libgav1/options.gni ++++ b/third_party/libgav1/options.gni +@@ -13,5 +13,5 @@ declare_args() { + use_libgav1_parser = + (is_chromeos || is_linux || is_win) && + (target_cpu == "x86" || target_cpu == "x64" || +- target_cpu == "arm64" || target_cpu == "ppc64") ++ target_cpu == "arm" || target_cpu == "arm64" || target_cpu == "ppc64") + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0016-media-Enable-HEVC-by-default-for-V4L2VDA.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0016-media-Enable-HEVC-by-default-for-V4L2VDA.patch new file mode 100644 index 0000000000000000000000000000000000000000..7983c80fb9d70fcc81df4c1c2f71575aff7a1318 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0016-media-Enable-HEVC-by-default-for-V4L2VDA.patch @@ -0,0 +1,123 @@ +From 46f6f7985d38fa4e54ab272f29aaf6341f0b96d0 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 9 Sep 2022 16:06:58 +0800 +Subject: [PATCH 16/17] media: Enable HEVC by default for V4L2VDA + +Signed-off-by: Jeffy Chen +--- + media/base/media_switches.cc | 2 +- + media/gpu/v4l2/v4l2_device.cc | 9 +++++++++ + media/gpu/v4l2/v4l2_vda_helpers.cc | 1 + + media/gpu/v4l2/v4l2_video_decode_accelerator.cc | 2 +- + media/gpu/v4l2/v4l2_video_decoder.cc | 3 ++- + media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc | 1 + + media/media_options.gni | 2 +- + 7 files changed, 16 insertions(+), 4 deletions(-) + +diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc +index 60c69224d..569c9691d 100644 +--- a/media/base/media_switches.cc ++++ b/media/base/media_switches.cc +@@ -270,7 +270,7 @@ const base::Feature kPictureInPicture { + #if BUILDFLAG(ENABLE_PLATFORM_HEVC) + // Enables HEVC hardware accelerated decoding. + const base::Feature kPlatformHEVCDecoderSupport{ +- "PlatformHEVCDecoderSupport", base::FEATURE_DISABLED_BY_DEFAULT}; ++ "PlatformHEVCDecoderSupport", base::FEATURE_ENABLED_BY_DEFAULT}; + #endif // BUILDFLAG(ENABLE_PLATFORM_HEVC) + + // Only decode preload=metadata elements upon visibility. +diff --git a/media/gpu/v4l2/v4l2_device.cc b/media/gpu/v4l2/v4l2_device.cc +index e0489a104..1506a0a9a 100644 +--- a/media/gpu/v4l2/v4l2_device.cc ++++ b/media/gpu/v4l2/v4l2_device.cc +@@ -1551,6 +1551,8 @@ uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + + if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { + return V4L2_PIX_FMT_H264; ++ } else if (profile >= HEVCPROFILE_MIN && profile <= HEVCPROFILE_MAX) { ++ return V4L2_PIX_FMT_HEVC; + } else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) { + return V4L2_PIX_FMT_VP8; + } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) { +@@ -1714,6 +1716,13 @@ std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + H264PROFILE_HIGH, + }; + break; ++ case V4L2_PIX_FMT_HEVC: ++ profiles = { ++ HEVCPROFILE_MAIN, ++ HEVCPROFILE_MAIN10, ++ HEVCPROFILE_MAIN_STILL_PICTURE, ++ }; ++ break; + case V4L2_PIX_FMT_VP8: + profiles = {VP8PROFILE_ANY}; + break; +diff --git a/media/gpu/v4l2/v4l2_vda_helpers.cc b/media/gpu/v4l2/v4l2_vda_helpers.cc +index f25619077..e2cb051c5 100644 +--- a/media/gpu/v4l2/v4l2_vda_helpers.cc ++++ b/media/gpu/v4l2/v4l2_vda_helpers.cc +@@ -151,6 +151,7 @@ InputBufferFragmentSplitter::CreateFromProfile( + case VideoCodec::kH264: + return std::make_unique< + v4l2_vda_helpers::H264InputBufferFragmentSplitter>(); ++ case VideoCodec::kHEVC: + case VideoCodec::kVP8: + case VideoCodec::kVP9: + // VP8/VP9 don't need any frame splitting, use the default implementation. +diff --git a/media/gpu/v4l2/v4l2_video_decode_accelerator.cc b/media/gpu/v4l2/v4l2_video_decode_accelerator.cc +index f39cc569a..51e610abb 100644 +--- a/media/gpu/v4l2/v4l2_video_decode_accelerator.cc ++++ b/media/gpu/v4l2/v4l2_video_decode_accelerator.cc +@@ -83,7 +83,7 @@ bool IsVp9KSVCStream(uint32_t input_format_fourcc, + + // static + const uint32_t V4L2VideoDecodeAccelerator::supported_input_fourccs_[] = { +- V4L2_PIX_FMT_H264, V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, ++ V4L2_PIX_FMT_H264, V4L2_PIX_FMT_HEVC, V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, + }; + + // static +diff --git a/media/gpu/v4l2/v4l2_video_decoder.cc b/media/gpu/v4l2/v4l2_video_decoder.cc +index b95d84ad1..3d002dfdd 100644 +--- a/media/gpu/v4l2/v4l2_video_decoder.cc ++++ b/media/gpu/v4l2/v4l2_video_decoder.cc +@@ -52,7 +52,8 @@ constexpr uint32_t kSupportedInputFourccs[] = { + #if !BUILDFLAG(USE_LINUX_V4L2) + V4L2_PIX_FMT_H264_SLICE, V4L2_PIX_FMT_VP8_FRAME, V4L2_PIX_FMT_VP9_FRAME, + #endif +- V4L2_PIX_FMT_H264, V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, ++ V4L2_PIX_FMT_H264, V4L2_PIX_FMT_HEVC, ++ V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, + }; + + // Number of output buffers to use for each VD stage above what's required by +diff --git a/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc b/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc +index 87d4f153d..6ab11da86 100644 +--- a/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc ++++ b/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc +@@ -731,6 +731,7 @@ bool V4L2StatefulVideoDecoderBackend::IsSupportedProfile( + if (supported_profiles_.empty()) { + constexpr uint32_t kSupportedInputFourccs[] = { + V4L2_PIX_FMT_H264, ++ V4L2_PIX_FMT_HEVC, + V4L2_PIX_FMT_VP8, + V4L2_PIX_FMT_VP9, + }; +diff --git a/media/media_options.gni b/media/media_options.gni +index b3727203d..64c91692c 100644 +--- a/media/media_options.gni ++++ b/media/media_options.gni +@@ -85,7 +85,7 @@ declare_args() { + enable_hevc_parser_and_hw_decoder = + proprietary_codecs && + (use_fuzzing_engine || use_chromeos_protected_media || is_win || is_mac || +- is_android) ++ is_android || is_linux) + } + + # Use another declare_args() to allow dependence on +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0017-media-gpu-chromeos-Define-new-formats-for-old-kernel.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0017-media-gpu-chromeos-Define-new-formats-for-old-kernel.patch new file mode 100644 index 0000000000000000000000000000000000000000..2b9cf80fc9da0618d4d75b4f72c3b16622c2e588 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_104.0.5112/0017-media-gpu-chromeos-Define-new-formats-for-old-kernel.patch @@ -0,0 +1,36 @@ +From ac208e602fb4c538ead0d02f1835e367537930c6 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 9 Sep 2022 18:54:08 +0800 +Subject: [PATCH 17/17] media: gpu: chromeos: Define new formats for old kernel + +Signed-off-by: Jeffy Chen +--- + media/gpu/chromeos/fourcc.h | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/media/gpu/chromeos/fourcc.h b/media/gpu/chromeos/fourcc.h +index c4b233ac6..ece7c1bb0 100644 +--- a/media/gpu/chromeos/fourcc.h ++++ b/media/gpu/chromeos/fourcc.h +@@ -13,6 +13,18 @@ + #include "media/gpu/media_gpu_export.h" + #include "third_party/abseil-cpp/absl/types/optional.h" + ++#ifndef V4L2_PIX_FMT_MT21C ++#define V4L2_PIX_FMT_MT21C v4l2_fourcc('M', 'T', '2', '1') /* Mediatek compressed block mode */ ++#endif ++ ++#ifndef V4L2_PIX_FMT_VP9 ++#define V4L2_PIX_FMT_VP9 v4l2_fourcc('V', 'P', '9', '0') /* VP9 */ ++#endif ++ ++#ifndef V4L2_PIX_FMT_HEVC ++#define V4L2_PIX_FMT_HEVC v4l2_fourcc('H', 'E', 'V', 'C') /* HEVC */ ++#endif ++ + namespace media { + + // Composes a Fourcc value. +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0001-Add-support-for-V4L2-VDA-and-VEA-on-Linux.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0001-Add-support-for-V4L2-VDA-and-VEA-on-Linux.patch new file mode 100644 index 0000000000000000000000000000000000000000..f8daad6f55fc766fd1b6c120364a6242578d0f0a --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0001-Add-support-for-V4L2-VDA-and-VEA-on-Linux.patch @@ -0,0 +1,449 @@ +From 6e9d3aa5e8baa7b47901ba6fd15614fb39fe7fba Mon Sep 17 00:00:00 2001 +From: Maksim Sisov +Date: Wed, 31 Jul 2019 09:56:24 +0300 +Subject: [PATCH 01/17] Add support for V4L2 VDA and VEA on Linux + +Based on: +https://github.com/OSSystems/meta-browser/pull/263/commits/60ceb28750ee1f73c9cc2bf7e9e20e1c37a03497 + +Signed-off-by: Jeffy Chen +--- + .../gpu_mjpeg_decode_accelerator_factory.cc | 3 +- + media/gpu/BUILD.gn | 1 + + media/gpu/args.gni | 3 + + .../gpu_video_decode_accelerator_factory.cc | 8 +++ + .../gpu_video_decode_accelerator_factory.h | 2 + + media/gpu/v4l2/BUILD.gn | 38 ++++++---- + media/gpu/v4l2/generic_v4l2_device.cc | 2 +- + media/gpu/v4l2/v4l2_device.cc | 70 +++++++++++++++++++ + media/gpu/v4l2/v4l2_video_decoder.cc | 7 ++ + 9 files changed, 119 insertions(+), 15 deletions(-) + +diff --git a/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc b/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc +index 3772b8ef0..dece6b77f 100644 +--- a/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc ++++ b/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc +@@ -13,7 +13,8 @@ + #include "media/base/media_switches.h" + #include "media/gpu/buildflags.h" + +-#if BUILDFLAG(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY) ++#if BUILDFLAG(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY) && \ ++ !BUILDFLAG(USE_LINUX_V4L2) + #define USE_V4L2_MJPEG_DECODE_ACCELERATOR + #endif + +diff --git a/media/gpu/BUILD.gn b/media/gpu/BUILD.gn +index 87b7f16fc..6e519acf2 100644 +--- a/media/gpu/BUILD.gn ++++ b/media/gpu/BUILD.gn +@@ -20,6 +20,7 @@ buildflag_header("buildflags") { + "USE_VAAPI_IMAGE_CODECS=$use_vaapi_image_codecs", + "USE_V4L2_CODEC=$use_v4l2_codec", + "USE_LIBV4L2=$use_v4lplugin", ++ "USE_LINUX_V4L2=$use_linux_v4l2_only", + "USE_VAAPI_X11=$use_vaapi_x11", + ] + } +diff --git a/media/gpu/args.gni b/media/gpu/args.gni +index da3ea5a5d..e2c58e366 100644 +--- a/media/gpu/args.gni ++++ b/media/gpu/args.gni +@@ -20,6 +20,9 @@ declare_args() { + # platforms which have v4l2 hardware encoder / decoder. + use_v4l2_codec = false + ++ # Indicates if Video4Linux2 codec is used for linux platform. ++ use_linux_v4l2_only = false ++ + # Indicates if Video4Linux2 AML encoder is used. This is used for AML + # platforms which have v4l2 hardware encoder + use_v4l2_codec_aml = false +diff --git a/media/gpu/gpu_video_decode_accelerator_factory.cc b/media/gpu/gpu_video_decode_accelerator_factory.cc +index 4785d49e8..d8305702a 100644 +--- a/media/gpu/gpu_video_decode_accelerator_factory.cc ++++ b/media/gpu/gpu_video_decode_accelerator_factory.cc +@@ -29,7 +29,9 @@ + #include "ui/gl/gl_implementation.h" + #elif BUILDFLAG(USE_V4L2_CODEC) + #include "media/gpu/v4l2/v4l2_device.h" ++#if !BUILDFLAG(USE_LINUX_V4L2) + #include "media/gpu/v4l2/v4l2_slice_video_decode_accelerator.h" ++#endif + #include "media/gpu/v4l2/v4l2_video_decode_accelerator.h" + #include "ui/gl/gl_surface_egl.h" + #endif +@@ -64,10 +66,12 @@ gpu::VideoDecodeAcceleratorCapabilities GetDecoderCapabilitiesInternal( + GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( + V4L2VideoDecodeAccelerator::GetSupportedProfiles(), + &capabilities.supported_profiles); ++#if !BUILDFLAG(USE_LINUX_V4L2) + GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( + V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles(), + &capabilities.supported_profiles); + #endif ++#endif + #elif BUILDFLAG(IS_MAC) + capabilities.supported_profiles = + VTVideoDecodeAccelerator::GetSupportedProfiles(workarounds); +@@ -146,8 +150,10 @@ GpuVideoDecodeAcceleratorFactory::CreateVDA( + &GpuVideoDecodeAcceleratorFactory::CreateVaapiVDA, + #elif BUILDFLAG(USE_V4L2_CODEC) + &GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA, ++#if !BUILDFLAG(USE_LINUX_V4L2) + &GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA, + #endif ++#endif + + #if BUILDFLAG(IS_MAC) + &GpuVideoDecodeAcceleratorFactory::CreateVTVDA, +@@ -207,6 +213,7 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA( + return decoder; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + std::unique_ptr + GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA( + const gpu::GpuDriverBugWorkarounds& /*workarounds*/, +@@ -222,6 +229,7 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA( + return decoder; + } + #endif ++#endif + + #if BUILDFLAG(IS_MAC) + std::unique_ptr +diff --git a/media/gpu/gpu_video_decode_accelerator_factory.h b/media/gpu/gpu_video_decode_accelerator_factory.h +index b2e1390c5..5a714eb80 100644 +--- a/media/gpu/gpu_video_decode_accelerator_factory.h ++++ b/media/gpu/gpu_video_decode_accelerator_factory.h +@@ -104,11 +104,13 @@ class MEDIA_GPU_EXPORT GpuVideoDecodeAcceleratorFactory { + const gpu::GpuDriverBugWorkarounds& workarounds, + const gpu::GpuPreferences& gpu_preferences, + MediaLog* media_log) const; ++#if !BUILDFLAG(USE_LINUX_V4L2) + std::unique_ptr CreateV4L2SliceVDA( + const gpu::GpuDriverBugWorkarounds& workarounds, + const gpu::GpuPreferences& gpu_preferences, + MediaLog* media_log) const; + #endif ++#endif + #if BUILDFLAG(IS_MAC) + std::unique_ptr CreateVTVDA( + const gpu::GpuDriverBugWorkarounds& workarounds, +diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn +index 80ebde854..0f88f7454 100644 +--- a/media/gpu/v4l2/BUILD.gn ++++ b/media/gpu/v4l2/BUILD.gn +@@ -29,9 +29,6 @@ source_set("v4l2") { + "buffer_affinity_tracker.h", + "generic_v4l2_device.cc", + "generic_v4l2_device.h", +- "v4l2_decode_surface.cc", +- "v4l2_decode_surface.h", +- "v4l2_decode_surface_handler.h", + "v4l2_device.cc", + "v4l2_device.h", + "v4l2_device_poller.cc", +@@ -40,8 +37,6 @@ source_set("v4l2") { + "v4l2_framerate_control.h", + "v4l2_image_processor_backend.cc", + "v4l2_image_processor_backend.h", +- "v4l2_slice_video_decode_accelerator.cc", +- "v4l2_slice_video_decode_accelerator.h", + "v4l2_stateful_workaround.cc", + "v4l2_stateful_workaround.h", + "v4l2_utils.cc", +@@ -56,16 +51,33 @@ source_set("v4l2") { + "v4l2_video_decoder_backend.h", + "v4l2_video_decoder_backend_stateful.cc", + "v4l2_video_decoder_backend_stateful.h", +- "v4l2_video_decoder_backend_stateless.cc", +- "v4l2_video_decoder_backend_stateless.h", +- "v4l2_video_decoder_delegate_h264.cc", +- "v4l2_video_decoder_delegate_h264.h", +- "v4l2_video_decoder_delegate_vp8.cc", +- "v4l2_video_decoder_delegate_vp8.h", +- "v4l2_video_decoder_delegate_vp9.cc", +- "v4l2_video_decoder_delegate_vp9.h", + ] + ++ if (!use_linux_v4l2_only) { ++ sources += [ ++ "v4l2_decode_surface.cc", ++ "v4l2_decode_surface.h", ++ "v4l2_decode_surface_handler.h", ++ "v4l2_slice_video_decode_accelerator.cc", ++ "v4l2_slice_video_decode_accelerator.h", ++ "v4l2_video_decoder_backend_stateless.cc", ++ "v4l2_video_decoder_backend_stateless.h", ++ "v4l2_video_decoder_delegate_h264.cc", ++ "v4l2_video_decoder_delegate_h264.h", ++ "v4l2_video_decoder_delegate_vp8.cc", ++ "v4l2_video_decoder_delegate_vp8.h", ++ "v4l2_video_decoder_delegate_vp9.cc", ++ "v4l2_video_decoder_delegate_vp9.h", ++ ] ++ } else if (!is_chromeos) { ++ # HACK(crbug.com/901264): Enable these only when data_offset hack is ++ # supported in downstream encoder. ++ sources += [ ++ "v4l2_video_encode_accelerator.cc", ++ "v4l2_video_encode_accelerator.h", ++ ] ++ } ++ + if (is_chromeos) { + sources += [ + "v4l2_video_decoder_delegate_h264_legacy.cc", +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index 475548bd7..184111288 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -441,7 +441,7 @@ bool GenericV4L2Device::OpenDevicePath(const std::string& path, Type type) { + return false; + + #if BUILDFLAG(USE_LIBV4L2) +- if (type == Type::kEncoder && ++ if (/* type == Type::kEncoder && */ + HANDLE_EINTR(v4l2_fd_open(device_fd_.get(), V4L2_DISABLE_CONVERSION)) != + -1) { + DVLOGF(3) << "Using libv4l2 for " << path; +diff --git a/media/gpu/v4l2/v4l2_device.cc b/media/gpu/v4l2/v4l2_device.cc +index d24013d2e..3669f7176 100644 +--- a/media/gpu/v4l2/v4l2_device.cc ++++ b/media/gpu/v4l2/v4l2_device.cc +@@ -1001,10 +1001,12 @@ V4L2Queue::V4L2Queue(scoped_refptr dev, + return; + } + ++#if BUILDFLAG(IS_CHROMEOS) + if (reqbufs.capabilities & V4L2_BUF_CAP_SUPPORTS_REQUESTS) { + supports_requests_ = true; + DVLOGF(4) << "Queue supports request API."; + } ++#endif + } + + V4L2Queue::~V4L2Queue() { +@@ -1146,9 +1148,13 @@ size_t V4L2Queue::AllocateBuffers(size_t count, + reqbufs.count = count; + reqbufs.type = type_; + reqbufs.memory = memory; ++#if BUILDFLAG(IS_CHROMEOS) + reqbufs.flags = incoherent ? V4L2_MEMORY_FLAG_NON_COHERENT : 0; + DVQLOGF(3) << "Requesting " << count << " buffers."; + DVQLOGF(3) << "Incoherent flag is " << incoherent << "."; ++#else ++ DVQLOGF(3) << "Requesting " << count << " buffers."; ++#endif + + int ret = device_->Ioctl(VIDIOC_REQBUFS, &reqbufs); + if (ret) { +@@ -1206,7 +1212,9 @@ bool V4L2Queue::DeallocateBuffers() { + reqbufs.count = 0; + reqbufs.type = type_; + reqbufs.memory = memory_; ++#if BUILDFLAG(IS_CHROMEOS) + reqbufs.flags = incoherent_ ? V4L2_MEMORY_FLAG_NON_COHERENT : 0; ++#endif + + int ret = device_->Ioctl(VIDIOC_REQBUFS, &reqbufs); + if (ret) { +@@ -1551,6 +1559,23 @@ std::string V4L2Device::GetDriverName() { + // static + uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + bool slice_based) { ++#if BUILDFLAG(USE_LINUX_V4L2) ++ if (slice_based) { ++ LOG(ERROR) << "Slice not supported"; ++ return 0; ++ } ++ ++ if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { ++ return V4L2_PIX_FMT_H264; ++ } else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) { ++ return V4L2_PIX_FMT_VP8; ++ } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) { ++ return V4L2_PIX_FMT_VP9; ++ } else { ++ DVLOGF(1) << "Unsupported profile: " << GetProfileName(profile); ++ return 0; ++ } ++#else + if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { + if (slice_based) + return V4L2_PIX_FMT_H264_SLICE; +@@ -1570,8 +1595,10 @@ uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + DVLOGF(1) << "Unsupported profile: " << GetProfileName(profile); + return 0; + } ++#endif + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + namespace { + + VideoCodecProfile V4L2ProfileToVideoCodecProfile(VideoCodec codec, +@@ -1618,9 +1645,11 @@ VideoCodecProfile V4L2ProfileToVideoCodecProfile(VideoCodec codec, + } + + } // namespace ++#endif + + std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + uint32_t pix_fmt) { ++#if !BUILDFLAG(USE_LINUX_V4L2) + auto get_supported_profiles = [this]( + VideoCodec codec, + std::vector* profiles) { +@@ -1691,6 +1720,27 @@ std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + VLOGF(1) << "Unhandled pixelformat " << FourccToString(pix_fmt); + return {}; + } ++#else ++ std::vector profiles; ++ switch (pix_fmt) { ++ case V4L2_PIX_FMT_H264: ++ profiles = { ++ H264PROFILE_BASELINE, ++ H264PROFILE_MAIN, ++ H264PROFILE_HIGH, ++ }; ++ break; ++ case V4L2_PIX_FMT_VP8: ++ profiles = {VP8PROFILE_ANY}; ++ break; ++ case V4L2_PIX_FMT_VP9: ++ profiles = {VP9PROFILE_PROFILE0}; ++ break; ++ default: ++ VLOGF(1) << "Unhandled pixelformat " << FourccToString(pix_fmt); ++ return {}; ++ } ++#endif + + // Erase duplicated profiles. + std::sort(profiles.begin(), profiles.end()); +@@ -2403,10 +2453,14 @@ bool V4L2Request::ApplyCtrls(struct v4l2_ext_controls* ctrls) { + return false; + } + ++#if BUILDFLAG(IS_CHROMEOS) + ctrls->which = V4L2_CTRL_WHICH_REQUEST_VAL; + ctrls->request_fd = request_fd_.get(); + + return true; ++#else ++ return false; ++#endif + } + + bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) { +@@ -2418,10 +2472,14 @@ bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) { + return false; + } + ++#if BUILDFLAG(IS_CHROMEOS) + buffer->flags |= V4L2_BUF_FLAG_REQUEST_FD; + buffer->request_fd = request_fd_.get(); + + return true; ++#else ++ return false; ++#endif + } + + bool V4L2Request::Submit() { +@@ -2432,7 +2490,11 @@ bool V4L2Request::Submit() { + return false; + } + ++#if BUILDFLAG(IS_CHROMEOS) + return HANDLE_EINTR(ioctl(request_fd_.get(), MEDIA_REQUEST_IOC_QUEUE)) == 0; ++#else ++ return false; ++#endif + } + + bool V4L2Request::IsCompleted() { +@@ -2475,6 +2537,7 @@ bool V4L2Request::Reset() { + return false; + } + ++#if BUILDFLAG(IS_CHROMEOS) + // Reinit the request to make sure we can use it for a new submission. + if (HANDLE_EINTR(ioctl(request_fd_.get(), MEDIA_REQUEST_IOC_REINIT)) < 0) { + VPLOGF(1) << "Failed to reinit request."; +@@ -2482,6 +2545,9 @@ bool V4L2Request::Reset() { + } + + return true; ++#else ++ return false; ++#endif + } + + V4L2RequestRefBase::V4L2RequestRefBase(V4L2RequestRefBase&& req_base) { +@@ -2556,6 +2622,7 @@ V4L2RequestsQueue::~V4L2RequestsQueue() { + absl::optional V4L2RequestsQueue::CreateRequestFD() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + ++#if BUILDFLAG(IS_CHROMEOS) + int request_fd; + int ret = HANDLE_EINTR( + ioctl(media_fd_.get(), MEDIA_IOC_REQUEST_ALLOC, &request_fd)); +@@ -2565,6 +2632,9 @@ absl::optional V4L2RequestsQueue::CreateRequestFD() { + } + + return base::ScopedFD(request_fd); ++#else ++ return absl::nullopt; ++#endif + } + + absl::optional V4L2RequestsQueue::GetFreeRequest() { +diff --git a/media/gpu/v4l2/v4l2_video_decoder.cc b/media/gpu/v4l2/v4l2_video_decoder.cc +index ac21ea7ce..d7cda20b4 100644 +--- a/media/gpu/v4l2/v4l2_video_decoder.cc ++++ b/media/gpu/v4l2/v4l2_video_decoder.cc +@@ -28,7 +28,10 @@ + #include "media/gpu/macros.h" + #include "media/gpu/v4l2/v4l2_status.h" + #include "media/gpu/v4l2/v4l2_video_decoder_backend_stateful.h" ++ ++#if !BUILDFLAG(USE_LINUX_V4L2) + #include "media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h" ++#endif + + namespace media { + +@@ -46,7 +49,9 @@ constexpr size_t kNumInputBuffers = 8; + + // Input format V4L2 fourccs this class supports. + constexpr uint32_t kSupportedInputFourccs[] = { ++#if !BUILDFLAG(USE_LINUX_V4L2) + V4L2_PIX_FMT_H264_SLICE, V4L2_PIX_FMT_VP8_FRAME, V4L2_PIX_FMT_VP9_FRAME, ++#endif + V4L2_PIX_FMT_H264, V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, + }; + +@@ -322,6 +327,7 @@ V4L2Status V4L2VideoDecoder::InitializeBackend() { + << " and fourcc: " << FourccToString(input_format_fourcc); + backend_ = std::make_unique( + this, device_, profile_, color_space_, decoder_task_runner_); ++#if !BUILDFLAG(USE_LINUX_V4L2) + } else { + DCHECK_EQ(preferred_api_and_format.first, kStateless); + VLOGF(1) << "Using a stateless API for profile: " +@@ -329,6 +335,7 @@ V4L2Status V4L2VideoDecoder::InitializeBackend() { + << " and fourcc: " << FourccToString(input_format_fourcc); + backend_ = std::make_unique( + this, device_, profile_, color_space_, decoder_task_runner_); ++#endif + } + + if (!backend_->Initialize()) { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0002-Add-mmap-via-libv4l-to-generic_v4l2_device.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0002-Add-mmap-via-libv4l-to-generic_v4l2_device.patch new file mode 100644 index 0000000000000000000000000000000000000000..9b894c7e8011e076a2463a9b712b68343409fb31 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0002-Add-mmap-via-libv4l-to-generic_v4l2_device.patch @@ -0,0 +1,49 @@ +From 7b685dab8b859ae74f88d6b68056c58bbf10bb0f Mon Sep 17 00:00:00 2001 +From: Damian Hobson-Garcia +Date: Wed, 21 Mar 2018 13:18:17 +0200 +Subject: [PATCH 02/17] Add mmap via libv4l to generic_v4l2_device + +Issue #437 +--- + media/gpu/v4l2/generic_v4l2_device.cc | 10 ++++++++++ + media/gpu/v4l2/v4l2.sig | 2 ++ + 2 files changed, 12 insertions(+) + +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index 184111288..ee637c196 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -124,10 +124,20 @@ void* GenericV4L2Device::Mmap(void* addr, + int flags, + unsigned int offset) { + DCHECK(device_fd_.is_valid()); ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_mmap(addr, len, prot, flags, device_fd_.get(), offset); ++#endif + return mmap(addr, len, prot, flags, device_fd_.get(), offset); + } + + void GenericV4L2Device::Munmap(void* addr, unsigned int len) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) { ++ v4l2_munmap(addr, len); ++ return; ++ } ++#endif + munmap(addr, len); + } + +diff --git a/media/gpu/v4l2/v4l2.sig b/media/gpu/v4l2/v4l2.sig +index 4269fb48d..71b5b3787 100644 +--- a/media/gpu/v4l2/v4l2.sig ++++ b/media/gpu/v4l2/v4l2.sig +@@ -8,3 +8,5 @@ + LIBV4L_PUBLIC int v4l2_close(int fd); + LIBV4L_PUBLIC int v4l2_ioctl(int fd, unsigned long int request, ...); + LIBV4L_PUBLIC int v4l2_fd_open(int fd, int v4l2_flags); ++LIBV4L_PUBLIC void *v4l2_mmap(void *start, size_t length, int prot, int flags, int fd, int64_t offset); ++LIBV4L_PUBLIC int v4l2_munmap(void *_start, size_t length); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0003-media-capture-linux-Support-libv4l2-plugins.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0003-media-capture-linux-Support-libv4l2-plugins.patch new file mode 100644 index 0000000000000000000000000000000000000000..18558ecb840695ba265a5c71ea3fc9453162e463 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0003-media-capture-linux-Support-libv4l2-plugins.patch @@ -0,0 +1,178 @@ +From be80b1e586897fcb253afa747209aa9f56d5b897 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 1 Jul 2019 10:37:35 +0800 +Subject: [PATCH 03/17] media: capture: linux: Support libv4l2 plugins + +Allow using libv4l2 plugins for linux v4l2 capture devices. + +Signed-off-by: Jeffy Chen +--- + media/capture/BUILD.gn | 14 +++++ + .../video/linux/v4l2_capture_device_impl.cc | 52 ++++++++++++++++++- + .../video/linux/v4l2_capture_device_impl.h | 11 ++++ + 3 files changed, 76 insertions(+), 1 deletion(-) + +diff --git a/media/capture/BUILD.gn b/media/capture/BUILD.gn +index 927a163d3..745c193af 100644 +--- a/media/capture/BUILD.gn ++++ b/media/capture/BUILD.gn +@@ -2,6 +2,7 @@ + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. + ++import("//build/buildflag_header.gni") + import("//build/config/chromeos/ui_mode.gni") + import("//build/config/features.gni") + import("//build/config/ui.gni") +@@ -18,6 +19,14 @@ group("capture") { + ] + } + ++buildflag_header("buildflags") { ++ header = "buildflags.h" ++ ++ flags = [ ++ "USE_LIBV4L2=$use_v4lplugin", ++ ] ++} ++ + component("capture_switches") { + defines = [ "CAPTURE_IMPLEMENTATION" ] + sources = [ +@@ -270,6 +279,11 @@ component("capture_lib") { + "video/linux/video_capture_device_linux.cc", + "video/linux/video_capture_device_linux.h", + ] ++ public_deps += [ ":buildflags" ] ++ ++ if (use_v4lplugin) { ++ deps += [ "//media/gpu/v4l2:libv4l2_stubs" ] ++ } + } + + if (is_chromeos_ash) { +diff --git a/media/capture/video/linux/v4l2_capture_device_impl.cc b/media/capture/video/linux/v4l2_capture_device_impl.cc +index c9040f5de..d05d1179e 100644 +--- a/media/capture/video/linux/v4l2_capture_device_impl.cc ++++ b/media/capture/video/linux/v4l2_capture_device_impl.cc +@@ -10,19 +10,61 @@ + #include + #include + ++#if BUILDFLAG(USE_LIBV4L2) ++// Auto-generated for dlopen libv4l2 libraries ++#include "media/gpu/v4l2/v4l2_stubs.h" ++#include "third_party/v4l-utils/lib/include/libv4l2.h" ++ ++#include "base/files/file_path.h" ++ ++using media_gpu_v4l2::kModuleV4l2; ++using media_gpu_v4l2::InitializeStubs; ++using media_gpu_v4l2::StubPathMap; ++ ++static const base::FilePath::CharType kV4l2Lib[] = ++ FILE_PATH_LITERAL("/usr/lib/libv4l2.so"); ++#endif ++ + namespace media { + + V4L2CaptureDeviceImpl::~V4L2CaptureDeviceImpl() = default; + ++V4L2CaptureDeviceImpl::V4L2CaptureDeviceImpl() { ++#if BUILDFLAG(USE_LIBV4L2) ++ StubPathMap paths; ++ paths[kModuleV4l2].push_back(kV4l2Lib); ++ ++ has_libv4l2_ = InitializeStubs(paths); ++#endif ++} ++ + int V4L2CaptureDeviceImpl::open(const char* device_name, int flags) { +- return ::open(device_name, flags); ++ int fd = ::open64(device_name, flags); ++ if (fd < 0) ++ return fd; ++ ++#if BUILDFLAG(USE_LIBV4L2) ++ use_libv4l2_ = false; ++ if (has_libv4l2_ && v4l2_fd_open(fd, V4L2_DISABLE_CONVERSION) != -1) { ++ use_libv4l2_ = true; ++ } ++#endif ++ return fd; + } + + int V4L2CaptureDeviceImpl::close(int fd) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_close(fd); ++#endif + return ::close(fd); + } + + int V4L2CaptureDeviceImpl::ioctl(int fd, int request, void* argp) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_ioctl(fd, request, argp); ++#endif + return ::ioctl(fd, request, argp); + } + +@@ -32,10 +74,18 @@ void* V4L2CaptureDeviceImpl::mmap(void* start, + int flags, + int fd, + off_t offset) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_mmap(start, length, prot, flags, fd, offset); ++#endif + return ::mmap(start, length, prot, flags, fd, offset); + } + + int V4L2CaptureDeviceImpl::munmap(void* start, size_t length) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_munmap(start, length); ++#endif + return ::munmap(start, length); + } + +diff --git a/media/capture/video/linux/v4l2_capture_device_impl.h b/media/capture/video/linux/v4l2_capture_device_impl.h +index 936c8b093..f96c2d434 100644 +--- a/media/capture/video/linux/v4l2_capture_device_impl.h ++++ b/media/capture/video/linux/v4l2_capture_device_impl.h +@@ -8,6 +8,7 @@ + #include + #include + ++#include "media/capture/buildflags.h" + #include "media/capture/capture_export.h" + #include "media/capture/video/linux/v4l2_capture_device.h" + +@@ -17,6 +18,8 @@ namespace media { + // V4L2 APIs. + class CAPTURE_EXPORT V4L2CaptureDeviceImpl : public V4L2CaptureDevice { + public: ++ V4L2CaptureDeviceImpl(); ++ + int open(const char* device_name, int flags) override; + int close(int fd) override; + int ioctl(int fd, int request, void* argp) override; +@@ -32,6 +35,14 @@ class CAPTURE_EXPORT V4L2CaptureDeviceImpl : public V4L2CaptureDevice { + + private: + ~V4L2CaptureDeviceImpl() override; ++ ++#if BUILDFLAG(USE_LIBV4L2) ++ // Has libv4l2. ++ bool has_libv4l2_; ++ // Use libv4l2 when operating |fd|. ++ bool use_libv4l2_; ++#endif ++ + }; + + } // namespace media +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0004-cld3-Avoid-unaligned-accesses.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0004-cld3-Avoid-unaligned-accesses.patch new file mode 100644 index 0000000000000000000000000000000000000000..9f59b728f89fe73353ae6a0f996b2b7aeff6e8f1 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0004-cld3-Avoid-unaligned-accesses.patch @@ -0,0 +1,46 @@ +From 22e3ad63ed5ccebb3af8cada32a0b6b39cb8b2bc Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 27 Mar 2020 17:48:20 +0800 +Subject: [PATCH 04/17] cld3: Avoid unaligned accesses + +Although the unaligned memory accesses are enabled, somehow i still hit +the SIGBUS: +[23496.643138] Unhandled fault: alignment fault (0x92000021) at 0x00000000b182e636 +Received signal 7 BUS_ADRALN 0000b182e636 + +Signed-off-by: Jeffy Chen +--- + third_party/cld_3/src/src/script_span/port.h | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/third_party/cld_3/src/src/script_span/port.h b/third_party/cld_3/src/src/script_span/port.h +index 2b3bc515a..1d437babf 100644 +--- a/third_party/cld_3/src/src/script_span/port.h ++++ b/third_party/cld_3/src/src/script_span/port.h +@@ -78,11 +78,23 @@ namespace CLD2 { + // + // This is a mess, but there's not much we can do about it. + ++#if 0 + #define UNALIGNED_LOAD16(_p) (*reinterpret_cast(_p)) + #define UNALIGNED_LOAD32(_p) (*reinterpret_cast(_p)) + + #define UNALIGNED_STORE16(_p, _val) (*reinterpret_cast(_p) = (_val)) + #define UNALIGNED_STORE32(_p, _val) (*reinterpret_cast(_p) = (_val)) ++#else ++inline uint32 UNALIGNED_LOAD32(const void *p) { ++ uint32 t; ++ memcpy(&t, p, sizeof t); ++ return t; ++} ++ ++inline void UNALIGNED_STORE32(void *p, uint32 v) { ++ memcpy(p, &v, sizeof v); ++} ++#endif + + // TODO(sesse): NEON supports unaligned 64-bit loads and stores. + // See if that would be more efficient on platforms supporting it, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0005-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0005-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch new file mode 100644 index 0000000000000000000000000000000000000000..789d7cd9d1d2f24daa0cc5011c7457129137fc9b --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0005-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch @@ -0,0 +1,29 @@ +From 12313d81393f2dc0d1b1f46343e729786decb450 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 10 Apr 2020 16:16:08 +0800 +Subject: [PATCH 05/17] media: gpu: v4l2: Use POLLIN for pending event + +The v4l-rkmpp is using eventfd to fake poll events which not supporting +POLLPRI. + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/generic_v4l2_device.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index ee637c196..61c003ba6 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -114,7 +114,7 @@ bool GenericV4L2Device::Poll(bool poll_device, bool* event_pending) { + VPLOGF(1) << "poll() failed"; + return false; + } +- *event_pending = (pollfd != -1 && pollfds[pollfd].revents & POLLPRI); ++ *event_pending = (pollfd != -1 && pollfds[pollfd].revents & POLLIN); + return true; + } + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0006-media-capture-linux-Prefer-using-the-first-device.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0006-media-capture-linux-Prefer-using-the-first-device.patch new file mode 100644 index 0000000000000000000000000000000000000000..030495383738d089b66fb92d7a65e2321dad1405 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0006-media-capture-linux-Prefer-using-the-first-device.patch @@ -0,0 +1,32 @@ +From b5591b1eb0cb0753cae43fc88ff463f203ecfb42 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 5 Nov 2020 12:22:52 +0800 +Subject: [PATCH 06/17] media: capture: linux: Prefer using the first device + +Somehow the newest chromium would prefer using the last device in some +cases, e.g. apprtc. + +Let's reverse the device array to workaround it. + +Signed-off-by: Jeffy Chen +--- + .../capture/video/linux/video_capture_device_factory_linux.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/media/capture/video/linux/video_capture_device_factory_linux.cc b/media/capture/video/linux/video_capture_device_factory_linux.cc +index 7c90f5c46..1351093ed 100644 +--- a/media/capture/video/linux/video_capture_device_factory_linux.cc ++++ b/media/capture/video/linux/video_capture_device_factory_linux.cc +@@ -197,7 +197,8 @@ void VideoCaptureDeviceFactoryLinux::GetDevicesInfo( + continue; + } + +- devices_info.emplace_back(VideoCaptureDeviceDescriptor( ++ // HACK: Somehow the newest chromium would prefer using the last device in some cases, e.g. apprtc ++ devices_info.emplace(devices_info.begin(), VideoCaptureDeviceDescriptor( + display_name, unique_id, model_id, + VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE, GetControlSupport(fd.get()), + VideoCaptureTransportType::OTHER_TRANSPORT, facing_mode)); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0007-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0007-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch new file mode 100644 index 0000000000000000000000000000000000000000..a5baa1e428a4ae6aeb04d34ab889b6f6d9e4f755 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0007-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch @@ -0,0 +1,67 @@ +From 556b8e10e159147916e5f27d4a968d029e6a9f6c Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 28 Sep 2020 20:02:00 +0800 +Subject: [PATCH 07/17] media: gpu: v4l2: Fix compile error when ozone not + enabled + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/BUILD.gn | 5 ++++- + media/gpu/v4l2/generic_v4l2_device.cc | 7 +++++++ + 2 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn +index 0f88f7454..12a281267 100644 +--- a/media/gpu/v4l2/BUILD.gn ++++ b/media/gpu/v4l2/BUILD.gn +@@ -123,9 +123,12 @@ source_set("v4l2") { + "//media/parsers", + "//third_party/libyuv", + "//ui/gfx/geometry", +- "//ui/ozone", + ] + ++ if (use_ozone) { ++ deps += [ "//ui/ozone" ] ++ } ++ + if (use_v4lplugin) { + deps += [ ":libv4l2_stubs" ] + } +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index 61c003ba6..fa909064e 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -33,8 +33,11 @@ + #include "ui/gl/egl_util.h" + #include "ui/gl/gl_bindings.h" + #include "ui/gl/gl_image_native_pixmap.h" ++ ++#if defined(USE_OZONE) + #include "ui/ozone/public/ozone_platform.h" + #include "ui/ozone/public/surface_factory_ozone.h" ++#endif + + #if BUILDFLAG(USE_LIBV4L2) + // Auto-generated for dlopen libv4l2 libraries +@@ -302,6 +305,9 @@ scoped_refptr GenericV4L2Device::CreateGLImage( + const gfx::Size& size, + const Fourcc fourcc, + gfx::NativePixmapHandle handle) const { ++#if !defined(USE_OZONE) ++ return nullptr; ++#else + DVLOGF(3); + DCHECK(CanCreateEGLImageFrom(fourcc)); + +@@ -337,6 +343,7 @@ scoped_refptr GenericV4L2Device::CreateGLImage( + bool ret = image->Initialize(std::move(pixmap)); + DCHECK(ret); + return image; ++#endif + } + + EGLBoolean GenericV4L2Device::DestroyEGLImage(EGLDisplay egl_display, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0008-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0008-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch new file mode 100644 index 0000000000000000000000000000000000000000..658c95c73ddafc7ce97ed4b5fd9b89ccba7821ef --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0008-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch @@ -0,0 +1,29 @@ +From 20e3b7d094e2bb1b62081cd529ea0e124071f994 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 20 May 2021 01:05:29 +0800 +Subject: [PATCH 08/17] ui: events: ozone: Define SW_PEN_INSERTED for old + kernel headers + +Signed-off-by: Jeffy Chen +--- + ui/events/ozone/evdev/event_converter_evdev_impl.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/ui/events/ozone/evdev/event_converter_evdev_impl.cc b/ui/events/ozone/evdev/event_converter_evdev_impl.cc +index 60835c6af..9ee4719f6 100644 +--- a/ui/events/ozone/evdev/event_converter_evdev_impl.cc ++++ b/ui/events/ozone/evdev/event_converter_evdev_impl.cc +@@ -31,6 +31,10 @@ namespace { + const int kKeyReleaseValue = 0; + const int kKeyRepeatValue = 2; + ++#ifndef SW_PEN_INSERTED ++#define SW_PEN_INSERTED 0x0f /* set = pen inserted */ ++#endif ++ + // Values for the EV_SW code. + const int kSwitchStylusInserted = SW_PEN_INSERTED; + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0009-Create-new-fence-when-there-s-no-in-fences.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0009-Create-new-fence-when-there-s-no-in-fences.patch new file mode 100644 index 0000000000000000000000000000000000000000..64aaa35d23719a0cffe0075981a9cf3a2a8f114e --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0009-Create-new-fence-when-there-s-no-in-fences.patch @@ -0,0 +1,62 @@ +From da52ffb8a42e5b24682cd475cb6631239918d2c2 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 01:29:11 +0800 +Subject: [PATCH 09/17] Create new fence when there's no in-fences + +There're cases that in-fences are not provided. + +Signed-off-by: Jeffy Chen +--- + .../wayland/gpu/gbm_surfaceless_wayland.cc | 21 +++++++++++++++++-- + 1 file changed, 19 insertions(+), 2 deletions(-) + +diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +index 1bfdcd2d5..0d95037ed 100644 +--- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc ++++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +@@ -31,6 +31,12 @@ static constexpr size_t kMaxSolidColorBuffers = 12; + + static constexpr gfx::Size kSolidColorBufferSize{4, 4}; + ++void WaitForEGLFence(EGLDisplay display, EGLSyncKHR fence) { ++ eglClientWaitSyncKHR(display, fence, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, ++ EGL_FOREVER_KHR); ++ eglDestroySyncKHR(display, fence); ++} ++ + void WaitForGpuFences(std::vector> fences) { + for (auto& fence : fences) + fence->Wait(); +@@ -231,8 +237,9 @@ void GbmSurfacelessWayland::SwapBuffersAsync( + return; + } + +- base::OnceClosure fence_wait_task; + std::vector> fences; ++ // Uset in-fences provided in the overlays. If there are none, we insert our ++ // own fence and wait. + for (auto& config : frame->configs) { + if (!config.access_fence_handle.is_null()) { + fences.push_back(std::make_unique( +@@ -241,7 +248,17 @@ void GbmSurfacelessWayland::SwapBuffersAsync( + } + } + +- fence_wait_task = base::BindOnce(&WaitForGpuFences, std::move(fences)); ++ base::OnceClosure fence_wait_task; ++ if (!fences.empty()) { ++ fence_wait_task = base::BindOnce(&WaitForGpuFences, std::move(fences)); ++ } else { ++ // TODO(fangzhoug): the following should be replaced by a per surface flush ++ // as it gets implemented in GL drivers. ++ EGLSyncKHR fence = InsertFence(has_implicit_external_sync_); ++ CHECK_NE(fence, EGL_NO_SYNC_KHR) << "eglCreateSyncKHR failed"; ++ ++ fence_wait_task = base::BindOnce(&WaitForEGLFence, GetDisplay(), fence); ++ } + + base::OnceClosure fence_retired_callback = base::BindOnce( + &GbmSurfacelessWayland::FenceRetired, weak_factory_.GetWeakPtr(), frame); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0010-HACK-ozone-wayland-Force-disable-implicit-external-s.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0010-HACK-ozone-wayland-Force-disable-implicit-external-s.patch new file mode 100644 index 0000000000000000000000000000000000000000..1b0f9cda356dc144ea2bec04c94161158026c27b --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0010-HACK-ozone-wayland-Force-disable-implicit-external-s.patch @@ -0,0 +1,34 @@ +From 09f3e2a8f328d86d8177eea93556147cabc8683b Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 01:41:57 +0800 +Subject: [PATCH 10/17] HACK: [ozone/wayland]: Force disable implicit external + sync + +The Mali's implicit external sync seems broken. + +Signed-off-by: Jeffy Chen +--- + ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +index 0d95037ed..66a1bfbde 100644 +--- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc ++++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +@@ -254,10 +254,11 @@ void GbmSurfacelessWayland::SwapBuffersAsync( + } else { + // TODO(fangzhoug): the following should be replaced by a per surface flush + // as it gets implemented in GL drivers. +- EGLSyncKHR fence = InsertFence(has_implicit_external_sync_); ++ // HACK: The Mali's implicit external sync seems broken. ++ EGLSyncKHR fence = InsertFence(/* has_implicit_external_sync_ */ false); + CHECK_NE(fence, EGL_NO_SYNC_KHR) << "eglCreateSyncKHR failed"; + +- fence_wait_task = base::BindOnce(&WaitForEGLFence, GetDisplay(), fence); ++ fence_wait_task = base::BindOnce(&WaitForEGLFence, GetEGLDisplay(), fence); + } + + base::OnceClosure fence_retired_callback = base::BindOnce( +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0011-HACK-media-capture-linux-Allow-camera-without-suppor.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0011-HACK-media-capture-linux-Allow-camera-without-suppor.patch new file mode 100644 index 0000000000000000000000000000000000000000..f4db4fc1c443c9d419aa3ed36af9ebf4263b27e5 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0011-HACK-media-capture-linux-Allow-camera-without-suppor.patch @@ -0,0 +1,35 @@ +From 018b543202b02aaa2659b3f242a3772156be7a26 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 07:25:58 +0800 +Subject: [PATCH 11/17] HACK: media: capture: linux: Allow camera without + supported format + +The chromium would only accept discrete frame sizes. + +Hack it to make Rockchip ISP camera working. + +Signed-off-by: Jeffy Chen +--- + .../video/linux/video_capture_device_factory_linux.cc | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/media/capture/video/linux/video_capture_device_factory_linux.cc b/media/capture/video/linux/video_capture_device_factory_linux.cc +index 1351093ed..e1320551f 100644 +--- a/media/capture/video/linux/video_capture_device_factory_linux.cc ++++ b/media/capture/video/linux/video_capture_device_factory_linux.cc +@@ -192,10 +192,8 @@ void VideoCaptureDeviceFactoryLinux::GetDevicesInfo( + + VideoCaptureFormats supported_formats; + GetSupportedFormatsForV4L2BufferType(fd.get(), &supported_formats); +- if (supported_formats.empty()) { +- DVLOG(1) << "No supported formats: " << unique_id; +- continue; +- } ++ if (supported_formats.empty()) ++ LOG(WARNING) << "No supported formats: " << unique_id; + + // HACK: Somehow the newest chromium would prefer using the last device in some cases, e.g. apprtc + devices_info.emplace(devices_info.begin(), VideoCaptureDeviceDescriptor( +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0012-content-gpu-Only-depend-dri-for-X11.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0012-content-gpu-Only-depend-dri-for-X11.patch new file mode 100644 index 0000000000000000000000000000000000000000..84a1949a9291f91a38253629e62a58c1fba7339b --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0012-content-gpu-Only-depend-dri-for-X11.patch @@ -0,0 +1,26 @@ +From 54a0607021f8292c956a2393a8e27bddc156fce2 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 22 Nov 2021 15:59:49 +0800 +Subject: [PATCH 12/17] content: gpu: Only depend dri for X11 + +Signed-off-by: Jeffy Chen +--- + content/gpu/BUILD.gn | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/content/gpu/BUILD.gn b/content/gpu/BUILD.gn +index 250c7712a..426330af9 100644 +--- a/content/gpu/BUILD.gn ++++ b/content/gpu/BUILD.gn +@@ -134,7 +134,7 @@ target(link_target_type, "gpu_sources") { + + # Use DRI on desktop Linux builds. + if (current_cpu != "s390x" && current_cpu != "ppc64" && is_linux && +- !is_castos) { ++ !is_castos && ozone_platform_x11) { + configs += [ "//build/config/linux/dri" ] + } + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0013-HACK-media-Disable-chromeos-direct-video-decoder-by-.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0013-HACK-media-Disable-chromeos-direct-video-decoder-by-.patch new file mode 100644 index 0000000000000000000000000000000000000000..9ad3fb0e506af3077f1a9d35606df6503b0e4d6a --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0013-HACK-media-Disable-chromeos-direct-video-decoder-by-.patch @@ -0,0 +1,29 @@ +From 2798f915b0992ed928e9a9a08a78387b4621e793 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 16 Mar 2022 12:14:02 +0800 +Subject: [PATCH 13/17] HACK: media: Disable chromeos direct video decoder by + default + +Revisit once V4L2 video decoder is supported on linux. + +Signed-off-by: Jeffy Chen +--- + media/base/media_switches.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc +index 58f745ee2..74b2379ff 100644 +--- a/media/base/media_switches.cc ++++ b/media/base/media_switches.cc +@@ -809,7 +809,7 @@ const base::Feature kChromeOSHWVBREncoding{"ChromeOSHWVBREncoding", + // experiment with direct VideoDecoder path on Linux Desktop. + // TODO(b/159825227): remove when the direct video decoder is fully launched. + const base::Feature kUseChromeOSDirectVideoDecoder{ +- "UseChromeOSDirectVideoDecoder", base::FEATURE_ENABLED_BY_DEFAULT}; ++ "UseChromeOSDirectVideoDecoder", base::FEATURE_DISABLED_BY_DEFAULT}; + + // Limit the number of concurrent hardware decoder instances on ChromeOS. + const base::Feature kLimitConcurrentDecoderInstances{ +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0014-libgav1-Enable-parser-on-arm32-as-well.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0014-libgav1-Enable-parser-on-arm32-as-well.patch new file mode 100644 index 0000000000000000000000000000000000000000..7ac7a41911c48f29a2330135c501346396f44b32 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0014-libgav1-Enable-parser-on-arm32-as-well.patch @@ -0,0 +1,24 @@ +From 33a1bf159037a7ba9ff0d099641029f277ce1d9b Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 6 Sep 2022 18:24:32 +0800 +Subject: [PATCH 14/17] libgav1: Enable parser on arm32 as well + +Signed-off-by: Jeffy Chen +--- + third_party/libgav1/options.gni | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/third_party/libgav1/options.gni b/third_party/libgav1/options.gni +index 5e0fe7ea3..bd6a4a572 100644 +--- a/third_party/libgav1/options.gni ++++ b/third_party/libgav1/options.gni +@@ -13,5 +13,5 @@ declare_args() { + use_libgav1_parser = + (is_chromeos || is_linux || is_win) && + (target_cpu == "x86" || target_cpu == "x64" || +- target_cpu == "arm64" || target_cpu == "ppc64") ++ target_cpu == "arm" || target_cpu == "arm64" || target_cpu == "ppc64") + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0015-media-Enable-HEVC-by-default-for-V4L2VDA.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0015-media-Enable-HEVC-by-default-for-V4L2VDA.patch new file mode 100644 index 0000000000000000000000000000000000000000..14dee96b3232f13d43c0d815da333e8499f35efc --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0015-media-Enable-HEVC-by-default-for-V4L2VDA.patch @@ -0,0 +1,123 @@ +From 5b94ed32a369c19d7069d1d1e897ca151cd27606 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 9 Sep 2022 16:06:58 +0800 +Subject: [PATCH 15/17] media: Enable HEVC by default for V4L2VDA + +Signed-off-by: Jeffy Chen +--- + media/base/media_switches.cc | 2 +- + media/gpu/v4l2/v4l2_device.cc | 9 +++++++++ + media/gpu/v4l2/v4l2_vda_helpers.cc | 1 + + media/gpu/v4l2/v4l2_video_decode_accelerator.cc | 2 +- + media/gpu/v4l2/v4l2_video_decoder.cc | 3 ++- + media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc | 1 + + media/media_options.gni | 2 +- + 7 files changed, 16 insertions(+), 4 deletions(-) + +diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc +index 74b2379ff..880d284c7 100644 +--- a/media/base/media_switches.cc ++++ b/media/base/media_switches.cc +@@ -275,7 +275,7 @@ const base::Feature kPictureInPicture{"PictureInPicture", + #if BUILDFLAG(ENABLE_PLATFORM_HEVC) + // Enables HEVC hardware accelerated decoding. + const base::Feature kPlatformHEVCDecoderSupport{ +- "PlatformHEVCDecoderSupport", base::FEATURE_DISABLED_BY_DEFAULT}; ++ "PlatformHEVCDecoderSupport", base::FEATURE_ENABLED_BY_DEFAULT}; + #endif // BUILDFLAG(ENABLE_PLATFORM_HEVC) + + // Only decode preload=metadata elements upon visibility. +diff --git a/media/gpu/v4l2/v4l2_device.cc b/media/gpu/v4l2/v4l2_device.cc +index 3669f7176..ab227a954 100644 +--- a/media/gpu/v4l2/v4l2_device.cc ++++ b/media/gpu/v4l2/v4l2_device.cc +@@ -1567,6 +1567,8 @@ uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + + if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { + return V4L2_PIX_FMT_H264; ++ } else if (profile >= HEVCPROFILE_MIN && profile <= HEVCPROFILE_MAX) { ++ return V4L2_PIX_FMT_HEVC; + } else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) { + return V4L2_PIX_FMT_VP8; + } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) { +@@ -1730,6 +1732,13 @@ std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + H264PROFILE_HIGH, + }; + break; ++ case V4L2_PIX_FMT_HEVC: ++ profiles = { ++ HEVCPROFILE_MAIN, ++ HEVCPROFILE_MAIN10, ++ HEVCPROFILE_MAIN_STILL_PICTURE, ++ }; ++ break; + case V4L2_PIX_FMT_VP8: + profiles = {VP8PROFILE_ANY}; + break; +diff --git a/media/gpu/v4l2/v4l2_vda_helpers.cc b/media/gpu/v4l2/v4l2_vda_helpers.cc +index f25619077..e2cb051c5 100644 +--- a/media/gpu/v4l2/v4l2_vda_helpers.cc ++++ b/media/gpu/v4l2/v4l2_vda_helpers.cc +@@ -151,6 +151,7 @@ InputBufferFragmentSplitter::CreateFromProfile( + case VideoCodec::kH264: + return std::make_unique< + v4l2_vda_helpers::H264InputBufferFragmentSplitter>(); ++ case VideoCodec::kHEVC: + case VideoCodec::kVP8: + case VideoCodec::kVP9: + // VP8/VP9 don't need any frame splitting, use the default implementation. +diff --git a/media/gpu/v4l2/v4l2_video_decode_accelerator.cc b/media/gpu/v4l2/v4l2_video_decode_accelerator.cc +index c54c7356d..c1db336de 100644 +--- a/media/gpu/v4l2/v4l2_video_decode_accelerator.cc ++++ b/media/gpu/v4l2/v4l2_video_decode_accelerator.cc +@@ -86,7 +86,7 @@ bool IsVp9KSVCStream(uint32_t input_format_fourcc, + + // static + const uint32_t V4L2VideoDecodeAccelerator::supported_input_fourccs_[] = { +- V4L2_PIX_FMT_H264, V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, ++ V4L2_PIX_FMT_H264, V4L2_PIX_FMT_HEVC, V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, + }; + + // static +diff --git a/media/gpu/v4l2/v4l2_video_decoder.cc b/media/gpu/v4l2/v4l2_video_decoder.cc +index d7cda20b4..8d8487cfa 100644 +--- a/media/gpu/v4l2/v4l2_video_decoder.cc ++++ b/media/gpu/v4l2/v4l2_video_decoder.cc +@@ -52,7 +52,8 @@ constexpr uint32_t kSupportedInputFourccs[] = { + #if !BUILDFLAG(USE_LINUX_V4L2) + V4L2_PIX_FMT_H264_SLICE, V4L2_PIX_FMT_VP8_FRAME, V4L2_PIX_FMT_VP9_FRAME, + #endif +- V4L2_PIX_FMT_H264, V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, ++ V4L2_PIX_FMT_H264, V4L2_PIX_FMT_HEVC, ++ V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, + }; + + // Number of output buffers to use for each VD stage above what's required by +diff --git a/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc b/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc +index 87d4f153d..6ab11da86 100644 +--- a/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc ++++ b/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc +@@ -731,6 +731,7 @@ bool V4L2StatefulVideoDecoderBackend::IsSupportedProfile( + if (supported_profiles_.empty()) { + constexpr uint32_t kSupportedInputFourccs[] = { + V4L2_PIX_FMT_H264, ++ V4L2_PIX_FMT_HEVC, + V4L2_PIX_FMT_VP8, + V4L2_PIX_FMT_VP9, + }; +diff --git a/media/media_options.gni b/media/media_options.gni +index 3349dda85..92d8c84ca 100644 +--- a/media/media_options.gni ++++ b/media/media_options.gni +@@ -99,7 +99,7 @@ declare_args() { + enable_hevc_parser_and_hw_decoder = + proprietary_codecs && + (use_fuzzing_engine || use_chromeos_protected_media || is_win || is_mac || +- is_android) ++ is_android || is_linux) + } + + # Use another declare_args() to allow dependence on +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0016-media-gpu-chromeos-Define-new-formats-for-old-kernel.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0016-media-gpu-chromeos-Define-new-formats-for-old-kernel.patch new file mode 100644 index 0000000000000000000000000000000000000000..a1f10e2bfdbeff5ea252496b682d3974c2bcf87c --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0016-media-gpu-chromeos-Define-new-formats-for-old-kernel.patch @@ -0,0 +1,36 @@ +From 3b50d28ad2599bde3dda9fae1622ff3c56b857e3 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 9 Sep 2022 18:54:08 +0800 +Subject: [PATCH 16/17] media: gpu: chromeos: Define new formats for old kernel + +Signed-off-by: Jeffy Chen +--- + media/gpu/chromeos/fourcc.h | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/media/gpu/chromeos/fourcc.h b/media/gpu/chromeos/fourcc.h +index c4b233ac6..ece7c1bb0 100644 +--- a/media/gpu/chromeos/fourcc.h ++++ b/media/gpu/chromeos/fourcc.h +@@ -13,6 +13,18 @@ + #include "media/gpu/media_gpu_export.h" + #include "third_party/abseil-cpp/absl/types/optional.h" + ++#ifndef V4L2_PIX_FMT_MT21C ++#define V4L2_PIX_FMT_MT21C v4l2_fourcc('M', 'T', '2', '1') /* Mediatek compressed block mode */ ++#endif ++ ++#ifndef V4L2_PIX_FMT_VP9 ++#define V4L2_PIX_FMT_VP9 v4l2_fourcc('V', 'P', '9', '0') /* VP9 */ ++#endif ++ ++#ifndef V4L2_PIX_FMT_HEVC ++#define V4L2_PIX_FMT_HEVC v4l2_fourcc('H', 'E', 'V', 'C') /* HEVC */ ++#endif ++ + namespace media { + + // Composes a Fourcc value. +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0017-abseil-cpp-Map-the-absl-is_trivially_-functions-to-t.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0017-abseil-cpp-Map-the-absl-is_trivially_-functions-to-t.patch new file mode 100644 index 0000000000000000000000000000000000000000..6938820396c90f6805a06b58a0c7b2f2084658e0 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0017-abseil-cpp-Map-the-absl-is_trivially_-functions-to-t.patch @@ -0,0 +1,136 @@ +From 70614679dae1cc4a157248c7c3302c7059dd327d Mon Sep 17 00:00:00 2001 +From: Abseil Team +Date: Fri, 5 Aug 2022 06:56:05 -0700 +Subject: [PATCH 17/17] abseil-cpp: Map the absl::is_trivially_* functions to + their std impl + +There's no point redefining these functions if they are supported by the compiler and the version of libstdc++. Also, some of the builtins used by the absl implementation of these functions (e.g. __has_trivial_destructor) have been deprecated in Clang 15. + +PiperOrigin-RevId: 465554125 +Change-Id: I8674c3a5270ce3c654cdf58ae7dbd9d2bda8faa5 +(cherry picked from commit cfe27e79cfcbefb2b4479e04f80cbb299bc46965) + +Signed-off-by: Jeffy Chen +--- + third_party/abseil-cpp/absl/base/config.h | 11 ++++++++++ + .../abseil-cpp/absl/meta/type_traits.h | 22 +++++++++++++++++++ + .../abseil-cpp/absl/meta/type_traits_test.cc | 1 + + 3 files changed, 34 insertions(+) + +diff --git a/third_party/abseil-cpp/absl/base/config.h b/third_party/abseil-cpp/absl/base/config.h +index 94f7fcb5d..2faed85a8 100644 +--- a/third_party/abseil-cpp/absl/base/config.h ++++ b/third_party/abseil-cpp/absl/base/config.h +@@ -273,6 +273,17 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || + #define ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE 1 + #endif + ++// ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE ++// ++// Checks whether `std::is_trivially_copyable` is supported. ++// ++// Notes: Clang 15+ with libc++ supports these features, GCC hasn't been tested. ++#if defined(ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE) ++#error ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE cannot be directly set ++#elif defined(__clang__) && (__clang_major__ >= 15) ++#define ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE 1 ++#endif ++ + // ABSL_HAVE_THREAD_LOCAL + // + // Checks whether C++11's `thread_local` storage duration specifier is +diff --git a/third_party/abseil-cpp/absl/meta/type_traits.h b/third_party/abseil-cpp/absl/meta/type_traits.h +index d886cb30a..46b769069 100644 +--- a/third_party/abseil-cpp/absl/meta/type_traits.h ++++ b/third_party/abseil-cpp/absl/meta/type_traits.h +@@ -298,8 +298,12 @@ struct is_function + // https://gcc.gnu.org/onlinedocs/gcc/Type-Traits.html#Type-Traits. + template + struct is_trivially_destructible ++#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE ++ : std::is_trivially_destructible { ++#else + : std::integral_constant::value> { ++#endif + #ifdef ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE + private: + static constexpr bool compliant = std::is_trivially_destructible::value == +@@ -347,9 +351,13 @@ struct is_trivially_destructible + // Nontrivially destructible types will cause the expression to be nontrivial. + template + struct is_trivially_default_constructible ++#if defined(ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE) ++ : std::is_trivially_default_constructible { ++#else + : std::integral_constant::value && + is_trivially_destructible::value> { ++#endif + #if defined(ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE) && \ + !defined( \ + ABSL_META_INTERNAL_STD_CONSTRUCTION_TRAITS_DONT_CHECK_DESTRUCTION) +@@ -381,10 +389,14 @@ struct is_trivially_default_constructible + // expression to be nontrivial. + template + struct is_trivially_move_constructible ++#if defined(ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE) ++ : std::is_trivially_move_constructible { ++#else + : std::conditional< + std::is_object::value && !std::is_array::value, + type_traits_internal::IsTriviallyMoveConstructibleObject, + std::is_reference>::type::type { ++#endif + #if defined(ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE) && \ + !defined( \ + ABSL_META_INTERNAL_STD_CONSTRUCTION_TRAITS_DONT_CHECK_DESTRUCTION) +@@ -490,9 +502,13 @@ struct is_trivially_move_assignable + // `is_trivially_assignable`. + template + struct is_trivially_copy_assignable ++#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE ++ : std::is_trivially_copy_assignable { ++#else + : std::integral_constant< + bool, __has_trivial_assign(typename std::remove_reference::type) && + absl::is_copy_assignable::value> { ++#endif + #ifdef ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE + private: + static constexpr bool compliant = +@@ -544,6 +560,11 @@ namespace type_traits_internal { + // destructible. Arrays of trivially copyable types are trivially copyable. + // + // We expose this metafunction only for internal use within absl. ++ ++#if defined(ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE) ++template ++struct is_trivially_copyable : std::is_trivially_copyable {}; ++#else + template + class is_trivially_copyable_impl { + using ExtentsRemoved = typename std::remove_all_extents::type; +@@ -569,6 +590,7 @@ template + struct is_trivially_copyable + : std::integral_constant< + bool, type_traits_internal::is_trivially_copyable_impl::kValue> {}; ++#endif + } // namespace type_traits_internal + + // ----------------------------------------------------------------------------- +diff --git a/third_party/abseil-cpp/absl/meta/type_traits_test.cc b/third_party/abseil-cpp/absl/meta/type_traits_test.cc +index 0ef5b6655..fe96554de 100644 +--- a/third_party/abseil-cpp/absl/meta/type_traits_test.cc ++++ b/third_party/abseil-cpp/absl/meta/type_traits_test.cc +@@ -336,6 +336,7 @@ struct MovableNonCopyable { + + struct NonCopyableOrMovable { + NonCopyableOrMovable() = default; ++ virtual ~NonCopyableOrMovable() = default; + NonCopyableOrMovable(const NonCopyableOrMovable&) = delete; + NonCopyableOrMovable(NonCopyableOrMovable&&) = delete; + NonCopyableOrMovable& operator=(const NonCopyableOrMovable&) = delete; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0018-swiftshader-Don-t-check-system-wayland-for-non-wayla.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0018-swiftshader-Don-t-check-system-wayland-for-non-wayla.patch new file mode 100644 index 0000000000000000000000000000000000000000..d9ec13df4085d333d691981965571f12d7e6d4aa --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_105.0.5195/0018-swiftshader-Don-t-check-system-wayland-for-non-wayla.patch @@ -0,0 +1,27 @@ +From 8e61ec315214833b71f75e463919626fd519af48 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 10 Oct 2022 18:03:13 +0800 +Subject: [PATCH] swiftshader: Don't check system wayland for non-wayland + platform + +Signed-off-by: Jeffy Chen +--- + third_party/swiftshader/src/WSI/BUILD.gn | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/third_party/swiftshader/src/WSI/BUILD.gn b/third_party/swiftshader/src/WSI/BUILD.gn +index 4709332e2..dbe29a2a3 100644 +--- a/third_party/swiftshader/src/WSI/BUILD.gn ++++ b/third_party/swiftshader/src/WSI/BUILD.gn +@@ -87,7 +87,7 @@ swiftshader_source_set("WSI") { + "../Vulkan:swiftshader_libvulkan_headers", + ] + +- if (is_linux && !use_system_libwayland) { ++ if (is_linux && !use_system_libwayland && ozone_platform_wayland) { + # Use third-party targets + deps += [ "$wayland_gn_dir:wayland_client" ] + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0001-media-gpu-v4l2-Support-V4L2-VDA-with-libv4l2-on-Linu.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0001-media-gpu-v4l2-Support-V4L2-VDA-with-libv4l2-on-Linu.patch new file mode 100644 index 0000000000000000000000000000000000000000..396fe184830545a9cd6bb652ce9811af9d3d2ad0 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0001-media-gpu-v4l2-Support-V4L2-VDA-with-libv4l2-on-Linu.patch @@ -0,0 +1,461 @@ +From dc95c012fb4105e73af1edd89061c73329324226 Mon Sep 17 00:00:00 2001 +From: Maksim Sisov +Date: Wed, 31 Jul 2019 09:56:24 +0300 +Subject: [PATCH 01/17] media: gpu: v4l2: Support V4L2 VDA with libv4l2 on + Linux + +Based on: +https://github.com/OSSystems/meta-browser/pull/263/commits/60ceb28750ee1f73c9cc2bf7e9e20e1c37a03497 + +Signed-off-by: Jeffy Chen +--- + .../gpu_mjpeg_decode_accelerator_factory.cc | 3 +- + media/gpu/BUILD.gn | 1 + + media/gpu/args.gni | 3 + + .../gpu_video_decode_accelerator_factory.cc | 8 +++ + .../gpu_video_decode_accelerator_factory.h | 2 + + media/gpu/v4l2/BUILD.gn | 43 +++++++----- + media/gpu/v4l2/generic_v4l2_device.cc | 2 +- + media/gpu/v4l2/v4l2_device.cc | 70 +++++++++++++++++++ + media/gpu/v4l2/v4l2_video_decoder.cc | 7 ++ + 9 files changed, 120 insertions(+), 19 deletions(-) + +diff --git a/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc b/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc +index 020b12831..18feaf03b 100644 +--- a/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc ++++ b/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc +@@ -13,7 +13,8 @@ + #include "media/base/media_switches.h" + #include "media/gpu/buildflags.h" + +-#if BUILDFLAG(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY) ++#if BUILDFLAG(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY) && \ ++ !BUILDFLAG(USE_LINUX_V4L2) + #define USE_V4L2_MJPEG_DECODE_ACCELERATOR + #endif + +diff --git a/media/gpu/BUILD.gn b/media/gpu/BUILD.gn +index 041652bb2..1e9f945ff 100644 +--- a/media/gpu/BUILD.gn ++++ b/media/gpu/BUILD.gn +@@ -20,6 +20,7 @@ buildflag_header("buildflags") { + "USE_VAAPI_IMAGE_CODECS=$use_vaapi_image_codecs", + "USE_V4L2_CODEC=$use_v4l2_codec", + "USE_LIBV4L2=$use_v4lplugin", ++ "USE_LINUX_V4L2=$use_linux_v4l2_only", + "USE_VAAPI_X11=$use_vaapi_x11", + ] + } +diff --git a/media/gpu/args.gni b/media/gpu/args.gni +index 813657af1..65fb45c1d 100644 +--- a/media/gpu/args.gni ++++ b/media/gpu/args.gni +@@ -25,6 +25,9 @@ declare_args() { + # platforms which have v4l2 hardware encoder + use_v4l2_codec_aml = false + ++ # Indicates if Video4Linux2 codec is used for linux platform. ++ use_linux_v4l2_only = false ++ + # Indicates if VA-API-based hardware acceleration is to be used. This + # is typically the case on x86-based ChromeOS devices. + # VA-API should also be compiled by default on x11-using linux devices +diff --git a/media/gpu/gpu_video_decode_accelerator_factory.cc b/media/gpu/gpu_video_decode_accelerator_factory.cc +index 4fa596240..2f58f8f19 100644 +--- a/media/gpu/gpu_video_decode_accelerator_factory.cc ++++ b/media/gpu/gpu_video_decode_accelerator_factory.cc +@@ -30,7 +30,9 @@ + #elif BUILDFLAG(USE_V4L2_CODEC) && \ + (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)) + #include "media/gpu/v4l2/v4l2_device.h" ++#if !BUILDFLAG(USE_LINUX_V4L2) + #include "media/gpu/v4l2/v4l2_slice_video_decode_accelerator.h" ++#endif + #include "media/gpu/v4l2/v4l2_video_decode_accelerator.h" + #include "ui/gl/gl_surface_egl.h" + #endif +@@ -66,10 +68,12 @@ gpu::VideoDecodeAcceleratorCapabilities GetDecoderCapabilitiesInternal( + GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( + V4L2VideoDecodeAccelerator::GetSupportedProfiles(), + &capabilities.supported_profiles); ++#if !BUILDFLAG(USE_LINUX_V4L2) + GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( + V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles(), + &capabilities.supported_profiles); + #endif ++#endif + #elif BUILDFLAG(IS_MAC) + capabilities.supported_profiles = + VTVideoDecodeAccelerator::GetSupportedProfiles(workarounds); +@@ -150,8 +154,10 @@ GpuVideoDecodeAcceleratorFactory::CreateVDA( + #elif BUILDFLAG(USE_V4L2_CODEC) && \ + (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)) + &GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA, ++#if !BUILDFLAG(USE_LINUX_V4L2) + &GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA, + #endif ++#endif + + #if BUILDFLAG(IS_MAC) + &GpuVideoDecodeAcceleratorFactory::CreateVTVDA, +@@ -212,6 +218,7 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA( + return decoder; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + std::unique_ptr + GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA( + const gpu::GpuDriverBugWorkarounds& /*workarounds*/, +@@ -227,6 +234,7 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA( + return decoder; + } + #endif ++#endif + + #if BUILDFLAG(IS_MAC) + std::unique_ptr +diff --git a/media/gpu/gpu_video_decode_accelerator_factory.h b/media/gpu/gpu_video_decode_accelerator_factory.h +index d105fe6f8..43e9d1260 100644 +--- a/media/gpu/gpu_video_decode_accelerator_factory.h ++++ b/media/gpu/gpu_video_decode_accelerator_factory.h +@@ -105,11 +105,13 @@ class MEDIA_GPU_EXPORT GpuVideoDecodeAcceleratorFactory { + const gpu::GpuDriverBugWorkarounds& workarounds, + const gpu::GpuPreferences& gpu_preferences, + MediaLog* media_log) const; ++#if !BUILDFLAG(USE_LINUX_V4L2) + std::unique_ptr CreateV4L2SliceVDA( + const gpu::GpuDriverBugWorkarounds& workarounds, + const gpu::GpuPreferences& gpu_preferences, + MediaLog* media_log) const; + #endif ++#endif + #if BUILDFLAG(IS_MAC) + std::unique_ptr CreateVTVDA( + const gpu::GpuDriverBugWorkarounds& workarounds, +diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn +index 75c124c89..a73b9fb03 100644 +--- a/media/gpu/v4l2/BUILD.gn ++++ b/media/gpu/v4l2/BUILD.gn +@@ -27,9 +27,6 @@ source_set("v4l2") { + "buffer_affinity_tracker.h", + "generic_v4l2_device.cc", + "generic_v4l2_device.h", +- "v4l2_decode_surface.cc", +- "v4l2_decode_surface.h", +- "v4l2_decode_surface_handler.h", + "v4l2_device.cc", + "v4l2_device.h", + "v4l2_device_poller.cc", +@@ -38,8 +35,6 @@ source_set("v4l2") { + "v4l2_framerate_control.h", + "v4l2_image_processor_backend.cc", + "v4l2_image_processor_backend.h", +- "v4l2_slice_video_decode_accelerator.cc", +- "v4l2_slice_video_decode_accelerator.h", + "v4l2_stateful_workaround.cc", + "v4l2_stateful_workaround.h", + "v4l2_utils.cc", +@@ -54,22 +49,36 @@ source_set("v4l2") { + "v4l2_video_decoder_backend.h", + "v4l2_video_decoder_backend_stateful.cc", + "v4l2_video_decoder_backend_stateful.h", +- "v4l2_video_decoder_backend_stateless.cc", +- "v4l2_video_decoder_backend_stateless.h", +- "v4l2_video_decoder_delegate_h264.cc", +- "v4l2_video_decoder_delegate_h264.h", +- "v4l2_video_decoder_delegate_vp8.cc", +- "v4l2_video_decoder_delegate_vp8.h", +- "v4l2_video_decoder_delegate_vp9.cc", +- "v4l2_video_decoder_delegate_vp9.h", + ] + +- if (is_chromeos) { ++ if (!use_linux_v4l2_only) { + sources += [ +- # AV1 delegate depends on header files only in ChromeOS SDK +- "v4l2_video_decoder_delegate_av1.cc", +- "v4l2_video_decoder_delegate_av1.h", ++ "v4l2_decode_surface.cc", ++ "v4l2_decode_surface.h", ++ "v4l2_decode_surface_handler.h", ++ "v4l2_slice_video_decode_accelerator.cc", ++ "v4l2_slice_video_decode_accelerator.h", ++ "v4l2_video_decoder_backend_stateless.cc", ++ "v4l2_video_decoder_backend_stateless.h", ++ "v4l2_video_decoder_delegate_h264.cc", ++ "v4l2_video_decoder_delegate_h264.h", ++ "v4l2_video_decoder_delegate_vp8.cc", ++ "v4l2_video_decoder_delegate_vp8.h", ++ "v4l2_video_decoder_delegate_vp9.cc", ++ "v4l2_video_decoder_delegate_vp9.h", ++ ] ++ ++ if (is_chromeos) { ++ sources += [ ++ # AV1 delegate depends on header files only in ChromeOS SDK ++ "v4l2_video_decoder_delegate_av1.cc", ++ "v4l2_video_decoder_delegate_av1.h", ++ ] ++ } ++ } + ++ if (is_chromeos) { ++ sources += [ + # TODO(crbug.com/901264): Encoders use hack for passing offset + # within a DMA-buf, which is not supported upstream. + "v4l2_video_encode_accelerator.cc", +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index fa9a95b95..b71494c34 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -434,7 +434,7 @@ bool GenericV4L2Device::OpenDevicePath(const std::string& path, Type type) { + return false; + + if (V4L2Device::UseLibV4L2()) { +- if (type == Type::kEncoder && ++ if (/* type == Type::kEncoder && */ + HANDLE_EINTR(v4l2_fd_open(device_fd_.get(), V4L2_DISABLE_CONVERSION)) != + -1) { + DVLOGF(3) << "Using libv4l2 for " << path; +diff --git a/media/gpu/v4l2/v4l2_device.cc b/media/gpu/v4l2/v4l2_device.cc +index e6d1b1927..d8e5526fe 100644 +--- a/media/gpu/v4l2/v4l2_device.cc ++++ b/media/gpu/v4l2/v4l2_device.cc +@@ -1019,10 +1019,12 @@ V4L2Queue::V4L2Queue(scoped_refptr dev, + return; + } + ++#if BUILDFLAG(IS_CHROMEOS) + if (reqbufs.capabilities & V4L2_BUF_CAP_SUPPORTS_REQUESTS) { + supports_requests_ = true; + DVLOGF(4) << "Queue supports request API."; + } ++#endif + } + + V4L2Queue::~V4L2Queue() { +@@ -1166,9 +1168,13 @@ size_t V4L2Queue::AllocateBuffers(size_t count, + reqbufs.count = count; + reqbufs.type = type_; + reqbufs.memory = memory; ++#if BUILDFLAG(IS_CHROMEOS) + reqbufs.flags = incoherent ? V4L2_MEMORY_FLAG_NON_COHERENT : 0; + DVQLOGF(3) << "Requesting " << count << " buffers."; + DVQLOGF(3) << "Incoherent flag is " << incoherent << "."; ++#else ++ DVQLOGF(3) << "Requesting " << count << " buffers."; ++#endif + + int ret = device_->Ioctl(VIDIOC_REQBUFS, &reqbufs); + if (ret) { +@@ -1227,7 +1233,9 @@ bool V4L2Queue::DeallocateBuffers() { + reqbufs.count = 0; + reqbufs.type = type_; + reqbufs.memory = memory_; ++#if BUILDFLAG(IS_CHROMEOS) + reqbufs.flags = incoherent_ ? V4L2_MEMORY_FLAG_NON_COHERENT : 0; ++#endif + + int ret = device_->Ioctl(VIDIOC_REQBUFS, &reqbufs); + if (ret) { +@@ -1583,6 +1591,23 @@ std::string V4L2Device::GetDriverName() { + // static + uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + bool slice_based) { ++#if BUILDFLAG(USE_LINUX_V4L2) ++ if (slice_based) { ++ LOG(ERROR) << "Slice not supported"; ++ return 0; ++ } ++ ++ if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { ++ return V4L2_PIX_FMT_H264; ++ } else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) { ++ return V4L2_PIX_FMT_VP8; ++ } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) { ++ return V4L2_PIX_FMT_VP9; ++ } else { ++ DVLOGF(1) << "Unsupported profile: " << GetProfileName(profile); ++ return 0; ++ } ++#else + if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { + if (slice_based) + return V4L2_PIX_FMT_H264_SLICE; +@@ -1607,8 +1632,10 @@ uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + DVLOGF(1) << "Unsupported profile: " << GetProfileName(profile); + return 0; + } ++#endif + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + namespace { + + VideoCodecProfile V4L2ProfileToVideoCodecProfile(VideoCodec codec, +@@ -1667,9 +1694,11 @@ VideoCodecProfile V4L2ProfileToVideoCodecProfile(VideoCodec codec, + } + + } // namespace ++#endif + + std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + uint32_t pix_fmt) { ++#if !BUILDFLAG(USE_LINUX_V4L2) + auto get_supported_profiles = [this]( + VideoCodec codec, + std::vector* profiles) { +@@ -1753,6 +1782,27 @@ std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + VLOGF(1) << "Unhandled pixelformat " << FourccToString(pix_fmt); + return {}; + } ++#else ++ std::vector profiles; ++ switch (pix_fmt) { ++ case V4L2_PIX_FMT_H264: ++ profiles = { ++ H264PROFILE_BASELINE, ++ H264PROFILE_MAIN, ++ H264PROFILE_HIGH, ++ }; ++ break; ++ case V4L2_PIX_FMT_VP8: ++ profiles = {VP8PROFILE_ANY}; ++ break; ++ case V4L2_PIX_FMT_VP9: ++ profiles = {VP9PROFILE_PROFILE0}; ++ break; ++ default: ++ VLOGF(1) << "Unhandled pixelformat " << FourccToString(pix_fmt); ++ return {}; ++ } ++#endif + + // Erase duplicated profiles. + std::sort(profiles.begin(), profiles.end()); +@@ -2469,10 +2519,14 @@ bool V4L2Request::ApplyCtrls(struct v4l2_ext_controls* ctrls) { + return false; + } + ++#if BUILDFLAG(IS_CHROMEOS) + ctrls->which = V4L2_CTRL_WHICH_REQUEST_VAL; + ctrls->request_fd = request_fd_.get(); + + return true; ++#else ++ return false; ++#endif + } + + bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) { +@@ -2484,10 +2538,14 @@ bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) { + return false; + } + ++#if BUILDFLAG(IS_CHROMEOS) + buffer->flags |= V4L2_BUF_FLAG_REQUEST_FD; + buffer->request_fd = request_fd_.get(); + + return true; ++#else ++ return false; ++#endif + } + + bool V4L2Request::Submit() { +@@ -2498,7 +2556,11 @@ bool V4L2Request::Submit() { + return false; + } + ++#if BUILDFLAG(IS_CHROMEOS) + return HANDLE_EINTR(ioctl(request_fd_.get(), MEDIA_REQUEST_IOC_QUEUE)) == 0; ++#else ++ return false; ++#endif + } + + bool V4L2Request::IsCompleted() { +@@ -2541,6 +2603,7 @@ bool V4L2Request::Reset() { + return false; + } + ++#if BUILDFLAG(IS_CHROMEOS) + // Reinit the request to make sure we can use it for a new submission. + if (HANDLE_EINTR(ioctl(request_fd_.get(), MEDIA_REQUEST_IOC_REINIT)) < 0) { + VPLOGF(1) << "Failed to reinit request."; +@@ -2548,6 +2611,9 @@ bool V4L2Request::Reset() { + } + + return true; ++#else ++ return false; ++#endif + } + + V4L2RequestRefBase::V4L2RequestRefBase(V4L2RequestRefBase&& req_base) { +@@ -2622,6 +2688,7 @@ V4L2RequestsQueue::~V4L2RequestsQueue() { + absl::optional V4L2RequestsQueue::CreateRequestFD() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + ++#if BUILDFLAG(IS_CHROMEOS) + int request_fd; + int ret = HANDLE_EINTR( + ioctl(media_fd_.get(), MEDIA_IOC_REQUEST_ALLOC, &request_fd)); +@@ -2631,6 +2698,9 @@ absl::optional V4L2RequestsQueue::CreateRequestFD() { + } + + return base::ScopedFD(request_fd); ++#else ++ return absl::nullopt; ++#endif + } + + absl::optional V4L2RequestsQueue::GetFreeRequest() { +diff --git a/media/gpu/v4l2/v4l2_video_decoder.cc b/media/gpu/v4l2/v4l2_video_decoder.cc +index 8ba46bc26..f6304210c 100644 +--- a/media/gpu/v4l2/v4l2_video_decoder.cc ++++ b/media/gpu/v4l2/v4l2_video_decoder.cc +@@ -28,7 +28,10 @@ + #include "media/gpu/macros.h" + #include "media/gpu/v4l2/v4l2_status.h" + #include "media/gpu/v4l2/v4l2_video_decoder_backend_stateful.h" ++ ++#if !BUILDFLAG(USE_LINUX_V4L2) + #include "media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h" ++#endif + + namespace media { + +@@ -45,11 +48,13 @@ constexpr size_t kInputBufferMaxSizeFor4k = 4 * kInputBufferMaxSizeFor1080p; + + // Input format V4L2 fourccs this class supports. + constexpr uint32_t kSupportedInputFourccs[] = { ++#if !BUILDFLAG(USE_LINUX_V4L2) + // V4L2 stateless formats + V4L2_PIX_FMT_H264_SLICE, + V4L2_PIX_FMT_VP8_FRAME, + V4L2_PIX_FMT_VP9_FRAME, + V4L2_PIX_FMT_AV1_FRAME, ++#endif + // V4L2 stateful formats + V4L2_PIX_FMT_H264, + V4L2_PIX_FMT_VP8, +@@ -336,6 +341,7 @@ V4L2Status V4L2VideoDecoder::InitializeBackend() { + backend_ = std::make_unique( + this, device_, profile_, color_space_, low_delay_, + decoder_task_runner_); ++#if !BUILDFLAG(USE_LINUX_V4L2) + } else { + DCHECK_EQ(preferred_api_and_format.first, kStateless); + VLOGF(1) << "Using a stateless API for profile: " +@@ -343,6 +349,7 @@ V4L2Status V4L2VideoDecoder::InitializeBackend() { + << " and fourcc: " << FourccToString(input_format_fourcc); + backend_ = std::make_unique( + this, device_, profile_, color_space_, decoder_task_runner_); ++#endif + } + + if (!backend_->Initialize()) { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0002-HACK-media-gpu-v4l2-Allow-V4L2-VEA-on-non-chromeos-p.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0002-HACK-media-gpu-v4l2-Allow-V4L2-VEA-on-non-chromeos-p.patch new file mode 100644 index 0000000000000000000000000000000000000000..60e0eb9af5698389930d4929cbfd1451d8600bfa --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0002-HACK-media-gpu-v4l2-Allow-V4L2-VEA-on-non-chromeos-p.patch @@ -0,0 +1,31 @@ +From 04b40ed582de2b118b4b025e596e1ccc6e46e9c6 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 13 Feb 2023 15:30:55 +0800 +Subject: [PATCH 02/17] HACK: media: gpu: v4l2: Allow V4L2 VEA on non-chromeos + platform + +NOTE(crbug.com/901264): +Encoders use hack for passing offset within a DMA-buf, which is not +supported upstream. + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/BUILD.gn | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn +index a73b9fb03..996be6e48 100644 +--- a/media/gpu/v4l2/BUILD.gn ++++ b/media/gpu/v4l2/BUILD.gn +@@ -77,7 +77,7 @@ source_set("v4l2") { + } + } + +- if (is_chromeos) { ++ if (true) { # if (is_chromeos) { + sources += [ + # TODO(crbug.com/901264): Encoders use hack for passing offset + # within a DMA-buf, which is not supported upstream. +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0003-Add-mmap-via-libv4l-to-generic_v4l2_device.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0003-Add-mmap-via-libv4l-to-generic_v4l2_device.patch new file mode 100644 index 0000000000000000000000000000000000000000..baacc92f6146d64fd5cd04014b47da90facc56d7 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0003-Add-mmap-via-libv4l-to-generic_v4l2_device.patch @@ -0,0 +1,49 @@ +From bbff6bfbf23ed17f4a9191b3f6762cd28c83a823 Mon Sep 17 00:00:00 2001 +From: Damian Hobson-Garcia +Date: Wed, 21 Mar 2018 13:18:17 +0200 +Subject: [PATCH 03/17] Add mmap via libv4l to generic_v4l2_device + +Issue #437 +--- + media/gpu/v4l2/generic_v4l2_device.cc | 10 ++++++++++ + media/gpu/v4l2/v4l2.sig | 2 ++ + 2 files changed, 12 insertions(+) + +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index b71494c34..559e273d7 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -120,10 +120,20 @@ void* GenericV4L2Device::Mmap(void* addr, + int flags, + unsigned int offset) { + DCHECK(device_fd_.is_valid()); ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_mmap(addr, len, prot, flags, device_fd_.get(), offset); ++#endif + return mmap(addr, len, prot, flags, device_fd_.get(), offset); + } + + void GenericV4L2Device::Munmap(void* addr, unsigned int len) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) { ++ v4l2_munmap(addr, len); ++ return; ++ } ++#endif + munmap(addr, len); + } + +diff --git a/media/gpu/v4l2/v4l2.sig b/media/gpu/v4l2/v4l2.sig +index 32931df37..8f1894536 100644 +--- a/media/gpu/v4l2/v4l2.sig ++++ b/media/gpu/v4l2/v4l2.sig +@@ -8,3 +8,5 @@ + LIBV4L_PUBLIC int v4l2_close(int fd); + LIBV4L_PUBLIC int v4l2_ioctl(int fd, unsigned long int request, ...); + LIBV4L_PUBLIC int v4l2_fd_open(int fd, int v4l2_flags); ++LIBV4L_PUBLIC void *v4l2_mmap(void *start, size_t length, int prot, int flags, int fd, int64_t offset); ++LIBV4L_PUBLIC int v4l2_munmap(void *_start, size_t length); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0004-media-capture-linux-Support-libv4l2-plugins.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0004-media-capture-linux-Support-libv4l2-plugins.patch new file mode 100644 index 0000000000000000000000000000000000000000..c70cab45f7ef52f31ff5ddf794661a0c91923932 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0004-media-capture-linux-Support-libv4l2-plugins.patch @@ -0,0 +1,178 @@ +From c094fa61bcdaa05acd1b01e43c35bd582fcc97c0 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 1 Jul 2019 10:37:35 +0800 +Subject: [PATCH 04/17] media: capture: linux: Support libv4l2 plugins + +Allow using libv4l2 plugins for linux v4l2 capture devices. + +Signed-off-by: Jeffy Chen +--- + media/capture/BUILD.gn | 14 +++++ + .../video/linux/v4l2_capture_device_impl.cc | 52 ++++++++++++++++++- + .../video/linux/v4l2_capture_device_impl.h | 11 ++++ + 3 files changed, 76 insertions(+), 1 deletion(-) + +diff --git a/media/capture/BUILD.gn b/media/capture/BUILD.gn +index 27afc0213..0ff0f4570 100644 +--- a/media/capture/BUILD.gn ++++ b/media/capture/BUILD.gn +@@ -2,6 +2,7 @@ + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. + ++import("//build/buildflag_header.gni") + import("//build/config/chromeos/ui_mode.gni") + import("//build/config/features.gni") + import("//build/config/ui.gni") +@@ -18,6 +19,14 @@ group("capture") { + ] + } + ++buildflag_header("buildflags") { ++ header = "buildflags.h" ++ ++ flags = [ ++ "USE_LIBV4L2=$use_v4lplugin", ++ ] ++} ++ + component("capture_switches") { + defines = [ "CAPTURE_IMPLEMENTATION" ] + sources = [ +@@ -270,6 +279,11 @@ component("capture_lib") { + "video/linux/video_capture_device_linux.cc", + "video/linux/video_capture_device_linux.h", + ] ++ public_deps += [ ":buildflags" ] ++ ++ if (use_v4lplugin) { ++ deps += [ "//media/gpu/v4l2:libv4l2_stubs" ] ++ } + } + + if (is_chromeos_ash) { +diff --git a/media/capture/video/linux/v4l2_capture_device_impl.cc b/media/capture/video/linux/v4l2_capture_device_impl.cc +index c8a49b3f0..a59d16492 100644 +--- a/media/capture/video/linux/v4l2_capture_device_impl.cc ++++ b/media/capture/video/linux/v4l2_capture_device_impl.cc +@@ -10,19 +10,61 @@ + #include + #include + ++#if BUILDFLAG(USE_LIBV4L2) ++// Auto-generated for dlopen libv4l2 libraries ++#include "media/gpu/v4l2/v4l2_stubs.h" ++#include "third_party/v4l-utils/lib/include/libv4l2.h" ++ ++#include "base/files/file_path.h" ++ ++using media_gpu_v4l2::kModuleV4l2; ++using media_gpu_v4l2::InitializeStubs; ++using media_gpu_v4l2::StubPathMap; ++ ++static const base::FilePath::CharType kV4l2Lib[] = ++ FILE_PATH_LITERAL("/usr/lib/libv4l2.so"); ++#endif ++ + namespace media { + + V4L2CaptureDeviceImpl::~V4L2CaptureDeviceImpl() = default; + ++V4L2CaptureDeviceImpl::V4L2CaptureDeviceImpl() { ++#if BUILDFLAG(USE_LIBV4L2) ++ StubPathMap paths; ++ paths[kModuleV4l2].push_back(kV4l2Lib); ++ ++ has_libv4l2_ = InitializeStubs(paths); ++#endif ++} ++ + int V4L2CaptureDeviceImpl::open(const char* device_name, int flags) { +- return ::open(device_name, flags); ++ int fd = ::open64(device_name, flags); ++ if (fd < 0) ++ return fd; ++ ++#if BUILDFLAG(USE_LIBV4L2) ++ use_libv4l2_ = false; ++ if (has_libv4l2_ && v4l2_fd_open(fd, V4L2_DISABLE_CONVERSION) != -1) { ++ use_libv4l2_ = true; ++ } ++#endif ++ return fd; + } + + int V4L2CaptureDeviceImpl::close(int fd) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_close(fd); ++#endif + return ::close(fd); + } + + int V4L2CaptureDeviceImpl::ioctl(int fd, int request, void* argp) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_ioctl(fd, request, argp); ++#endif + return ::ioctl(fd, request, argp); + } + +@@ -32,10 +74,18 @@ void* V4L2CaptureDeviceImpl::mmap(void* start, + int flags, + int fd, + off_t offset) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_mmap(start, length, prot, flags, fd, offset); ++#endif + return ::mmap(start, length, prot, flags, fd, offset); + } + + int V4L2CaptureDeviceImpl::munmap(void* start, size_t length) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_munmap(start, length); ++#endif + return ::munmap(start, length); + } + +diff --git a/media/capture/video/linux/v4l2_capture_device_impl.h b/media/capture/video/linux/v4l2_capture_device_impl.h +index 7bfc98414..b321d3cc6 100644 +--- a/media/capture/video/linux/v4l2_capture_device_impl.h ++++ b/media/capture/video/linux/v4l2_capture_device_impl.h +@@ -8,6 +8,7 @@ + #include + #include + ++#include "media/capture/buildflags.h" + #include "media/capture/capture_export.h" + #include "media/capture/video/linux/v4l2_capture_device.h" + +@@ -17,6 +18,8 @@ namespace media { + // V4L2 APIs. + class CAPTURE_EXPORT V4L2CaptureDeviceImpl : public V4L2CaptureDevice { + public: ++ V4L2CaptureDeviceImpl(); ++ + int open(const char* device_name, int flags) override; + int close(int fd) override; + int ioctl(int fd, int request, void* argp) override; +@@ -32,6 +35,14 @@ class CAPTURE_EXPORT V4L2CaptureDeviceImpl : public V4L2CaptureDevice { + + private: + ~V4L2CaptureDeviceImpl() override; ++ ++#if BUILDFLAG(USE_LIBV4L2) ++ // Has libv4l2. ++ bool has_libv4l2_; ++ // Use libv4l2 when operating |fd|. ++ bool use_libv4l2_; ++#endif ++ + }; + + } // namespace media +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0005-cld3-Avoid-unaligned-accesses.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0005-cld3-Avoid-unaligned-accesses.patch new file mode 100644 index 0000000000000000000000000000000000000000..4e7316ec5c47f7c51a1de8fda9fb20063110fe12 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0005-cld3-Avoid-unaligned-accesses.patch @@ -0,0 +1,46 @@ +From e8818d0018fd88c6ce17d9d007b175dc6cf482b7 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 27 Mar 2020 17:48:20 +0800 +Subject: [PATCH 05/17] cld3: Avoid unaligned accesses + +Although the unaligned memory accesses are enabled, somehow i still hit +the SIGBUS: +[23496.643138] Unhandled fault: alignment fault (0x92000021) at 0x00000000b182e636 +Received signal 7 BUS_ADRALN 0000b182e636 + +Signed-off-by: Jeffy Chen +--- + third_party/cld_3/src/src/script_span/port.h | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/third_party/cld_3/src/src/script_span/port.h b/third_party/cld_3/src/src/script_span/port.h +index 2b3bc515a..1d437babf 100644 +--- a/third_party/cld_3/src/src/script_span/port.h ++++ b/third_party/cld_3/src/src/script_span/port.h +@@ -78,11 +78,23 @@ namespace CLD2 { + // + // This is a mess, but there's not much we can do about it. + ++#if 0 + #define UNALIGNED_LOAD16(_p) (*reinterpret_cast(_p)) + #define UNALIGNED_LOAD32(_p) (*reinterpret_cast(_p)) + + #define UNALIGNED_STORE16(_p, _val) (*reinterpret_cast(_p) = (_val)) + #define UNALIGNED_STORE32(_p, _val) (*reinterpret_cast(_p) = (_val)) ++#else ++inline uint32 UNALIGNED_LOAD32(const void *p) { ++ uint32 t; ++ memcpy(&t, p, sizeof t); ++ return t; ++} ++ ++inline void UNALIGNED_STORE32(void *p, uint32 v) { ++ memcpy(p, &v, sizeof v); ++} ++#endif + + // TODO(sesse): NEON supports unaligned 64-bit loads and stores. + // See if that would be more efficient on platforms supporting it, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0006-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0006-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch new file mode 100644 index 0000000000000000000000000000000000000000..752f30fc7845d8ffbe8594376e7ad25073e7ece0 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0006-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch @@ -0,0 +1,29 @@ +From 2b451f5e52bf476bebe5c3e47ba94370108d7d4e Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 10 Apr 2020 16:16:08 +0800 +Subject: [PATCH 06/17] media: gpu: v4l2: Use POLLIN for pending event + +The v4l-rkmpp is using eventfd to fake poll events which not supporting +POLLPRI. + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/generic_v4l2_device.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index 559e273d7..6485fc4fe 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -110,7 +110,7 @@ bool GenericV4L2Device::Poll(bool poll_device, bool* event_pending) { + VPLOGF(1) << "poll() failed"; + return false; + } +- *event_pending = (pollfd != -1 && pollfds[pollfd].revents & POLLPRI); ++ *event_pending = (pollfd != -1 && pollfds[pollfd].revents & POLLIN); + return true; + } + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0007-media-capture-linux-Prefer-using-the-first-device.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0007-media-capture-linux-Prefer-using-the-first-device.patch new file mode 100644 index 0000000000000000000000000000000000000000..86f88019bb57298f3158ac5a3167983b392e7762 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0007-media-capture-linux-Prefer-using-the-first-device.patch @@ -0,0 +1,32 @@ +From 8f9375a9a8a30e85a94001d75a14098e671afa9b Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 5 Nov 2020 12:22:52 +0800 +Subject: [PATCH 07/17] media: capture: linux: Prefer using the first device + +Somehow the newest chromium would prefer using the last device in some +cases, e.g. apprtc. + +Let's reverse the device array to workaround it. + +Signed-off-by: Jeffy Chen +--- + .../capture/video/linux/video_capture_device_factory_linux.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/media/capture/video/linux/video_capture_device_factory_linux.cc b/media/capture/video/linux/video_capture_device_factory_linux.cc +index bca335210..3e62711fe 100644 +--- a/media/capture/video/linux/video_capture_device_factory_linux.cc ++++ b/media/capture/video/linux/video_capture_device_factory_linux.cc +@@ -197,7 +197,8 @@ void VideoCaptureDeviceFactoryLinux::GetDevicesInfo( + continue; + } + +- devices_info.emplace_back(VideoCaptureDeviceDescriptor( ++ // HACK: Somehow the newest chromium would prefer using the last device in some cases, e.g. apprtc ++ devices_info.emplace(devices_info.begin(), VideoCaptureDeviceDescriptor( + display_name, unique_id, model_id, + VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE, GetControlSupport(fd.get()), + VideoCaptureTransportType::OTHER_TRANSPORT, facing_mode)); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0008-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0008-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch new file mode 100644 index 0000000000000000000000000000000000000000..609888dfaf58b859743c36618e34ed406d07de23 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0008-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch @@ -0,0 +1,67 @@ +From c62bfc00296146beab52e3c1a9f67d1341908698 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 28 Sep 2020 20:02:00 +0800 +Subject: [PATCH 08/17] media: gpu: v4l2: Fix compile error when ozone not + enabled + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/BUILD.gn | 5 ++++- + media/gpu/v4l2/generic_v4l2_device.cc | 7 +++++++ + 2 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn +index 996be6e48..b2a0004ec 100644 +--- a/media/gpu/v4l2/BUILD.gn ++++ b/media/gpu/v4l2/BUILD.gn +@@ -116,9 +116,12 @@ source_set("v4l2") { + "//media/parsers", + "//third_party/libyuv", + "//ui/gfx/geometry", +- "//ui/ozone", + ] + ++ if (use_ozone) { ++ deps += [ "//ui/ozone" ] ++ } ++ + if (is_chromeos_ash) { + sources += [ + "v4l2_jpeg_encode_accelerator.cc", +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index 6485fc4fe..f1f1dd6c9 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -33,8 +33,11 @@ + #include "ui/gl/egl_util.h" + #include "ui/gl/gl_bindings.h" + #include "ui/gl/gl_image_native_pixmap.h" ++ ++#if defined(USE_OZONE) + #include "ui/ozone/public/ozone_platform.h" + #include "ui/ozone/public/surface_factory_ozone.h" ++#endif + + // Auto-generated for dlopen libv4l2 libraries + #include "media/gpu/v4l2/v4l2_stubs.h" +@@ -295,6 +298,9 @@ scoped_refptr GenericV4L2Device::CreateGLImage( + const gfx::Size& size, + const Fourcc fourcc, + gfx::NativePixmapHandle handle) const { ++#if !defined(USE_OZONE) ++ return nullptr; ++#else + DVLOGF(3); + DCHECK(CanCreateEGLImageFrom(fourcc)); + +@@ -330,6 +336,7 @@ scoped_refptr GenericV4L2Device::CreateGLImage( + bool ret = image->Initialize(std::move(pixmap)); + DCHECK(ret); + return image; ++#endif + } + + EGLBoolean GenericV4L2Device::DestroyEGLImage(EGLDisplay egl_display, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0009-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0009-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch new file mode 100644 index 0000000000000000000000000000000000000000..633bec048d9c83b142986e9abc5a2bf2934ef9fb --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0009-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch @@ -0,0 +1,29 @@ +From aa837dc37a6d7d2a943d7ac2b64cf63512f573de Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 20 May 2021 01:05:29 +0800 +Subject: [PATCH 09/17] ui: events: ozone: Define SW_PEN_INSERTED for old + kernel headers + +Signed-off-by: Jeffy Chen +--- + ui/events/ozone/evdev/event_converter_evdev_impl.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/ui/events/ozone/evdev/event_converter_evdev_impl.cc b/ui/events/ozone/evdev/event_converter_evdev_impl.cc +index 9319022c8..a1a82d51d 100644 +--- a/ui/events/ozone/evdev/event_converter_evdev_impl.cc ++++ b/ui/events/ozone/evdev/event_converter_evdev_impl.cc +@@ -31,6 +31,10 @@ namespace { + const int kKeyReleaseValue = 0; + const int kKeyRepeatValue = 2; + ++#ifndef SW_PEN_INSERTED ++#define SW_PEN_INSERTED 0x0f /* set = pen inserted */ ++#endif ++ + // Values for the EV_SW code. + const int kSwitchStylusInserted = SW_PEN_INSERTED; + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0010-Create-new-fence-when-there-s-no-in-fences.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0010-Create-new-fence-when-there-s-no-in-fences.patch new file mode 100644 index 0000000000000000000000000000000000000000..a541d821b03714d19ef440de03ece3bdc8d86d76 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0010-Create-new-fence-when-there-s-no-in-fences.patch @@ -0,0 +1,62 @@ +From 5e3f7fc4096d5606c3e8e64d9ebb5b97b84231f4 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 01:29:11 +0800 +Subject: [PATCH 10/17] Create new fence when there's no in-fences + +There're cases that in-fences are not provided. + +Signed-off-by: Jeffy Chen +--- + .../wayland/gpu/gbm_surfaceless_wayland.cc | 21 +++++++++++++++++-- + 1 file changed, 19 insertions(+), 2 deletions(-) + +diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +index c6355fb44..7b514430a 100644 +--- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc ++++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +@@ -33,6 +33,12 @@ static constexpr size_t kMaxSolidColorBuffers = 12; + + static constexpr gfx::Size kSolidColorBufferSize{4, 4}; + ++void WaitForEGLFence(EGLDisplay display, EGLSyncKHR fence) { ++ eglClientWaitSyncKHR(display, fence, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, ++ EGL_FOREVER_KHR); ++ eglDestroySyncKHR(display, fence); ++} ++ + void WaitForGpuFences(std::vector> fences) { + for (auto& fence : fences) + fence->Wait(); +@@ -228,8 +234,9 @@ void GbmSurfacelessWayland::SwapBuffersAsync( + return; + } + +- base::OnceClosure fence_wait_task; + std::vector> fences; ++ // Uset in-fences provided in the overlays. If there are none, we insert our ++ // own fence and wait. + for (auto& config : frame->configs) { + if (!config.access_fence_handle.is_null()) { + fences.push_back(std::make_unique( +@@ -238,7 +245,17 @@ void GbmSurfacelessWayland::SwapBuffersAsync( + } + } + +- fence_wait_task = base::BindOnce(&WaitForGpuFences, std::move(fences)); ++ base::OnceClosure fence_wait_task; ++ if (!fences.empty()) { ++ fence_wait_task = base::BindOnce(&WaitForGpuFences, std::move(fences)); ++ } else { ++ // TODO(fangzhoug): the following should be replaced by a per surface flush ++ // as it gets implemented in GL drivers. ++ EGLSyncKHR fence = InsertFence(has_implicit_external_sync_); ++ CHECK_NE(fence, EGL_NO_SYNC_KHR) << "eglCreateSyncKHR failed"; ++ ++ fence_wait_task = base::BindOnce(&WaitForEGLFence, GetDisplay(), fence); ++ } + + base::OnceClosure fence_retired_callback = base::BindOnce( + &GbmSurfacelessWayland::FenceRetired, weak_factory_.GetWeakPtr(), frame); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0011-HACK-ozone-wayland-Force-disable-implicit-external-s.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0011-HACK-ozone-wayland-Force-disable-implicit-external-s.patch new file mode 100644 index 0000000000000000000000000000000000000000..c7474156d17f6976302a57b3ecf7bf58a9386785 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0011-HACK-ozone-wayland-Force-disable-implicit-external-s.patch @@ -0,0 +1,34 @@ +From 9a85a408794d662ef395650db9e4bade0c8eaf44 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 01:41:57 +0800 +Subject: [PATCH 11/17] HACK: [ozone/wayland]: Force disable implicit external + sync + +The Mali's implicit external sync seems broken. + +Signed-off-by: Jeffy Chen +--- + ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +index 7b514430a..9f0d2dc2b 100644 +--- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc ++++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +@@ -251,10 +251,11 @@ void GbmSurfacelessWayland::SwapBuffersAsync( + } else { + // TODO(fangzhoug): the following should be replaced by a per surface flush + // as it gets implemented in GL drivers. +- EGLSyncKHR fence = InsertFence(has_implicit_external_sync_); ++ // HACK: The Mali's implicit external sync seems broken. ++ EGLSyncKHR fence = InsertFence(/* has_implicit_external_sync_ */ false); + CHECK_NE(fence, EGL_NO_SYNC_KHR) << "eglCreateSyncKHR failed"; + +- fence_wait_task = base::BindOnce(&WaitForEGLFence, GetDisplay(), fence); ++ fence_wait_task = base::BindOnce(&WaitForEGLFence, GetEGLDisplay(), fence); + } + + base::OnceClosure fence_retired_callback = base::BindOnce( +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0012-HACK-media-capture-linux-Allow-camera-without-suppor.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0012-HACK-media-capture-linux-Allow-camera-without-suppor.patch new file mode 100644 index 0000000000000000000000000000000000000000..71b3b2362c707f7707aeea2ecdc195c48e278496 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0012-HACK-media-capture-linux-Allow-camera-without-suppor.patch @@ -0,0 +1,35 @@ +From 178ffbd5769752f554a09cacc2d170c0ebc585ea Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 07:25:58 +0800 +Subject: [PATCH 12/17] HACK: media: capture: linux: Allow camera without + supported format + +The chromium would only accept discrete frame sizes. + +Hack it to make Rockchip ISP camera working. + +Signed-off-by: Jeffy Chen +--- + .../video/linux/video_capture_device_factory_linux.cc | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/media/capture/video/linux/video_capture_device_factory_linux.cc b/media/capture/video/linux/video_capture_device_factory_linux.cc +index 3e62711fe..921810271 100644 +--- a/media/capture/video/linux/video_capture_device_factory_linux.cc ++++ b/media/capture/video/linux/video_capture_device_factory_linux.cc +@@ -192,10 +192,8 @@ void VideoCaptureDeviceFactoryLinux::GetDevicesInfo( + + VideoCaptureFormats supported_formats; + GetSupportedFormatsForV4L2BufferType(fd.get(), &supported_formats); +- if (supported_formats.empty()) { +- DVLOG(1) << "No supported formats: " << unique_id; +- continue; +- } ++ if (supported_formats.empty()) ++ LOG(WARNING) << "No supported formats: " << unique_id; + + // HACK: Somehow the newest chromium would prefer using the last device in some cases, e.g. apprtc + devices_info.emplace(devices_info.begin(), VideoCaptureDeviceDescriptor( +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0013-content-gpu-Only-depend-dri-for-X11.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0013-content-gpu-Only-depend-dri-for-X11.patch new file mode 100644 index 0000000000000000000000000000000000000000..e3325d99bb103d5647f769cb4ed021d864559192 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0013-content-gpu-Only-depend-dri-for-X11.patch @@ -0,0 +1,26 @@ +From 7dc48fb53270a9732990cf4d7fb7c2091343d4e2 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 22 Nov 2021 15:59:49 +0800 +Subject: [PATCH 13/17] content: gpu: Only depend dri for X11 + +Signed-off-by: Jeffy Chen +--- + content/gpu/BUILD.gn | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/content/gpu/BUILD.gn b/content/gpu/BUILD.gn +index 9f5f303b2..524b257aa 100644 +--- a/content/gpu/BUILD.gn ++++ b/content/gpu/BUILD.gn +@@ -138,7 +138,7 @@ target(link_target_type, "gpu_sources") { + + # Use DRI on desktop Linux builds. + if (current_cpu != "s390x" && current_cpu != "ppc64" && is_linux && +- !is_castos) { ++ !is_castos && ozone_platform_x11) { + configs += [ "//build/config/linux/dri" ] + } + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0014-HACK-media-Disable-chromeos-direct-video-decoder-by-.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0014-HACK-media-Disable-chromeos-direct-video-decoder-by-.patch new file mode 100644 index 0000000000000000000000000000000000000000..b2beac569bcb704559edbb1d3d58455f3bed3714 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0014-HACK-media-Disable-chromeos-direct-video-decoder-by-.patch @@ -0,0 +1,30 @@ +From e3d6c06d7694b638792ee094a0c0b2c1b0e22938 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 16 Mar 2022 12:14:02 +0800 +Subject: [PATCH 14/17] HACK: media: Disable chromeos direct video decoder by + default + +Revisit once V4L2 video decoder is supported on linux. + +Signed-off-by: Jeffy Chen +--- + media/base/media_switches.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc +index fc4504317..71747b851 100644 +--- a/media/base/media_switches.cc ++++ b/media/base/media_switches.cc +@@ -926,7 +926,8 @@ BASE_FEATURE(kChromeOSHWVBREncoding, + // TODO(b/159825227): remove when the direct video decoder is fully launched. + BASE_FEATURE(kUseChromeOSDirectVideoDecoder, + "UseChromeOSDirectVideoDecoder", +- base::FEATURE_ENABLED_BY_DEFAULT); ++ // base::FEATURE_ENABLED_BY_DEFAULT); ++ base::FEATURE_DISABLED_BY_DEFAULT); + + // Limit the number of concurrent hardware decoder instances on ChromeOS. + BASE_FEATURE(kLimitConcurrentDecoderInstances, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0015-media-Support-HEVC-in-V4L2-VDA.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0015-media-Support-HEVC-in-V4L2-VDA.patch new file mode 100644 index 0000000000000000000000000000000000000000..833c593245530268cf99c502ab784178f57f33e1 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0015-media-Support-HEVC-in-V4L2-VDA.patch @@ -0,0 +1,93 @@ +From c84f1f0f1df5be16b32eec0340e11022e228f38f Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 9 Sep 2022 16:06:58 +0800 +Subject: [PATCH 15/17] media: Support HEVC in V4L2 VDA + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/v4l2_device.cc | 9 +++++++++ + media/gpu/v4l2/v4l2_vda_helpers.cc | 1 + + media/gpu/v4l2/v4l2_video_decode_accelerator.cc | 2 +- + media/gpu/v4l2/v4l2_video_decoder.cc | 1 + + media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc | 1 + + 5 files changed, 13 insertions(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/v4l2_device.cc b/media/gpu/v4l2/v4l2_device.cc +index d8e5526fe..50886548f 100644 +--- a/media/gpu/v4l2/v4l2_device.cc ++++ b/media/gpu/v4l2/v4l2_device.cc +@@ -1599,6 +1599,8 @@ uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + + if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { + return V4L2_PIX_FMT_H264; ++ } else if (profile >= HEVCPROFILE_MIN && profile <= HEVCPROFILE_MAX) { ++ return V4L2_PIX_FMT_HEVC; + } else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) { + return V4L2_PIX_FMT_VP8; + } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) { +@@ -1792,6 +1794,13 @@ std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + H264PROFILE_HIGH, + }; + break; ++ case V4L2_PIX_FMT_HEVC: ++ profiles = { ++ HEVCPROFILE_MAIN, ++ HEVCPROFILE_MAIN10, ++ HEVCPROFILE_MAIN_STILL_PICTURE, ++ }; ++ break; + case V4L2_PIX_FMT_VP8: + profiles = {VP8PROFILE_ANY}; + break; +diff --git a/media/gpu/v4l2/v4l2_vda_helpers.cc b/media/gpu/v4l2/v4l2_vda_helpers.cc +index baaca9c0a..71983d372 100644 +--- a/media/gpu/v4l2/v4l2_vda_helpers.cc ++++ b/media/gpu/v4l2/v4l2_vda_helpers.cc +@@ -149,6 +149,7 @@ InputBufferFragmentSplitter::CreateFromProfile( + case VideoCodec::kH264: + return std::make_unique< + v4l2_vda_helpers::H264InputBufferFragmentSplitter>(); ++ case VideoCodec::kHEVC: + case VideoCodec::kVP8: + case VideoCodec::kVP9: + // VP8/VP9 don't need any frame splitting, use the default implementation. +diff --git a/media/gpu/v4l2/v4l2_video_decode_accelerator.cc b/media/gpu/v4l2/v4l2_video_decode_accelerator.cc +index 05b87395f..08da713c9 100644 +--- a/media/gpu/v4l2/v4l2_video_decode_accelerator.cc ++++ b/media/gpu/v4l2/v4l2_video_decode_accelerator.cc +@@ -87,7 +87,7 @@ bool IsVp9KSVCStream(uint32_t input_format_fourcc, + + // static + const uint32_t V4L2VideoDecodeAccelerator::supported_input_fourccs_[] = { +- V4L2_PIX_FMT_H264, V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, ++ V4L2_PIX_FMT_H264, V4L2_PIX_FMT_HEVC, V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, + }; + + // static +diff --git a/media/gpu/v4l2/v4l2_video_decoder.cc b/media/gpu/v4l2/v4l2_video_decoder.cc +index f6304210c..ca84857e6 100644 +--- a/media/gpu/v4l2/v4l2_video_decoder.cc ++++ b/media/gpu/v4l2/v4l2_video_decoder.cc +@@ -57,6 +57,7 @@ constexpr uint32_t kSupportedInputFourccs[] = { + #endif + // V4L2 stateful formats + V4L2_PIX_FMT_H264, ++ V4L2_PIX_FMT_HEVC, + V4L2_PIX_FMT_VP8, + V4L2_PIX_FMT_VP9, + V4L2_PIX_FMT_AV1, +diff --git a/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc b/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc +index a95bf0093..e9edcbef3 100644 +--- a/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc ++++ b/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc +@@ -768,6 +768,7 @@ bool V4L2StatefulVideoDecoderBackend::IsSupportedProfile( + if (supported_profiles_.empty()) { + constexpr uint32_t kSupportedInputFourccs[] = { + V4L2_PIX_FMT_H264, ++ V4L2_PIX_FMT_HEVC, + V4L2_PIX_FMT_VP8, + V4L2_PIX_FMT_VP9, + }; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0016-media-gpu-chromeos-Define-new-formats-for-old-kernel.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0016-media-gpu-chromeos-Define-new-formats-for-old-kernel.patch new file mode 100644 index 0000000000000000000000000000000000000000..849b1597591879274ab2c390ccf8f7f565ca9717 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0016-media-gpu-chromeos-Define-new-formats-for-old-kernel.patch @@ -0,0 +1,36 @@ +From 8af67377890ca61d1b12a9beba1dcb397645f66c Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 9 Sep 2022 18:54:08 +0800 +Subject: [PATCH 16/17] media: gpu: chromeos: Define new formats for old kernel + +Signed-off-by: Jeffy Chen +--- + media/gpu/chromeos/fourcc.h | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/media/gpu/chromeos/fourcc.h b/media/gpu/chromeos/fourcc.h +index 891959164..77dc337be 100644 +--- a/media/gpu/chromeos/fourcc.h ++++ b/media/gpu/chromeos/fourcc.h +@@ -13,6 +13,18 @@ + #include "media/gpu/media_gpu_export.h" + #include "third_party/abseil-cpp/absl/types/optional.h" + ++#ifndef V4L2_PIX_FMT_MT21C ++#define V4L2_PIX_FMT_MT21C v4l2_fourcc('M', 'T', '2', '1') /* Mediatek compressed block mode */ ++#endif ++ ++#ifndef V4L2_PIX_FMT_VP9 ++#define V4L2_PIX_FMT_VP9 v4l2_fourcc('V', 'P', '9', '0') /* VP9 */ ++#endif ++ ++#ifndef V4L2_PIX_FMT_HEVC ++#define V4L2_PIX_FMT_HEVC v4l2_fourcc('H', 'E', 'V', 'C') /* HEVC */ ++#endif ++ + namespace media { + + // Composes a Fourcc value. +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0017-media-Support-AV1-in-V4L2-VDA.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0017-media-Support-AV1-in-V4L2-VDA.patch new file mode 100644 index 0000000000000000000000000000000000000000..ac200800dccc91662d5a304ec3659adda78fe767 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_109.0.5414/0017-media-Support-AV1-in-V4L2-VDA.patch @@ -0,0 +1,93 @@ +From efe2522861b7c3e2a9abc809883d9e3ac667e981 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 13 Feb 2023 15:50:20 +0800 +Subject: [PATCH 17/17] media: Support AV1 in V4L2 VDA + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/v4l2_device.cc | 9 +++++++++ + media/gpu/v4l2/v4l2_vda_helpers.cc | 1 + + media/gpu/v4l2/v4l2_video_decode_accelerator.cc | 2 +- + media/gpu/v4l2/v4l2_video_decoder.cc | 1 + + media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc | 1 + + 5 files changed, 13 insertions(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/v4l2_device.cc b/media/gpu/v4l2/v4l2_device.cc +index 50886548f..d206b18a7 100644 +--- a/media/gpu/v4l2/v4l2_device.cc ++++ b/media/gpu/v4l2/v4l2_device.cc +@@ -1605,6 +1605,8 @@ uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + return V4L2_PIX_FMT_VP8; + } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) { + return V4L2_PIX_FMT_VP9; ++ } else if (profile >= AV1PROFILE_MIN && profile <= AV1PROFILE_MAX) { ++ return V4L2_PIX_FMT_AV1; + } else { + DVLOGF(1) << "Unsupported profile: " << GetProfileName(profile); + return 0; +@@ -1807,6 +1809,13 @@ std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + case V4L2_PIX_FMT_VP9: + profiles = {VP9PROFILE_PROFILE0}; + break; ++ case V4L2_PIX_FMT_AV1: ++ profiles = { ++ AV1PROFILE_PROFILE_MAIN, ++ AV1PROFILE_PROFILE_HIGH, ++ AV1PROFILE_PROFILE_PRO, ++ }; ++ break; + default: + VLOGF(1) << "Unhandled pixelformat " << FourccToString(pix_fmt); + return {}; +diff --git a/media/gpu/v4l2/v4l2_vda_helpers.cc b/media/gpu/v4l2/v4l2_vda_helpers.cc +index 71983d372..83ec303d4 100644 +--- a/media/gpu/v4l2/v4l2_vda_helpers.cc ++++ b/media/gpu/v4l2/v4l2_vda_helpers.cc +@@ -150,6 +150,7 @@ InputBufferFragmentSplitter::CreateFromProfile( + return std::make_unique< + v4l2_vda_helpers::H264InputBufferFragmentSplitter>(); + case VideoCodec::kHEVC: ++ case VideoCodec::kAV1: + case VideoCodec::kVP8: + case VideoCodec::kVP9: + // VP8/VP9 don't need any frame splitting, use the default implementation. +diff --git a/media/gpu/v4l2/v4l2_video_decode_accelerator.cc b/media/gpu/v4l2/v4l2_video_decode_accelerator.cc +index 08da713c9..afb993d11 100644 +--- a/media/gpu/v4l2/v4l2_video_decode_accelerator.cc ++++ b/media/gpu/v4l2/v4l2_video_decode_accelerator.cc +@@ -87,7 +87,7 @@ bool IsVp9KSVCStream(uint32_t input_format_fourcc, + + // static + const uint32_t V4L2VideoDecodeAccelerator::supported_input_fourccs_[] = { +- V4L2_PIX_FMT_H264, V4L2_PIX_FMT_HEVC, V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, ++ V4L2_PIX_FMT_H264, V4L2_PIX_FMT_HEVC, V4L2_PIX_FMT_AV1, V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, + }; + + // static +diff --git a/media/gpu/v4l2/v4l2_video_decoder.cc b/media/gpu/v4l2/v4l2_video_decoder.cc +index ca84857e6..eee326eca 100644 +--- a/media/gpu/v4l2/v4l2_video_decoder.cc ++++ b/media/gpu/v4l2/v4l2_video_decoder.cc +@@ -58,6 +58,7 @@ constexpr uint32_t kSupportedInputFourccs[] = { + // V4L2 stateful formats + V4L2_PIX_FMT_H264, + V4L2_PIX_FMT_HEVC, ++ V4L2_PIX_FMT_AV1, + V4L2_PIX_FMT_VP8, + V4L2_PIX_FMT_VP9, + V4L2_PIX_FMT_AV1, +diff --git a/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc b/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc +index e9edcbef3..ab5e7a6d3 100644 +--- a/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc ++++ b/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc +@@ -769,6 +769,7 @@ bool V4L2StatefulVideoDecoderBackend::IsSupportedProfile( + constexpr uint32_t kSupportedInputFourccs[] = { + V4L2_PIX_FMT_H264, + V4L2_PIX_FMT_HEVC, ++ V4L2_PIX_FMT_AV1, + V4L2_PIX_FMT_VP8, + V4L2_PIX_FMT_VP9, + }; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0001-media-gpu-v4l2-Support-V4L2-VDA-with-libv4l2-on-Linu.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0001-media-gpu-v4l2-Support-V4L2-VDA-with-libv4l2-on-Linu.patch new file mode 100644 index 0000000000000000000000000000000000000000..24bce23d387e758095aa061d848cdce0054d970c --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0001-media-gpu-v4l2-Support-V4L2-VDA-with-libv4l2-on-Linu.patch @@ -0,0 +1,461 @@ +From b4df6bb5295e9b1d6d192abbaefa0ae2f802b2b1 Mon Sep 17 00:00:00 2001 +From: Maksim Sisov +Date: Wed, 31 Jul 2019 09:56:24 +0300 +Subject: [PATCH 01/18] media: gpu: v4l2: Support V4L2 VDA with libv4l2 on + Linux + +Based on: +https://github.com/OSSystems/meta-browser/pull/263/commits/60ceb28750ee1f73c9cc2bf7e9e20e1c37a03497 + +Signed-off-by: Jeffy Chen +--- + .../gpu_mjpeg_decode_accelerator_factory.cc | 3 +- + media/gpu/BUILD.gn | 1 + + media/gpu/args.gni | 3 + + .../gpu_video_decode_accelerator_factory.cc | 8 +++ + .../gpu_video_decode_accelerator_factory.h | 2 + + media/gpu/v4l2/BUILD.gn | 43 +++++++----- + media/gpu/v4l2/generic_v4l2_device.cc | 2 +- + media/gpu/v4l2/v4l2_device.cc | 70 +++++++++++++++++++ + media/gpu/v4l2/v4l2_video_decoder.cc | 7 ++ + 9 files changed, 120 insertions(+), 19 deletions(-) + +diff --git a/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc b/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc +index 888a5ce26..f083c93c7 100644 +--- a/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc ++++ b/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc +@@ -12,7 +12,8 @@ + #include "media/base/media_switches.h" + #include "media/gpu/buildflags.h" + +-#if BUILDFLAG(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY) ++#if BUILDFLAG(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY) && \ ++ !BUILDFLAG(USE_LINUX_V4L2) + #define USE_V4L2_MJPEG_DECODE_ACCELERATOR + #endif + +diff --git a/media/gpu/BUILD.gn b/media/gpu/BUILD.gn +index 9ecae932b..f4b656e40 100644 +--- a/media/gpu/BUILD.gn ++++ b/media/gpu/BUILD.gn +@@ -20,6 +20,7 @@ buildflag_header("buildflags") { + "USE_VAAPI_IMAGE_CODECS=$use_vaapi_image_codecs", + "USE_V4L2_CODEC=$use_v4l2_codec", + "USE_LIBV4L2=$use_v4lplugin", ++ "USE_LINUX_V4L2=$use_linux_v4l2_only", + "USE_VAAPI_X11=$use_vaapi_x11", + ] + } +diff --git a/media/gpu/args.gni b/media/gpu/args.gni +index 813657af1..65fb45c1d 100644 +--- a/media/gpu/args.gni ++++ b/media/gpu/args.gni +@@ -25,6 +25,9 @@ declare_args() { + # platforms which have v4l2 hardware encoder + use_v4l2_codec_aml = false + ++ # Indicates if Video4Linux2 codec is used for linux platform. ++ use_linux_v4l2_only = false ++ + # Indicates if VA-API-based hardware acceleration is to be used. This + # is typically the case on x86-based ChromeOS devices. + # VA-API should also be compiled by default on x11-using linux devices +diff --git a/media/gpu/gpu_video_decode_accelerator_factory.cc b/media/gpu/gpu_video_decode_accelerator_factory.cc +index 2db7d44e7..94287277a 100644 +--- a/media/gpu/gpu_video_decode_accelerator_factory.cc ++++ b/media/gpu/gpu_video_decode_accelerator_factory.cc +@@ -29,7 +29,9 @@ + #elif BUILDFLAG(USE_V4L2_CODEC) && \ + (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)) + #include "media/gpu/v4l2/v4l2_device.h" ++#if !BUILDFLAG(USE_LINUX_V4L2) + #include "media/gpu/v4l2/v4l2_slice_video_decode_accelerator.h" ++#endif + #include "media/gpu/v4l2/v4l2_video_decode_accelerator.h" + #include "ui/gl/gl_surface_egl.h" + #endif +@@ -65,10 +67,12 @@ gpu::VideoDecodeAcceleratorCapabilities GetDecoderCapabilitiesInternal( + GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( + V4L2VideoDecodeAccelerator::GetSupportedProfiles(), + &capabilities.supported_profiles); ++#if !BUILDFLAG(USE_LINUX_V4L2) + GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( + V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles(), + &capabilities.supported_profiles); + #endif ++#endif + #elif BUILDFLAG(IS_MAC) + capabilities.supported_profiles = + VTVideoDecodeAccelerator::GetSupportedProfiles(workarounds); +@@ -149,8 +153,10 @@ GpuVideoDecodeAcceleratorFactory::CreateVDA( + #elif BUILDFLAG(USE_V4L2_CODEC) && \ + (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)) + &GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA, ++#if !BUILDFLAG(USE_LINUX_V4L2) + &GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA, + #endif ++#endif + + #if BUILDFLAG(IS_MAC) + &GpuVideoDecodeAcceleratorFactory::CreateVTVDA, +@@ -211,6 +217,7 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA( + return decoder; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + std::unique_ptr + GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA( + const gpu::GpuDriverBugWorkarounds& /*workarounds*/, +@@ -226,6 +233,7 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA( + return decoder; + } + #endif ++#endif + + #if BUILDFLAG(IS_MAC) + std::unique_ptr +diff --git a/media/gpu/gpu_video_decode_accelerator_factory.h b/media/gpu/gpu_video_decode_accelerator_factory.h +index fadf95184..5d1ae3581 100644 +--- a/media/gpu/gpu_video_decode_accelerator_factory.h ++++ b/media/gpu/gpu_video_decode_accelerator_factory.h +@@ -104,11 +104,13 @@ class MEDIA_GPU_EXPORT GpuVideoDecodeAcceleratorFactory { + const gpu::GpuDriverBugWorkarounds& workarounds, + const gpu::GpuPreferences& gpu_preferences, + MediaLog* media_log) const; ++#if !BUILDFLAG(USE_LINUX_V4L2) + std::unique_ptr CreateV4L2SliceVDA( + const gpu::GpuDriverBugWorkarounds& workarounds, + const gpu::GpuPreferences& gpu_preferences, + MediaLog* media_log) const; + #endif ++#endif + #if BUILDFLAG(IS_MAC) + std::unique_ptr CreateVTVDA( + const gpu::GpuDriverBugWorkarounds& workarounds, +diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn +index 12e6b66cf..23c1961c2 100644 +--- a/media/gpu/v4l2/BUILD.gn ++++ b/media/gpu/v4l2/BUILD.gn +@@ -27,9 +27,6 @@ source_set("v4l2") { + "buffer_affinity_tracker.h", + "generic_v4l2_device.cc", + "generic_v4l2_device.h", +- "v4l2_decode_surface.cc", +- "v4l2_decode_surface.h", +- "v4l2_decode_surface_handler.h", + "v4l2_device.cc", + "v4l2_device.h", + "v4l2_device_poller.cc", +@@ -38,8 +35,6 @@ source_set("v4l2") { + "v4l2_framerate_control.h", + "v4l2_image_processor_backend.cc", + "v4l2_image_processor_backend.h", +- "v4l2_slice_video_decode_accelerator.cc", +- "v4l2_slice_video_decode_accelerator.h", + "v4l2_stateful_workaround.cc", + "v4l2_stateful_workaround.h", + "v4l2_utils.cc", +@@ -54,22 +49,36 @@ source_set("v4l2") { + "v4l2_video_decoder_backend.h", + "v4l2_video_decoder_backend_stateful.cc", + "v4l2_video_decoder_backend_stateful.h", +- "v4l2_video_decoder_backend_stateless.cc", +- "v4l2_video_decoder_backend_stateless.h", +- "v4l2_video_decoder_delegate_h264.cc", +- "v4l2_video_decoder_delegate_h264.h", +- "v4l2_video_decoder_delegate_vp8.cc", +- "v4l2_video_decoder_delegate_vp8.h", +- "v4l2_video_decoder_delegate_vp9.cc", +- "v4l2_video_decoder_delegate_vp9.h", + ] + +- if (is_chromeos) { ++ if (!use_linux_v4l2_only) { + sources += [ +- # AV1 delegate depends on header files only in ChromeOS SDK +- "v4l2_video_decoder_delegate_av1.cc", +- "v4l2_video_decoder_delegate_av1.h", ++ "v4l2_decode_surface.cc", ++ "v4l2_decode_surface.h", ++ "v4l2_decode_surface_handler.h", ++ "v4l2_slice_video_decode_accelerator.cc", ++ "v4l2_slice_video_decode_accelerator.h", ++ "v4l2_video_decoder_backend_stateless.cc", ++ "v4l2_video_decoder_backend_stateless.h", ++ "v4l2_video_decoder_delegate_h264.cc", ++ "v4l2_video_decoder_delegate_h264.h", ++ "v4l2_video_decoder_delegate_vp8.cc", ++ "v4l2_video_decoder_delegate_vp8.h", ++ "v4l2_video_decoder_delegate_vp9.cc", ++ "v4l2_video_decoder_delegate_vp9.h", ++ ] ++ ++ if (is_chromeos) { ++ sources += [ ++ # AV1 delegate depends on header files only in ChromeOS SDK ++ "v4l2_video_decoder_delegate_av1.cc", ++ "v4l2_video_decoder_delegate_av1.h", ++ ] ++ } ++ } + ++ if (is_chromeos) { ++ sources += [ + # TODO(crbug.com/901264): Encoders use hack for passing offset + # within a DMA-buf, which is not supported upstream. + "v4l2_video_encode_accelerator.cc", +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index c3c57a0f4..9238385fb 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -433,7 +433,7 @@ bool GenericV4L2Device::OpenDevicePath(const std::string& path, Type type) { + return false; + + if (V4L2Device::UseLibV4L2()) { +- if (type == Type::kEncoder && ++ if (/* type == Type::kEncoder && */ + HANDLE_EINTR(v4l2_fd_open(device_fd_.get(), V4L2_DISABLE_CONVERSION)) != + -1) { + DVLOGF(3) << "Using libv4l2 for " << path; +diff --git a/media/gpu/v4l2/v4l2_device.cc b/media/gpu/v4l2/v4l2_device.cc +index cdbdb4b84..090863ce6 100644 +--- a/media/gpu/v4l2/v4l2_device.cc ++++ b/media/gpu/v4l2/v4l2_device.cc +@@ -1009,10 +1009,12 @@ V4L2Queue::V4L2Queue(scoped_refptr dev, + return; + } + ++#if BUILDFLAG(IS_CHROMEOS) + if (reqbufs.capabilities & V4L2_BUF_CAP_SUPPORTS_REQUESTS) { + supports_requests_ = true; + DVLOGF(4) << "Queue supports request API."; + } ++#endif + } + + V4L2Queue::~V4L2Queue() { +@@ -1156,9 +1158,13 @@ size_t V4L2Queue::AllocateBuffers(size_t count, + reqbufs.count = count; + reqbufs.type = type_; + reqbufs.memory = memory; ++#if BUILDFLAG(IS_CHROMEOS) + reqbufs.flags = incoherent ? V4L2_MEMORY_FLAG_NON_COHERENT : 0; + DVQLOGF(3) << "Requesting " << count << " buffers."; + DVQLOGF(3) << "Incoherent flag is " << incoherent << "."; ++#else ++ DVQLOGF(3) << "Requesting " << count << " buffers."; ++#endif + + int ret = device_->Ioctl(VIDIOC_REQBUFS, &reqbufs); + if (ret) { +@@ -1217,7 +1223,9 @@ bool V4L2Queue::DeallocateBuffers() { + reqbufs.count = 0; + reqbufs.type = type_; + reqbufs.memory = memory_; ++#if BUILDFLAG(IS_CHROMEOS) + reqbufs.flags = incoherent_ ? V4L2_MEMORY_FLAG_NON_COHERENT : 0; ++#endif + + int ret = device_->Ioctl(VIDIOC_REQBUFS, &reqbufs); + if (ret) { +@@ -1562,6 +1570,23 @@ std::string V4L2Device::GetDriverName() { + // static + uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + bool slice_based) { ++#if BUILDFLAG(USE_LINUX_V4L2) ++ if (slice_based) { ++ LOG(ERROR) << "Slice not supported"; ++ return 0; ++ } ++ ++ if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { ++ return V4L2_PIX_FMT_H264; ++ } else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) { ++ return V4L2_PIX_FMT_VP8; ++ } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) { ++ return V4L2_PIX_FMT_VP9; ++ } else { ++ DVLOGF(1) << "Unsupported profile: " << GetProfileName(profile); ++ return 0; ++ } ++#else + if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { + if (slice_based) + return V4L2_PIX_FMT_H264_SLICE; +@@ -1596,8 +1621,10 @@ uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + DVLOGF(1) << "Unsupported profile: " << GetProfileName(profile); + return 0; + } ++#endif + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + namespace { + + VideoCodecProfile V4L2ProfileToVideoCodecProfile(VideoCodec codec, +@@ -1656,9 +1683,11 @@ VideoCodecProfile V4L2ProfileToVideoCodecProfile(VideoCodec codec, + } + + } // namespace ++#endif + + std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + uint32_t pix_fmt) { ++#if !BUILDFLAG(USE_LINUX_V4L2) + auto get_supported_profiles = [this]( + VideoCodec codec, + std::vector* profiles) { +@@ -1758,6 +1787,27 @@ std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + VLOGF(1) << "Unhandled pixelformat " << FourccToString(pix_fmt); + return {}; + } ++#else ++ std::vector profiles; ++ switch (pix_fmt) { ++ case V4L2_PIX_FMT_H264: ++ profiles = { ++ H264PROFILE_BASELINE, ++ H264PROFILE_MAIN, ++ H264PROFILE_HIGH, ++ }; ++ break; ++ case V4L2_PIX_FMT_VP8: ++ profiles = {VP8PROFILE_ANY}; ++ break; ++ case V4L2_PIX_FMT_VP9: ++ profiles = {VP9PROFILE_PROFILE0}; ++ break; ++ default: ++ VLOGF(1) << "Unhandled pixelformat " << FourccToString(pix_fmt); ++ return {}; ++ } ++#endif + + // Erase duplicated profiles. + std::sort(profiles.begin(), profiles.end()); +@@ -2493,10 +2543,14 @@ bool V4L2Request::ApplyCtrls(struct v4l2_ext_controls* ctrls) { + return false; + } + ++#if BUILDFLAG(IS_CHROMEOS) + ctrls->which = V4L2_CTRL_WHICH_REQUEST_VAL; + ctrls->request_fd = request_fd_.get(); + + return true; ++#else ++ return false; ++#endif + } + + bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) { +@@ -2508,10 +2562,14 @@ bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) { + return false; + } + ++#if BUILDFLAG(IS_CHROMEOS) + buffer->flags |= V4L2_BUF_FLAG_REQUEST_FD; + buffer->request_fd = request_fd_.get(); + + return true; ++#else ++ return false; ++#endif + } + + bool V4L2Request::Submit() { +@@ -2522,7 +2580,11 @@ bool V4L2Request::Submit() { + return false; + } + ++#if BUILDFLAG(IS_CHROMEOS) + return HANDLE_EINTR(ioctl(request_fd_.get(), MEDIA_REQUEST_IOC_QUEUE)) == 0; ++#else ++ return false; ++#endif + } + + bool V4L2Request::IsCompleted() { +@@ -2565,6 +2627,7 @@ bool V4L2Request::Reset() { + return false; + } + ++#if BUILDFLAG(IS_CHROMEOS) + // Reinit the request to make sure we can use it for a new submission. + if (HANDLE_EINTR(ioctl(request_fd_.get(), MEDIA_REQUEST_IOC_REINIT)) < 0) { + VPLOGF(1) << "Failed to reinit request."; +@@ -2572,6 +2635,9 @@ bool V4L2Request::Reset() { + } + + return true; ++#else ++ return false; ++#endif + } + + V4L2RequestRefBase::V4L2RequestRefBase(V4L2RequestRefBase&& req_base) { +@@ -2646,6 +2712,7 @@ V4L2RequestsQueue::~V4L2RequestsQueue() { + absl::optional V4L2RequestsQueue::CreateRequestFD() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + ++#if BUILDFLAG(IS_CHROMEOS) + int request_fd; + int ret = HANDLE_EINTR( + ioctl(media_fd_.get(), MEDIA_IOC_REQUEST_ALLOC, &request_fd)); +@@ -2655,6 +2722,9 @@ absl::optional V4L2RequestsQueue::CreateRequestFD() { + } + + return base::ScopedFD(request_fd); ++#else ++ return absl::nullopt; ++#endif + } + + absl::optional V4L2RequestsQueue::GetFreeRequest() { +diff --git a/media/gpu/v4l2/v4l2_video_decoder.cc b/media/gpu/v4l2/v4l2_video_decoder.cc +index e57c0043b..300711821 100644 +--- a/media/gpu/v4l2/v4l2_video_decoder.cc ++++ b/media/gpu/v4l2/v4l2_video_decoder.cc +@@ -28,7 +28,10 @@ + #include "media/gpu/macros.h" + #include "media/gpu/v4l2/v4l2_status.h" + #include "media/gpu/v4l2/v4l2_video_decoder_backend_stateful.h" ++ ++#if !BUILDFLAG(USE_LINUX_V4L2) + #include "media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h" ++#endif + + namespace media { + +@@ -45,11 +48,13 @@ constexpr size_t kInputBufferMaxSizeFor4k = 4 * kInputBufferMaxSizeFor1080p; + + // Input format V4L2 fourccs this class supports. + constexpr uint32_t kSupportedInputFourccs[] = { ++#if !BUILDFLAG(USE_LINUX_V4L2) + // V4L2 stateless formats + V4L2_PIX_FMT_H264_SLICE, + V4L2_PIX_FMT_VP8_FRAME, + V4L2_PIX_FMT_VP9_FRAME, + V4L2_PIX_FMT_AV1_FRAME, ++#endif + // V4L2 stateful formats + V4L2_PIX_FMT_H264, + #if BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER) +@@ -343,6 +348,7 @@ V4L2Status V4L2VideoDecoder::InitializeBackend() { + << " and fourcc: " << FourccToString(input_format_fourcc); + backend_ = std::make_unique( + this, device_, profile_, color_space_, decoder_task_runner_); ++#if !BUILDFLAG(USE_LINUX_V4L2) + } else { + DCHECK_EQ(preferred_api_and_format.first, kStateless); + VLOGF(1) << "Using a stateless API for profile: " +@@ -350,6 +356,7 @@ V4L2Status V4L2VideoDecoder::InitializeBackend() { + << " and fourcc: " << FourccToString(input_format_fourcc); + backend_ = std::make_unique( + this, device_, profile_, color_space_, decoder_task_runner_); ++#endif + } + + if (!backend_->Initialize()) { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0002-HACK-media-gpu-v4l2-Allow-V4L2-VEA-on-non-chromeos-p.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0002-HACK-media-gpu-v4l2-Allow-V4L2-VEA-on-non-chromeos-p.patch new file mode 100644 index 0000000000000000000000000000000000000000..77c5430c80a404f80e1230306675caf2a2f7cc01 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0002-HACK-media-gpu-v4l2-Allow-V4L2-VEA-on-non-chromeos-p.patch @@ -0,0 +1,31 @@ +From ed24a4fc3052f7aa29e4abb5ba8c7547cf1bdc30 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 13 Feb 2023 15:30:55 +0800 +Subject: [PATCH 02/18] HACK: media: gpu: v4l2: Allow V4L2 VEA on non-chromeos + platform + +NOTE(crbug.com/901264): +Encoders use hack for passing offset within a DMA-buf, which is not +supported upstream. + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/BUILD.gn | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn +index 23c1961c2..e4e05249b 100644 +--- a/media/gpu/v4l2/BUILD.gn ++++ b/media/gpu/v4l2/BUILD.gn +@@ -77,7 +77,7 @@ source_set("v4l2") { + } + } + +- if (is_chromeos) { ++ if (true) { # if (is_chromeos) { + sources += [ + # TODO(crbug.com/901264): Encoders use hack for passing offset + # within a DMA-buf, which is not supported upstream. +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0003-Add-mmap-via-libv4l-to-generic_v4l2_device.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0003-Add-mmap-via-libv4l-to-generic_v4l2_device.patch new file mode 100644 index 0000000000000000000000000000000000000000..05b6e1f14910950ab4606e83058c0df31c4eb4f5 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0003-Add-mmap-via-libv4l-to-generic_v4l2_device.patch @@ -0,0 +1,49 @@ +From d22c07d861abd712615d3c477166ff185ca09c57 Mon Sep 17 00:00:00 2001 +From: Damian Hobson-Garcia +Date: Wed, 21 Mar 2018 13:18:17 +0200 +Subject: [PATCH 03/18] Add mmap via libv4l to generic_v4l2_device + +Issue #437 +--- + media/gpu/v4l2/generic_v4l2_device.cc | 10 ++++++++++ + media/gpu/v4l2/v4l2.sig | 2 ++ + 2 files changed, 12 insertions(+) + +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index 9238385fb..606db8e73 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -120,10 +120,20 @@ void* GenericV4L2Device::Mmap(void* addr, + int flags, + unsigned int offset) { + DCHECK(device_fd_.is_valid()); ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_mmap(addr, len, prot, flags, device_fd_.get(), offset); ++#endif + return mmap(addr, len, prot, flags, device_fd_.get(), offset); + } + + void GenericV4L2Device::Munmap(void* addr, unsigned int len) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) { ++ v4l2_munmap(addr, len); ++ return; ++ } ++#endif + munmap(addr, len); + } + +diff --git a/media/gpu/v4l2/v4l2.sig b/media/gpu/v4l2/v4l2.sig +index 32931df37..8f1894536 100644 +--- a/media/gpu/v4l2/v4l2.sig ++++ b/media/gpu/v4l2/v4l2.sig +@@ -8,3 +8,5 @@ + LIBV4L_PUBLIC int v4l2_close(int fd); + LIBV4L_PUBLIC int v4l2_ioctl(int fd, unsigned long int request, ...); + LIBV4L_PUBLIC int v4l2_fd_open(int fd, int v4l2_flags); ++LIBV4L_PUBLIC void *v4l2_mmap(void *start, size_t length, int prot, int flags, int fd, int64_t offset); ++LIBV4L_PUBLIC int v4l2_munmap(void *_start, size_t length); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0004-media-capture-linux-Support-libv4l2-plugins.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0004-media-capture-linux-Support-libv4l2-plugins.patch new file mode 100644 index 0000000000000000000000000000000000000000..e6cabc3e2f974c9cb153a83187ec6918e187a259 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0004-media-capture-linux-Support-libv4l2-plugins.patch @@ -0,0 +1,178 @@ +From 088bbd0b7e7c88a434c7d28b3c146326d81205ef Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 1 Jul 2019 10:37:35 +0800 +Subject: [PATCH 04/18] media: capture: linux: Support libv4l2 plugins + +Allow using libv4l2 plugins for linux v4l2 capture devices. + +Signed-off-by: Jeffy Chen +--- + media/capture/BUILD.gn | 14 +++++ + .../video/linux/v4l2_capture_device_impl.cc | 52 ++++++++++++++++++- + .../video/linux/v4l2_capture_device_impl.h | 11 ++++ + 3 files changed, 76 insertions(+), 1 deletion(-) + +diff --git a/media/capture/BUILD.gn b/media/capture/BUILD.gn +index 3e6bfcbff..3270fa19b 100644 +--- a/media/capture/BUILD.gn ++++ b/media/capture/BUILD.gn +@@ -2,6 +2,7 @@ + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. + ++import("//build/buildflag_header.gni") + import("//build/config/chromeos/ui_mode.gni") + import("//build/config/features.gni") + import("//build/config/ui.gni") +@@ -18,6 +19,14 @@ group("capture") { + ] + } + ++buildflag_header("buildflags") { ++ header = "buildflags.h" ++ ++ flags = [ ++ "USE_LIBV4L2=$use_v4lplugin", ++ ] ++} ++ + component("capture_switches") { + defines = [ "CAPTURE_IMPLEMENTATION" ] + sources = [ +@@ -272,6 +281,11 @@ component("capture_lib") { + "video/linux/video_capture_device_linux.cc", + "video/linux/video_capture_device_linux.h", + ] ++ public_deps += [ ":buildflags" ] ++ ++ if (use_v4lplugin) { ++ deps += [ "//media/gpu/v4l2:libv4l2_stubs" ] ++ } + } + + if (is_chromeos_ash) { +diff --git a/media/capture/video/linux/v4l2_capture_device_impl.cc b/media/capture/video/linux/v4l2_capture_device_impl.cc +index c8a49b3f0..a59d16492 100644 +--- a/media/capture/video/linux/v4l2_capture_device_impl.cc ++++ b/media/capture/video/linux/v4l2_capture_device_impl.cc +@@ -10,19 +10,61 @@ + #include + #include + ++#if BUILDFLAG(USE_LIBV4L2) ++// Auto-generated for dlopen libv4l2 libraries ++#include "media/gpu/v4l2/v4l2_stubs.h" ++#include "third_party/v4l-utils/lib/include/libv4l2.h" ++ ++#include "base/files/file_path.h" ++ ++using media_gpu_v4l2::kModuleV4l2; ++using media_gpu_v4l2::InitializeStubs; ++using media_gpu_v4l2::StubPathMap; ++ ++static const base::FilePath::CharType kV4l2Lib[] = ++ FILE_PATH_LITERAL("/usr/lib/libv4l2.so"); ++#endif ++ + namespace media { + + V4L2CaptureDeviceImpl::~V4L2CaptureDeviceImpl() = default; + ++V4L2CaptureDeviceImpl::V4L2CaptureDeviceImpl() { ++#if BUILDFLAG(USE_LIBV4L2) ++ StubPathMap paths; ++ paths[kModuleV4l2].push_back(kV4l2Lib); ++ ++ has_libv4l2_ = InitializeStubs(paths); ++#endif ++} ++ + int V4L2CaptureDeviceImpl::open(const char* device_name, int flags) { +- return ::open(device_name, flags); ++ int fd = ::open64(device_name, flags); ++ if (fd < 0) ++ return fd; ++ ++#if BUILDFLAG(USE_LIBV4L2) ++ use_libv4l2_ = false; ++ if (has_libv4l2_ && v4l2_fd_open(fd, V4L2_DISABLE_CONVERSION) != -1) { ++ use_libv4l2_ = true; ++ } ++#endif ++ return fd; + } + + int V4L2CaptureDeviceImpl::close(int fd) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_close(fd); ++#endif + return ::close(fd); + } + + int V4L2CaptureDeviceImpl::ioctl(int fd, int request, void* argp) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_ioctl(fd, request, argp); ++#endif + return ::ioctl(fd, request, argp); + } + +@@ -32,10 +74,18 @@ void* V4L2CaptureDeviceImpl::mmap(void* start, + int flags, + int fd, + off_t offset) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_mmap(start, length, prot, flags, fd, offset); ++#endif + return ::mmap(start, length, prot, flags, fd, offset); + } + + int V4L2CaptureDeviceImpl::munmap(void* start, size_t length) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_munmap(start, length); ++#endif + return ::munmap(start, length); + } + +diff --git a/media/capture/video/linux/v4l2_capture_device_impl.h b/media/capture/video/linux/v4l2_capture_device_impl.h +index 7bfc98414..b321d3cc6 100644 +--- a/media/capture/video/linux/v4l2_capture_device_impl.h ++++ b/media/capture/video/linux/v4l2_capture_device_impl.h +@@ -8,6 +8,7 @@ + #include + #include + ++#include "media/capture/buildflags.h" + #include "media/capture/capture_export.h" + #include "media/capture/video/linux/v4l2_capture_device.h" + +@@ -17,6 +18,8 @@ namespace media { + // V4L2 APIs. + class CAPTURE_EXPORT V4L2CaptureDeviceImpl : public V4L2CaptureDevice { + public: ++ V4L2CaptureDeviceImpl(); ++ + int open(const char* device_name, int flags) override; + int close(int fd) override; + int ioctl(int fd, int request, void* argp) override; +@@ -32,6 +35,14 @@ class CAPTURE_EXPORT V4L2CaptureDeviceImpl : public V4L2CaptureDevice { + + private: + ~V4L2CaptureDeviceImpl() override; ++ ++#if BUILDFLAG(USE_LIBV4L2) ++ // Has libv4l2. ++ bool has_libv4l2_; ++ // Use libv4l2 when operating |fd|. ++ bool use_libv4l2_; ++#endif ++ + }; + + } // namespace media +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0005-cld3-Avoid-unaligned-accesses.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0005-cld3-Avoid-unaligned-accesses.patch new file mode 100644 index 0000000000000000000000000000000000000000..f1e474346235e27837125b81c0ae7462a2415709 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0005-cld3-Avoid-unaligned-accesses.patch @@ -0,0 +1,46 @@ +From f241a491490c948e253f34765e3f0a055ba75bee Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 27 Mar 2020 17:48:20 +0800 +Subject: [PATCH 05/18] cld3: Avoid unaligned accesses + +Although the unaligned memory accesses are enabled, somehow i still hit +the SIGBUS: +[23496.643138] Unhandled fault: alignment fault (0x92000021) at 0x00000000b182e636 +Received signal 7 BUS_ADRALN 0000b182e636 + +Signed-off-by: Jeffy Chen +--- + third_party/cld_3/src/src/script_span/port.h | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/third_party/cld_3/src/src/script_span/port.h b/third_party/cld_3/src/src/script_span/port.h +index 2b3bc515a..1d437babf 100644 +--- a/third_party/cld_3/src/src/script_span/port.h ++++ b/third_party/cld_3/src/src/script_span/port.h +@@ -78,11 +78,23 @@ namespace CLD2 { + // + // This is a mess, but there's not much we can do about it. + ++#if 0 + #define UNALIGNED_LOAD16(_p) (*reinterpret_cast(_p)) + #define UNALIGNED_LOAD32(_p) (*reinterpret_cast(_p)) + + #define UNALIGNED_STORE16(_p, _val) (*reinterpret_cast(_p) = (_val)) + #define UNALIGNED_STORE32(_p, _val) (*reinterpret_cast(_p) = (_val)) ++#else ++inline uint32 UNALIGNED_LOAD32(const void *p) { ++ uint32 t; ++ memcpy(&t, p, sizeof t); ++ return t; ++} ++ ++inline void UNALIGNED_STORE32(void *p, uint32 v) { ++ memcpy(p, &v, sizeof v); ++} ++#endif + + // TODO(sesse): NEON supports unaligned 64-bit loads and stores. + // See if that would be more efficient on platforms supporting it, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0006-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0006-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch new file mode 100644 index 0000000000000000000000000000000000000000..952c7a47000daa1bfa4668647bb9a10ebcc6e84e --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0006-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch @@ -0,0 +1,29 @@ +From 345092ade3606cf709dff8fdbc0a58b3355cf20e Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 10 Apr 2020 16:16:08 +0800 +Subject: [PATCH 06/18] media: gpu: v4l2: Use POLLIN for pending event + +The v4l-rkmpp is using eventfd to fake poll events which not supporting +POLLPRI. + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/generic_v4l2_device.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index 606db8e73..abbf2e574 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -110,7 +110,7 @@ bool GenericV4L2Device::Poll(bool poll_device, bool* event_pending) { + VPLOGF(1) << "poll() failed"; + return false; + } +- *event_pending = (pollfd != -1 && pollfds[pollfd].revents & POLLPRI); ++ *event_pending = (pollfd != -1 && pollfds[pollfd].revents & POLLIN); + return true; + } + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0007-media-capture-linux-Prefer-using-the-first-device.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0007-media-capture-linux-Prefer-using-the-first-device.patch new file mode 100644 index 0000000000000000000000000000000000000000..4355c468e7b85f99f17e86061e93a51c190015c6 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0007-media-capture-linux-Prefer-using-the-first-device.patch @@ -0,0 +1,32 @@ +From 86f7197655a5cd795218e8998546ce0de3c333d9 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 5 Nov 2020 12:22:52 +0800 +Subject: [PATCH 07/18] media: capture: linux: Prefer using the first device + +Somehow the newest chromium would prefer using the last device in some +cases, e.g. apprtc. + +Let's reverse the device array to workaround it. + +Signed-off-by: Jeffy Chen +--- + .../capture/video/linux/video_capture_device_factory_linux.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/media/capture/video/linux/video_capture_device_factory_linux.cc b/media/capture/video/linux/video_capture_device_factory_linux.cc +index a726e2ff5..bbbd6cc9e 100644 +--- a/media/capture/video/linux/video_capture_device_factory_linux.cc ++++ b/media/capture/video/linux/video_capture_device_factory_linux.cc +@@ -198,7 +198,8 @@ void VideoCaptureDeviceFactoryLinux::GetDevicesInfo( + continue; + } + +- devices_info.emplace_back(VideoCaptureDeviceDescriptor( ++ // HACK: Somehow the newest chromium would prefer using the last device in some cases, e.g. apprtc ++ devices_info.emplace(devices_info.begin(), VideoCaptureDeviceDescriptor( + display_name, unique_id, model_id, + VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE, GetControlSupport(fd.get()), + VideoCaptureTransportType::OTHER_TRANSPORT, facing_mode)); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0008-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0008-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch new file mode 100644 index 0000000000000000000000000000000000000000..fc05a281b4bb028f83d1d668b4649c0a62cce0e4 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0008-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch @@ -0,0 +1,67 @@ +From e4da759b9a3c52babece10938689c649c3f16835 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 28 Sep 2020 20:02:00 +0800 +Subject: [PATCH 08/18] media: gpu: v4l2: Fix compile error when ozone not + enabled + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/BUILD.gn | 5 ++++- + media/gpu/v4l2/generic_v4l2_device.cc | 7 +++++++ + 2 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn +index e4e05249b..c2b3ce87f 100644 +--- a/media/gpu/v4l2/BUILD.gn ++++ b/media/gpu/v4l2/BUILD.gn +@@ -116,9 +116,12 @@ source_set("v4l2") { + "//media/parsers", + "//third_party/libyuv", + "//ui/gfx/geometry", +- "//ui/ozone", + ] + ++ if (use_ozone) { ++ deps += [ "//ui/ozone" ] ++ } ++ + if (is_chromeos_ash) { + sources += [ + "v4l2_jpeg_encode_accelerator.cc", +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index abbf2e574..c623f5380 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -33,8 +33,11 @@ + #include "ui/gl/egl_util.h" + #include "ui/gl/gl_bindings.h" + #include "ui/gl/gl_image_native_pixmap.h" ++ ++#if defined(USE_OZONE) + #include "ui/ozone/public/ozone_platform.h" + #include "ui/ozone/public/surface_factory_ozone.h" ++#endif + + // Auto-generated for dlopen libv4l2 libraries + #include "media/gpu/v4l2/v4l2_stubs.h" +@@ -295,6 +298,9 @@ scoped_refptr GenericV4L2Device::CreateGLImage( + const gfx::Size& size, + const Fourcc fourcc, + gfx::NativePixmapHandle handle) const { ++#if !defined(USE_OZONE) ++ return nullptr; ++#else + DVLOGF(3); + DCHECK(CanCreateEGLImageFrom(fourcc)); + +@@ -329,6 +335,7 @@ scoped_refptr GenericV4L2Device::CreateGLImage( + gl::GLImageNativePixmap::Create(size, buffer_format, std::move(pixmap)); + DCHECK(image); + return image; ++#endif + } + + EGLBoolean GenericV4L2Device::DestroyEGLImage(EGLDisplay egl_display, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0009-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0009-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch new file mode 100644 index 0000000000000000000000000000000000000000..223969f8e1320581077c9e26ed23d9a248a45ada --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0009-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch @@ -0,0 +1,29 @@ +From b9d7819e223d0239d983a1da4386351268ad8572 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 20 May 2021 01:05:29 +0800 +Subject: [PATCH 09/18] ui: events: ozone: Define SW_PEN_INSERTED for old + kernel headers + +Signed-off-by: Jeffy Chen +--- + ui/events/ozone/evdev/event_converter_evdev_impl.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/ui/events/ozone/evdev/event_converter_evdev_impl.cc b/ui/events/ozone/evdev/event_converter_evdev_impl.cc +index 9319022c8..a1a82d51d 100644 +--- a/ui/events/ozone/evdev/event_converter_evdev_impl.cc ++++ b/ui/events/ozone/evdev/event_converter_evdev_impl.cc +@@ -31,6 +31,10 @@ namespace { + const int kKeyReleaseValue = 0; + const int kKeyRepeatValue = 2; + ++#ifndef SW_PEN_INSERTED ++#define SW_PEN_INSERTED 0x0f /* set = pen inserted */ ++#endif ++ + // Values for the EV_SW code. + const int kSwitchStylusInserted = SW_PEN_INSERTED; + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0010-Create-new-fence-when-there-s-no-in-fences.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0010-Create-new-fence-when-there-s-no-in-fences.patch new file mode 100644 index 0000000000000000000000000000000000000000..4360c02b195e456620a80c5ea7adc44e3ffd2ebf --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0010-Create-new-fence-when-there-s-no-in-fences.patch @@ -0,0 +1,62 @@ +From 762fd9a6ef1aabb5917f5ba5412c1e7561b85674 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 01:29:11 +0800 +Subject: [PATCH 10/18] Create new fence when there's no in-fences + +There're cases that in-fences are not provided. + +Signed-off-by: Jeffy Chen +--- + .../wayland/gpu/gbm_surfaceless_wayland.cc | 21 +++++++++++++++++-- + 1 file changed, 19 insertions(+), 2 deletions(-) + +diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +index 5bfc19ef9..a2aecf88f 100644 +--- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc ++++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +@@ -33,6 +33,12 @@ static constexpr size_t kMaxSolidColorBuffers = 12; + + static constexpr gfx::Size kSolidColorBufferSize{4, 4}; + ++void WaitForEGLFence(EGLDisplay display, EGLSyncKHR fence) { ++ eglClientWaitSyncKHR(display, fence, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, ++ EGL_FOREVER_KHR); ++ eglDestroySyncKHR(display, fence); ++} ++ + void WaitForGpuFences(std::vector> fences) { + for (auto& fence : fences) + fence->Wait(); +@@ -201,8 +207,9 @@ void GbmSurfacelessWayland::Present(SwapCompletionCallback completion_callback, + return; + } + +- base::OnceClosure fence_wait_task; + std::vector> fences; ++ // Uset in-fences provided in the overlays. If there are none, we insert our ++ // own fence and wait. + for (auto& config : frame->configs) { + if (!config.access_fence_handle.is_null()) { + fences.push_back(std::make_unique( +@@ -211,7 +218,17 @@ void GbmSurfacelessWayland::Present(SwapCompletionCallback completion_callback, + } + } + +- fence_wait_task = base::BindOnce(&WaitForGpuFences, std::move(fences)); ++ base::OnceClosure fence_wait_task; ++ if (!fences.empty()) { ++ fence_wait_task = base::BindOnce(&WaitForGpuFences, std::move(fences)); ++ } else { ++ // TODO(fangzhoug): the following should be replaced by a per surface flush ++ // as it gets implemented in GL drivers. ++ EGLSyncKHR fence = InsertFence(has_implicit_external_sync_); ++ CHECK_NE(fence, EGL_NO_SYNC_KHR) << "eglCreateSyncKHR failed"; ++ ++ fence_wait_task = base::BindOnce(&WaitForEGLFence, GetDisplay(), fence); ++ } + + base::OnceClosure fence_retired_callback = base::BindOnce( + &GbmSurfacelessWayland::FenceRetired, weak_factory_.GetWeakPtr(), frame); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0011-HACK-ozone-wayland-Force-disable-implicit-external-s.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0011-HACK-ozone-wayland-Force-disable-implicit-external-s.patch new file mode 100644 index 0000000000000000000000000000000000000000..5dbc70cebf206e61fe7095ca33411ad5ca5eaaae --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0011-HACK-ozone-wayland-Force-disable-implicit-external-s.patch @@ -0,0 +1,34 @@ +From e6624efbd547feaffd5aec7db9f194adbd8a203e Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 01:41:57 +0800 +Subject: [PATCH 11/18] HACK: [ozone/wayland]: Force disable implicit external + sync + +The Mali's implicit external sync seems broken. + +Signed-off-by: Jeffy Chen +--- + ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +index a2aecf88f..5fcd5fe4b 100644 +--- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc ++++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +@@ -224,10 +224,11 @@ void GbmSurfacelessWayland::Present(SwapCompletionCallback completion_callback, + } else { + // TODO(fangzhoug): the following should be replaced by a per surface flush + // as it gets implemented in GL drivers. +- EGLSyncKHR fence = InsertFence(has_implicit_external_sync_); ++ // HACK: The Mali's implicit external sync seems broken. ++ EGLSyncKHR fence = InsertFence(/* has_implicit_external_sync_ */ false); + CHECK_NE(fence, EGL_NO_SYNC_KHR) << "eglCreateSyncKHR failed"; + +- fence_wait_task = base::BindOnce(&WaitForEGLFence, GetDisplay(), fence); ++ fence_wait_task = base::BindOnce(&WaitForEGLFence, GetEGLDisplay(), fence); + } + + base::OnceClosure fence_retired_callback = base::BindOnce( +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0012-HACK-media-capture-linux-Allow-camera-without-suppor.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0012-HACK-media-capture-linux-Allow-camera-without-suppor.patch new file mode 100644 index 0000000000000000000000000000000000000000..a95d3978723e6296c07dbaf57f12fa1d6dc27889 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0012-HACK-media-capture-linux-Allow-camera-without-suppor.patch @@ -0,0 +1,35 @@ +From b246955a142dd919e26659aa7695302bd7adc08d Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 07:25:58 +0800 +Subject: [PATCH 12/18] HACK: media: capture: linux: Allow camera without + supported format + +The chromium would only accept discrete frame sizes. + +Hack it to make Rockchip ISP camera working. + +Signed-off-by: Jeffy Chen +--- + .../video/linux/video_capture_device_factory_linux.cc | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/media/capture/video/linux/video_capture_device_factory_linux.cc b/media/capture/video/linux/video_capture_device_factory_linux.cc +index bbbd6cc9e..4f2bc62c3 100644 +--- a/media/capture/video/linux/video_capture_device_factory_linux.cc ++++ b/media/capture/video/linux/video_capture_device_factory_linux.cc +@@ -193,10 +193,8 @@ void VideoCaptureDeviceFactoryLinux::GetDevicesInfo( + + VideoCaptureFormats supported_formats; + GetSupportedFormatsForV4L2BufferType(fd.get(), &supported_formats); +- if (supported_formats.empty()) { +- DVLOG(1) << "No supported formats: " << unique_id; +- continue; +- } ++ if (supported_formats.empty()) ++ LOG(WARNING) << "No supported formats: " << unique_id; + + // HACK: Somehow the newest chromium would prefer using the last device in some cases, e.g. apprtc + devices_info.emplace(devices_info.begin(), VideoCaptureDeviceDescriptor( +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0013-content-gpu-Only-depend-dri-for-X11.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0013-content-gpu-Only-depend-dri-for-X11.patch new file mode 100644 index 0000000000000000000000000000000000000000..cdf1fe98f263faf11904a4bd9a3fc792fe108848 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0013-content-gpu-Only-depend-dri-for-X11.patch @@ -0,0 +1,26 @@ +From c7dfab48947b0c3dac4560d796ff6d85abebc686 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 22 Nov 2021 15:59:49 +0800 +Subject: [PATCH 13/18] content: gpu: Only depend dri for X11 + +Signed-off-by: Jeffy Chen +--- + content/gpu/BUILD.gn | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/content/gpu/BUILD.gn b/content/gpu/BUILD.gn +index 9f5f303b2..524b257aa 100644 +--- a/content/gpu/BUILD.gn ++++ b/content/gpu/BUILD.gn +@@ -138,7 +138,7 @@ target(link_target_type, "gpu_sources") { + + # Use DRI on desktop Linux builds. + if (current_cpu != "s390x" && current_cpu != "ppc64" && is_linux && +- !is_castos) { ++ !is_castos && ozone_platform_x11) { + configs += [ "//build/config/linux/dri" ] + } + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0014-HACK-media-Disable-chromeos-direct-video-decoder-by-.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0014-HACK-media-Disable-chromeos-direct-video-decoder-by-.patch new file mode 100644 index 0000000000000000000000000000000000000000..272973d11227cc7e4a1416b89f1857f372551be1 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0014-HACK-media-Disable-chromeos-direct-video-decoder-by-.patch @@ -0,0 +1,30 @@ +From 5ef545e95cdf158131162e686dfdff28fbf131e2 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 16 Mar 2022 12:14:02 +0800 +Subject: [PATCH 14/18] HACK: media: Disable chromeos direct video decoder by + default + +Revisit once V4L2 video decoder is supported on linux. + +Signed-off-by: Jeffy Chen +--- + media/base/media_switches.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc +index c4e128757..b3f1b1069 100644 +--- a/media/base/media_switches.cc ++++ b/media/base/media_switches.cc +@@ -1029,7 +1029,8 @@ BASE_FEATURE(kChromeOSHWVBREncoding, + // TODO(b/159825227): remove when the direct video decoder is fully launched. + BASE_FEATURE(kUseChromeOSDirectVideoDecoder, + "UseChromeOSDirectVideoDecoder", +- base::FEATURE_ENABLED_BY_DEFAULT); ++ // base::FEATURE_ENABLED_BY_DEFAULT); ++ base::FEATURE_DISABLED_BY_DEFAULT); + + // Limit the number of concurrent hardware decoder instances on ChromeOS. + BASE_FEATURE(kLimitConcurrentDecoderInstances, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0015-media-Support-HEVC-in-V4L2-VDA.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0015-media-Support-HEVC-in-V4L2-VDA.patch new file mode 100644 index 0000000000000000000000000000000000000000..39af1ea393a5286dfa72900b55dba9d2418815fa --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0015-media-Support-HEVC-in-V4L2-VDA.patch @@ -0,0 +1,54 @@ +From ca4b14601d434ffa709664593e67987c8ac39c3c Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 9 Sep 2022 16:06:58 +0800 +Subject: [PATCH 15/18] media: Support HEVC in V4L2 VDA + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/v4l2_device.cc | 9 +++++++++ + media/gpu/v4l2/v4l2_video_decode_accelerator.cc | 2 +- + 2 files changed, 10 insertions(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/v4l2_device.cc b/media/gpu/v4l2/v4l2_device.cc +index 090863ce6..fc719957d 100644 +--- a/media/gpu/v4l2/v4l2_device.cc ++++ b/media/gpu/v4l2/v4l2_device.cc +@@ -1578,6 +1578,8 @@ uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + + if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { + return V4L2_PIX_FMT_H264; ++ } else if (profile >= HEVCPROFILE_MIN && profile <= HEVCPROFILE_MAX) { ++ return V4L2_PIX_FMT_HEVC; + } else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) { + return V4L2_PIX_FMT_VP8; + } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) { +@@ -1797,6 +1799,13 @@ std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + H264PROFILE_HIGH, + }; + break; ++ case V4L2_PIX_FMT_HEVC: ++ profiles = { ++ HEVCPROFILE_MAIN, ++ HEVCPROFILE_MAIN10, ++ HEVCPROFILE_MAIN_STILL_PICTURE, ++ }; ++ break; + case V4L2_PIX_FMT_VP8: + profiles = {VP8PROFILE_ANY}; + break; +diff --git a/media/gpu/v4l2/v4l2_video_decode_accelerator.cc b/media/gpu/v4l2/v4l2_video_decode_accelerator.cc +index a71e272e8..539908bf4 100644 +--- a/media/gpu/v4l2/v4l2_video_decode_accelerator.cc ++++ b/media/gpu/v4l2/v4l2_video_decode_accelerator.cc +@@ -86,7 +86,7 @@ bool IsVp9KSVCStream(uint32_t input_format_fourcc, + + // static + const uint32_t V4L2VideoDecodeAccelerator::supported_input_fourccs_[] = { +- V4L2_PIX_FMT_H264, V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, ++ V4L2_PIX_FMT_H264, V4L2_PIX_FMT_HEVC, V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, + }; + + // static +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0016-media-gpu-chromeos-Define-new-formats-for-old-kernel.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0016-media-gpu-chromeos-Define-new-formats-for-old-kernel.patch new file mode 100644 index 0000000000000000000000000000000000000000..6bff6fb5d648c99db659b884c81e7afb717f8bbe --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0016-media-gpu-chromeos-Define-new-formats-for-old-kernel.patch @@ -0,0 +1,36 @@ +From 854b12c19a6f2dfc213bb307540c2c6aca3fd2e0 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 9 Sep 2022 18:54:08 +0800 +Subject: [PATCH 16/18] media: gpu: chromeos: Define new formats for old kernel + +Signed-off-by: Jeffy Chen +--- + media/gpu/chromeos/fourcc.h | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/media/gpu/chromeos/fourcc.h b/media/gpu/chromeos/fourcc.h +index b1f0907c4..88f28dd0f 100644 +--- a/media/gpu/chromeos/fourcc.h ++++ b/media/gpu/chromeos/fourcc.h +@@ -13,6 +13,18 @@ + #include "media/gpu/media_gpu_export.h" + #include "third_party/abseil-cpp/absl/types/optional.h" + ++#ifndef V4L2_PIX_FMT_MT21C ++#define V4L2_PIX_FMT_MT21C v4l2_fourcc('M', 'T', '2', '1') /* Mediatek compressed block mode */ ++#endif ++ ++#ifndef V4L2_PIX_FMT_VP9 ++#define V4L2_PIX_FMT_VP9 v4l2_fourcc('V', 'P', '9', '0') /* VP9 */ ++#endif ++ ++#ifndef V4L2_PIX_FMT_HEVC ++#define V4L2_PIX_FMT_HEVC v4l2_fourcc('H', 'E', 'V', 'C') /* HEVC */ ++#endif ++ + namespace media { + + // Composes a Fourcc value. +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0017-media-Support-AV1-in-V4L2-VDA.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0017-media-Support-AV1-in-V4L2-VDA.patch new file mode 100644 index 0000000000000000000000000000000000000000..00718326a27255b5f4dc0fa09fd98dcab461367d --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0017-media-Support-AV1-in-V4L2-VDA.patch @@ -0,0 +1,82 @@ +From e42483f06ae602945631ff8fc6bd370590f8e015 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 13 Feb 2023 15:50:20 +0800 +Subject: [PATCH 17/18] media: Support AV1 in V4L2 VDA + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/v4l2_device.cc | 9 +++++++++ + media/gpu/v4l2/v4l2_vda_helpers.cc | 3 +++ + media/gpu/v4l2/v4l2_video_decode_accelerator.cc | 2 +- + media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc | 1 + + 4 files changed, 14 insertions(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/v4l2_device.cc b/media/gpu/v4l2/v4l2_device.cc +index fc719957d..18d5d1a4c 100644 +--- a/media/gpu/v4l2/v4l2_device.cc ++++ b/media/gpu/v4l2/v4l2_device.cc +@@ -1584,6 +1584,8 @@ uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + return V4L2_PIX_FMT_VP8; + } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) { + return V4L2_PIX_FMT_VP9; ++ } else if (profile >= AV1PROFILE_MIN && profile <= AV1PROFILE_MAX) { ++ return V4L2_PIX_FMT_AV1; + } else { + DVLOGF(1) << "Unsupported profile: " << GetProfileName(profile); + return 0; +@@ -1812,6 +1814,13 @@ std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + case V4L2_PIX_FMT_VP9: + profiles = {VP9PROFILE_PROFILE0}; + break; ++ case V4L2_PIX_FMT_AV1: ++ profiles = { ++ AV1PROFILE_PROFILE_MAIN, ++ AV1PROFILE_PROFILE_HIGH, ++ AV1PROFILE_PROFILE_PRO, ++ }; ++ break; + default: + VLOGF(1) << "Unhandled pixelformat " << FourccToString(pix_fmt); + return {}; +diff --git a/media/gpu/v4l2/v4l2_vda_helpers.cc b/media/gpu/v4l2/v4l2_vda_helpers.cc +index 1fda578eb..1233b1355 100644 +--- a/media/gpu/v4l2/v4l2_vda_helpers.cc ++++ b/media/gpu/v4l2/v4l2_vda_helpers.cc +@@ -162,6 +162,9 @@ InputBufferFragmentSplitter::CreateFromProfile( + case VideoCodec::kVP9: + // VP8/VP9 don't need any frame splitting, use the default implementation. + return std::make_unique(); ++ case VideoCodec::kAV1: ++ // Depends on downstream frame splitting, use the default implementation. ++ return std::make_unique(); + default: + LOG(ERROR) << "Unhandled profile: " << profile; + return nullptr; +diff --git a/media/gpu/v4l2/v4l2_video_decode_accelerator.cc b/media/gpu/v4l2/v4l2_video_decode_accelerator.cc +index 539908bf4..d67fdbaad 100644 +--- a/media/gpu/v4l2/v4l2_video_decode_accelerator.cc ++++ b/media/gpu/v4l2/v4l2_video_decode_accelerator.cc +@@ -86,7 +86,7 @@ bool IsVp9KSVCStream(uint32_t input_format_fourcc, + + // static + const uint32_t V4L2VideoDecodeAccelerator::supported_input_fourccs_[] = { +- V4L2_PIX_FMT_H264, V4L2_PIX_FMT_HEVC, V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, ++ V4L2_PIX_FMT_H264, V4L2_PIX_FMT_HEVC, V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, V4L2_PIX_FMT_AV1, + }; + + // static +diff --git a/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc b/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc +index 22b99e4d2..9d5fa1f91 100644 +--- a/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc ++++ b/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc +@@ -776,6 +776,7 @@ bool V4L2StatefulVideoDecoderBackend::IsSupportedProfile( + #endif // BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER) + V4L2_PIX_FMT_VP8, + V4L2_PIX_FMT_VP9, ++ V4L2_PIX_FMT_AV1, + }; + scoped_refptr device = V4L2Device::Create(); + VideoDecodeAccelerator::SupportedProfiles profiles = +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0018-media-gpu-sandbox-Only-depend-dri-for-X11.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0018-media-gpu-sandbox-Only-depend-dri-for-X11.patch new file mode 100644 index 0000000000000000000000000000000000000000..0949b6b9a9cfca038337336da0d84780c74a0b88 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_111.0.5563/0018-media-gpu-sandbox-Only-depend-dri-for-X11.patch @@ -0,0 +1,26 @@ +From 1fb6887173a03d8de321f429f35d1b2895f3e6bf Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 20 Mar 2023 15:00:44 +0800 +Subject: [PATCH 18/18] media: gpu: sandbox: Only depend dri for X11 + +Signed-off-by: Jeffy Chen +--- + media/gpu/sandbox/BUILD.gn | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/media/gpu/sandbox/BUILD.gn b/media/gpu/sandbox/BUILD.gn +index cfcb7fa80..8d8cd0455 100644 +--- a/media/gpu/sandbox/BUILD.gn ++++ b/media/gpu/sandbox/BUILD.gn +@@ -31,7 +31,7 @@ source_set("sandbox") { + deps += [ "//media/gpu/v4l2" ] + } + if (current_cpu != "s390x" && current_cpu != "ppc64" && is_linux && +- !is_castos) { ++ !is_castos && ozone_platform_x11) { + # For DRI_DRIVER_DIR. + configs += [ "//build/config/linux/dri" ] + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0001-Add-support-for-V4L2VDA-on-Linux.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0001-Add-support-for-V4L2VDA-on-Linux.patch new file mode 100644 index 0000000000000000000000000000000000000000..b8b26c5baa84646fbabdcb47af6b171212dfbd6a --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0001-Add-support-for-V4L2VDA-on-Linux.patch @@ -0,0 +1,473 @@ +From dede45519fc653a708ce4ce934d737210f017219 Mon Sep 17 00:00:00 2001 +From: Maksim Sisov +Date: Wed, 31 Jul 2019 09:56:24 +0300 +Subject: [PATCH 01/14] Add support for V4L2VDA on Linux + +This patch enables hardware assisted video decoding via the +Chromium V4L2VDA. Including changes when Linux is used. In +order to use this, use_linux_v4l2_only flag should be set +to true. + +Signed-off-by: Ryo Kodama + +fixup! avoid building not declared formats + +"FRAME", "_SLICE", "V4L2_PIX_FMT_VP9" are not defined in mainline + Linux headers. This patch avoids building these formats. + +Signed-off-by: Ryo Kodama + +fixup! add V4L2_PIX_FMT_VP9 support back again as it is now +included in mainline Linux kernel. This allows VP9 codec +to work with upstream kernel and v4l2 vda. Tested on db820c +with Venus v4l2 driver. + +Signed-off-by: Peter Griffin +Signed-off-by: Stanimir Varbanov +Signed-off-by: Jeffy Chen +--- + .../gpu_mjpeg_decode_accelerator_factory.cc | 3 +- + media/gpu/BUILD.gn | 1 + + media/gpu/args.gni | 4 ++ + .../gpu_video_decode_accelerator_factory.cc | 8 +++ + .../gpu_video_decode_accelerator_factory.h | 2 + + media/gpu/v4l2/BUILD.gn | 48 ++++++++------ + media/gpu/v4l2/generic_v4l2_device.cc | 4 ++ + media/gpu/v4l2/v4l2_device.cc | 66 +++++++++++++++++++ + media/gpu/v4l2/v4l2_video_decoder.cc | 7 ++ + 9 files changed, 121 insertions(+), 22 deletions(-) + +diff --git a/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc b/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc +index 6f319e88..4f8f0b7d 100644 +--- a/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc ++++ b/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc +@@ -13,7 +13,8 @@ + #include "media/base/media_switches.h" + #include "media/gpu/buildflags.h" + +-#if BUILDFLAG(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY) ++#if BUILDFLAG(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY) && \ ++ !BUILDFLAG(USE_LINUX_V4L2) + #define USE_V4L2_MJPEG_DECODE_ACCELERATOR + #endif + +diff --git a/media/gpu/BUILD.gn b/media/gpu/BUILD.gn +index 3fedc789..b47052bd 100644 +--- a/media/gpu/BUILD.gn ++++ b/media/gpu/BUILD.gn +@@ -20,6 +20,7 @@ buildflag_header("buildflags") { + "USE_VAAPI_IMAGE_CODECS=$use_vaapi_image_codecs", + "USE_V4L2_CODEC=$use_v4l2_codec", + "USE_LIBV4L2=$use_v4lplugin", ++ "USE_LINUX_V4L2=$use_linux_v4l2_only", + "USE_VAAPI_X11=$use_vaapi_x11", + ] + } +diff --git a/media/gpu/args.gni b/media/gpu/args.gni +index 2f538439..bc47d2ad 100644 +--- a/media/gpu/args.gni ++++ b/media/gpu/args.gni +@@ -21,6 +21,10 @@ declare_args() { + # platforms which have v4l2 hardware encoder / decoder. + use_v4l2_codec = false + ++ # Indicates that only definitions available in the mainline linux kernel ++ # will be used. ++ use_linux_v4l2_only = false ++ + # Indicates if Video4Linux2 AML encoder is used. This is used for AML + # platforms which have v4l2 hardware encoder + use_v4l2_codec_aml = false +diff --git a/media/gpu/gpu_video_decode_accelerator_factory.cc b/media/gpu/gpu_video_decode_accelerator_factory.cc +index 0e55ef47..2096dc61 100644 +--- a/media/gpu/gpu_video_decode_accelerator_factory.cc ++++ b/media/gpu/gpu_video_decode_accelerator_factory.cc +@@ -29,7 +29,9 @@ + #include "ui/gl/gl_implementation.h" + #elif BUILDFLAG(USE_V4L2_CODEC) + #include "media/gpu/v4l2/v4l2_device.h" ++#if !BUILDFLAG(USE_LINUX_V4L2) + #include "media/gpu/v4l2/v4l2_slice_video_decode_accelerator.h" ++#endif + #include "media/gpu/v4l2/v4l2_video_decode_accelerator.h" + #include "ui/gl/gl_surface_egl.h" + #endif +@@ -64,10 +66,12 @@ gpu::VideoDecodeAcceleratorCapabilities GetDecoderCapabilitiesInternal( + GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( + V4L2VideoDecodeAccelerator::GetSupportedProfiles(), + &capabilities.supported_profiles); ++#if !BUILDFLAG(USE_LINUX_V4L2) + GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( + V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles(), + &capabilities.supported_profiles); + #endif ++#endif + #elif defined(OS_MAC) + capabilities.supported_profiles = + VTVideoDecodeAccelerator::GetSupportedProfiles(workarounds); +@@ -146,8 +150,10 @@ GpuVideoDecodeAcceleratorFactory::CreateVDA( + &GpuVideoDecodeAcceleratorFactory::CreateVaapiVDA, + #elif BUILDFLAG(USE_V4L2_CODEC) + &GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA, ++#if !BUILDFLAG(USE_LINUX_V4L2) + &GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA, + #endif ++#endif + + #if defined(OS_MAC) + &GpuVideoDecodeAcceleratorFactory::CreateVTVDA, +@@ -207,6 +213,7 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA( + return decoder; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + std::unique_ptr + GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA( + const gpu::GpuDriverBugWorkarounds& /*workarounds*/, +@@ -222,6 +229,7 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA( + return decoder; + } + #endif ++#endif + + #if defined(OS_MAC) + std::unique_ptr +diff --git a/media/gpu/gpu_video_decode_accelerator_factory.h b/media/gpu/gpu_video_decode_accelerator_factory.h +index 04125542..7ed68b34 100644 +--- a/media/gpu/gpu_video_decode_accelerator_factory.h ++++ b/media/gpu/gpu_video_decode_accelerator_factory.h +@@ -98,11 +98,13 @@ class MEDIA_GPU_EXPORT GpuVideoDecodeAcceleratorFactory { + const gpu::GpuDriverBugWorkarounds& workarounds, + const gpu::GpuPreferences& gpu_preferences, + MediaLog* media_log) const; ++#if !BUILDFLAG(USE_LINUX_V4L2) + std::unique_ptr CreateV4L2SliceVDA( + const gpu::GpuDriverBugWorkarounds& workarounds, + const gpu::GpuPreferences& gpu_preferences, + MediaLog* media_log) const; + #endif ++#endif + #if defined(OS_MAC) + std::unique_ptr CreateVTVDA( + const gpu::GpuDriverBugWorkarounds& workarounds, +diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn +index 0ac4aa4c..d7965ae5 100644 +--- a/media/gpu/v4l2/BUILD.gn ++++ b/media/gpu/v4l2/BUILD.gn +@@ -28,9 +28,6 @@ source_set("v4l2") { + "buffer_affinity_tracker.h", + "generic_v4l2_device.cc", + "generic_v4l2_device.h", +- "v4l2_decode_surface.cc", +- "v4l2_decode_surface.h", +- "v4l2_decode_surface_handler.h", + "v4l2_device.cc", + "v4l2_device.h", + "v4l2_device_poller.cc", +@@ -39,8 +36,6 @@ source_set("v4l2") { + "v4l2_framerate_control.h", + "v4l2_image_processor_backend.cc", + "v4l2_image_processor_backend.h", +- "v4l2_slice_video_decode_accelerator.cc", +- "v4l2_slice_video_decode_accelerator.h", + "v4l2_stateful_workaround.cc", + "v4l2_stateful_workaround.h", + "v4l2_utils.cc", +@@ -49,30 +44,41 @@ source_set("v4l2") { + "v4l2_vda_helpers.h", + "v4l2_video_decode_accelerator.cc", + "v4l2_video_decode_accelerator.h", +- "v4l2_video_decoder.cc", +- "v4l2_video_decoder.h", + "v4l2_video_decoder_backend.cc", + "v4l2_video_decoder_backend.h", + "v4l2_video_decoder_backend_stateful.cc", + "v4l2_video_decoder_backend_stateful.h", +- "v4l2_video_decoder_backend_stateless.cc", +- "v4l2_video_decoder_backend_stateless.h", +- "v4l2_video_decoder_delegate_h264.cc", +- "v4l2_video_decoder_delegate_h264.h", +- "v4l2_video_decoder_delegate_h264_legacy.cc", +- "v4l2_video_decoder_delegate_h264_legacy.h", +- "v4l2_video_decoder_delegate_vp8.cc", +- "v4l2_video_decoder_delegate_vp8.h", +- "v4l2_video_decoder_delegate_vp8_legacy.cc", +- "v4l2_video_decoder_delegate_vp8_legacy.h", +- "v4l2_video_decoder_delegate_vp9_chromium.cc", +- "v4l2_video_decoder_delegate_vp9_chromium.h", +- "v4l2_video_decoder_delegate_vp9_legacy.cc", +- "v4l2_video_decoder_delegate_vp9_legacy.h", + "v4l2_video_encode_accelerator.cc", + "v4l2_video_encode_accelerator.h", + ] + ++ if (!use_linux_v4l2_only) { ++ sources += [ ++ "v4l2_decode_surface.cc", ++ "v4l2_decode_surface.h", ++ "v4l2_decode_surface_handler.h", ++ "v4l2_slice_video_decode_accelerator.cc", ++ "v4l2_slice_video_decode_accelerator.h", ++ "v4l2_video_decoder.cc", ++ "v4l2_video_decoder.h", ++ "v4l2_video_decoder_backend_stateless.cc", ++ "v4l2_video_decoder_backend_stateless.h", ++ "v4l2_video_decoder_delegate_h264.cc", ++ "v4l2_video_decoder_delegate_h264.h", ++ "v4l2_video_decoder_delegate_h264_legacy.cc", ++ "v4l2_video_decoder_delegate_h264_legacy.h", ++ "v4l2_video_decoder_delegate_vp8.cc", ++ "v4l2_video_decoder_delegate_vp8.h", ++ "v4l2_video_decoder_delegate_vp8_legacy.cc", ++ "v4l2_video_decoder_delegate_vp8_legacy.h", ++ "v4l2_video_decoder_delegate_vp9_chromium.cc", ++ "v4l2_video_decoder_delegate_vp9_chromium.h", ++ "v4l2_video_decoder_delegate_vp9_legacy.cc", ++ "v4l2_video_decoder_delegate_vp9_legacy.h", ++ ] ++ } ++ ++ + libs = [ + "EGL", + "GLESv2", +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index b64c9bd0..92ec1b60 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -441,7 +441,11 @@ bool GenericV4L2Device::OpenDevicePath(const std::string& path, Type type) { + return false; + + #if BUILDFLAG(USE_LIBV4L2) ++#if BUILDFLAG(USE_LINUX_V4L2) ++ if ( ++#else + if (type == Type::kEncoder && ++#endif + HANDLE_EINTR(v4l2_fd_open(device_fd_.get(), V4L2_DISABLE_CONVERSION)) != + -1) { + DVLOGF(3) << "Using libv4l2 for " << path; +diff --git a/media/gpu/v4l2/v4l2_device.cc b/media/gpu/v4l2/v4l2_device.cc +index 24e91471..492b64ce 100644 +--- a/media/gpu/v4l2/v4l2_device.cc ++++ b/media/gpu/v4l2/v4l2_device.cc +@@ -850,7 +850,9 @@ void V4L2WritableBufferRef::SetConfigStore(uint32_t config_store) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK(buffer_data_); + ++#if !BUILDFLAG(USE_LINUX_V4L2) + buffer_data_->v4l2_buffer_.config_store = config_store; ++#endif + } + + V4L2ReadableBuffer::V4L2ReadableBuffer(const struct v4l2_buffer& v4l2_buffer, +@@ -993,10 +995,12 @@ V4L2Queue::V4L2Queue(scoped_refptr dev, + return; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + if (reqbufs.capabilities & V4L2_BUF_CAP_SUPPORTS_REQUESTS) { + supports_requests_ = true; + DVLOGF(4) << "Queue supports request API."; + } ++#endif + } + + V4L2Queue::~V4L2Queue() { +@@ -1524,6 +1528,23 @@ scoped_refptr V4L2Device::Create() { + // static + uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + bool slice_based) { ++#if BUILDFLAG(USE_LINUX_V4L2) ++ if (slice_based) { ++ LOG(ERROR) << "Slice not supported"; ++ return 0; ++ } ++ ++ if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { ++ return V4L2_PIX_FMT_H264; ++ } else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) { ++ return V4L2_PIX_FMT_VP8; ++ } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) { ++ return V4L2_PIX_FMT_VP9; ++ } else { ++ DVLOGF(1) << "Unsupported profile: " << GetProfileName(profile); ++ return 0; ++ } ++#else + if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { + if (slice_based) + return V4L2_PIX_FMT_H264_SLICE; +@@ -1543,8 +1564,10 @@ uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + DVLOGF(1) << "Unsupported profile: " << GetProfileName(profile); + return 0; + } ++#endif + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + namespace { + + VideoCodecProfile V4L2ProfileToVideoCodecProfile(VideoCodec codec, +@@ -1591,9 +1614,11 @@ VideoCodecProfile V4L2ProfileToVideoCodecProfile(VideoCodec codec, + } + + } // namespace ++#endif + + std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + uint32_t pix_fmt) { ++#if !BUILDFLAG(USE_LINUX_V4L2) + auto get_supported_profiles = [this]( + VideoCodec codec, + std::vector* profiles) { +@@ -1664,6 +1689,27 @@ std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + VLOGF(1) << "Unhandled pixelformat " << FourccToString(pix_fmt); + return {}; + } ++#else ++ std::vector profiles; ++ switch (pix_fmt) { ++ case V4L2_PIX_FMT_H264: ++ profiles = { ++ H264PROFILE_BASELINE, ++ H264PROFILE_MAIN, ++ H264PROFILE_HIGH, ++ }; ++ break; ++ case V4L2_PIX_FMT_VP8: ++ profiles = {VP8PROFILE_ANY}; ++ break; ++ case V4L2_PIX_FMT_VP9: ++ profiles = {VP9PROFILE_PROFILE0}; ++ break; ++ default: ++ VLOGF(1) << "Unhandled pixelformat " << FourccToString(pix_fmt); ++ return {}; ++ } ++#endif + + // Erase duplicated profiles. + std::sort(profiles.begin(), profiles.end()); +@@ -2281,10 +2327,14 @@ bool V4L2Request::ApplyCtrls(struct v4l2_ext_controls* ctrls) { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + ctrls->which = V4L2_CTRL_WHICH_REQUEST_VAL; + ctrls->request_fd = request_fd_.get(); + + return true; ++#else ++ return false; ++#endif + } + + bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) { +@@ -2296,10 +2346,14 @@ bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + buffer->flags |= V4L2_BUF_FLAG_REQUEST_FD; + buffer->request_fd = request_fd_.get(); + + return true; ++#else ++ return false; ++#endif + } + + bool V4L2Request::Submit() { +@@ -2310,7 +2364,11 @@ bool V4L2Request::Submit() { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + return HANDLE_EINTR(ioctl(request_fd_.get(), MEDIA_REQUEST_IOC_QUEUE)) == 0; ++#else ++ return false; ++#endif + } + + bool V4L2Request::IsCompleted() { +@@ -2353,6 +2411,7 @@ bool V4L2Request::Reset() { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + // Reinit the request to make sure we can use it for a new submission. + if (HANDLE_EINTR(ioctl(request_fd_.get(), MEDIA_REQUEST_IOC_REINIT)) < 0) { + VPLOGF(1) << "Failed to reinit request."; +@@ -2360,6 +2419,9 @@ bool V4L2Request::Reset() { + } + + return true; ++#else ++ return false; ++#endif + } + + V4L2RequestRefBase::V4L2RequestRefBase(V4L2RequestRefBase&& req_base) { +@@ -2434,6 +2496,7 @@ V4L2RequestsQueue::~V4L2RequestsQueue() { + absl::optional V4L2RequestsQueue::CreateRequestFD() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + ++#if !BUILDFLAG(USE_LINUX_V4L2) + int request_fd; + int ret = HANDLE_EINTR( + ioctl(media_fd_.get(), MEDIA_IOC_REQUEST_ALLOC, &request_fd)); +@@ -2443,6 +2506,9 @@ absl::optional V4L2RequestsQueue::CreateRequestFD() { + } + + return base::ScopedFD(request_fd); ++#else ++ return absl::nullopt; ++#endif + } + + absl::optional V4L2RequestsQueue::GetFreeRequest() { +diff --git a/media/gpu/v4l2/v4l2_video_decoder.cc b/media/gpu/v4l2/v4l2_video_decoder.cc +index 9b44eaad..a46f4f63 100644 +--- a/media/gpu/v4l2/v4l2_video_decoder.cc ++++ b/media/gpu/v4l2/v4l2_video_decoder.cc +@@ -21,7 +21,10 @@ + #include "media/gpu/gpu_video_decode_accelerator_helpers.h" + #include "media/gpu/macros.h" + #include "media/gpu/v4l2/v4l2_video_decoder_backend_stateful.h" ++ ++#if !BUILDFLAG(USE_LINUX_V4L2) + #include "media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h" ++#endif + + namespace media { + +@@ -37,7 +40,9 @@ constexpr size_t kNumInputBuffers = 8; + + // Input format V4L2 fourccs this class supports. + constexpr uint32_t kSupportedInputFourccs[] = { ++#if !BUILDFLAG(USE_LINUX_V4L2) + V4L2_PIX_FMT_H264_SLICE, V4L2_PIX_FMT_VP8_FRAME, V4L2_PIX_FMT_VP9_FRAME, ++#endif + V4L2_PIX_FMT_H264, V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, + }; + +@@ -286,6 +291,7 @@ StatusCode V4L2VideoDecoder::InitializeBackend() { + << " and fourcc: " << FourccToString(input_format_fourcc); + backend_ = std::make_unique( + this, device_, profile_, decoder_task_runner_); ++#if !BUILDFLAG(USE_LINUX_V4L2) + } else { + DCHECK_EQ(preferred_api_and_format.first, kStateless); + VLOGF(1) << "Using a stateless API for profile: " +@@ -293,6 +299,7 @@ StatusCode V4L2VideoDecoder::InitializeBackend() { + << " and fourcc: " << FourccToString(input_format_fourcc); + backend_ = std::make_unique( + this, device_, profile_, decoder_task_runner_); ++#endif + } + + if (!backend_->Initialize()) { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0002-Add-mmap-via-libv4l-to-generic_v4l2_device.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0002-Add-mmap-via-libv4l-to-generic_v4l2_device.patch new file mode 100644 index 0000000000000000000000000000000000000000..7e29f994400d716e60b300b3d27be382c4e238e7 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0002-Add-mmap-via-libv4l-to-generic_v4l2_device.patch @@ -0,0 +1,49 @@ +From a9890d65c3e2ac0b50c4b66f2c083a99169320c8 Mon Sep 17 00:00:00 2001 +From: Damian Hobson-Garcia +Date: Wed, 21 Mar 2018 13:18:17 +0200 +Subject: [PATCH 02/14] Add mmap via libv4l to generic_v4l2_device + +Issue #437 +--- + media/gpu/v4l2/generic_v4l2_device.cc | 10 ++++++++++ + media/gpu/v4l2/v4l2.sig | 2 ++ + 2 files changed, 12 insertions(+) + +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index 92ec1b60..b9da0b3c 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -125,10 +125,20 @@ void* GenericV4L2Device::Mmap(void* addr, + int flags, + unsigned int offset) { + DCHECK(device_fd_.is_valid()); ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_mmap(addr, len, prot, flags, device_fd_.get(), offset); ++#endif + return mmap(addr, len, prot, flags, device_fd_.get(), offset); + } + + void GenericV4L2Device::Munmap(void* addr, unsigned int len) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) { ++ v4l2_munmap(addr, len); ++ return; ++ } ++#endif + munmap(addr, len); + } + +diff --git a/media/gpu/v4l2/v4l2.sig b/media/gpu/v4l2/v4l2.sig +index 4269fb48..71b5b378 100644 +--- a/media/gpu/v4l2/v4l2.sig ++++ b/media/gpu/v4l2/v4l2.sig +@@ -8,3 +8,5 @@ + LIBV4L_PUBLIC int v4l2_close(int fd); + LIBV4L_PUBLIC int v4l2_ioctl(int fd, unsigned long int request, ...); + LIBV4L_PUBLIC int v4l2_fd_open(int fd, int v4l2_flags); ++LIBV4L_PUBLIC void *v4l2_mmap(void *start, size_t length, int prot, int flags, int fd, int64_t offset); ++LIBV4L_PUBLIC int v4l2_munmap(void *_start, size_t length); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0003-media-capture-linux-Support-libv4l2-plugins.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0003-media-capture-linux-Support-libv4l2-plugins.patch new file mode 100644 index 0000000000000000000000000000000000000000..648757850e88661c373f3c3fae2b0475816c526a --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0003-media-capture-linux-Support-libv4l2-plugins.patch @@ -0,0 +1,178 @@ +From 6c6ce596eb7a4574dbd558b7879faecc3a8b87c4 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 1 Jul 2019 10:37:35 +0800 +Subject: [PATCH 03/14] media: capture: linux: Support libv4l2 plugins + +Allow using libv4l2 plugins for linux v4l2 capture devices. + +Signed-off-by: Jeffy Chen +--- + media/capture/BUILD.gn | 14 +++++ + .../video/linux/v4l2_capture_device_impl.cc | 52 ++++++++++++++++++- + .../video/linux/v4l2_capture_device_impl.h | 11 ++++ + 3 files changed, 76 insertions(+), 1 deletion(-) + +diff --git a/media/capture/BUILD.gn b/media/capture/BUILD.gn +index 5207dde6..61e16405 100644 +--- a/media/capture/BUILD.gn ++++ b/media/capture/BUILD.gn +@@ -2,6 +2,7 @@ + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. + ++import("//build/buildflag_header.gni") + import("//build/config/chromeos/ui_mode.gni") + import("//build/config/features.gni") + import("//build/config/ui.gni") +@@ -18,6 +19,14 @@ group("capture") { + ] + } + ++buildflag_header("buildflags") { ++ header = "buildflags.h" ++ ++ flags = [ ++ "USE_LIBV4L2=$use_v4lplugin", ++ ] ++} ++ + component("capture_switches") { + defines = [ "CAPTURE_IMPLEMENTATION" ] + sources = [ +@@ -267,6 +276,11 @@ component("capture_lib") { + "video/linux/video_capture_device_linux.cc", + "video/linux/video_capture_device_linux.h", + ] ++ public_deps += [ ":buildflags" ] ++ ++ if (use_v4lplugin) { ++ deps += [ "//media/gpu/v4l2:libv4l2_stubs" ] ++ } + } + + if (is_chromeos_ash) { +diff --git a/media/capture/video/linux/v4l2_capture_device_impl.cc b/media/capture/video/linux/v4l2_capture_device_impl.cc +index c9040f5d..d05d1179 100644 +--- a/media/capture/video/linux/v4l2_capture_device_impl.cc ++++ b/media/capture/video/linux/v4l2_capture_device_impl.cc +@@ -10,19 +10,61 @@ + #include + #include + ++#if BUILDFLAG(USE_LIBV4L2) ++// Auto-generated for dlopen libv4l2 libraries ++#include "media/gpu/v4l2/v4l2_stubs.h" ++#include "third_party/v4l-utils/lib/include/libv4l2.h" ++ ++#include "base/files/file_path.h" ++ ++using media_gpu_v4l2::kModuleV4l2; ++using media_gpu_v4l2::InitializeStubs; ++using media_gpu_v4l2::StubPathMap; ++ ++static const base::FilePath::CharType kV4l2Lib[] = ++ FILE_PATH_LITERAL("/usr/lib/libv4l2.so"); ++#endif ++ + namespace media { + + V4L2CaptureDeviceImpl::~V4L2CaptureDeviceImpl() = default; + ++V4L2CaptureDeviceImpl::V4L2CaptureDeviceImpl() { ++#if BUILDFLAG(USE_LIBV4L2) ++ StubPathMap paths; ++ paths[kModuleV4l2].push_back(kV4l2Lib); ++ ++ has_libv4l2_ = InitializeStubs(paths); ++#endif ++} ++ + int V4L2CaptureDeviceImpl::open(const char* device_name, int flags) { +- return ::open(device_name, flags); ++ int fd = ::open64(device_name, flags); ++ if (fd < 0) ++ return fd; ++ ++#if BUILDFLAG(USE_LIBV4L2) ++ use_libv4l2_ = false; ++ if (has_libv4l2_ && v4l2_fd_open(fd, V4L2_DISABLE_CONVERSION) != -1) { ++ use_libv4l2_ = true; ++ } ++#endif ++ return fd; + } + + int V4L2CaptureDeviceImpl::close(int fd) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_close(fd); ++#endif + return ::close(fd); + } + + int V4L2CaptureDeviceImpl::ioctl(int fd, int request, void* argp) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_ioctl(fd, request, argp); ++#endif + return ::ioctl(fd, request, argp); + } + +@@ -32,10 +74,18 @@ void* V4L2CaptureDeviceImpl::mmap(void* start, + int flags, + int fd, + off_t offset) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_mmap(start, length, prot, flags, fd, offset); ++#endif + return ::mmap(start, length, prot, flags, fd, offset); + } + + int V4L2CaptureDeviceImpl::munmap(void* start, size_t length) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_munmap(start, length); ++#endif + return ::munmap(start, length); + } + +diff --git a/media/capture/video/linux/v4l2_capture_device_impl.h b/media/capture/video/linux/v4l2_capture_device_impl.h +index 936c8b09..f96c2d43 100644 +--- a/media/capture/video/linux/v4l2_capture_device_impl.h ++++ b/media/capture/video/linux/v4l2_capture_device_impl.h +@@ -8,6 +8,7 @@ + #include + #include + ++#include "media/capture/buildflags.h" + #include "media/capture/capture_export.h" + #include "media/capture/video/linux/v4l2_capture_device.h" + +@@ -17,6 +18,8 @@ namespace media { + // V4L2 APIs. + class CAPTURE_EXPORT V4L2CaptureDeviceImpl : public V4L2CaptureDevice { + public: ++ V4L2CaptureDeviceImpl(); ++ + int open(const char* device_name, int flags) override; + int close(int fd) override; + int ioctl(int fd, int request, void* argp) override; +@@ -32,6 +35,14 @@ class CAPTURE_EXPORT V4L2CaptureDeviceImpl : public V4L2CaptureDevice { + + private: + ~V4L2CaptureDeviceImpl() override; ++ ++#if BUILDFLAG(USE_LIBV4L2) ++ // Has libv4l2. ++ bool has_libv4l2_; ++ // Use libv4l2 when operating |fd|. ++ bool use_libv4l2_; ++#endif ++ + }; + + } // namespace media +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0004-media-Enable-mojo-media-when-using-v4l2-codec-on-des.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0004-media-Enable-mojo-media-when-using-v4l2-codec-on-des.patch new file mode 100644 index 0000000000000000000000000000000000000000..1a1e08dde6c51fc3673787e9a6c8b4de14ef30a9 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0004-media-Enable-mojo-media-when-using-v4l2-codec-on-des.patch @@ -0,0 +1,30 @@ +From f154d69953bfdb4a4f291364b04e0c6b072622d9 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 19 Dec 2019 14:22:32 +0800 +Subject: [PATCH 04/14] media: Enable mojo media when using v4l2 codec on + desktop linux + +The newest chromium turns to use mojo video decoder instead of gpu video +decoder. + +Signed-off-by: Jeffy Chen +--- + media/media_options.gni | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/media/media_options.gni b/media/media_options.gni +index 3574b2aa..0b4b7f4a 100644 +--- a/media/media_options.gni ++++ b/media/media_options.gni +@@ -197,7 +197,7 @@ if (is_chromecast) { + ] + _default_mojo_media_host = "gpu" + } else if (is_chromeos_ash || is_mac || is_win || +- ((is_linux || is_chromeos_lacros) && use_vaapi)) { ++ ((is_linux || is_chromeos_lacros) && (use_vaapi || use_v4l2_codec))) { + _default_mojo_media_services = [ "video_decoder" ] + _default_mojo_media_host = "gpu" + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0005-cld3-Avoid-unaligned-accesses.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0005-cld3-Avoid-unaligned-accesses.patch new file mode 100644 index 0000000000000000000000000000000000000000..41d556cb935b0c00dc7227049b903e4f212c137e --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0005-cld3-Avoid-unaligned-accesses.patch @@ -0,0 +1,46 @@ +From 50bf5b541601b613d58617798f6c0707607c74f4 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 27 Mar 2020 17:48:20 +0800 +Subject: [PATCH 05/14] cld3: Avoid unaligned accesses + +Although the unaligned memory accesses are enabled, somehow i still hit +the SIGBUS: +[23496.643138] Unhandled fault: alignment fault (0x92000021) at 0x00000000b182e636 +Received signal 7 BUS_ADRALN 0000b182e636 + +Signed-off-by: Jeffy Chen +--- + third_party/cld_3/src/src/script_span/port.h | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/third_party/cld_3/src/src/script_span/port.h b/third_party/cld_3/src/src/script_span/port.h +index 2b3bc515..1d437bab 100644 +--- a/third_party/cld_3/src/src/script_span/port.h ++++ b/third_party/cld_3/src/src/script_span/port.h +@@ -78,11 +78,23 @@ namespace CLD2 { + // + // This is a mess, but there's not much we can do about it. + ++#if 0 + #define UNALIGNED_LOAD16(_p) (*reinterpret_cast(_p)) + #define UNALIGNED_LOAD32(_p) (*reinterpret_cast(_p)) + + #define UNALIGNED_STORE16(_p, _val) (*reinterpret_cast(_p) = (_val)) + #define UNALIGNED_STORE32(_p, _val) (*reinterpret_cast(_p) = (_val)) ++#else ++inline uint32 UNALIGNED_LOAD32(const void *p) { ++ uint32 t; ++ memcpy(&t, p, sizeof t); ++ return t; ++} ++ ++inline void UNALIGNED_STORE32(void *p, uint32 v) { ++ memcpy(p, &v, sizeof v); ++} ++#endif + + // TODO(sesse): NEON supports unaligned 64-bit loads and stores. + // See if that would be more efficient on platforms supporting it, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0006-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0006-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch new file mode 100644 index 0000000000000000000000000000000000000000..37f2730ce7dc26619177550ce1c63f69f2b31592 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0006-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch @@ -0,0 +1,29 @@ +From 1e871eaac611942081d2eb2ee350f81d8d956ab8 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 10 Apr 2020 16:16:08 +0800 +Subject: [PATCH 06/14] media: gpu: v4l2: Use POLLIN for pending event + +The v4l-rkmpp is using eventfd to fake poll events which not supporting +POLLPRI. + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/generic_v4l2_device.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index b9da0b3c..64aa8c6d 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -115,7 +115,7 @@ bool GenericV4L2Device::Poll(bool poll_device, bool* event_pending) { + VPLOGF(1) << "poll() failed"; + return false; + } +- *event_pending = (pollfd != -1 && pollfds[pollfd].revents & POLLPRI); ++ *event_pending = (pollfd != -1 && pollfds[pollfd].revents & POLLIN); + return true; + } + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0007-media-capture-linux-Prefer-using-the-first-device.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0007-media-capture-linux-Prefer-using-the-first-device.patch new file mode 100644 index 0000000000000000000000000000000000000000..7370e0461d5bf6272a74d56e6ca760480455491a --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0007-media-capture-linux-Prefer-using-the-first-device.patch @@ -0,0 +1,32 @@ +From c8da02855e8891c8ef507c4f764c9f88e4a74029 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 5 Nov 2020 12:22:52 +0800 +Subject: [PATCH 07/14] media: capture: linux: Prefer using the first device + +Somehow the newest chromium would prefer using the last device in some +cases, e.g. apprtc. + +Let's reverse the device array to workaround it. + +Signed-off-by: Jeffy Chen +--- + .../capture/video/linux/video_capture_device_factory_linux.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/media/capture/video/linux/video_capture_device_factory_linux.cc b/media/capture/video/linux/video_capture_device_factory_linux.cc +index 6724957d..9dfcabb2 100644 +--- a/media/capture/video/linux/video_capture_device_factory_linux.cc ++++ b/media/capture/video/linux/video_capture_device_factory_linux.cc +@@ -197,7 +197,8 @@ void VideoCaptureDeviceFactoryLinux::GetDevicesInfo( + continue; + } + +- devices_info.emplace_back(VideoCaptureDeviceDescriptor( ++ // HACK: Somehow the newest chromium would prefer using the last device in some cases, e.g. apprtc ++ devices_info.emplace(devices_info.begin(), VideoCaptureDeviceDescriptor( + display_name, unique_id, model_id, + VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE, GetControlSupport(fd.get()), + VideoCaptureTransportType::OTHER_TRANSPORT, facing_mode)); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0008-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0008-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch new file mode 100644 index 0000000000000000000000000000000000000000..b9c103edd52df804eb56e6b271ced28003a4c497 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0008-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch @@ -0,0 +1,67 @@ +From 38583b7b3800b7924c12e3183f4ac558d97c66bf Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 28 Sep 2020 20:02:00 +0800 +Subject: [PATCH 08/14] media: gpu: v4l2: Fix compile error when ozone not + enabled + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/BUILD.gn | 5 ++++- + media/gpu/v4l2/generic_v4l2_device.cc | 7 +++++++ + 2 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn +index d7965ae5..c96846ba 100644 +--- a/media/gpu/v4l2/BUILD.gn ++++ b/media/gpu/v4l2/BUILD.gn +@@ -107,9 +107,12 @@ source_set("v4l2") { + "//media/parsers", + "//third_party/libyuv", + "//ui/gfx/geometry", +- "//ui/ozone", + ] + ++ if (use_ozone) { ++ deps += [ "//ui/ozone" ] ++ } ++ + if (use_v4lplugin) { + deps += [ ":libv4l2_stubs" ] + } +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index 64aa8c6d..11cf9c96 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -34,8 +34,11 @@ + #include "ui/gl/egl_util.h" + #include "ui/gl/gl_bindings.h" + #include "ui/gl/gl_image_native_pixmap.h" ++ ++#if defined(USE_OZONE) + #include "ui/ozone/public/ozone_platform.h" + #include "ui/ozone/public/surface_factory_ozone.h" ++#endif + + #if BUILDFLAG(USE_LIBV4L2) + // Auto-generated for dlopen libv4l2 libraries +@@ -303,6 +306,9 @@ scoped_refptr GenericV4L2Device::CreateGLImage( + const gfx::Size& size, + const Fourcc fourcc, + gfx::NativePixmapHandle handle) const { ++#if !defined(USE_OZONE) ++ return nullptr; ++#else + DVLOGF(3); + DCHECK(CanCreateEGLImageFrom(fourcc)); + +@@ -337,6 +343,7 @@ scoped_refptr GenericV4L2Device::CreateGLImage( + bool ret = image->Initialize(std::move(pixmap)); + DCHECK(ret); + return image; ++#endif + } + + EGLBoolean GenericV4L2Device::DestroyEGLImage(EGLDisplay egl_display, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0009-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0009-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch new file mode 100644 index 0000000000000000000000000000000000000000..9124e3ecad900d9c9fcb66b817927682e17dcafc --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0009-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch @@ -0,0 +1,29 @@ +From a206b9be1afc821172b7bb5764f962ced3df4a43 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 20 May 2021 01:05:29 +0800 +Subject: [PATCH 09/14] ui: events: ozone: Define SW_PEN_INSERTED for old + kernel headers + +Signed-off-by: Jeffy Chen +--- + ui/events/ozone/evdev/event_converter_evdev_impl.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/ui/events/ozone/evdev/event_converter_evdev_impl.cc b/ui/events/ozone/evdev/event_converter_evdev_impl.cc +index 6b879e29..3705923e 100644 +--- a/ui/events/ozone/evdev/event_converter_evdev_impl.cc ++++ b/ui/events/ozone/evdev/event_converter_evdev_impl.cc +@@ -25,6 +25,10 @@ namespace { + const int kKeyReleaseValue = 0; + const int kKeyRepeatValue = 2; + ++#ifndef SW_PEN_INSERTED ++#define SW_PEN_INSERTED 0x0f /* set = pen inserted */ ++#endif ++ + // Values for the EV_SW code. + const int kSwitchStylusInserted = SW_PEN_INSERTED; + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0010-Create-new-fence-when-there-s-no-in-fences.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0010-Create-new-fence-when-there-s-no-in-fences.patch new file mode 100644 index 0000000000000000000000000000000000000000..2e0bcc2baf15eff834c8decd8edf8053f13c058e --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0010-Create-new-fence-when-there-s-no-in-fences.patch @@ -0,0 +1,60 @@ +From 9f755da486b8568ef5a591836b23f4be3984a14b Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 01:29:11 +0800 +Subject: [PATCH 10/14] Create new fence when there's no in-fences + +There're cases that in-fences are not provided. + +Signed-off-by: Jeffy Chen +--- + .../wayland/gpu/gbm_surfaceless_wayland.cc | 21 +++++++++++++++++-- + 1 file changed, 19 insertions(+), 2 deletions(-) + +diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +index ae709740..c67c8bd1 100644 +--- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc ++++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +@@ -23,6 +23,12 @@ namespace ui { + + namespace { + ++void WaitForEGLFence(EGLDisplay display, EGLSyncKHR fence) { ++ eglClientWaitSyncKHR(display, fence, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, ++ EGL_FOREVER_KHR); ++ eglDestroySyncKHR(display, fence); ++} ++ + void WaitForGpuFences(std::vector> fences) { + for (auto& fence : fences) + fence->Wait(); +@@ -117,14 +123,25 @@ void GbmSurfacelessWayland::SwapBuffersAsync( + return; + } + +- base::OnceClosure fence_wait_task; + std::vector> fences; ++ // Uset in-fences provided in the overlays. If there are none, we insert our ++ // own fence and wait. + for (auto& plane : frame->planes) { + if (plane.second.gpu_fence) + fences.push_back(std::move(plane.second.gpu_fence)); + } + +- fence_wait_task = base::BindOnce(&WaitForGpuFences, std::move(fences)); ++ base::OnceClosure fence_wait_task; ++ if (!fences.empty()) { ++ fence_wait_task = base::BindOnce(&WaitForGpuFences, std::move(fences)); ++ } else { ++ // TODO(fangzhoug): the following should be replaced by a per surface flush ++ // as it gets implemented in GL drivers. ++ EGLSyncKHR fence = InsertFence(has_implicit_external_sync_); ++ CHECK_NE(fence, EGL_NO_SYNC_KHR) << "eglCreateSyncKHR failed"; ++ ++ fence_wait_task = base::BindOnce(&WaitForEGLFence, GetDisplay(), fence); ++ } + + base::OnceClosure fence_retired_callback = base::BindOnce( + &GbmSurfacelessWayland::FenceRetired, weak_factory_.GetWeakPtr(), frame); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0011-HACK-ozone-wayland-Force-disable-implicit-external-s.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0011-HACK-ozone-wayland-Force-disable-implicit-external-s.patch new file mode 100644 index 0000000000000000000000000000000000000000..92b1b9ee192e212ff3bf6bfe6406c1bcc6fe5aff --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0011-HACK-ozone-wayland-Force-disable-implicit-external-s.patch @@ -0,0 +1,30 @@ +From 1a36e51f7a8e854722cb89cb4e3f4d7c0c710df1 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 01:41:57 +0800 +Subject: [PATCH 11/14] HACK: [ozone/wayland]: Force disable implicit external + sync + +The Mali's implicit external sync seems broken. + +Signed-off-by: Jeffy Chen +--- + ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +index c67c8bd1..2378a376 100644 +--- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc ++++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +@@ -137,7 +137,8 @@ void GbmSurfacelessWayland::SwapBuffersAsync( + } else { + // TODO(fangzhoug): the following should be replaced by a per surface flush + // as it gets implemented in GL drivers. +- EGLSyncKHR fence = InsertFence(has_implicit_external_sync_); ++ // HACK: The Mali's implicit external sync seems broken. ++ EGLSyncKHR fence = InsertFence(/* has_implicit_external_sync_ */ false); + CHECK_NE(fence, EGL_NO_SYNC_KHR) << "eglCreateSyncKHR failed"; + + fence_wait_task = base::BindOnce(&WaitForEGLFence, GetDisplay(), fence); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0012-HACK-media-capture-linux-Allow-camera-without-suppor.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0012-HACK-media-capture-linux-Allow-camera-without-suppor.patch new file mode 100644 index 0000000000000000000000000000000000000000..8b585633477c346fc56a2919cc93658648d33322 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0012-HACK-media-capture-linux-Allow-camera-without-suppor.patch @@ -0,0 +1,35 @@ +From aac9ab1975eff4e417485af39596680f3d5aea92 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 07:25:58 +0800 +Subject: [PATCH 12/14] HACK: media: capture: linux: Allow camera without + supported format + +The chromium would only accept discrete frame sizes. + +Hack it to make Rockchip ISP camera working. + +Signed-off-by: Jeffy Chen +--- + .../video/linux/video_capture_device_factory_linux.cc | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/media/capture/video/linux/video_capture_device_factory_linux.cc b/media/capture/video/linux/video_capture_device_factory_linux.cc +index 9dfcabb2..af7f053d 100644 +--- a/media/capture/video/linux/video_capture_device_factory_linux.cc ++++ b/media/capture/video/linux/video_capture_device_factory_linux.cc +@@ -192,10 +192,8 @@ void VideoCaptureDeviceFactoryLinux::GetDevicesInfo( + + VideoCaptureFormats supported_formats; + GetSupportedFormatsForV4L2BufferType(fd.get(), &supported_formats); +- if (supported_formats.empty()) { +- DVLOG(1) << "No supported formats: " << unique_id; +- continue; +- } ++ if (supported_formats.empty()) ++ LOG(WARNING) << "No supported formats: " << unique_id; + + // HACK: Somehow the newest chromium would prefer using the last device in some cases, e.g. apprtc + devices_info.emplace(devices_info.begin(), VideoCaptureDeviceDescriptor( +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0013-content-gpu-Only-depend-dri-for-X11.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0013-content-gpu-Only-depend-dri-for-X11.patch new file mode 100644 index 0000000000000000000000000000000000000000..4b98969b0140c977d45df96d06b7b91d98c2f022 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0013-content-gpu-Only-depend-dri-for-X11.patch @@ -0,0 +1,26 @@ +From 64b7caacc352522721f59c86608847d39fad04ad Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 22 Nov 2021 15:59:49 +0800 +Subject: [PATCH 13/14] content: gpu: Only depend dri for X11 + +Signed-off-by: Jeffy Chen +--- + content/gpu/BUILD.gn | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/content/gpu/BUILD.gn b/content/gpu/BUILD.gn +index 24d5825f..944ea211 100644 +--- a/content/gpu/BUILD.gn ++++ b/content/gpu/BUILD.gn +@@ -135,7 +135,7 @@ target(link_target_type, "gpu_sources") { + } + + # Use DRI on desktop Linux builds. +- if (current_cpu != "s390x" && current_cpu != "ppc64" && is_linux && ++ if (current_cpu != "s390x" && current_cpu != "ppc64" && is_linux && use_x11 && + (!is_chromecast || is_cast_desktop_build)) { + configs += [ "//build/config/linux/dri" ] + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0014-blink-rtc-Force-disabling-optimized-video-scaling.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0014-blink-rtc-Force-disabling-optimized-video-scaling.patch new file mode 100644 index 0000000000000000000000000000000000000000..01cf3fbe6acb22e2a24b25a6d9cad8ef969a18c7 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_96.0.4664/0014-blink-rtc-Force-disabling-optimized-video-scaling.patch @@ -0,0 +1,31 @@ +From 8d7e81dd8f2a4ab69ad1ade78bef47d538f6fa3b Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 1 Dec 2021 18:27:06 +0800 +Subject: [PATCH 14/14] blink: rtc: Force disabling optimized video scaling + +This would break VEA when encoder requires special coded size: +https://bugs.chromium.org/p/chromium/issues/detail?id=1193457#c6 + +Signed-off-by: Jeffy Chen +--- + .../renderer/platform/peerconnection/rtc_video_encoder.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc b/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc +index 4d33a545..594a3912 100644 +--- a/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc ++++ b/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc +@@ -1214,6 +1214,10 @@ void RTCVideoEncoder::Impl::EncodeOneFrame() { + #else + false; + #endif ++ ++ // https://bugs.chromium.org/p/chromium/issues/detail?id=1193457#c6 ++ optimized_scaling = false; ++ + if (optimized_scaling) { + DCHECK_EQ(buffer->type(), webrtc::VideoFrameBuffer::Type::kNative); + auto scaled_buffer = buffer->Scale(input_visible_size_.width(), +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0001-Add-support-for-V4L2VDA-on-Linux.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0001-Add-support-for-V4L2VDA-on-Linux.patch new file mode 100644 index 0000000000000000000000000000000000000000..d6c3628d83623b0aa4a9bd536229e3229d0f346f --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0001-Add-support-for-V4L2VDA-on-Linux.patch @@ -0,0 +1,473 @@ +From 093ba11869de97c40942e6fc0366a514e8102ee2 Mon Sep 17 00:00:00 2001 +From: Maksim Sisov +Date: Wed, 31 Jul 2019 09:56:24 +0300 +Subject: [PATCH 01/14] Add support for V4L2VDA on Linux + +This patch enables hardware assisted video decoding via the +Chromium V4L2VDA. Including changes when Linux is used. In +order to use this, use_linux_v4l2_only flag should be set +to true. + +Signed-off-by: Ryo Kodama + +fixup! avoid building not declared formats + +"FRAME", "_SLICE", "V4L2_PIX_FMT_VP9" are not defined in mainline + Linux headers. This patch avoids building these formats. + +Signed-off-by: Ryo Kodama + +fixup! add V4L2_PIX_FMT_VP9 support back again as it is now +included in mainline Linux kernel. This allows VP9 codec +to work with upstream kernel and v4l2 vda. Tested on db820c +with Venus v4l2 driver. + +Signed-off-by: Peter Griffin +Signed-off-by: Stanimir Varbanov +Signed-off-by: Jeffy Chen +--- + .../gpu_mjpeg_decode_accelerator_factory.cc | 3 +- + media/gpu/BUILD.gn | 1 + + media/gpu/args.gni | 4 ++ + .../gpu_video_decode_accelerator_factory.cc | 8 +++ + .../gpu_video_decode_accelerator_factory.h | 2 + + media/gpu/v4l2/BUILD.gn | 48 ++++++++------ + media/gpu/v4l2/generic_v4l2_device.cc | 4 ++ + media/gpu/v4l2/v4l2_device.cc | 66 +++++++++++++++++++ + media/gpu/v4l2/v4l2_video_decoder.cc | 7 ++ + 9 files changed, 121 insertions(+), 22 deletions(-) + +diff --git a/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc b/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc +index 3772b8ef..dece6b77 100644 +--- a/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc ++++ b/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc +@@ -13,7 +13,8 @@ + #include "media/base/media_switches.h" + #include "media/gpu/buildflags.h" + +-#if BUILDFLAG(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY) ++#if BUILDFLAG(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY) && \ ++ !BUILDFLAG(USE_LINUX_V4L2) + #define USE_V4L2_MJPEG_DECODE_ACCELERATOR + #endif + +diff --git a/media/gpu/BUILD.gn b/media/gpu/BUILD.gn +index 98bf1fff..fed26fd4 100644 +--- a/media/gpu/BUILD.gn ++++ b/media/gpu/BUILD.gn +@@ -20,6 +20,7 @@ buildflag_header("buildflags") { + "USE_VAAPI_IMAGE_CODECS=$use_vaapi_image_codecs", + "USE_V4L2_CODEC=$use_v4l2_codec", + "USE_LIBV4L2=$use_v4lplugin", ++ "USE_LINUX_V4L2=$use_linux_v4l2_only", + "USE_VAAPI_X11=$use_vaapi_x11", + ] + } +diff --git a/media/gpu/args.gni b/media/gpu/args.gni +index 2f538439..bc47d2ad 100644 +--- a/media/gpu/args.gni ++++ b/media/gpu/args.gni +@@ -21,6 +21,10 @@ declare_args() { + # platforms which have v4l2 hardware encoder / decoder. + use_v4l2_codec = false + ++ # Indicates that only definitions available in the mainline linux kernel ++ # will be used. ++ use_linux_v4l2_only = false ++ + # Indicates if Video4Linux2 AML encoder is used. This is used for AML + # platforms which have v4l2 hardware encoder + use_v4l2_codec_aml = false +diff --git a/media/gpu/gpu_video_decode_accelerator_factory.cc b/media/gpu/gpu_video_decode_accelerator_factory.cc +index 0e55ef47..2096dc61 100644 +--- a/media/gpu/gpu_video_decode_accelerator_factory.cc ++++ b/media/gpu/gpu_video_decode_accelerator_factory.cc +@@ -29,7 +29,9 @@ + #include "ui/gl/gl_implementation.h" + #elif BUILDFLAG(USE_V4L2_CODEC) + #include "media/gpu/v4l2/v4l2_device.h" ++#if !BUILDFLAG(USE_LINUX_V4L2) + #include "media/gpu/v4l2/v4l2_slice_video_decode_accelerator.h" ++#endif + #include "media/gpu/v4l2/v4l2_video_decode_accelerator.h" + #include "ui/gl/gl_surface_egl.h" + #endif +@@ -64,10 +66,12 @@ gpu::VideoDecodeAcceleratorCapabilities GetDecoderCapabilitiesInternal( + GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( + V4L2VideoDecodeAccelerator::GetSupportedProfiles(), + &capabilities.supported_profiles); ++#if !BUILDFLAG(USE_LINUX_V4L2) + GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( + V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles(), + &capabilities.supported_profiles); + #endif ++#endif + #elif defined(OS_MAC) + capabilities.supported_profiles = + VTVideoDecodeAccelerator::GetSupportedProfiles(workarounds); +@@ -146,8 +150,10 @@ GpuVideoDecodeAcceleratorFactory::CreateVDA( + &GpuVideoDecodeAcceleratorFactory::CreateVaapiVDA, + #elif BUILDFLAG(USE_V4L2_CODEC) + &GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA, ++#if !BUILDFLAG(USE_LINUX_V4L2) + &GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA, + #endif ++#endif + + #if defined(OS_MAC) + &GpuVideoDecodeAcceleratorFactory::CreateVTVDA, +@@ -207,6 +213,7 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA( + return decoder; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + std::unique_ptr + GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA( + const gpu::GpuDriverBugWorkarounds& /*workarounds*/, +@@ -222,6 +229,7 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA( + return decoder; + } + #endif ++#endif + + #if defined(OS_MAC) + std::unique_ptr +diff --git a/media/gpu/gpu_video_decode_accelerator_factory.h b/media/gpu/gpu_video_decode_accelerator_factory.h +index a80cac21..1021af34 100644 +--- a/media/gpu/gpu_video_decode_accelerator_factory.h ++++ b/media/gpu/gpu_video_decode_accelerator_factory.h +@@ -104,11 +104,13 @@ class MEDIA_GPU_EXPORT GpuVideoDecodeAcceleratorFactory { + const gpu::GpuDriverBugWorkarounds& workarounds, + const gpu::GpuPreferences& gpu_preferences, + MediaLog* media_log) const; ++#if !BUILDFLAG(USE_LINUX_V4L2) + std::unique_ptr CreateV4L2SliceVDA( + const gpu::GpuDriverBugWorkarounds& workarounds, + const gpu::GpuPreferences& gpu_preferences, + MediaLog* media_log) const; + #endif ++#endif + #if defined(OS_MAC) + std::unique_ptr CreateVTVDA( + const gpu::GpuDriverBugWorkarounds& workarounds, +diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn +index 0322bbf7..3e637653 100644 +--- a/media/gpu/v4l2/BUILD.gn ++++ b/media/gpu/v4l2/BUILD.gn +@@ -28,9 +28,6 @@ source_set("v4l2") { + "buffer_affinity_tracker.h", + "generic_v4l2_device.cc", + "generic_v4l2_device.h", +- "v4l2_decode_surface.cc", +- "v4l2_decode_surface.h", +- "v4l2_decode_surface_handler.h", + "v4l2_device.cc", + "v4l2_device.h", + "v4l2_device_poller.cc", +@@ -39,8 +36,6 @@ source_set("v4l2") { + "v4l2_framerate_control.h", + "v4l2_image_processor_backend.cc", + "v4l2_image_processor_backend.h", +- "v4l2_slice_video_decode_accelerator.cc", +- "v4l2_slice_video_decode_accelerator.h", + "v4l2_stateful_workaround.cc", + "v4l2_stateful_workaround.h", + "v4l2_status.h", +@@ -50,30 +45,41 @@ source_set("v4l2") { + "v4l2_vda_helpers.h", + "v4l2_video_decode_accelerator.cc", + "v4l2_video_decode_accelerator.h", +- "v4l2_video_decoder.cc", +- "v4l2_video_decoder.h", + "v4l2_video_decoder_backend.cc", + "v4l2_video_decoder_backend.h", + "v4l2_video_decoder_backend_stateful.cc", + "v4l2_video_decoder_backend_stateful.h", +- "v4l2_video_decoder_backend_stateless.cc", +- "v4l2_video_decoder_backend_stateless.h", +- "v4l2_video_decoder_delegate_h264.cc", +- "v4l2_video_decoder_delegate_h264.h", +- "v4l2_video_decoder_delegate_h264_legacy.cc", +- "v4l2_video_decoder_delegate_h264_legacy.h", +- "v4l2_video_decoder_delegate_vp8.cc", +- "v4l2_video_decoder_delegate_vp8.h", +- "v4l2_video_decoder_delegate_vp8_legacy.cc", +- "v4l2_video_decoder_delegate_vp8_legacy.h", +- "v4l2_video_decoder_delegate_vp9_chromium.cc", +- "v4l2_video_decoder_delegate_vp9_chromium.h", +- "v4l2_video_decoder_delegate_vp9_legacy.cc", +- "v4l2_video_decoder_delegate_vp9_legacy.h", + "v4l2_video_encode_accelerator.cc", + "v4l2_video_encode_accelerator.h", + ] + ++ if (!use_linux_v4l2_only) { ++ sources += [ ++ "v4l2_decode_surface.cc", ++ "v4l2_decode_surface.h", ++ "v4l2_decode_surface_handler.h", ++ "v4l2_slice_video_decode_accelerator.cc", ++ "v4l2_slice_video_decode_accelerator.h", ++ "v4l2_video_decoder.cc", ++ "v4l2_video_decoder.h", ++ "v4l2_video_decoder_backend_stateless.cc", ++ "v4l2_video_decoder_backend_stateless.h", ++ "v4l2_video_decoder_delegate_h264.cc", ++ "v4l2_video_decoder_delegate_h264.h", ++ "v4l2_video_decoder_delegate_h264_legacy.cc", ++ "v4l2_video_decoder_delegate_h264_legacy.h", ++ "v4l2_video_decoder_delegate_vp8.cc", ++ "v4l2_video_decoder_delegate_vp8.h", ++ "v4l2_video_decoder_delegate_vp8_legacy.cc", ++ "v4l2_video_decoder_delegate_vp8_legacy.h", ++ "v4l2_video_decoder_delegate_vp9_chromium.cc", ++ "v4l2_video_decoder_delegate_vp9_chromium.h", ++ "v4l2_video_decoder_delegate_vp9_legacy.cc", ++ "v4l2_video_decoder_delegate_vp9_legacy.h", ++ ] ++ } ++ ++ + libs = [ + "EGL", + "GLESv2", +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index b64c9bd0..92ec1b60 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -441,7 +441,11 @@ bool GenericV4L2Device::OpenDevicePath(const std::string& path, Type type) { + return false; + + #if BUILDFLAG(USE_LIBV4L2) ++#if BUILDFLAG(USE_LINUX_V4L2) ++ if ( ++#else + if (type == Type::kEncoder && ++#endif + HANDLE_EINTR(v4l2_fd_open(device_fd_.get(), V4L2_DISABLE_CONVERSION)) != + -1) { + DVLOGF(3) << "Using libv4l2 for " << path; +diff --git a/media/gpu/v4l2/v4l2_device.cc b/media/gpu/v4l2/v4l2_device.cc +index ee99d095..98a0d51f 100644 +--- a/media/gpu/v4l2/v4l2_device.cc ++++ b/media/gpu/v4l2/v4l2_device.cc +@@ -853,7 +853,9 @@ void V4L2WritableBufferRef::SetConfigStore(uint32_t config_store) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK(buffer_data_); + ++#if !BUILDFLAG(USE_LINUX_V4L2) + buffer_data_->v4l2_buffer_.config_store = config_store; ++#endif + } + + V4L2ReadableBuffer::V4L2ReadableBuffer(const struct v4l2_buffer& v4l2_buffer, +@@ -996,10 +998,12 @@ V4L2Queue::V4L2Queue(scoped_refptr dev, + return; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + if (reqbufs.capabilities & V4L2_BUF_CAP_SUPPORTS_REQUESTS) { + supports_requests_ = true; + DVLOGF(4) << "Queue supports request API."; + } ++#endif + } + + V4L2Queue::~V4L2Queue() { +@@ -1527,6 +1531,23 @@ scoped_refptr V4L2Device::Create() { + // static + uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + bool slice_based) { ++#if BUILDFLAG(USE_LINUX_V4L2) ++ if (slice_based) { ++ LOG(ERROR) << "Slice not supported"; ++ return 0; ++ } ++ ++ if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { ++ return V4L2_PIX_FMT_H264; ++ } else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) { ++ return V4L2_PIX_FMT_VP8; ++ } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) { ++ return V4L2_PIX_FMT_VP9; ++ } else { ++ DVLOGF(1) << "Unsupported profile: " << GetProfileName(profile); ++ return 0; ++ } ++#else + if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { + if (slice_based) + return V4L2_PIX_FMT_H264_SLICE; +@@ -1546,8 +1567,10 @@ uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + DVLOGF(1) << "Unsupported profile: " << GetProfileName(profile); + return 0; + } ++#endif + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + namespace { + + VideoCodecProfile V4L2ProfileToVideoCodecProfile(VideoCodec codec, +@@ -1594,9 +1617,11 @@ VideoCodecProfile V4L2ProfileToVideoCodecProfile(VideoCodec codec, + } + + } // namespace ++#endif + + std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + uint32_t pix_fmt) { ++#if !BUILDFLAG(USE_LINUX_V4L2) + auto get_supported_profiles = [this]( + VideoCodec codec, + std::vector* profiles) { +@@ -1667,6 +1692,27 @@ std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + VLOGF(1) << "Unhandled pixelformat " << FourccToString(pix_fmt); + return {}; + } ++#else ++ std::vector profiles; ++ switch (pix_fmt) { ++ case V4L2_PIX_FMT_H264: ++ profiles = { ++ H264PROFILE_BASELINE, ++ H264PROFILE_MAIN, ++ H264PROFILE_HIGH, ++ }; ++ break; ++ case V4L2_PIX_FMT_VP8: ++ profiles = {VP8PROFILE_ANY}; ++ break; ++ case V4L2_PIX_FMT_VP9: ++ profiles = {VP9PROFILE_PROFILE0}; ++ break; ++ default: ++ VLOGF(1) << "Unhandled pixelformat " << FourccToString(pix_fmt); ++ return {}; ++ } ++#endif + + // Erase duplicated profiles. + std::sort(profiles.begin(), profiles.end()); +@@ -2334,10 +2380,14 @@ bool V4L2Request::ApplyCtrls(struct v4l2_ext_controls* ctrls) { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + ctrls->which = V4L2_CTRL_WHICH_REQUEST_VAL; + ctrls->request_fd = request_fd_.get(); + + return true; ++#else ++ return false; ++#endif + } + + bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) { +@@ -2349,10 +2399,14 @@ bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + buffer->flags |= V4L2_BUF_FLAG_REQUEST_FD; + buffer->request_fd = request_fd_.get(); + + return true; ++#else ++ return false; ++#endif + } + + bool V4L2Request::Submit() { +@@ -2363,7 +2417,11 @@ bool V4L2Request::Submit() { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + return HANDLE_EINTR(ioctl(request_fd_.get(), MEDIA_REQUEST_IOC_QUEUE)) == 0; ++#else ++ return false; ++#endif + } + + bool V4L2Request::IsCompleted() { +@@ -2406,6 +2464,7 @@ bool V4L2Request::Reset() { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + // Reinit the request to make sure we can use it for a new submission. + if (HANDLE_EINTR(ioctl(request_fd_.get(), MEDIA_REQUEST_IOC_REINIT)) < 0) { + VPLOGF(1) << "Failed to reinit request."; +@@ -2413,6 +2472,9 @@ bool V4L2Request::Reset() { + } + + return true; ++#else ++ return false; ++#endif + } + + V4L2RequestRefBase::V4L2RequestRefBase(V4L2RequestRefBase&& req_base) { +@@ -2487,6 +2549,7 @@ V4L2RequestsQueue::~V4L2RequestsQueue() { + absl::optional V4L2RequestsQueue::CreateRequestFD() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + ++#if !BUILDFLAG(USE_LINUX_V4L2) + int request_fd; + int ret = HANDLE_EINTR( + ioctl(media_fd_.get(), MEDIA_IOC_REQUEST_ALLOC, &request_fd)); +@@ -2496,6 +2559,9 @@ absl::optional V4L2RequestsQueue::CreateRequestFD() { + } + + return base::ScopedFD(request_fd); ++#else ++ return absl::nullopt; ++#endif + } + + absl::optional V4L2RequestsQueue::GetFreeRequest() { +diff --git a/media/gpu/v4l2/v4l2_video_decoder.cc b/media/gpu/v4l2/v4l2_video_decoder.cc +index f3545a54..1b07bf79 100644 +--- a/media/gpu/v4l2/v4l2_video_decoder.cc ++++ b/media/gpu/v4l2/v4l2_video_decoder.cc +@@ -23,7 +23,10 @@ + #include "media/gpu/macros.h" + #include "media/gpu/v4l2/v4l2_status.h" + #include "media/gpu/v4l2/v4l2_video_decoder_backend_stateful.h" ++ ++#if !BUILDFLAG(USE_LINUX_V4L2) + #include "media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h" ++#endif + + namespace media { + +@@ -39,7 +42,9 @@ constexpr size_t kNumInputBuffers = 8; + + // Input format V4L2 fourccs this class supports. + constexpr uint32_t kSupportedInputFourccs[] = { ++#if !BUILDFLAG(USE_LINUX_V4L2) + V4L2_PIX_FMT_H264_SLICE, V4L2_PIX_FMT_VP8_FRAME, V4L2_PIX_FMT_VP9_FRAME, ++#endif + V4L2_PIX_FMT_H264, V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, + }; + +@@ -298,6 +303,7 @@ V4L2Status V4L2VideoDecoder::InitializeBackend() { + << " and fourcc: " << FourccToString(input_format_fourcc); + backend_ = std::make_unique( + this, device_, profile_, decoder_task_runner_); ++#if !BUILDFLAG(USE_LINUX_V4L2) + } else { + DCHECK_EQ(preferred_api_and_format.first, kStateless); + VLOGF(1) << "Using a stateless API for profile: " +@@ -305,6 +311,7 @@ V4L2Status V4L2VideoDecoder::InitializeBackend() { + << " and fourcc: " << FourccToString(input_format_fourcc); + backend_ = std::make_unique( + this, device_, profile_, decoder_task_runner_); ++#endif + } + + if (!backend_->Initialize()) { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0002-Add-mmap-via-libv4l-to-generic_v4l2_device.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0002-Add-mmap-via-libv4l-to-generic_v4l2_device.patch new file mode 100644 index 0000000000000000000000000000000000000000..55b0d77e9acef829d7f9c454654673075ce58f78 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0002-Add-mmap-via-libv4l-to-generic_v4l2_device.patch @@ -0,0 +1,49 @@ +From f4d0420b18c9779f8e2f09c000e6e48c92edbda8 Mon Sep 17 00:00:00 2001 +From: Damian Hobson-Garcia +Date: Wed, 21 Mar 2018 13:18:17 +0200 +Subject: [PATCH 02/14] Add mmap via libv4l to generic_v4l2_device + +Issue #437 +--- + media/gpu/v4l2/generic_v4l2_device.cc | 10 ++++++++++ + media/gpu/v4l2/v4l2.sig | 2 ++ + 2 files changed, 12 insertions(+) + +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index 92ec1b60..b9da0b3c 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -125,10 +125,20 @@ void* GenericV4L2Device::Mmap(void* addr, + int flags, + unsigned int offset) { + DCHECK(device_fd_.is_valid()); ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_mmap(addr, len, prot, flags, device_fd_.get(), offset); ++#endif + return mmap(addr, len, prot, flags, device_fd_.get(), offset); + } + + void GenericV4L2Device::Munmap(void* addr, unsigned int len) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) { ++ v4l2_munmap(addr, len); ++ return; ++ } ++#endif + munmap(addr, len); + } + +diff --git a/media/gpu/v4l2/v4l2.sig b/media/gpu/v4l2/v4l2.sig +index 4269fb48..71b5b378 100644 +--- a/media/gpu/v4l2/v4l2.sig ++++ b/media/gpu/v4l2/v4l2.sig +@@ -8,3 +8,5 @@ + LIBV4L_PUBLIC int v4l2_close(int fd); + LIBV4L_PUBLIC int v4l2_ioctl(int fd, unsigned long int request, ...); + LIBV4L_PUBLIC int v4l2_fd_open(int fd, int v4l2_flags); ++LIBV4L_PUBLIC void *v4l2_mmap(void *start, size_t length, int prot, int flags, int fd, int64_t offset); ++LIBV4L_PUBLIC int v4l2_munmap(void *_start, size_t length); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0003-media-capture-linux-Support-libv4l2-plugins.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0003-media-capture-linux-Support-libv4l2-plugins.patch new file mode 100644 index 0000000000000000000000000000000000000000..6c5d7c77744851e4b4a5f9af15d4bb7083ebe0ed --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0003-media-capture-linux-Support-libv4l2-plugins.patch @@ -0,0 +1,178 @@ +From 46c7cc98a31c3cbdc9855e1875471f820937feb8 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 1 Jul 2019 10:37:35 +0800 +Subject: [PATCH 03/14] media: capture: linux: Support libv4l2 plugins + +Allow using libv4l2 plugins for linux v4l2 capture devices. + +Signed-off-by: Jeffy Chen +--- + media/capture/BUILD.gn | 14 +++++ + .../video/linux/v4l2_capture_device_impl.cc | 52 ++++++++++++++++++- + .../video/linux/v4l2_capture_device_impl.h | 11 ++++ + 3 files changed, 76 insertions(+), 1 deletion(-) + +diff --git a/media/capture/BUILD.gn b/media/capture/BUILD.gn +index 11c7972e..89b73d3e 100644 +--- a/media/capture/BUILD.gn ++++ b/media/capture/BUILD.gn +@@ -2,6 +2,7 @@ + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. + ++import("//build/buildflag_header.gni") + import("//build/config/chromeos/ui_mode.gni") + import("//build/config/features.gni") + import("//build/config/ui.gni") +@@ -18,6 +19,14 @@ group("capture") { + ] + } + ++buildflag_header("buildflags") { ++ header = "buildflags.h" ++ ++ flags = [ ++ "USE_LIBV4L2=$use_v4lplugin", ++ ] ++} ++ + component("capture_switches") { + defines = [ "CAPTURE_IMPLEMENTATION" ] + sources = [ +@@ -266,6 +275,11 @@ component("capture_lib") { + "video/linux/video_capture_device_linux.cc", + "video/linux/video_capture_device_linux.h", + ] ++ public_deps += [ ":buildflags" ] ++ ++ if (use_v4lplugin) { ++ deps += [ "//media/gpu/v4l2:libv4l2_stubs" ] ++ } + } + + if (is_chromeos_ash) { +diff --git a/media/capture/video/linux/v4l2_capture_device_impl.cc b/media/capture/video/linux/v4l2_capture_device_impl.cc +index c9040f5d..d05d1179 100644 +--- a/media/capture/video/linux/v4l2_capture_device_impl.cc ++++ b/media/capture/video/linux/v4l2_capture_device_impl.cc +@@ -10,19 +10,61 @@ + #include + #include + ++#if BUILDFLAG(USE_LIBV4L2) ++// Auto-generated for dlopen libv4l2 libraries ++#include "media/gpu/v4l2/v4l2_stubs.h" ++#include "third_party/v4l-utils/lib/include/libv4l2.h" ++ ++#include "base/files/file_path.h" ++ ++using media_gpu_v4l2::kModuleV4l2; ++using media_gpu_v4l2::InitializeStubs; ++using media_gpu_v4l2::StubPathMap; ++ ++static const base::FilePath::CharType kV4l2Lib[] = ++ FILE_PATH_LITERAL("/usr/lib/libv4l2.so"); ++#endif ++ + namespace media { + + V4L2CaptureDeviceImpl::~V4L2CaptureDeviceImpl() = default; + ++V4L2CaptureDeviceImpl::V4L2CaptureDeviceImpl() { ++#if BUILDFLAG(USE_LIBV4L2) ++ StubPathMap paths; ++ paths[kModuleV4l2].push_back(kV4l2Lib); ++ ++ has_libv4l2_ = InitializeStubs(paths); ++#endif ++} ++ + int V4L2CaptureDeviceImpl::open(const char* device_name, int flags) { +- return ::open(device_name, flags); ++ int fd = ::open64(device_name, flags); ++ if (fd < 0) ++ return fd; ++ ++#if BUILDFLAG(USE_LIBV4L2) ++ use_libv4l2_ = false; ++ if (has_libv4l2_ && v4l2_fd_open(fd, V4L2_DISABLE_CONVERSION) != -1) { ++ use_libv4l2_ = true; ++ } ++#endif ++ return fd; + } + + int V4L2CaptureDeviceImpl::close(int fd) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_close(fd); ++#endif + return ::close(fd); + } + + int V4L2CaptureDeviceImpl::ioctl(int fd, int request, void* argp) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_ioctl(fd, request, argp); ++#endif + return ::ioctl(fd, request, argp); + } + +@@ -32,10 +74,18 @@ void* V4L2CaptureDeviceImpl::mmap(void* start, + int flags, + int fd, + off_t offset) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_mmap(start, length, prot, flags, fd, offset); ++#endif + return ::mmap(start, length, prot, flags, fd, offset); + } + + int V4L2CaptureDeviceImpl::munmap(void* start, size_t length) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_munmap(start, length); ++#endif + return ::munmap(start, length); + } + +diff --git a/media/capture/video/linux/v4l2_capture_device_impl.h b/media/capture/video/linux/v4l2_capture_device_impl.h +index 936c8b09..f96c2d43 100644 +--- a/media/capture/video/linux/v4l2_capture_device_impl.h ++++ b/media/capture/video/linux/v4l2_capture_device_impl.h +@@ -8,6 +8,7 @@ + #include + #include + ++#include "media/capture/buildflags.h" + #include "media/capture/capture_export.h" + #include "media/capture/video/linux/v4l2_capture_device.h" + +@@ -17,6 +18,8 @@ namespace media { + // V4L2 APIs. + class CAPTURE_EXPORT V4L2CaptureDeviceImpl : public V4L2CaptureDevice { + public: ++ V4L2CaptureDeviceImpl(); ++ + int open(const char* device_name, int flags) override; + int close(int fd) override; + int ioctl(int fd, int request, void* argp) override; +@@ -32,6 +35,14 @@ class CAPTURE_EXPORT V4L2CaptureDeviceImpl : public V4L2CaptureDevice { + + private: + ~V4L2CaptureDeviceImpl() override; ++ ++#if BUILDFLAG(USE_LIBV4L2) ++ // Has libv4l2. ++ bool has_libv4l2_; ++ // Use libv4l2 when operating |fd|. ++ bool use_libv4l2_; ++#endif ++ + }; + + } // namespace media +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0004-media-Enable-mojo-media-when-using-v4l2-codec-on-des.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0004-media-Enable-mojo-media-when-using-v4l2-codec-on-des.patch new file mode 100644 index 0000000000000000000000000000000000000000..ecaade5567dee3b0bbdb36507d6ec35447aed46c --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0004-media-Enable-mojo-media-when-using-v4l2-codec-on-des.patch @@ -0,0 +1,30 @@ +From 65398513171cbcc728d5af34395922c5d4cffe85 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 19 Dec 2019 14:22:32 +0800 +Subject: [PATCH 04/14] media: Enable mojo media when using v4l2 codec on + desktop linux + +The newest chromium turns to use mojo video decoder instead of gpu video +decoder. + +Signed-off-by: Jeffy Chen +--- + media/media_options.gni | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/media/media_options.gni b/media/media_options.gni +index 3574b2aa..0b4b7f4a 100644 +--- a/media/media_options.gni ++++ b/media/media_options.gni +@@ -197,7 +197,7 @@ if (is_chromecast) { + ] + _default_mojo_media_host = "gpu" + } else if (is_chromeos_ash || is_mac || is_win || +- ((is_linux || is_chromeos_lacros) && use_vaapi)) { ++ ((is_linux || is_chromeos_lacros) && (use_vaapi || use_v4l2_codec))) { + _default_mojo_media_services = [ "video_decoder" ] + _default_mojo_media_host = "gpu" + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0005-cld3-Avoid-unaligned-accesses.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0005-cld3-Avoid-unaligned-accesses.patch new file mode 100644 index 0000000000000000000000000000000000000000..dec1cb2371708acbbc08f3b7a5f103e90db5924e --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0005-cld3-Avoid-unaligned-accesses.patch @@ -0,0 +1,46 @@ +From eb4ecc5b5e32ead84c90fc06133be7e9b3cf86fb Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 27 Mar 2020 17:48:20 +0800 +Subject: [PATCH 05/14] cld3: Avoid unaligned accesses + +Although the unaligned memory accesses are enabled, somehow i still hit +the SIGBUS: +[23496.643138] Unhandled fault: alignment fault (0x92000021) at 0x00000000b182e636 +Received signal 7 BUS_ADRALN 0000b182e636 + +Signed-off-by: Jeffy Chen +--- + third_party/cld_3/src/src/script_span/port.h | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/third_party/cld_3/src/src/script_span/port.h b/third_party/cld_3/src/src/script_span/port.h +index 2b3bc515..1d437bab 100644 +--- a/third_party/cld_3/src/src/script_span/port.h ++++ b/third_party/cld_3/src/src/script_span/port.h +@@ -78,11 +78,23 @@ namespace CLD2 { + // + // This is a mess, but there's not much we can do about it. + ++#if 0 + #define UNALIGNED_LOAD16(_p) (*reinterpret_cast(_p)) + #define UNALIGNED_LOAD32(_p) (*reinterpret_cast(_p)) + + #define UNALIGNED_STORE16(_p, _val) (*reinterpret_cast(_p) = (_val)) + #define UNALIGNED_STORE32(_p, _val) (*reinterpret_cast(_p) = (_val)) ++#else ++inline uint32 UNALIGNED_LOAD32(const void *p) { ++ uint32 t; ++ memcpy(&t, p, sizeof t); ++ return t; ++} ++ ++inline void UNALIGNED_STORE32(void *p, uint32 v) { ++ memcpy(p, &v, sizeof v); ++} ++#endif + + // TODO(sesse): NEON supports unaligned 64-bit loads and stores. + // See if that would be more efficient on platforms supporting it, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0006-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0006-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch new file mode 100644 index 0000000000000000000000000000000000000000..79ed00939b63159d93d68e5c454a185dd5b5f0f2 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0006-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch @@ -0,0 +1,29 @@ +From 99dd895a2d2e43373d07187e99ceffa8ea153573 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 10 Apr 2020 16:16:08 +0800 +Subject: [PATCH 06/14] media: gpu: v4l2: Use POLLIN for pending event + +The v4l-rkmpp is using eventfd to fake poll events which not supporting +POLLPRI. + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/generic_v4l2_device.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index b9da0b3c..64aa8c6d 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -115,7 +115,7 @@ bool GenericV4L2Device::Poll(bool poll_device, bool* event_pending) { + VPLOGF(1) << "poll() failed"; + return false; + } +- *event_pending = (pollfd != -1 && pollfds[pollfd].revents & POLLPRI); ++ *event_pending = (pollfd != -1 && pollfds[pollfd].revents & POLLIN); + return true; + } + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0007-media-capture-linux-Prefer-using-the-first-device.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0007-media-capture-linux-Prefer-using-the-first-device.patch new file mode 100644 index 0000000000000000000000000000000000000000..dc2ec624471257715509b61fbf7bdc6c0615626b --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0007-media-capture-linux-Prefer-using-the-first-device.patch @@ -0,0 +1,32 @@ +From d74af7a06b44ca48f8a133b84297c77f62e74d48 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 5 Nov 2020 12:22:52 +0800 +Subject: [PATCH 07/14] media: capture: linux: Prefer using the first device + +Somehow the newest chromium would prefer using the last device in some +cases, e.g. apprtc. + +Let's reverse the device array to workaround it. + +Signed-off-by: Jeffy Chen +--- + .../capture/video/linux/video_capture_device_factory_linux.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/media/capture/video/linux/video_capture_device_factory_linux.cc b/media/capture/video/linux/video_capture_device_factory_linux.cc +index 6724957d..9dfcabb2 100644 +--- a/media/capture/video/linux/video_capture_device_factory_linux.cc ++++ b/media/capture/video/linux/video_capture_device_factory_linux.cc +@@ -197,7 +197,8 @@ void VideoCaptureDeviceFactoryLinux::GetDevicesInfo( + continue; + } + +- devices_info.emplace_back(VideoCaptureDeviceDescriptor( ++ // HACK: Somehow the newest chromium would prefer using the last device in some cases, e.g. apprtc ++ devices_info.emplace(devices_info.begin(), VideoCaptureDeviceDescriptor( + display_name, unique_id, model_id, + VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE, GetControlSupport(fd.get()), + VideoCaptureTransportType::OTHER_TRANSPORT, facing_mode)); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0008-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0008-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch new file mode 100644 index 0000000000000000000000000000000000000000..4ceefba3bcc2567fe89aed5f7dc2a93994236968 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0008-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch @@ -0,0 +1,67 @@ +From f7dc3dfe23a907de10143bc4327194389ecbf34e Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 28 Sep 2020 20:02:00 +0800 +Subject: [PATCH 08/14] media: gpu: v4l2: Fix compile error when ozone not + enabled + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/BUILD.gn | 5 ++++- + media/gpu/v4l2/generic_v4l2_device.cc | 7 +++++++ + 2 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn +index 3e637653..9f83e8e3 100644 +--- a/media/gpu/v4l2/BUILD.gn ++++ b/media/gpu/v4l2/BUILD.gn +@@ -108,9 +108,12 @@ source_set("v4l2") { + "//media/parsers", + "//third_party/libyuv", + "//ui/gfx/geometry", +- "//ui/ozone", + ] + ++ if (use_ozone) { ++ deps += [ "//ui/ozone" ] ++ } ++ + if (use_v4lplugin) { + deps += [ ":libv4l2_stubs" ] + } +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index 64aa8c6d..11cf9c96 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -34,8 +34,11 @@ + #include "ui/gl/egl_util.h" + #include "ui/gl/gl_bindings.h" + #include "ui/gl/gl_image_native_pixmap.h" ++ ++#if defined(USE_OZONE) + #include "ui/ozone/public/ozone_platform.h" + #include "ui/ozone/public/surface_factory_ozone.h" ++#endif + + #if BUILDFLAG(USE_LIBV4L2) + // Auto-generated for dlopen libv4l2 libraries +@@ -303,6 +306,9 @@ scoped_refptr GenericV4L2Device::CreateGLImage( + const gfx::Size& size, + const Fourcc fourcc, + gfx::NativePixmapHandle handle) const { ++#if !defined(USE_OZONE) ++ return nullptr; ++#else + DVLOGF(3); + DCHECK(CanCreateEGLImageFrom(fourcc)); + +@@ -337,6 +343,7 @@ scoped_refptr GenericV4L2Device::CreateGLImage( + bool ret = image->Initialize(std::move(pixmap)); + DCHECK(ret); + return image; ++#endif + } + + EGLBoolean GenericV4L2Device::DestroyEGLImage(EGLDisplay egl_display, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0009-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0009-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch new file mode 100644 index 0000000000000000000000000000000000000000..452e9e43c03139164216f64f0e9f7f3f19cd3a1b --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0009-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch @@ -0,0 +1,29 @@ +From 1e426564e9b90e5e17fb0d45c047c021c1da0856 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 20 May 2021 01:05:29 +0800 +Subject: [PATCH 09/14] ui: events: ozone: Define SW_PEN_INSERTED for old + kernel headers + +Signed-off-by: Jeffy Chen +--- + ui/events/ozone/evdev/event_converter_evdev_impl.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/ui/events/ozone/evdev/event_converter_evdev_impl.cc b/ui/events/ozone/evdev/event_converter_evdev_impl.cc +index dbbe648b..8f2e62cf 100644 +--- a/ui/events/ozone/evdev/event_converter_evdev_impl.cc ++++ b/ui/events/ozone/evdev/event_converter_evdev_impl.cc +@@ -30,6 +30,10 @@ namespace { + const int kKeyReleaseValue = 0; + const int kKeyRepeatValue = 2; + ++#ifndef SW_PEN_INSERTED ++#define SW_PEN_INSERTED 0x0f /* set = pen inserted */ ++#endif ++ + // Values for the EV_SW code. + const int kSwitchStylusInserted = SW_PEN_INSERTED; + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0010-Create-new-fence-when-there-s-no-in-fences.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0010-Create-new-fence-when-there-s-no-in-fences.patch new file mode 100644 index 0000000000000000000000000000000000000000..a0577014d3d1c2de8709e86345b0f62ea7dc2b2f --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0010-Create-new-fence-when-there-s-no-in-fences.patch @@ -0,0 +1,60 @@ +From 96e5f317bc2923f4bb8192ead3c67987314fc2f1 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 01:29:11 +0800 +Subject: [PATCH 10/14] Create new fence when there's no in-fences + +There're cases that in-fences are not provided. + +Signed-off-by: Jeffy Chen +--- + .../wayland/gpu/gbm_surfaceless_wayland.cc | 21 +++++++++++++++++-- + 1 file changed, 19 insertions(+), 2 deletions(-) + +diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +index 0f2eb6ec..b283e438 100644 +--- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc ++++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +@@ -30,6 +30,12 @@ static constexpr size_t kMaxSolidColorBuffers = 12; + + static constexpr gfx::Size kSolidColorBufferSize{4, 4}; + ++void WaitForEGLFence(EGLDisplay display, EGLSyncKHR fence) { ++ eglClientWaitSyncKHR(display, fence, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, ++ EGL_FOREVER_KHR); ++ eglDestroySyncKHR(display, fence); ++} ++ + void WaitForGpuFences(std::vector> fences) { + for (auto& fence : fences) + fence->Wait(); +@@ -211,14 +217,25 @@ void GbmSurfacelessWayland::SwapBuffersAsync( + return; + } + +- base::OnceClosure fence_wait_task; + std::vector> fences; ++ // Uset in-fences provided in the overlays. If there are none, we insert our ++ // own fence and wait. + for (auto& plane : frame->planes) { + if (plane.second.gpu_fence) + fences.push_back(std::move(plane.second.gpu_fence)); + } + +- fence_wait_task = base::BindOnce(&WaitForGpuFences, std::move(fences)); ++ base::OnceClosure fence_wait_task; ++ if (!fences.empty()) { ++ fence_wait_task = base::BindOnce(&WaitForGpuFences, std::move(fences)); ++ } else { ++ // TODO(fangzhoug): the following should be replaced by a per surface flush ++ // as it gets implemented in GL drivers. ++ EGLSyncKHR fence = InsertFence(has_implicit_external_sync_); ++ CHECK_NE(fence, EGL_NO_SYNC_KHR) << "eglCreateSyncKHR failed"; ++ ++ fence_wait_task = base::BindOnce(&WaitForEGLFence, GetDisplay(), fence); ++ } + + base::OnceClosure fence_retired_callback = base::BindOnce( + &GbmSurfacelessWayland::FenceRetired, weak_factory_.GetWeakPtr(), frame); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0011-HACK-ozone-wayland-Force-disable-implicit-external-s.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0011-HACK-ozone-wayland-Force-disable-implicit-external-s.patch new file mode 100644 index 0000000000000000000000000000000000000000..0a9ca63f3d219d54d14a47f7d9d2ca98a2b7b819 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0011-HACK-ozone-wayland-Force-disable-implicit-external-s.patch @@ -0,0 +1,30 @@ +From 94ef4fafee8a114d801de83566c8093030a296b5 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 01:41:57 +0800 +Subject: [PATCH 11/14] HACK: [ozone/wayland]: Force disable implicit external + sync + +The Mali's implicit external sync seems broken. + +Signed-off-by: Jeffy Chen +--- + ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +index b283e438..8a0b9d58 100644 +--- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc ++++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +@@ -231,7 +231,8 @@ void GbmSurfacelessWayland::SwapBuffersAsync( + } else { + // TODO(fangzhoug): the following should be replaced by a per surface flush + // as it gets implemented in GL drivers. +- EGLSyncKHR fence = InsertFence(has_implicit_external_sync_); ++ // HACK: The Mali's implicit external sync seems broken. ++ EGLSyncKHR fence = InsertFence(/* has_implicit_external_sync_ */ false); + CHECK_NE(fence, EGL_NO_SYNC_KHR) << "eglCreateSyncKHR failed"; + + fence_wait_task = base::BindOnce(&WaitForEGLFence, GetDisplay(), fence); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0012-HACK-media-capture-linux-Allow-camera-without-suppor.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0012-HACK-media-capture-linux-Allow-camera-without-suppor.patch new file mode 100644 index 0000000000000000000000000000000000000000..38cda343442cfc8d243bf01b9b60c16a90f3b3b2 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0012-HACK-media-capture-linux-Allow-camera-without-suppor.patch @@ -0,0 +1,35 @@ +From ec175e08ea2604f249aa01839a16e260d44d8a07 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 07:25:58 +0800 +Subject: [PATCH 12/14] HACK: media: capture: linux: Allow camera without + supported format + +The chromium would only accept discrete frame sizes. + +Hack it to make Rockchip ISP camera working. + +Signed-off-by: Jeffy Chen +--- + .../video/linux/video_capture_device_factory_linux.cc | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/media/capture/video/linux/video_capture_device_factory_linux.cc b/media/capture/video/linux/video_capture_device_factory_linux.cc +index 9dfcabb2..af7f053d 100644 +--- a/media/capture/video/linux/video_capture_device_factory_linux.cc ++++ b/media/capture/video/linux/video_capture_device_factory_linux.cc +@@ -192,10 +192,8 @@ void VideoCaptureDeviceFactoryLinux::GetDevicesInfo( + + VideoCaptureFormats supported_formats; + GetSupportedFormatsForV4L2BufferType(fd.get(), &supported_formats); +- if (supported_formats.empty()) { +- DVLOG(1) << "No supported formats: " << unique_id; +- continue; +- } ++ if (supported_formats.empty()) ++ LOG(WARNING) << "No supported formats: " << unique_id; + + // HACK: Somehow the newest chromium would prefer using the last device in some cases, e.g. apprtc + devices_info.emplace(devices_info.begin(), VideoCaptureDeviceDescriptor( +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0013-content-gpu-Only-depend-dri-for-X11.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0013-content-gpu-Only-depend-dri-for-X11.patch new file mode 100644 index 0000000000000000000000000000000000000000..f230a8d760740b1a771196df4828b79e2833a2c3 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0013-content-gpu-Only-depend-dri-for-X11.patch @@ -0,0 +1,26 @@ +From 3e9d7d33da0c36d523b42b5ad8489b9573ab7e1c Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 22 Nov 2021 15:59:49 +0800 +Subject: [PATCH 13/14] content: gpu: Only depend dri for X11 + +Signed-off-by: Jeffy Chen +--- + content/gpu/BUILD.gn | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/content/gpu/BUILD.gn b/content/gpu/BUILD.gn +index bdf9b9d9..7883c6fe 100644 +--- a/content/gpu/BUILD.gn ++++ b/content/gpu/BUILD.gn +@@ -127,7 +127,7 @@ target(link_target_type, "gpu_sources") { + } + + # Use DRI on desktop Linux builds. +- if (current_cpu != "s390x" && current_cpu != "ppc64" && is_linux && ++ if (current_cpu != "s390x" && current_cpu != "ppc64" && is_linux && use_x11 && + (!is_chromecast || is_cast_desktop_build)) { + configs += [ "//build/config/linux/dri" ] + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0014-blink-rtc-Force-disabling-optimized-video-scaling.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0014-blink-rtc-Force-disabling-optimized-video-scaling.patch new file mode 100644 index 0000000000000000000000000000000000000000..37f110ea725b5fd409366c2277a96bc16486a8b6 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_97.0.4692/0014-blink-rtc-Force-disabling-optimized-video-scaling.patch @@ -0,0 +1,31 @@ +From 9044f45a383065c2953715e1534aaa18c3a35718 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 1 Dec 2021 18:27:06 +0800 +Subject: [PATCH 14/14] blink: rtc: Force disabling optimized video scaling + +This would break VEA when encoder requires special coded size: +https://bugs.chromium.org/p/chromium/issues/detail?id=1193457#c6 + +Signed-off-by: Jeffy Chen +--- + .../renderer/platform/peerconnection/rtc_video_encoder.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc b/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc +index 14d2a2f5..4604982b 100644 +--- a/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc ++++ b/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc +@@ -1218,6 +1218,10 @@ void RTCVideoEncoder::Impl::EncodeOneFrame() { + #else + false; + #endif ++ ++ // https://bugs.chromium.org/p/chromium/issues/detail?id=1193457#c6 ++ optimized_scaling = false; ++ + if (optimized_scaling) { + DCHECK_EQ(buffer->type(), webrtc::VideoFrameBuffer::Type::kNative); + auto scaled_buffer = buffer->Scale(input_visible_size_.width(), +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0001-media-gpu-v4l2-VD-Add-sequenced_task_runner_handle.h.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0001-media-gpu-v4l2-VD-Add-sequenced_task_runner_handle.h.patch new file mode 100644 index 0000000000000000000000000000000000000000..a183aa150b9b2e30984aec963cbb3b6e638b684d --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0001-media-gpu-v4l2-VD-Add-sequenced_task_runner_handle.h.patch @@ -0,0 +1,44 @@ +From fd38be8256c9865cdfc2903328c41de4d4616dac Mon Sep 17 00:00:00 2001 +From: Chen-Yu Tsai +Date: Fri, 14 Jan 2022 04:33:46 +0000 +Subject: [PATCH 01/17] media/gpu/v4l2: VD: Add sequenced_task_runner_handle.h + header + +In commit e4bb5ae4828be ("media/gpu/chromeos: make sure VideoDecoderMixins +respect Decode()"), usage of base::SequencedTaskRunnerHandle was added, +but its defining header was not included. + +This might have worked with ChromeOS builds through some indirect +inclusion of said header, but it doesn't work when building for standard +Linux. + +Include said header in v4l2_video_decoder.cc where SequencedTaskRunnerHandle +is used. + +BUG=b:192087509 +TEST=Build for standard Linux + +Change-Id: I614788d0a18a3a7f05f99730902d8ca11b1bc820 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3380424 +Reviewed-by: Miguel Casas-Sanchez +Commit-Queue: Chen-Yu Tsai +Cr-Commit-Position: refs/heads/main@{#959037} +--- + media/gpu/v4l2/v4l2_video_decoder.cc | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/media/gpu/v4l2/v4l2_video_decoder.cc b/media/gpu/v4l2/v4l2_video_decoder.cc +index c75a9148..7534052f 100644 +--- a/media/gpu/v4l2/v4l2_video_decoder.cc ++++ b/media/gpu/v4l2/v4l2_video_decoder.cc +@@ -11,6 +11,7 @@ + #include "base/logging.h" + #include "base/memory/ptr_util.h" + #include "base/task/post_task.h" ++#include "base/threading/sequenced_task_runner_handle.h" + #include "base/trace_event/trace_event.h" + #include "media/base/limits.h" + #include "media/base/media_log.h" +-- +2.17.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0002-Add-support-for-V4L2VDA-on-Linux.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0002-Add-support-for-V4L2VDA-on-Linux.patch new file mode 100644 index 0000000000000000000000000000000000000000..ad276ef50d5db6d352089848b3c72909945812a3 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0002-Add-support-for-V4L2VDA-on-Linux.patch @@ -0,0 +1,464 @@ +From f62053a3a3cc31905586e657edcac18f4c6ad8e4 Mon Sep 17 00:00:00 2001 +From: Maksim Sisov +Date: Wed, 31 Jul 2019 09:56:24 +0300 +Subject: [PATCH 02/17] Add support for V4L2VDA on Linux + +This patch enables hardware assisted video decoding via the +Chromium V4L2VDA. Including changes when Linux is used. In +order to use this, use_linux_v4l2_only flag should be set +to true. + +Signed-off-by: Ryo Kodama + +fixup! avoid building not declared formats + +"FRAME", "_SLICE", "V4L2_PIX_FMT_VP9" are not defined in mainline + Linux headers. This patch avoids building these formats. + +Signed-off-by: Ryo Kodama + +fixup! add V4L2_PIX_FMT_VP9 support back again as it is now +included in mainline Linux kernel. This allows VP9 codec +to work with upstream kernel and v4l2 vda. Tested on db820c +with Venus v4l2 driver. + +Signed-off-by: Peter Griffin +Signed-off-by: Stanimir Varbanov +Signed-off-by: Jeffy Chen +--- + .../gpu_mjpeg_decode_accelerator_factory.cc | 3 +- + media/gpu/BUILD.gn | 1 + + media/gpu/args.gni | 4 ++ + .../gpu_video_decode_accelerator_factory.cc | 8 +++ + .../gpu_video_decode_accelerator_factory.h | 2 + + media/gpu/v4l2/BUILD.gn | 43 ++++++------ + media/gpu/v4l2/generic_v4l2_device.cc | 4 ++ + media/gpu/v4l2/v4l2_device.cc | 66 +++++++++++++++++++ + media/gpu/v4l2/v4l2_video_decoder.cc | 7 ++ + 9 files changed, 118 insertions(+), 20 deletions(-) + +diff --git a/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc b/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc +index 3772b8ef0..dece6b77f 100644 +--- a/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc ++++ b/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc +@@ -13,7 +13,8 @@ + #include "media/base/media_switches.h" + #include "media/gpu/buildflags.h" + +-#if BUILDFLAG(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY) ++#if BUILDFLAG(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY) && \ ++ !BUILDFLAG(USE_LINUX_V4L2) + #define USE_V4L2_MJPEG_DECODE_ACCELERATOR + #endif + +diff --git a/media/gpu/BUILD.gn b/media/gpu/BUILD.gn +index 30267d96c..0c8f78de1 100644 +--- a/media/gpu/BUILD.gn ++++ b/media/gpu/BUILD.gn +@@ -20,6 +20,7 @@ buildflag_header("buildflags") { + "USE_VAAPI_IMAGE_CODECS=$use_vaapi_image_codecs", + "USE_V4L2_CODEC=$use_v4l2_codec", + "USE_LIBV4L2=$use_v4lplugin", ++ "USE_LINUX_V4L2=$use_linux_v4l2_only", + "USE_VAAPI_X11=$use_vaapi_x11", + ] + } +diff --git a/media/gpu/args.gni b/media/gpu/args.gni +index bb2ff0797..da20cff79 100644 +--- a/media/gpu/args.gni ++++ b/media/gpu/args.gni +@@ -21,6 +21,10 @@ declare_args() { + # platforms which have v4l2 hardware encoder / decoder. + use_v4l2_codec = false + ++ # Indicates that only definitions available in the mainline linux kernel ++ # will be used. ++ use_linux_v4l2_only = false ++ + # Indicates if Video4Linux2 AML encoder is used. This is used for AML + # platforms which have v4l2 hardware encoder + use_v4l2_codec_aml = false +diff --git a/media/gpu/gpu_video_decode_accelerator_factory.cc b/media/gpu/gpu_video_decode_accelerator_factory.cc +index 0e55ef47e..2096dc619 100644 +--- a/media/gpu/gpu_video_decode_accelerator_factory.cc ++++ b/media/gpu/gpu_video_decode_accelerator_factory.cc +@@ -29,7 +29,9 @@ + #include "ui/gl/gl_implementation.h" + #elif BUILDFLAG(USE_V4L2_CODEC) + #include "media/gpu/v4l2/v4l2_device.h" ++#if !BUILDFLAG(USE_LINUX_V4L2) + #include "media/gpu/v4l2/v4l2_slice_video_decode_accelerator.h" ++#endif + #include "media/gpu/v4l2/v4l2_video_decode_accelerator.h" + #include "ui/gl/gl_surface_egl.h" + #endif +@@ -64,10 +66,12 @@ gpu::VideoDecodeAcceleratorCapabilities GetDecoderCapabilitiesInternal( + GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( + V4L2VideoDecodeAccelerator::GetSupportedProfiles(), + &capabilities.supported_profiles); ++#if !BUILDFLAG(USE_LINUX_V4L2) + GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( + V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles(), + &capabilities.supported_profiles); + #endif ++#endif + #elif defined(OS_MAC) + capabilities.supported_profiles = + VTVideoDecodeAccelerator::GetSupportedProfiles(workarounds); +@@ -146,8 +150,10 @@ GpuVideoDecodeAcceleratorFactory::CreateVDA( + &GpuVideoDecodeAcceleratorFactory::CreateVaapiVDA, + #elif BUILDFLAG(USE_V4L2_CODEC) + &GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA, ++#if !BUILDFLAG(USE_LINUX_V4L2) + &GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA, + #endif ++#endif + + #if defined(OS_MAC) + &GpuVideoDecodeAcceleratorFactory::CreateVTVDA, +@@ -207,6 +213,7 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA( + return decoder; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + std::unique_ptr + GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA( + const gpu::GpuDriverBugWorkarounds& /*workarounds*/, +@@ -222,6 +229,7 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA( + return decoder; + } + #endif ++#endif + + #if defined(OS_MAC) + std::unique_ptr +diff --git a/media/gpu/gpu_video_decode_accelerator_factory.h b/media/gpu/gpu_video_decode_accelerator_factory.h +index a80cac212..1021af34a 100644 +--- a/media/gpu/gpu_video_decode_accelerator_factory.h ++++ b/media/gpu/gpu_video_decode_accelerator_factory.h +@@ -104,11 +104,13 @@ class MEDIA_GPU_EXPORT GpuVideoDecodeAcceleratorFactory { + const gpu::GpuDriverBugWorkarounds& workarounds, + const gpu::GpuPreferences& gpu_preferences, + MediaLog* media_log) const; ++#if !BUILDFLAG(USE_LINUX_V4L2) + std::unique_ptr CreateV4L2SliceVDA( + const gpu::GpuDriverBugWorkarounds& workarounds, + const gpu::GpuPreferences& gpu_preferences, + MediaLog* media_log) const; + #endif ++#endif + #if defined(OS_MAC) + std::unique_ptr CreateVTVDA( + const gpu::GpuDriverBugWorkarounds& workarounds, +diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn +index 0322bbf7f..e7a8743d4 100644 +--- a/media/gpu/v4l2/BUILD.gn ++++ b/media/gpu/v4l2/BUILD.gn +@@ -28,9 +28,6 @@ source_set("v4l2") { + "buffer_affinity_tracker.h", + "generic_v4l2_device.cc", + "generic_v4l2_device.h", +- "v4l2_decode_surface.cc", +- "v4l2_decode_surface.h", +- "v4l2_decode_surface_handler.h", + "v4l2_device.cc", + "v4l2_device.h", + "v4l2_device_poller.cc", +@@ -39,8 +36,6 @@ source_set("v4l2") { + "v4l2_framerate_control.h", + "v4l2_image_processor_backend.cc", + "v4l2_image_processor_backend.h", +- "v4l2_slice_video_decode_accelerator.cc", +- "v4l2_slice_video_decode_accelerator.h", + "v4l2_stateful_workaround.cc", + "v4l2_stateful_workaround.h", + "v4l2_status.h", +@@ -56,24 +51,34 @@ source_set("v4l2") { + "v4l2_video_decoder_backend.h", + "v4l2_video_decoder_backend_stateful.cc", + "v4l2_video_decoder_backend_stateful.h", +- "v4l2_video_decoder_backend_stateless.cc", +- "v4l2_video_decoder_backend_stateless.h", +- "v4l2_video_decoder_delegate_h264.cc", +- "v4l2_video_decoder_delegate_h264.h", +- "v4l2_video_decoder_delegate_h264_legacy.cc", +- "v4l2_video_decoder_delegate_h264_legacy.h", +- "v4l2_video_decoder_delegate_vp8.cc", +- "v4l2_video_decoder_delegate_vp8.h", +- "v4l2_video_decoder_delegate_vp8_legacy.cc", +- "v4l2_video_decoder_delegate_vp8_legacy.h", +- "v4l2_video_decoder_delegate_vp9_chromium.cc", +- "v4l2_video_decoder_delegate_vp9_chromium.h", +- "v4l2_video_decoder_delegate_vp9_legacy.cc", +- "v4l2_video_decoder_delegate_vp9_legacy.h", + "v4l2_video_encode_accelerator.cc", + "v4l2_video_encode_accelerator.h", + ] + ++ if (!use_linux_v4l2_only) { ++ sources += [ ++ "v4l2_decode_surface.cc", ++ "v4l2_decode_surface.h", ++ "v4l2_decode_surface_handler.h", ++ "v4l2_slice_video_decode_accelerator.cc", ++ "v4l2_slice_video_decode_accelerator.h", ++ "v4l2_video_decoder_backend_stateless.cc", ++ "v4l2_video_decoder_backend_stateless.h", ++ "v4l2_video_decoder_delegate_h264.cc", ++ "v4l2_video_decoder_delegate_h264.h", ++ "v4l2_video_decoder_delegate_h264_legacy.cc", ++ "v4l2_video_decoder_delegate_h264_legacy.h", ++ "v4l2_video_decoder_delegate_vp8.cc", ++ "v4l2_video_decoder_delegate_vp8.h", ++ "v4l2_video_decoder_delegate_vp8_legacy.cc", ++ "v4l2_video_decoder_delegate_vp8_legacy.h", ++ "v4l2_video_decoder_delegate_vp9_chromium.cc", ++ "v4l2_video_decoder_delegate_vp9_chromium.h", ++ "v4l2_video_decoder_delegate_vp9_legacy.cc", ++ "v4l2_video_decoder_delegate_vp9_legacy.h", ++ ] ++ } ++ + libs = [ + "EGL", + "GLESv2", +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index b64c9bd0f..92ec1b607 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -441,7 +441,11 @@ bool GenericV4L2Device::OpenDevicePath(const std::string& path, Type type) { + return false; + + #if BUILDFLAG(USE_LIBV4L2) ++#if BUILDFLAG(USE_LINUX_V4L2) ++ if ( ++#else + if (type == Type::kEncoder && ++#endif + HANDLE_EINTR(v4l2_fd_open(device_fd_.get(), V4L2_DISABLE_CONVERSION)) != + -1) { + DVLOGF(3) << "Using libv4l2 for " << path; +diff --git a/media/gpu/v4l2/v4l2_device.cc b/media/gpu/v4l2/v4l2_device.cc +index ee99d095f..98a0d51fa 100644 +--- a/media/gpu/v4l2/v4l2_device.cc ++++ b/media/gpu/v4l2/v4l2_device.cc +@@ -853,7 +853,9 @@ void V4L2WritableBufferRef::SetConfigStore(uint32_t config_store) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK(buffer_data_); + ++#if !BUILDFLAG(USE_LINUX_V4L2) + buffer_data_->v4l2_buffer_.config_store = config_store; ++#endif + } + + V4L2ReadableBuffer::V4L2ReadableBuffer(const struct v4l2_buffer& v4l2_buffer, +@@ -996,10 +998,12 @@ V4L2Queue::V4L2Queue(scoped_refptr dev, + return; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + if (reqbufs.capabilities & V4L2_BUF_CAP_SUPPORTS_REQUESTS) { + supports_requests_ = true; + DVLOGF(4) << "Queue supports request API."; + } ++#endif + } + + V4L2Queue::~V4L2Queue() { +@@ -1527,6 +1531,23 @@ scoped_refptr V4L2Device::Create() { + // static + uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + bool slice_based) { ++#if BUILDFLAG(USE_LINUX_V4L2) ++ if (slice_based) { ++ LOG(ERROR) << "Slice not supported"; ++ return 0; ++ } ++ ++ if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { ++ return V4L2_PIX_FMT_H264; ++ } else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) { ++ return V4L2_PIX_FMT_VP8; ++ } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) { ++ return V4L2_PIX_FMT_VP9; ++ } else { ++ DVLOGF(1) << "Unsupported profile: " << GetProfileName(profile); ++ return 0; ++ } ++#else + if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { + if (slice_based) + return V4L2_PIX_FMT_H264_SLICE; +@@ -1546,8 +1567,10 @@ uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile, + DVLOGF(1) << "Unsupported profile: " << GetProfileName(profile); + return 0; + } ++#endif + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + namespace { + + VideoCodecProfile V4L2ProfileToVideoCodecProfile(VideoCodec codec, +@@ -1594,9 +1617,11 @@ VideoCodecProfile V4L2ProfileToVideoCodecProfile(VideoCodec codec, + } + + } // namespace ++#endif + + std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + uint32_t pix_fmt) { ++#if !BUILDFLAG(USE_LINUX_V4L2) + auto get_supported_profiles = [this]( + VideoCodec codec, + std::vector* profiles) { +@@ -1667,6 +1692,27 @@ std::vector V4L2Device::V4L2PixFmtToVideoCodecProfiles( + VLOGF(1) << "Unhandled pixelformat " << FourccToString(pix_fmt); + return {}; + } ++#else ++ std::vector profiles; ++ switch (pix_fmt) { ++ case V4L2_PIX_FMT_H264: ++ profiles = { ++ H264PROFILE_BASELINE, ++ H264PROFILE_MAIN, ++ H264PROFILE_HIGH, ++ }; ++ break; ++ case V4L2_PIX_FMT_VP8: ++ profiles = {VP8PROFILE_ANY}; ++ break; ++ case V4L2_PIX_FMT_VP9: ++ profiles = {VP9PROFILE_PROFILE0}; ++ break; ++ default: ++ VLOGF(1) << "Unhandled pixelformat " << FourccToString(pix_fmt); ++ return {}; ++ } ++#endif + + // Erase duplicated profiles. + std::sort(profiles.begin(), profiles.end()); +@@ -2334,10 +2380,14 @@ bool V4L2Request::ApplyCtrls(struct v4l2_ext_controls* ctrls) { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + ctrls->which = V4L2_CTRL_WHICH_REQUEST_VAL; + ctrls->request_fd = request_fd_.get(); + + return true; ++#else ++ return false; ++#endif + } + + bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) { +@@ -2349,10 +2399,14 @@ bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + buffer->flags |= V4L2_BUF_FLAG_REQUEST_FD; + buffer->request_fd = request_fd_.get(); + + return true; ++#else ++ return false; ++#endif + } + + bool V4L2Request::Submit() { +@@ -2363,7 +2417,11 @@ bool V4L2Request::Submit() { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + return HANDLE_EINTR(ioctl(request_fd_.get(), MEDIA_REQUEST_IOC_QUEUE)) == 0; ++#else ++ return false; ++#endif + } + + bool V4L2Request::IsCompleted() { +@@ -2406,6 +2464,7 @@ bool V4L2Request::Reset() { + return false; + } + ++#if !BUILDFLAG(USE_LINUX_V4L2) + // Reinit the request to make sure we can use it for a new submission. + if (HANDLE_EINTR(ioctl(request_fd_.get(), MEDIA_REQUEST_IOC_REINIT)) < 0) { + VPLOGF(1) << "Failed to reinit request."; +@@ -2413,6 +2472,9 @@ bool V4L2Request::Reset() { + } + + return true; ++#else ++ return false; ++#endif + } + + V4L2RequestRefBase::V4L2RequestRefBase(V4L2RequestRefBase&& req_base) { +@@ -2487,6 +2549,7 @@ V4L2RequestsQueue::~V4L2RequestsQueue() { + absl::optional V4L2RequestsQueue::CreateRequestFD() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + ++#if !BUILDFLAG(USE_LINUX_V4L2) + int request_fd; + int ret = HANDLE_EINTR( + ioctl(media_fd_.get(), MEDIA_IOC_REQUEST_ALLOC, &request_fd)); +@@ -2496,6 +2559,9 @@ absl::optional V4L2RequestsQueue::CreateRequestFD() { + } + + return base::ScopedFD(request_fd); ++#else ++ return absl::nullopt; ++#endif + } + + absl::optional V4L2RequestsQueue::GetFreeRequest() { +diff --git a/media/gpu/v4l2/v4l2_video_decoder.cc b/media/gpu/v4l2/v4l2_video_decoder.cc +index 7534052f9..afde6b8e4 100644 +--- a/media/gpu/v4l2/v4l2_video_decoder.cc ++++ b/media/gpu/v4l2/v4l2_video_decoder.cc +@@ -27,7 +27,10 @@ + #include "media/gpu/macros.h" + #include "media/gpu/v4l2/v4l2_status.h" + #include "media/gpu/v4l2/v4l2_video_decoder_backend_stateful.h" ++ ++#if !BUILDFLAG(USE_LINUX_V4L2) + #include "media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h" ++#endif + + namespace media { + +@@ -45,7 +48,9 @@ constexpr size_t kNumInputBuffers = 8; + + // Input format V4L2 fourccs this class supports. + constexpr uint32_t kSupportedInputFourccs[] = { ++#if !BUILDFLAG(USE_LINUX_V4L2) + V4L2_PIX_FMT_H264_SLICE, V4L2_PIX_FMT_VP8_FRAME, V4L2_PIX_FMT_VP9_FRAME, ++#endif + V4L2_PIX_FMT_H264, V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9, + }; + +@@ -317,6 +322,7 @@ V4L2Status V4L2VideoDecoder::InitializeBackend() { + << " and fourcc: " << FourccToString(input_format_fourcc); + backend_ = std::make_unique( + this, device_, profile_, decoder_task_runner_); ++#if !BUILDFLAG(USE_LINUX_V4L2) + } else { + DCHECK_EQ(preferred_api_and_format.first, kStateless); + VLOGF(1) << "Using a stateless API for profile: " +@@ -324,6 +330,7 @@ V4L2Status V4L2VideoDecoder::InitializeBackend() { + << " and fourcc: " << FourccToString(input_format_fourcc); + backend_ = std::make_unique( + this, device_, profile_, decoder_task_runner_); ++#endif + } + + if (!backend_->Initialize()) { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0003-Add-mmap-via-libv4l-to-generic_v4l2_device.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0003-Add-mmap-via-libv4l-to-generic_v4l2_device.patch new file mode 100644 index 0000000000000000000000000000000000000000..22569b76f70d252d305ea9166a0c6e2ec4e6306b --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0003-Add-mmap-via-libv4l-to-generic_v4l2_device.patch @@ -0,0 +1,49 @@ +From 43581c52dd67d67f1366195155989e810dd78cf2 Mon Sep 17 00:00:00 2001 +From: Damian Hobson-Garcia +Date: Wed, 21 Mar 2018 13:18:17 +0200 +Subject: [PATCH 03/17] Add mmap via libv4l to generic_v4l2_device + +Issue #437 +--- + media/gpu/v4l2/generic_v4l2_device.cc | 10 ++++++++++ + media/gpu/v4l2/v4l2.sig | 2 ++ + 2 files changed, 12 insertions(+) + +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index 92ec1b60..b9da0b3c 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -125,10 +125,20 @@ void* GenericV4L2Device::Mmap(void* addr, + int flags, + unsigned int offset) { + DCHECK(device_fd_.is_valid()); ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_mmap(addr, len, prot, flags, device_fd_.get(), offset); ++#endif + return mmap(addr, len, prot, flags, device_fd_.get(), offset); + } + + void GenericV4L2Device::Munmap(void* addr, unsigned int len) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) { ++ v4l2_munmap(addr, len); ++ return; ++ } ++#endif + munmap(addr, len); + } + +diff --git a/media/gpu/v4l2/v4l2.sig b/media/gpu/v4l2/v4l2.sig +index 4269fb48..71b5b378 100644 +--- a/media/gpu/v4l2/v4l2.sig ++++ b/media/gpu/v4l2/v4l2.sig +@@ -8,3 +8,5 @@ + LIBV4L_PUBLIC int v4l2_close(int fd); + LIBV4L_PUBLIC int v4l2_ioctl(int fd, unsigned long int request, ...); + LIBV4L_PUBLIC int v4l2_fd_open(int fd, int v4l2_flags); ++LIBV4L_PUBLIC void *v4l2_mmap(void *start, size_t length, int prot, int flags, int fd, int64_t offset); ++LIBV4L_PUBLIC int v4l2_munmap(void *_start, size_t length); +-- +2.17.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0004-media-capture-linux-Support-libv4l2-plugins.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0004-media-capture-linux-Support-libv4l2-plugins.patch new file mode 100644 index 0000000000000000000000000000000000000000..ba14b8bf90284c7e3ac33c8ded662766c8bef738 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0004-media-capture-linux-Support-libv4l2-plugins.patch @@ -0,0 +1,178 @@ +From 0ffb2cf197a5e50f4f75576963e98219ddea137a Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 1 Jul 2019 10:37:35 +0800 +Subject: [PATCH 04/17] media: capture: linux: Support libv4l2 plugins + +Allow using libv4l2 plugins for linux v4l2 capture devices. + +Signed-off-by: Jeffy Chen +--- + media/capture/BUILD.gn | 14 +++++ + .../video/linux/v4l2_capture_device_impl.cc | 52 ++++++++++++++++++- + .../video/linux/v4l2_capture_device_impl.h | 11 ++++ + 3 files changed, 76 insertions(+), 1 deletion(-) + +diff --git a/media/capture/BUILD.gn b/media/capture/BUILD.gn +index e0cd3cdc..7f582430 100644 +--- a/media/capture/BUILD.gn ++++ b/media/capture/BUILD.gn +@@ -2,6 +2,7 @@ + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. + ++import("//build/buildflag_header.gni") + import("//build/config/chromeos/ui_mode.gni") + import("//build/config/features.gni") + import("//build/config/ui.gni") +@@ -18,6 +19,14 @@ group("capture") { + ] + } + ++buildflag_header("buildflags") { ++ header = "buildflags.h" ++ ++ flags = [ ++ "USE_LIBV4L2=$use_v4lplugin", ++ ] ++} ++ + component("capture_switches") { + defines = [ "CAPTURE_IMPLEMENTATION" ] + sources = [ +@@ -266,6 +275,11 @@ component("capture_lib") { + "video/linux/video_capture_device_linux.cc", + "video/linux/video_capture_device_linux.h", + ] ++ public_deps += [ ":buildflags" ] ++ ++ if (use_v4lplugin) { ++ deps += [ "//media/gpu/v4l2:libv4l2_stubs" ] ++ } + } + + if (is_chromeos_ash) { +diff --git a/media/capture/video/linux/v4l2_capture_device_impl.cc b/media/capture/video/linux/v4l2_capture_device_impl.cc +index c9040f5d..d05d1179 100644 +--- a/media/capture/video/linux/v4l2_capture_device_impl.cc ++++ b/media/capture/video/linux/v4l2_capture_device_impl.cc +@@ -10,19 +10,61 @@ + #include + #include + ++#if BUILDFLAG(USE_LIBV4L2) ++// Auto-generated for dlopen libv4l2 libraries ++#include "media/gpu/v4l2/v4l2_stubs.h" ++#include "third_party/v4l-utils/lib/include/libv4l2.h" ++ ++#include "base/files/file_path.h" ++ ++using media_gpu_v4l2::kModuleV4l2; ++using media_gpu_v4l2::InitializeStubs; ++using media_gpu_v4l2::StubPathMap; ++ ++static const base::FilePath::CharType kV4l2Lib[] = ++ FILE_PATH_LITERAL("/usr/lib/libv4l2.so"); ++#endif ++ + namespace media { + + V4L2CaptureDeviceImpl::~V4L2CaptureDeviceImpl() = default; + ++V4L2CaptureDeviceImpl::V4L2CaptureDeviceImpl() { ++#if BUILDFLAG(USE_LIBV4L2) ++ StubPathMap paths; ++ paths[kModuleV4l2].push_back(kV4l2Lib); ++ ++ has_libv4l2_ = InitializeStubs(paths); ++#endif ++} ++ + int V4L2CaptureDeviceImpl::open(const char* device_name, int flags) { +- return ::open(device_name, flags); ++ int fd = ::open64(device_name, flags); ++ if (fd < 0) ++ return fd; ++ ++#if BUILDFLAG(USE_LIBV4L2) ++ use_libv4l2_ = false; ++ if (has_libv4l2_ && v4l2_fd_open(fd, V4L2_DISABLE_CONVERSION) != -1) { ++ use_libv4l2_ = true; ++ } ++#endif ++ return fd; + } + + int V4L2CaptureDeviceImpl::close(int fd) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_close(fd); ++#endif + return ::close(fd); + } + + int V4L2CaptureDeviceImpl::ioctl(int fd, int request, void* argp) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_ioctl(fd, request, argp); ++#endif + return ::ioctl(fd, request, argp); + } + +@@ -32,10 +74,18 @@ void* V4L2CaptureDeviceImpl::mmap(void* start, + int flags, + int fd, + off_t offset) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_mmap(start, length, prot, flags, fd, offset); ++#endif + return ::mmap(start, length, prot, flags, fd, offset); + } + + int V4L2CaptureDeviceImpl::munmap(void* start, size_t length) { ++#if BUILDFLAG(USE_LIBV4L2) ++ if (use_libv4l2_) ++ return v4l2_munmap(start, length); ++#endif + return ::munmap(start, length); + } + +diff --git a/media/capture/video/linux/v4l2_capture_device_impl.h b/media/capture/video/linux/v4l2_capture_device_impl.h +index 936c8b09..f96c2d43 100644 +--- a/media/capture/video/linux/v4l2_capture_device_impl.h ++++ b/media/capture/video/linux/v4l2_capture_device_impl.h +@@ -8,6 +8,7 @@ + #include + #include + ++#include "media/capture/buildflags.h" + #include "media/capture/capture_export.h" + #include "media/capture/video/linux/v4l2_capture_device.h" + +@@ -17,6 +18,8 @@ namespace media { + // V4L2 APIs. + class CAPTURE_EXPORT V4L2CaptureDeviceImpl : public V4L2CaptureDevice { + public: ++ V4L2CaptureDeviceImpl(); ++ + int open(const char* device_name, int flags) override; + int close(int fd) override; + int ioctl(int fd, int request, void* argp) override; +@@ -32,6 +35,14 @@ class CAPTURE_EXPORT V4L2CaptureDeviceImpl : public V4L2CaptureDevice { + + private: + ~V4L2CaptureDeviceImpl() override; ++ ++#if BUILDFLAG(USE_LIBV4L2) ++ // Has libv4l2. ++ bool has_libv4l2_; ++ // Use libv4l2 when operating |fd|. ++ bool use_libv4l2_; ++#endif ++ + }; + + } // namespace media +-- +2.17.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0005-media-Enable-mojo-media-when-using-v4l2-codec-on-des.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0005-media-Enable-mojo-media-when-using-v4l2-codec-on-des.patch new file mode 100644 index 0000000000000000000000000000000000000000..f7c9d905bcec1136e6207e4013e4927cce9ea5f5 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0005-media-Enable-mojo-media-when-using-v4l2-codec-on-des.patch @@ -0,0 +1,30 @@ +From aa4b0ec4529a95e434543da16838b73e69992dec Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 19 Dec 2019 14:22:32 +0800 +Subject: [PATCH 05/17] media: Enable mojo media when using v4l2 codec on + desktop linux + +The newest chromium turns to use mojo video decoder instead of gpu video +decoder. + +Signed-off-by: Jeffy Chen +--- + media/media_options.gni | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/media/media_options.gni b/media/media_options.gni +index 2f3ad542..90dcfafa 100644 +--- a/media/media_options.gni ++++ b/media/media_options.gni +@@ -208,7 +208,7 @@ if (is_chromecast) { + ] + _default_mojo_media_host = "gpu" + } else if (is_chromeos_ash || is_mac || is_win || +- ((is_linux || is_chromeos_lacros) && use_vaapi)) { ++ ((is_linux || is_chromeos_lacros) && (use_vaapi || use_v4l2_codec))) { + _default_mojo_media_services = [ "video_decoder" ] + _default_mojo_media_host = "gpu" + } +-- +2.17.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0006-cld3-Avoid-unaligned-accesses.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0006-cld3-Avoid-unaligned-accesses.patch new file mode 100644 index 0000000000000000000000000000000000000000..77071b4a7ea8d52d1f22d2c4cbbb0981d3cead4c --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0006-cld3-Avoid-unaligned-accesses.patch @@ -0,0 +1,46 @@ +From 8720cc202c671ba83dea8bed6344d39c69accb2d Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 27 Mar 2020 17:48:20 +0800 +Subject: [PATCH 06/17] cld3: Avoid unaligned accesses + +Although the unaligned memory accesses are enabled, somehow i still hit +the SIGBUS: +[23496.643138] Unhandled fault: alignment fault (0x92000021) at 0x00000000b182e636 +Received signal 7 BUS_ADRALN 0000b182e636 + +Signed-off-by: Jeffy Chen +--- + third_party/cld_3/src/src/script_span/port.h | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/third_party/cld_3/src/src/script_span/port.h b/third_party/cld_3/src/src/script_span/port.h +index 2b3bc515..1d437bab 100644 +--- a/third_party/cld_3/src/src/script_span/port.h ++++ b/third_party/cld_3/src/src/script_span/port.h +@@ -78,11 +78,23 @@ namespace CLD2 { + // + // This is a mess, but there's not much we can do about it. + ++#if 0 + #define UNALIGNED_LOAD16(_p) (*reinterpret_cast(_p)) + #define UNALIGNED_LOAD32(_p) (*reinterpret_cast(_p)) + + #define UNALIGNED_STORE16(_p, _val) (*reinterpret_cast(_p) = (_val)) + #define UNALIGNED_STORE32(_p, _val) (*reinterpret_cast(_p) = (_val)) ++#else ++inline uint32 UNALIGNED_LOAD32(const void *p) { ++ uint32 t; ++ memcpy(&t, p, sizeof t); ++ return t; ++} ++ ++inline void UNALIGNED_STORE32(void *p, uint32 v) { ++ memcpy(p, &v, sizeof v); ++} ++#endif + + // TODO(sesse): NEON supports unaligned 64-bit loads and stores. + // See if that would be more efficient on platforms supporting it, +-- +2.17.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0007-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0007-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch new file mode 100644 index 0000000000000000000000000000000000000000..e6bfb808f718fbc7e7e7b689d18873488b65b99b --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0007-media-gpu-v4l2-Use-POLLIN-for-pending-event.patch @@ -0,0 +1,29 @@ +From 8a48561c514b3ba7db6177722c79b06d39182ab1 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 10 Apr 2020 16:16:08 +0800 +Subject: [PATCH 07/17] media: gpu: v4l2: Use POLLIN for pending event + +The v4l-rkmpp is using eventfd to fake poll events which not supporting +POLLPRI. + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/generic_v4l2_device.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index b9da0b3c..64aa8c6d 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -115,7 +115,7 @@ bool GenericV4L2Device::Poll(bool poll_device, bool* event_pending) { + VPLOGF(1) << "poll() failed"; + return false; + } +- *event_pending = (pollfd != -1 && pollfds[pollfd].revents & POLLPRI); ++ *event_pending = (pollfd != -1 && pollfds[pollfd].revents & POLLIN); + return true; + } + +-- +2.17.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0008-media-capture-linux-Prefer-using-the-first-device.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0008-media-capture-linux-Prefer-using-the-first-device.patch new file mode 100644 index 0000000000000000000000000000000000000000..5949b0951a837f6c092750416de1c129b36a3efb --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0008-media-capture-linux-Prefer-using-the-first-device.patch @@ -0,0 +1,32 @@ +From d722fecb489f2ab0222e94d6fbce6f9ca27930c4 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 5 Nov 2020 12:22:52 +0800 +Subject: [PATCH 08/17] media: capture: linux: Prefer using the first device + +Somehow the newest chromium would prefer using the last device in some +cases, e.g. apprtc. + +Let's reverse the device array to workaround it. + +Signed-off-by: Jeffy Chen +--- + .../capture/video/linux/video_capture_device_factory_linux.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/media/capture/video/linux/video_capture_device_factory_linux.cc b/media/capture/video/linux/video_capture_device_factory_linux.cc +index c544563f..4279ae8c 100644 +--- a/media/capture/video/linux/video_capture_device_factory_linux.cc ++++ b/media/capture/video/linux/video_capture_device_factory_linux.cc +@@ -197,7 +197,8 @@ void VideoCaptureDeviceFactoryLinux::GetDevicesInfo( + continue; + } + +- devices_info.emplace_back(VideoCaptureDeviceDescriptor( ++ // HACK: Somehow the newest chromium would prefer using the last device in some cases, e.g. apprtc ++ devices_info.emplace(devices_info.begin(), VideoCaptureDeviceDescriptor( + display_name, unique_id, model_id, + VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE, GetControlSupport(fd.get()), + VideoCaptureTransportType::OTHER_TRANSPORT, facing_mode)); +-- +2.17.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0009-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0009-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch new file mode 100644 index 0000000000000000000000000000000000000000..6fedd8cc75523c38ea45de4d8640e6febd2584d8 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0009-media-gpu-v4l2-Fix-compile-error-when-ozone-not-enab.patch @@ -0,0 +1,67 @@ +From 8b9a4232e72c16805e3845e472c4e1532647422f Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 28 Sep 2020 20:02:00 +0800 +Subject: [PATCH 09/17] media: gpu: v4l2: Fix compile error when ozone not + enabled + +Signed-off-by: Jeffy Chen +--- + media/gpu/v4l2/BUILD.gn | 5 ++++- + media/gpu/v4l2/generic_v4l2_device.cc | 7 +++++++ + 2 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn +index abd85698..f20f18c3 100644 +--- a/media/gpu/v4l2/BUILD.gn ++++ b/media/gpu/v4l2/BUILD.gn +@@ -108,9 +108,12 @@ source_set("v4l2") { + "//media/parsers", + "//third_party/libyuv", + "//ui/gfx/geometry", +- "//ui/ozone", + ] + ++ if (use_ozone) { ++ deps += [ "//ui/ozone" ] ++ } ++ + if (use_v4lplugin) { + deps += [ ":libv4l2_stubs" ] + } +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index 64aa8c6d..11cf9c96 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -34,8 +34,11 @@ + #include "ui/gl/egl_util.h" + #include "ui/gl/gl_bindings.h" + #include "ui/gl/gl_image_native_pixmap.h" ++ ++#if defined(USE_OZONE) + #include "ui/ozone/public/ozone_platform.h" + #include "ui/ozone/public/surface_factory_ozone.h" ++#endif + + #if BUILDFLAG(USE_LIBV4L2) + // Auto-generated for dlopen libv4l2 libraries +@@ -303,6 +306,9 @@ scoped_refptr GenericV4L2Device::CreateGLImage( + const gfx::Size& size, + const Fourcc fourcc, + gfx::NativePixmapHandle handle) const { ++#if !defined(USE_OZONE) ++ return nullptr; ++#else + DVLOGF(3); + DCHECK(CanCreateEGLImageFrom(fourcc)); + +@@ -337,6 +343,7 @@ scoped_refptr GenericV4L2Device::CreateGLImage( + bool ret = image->Initialize(std::move(pixmap)); + DCHECK(ret); + return image; ++#endif + } + + EGLBoolean GenericV4L2Device::DestroyEGLImage(EGLDisplay egl_display, +-- +2.17.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0010-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0010-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch new file mode 100644 index 0000000000000000000000000000000000000000..b5f379cdb2b8aef8f33a3d72c08e50db635e2f65 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0010-ui-events-ozone-Define-SW_PEN_INSERTED-for-old-kerne.patch @@ -0,0 +1,29 @@ +From 41ddd053ea55a15bcb3857fe0a02993c7acb1698 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 20 May 2021 01:05:29 +0800 +Subject: [PATCH 10/17] ui: events: ozone: Define SW_PEN_INSERTED for old + kernel headers + +Signed-off-by: Jeffy Chen +--- + ui/events/ozone/evdev/event_converter_evdev_impl.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/ui/events/ozone/evdev/event_converter_evdev_impl.cc b/ui/events/ozone/evdev/event_converter_evdev_impl.cc +index c2df3597..2660882a 100644 +--- a/ui/events/ozone/evdev/event_converter_evdev_impl.cc ++++ b/ui/events/ozone/evdev/event_converter_evdev_impl.cc +@@ -31,6 +31,10 @@ namespace { + const int kKeyReleaseValue = 0; + const int kKeyRepeatValue = 2; + ++#ifndef SW_PEN_INSERTED ++#define SW_PEN_INSERTED 0x0f /* set = pen inserted */ ++#endif ++ + // Values for the EV_SW code. + const int kSwitchStylusInserted = SW_PEN_INSERTED; + +-- +2.17.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0011-Create-new-fence-when-there-s-no-in-fences.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0011-Create-new-fence-when-there-s-no-in-fences.patch new file mode 100644 index 0000000000000000000000000000000000000000..4a3df535b52ff77a1a4fe65e4f05c018b09bc837 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0011-Create-new-fence-when-there-s-no-in-fences.patch @@ -0,0 +1,60 @@ +From 3947bece937676c35af779d52e7d6a160b428aef Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 01:29:11 +0800 +Subject: [PATCH 11/17] Create new fence when there's no in-fences + +There're cases that in-fences are not provided. + +Signed-off-by: Jeffy Chen +--- + .../wayland/gpu/gbm_surfaceless_wayland.cc | 21 +++++++++++++++++-- + 1 file changed, 19 insertions(+), 2 deletions(-) + +diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +index db7037fc..f2c14328 100644 +--- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc ++++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +@@ -30,6 +30,12 @@ static constexpr size_t kMaxSolidColorBuffers = 12; + + static constexpr gfx::Size kSolidColorBufferSize{4, 4}; + ++void WaitForEGLFence(EGLDisplay display, EGLSyncKHR fence) { ++ eglClientWaitSyncKHR(display, fence, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, ++ EGL_FOREVER_KHR); ++ eglDestroySyncKHR(display, fence); ++} ++ + void WaitForGpuFences(std::vector> fences) { + for (auto& fence : fences) + fence->Wait(); +@@ -211,14 +217,25 @@ void GbmSurfacelessWayland::SwapBuffersAsync( + return; + } + +- base::OnceClosure fence_wait_task; + std::vector> fences; ++ // Uset in-fences provided in the overlays. If there are none, we insert our ++ // own fence and wait. + for (auto& plane : frame->planes) { + if (plane.second.gpu_fence) + fences.push_back(std::move(plane.second.gpu_fence)); + } + +- fence_wait_task = base::BindOnce(&WaitForGpuFences, std::move(fences)); ++ base::OnceClosure fence_wait_task; ++ if (!fences.empty()) { ++ fence_wait_task = base::BindOnce(&WaitForGpuFences, std::move(fences)); ++ } else { ++ // TODO(fangzhoug): the following should be replaced by a per surface flush ++ // as it gets implemented in GL drivers. ++ EGLSyncKHR fence = InsertFence(has_implicit_external_sync_); ++ CHECK_NE(fence, EGL_NO_SYNC_KHR) << "eglCreateSyncKHR failed"; ++ ++ fence_wait_task = base::BindOnce(&WaitForEGLFence, GetDisplay(), fence); ++ } + + base::OnceClosure fence_retired_callback = base::BindOnce( + &GbmSurfacelessWayland::FenceRetired, weak_factory_.GetWeakPtr(), frame); +-- +2.17.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0012-HACK-ozone-wayland-Force-disable-implicit-external-s.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0012-HACK-ozone-wayland-Force-disable-implicit-external-s.patch new file mode 100644 index 0000000000000000000000000000000000000000..491478e7f546d34074338a206b077a4ee73af89e --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0012-HACK-ozone-wayland-Force-disable-implicit-external-s.patch @@ -0,0 +1,30 @@ +From 1b9e592a77daf1ed0963efca94f65a597e2affe3 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 01:41:57 +0800 +Subject: [PATCH 12/17] HACK: [ozone/wayland]: Force disable implicit external + sync + +The Mali's implicit external sync seems broken. + +Signed-off-by: Jeffy Chen +--- + ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +index f2c14328..49d69af0 100644 +--- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc ++++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +@@ -231,7 +231,8 @@ void GbmSurfacelessWayland::SwapBuffersAsync( + } else { + // TODO(fangzhoug): the following should be replaced by a per surface flush + // as it gets implemented in GL drivers. +- EGLSyncKHR fence = InsertFence(has_implicit_external_sync_); ++ // HACK: The Mali's implicit external sync seems broken. ++ EGLSyncKHR fence = InsertFence(/* has_implicit_external_sync_ */ false); + CHECK_NE(fence, EGL_NO_SYNC_KHR) << "eglCreateSyncKHR failed"; + + fence_wait_task = base::BindOnce(&WaitForEGLFence, GetDisplay(), fence); +-- +2.17.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0013-HACK-media-capture-linux-Allow-camera-without-suppor.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0013-HACK-media-capture-linux-Allow-camera-without-suppor.patch new file mode 100644 index 0000000000000000000000000000000000000000..9c7e8ee2df6d5e594e4aa5ef58cb8c1f8d1560e7 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0013-HACK-media-capture-linux-Allow-camera-without-suppor.patch @@ -0,0 +1,35 @@ +From 66da7e7324bb0807cc956619e235b9b35f015180 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 31 May 2021 07:25:58 +0800 +Subject: [PATCH 13/17] HACK: media: capture: linux: Allow camera without + supported format + +The chromium would only accept discrete frame sizes. + +Hack it to make Rockchip ISP camera working. + +Signed-off-by: Jeffy Chen +--- + .../video/linux/video_capture_device_factory_linux.cc | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/media/capture/video/linux/video_capture_device_factory_linux.cc b/media/capture/video/linux/video_capture_device_factory_linux.cc +index 4279ae8c..2f4a64d7 100644 +--- a/media/capture/video/linux/video_capture_device_factory_linux.cc ++++ b/media/capture/video/linux/video_capture_device_factory_linux.cc +@@ -192,10 +192,8 @@ void VideoCaptureDeviceFactoryLinux::GetDevicesInfo( + + VideoCaptureFormats supported_formats; + GetSupportedFormatsForV4L2BufferType(fd.get(), &supported_formats); +- if (supported_formats.empty()) { +- DVLOG(1) << "No supported formats: " << unique_id; +- continue; +- } ++ if (supported_formats.empty()) ++ LOG(WARNING) << "No supported formats: " << unique_id; + + // HACK: Somehow the newest chromium would prefer using the last device in some cases, e.g. apprtc + devices_info.emplace(devices_info.begin(), VideoCaptureDeviceDescriptor( +-- +2.17.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0014-content-gpu-Only-depend-dri-for-X11.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0014-content-gpu-Only-depend-dri-for-X11.patch new file mode 100644 index 0000000000000000000000000000000000000000..cbc181a451ad7f60e7c6e790b42e98b64e8415d5 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0014-content-gpu-Only-depend-dri-for-X11.patch @@ -0,0 +1,26 @@ +From b6dfd73fbf021a36ecc7bc334588dfb88ce8db43 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 22 Nov 2021 15:59:49 +0800 +Subject: [PATCH 14/17] content: gpu: Only depend dri for X11 + +Signed-off-by: Jeffy Chen +--- + content/gpu/BUILD.gn | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/content/gpu/BUILD.gn b/content/gpu/BUILD.gn +index bdf9b9d9..3c1bd014 100644 +--- a/content/gpu/BUILD.gn ++++ b/content/gpu/BUILD.gn +@@ -127,7 +127,7 @@ target(link_target_type, "gpu_sources") { + } + + # Use DRI on desktop Linux builds. +- if (current_cpu != "s390x" && current_cpu != "ppc64" && is_linux && ++ if (current_cpu != "s390x" && current_cpu != "ppc64" && is_linux && ozone_platform_x11 && + (!is_chromecast || is_cast_desktop_build)) { + configs += [ "//build/config/linux/dri" ] + } +-- +2.17.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0015-blink-rtc-Force-disabling-optimized-video-scaling.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0015-blink-rtc-Force-disabling-optimized-video-scaling.patch new file mode 100644 index 0000000000000000000000000000000000000000..221c9a698ecee12ef0dd2a2571e94c67507deb43 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0015-blink-rtc-Force-disabling-optimized-video-scaling.patch @@ -0,0 +1,31 @@ +From 3ff889b8b3029142b2e05bfdbaf253596fd3ad7c Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 1 Dec 2021 18:27:06 +0800 +Subject: [PATCH 15/17] blink: rtc: Force disabling optimized video scaling + +This would break VEA when encoder requires special coded size: +https://bugs.chromium.org/p/chromium/issues/detail?id=1193457#c6 + +Signed-off-by: Jeffy Chen +--- + .../renderer/platform/peerconnection/rtc_video_encoder.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc b/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc +index 14d2a2f5..4604982b 100644 +--- a/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc ++++ b/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc +@@ -1218,6 +1218,10 @@ void RTCVideoEncoder::Impl::EncodeOneFrame() { + #else + false; + #endif ++ ++ // https://bugs.chromium.org/p/chromium/issues/detail?id=1193457#c6 ++ optimized_scaling = false; ++ + if (optimized_scaling) { + DCHECK_EQ(buffer->type(), webrtc::VideoFrameBuffer::Type::kNative); + auto scaled_buffer = buffer->Scale(input_visible_size_.width(), +-- +2.17.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0016-HACK-media-Disable-chromeos-direct-video-decoder-by-.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0016-HACK-media-Disable-chromeos-direct-video-decoder-by-.patch new file mode 100644 index 0000000000000000000000000000000000000000..fd33c56a199b44e2401d9a27693c7f7d1a4aeef0 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0016-HACK-media-Disable-chromeos-direct-video-decoder-by-.patch @@ -0,0 +1,29 @@ +From ae5bd666cc2d6219a81241ced5ed36feddd24860 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 16 Mar 2022 12:14:02 +0800 +Subject: [PATCH 16/17] HACK: media: Disable chromeos direct video decoder by + default + +Revisit once V4L2 video decoder is supported on linux. + +Signed-off-by: Jeffy Chen +--- + media/base/media_switches.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc +index a15162b9..27d5a659 100644 +--- a/media/base/media_switches.cc ++++ b/media/base/media_switches.cc +@@ -711,7 +711,7 @@ const base::Feature kUseRealColorSpaceForAndroidVideo{ + // experiment with direct VideoDecoder path on Linux Desktop. + // TODO(b/159825227): remove when the direct video decoder is fully launched. + const base::Feature kUseChromeOSDirectVideoDecoder{ +- "UseChromeOSDirectVideoDecoder", base::FEATURE_ENABLED_BY_DEFAULT}; ++ "UseChromeOSDirectVideoDecoder", base::FEATURE_DISABLED_BY_DEFAULT}; + + #if defined(OS_CHROMEOS) + // ChromeOS has one of two VideoDecoder implementations active based on +-- +2.17.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0017-media-gpu-v4l2-Non-blocking-initialize.patch b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0017-media-gpu-v4l2-Non-blocking-initialize.patch new file mode 100644 index 0000000000000000000000000000000000000000..02e988427f7dcf26d1fc8cab62010fd86230a6ea --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/chromium_98.0.4758/0017-media-gpu-v4l2-Non-blocking-initialize.patch @@ -0,0 +1,126 @@ +From aaa752ff8f8fdf84e7323f19c5fb92facfa5e986 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 21 Mar 2022 18:30:22 +0800 +Subject: [PATCH 17/17] media/gpu/v4l2: Non-blocking initialize + +See: +https://bugs.chromium.org/p/chromium/issues/detail?id=1308345 + +Signed-off-by: Jeffy Chen +--- + .../gpu/v4l2/v4l2_video_encode_accelerator.cc | 35 +++++++++---------- + .../gpu/v4l2/v4l2_video_encode_accelerator.h | 4 +-- + 2 files changed, 17 insertions(+), 22 deletions(-) + +diff --git a/media/gpu/v4l2/v4l2_video_encode_accelerator.cc b/media/gpu/v4l2/v4l2_video_encode_accelerator.cc +index 702fa0df..b7ba2e80 100644 +--- a/media/gpu/v4l2/v4l2_video_encode_accelerator.cc ++++ b/media/gpu/v4l2/v4l2_video_encode_accelerator.cc +@@ -261,25 +261,15 @@ bool V4L2VideoEncodeAccelerator::Initialize(const Config& config, + return false; + } + +- bool result = false; +- base::WaitableEvent done; + encoder_task_runner_->PostTask( + FROM_HERE, base::BindOnce(&V4L2VideoEncodeAccelerator::InitializeTask, +- weak_this_, config, &result, &done)); +- done.Wait(); +- return result; ++ weak_this_, config)); ++ return true; + } + +-void V4L2VideoEncodeAccelerator::InitializeTask(const Config& config, +- bool* result, +- base::WaitableEvent* done) { ++void V4L2VideoEncodeAccelerator::InitializeTask(const Config& config) { + DCHECK_CALLED_ON_VALID_SEQUENCE(encoder_sequence_checker_); + +- // Signal the event when leaving the method. +- base::ScopedClosureRunner signal_event( +- base::BindOnce(&base::WaitableEvent::Signal, base::Unretained(done))); +- *result = false; +- + native_input_mode_ = + config.storage_type.value_or(Config::StorageType::kShmem) == + Config::StorageType::kGpuMemoryBuffer; +@@ -294,6 +284,7 @@ void V4L2VideoEncodeAccelerator::InitializeTask(const Config& config, + + if (!SetFormats(config.input_format, config.output_profile)) { + VLOGF(1) << "Failed setting up formats"; ++ NOTIFY_ERROR(kPlatformFailureError); + return; + } + +@@ -307,6 +298,7 @@ void V4L2VideoEncodeAccelerator::InitializeTask(const Config& config, + VideoFrame::NumPlanes(config.input_format))); + if (!input_layout) { + VLOGF(1) << "Invalid image processor input layout"; ++ NOTIFY_ERROR(kPlatformFailureError); + return; + } + +@@ -316,6 +308,7 @@ void V4L2VideoEncodeAccelerator::InitializeTask(const Config& config, + encoder_input_visible_rect_, + encoder_input_visible_rect_)) { + VLOGF(1) << "Failed to create image processor"; ++ NOTIFY_ERROR(kPlatformFailureError); + return; + } + +@@ -327,16 +320,23 @@ void V4L2VideoEncodeAccelerator::InitializeTask(const Config& config, + VLOGF(1) << "Failed to reconfigure v4l2 encoder driver with the " + << "ImageProcessor output buffer: " + << ip_output_buffer_size.ToString(); ++ NOTIFY_ERROR(kPlatformFailureError); + return; + } + } + +- if (!InitInputMemoryType(config)) ++ if (!InitInputMemoryType(config)) { ++ NOTIFY_ERROR(kPlatformFailureError); + return; +- if (!InitControls(config)) ++ } ++ if (!InitControls(config)) { ++ NOTIFY_ERROR(kPlatformFailureError); + return; +- if (!CreateOutputBuffers()) ++ } ++ if (!CreateOutputBuffers()) { ++ NOTIFY_ERROR(kPlatformFailureError); + return; ++ } + + encoder_state_ = kInitialized; + RequestEncodingParametersChangeTask( +@@ -369,9 +369,6 @@ void V4L2VideoEncodeAccelerator::InitializeTask(const Config& config, + child_task_runner_->PostTask( + FROM_HERE, + base::BindOnce(&Client::NotifyEncoderInfoChange, client_, encoder_info)); +- +- // Finish initialization. +- *result = true; + } + + bool V4L2VideoEncodeAccelerator::CreateImageProcessor( +diff --git a/media/gpu/v4l2/v4l2_video_encode_accelerator.h b/media/gpu/v4l2/v4l2_video_encode_accelerator.h +index f5e104b6..f2b1cf91 100644 +--- a/media/gpu/v4l2/v4l2_video_encode_accelerator.h ++++ b/media/gpu/v4l2/v4l2_video_encode_accelerator.h +@@ -198,9 +198,7 @@ class MEDIA_GPU_EXPORT V4L2VideoEncodeAccelerator + uint32_t framerate); + + // Do several initializations (e.g. set up format) on |encoder_task_runner_|. +- void InitializeTask(const Config& config, +- bool* result, +- base::WaitableEvent* done); ++ void InitializeTask(const Config& config); + + // Set up formats and initialize the device for them. + bool SetFormats(VideoPixelFormat input_format, +-- +2.17.1 + diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/files/chromium-init.sh b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/files/chromium-init.sh new file mode 100755 index 0000000000000000000000000000000000000000..c8e01edac79751c1599dfa86f02a9e6c71c0044e --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-browser/chromium/files/chromium-init.sh @@ -0,0 +1,25 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: chromium browser initial script +# Required-Start: +# Required-Stop: +# Should-Start: mountvirtfs +# Should-stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Custom initial script for chromium browser +### END INIT INFO + +# Create dummy video node for V4L2 VDA/VEA with rkmpp plugin +for type in dec enc; do + dev=/dev/video-${type}0 + echo $type > $dev + chmod 660 $dev + chown root.video $dev +done + +# Link /usr/lib64 for dlopen libv4l2.so +[ -e /lib/ld-linux-aarch64.so.1 -a ! -e /usr/lib64 ] && \ + ln -s lib /usr/lib64 + +exit 0 diff --git a/bsp/meta-rockchip/dynamic-layers/recipes-qt/qt5/qtbase_git.bbappend b/bsp/meta-rockchip/dynamic-layers/recipes-qt/qt5/qtbase_git.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..d29cfbcacfe86d791851277bbd8ce9934bfcff68 --- /dev/null +++ b/bsp/meta-rockchip/dynamic-layers/recipes-qt/qt5/qtbase_git.bbappend @@ -0,0 +1,7 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +PACKAGECONFIG_GL = "${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'gles2', '', d)}" +PACKAGECONFIG_FONTS = "fontconfig" + +PACKAGECONFIG:append = " gbm kms eglfs linuxfb" diff --git a/bsp/meta-rockchip/licenses/LICENSE.rockchip b/bsp/meta-rockchip/licenses/LICENSE.rockchip new file mode 100644 index 0000000000000000000000000000000000000000..69b445b037c884a240f22feb8a42d057973c222e --- /dev/null +++ b/bsp/meta-rockchip/licenses/LICENSE.rockchip @@ -0,0 +1,41 @@ +Copyright (c) 2020, Rockchip Electronics Co.Ltd +All rights reserved. + +Redistribution. Redistribution and use in binary form, without +modification, are permitted provided that the following conditions are +met: + +* Redistributions must reproduce the above copyright notice and the + following disclaimer in the documentation and/or other materials + provided with the distribution. + +* Neither the name of Rockchip Electronics Co.Ltd, its products + nor the names of its suppliers may be used to endorse or promote products + derived from this Software without specific prior written permission. + +* No reverse engineering, decompilation, or disassembly of this software + is permitted. + +Limited patent license. Rockchip Electronics Co.Ltd grants a world-wide, +royalty-free, non-exclusive license under patents it now or hereafter +owns or controls to make, have made, use, import, offer to sell and +sell ("Utilize") this software, but solely to the extent that any +such patent is necessary to Utilize the software alone, or in +combination with an operating system licensed under an approved Open +Source license as listed by the Open Source Initiative at +http://opensource.org/licenses. The patent license shall not apply to +any other combinations which include this software. No hardware per +se is licensed hereunder. + +DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +CONTRIBUTORS "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 THE +COPYRIGHT OWNER OR CONTRIBUTORS 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. diff --git a/bsp/meta-rockchip/recipes-benchmark/glmark2/glmark2_%.bbappend b/bsp/meta-rockchip/recipes-benchmark/glmark2/glmark2_%.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..ed4a28dcf89fe9421d7969489e54ca5da53d859f --- /dev/null +++ b/bsp/meta-rockchip/recipes-benchmark/glmark2/glmark2_%.bbappend @@ -0,0 +1,7 @@ +# Copyright (C) 2020, Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +# Some opengl[es] libraries are multithreaded. +LDFLAGS:append = " -pthread" + +DEPENDS:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland-protocols', '', d)}" diff --git a/bsp/meta-rockchip/recipes-bsp/rk-binary/rk-binary-native.bb b/bsp/meta-rockchip/recipes-bsp/rk-binary/rk-binary-native.bb new file mode 100644 index 0000000000000000000000000000000000000000..144ea4f1a50b7663d59dbfefd65482570249ea07 --- /dev/null +++ b/bsp/meta-rockchip/recipes-bsp/rk-binary/rk-binary-native.bb @@ -0,0 +1,48 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +inherit freeze-rev local-git deploy native + +DESCRIPTION = "Rockchip binary tools" + +LICENSE = "LICENSE.rockchip" +LIC_FILES_CHKSUM = "file://${RKBASE}/licenses/LICENSE.rockchip;md5=d63890e209bf038f44e708bbb13e4ed9" +SRC_URI = " \ + git://github.com/JeffyCN/mirrors.git;protocol=https;nobranch=1;branch=rkbin-2021_10_13;name=rkbin \ + git://github.com/JeffyCN/mirrors.git;protocol=https;branch=tools;name=tools;destsuffix=git/extra \ +" + +SRCREV_rkbin = "3712dbc00e806ec1ed240b4a1a04df210dd3b550" +SRCREV_tools = "1a32bc776af52494144fcef6641a73850cee628a" +SRCREV_FORMAT ?= "rkbin_tools" + +S = "${WORKDIR}/git" + +INSANE_SKIP:${PN} = "already-stripped" +STRIP = "echo" + +# The pre-built tools have different link loader, don't change them. +UNINATIVE_LOADER := "" + +do_install () { + install -d ${D}/${bindir} + + cd ${S}/tools + + install -m 0755 boot_merger ${D}/${bindir} + install -m 0755 trust_merger ${D}/${bindir} + install -m 0755 firmwareMerger ${D}/${bindir} + + install -m 0755 kernelimage ${D}/${bindir} + install -m 0755 loaderimage ${D}/${bindir} + + install -m 0755 mkkrnlimg ${D}/${bindir} + install -m 0755 resource_tool ${D}/${bindir} + + install -m 0755 upgrade_tool ${D}/${bindir} + + cd ${S}/extra/linux/Linux_Pack_Firmware/rockdev + + install -m 0755 afptool ${D}/${bindir} + install -m 0755 rkImageMaker ${D}/${bindir} +} diff --git a/bsp/meta-rockchip/recipes-bsp/rockchip-npu/files/rockchip-npu.sh b/bsp/meta-rockchip/recipes-bsp/rockchip-npu/files/rockchip-npu.sh new file mode 100755 index 0000000000000000000000000000000000000000..f1a8be806056a10cb91576933f3eecb1eaa209ba --- /dev/null +++ b/bsp/meta-rockchip/recipes-bsp/rockchip-npu/files/rockchip-npu.sh @@ -0,0 +1,25 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: rockchip npu initial script +# Required-Start: +# Required-Stop: +# Should-Start: mountvirtfs +# Should-stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Custom initial script for chromium browser +### END INIT INFO + +{ + unset FW_TYPE + [ -e "/sys/devices/platform/f8000000.pcie/pcie_reset_ep" ] && \ + FW_TYPE="_pcie" + + cd /usr/share/npu_fw${FW_TYPE} + + npu_upgrade${FW_TYPE} MiniLoaderAll.bin uboot.img trust.img boot.img + sleep 1 + npu_transfer_proxy +} & + +exit 0 diff --git a/bsp/meta-rockchip/recipes-bsp/rockchip-npu/rockchip-npu.bb b/bsp/meta-rockchip/recipes-bsp/rockchip-npu/rockchip-npu.bb new file mode 100644 index 0000000000000000000000000000000000000000..c0c992825cff855ab505da83e87e68ed42ffa90a --- /dev/null +++ b/bsp/meta-rockchip/recipes-bsp/rockchip-npu/rockchip-npu.bb @@ -0,0 +1,47 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +DESCRIPTION = "Tools and firmwares for rockchip npu" +SECTION = "utils" + +LICENSE = "LICENSE.rockchip" +LIC_FILES_CHKSUM = "file://${RKBASE}/licenses/LICENSE.rockchip;md5=d63890e209bf038f44e708bbb13e4ed9" + +RDEPENDS:${PN} = "bash" + +inherit freeze-rev local-git + +SRC_URI = " \ + git://github.com/JeffyCN/mirrors.git;protocol=https;branch=rknpu-fw; \ + file://rockchip-npu.sh \ +" +SRCREV = "2a532b012b5179dd573d8b7f98fc2c51b3046409" +S = "${WORKDIR}/git" + +do_install () { + install -d ${D}${datadir}/npu_fw + install -m 0644 npu_fw/* ${D}${datadir}/npu_fw/ + + install -d ${D}${datadir}/npu_fw_pcie + install -m 0644 npu_fw_pcie/* ${D}${datadir}/npu_fw_pcie/ + + install -d ${D}${bindir} + # FIXME: support different arch + install -m 0755 bin/* ${D}${bindir} + + install -d ${D}${sysconfdir}/init.d/ + install -m 0755 ${WORKDIR}/rockchip-npu.sh ${D}${sysconfdir}/init.d/ +} + +inherit update-rc.d + +INITSCRIPT_NAME = "rockchip-npu.sh" +INITSCRIPT_PARAMS = "start 11 S ." + +INSANE_SKIP:${PN} = "already-stripped ldflags" + +FILES:${PN} = " \ + ${datadir} \ + ${bindir} \ + ${sysconfdir}/init.d \ +" diff --git a/bsp/meta-rockchip/recipes-bsp/u-boot/files/0001-HACK-Support-python3-for-dtoc.patch b/bsp/meta-rockchip/recipes-bsp/u-boot/files/0001-HACK-Support-python3-for-dtoc.patch new file mode 100644 index 0000000000000000000000000000000000000000..79061032e100a26e4f16602932217bab3fa6b1bb --- /dev/null +++ b/bsp/meta-rockchip/recipes-bsp/u-boot/files/0001-HACK-Support-python3-for-dtoc.patch @@ -0,0 +1,2281 @@ +From ab6269658ff3ed78b40360f9a5ac6edf5fc88661 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 30 Jan 2023 17:13:26 +0800 +Subject: [PATCH] HACK: Support python3 for dtoc + +Sync a few files from v2020.01 + +Change-Id: Ib88caeb2b29520146c8fcf7c7e1a0eb2823aaab7 +Signed-off-by: Jeffy Chen +--- + scripts/dtc/pylibfdt/Makefile | 5 +- + scripts/dtc/pylibfdt/libfdt.i_shipped | 869 +++++++++++++++++++++++--- + tools/dtoc/dtb_platdata.py | 35 +- + tools/dtoc/dtoc.py | 60 +- + tools/dtoc/fdt.py | 472 +++++++++++--- + tools/dtoc/fdt_util.py | 135 +++- + tools/patman/test_util.py | 92 +++ + 7 files changed, 1431 insertions(+), 237 deletions(-) + create mode 100644 tools/patman/test_util.py + +diff --git a/scripts/dtc/pylibfdt/Makefile b/scripts/dtc/pylibfdt/Makefile +index 01d5e0ffe3..42342c75bb 100644 +--- a/scripts/dtc/pylibfdt/Makefile ++++ b/scripts/dtc/pylibfdt/Makefile +@@ -14,13 +14,14 @@ PYLIBFDT_srcs = $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_SRCS)) \ + $(obj)/libfdt.i + + quiet_cmd_pymod = PYMOD $@ +- cmd_pymod = unset CC; unset CROSS_COMPILE; unset CFLAGS;\ ++ cmd_pymod = unset CROSS_COMPILE; unset CFLAGS; \ ++ CC="$(HOSTCC)" LDSHARED="$(HOSTCC) -shared " \ + LDFLAGS="$(HOSTLDFLAGS)" \ + VERSION="u-boot-$(UBOOTVERSION)" \ + CPPFLAGS="$(HOSTCFLAGS) -I$(LIBFDT_srcdir)" OBJDIR=$(obj) \ + SOURCES="$(PYLIBFDT_srcs)" \ + SWIG_OPTS="-I$(LIBFDT_srcdir) -I$(LIBFDT_srcdir)/.." \ +- $(PYTHON) $< --quiet build_ext --inplace ++ $(PYTHON3) $< --quiet build_ext --inplace + + $(obj)/_libfdt.so: $(src)/setup.py $(PYLIBFDT_srcs) FORCE + $(call if_changed,pymod) +diff --git a/scripts/dtc/pylibfdt/libfdt.i_shipped b/scripts/dtc/pylibfdt/libfdt.i_shipped +index 5b1a8cf4d4..fae0b27d7d 100644 +--- a/scripts/dtc/pylibfdt/libfdt.i_shipped ++++ b/scripts/dtc/pylibfdt/libfdt.i_shipped +@@ -1,9 +1,8 @@ ++/* SPDX-License-Identifier: GPL-2.0+ OR BSD-2-Clause */ + /* + * pylibfdt - Flat Device Tree manipulation in Python + * Copyright (C) 2017 Google, Inc. + * Written by Simon Glass +- * +- * SPDX-License-Identifier: GPL-2.0+ BSD-2-Clause + */ + + %module libfdt +@@ -13,6 +12,18 @@ + %{ + #define SWIG_FILE_WITH_INIT + #include "libfdt.h" ++ ++/* ++ * We rename this function here to avoid problems with swig, since we also have ++ * a struct called fdt_property. That struct causes swig to create a class in ++ * libfdt.py called fdt_property(), which confuses things. ++ */ ++static int fdt_property_stub(void *fdt, const char *name, const void *val, ++ int len) ++{ ++ return fdt_property(fdt, name, val, len); ++} ++ + %} + + %pythoncode %{ +@@ -44,6 +55,7 @@ import struct + # Pass this as the 'quiet' parameter to return -ENOTFOUND on NOTFOUND errors, + # instead of raising an exception. + QUIET_NOTFOUND = (NOTFOUND,) ++QUIET_NOSPACE = (NOSPACE,) + + + class FdtException(Exception): +@@ -80,7 +92,7 @@ def check_err(val, quiet=()): + Raises + FdtException if val < 0 + """ +- if val < 0: ++ if isinstance(val, int) and val < 0: + if -val not in quiet: + raise FdtException(val) + return val +@@ -109,27 +121,182 @@ def check_err_null(val, quiet=()): + raise FdtException(val) + return val + +-class Fdt: +- """Device tree class, supporting all operations +- +- The Fdt object is created is created from a device tree binary file, +- e.g. with something like: ++class FdtRo(object): ++ """Class for a read-only device-tree + +- fdt = Fdt(open("filename.dtb").read()) ++ This is a base class used by FdtRw (read-write access) and FdtSw ++ (sequential-write access). It implements read-only access to the ++ device tree. + +- Operations can then be performed using the methods in this class. Each +- method xxx(args...) corresponds to a libfdt function fdt_xxx(fdt, args...). ++ Here are the three classes and when you should use them: + +- All methods raise an FdtException if an error occurs. To avoid this +- behaviour a 'quiet' parameter is provided for some functions. This +- defaults to empty, but you can pass a list of errors that you expect. +- If one of these errors occurs, the function will return an error number +- (e.g. -NOTFOUND). ++ FdtRo - read-only access to an existing FDT ++ FdtRw - read-write access to an existing FDT (most common case) ++ FdtSw - for creating a new FDT, as well as allowing read-only access + """ + def __init__(self, data): + self._fdt = bytearray(data) + check_err(fdt_check_header(self._fdt)); + ++ def as_bytearray(self): ++ """Get the device tree contents as a bytearray ++ ++ This can be passed directly to libfdt functions that access a ++ const void * for the device tree. ++ ++ Returns: ++ bytearray containing the device tree ++ """ ++ return bytearray(self._fdt) ++ ++ def next_node(self, nodeoffset, depth, quiet=()): ++ """Find the next subnode ++ ++ Args: ++ nodeoffset: Node offset of previous node ++ depth: The depth of the node at nodeoffset. This is used to ++ calculate the depth of the returned node ++ quiet: Errors to ignore (empty to raise on all errors) ++ ++ Returns: ++ Typle: ++ Offset of the next node, if any, else a -ve error ++ Depth of the returned node, if any, else undefined ++ ++ Raises: ++ FdtException if no more nodes found or other error occurs ++ """ ++ return check_err(fdt_next_node(self._fdt, nodeoffset, depth), quiet) ++ ++ def first_subnode(self, nodeoffset, quiet=()): ++ """Find the first subnode of a parent node ++ ++ Args: ++ nodeoffset: Node offset of parent node ++ quiet: Errors to ignore (empty to raise on all errors) ++ ++ Returns: ++ The offset of the first subnode, if any ++ ++ Raises: ++ FdtException if no subnodes found or other error occurs ++ """ ++ return check_err(fdt_first_subnode(self._fdt, nodeoffset), quiet) ++ ++ def next_subnode(self, nodeoffset, quiet=()): ++ """Find the next subnode ++ ++ Args: ++ nodeoffset: Node offset of previous subnode ++ quiet: Errors to ignore (empty to raise on all errors) ++ ++ Returns: ++ The offset of the next subnode, if any ++ ++ Raises: ++ FdtException if no more subnodes found or other error occurs ++ """ ++ return check_err(fdt_next_subnode(self._fdt, nodeoffset), quiet) ++ ++ def magic(self): ++ """Return the magic word from the header ++ ++ Returns: ++ Magic word ++ """ ++ return fdt_magic(self._fdt) ++ ++ def totalsize(self): ++ """Return the total size of the device tree ++ ++ Returns: ++ Total tree size in bytes ++ """ ++ return fdt_totalsize(self._fdt) ++ ++ def off_dt_struct(self): ++ """Return the start of the device-tree struct area ++ ++ Returns: ++ Start offset of struct area ++ """ ++ return fdt_off_dt_struct(self._fdt) ++ ++ def off_dt_strings(self): ++ """Return the start of the device-tree string area ++ ++ Returns: ++ Start offset of string area ++ """ ++ return fdt_off_dt_strings(self._fdt) ++ ++ def off_mem_rsvmap(self): ++ """Return the start of the memory reserve map ++ ++ Returns: ++ Start offset of memory reserve map ++ """ ++ return fdt_off_mem_rsvmap(self._fdt) ++ ++ def version(self): ++ """Return the version of the device tree ++ ++ Returns: ++ Version number of the device tree ++ """ ++ return fdt_version(self._fdt) ++ ++ def last_comp_version(self): ++ """Return the last compatible version of the device tree ++ ++ Returns: ++ Last compatible version number of the device tree ++ """ ++ return fdt_last_comp_version(self._fdt) ++ ++ def boot_cpuid_phys(self): ++ """Return the physical boot CPU ID ++ ++ Returns: ++ Physical boot CPU ID ++ """ ++ return fdt_boot_cpuid_phys(self._fdt) ++ ++ def size_dt_strings(self): ++ """Return the start of the device-tree string area ++ ++ Returns: ++ Start offset of string area ++ """ ++ return fdt_size_dt_strings(self._fdt) ++ ++ def size_dt_struct(self): ++ """Return the start of the device-tree struct area ++ ++ Returns: ++ Start offset of struct area ++ """ ++ return fdt_size_dt_struct(self._fdt) ++ ++ def num_mem_rsv(self, quiet=()): ++ """Return the number of memory reserve-map records ++ ++ Returns: ++ Number of memory reserve-map records ++ """ ++ return check_err(fdt_num_mem_rsv(self._fdt), quiet) ++ ++ def get_mem_rsv(self, index, quiet=()): ++ """Return the indexed memory reserve-map record ++ ++ Args: ++ index: Record to return (0=first) ++ ++ Returns: ++ Number of memory reserve-map records ++ """ ++ return check_err(fdt_get_mem_rsv(self._fdt, index), quiet) ++ + def subnode_offset(self, parentoffset, name, quiet=()): + """Get the offset of a named subnode + +@@ -162,6 +329,20 @@ class Fdt: + """ + return check_err(fdt_path_offset(self._fdt, path), quiet) + ++ def get_name(self, nodeoffset): ++ """Get the name of a node ++ ++ Args: ++ nodeoffset: Offset of node to check ++ ++ Returns: ++ Node name ++ ++ Raises: ++ FdtException on error (e.g. nodeoffset is invalid) ++ """ ++ return check_err_null(fdt_get_name(self._fdt, nodeoffset))[0] ++ + def first_property_offset(self, nodeoffset, quiet=()): + """Get the offset of the first property in a node offset + +@@ -196,20 +377,6 @@ class Fdt: + return check_err(fdt_next_property_offset(self._fdt, prop_offset), + quiet) + +- def get_name(self, nodeoffset): +- """Get the name of a node +- +- Args: +- nodeoffset: Offset of node to check +- +- Returns: +- Node name +- +- Raises: +- FdtException on error (e.g. nodeoffset is invalid) +- """ +- return check_err_null(fdt_get_name(self._fdt, nodeoffset))[0] +- + def get_property_by_offset(self, prop_offset, quiet=()): + """Obtains a property that can be examined + +@@ -230,51 +397,135 @@ class Fdt: + return pdata + return Property(pdata[0], pdata[1]) + +- def first_subnode(self, nodeoffset, quiet=()): +- """Find the first subnode of a parent node ++ def getprop(self, nodeoffset, prop_name, quiet=()): ++ """Get a property from a node + + Args: +- nodeoffset: Node offset of parent node ++ nodeoffset: Node offset containing property to get ++ prop_name: Name of property to get + quiet: Errors to ignore (empty to raise on all errors) + + Returns: +- The offset of the first subnode, if any ++ Value of property as a Property object (which can be used as a ++ bytearray/string), or -ve error number. On failure, returns an ++ integer error + + Raises: +- FdtException if no subnode found or other error occurs ++ FdtError if any error occurs (e.g. the property is not found) + """ +- return check_err(fdt_first_subnode(self._fdt, nodeoffset), quiet) ++ pdata = check_err_null(fdt_getprop(self._fdt, nodeoffset, prop_name), ++ quiet) ++ if isinstance(pdata, (int)): ++ return pdata ++ return Property(prop_name, bytes(pdata[0])) + +- def next_subnode(self, nodeoffset, quiet=()): +- """Find the next subnode ++ def get_phandle(self, nodeoffset): ++ """Get the phandle of a node + + Args: +- nodeoffset: Node offset of previous subnode ++ nodeoffset: Node offset to check ++ ++ Returns: ++ phandle of node, or 0 if the node has no phandle or another error ++ occurs ++ """ ++ return fdt_get_phandle(self._fdt, nodeoffset) ++ ++ def get_alias(self, name): ++ """Get the full path referenced by a given alias ++ ++ Args: ++ name: name of the alias to lookup ++ ++ Returns: ++ Full path to the node for the alias named 'name', if it exists ++ None, if the given alias or the /aliases node does not exist ++ """ ++ return fdt_get_alias(self._fdt, name) ++ ++ def parent_offset(self, nodeoffset, quiet=()): ++ """Get the offset of a node's parent ++ ++ Args: ++ nodeoffset: Node offset to check + quiet: Errors to ignore (empty to raise on all errors) + + Returns: +- The offset of the next subnode, if any ++ The offset of the parent node, if any + + Raises: +- FdtException if no more subnode found or other error occurs ++ FdtException if no parent found or other error occurs + """ +- return check_err(fdt_next_subnode(self._fdt, nodeoffset), quiet) ++ return check_err(fdt_parent_offset(self._fdt, nodeoffset), quiet) + +- def totalsize(self): +- """Return the total size of the device tree ++ def node_offset_by_phandle(self, phandle, quiet=()): ++ """Get the offset of a node with the given phandle ++ ++ Args: ++ phandle: Phandle to search for ++ quiet: Errors to ignore (empty to raise on all errors) + + Returns: +- Total tree size in bytes ++ The offset of node with that phandle, if any ++ ++ Raises: ++ FdtException if no node found or other error occurs + """ +- return check_err(fdt_totalsize(self._fdt)) ++ return check_err(fdt_node_offset_by_phandle(self._fdt, phandle), quiet) + +- def off_dt_struct(self): +- """Return the start of the device tree struct area ++ ++class Fdt(FdtRo): ++ """Device tree class, supporting all operations ++ ++ The Fdt object is created is created from a device tree binary file, ++ e.g. with something like: ++ ++ fdt = Fdt(open("filename.dtb").read()) ++ ++ Operations can then be performed using the methods in this class. Each ++ method xxx(args...) corresponds to a libfdt function fdt_xxx(fdt, args...). ++ ++ All methods raise an FdtException if an error occurs. To avoid this ++ behaviour a 'quiet' parameter is provided for some functions. This ++ defaults to empty, but you can pass a list of errors that you expect. ++ If one of these errors occurs, the function will return an error number ++ (e.g. -NOTFOUND). ++ """ ++ def __init__(self, data): ++ FdtRo.__init__(self, data) ++ ++ @staticmethod ++ def create_empty_tree(size, quiet=()): ++ """Create an empty device tree ready for use ++ ++ Args: ++ size: Size of device tree in bytes + + Returns: +- Start offset of struct area ++ Fdt object containing the device tree + """ +- return check_err(fdt_off_dt_struct(self._fdt)) ++ data = bytearray(size) ++ err = check_err(fdt_create_empty_tree(data, size), quiet) ++ if err: ++ return err ++ return Fdt(data) ++ ++ def resize(self, size, quiet=()): ++ """Move the device tree into a larger or smaller space ++ ++ This creates a new device tree of size @size and moves the existing ++ device tree contents over to that. It can be used to create more space ++ in a device tree. Note that the Fdt object remains the same, but it ++ now has a new bytearray holding the contents. ++ ++ Args: ++ size: Required new size of device tree in bytes ++ """ ++ fdt = bytearray(size) ++ err = check_err(fdt_open_into(self._fdt, fdt, size), quiet) ++ if err: ++ return err ++ self._fdt = fdt + + def pack(self, quiet=()): + """Pack the device tree to remove unused space +@@ -284,86 +535,158 @@ class Fdt: + Args: + quiet: Errors to ignore (empty to raise on all errors) + ++ Returns: ++ Error code, or 0 if OK ++ + Raises: + FdtException if any error occurs + """ +- return check_err(fdt_pack(self._fdt), quiet) ++ err = check_err(fdt_pack(self._fdt), quiet) ++ if err: ++ return err ++ del self._fdt[self.totalsize():] ++ return err + +- def delprop(self, nodeoffset, prop_name): +- """Delete a property from a node ++ def set_name(self, nodeoffset, name, quiet=()): ++ """Set the name of a node + + Args: +- nodeoffset: Node offset containing property to delete +- prop_name: Name of property to delete ++ nodeoffset: Node offset of node to update ++ name: New node name (string without \0) ++ ++ Returns: ++ Error code, or 0 if OK + + Raises: +- FdtError if the property does not exist, or another error occurs ++ FdtException if no parent found or other error occurs + """ +- return check_err(fdt_delprop(self._fdt, nodeoffset, prop_name)) ++ if chr(0) in name: ++ raise ValueError('Property contains embedded nul characters') ++ return check_err(fdt_set_name(self._fdt, nodeoffset, name), quiet) + +- def getprop(self, nodeoffset, prop_name, quiet=()): +- """Get a property from a node ++ def setprop(self, nodeoffset, prop_name, val, quiet=()): ++ """Set the value of a property + + Args: +- nodeoffset: Node offset containing property to get +- prop_name: Name of property to get ++ nodeoffset: Node offset containing the property to create/update ++ prop_name: Name of property ++ val: Value to write (string or bytearray) + quiet: Errors to ignore (empty to raise on all errors) + + Returns: +- Value of property as a bytearray, or -ve error number ++ Error code, or 0 if OK + + Raises: +- FdtError if any error occurs (e.g. the property is not found) ++ FdtException if no parent found or other error occurs + """ +- pdata = check_err_null(fdt_getprop(self._fdt, nodeoffset, prop_name), +- quiet) +- if isinstance(pdata, (int)): +- return pdata +- return bytearray(pdata[0]) ++ return check_err(fdt_setprop(self._fdt, nodeoffset, prop_name, val, ++ len(val)), quiet) + +- def get_phandle(self, nodeoffset): +- """Get the phandle of a node ++ def setprop_u32(self, nodeoffset, prop_name, val, quiet=()): ++ """Set the value of a property + + Args: +- nodeoffset: Node offset to check ++ nodeoffset: Node offset containing the property to create/update ++ prop_name: Name of property ++ val: Value to write (integer) ++ quiet: Errors to ignore (empty to raise on all errors) + + Returns: +- phandle of node, or 0 if the node has no phandle or another error +- occurs ++ Error code, or 0 if OK ++ ++ Raises: ++ FdtException if no parent found or other error occurs + """ +- return fdt_get_phandle(self._fdt, nodeoffset) ++ return check_err(fdt_setprop_u32(self._fdt, nodeoffset, prop_name, val), ++ quiet) + +- def parent_offset(self, nodeoffset, quiet=()): +- """Get the offset of a node's parent ++ def setprop_u64(self, nodeoffset, prop_name, val, quiet=()): ++ """Set the value of a property + + Args: +- nodeoffset: Node offset to check ++ nodeoffset: Node offset containing the property to create/update ++ prop_name: Name of property ++ val: Value to write (integer) + quiet: Errors to ignore (empty to raise on all errors) + + Returns: +- The offset of the parent node, if any ++ Error code, or 0 if OK + + Raises: + FdtException if no parent found or other error occurs + """ +- return check_err(fdt_parent_offset(self._fdt, nodeoffset), quiet) ++ return check_err(fdt_setprop_u64(self._fdt, nodeoffset, prop_name, val), ++ quiet) + +- def node_offset_by_phandle(self, phandle, quiet=()): +- """Get the offset of a node with the given phandle ++ def setprop_str(self, nodeoffset, prop_name, val, quiet=()): ++ """Set the string value of a property ++ ++ The property is set to the string, with a nul terminator added + + Args: +- phandle: Phandle to search for ++ nodeoffset: Node offset containing the property to create/update ++ prop_name: Name of property ++ val: Value to write (string without nul terminator). Unicode is ++ supposed by encoding to UTF-8 + quiet: Errors to ignore (empty to raise on all errors) + + Returns: +- The offset of node with that phandle, if any ++ Error code, or 0 if OK + + Raises: +- FdtException if no node found or other error occurs ++ FdtException if no parent found or other error occurs + """ +- return check_err(fdt_node_offset_by_phandle(self._fdt, phandle), quiet) ++ val = val.encode('utf-8') + b'\0' ++ return check_err(fdt_setprop(self._fdt, nodeoffset, prop_name, ++ val, len(val)), quiet) ++ ++ def delprop(self, nodeoffset, prop_name, quiet=()): ++ """Delete a property from a node ++ ++ Args: ++ nodeoffset: Node offset containing property to delete ++ prop_name: Name of property to delete ++ quiet: Errors to ignore (empty to raise on all errors) ++ ++ Returns: ++ Error code, or 0 if OK ++ ++ Raises: ++ FdtError if the property does not exist, or another error occurs ++ """ ++ return check_err(fdt_delprop(self._fdt, nodeoffset, prop_name), quiet) ++ ++ def add_subnode(self, parentoffset, name, quiet=()): ++ """Add a new subnode to a node ++ ++ Args: ++ parentoffset: Parent offset to add the subnode to ++ name: Name of node to add ++ ++ Returns: ++ offset of the node created, or negative error code on failure ++ ++ Raises: ++ FdtError if there is not enough space, or another error occurs ++ """ ++ return check_err(fdt_add_subnode(self._fdt, parentoffset, name), quiet) ++ ++ def del_node(self, nodeoffset, quiet=()): ++ """Delete a node ++ ++ Args: ++ nodeoffset: Offset of node to delete ++ ++ Returns: ++ Error code, or 0 if OK + +-class Property: ++ Raises: ++ FdtError if an error occurs ++ """ ++ return check_err(fdt_del_node(self._fdt, nodeoffset), quiet) ++ ++ ++class Property(bytearray): + """Holds a device tree property name and value. + + This holds a copy of a property taken from the device tree. It does not +@@ -372,16 +695,307 @@ class Property: + + Properties: + name: Property name +- value: Proper value as a bytearray ++ value: Property value as a bytearray + """ + def __init__(self, name, value): ++ bytearray.__init__(self, value) + self.name = name +- self.value = value ++ ++ def as_cell(self, fmt): ++ return struct.unpack('>' + fmt, self)[0] ++ ++ def as_uint32(self): ++ return self.as_cell('L') ++ ++ def as_int32(self): ++ return self.as_cell('l') ++ ++ def as_uint64(self): ++ return self.as_cell('Q') ++ ++ def as_int64(self): ++ return self.as_cell('q') ++ ++ def as_str(self): ++ """Unicode is supported by decoding from UTF-8""" ++ if self[-1] != 0: ++ raise ValueError('Property lacks nul termination') ++ if 0 in self[:-1]: ++ raise ValueError('Property contains embedded nul characters') ++ return self[:-1].decode('utf-8') ++ ++ ++class FdtSw(FdtRo): ++ """Software interface to create a device tree from scratch ++ ++ The methods in this class work by adding to an existing 'partial' device ++ tree buffer of a fixed size created by instantiating this class. When the ++ tree is complete, call as_fdt() to obtain a device tree ready to be used. ++ ++ Similarly with nodes, a new node is started with begin_node() and finished ++ with end_node(). ++ ++ The context manager functions can be used to make this a bit easier: ++ ++ # First create the device tree with a node and property: ++ sw = FdtSw() ++ sw.finish_reservemap() ++ with sw.add_node(''): ++ with sw.add_node('node'): ++ sw.property_u32('reg', 2) ++ fdt = sw.as_fdt() ++ ++ # Now we can use it as a real device tree ++ fdt.setprop_u32(0, 'reg', 3) ++ ++ The size hint provides a starting size for the space to be used by the ++ device tree. This will be increased automatically as needed as new items ++ are added to the tree. ++ """ ++ INC_SIZE = 1024 # Expand size by this much when out of space ++ ++ def __init__(self, size_hint=None): ++ """Create a new FdtSw object ++ ++ Args: ++ size_hint: A hint as to the initial size to use ++ ++ Raises: ++ ValueError if size_hint is negative ++ ++ Returns: ++ FdtSw object on success, else integer error code (if not raising) ++ """ ++ if not size_hint: ++ size_hint = self.INC_SIZE ++ fdtsw = bytearray(size_hint) ++ err = check_err(fdt_create(fdtsw, size_hint)) ++ if err: ++ return err ++ self._fdt = fdtsw ++ ++ def as_fdt(self): ++ """Convert a FdtSw into an Fdt so it can be accessed as normal ++ ++ Creates a new Fdt object from the work-in-progress device tree. This ++ does not call fdt_finish() on the current object, so it is possible to ++ add more nodes/properties and call as_fdt() again to get an updated ++ tree. ++ ++ Returns: ++ Fdt object allowing access to the newly created device tree ++ """ ++ fdtsw = bytearray(self._fdt) ++ check_err(fdt_finish(fdtsw)) ++ return Fdt(fdtsw) ++ ++ def check_space(self, val): ++ """Check if we need to add more space to the FDT ++ ++ This should be called with the error code from an operation. If this is ++ -NOSPACE then the FDT will be expanded to have more space, and True will ++ be returned, indicating that the operation needs to be tried again. ++ ++ Args: ++ val: Return value from the operation that was attempted ++ ++ Returns: ++ True if the operation must be retried, else False ++ """ ++ if check_err(val, QUIET_NOSPACE) < 0: ++ self.resize(len(self._fdt) + self.INC_SIZE) ++ return True ++ return False ++ ++ def resize(self, size): ++ """Resize the buffer to accommodate a larger tree ++ ++ Args: ++ size: New size of tree ++ ++ Raises: ++ FdtException on any error ++ """ ++ fdt = bytearray(size) ++ err = check_err(fdt_resize(self._fdt, fdt, size)) ++ self._fdt = fdt ++ ++ def add_reservemap_entry(self, addr, size): ++ """Add a new memory reserve map entry ++ ++ Once finished adding, you must call finish_reservemap(). ++ ++ Args: ++ addr: 64-bit start address ++ size: 64-bit size ++ ++ Raises: ++ FdtException on any error ++ """ ++ while self.check_space(fdt_add_reservemap_entry(self._fdt, addr, ++ size)): ++ pass ++ ++ def finish_reservemap(self): ++ """Indicate that there are no more reserve map entries to add ++ ++ Raises: ++ FdtException on any error ++ """ ++ while self.check_space(fdt_finish_reservemap(self._fdt)): ++ pass ++ ++ def begin_node(self, name): ++ """Begin a new node ++ ++ Use this before adding properties to the node. Then call end_node() to ++ finish it. You can also use the context manager as shown in the FdtSw ++ class comment. ++ ++ Args: ++ name: Name of node to begin ++ ++ Raises: ++ FdtException on any error ++ """ ++ while self.check_space(fdt_begin_node(self._fdt, name)): ++ pass ++ ++ def property_string(self, name, string): ++ """Add a property with a string value ++ ++ The string will be nul-terminated when written to the device tree ++ ++ Args: ++ name: Name of property to add ++ string: String value of property ++ ++ Raises: ++ FdtException on any error ++ """ ++ while self.check_space(fdt_property_string(self._fdt, name, string)): ++ pass ++ ++ def property_u32(self, name, val): ++ """Add a property with a 32-bit value ++ ++ Write a single-cell value to the device tree ++ ++ Args: ++ name: Name of property to add ++ val: Value of property ++ ++ Raises: ++ FdtException on any error ++ """ ++ while self.check_space(fdt_property_u32(self._fdt, name, val)): ++ pass ++ ++ def property_u64(self, name, val): ++ """Add a property with a 64-bit value ++ ++ Write a double-cell value to the device tree in big-endian format ++ ++ Args: ++ name: Name of property to add ++ val: Value of property ++ ++ Raises: ++ FdtException on any error ++ """ ++ while self.check_space(fdt_property_u64(self._fdt, name, val)): ++ pass ++ ++ def property_cell(self, name, val): ++ """Add a property with a single-cell value ++ ++ Write a single-cell value to the device tree ++ ++ Args: ++ name: Name of property to add ++ val: Value of property ++ quiet: Errors to ignore (empty to raise on all errors) ++ ++ Raises: ++ FdtException on any error ++ """ ++ while self.check_space(fdt_property_cell(self._fdt, name, val)): ++ pass ++ ++ def property(self, name, val): ++ """Add a property ++ ++ Write a new property with the given value to the device tree. The value ++ is taken as is and is not nul-terminated ++ ++ Args: ++ name: Name of property to add ++ val: Value of property ++ quiet: Errors to ignore (empty to raise on all errors) ++ ++ Raises: ++ FdtException on any error ++ """ ++ while self.check_space(fdt_property_stub(self._fdt, name, val, ++ len(val))): ++ pass ++ ++ def end_node(self): ++ """End a node ++ ++ Use this after adding properties to a node to close it off. You can also ++ use the context manager as shown in the FdtSw class comment. ++ ++ Args: ++ quiet: Errors to ignore (empty to raise on all errors) ++ ++ Raises: ++ FdtException on any error ++ """ ++ while self.check_space(fdt_end_node(self._fdt)): ++ pass ++ ++ def add_node(self, name): ++ """Create a new context for adding a node ++ ++ When used in a 'with' clause this starts a new node and finishes it ++ afterward. ++ ++ Args: ++ name: Name of node to add ++ """ ++ return NodeAdder(self, name) ++ ++ ++class NodeAdder(): ++ """Class to provide a node context ++ ++ This allows you to add nodes in a more natural way: ++ ++ with fdtsw.add_node('name'): ++ fdtsw.property_string('test', 'value') ++ ++ The node is automatically completed with a call to end_node() when the ++ context exits. ++ """ ++ def __init__(self, fdtsw, name): ++ self._fdt = fdtsw ++ self._name = name ++ ++ def __enter__(self): ++ self._fdt.begin_node(self._name) ++ ++ def __exit__(self, type, value, traceback): ++ self._fdt.end_node() + %} + + %rename(fdt_property) fdt_property_func; + +-typedef int fdt32_t; ++/* ++ * fdt32_t is a big-endian 32-bit value defined to uint32_t in libfdt_env.h ++ * so use the same type here. ++ */ ++typedef uint32_t fdt32_t; + + %include "libfdt/fdt.h" + +@@ -409,6 +1023,7 @@ typedef int fdt32_t; + fdt = fdt; /* avoid unused variable warning */ + } + ++/* typemap used for fdt_get_property_by_offset() */ + %typemap(out) (struct fdt_property *) { + PyObject *buff; + +@@ -428,22 +1043,76 @@ typedef int fdt32_t; + if (!$1) + $result = Py_None; + else +- $result = Py_BuildValue("s#", $1, *arg4); ++ %#if PY_VERSION_HEX >= 0x03000000 ++ $result = Py_BuildValue("y#", $1, *arg4); ++ %#else ++ $result = Py_BuildValue("s#", $1, *arg4); ++ %#endif ++} ++ ++/* typemap used for fdt_setprop() */ ++%typemap(in) (const void *val) { ++ %#if PY_VERSION_HEX >= 0x03000000 ++ if (!PyBytes_Check($input)) { ++ SWIG_exception_fail(SWIG_TypeError, "bytes expected in method '" "$symname" ++ "', argument " "$argnum"" of type '" "$type""'"); ++ } ++ $1 = PyBytes_AsString($input); ++ %#else ++ $1 = PyString_AsString($input); /* char *str */ ++ %#endif ++} ++ ++/* typemaps used for fdt_next_node() */ ++%typemap(in, numinputs=1) int *depth (int depth) { ++ depth = (int) PyInt_AsLong($input); ++ $1 = &depth; ++} ++ ++%typemap(argout) int *depth { ++ PyObject *val = Py_BuildValue("i", *arg$argnum); ++ resultobj = SWIG_Python_AppendOutput(resultobj, val); ++} ++ ++%apply int *depth { int *depth }; ++ ++/* typemaps for fdt_get_mem_rsv */ ++%typemap(in, numinputs=0) uint64_t * (uint64_t temp) { ++ $1 = &temp; ++} ++ ++%typemap(argout) uint64_t * { ++ PyObject *val = PyLong_FromUnsignedLongLong(*arg$argnum); ++ if (!result) { ++ if (PyTuple_GET_SIZE(resultobj) == 0) ++ resultobj = val; ++ else ++ resultobj = SWIG_Python_AppendOutput(resultobj, val); ++ } + } + + /* We have both struct fdt_property and a function fdt_property() */ + %warnfilter(302) fdt_property; + + /* These are macros in the header so have to be redefined here */ +-int fdt_magic(const void *fdt); +-int fdt_totalsize(const void *fdt); +-int fdt_off_dt_struct(const void *fdt); +-int fdt_off_dt_strings(const void *fdt); +-int fdt_off_mem_rsvmap(const void *fdt); +-int fdt_version(const void *fdt); +-int fdt_last_comp_version(const void *fdt); +-int fdt_boot_cpuid_phys(const void *fdt); +-int fdt_size_dt_strings(const void *fdt); +-int fdt_size_dt_struct(const void *fdt); ++uint32_t fdt_magic(const void *fdt); ++uint32_t fdt_totalsize(const void *fdt); ++uint32_t fdt_off_dt_struct(const void *fdt); ++uint32_t fdt_off_dt_strings(const void *fdt); ++uint32_t fdt_off_mem_rsvmap(const void *fdt); ++uint32_t fdt_version(const void *fdt); ++uint32_t fdt_last_comp_version(const void *fdt); ++uint32_t fdt_boot_cpuid_phys(const void *fdt); ++uint32_t fdt_size_dt_strings(const void *fdt); ++uint32_t fdt_size_dt_struct(const void *fdt); ++ ++int fdt_property_string(void *fdt, const char *name, const char *val); ++int fdt_property_cell(void *fdt, const char *name, uint32_t val); ++ ++/* ++ * This function has a stub since the name fdt_property is used for both a ++ * function and a struct, which confuses SWIG. ++ */ ++int fdt_property_stub(void *fdt, const char *name, const void *val, int len); + + %include <../libfdt/libfdt.h> +diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py +index c5767e5fb4..037e82c8bb 100644 +--- a/tools/dtoc/dtb_platdata.py ++++ b/tools/dtoc/dtb_platdata.py +@@ -1,10 +1,9 @@ + #!/usr/bin/python ++# SPDX-License-Identifier: GPL-2.0+ + # + # Copyright (C) 2017 Google, Inc + # Written by Simon Glass + # +-# SPDX-License-Identifier: GPL-2.0+ +-# + + """Device tree to platform data class + +@@ -18,6 +17,7 @@ import sys + + import fdt + import fdt_util ++import tools + + # When we see these properties we ignore them - i.e. do not create a structure member + PROP_IGNORE_LIST = [ +@@ -100,7 +100,7 @@ def get_value(ftype, value): + if ftype == fdt.TYPE_INT: + return '%#x' % fdt_util.fdt32_to_cpu(value) + elif ftype == fdt.TYPE_BYTE: +- return '%#x' % ord(value[0]) ++ return '%#x' % tools.ToByte(value[0]) + elif ftype == fdt.TYPE_STRING: + return '"%s"' % value + elif ftype == fdt.TYPE_BOOL: +@@ -212,15 +212,21 @@ class DtbPlatdata(object): + Number of argument cells is this is a phandle, else None + """ + if prop.name in ['clocks']: ++ if not isinstance(prop.value, list): ++ prop.value = [prop.value] + val = prop.value +- if not isinstance(val, list): +- val = [val] + i = 0 + + max_args = 0 + args = [] + while i < len(val): + phandle = fdt_util.fdt32_to_cpu(val[i]) ++ # If we get to the end of the list, stop. This can happen ++ # since some nodes have more phandles in the list than others, ++ # but we allocate enough space for the largest list. So those ++ # nodes with shorter lists end up with zeroes at the end. ++ if not phandle: ++ break + target = self._fdt.phandle_to_node.get(phandle) + if not target: + raise ValueError("Cannot parse '%s' in node '%s'" % +@@ -311,7 +317,8 @@ class DtbPlatdata(object): + total = na + ns + + if reg.type != fdt.TYPE_INT: +- raise ValueError("Node '%s' reg property is not an int") ++ raise ValueError("Node '%s' reg property is not an int" % ++ node.name) + if len(reg.value) % total: + raise ValueError("Node '%s' reg property has %d cells " + 'which is not a multiple of na + ns = %d + %d)' % +@@ -401,8 +408,6 @@ class DtbPlatdata(object): + continue + info = self.get_phandle_argc(prop, node.name) + if info: +- if not isinstance(prop.value, list): +- prop.value = [prop.value] + # Process the list as pairs of (phandle, id) + pos = 0 + for args in info.args: +@@ -445,9 +450,10 @@ class DtbPlatdata(object): + self.out(';\n') + self.out('};\n') + +- for alias, struct_name in self._aliases.iteritems(): +- self.out('#define %s%s %s%s\n'% (STRUCT_PREFIX, alias, +- STRUCT_PREFIX, struct_name)) ++ for alias, struct_name in self._aliases.items(): ++ if alias not in sorted(structs): ++ self.out('#define %s%s %s%s\n'% (STRUCT_PREFIX, alias, ++ STRUCT_PREFIX, struct_name)) + + def output_node(self, node): + """Output the C code for a node +@@ -457,9 +463,10 @@ class DtbPlatdata(object): + """ + struct_name, _ = get_compat_name(node) + var_name = conv_name_to_c(node.name) +- self.buf('static struct %s%s %s%s = {\n' % ++ self.buf('static const struct %s%s %s%s = {\n' % + (STRUCT_PREFIX, struct_name, VAL_PREFIX, var_name)) +- for pname, prop in node.props.items(): ++ for pname in sorted(node.props): ++ prop = node.props[pname] + if pname in PROP_IGNORE_LIST or pname[0] == '#': + continue + member_name = conv_name_to_c(prop.name) +@@ -493,7 +500,7 @@ class DtbPlatdata(object): + vals.append(get_value(prop.type, val)) + + # Put 8 values per line to avoid very long lines. +- for i in xrange(0, len(vals), 8): ++ for i in range(0, len(vals), 8): + if i: + self.buf(',\n\t\t') + self.buf(', '.join(vals[i:i + 8])) +diff --git a/tools/dtoc/dtoc.py b/tools/dtoc/dtoc.py +index 6eacfc90a0..b3596a5918 100755 +--- a/tools/dtoc/dtoc.py ++++ b/tools/dtoc/dtoc.py +@@ -1,10 +1,9 @@ +-#!/usr/bin/env python2 ++#!/usr/bin/env python3 ++# SPDX-License-Identifier: GPL-2.0+ + # + # Copyright (C) 2016 Google, Inc + # Written by Simon Glass + # +-# SPDX-License-Identifier: GPL-2.0+ +-# + + """Device tree to C tool + +@@ -26,6 +25,8 @@ options. For more information about the use of this options and tool please + see doc/driver-model/of-plat.txt + """ + ++from __future__ import print_function ++ + from optparse import OptionParser + import os + import sys +@@ -35,41 +36,80 @@ import unittest + our_path = os.path.dirname(os.path.realpath(__file__)) + sys.path.append(os.path.join(our_path, '../patman')) + ++# Bring in the libfdt module ++sys.path.insert(0, 'scripts/dtc/pylibfdt') ++sys.path.insert(0, os.path.join(our_path, ++ '../../build-sandbox_spl/scripts/dtc/pylibfdt')) ++ + import dtb_platdata ++import test_util ++ ++def run_tests(args): ++ """Run all the test we have for dtoc + +-def run_tests(): +- """Run all the test we have for dtoc""" ++ Args: ++ args: List of positional args provided to dtoc. This can hold a test ++ name to execute (as in 'dtoc -t test_empty_file', for example) ++ """ + import test_dtoc + + result = unittest.TestResult() + sys.argv = [sys.argv[0]] ++ test_name = args and args[0] or None + for module in (test_dtoc.TestDtoc,): +- suite = unittest.TestLoader().loadTestsFromTestCase(module) ++ if test_name: ++ try: ++ suite = unittest.TestLoader().loadTestsFromName(test_name, module) ++ except AttributeError: ++ continue ++ else: ++ suite = unittest.TestLoader().loadTestsFromTestCase(module) + suite.run(result) + +- print result ++ print(result) + for _, err in result.errors: +- print err ++ print(err) + for _, err in result.failures: +- print err ++ print(err) ++ if result.errors or result.failures: ++ print('dtoc tests FAILED') ++ return 1 ++ return 0 ++ ++def RunTestCoverage(): ++ """Run the tests and check that we get 100% coverage""" ++ sys.argv = [sys.argv[0]] ++ test_util.RunTestCoverage('tools/dtoc/dtoc.py', '/dtoc.py', ++ ['tools/patman/*.py', '*/fdt*', '*test*'], options.build_dir) ++ + + if __name__ != '__main__': + sys.exit(1) + + parser = OptionParser() ++parser.add_option('-B', '--build-dir', type='string', default='b', ++ help='Directory containing the build output') + parser.add_option('-d', '--dtb-file', action='store', + help='Specify the .dtb input file') + parser.add_option('--include-disabled', action='store_true', + help='Include disabled nodes') + parser.add_option('-o', '--output', action='store', default='-', + help='Select output filename') ++parser.add_option('-P', '--processes', type=int, ++ help='set number of processes to use for running tests') + parser.add_option('-t', '--test', action='store_true', dest='test', + default=False, help='run tests') ++parser.add_option('-T', '--test-coverage', action='store_true', ++ default=False, help='run tests and check for 100% coverage') + (options, args) = parser.parse_args() + + # Run our meagre tests + if options.test: +- run_tests() ++ ret_code = run_tests(args) ++ sys.exit(ret_code) ++ ++elif options.test_coverage: ++ RunTestCoverage() + + else: + dtb_platdata.run_steps(args, options.dtb_file, options.include_disabled, +diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py +index dbc338653b..1b7b730359 100644 +--- a/tools/dtoc/fdt.py ++++ b/tools/dtoc/fdt.py +@@ -1,16 +1,17 @@ + #!/usr/bin/python ++# SPDX-License-Identifier: GPL-2.0+ + # + # Copyright (C) 2016 Google, Inc + # Written by Simon Glass + # +-# SPDX-License-Identifier: GPL-2.0+ +-# + + import struct + import sys + + import fdt_util + import libfdt ++from libfdt import QUIET_NOTFOUND ++import tools + + # This deals with a device tree, presenting it as an assortment of Node and + # Prop objects, representing nodes and properties, respectively. This file +@@ -28,6 +29,57 @@ def CheckErr(errnum, msg): + raise ValueError('Error %d: %s: %s' % + (errnum, libfdt.fdt_strerror(errnum), msg)) + ++ ++def BytesToValue(data): ++ """Converts a string of bytes into a type and value ++ ++ Args: ++ A bytes value (which on Python 2 is an alias for str) ++ ++ Return: ++ A tuple: ++ Type of data ++ Data, either a single element or a list of elements. Each element ++ is one of: ++ TYPE_STRING: str/bytes value from the property ++ TYPE_INT: a byte-swapped integer stored as a 4-byte str/bytes ++ TYPE_BYTE: a byte stored as a single-byte str/bytes ++ """ ++ data = bytes(data) ++ size = len(data) ++ strings = data.split(b'\0') ++ is_string = True ++ count = len(strings) - 1 ++ if count > 0 and not len(strings[-1]): ++ for string in strings[:-1]: ++ if not string: ++ is_string = False ++ break ++ for ch in string: ++ if ch < 32 or ch > 127: ++ is_string = False ++ break ++ else: ++ is_string = False ++ if is_string: ++ if count == 1: ++ return TYPE_STRING, strings[0].decode() ++ else: ++ return TYPE_STRING, [s.decode() for s in strings[:-1]] ++ if size % 4: ++ if size == 1: ++ return TYPE_BYTE, tools.ToChar(data[0]) ++ else: ++ return TYPE_BYTE, [tools.ToChar(ch) for ch in list(data)] ++ val = [] ++ for i in range(0, size, 4): ++ val.append(data[i:i + 4]) ++ if size == 4: ++ return TYPE_INT, val[0] ++ else: ++ return TYPE_INT, val ++ ++ + class Prop: + """A device tree property + +@@ -37,24 +89,21 @@ class Prop: + bytes + type: Value type + """ +- def __init__(self, node, offset, name, bytes): ++ def __init__(self, node, offset, name, data): + self._node = node + self._offset = offset + self.name = name + self.value = None +- self.bytes = str(bytes) +- if not bytes: ++ self.bytes = bytes(data) ++ self.dirty = False ++ if not data: + self.type = TYPE_BOOL + self.value = True + return +- self.type, self.value = self.BytesToValue(bytes) ++ self.type, self.value = BytesToValue(bytes(data)) + +- def GetPhandle(self): +- """Get a (single) phandle value from a property +- +- Gets the phandle valuie from a property and returns it as an integer +- """ +- return fdt_util.fdt32_to_cpu(self.value[:4]) ++ def RefreshOffset(self, poffset): ++ self._offset = poffset + + def Widen(self, newprop): + """Figure out which property type is more general +@@ -90,55 +139,7 @@ class Prop: + while len(self.value) < len(newprop.value): + self.value.append(val) + +- def BytesToValue(self, bytes): +- """Converts a string of bytes into a type and value +- +- Args: +- A string containing bytes +- +- Return: +- A tuple: +- Type of data +- Data, either a single element or a list of elements. Each element +- is one of: +- TYPE_STRING: string value from the property +- TYPE_INT: a byte-swapped integer stored as a 4-byte string +- TYPE_BYTE: a byte stored as a single-byte string +- """ +- bytes = str(bytes) +- size = len(bytes) +- strings = bytes.split('\0') +- is_string = True +- count = len(strings) - 1 +- if count > 0 and not strings[-1]: +- for string in strings[:-1]: +- if not string: +- is_string = False +- break +- for ch in string: +- if ch < ' ' or ch > '~': +- is_string = False +- break +- else: +- is_string = False +- if is_string: +- if count == 1: +- return TYPE_STRING, strings[0] +- else: +- return TYPE_STRING, strings[:-1] +- if size % 4: +- if size == 1: +- return TYPE_BYTE, bytes[0] +- else: +- return TYPE_BYTE, list(bytes) +- val = [] +- for i in range(0, size, 4): +- val.append(bytes[i:i + 4]) +- if size == 4: +- return TYPE_INT, val[0] +- else: +- return TYPE_INT, val +- ++ @classmethod + def GetEmpty(self, type): + """Get an empty / zero value of the given type + +@@ -148,7 +149,7 @@ class Prop: + if type == TYPE_BYTE: + return chr(0) + elif type == TYPE_INT: +- return struct.pack('I', 0); + elif type == TYPE_STRING: + return '' + else: +@@ -160,8 +161,58 @@ class Prop: + Returns: + The offset of the property (struct fdt_property) within the file + """ ++ self._node._fdt.CheckCache() + return self._node._fdt.GetStructOffset(self._offset) + ++ def SetInt(self, val): ++ """Set the integer value of the property ++ ++ The device tree is marked dirty so that the value will be written to ++ the block on the next sync. ++ ++ Args: ++ val: Integer value (32-bit, single cell) ++ """ ++ self.bytes = struct.pack('>I', val); ++ self.value = self.bytes ++ self.type = TYPE_INT ++ self.dirty = True ++ ++ def SetData(self, bytes): ++ """Set the value of a property as bytes ++ ++ Args: ++ bytes: New property value to set ++ """ ++ self.bytes = bytes ++ self.type, self.value = BytesToValue(bytes) ++ self.dirty = True ++ ++ def Sync(self, auto_resize=False): ++ """Sync property changes back to the device tree ++ ++ This updates the device tree blob with any changes to this property ++ since the last sync. ++ ++ Args: ++ auto_resize: Resize the device tree automatically if it does not ++ have enough space for the update ++ ++ Raises: ++ FdtException if auto_resize is False and there is not enough space ++ """ ++ if self._offset is None or self.dirty: ++ node = self._node ++ fdt_obj = node._fdt._fdt_obj ++ if auto_resize: ++ while fdt_obj.setprop(node.Offset(), self.name, self.bytes, ++ (libfdt.NOSPACE,)) == -libfdt.NOSPACE: ++ fdt_obj.resize(fdt_obj.totalsize() + 1024) ++ fdt_obj.setprop(node.Offset(), self.name, self.bytes) ++ else: ++ fdt_obj.setprop(node.Offset(), self.name, self.bytes) ++ ++ + class Node: + """A device tree node + +@@ -183,7 +234,15 @@ class Node: + self.subnodes = [] + self.props = {} + +- def _FindNode(self, name): ++ def GetFdt(self): ++ """Get the Fdt object for this node ++ ++ Returns: ++ Fdt object ++ """ ++ return self._fdt ++ ++ def FindNode(self, name): + """Find a node given its name + + Args: +@@ -211,22 +270,22 @@ class Node: + This fills in the props and subnodes properties, recursively + searching into subnodes so that the entire tree is built. + """ ++ fdt_obj = self._fdt._fdt_obj + self.props = self._fdt.GetProps(self) +- phandle = self.props.get('phandle') ++ phandle = fdt_obj.get_phandle(self.Offset()) + if phandle: +- val = fdt_util.fdt32_to_cpu(phandle.value) +- self._fdt.phandle_to_node[val] = self ++ self._fdt.phandle_to_node[phandle] = self + +- offset = libfdt.fdt_first_subnode(self._fdt.GetFdt(), self.Offset()) ++ offset = fdt_obj.first_subnode(self.Offset(), QUIET_NOTFOUND) + while offset >= 0: + sep = '' if self.path[-1] == '/' else '/' +- name = self._fdt._fdt_obj.get_name(offset) ++ name = fdt_obj.get_name(offset) + path = self.path + sep + name + node = Node(self._fdt, self, offset, name, path) + self.subnodes.append(node) + + node.Scan() +- offset = libfdt.fdt_next_subnode(self._fdt.GetFdt(), offset) ++ offset = fdt_obj.next_subnode(offset, QUIET_NOTFOUND) + + def Refresh(self, my_offset): + """Fix up the _offset for each node, recursively +@@ -234,13 +293,28 @@ class Node: + Note: This does not take account of property offsets - these will not + be updated. + """ ++ fdt_obj = self._fdt._fdt_obj + if self._offset != my_offset: +- #print '%s: %d -> %d\n' % (self.path, self._offset, my_offset) + self._offset = my_offset +- offset = libfdt.fdt_first_subnode(self._fdt.GetFdt(), self._offset) ++ offset = fdt_obj.first_subnode(self._offset, QUIET_NOTFOUND) + for subnode in self.subnodes: ++ if subnode.name != fdt_obj.get_name(offset): ++ raise ValueError('Internal error, node name mismatch %s != %s' % ++ (subnode.name, fdt_obj.get_name(offset))) + subnode.Refresh(offset) +- offset = libfdt.fdt_next_subnode(self._fdt.GetFdt(), offset) ++ offset = fdt_obj.next_subnode(offset, QUIET_NOTFOUND) ++ if offset != -libfdt.FDT_ERR_NOTFOUND: ++ raise ValueError('Internal error, offset == %d' % offset) ++ ++ poffset = fdt_obj.first_property_offset(self._offset, QUIET_NOTFOUND) ++ while poffset >= 0: ++ p = fdt_obj.get_property_by_offset(poffset) ++ prop = self.props.get(p.name) ++ if not prop: ++ raise ValueError("Internal error, property '%s' missing, " ++ 'offset %d' % (p.name, poffset)) ++ prop.RefreshOffset(poffset) ++ poffset = fdt_obj.next_property_offset(poffset, QUIET_NOTFOUND) + + def DeleteProp(self, prop_name): + """Delete a property of a node +@@ -252,28 +326,210 @@ class Node: + Raises: + ValueError if the property does not exist + """ +- CheckErr(libfdt.fdt_delprop(self._fdt.GetFdt(), self.Offset(), prop_name), ++ CheckErr(self._fdt._fdt_obj.delprop(self.Offset(), prop_name), + "Node '%s': delete property: '%s'" % (self.path, prop_name)) + del self.props[prop_name] + self._fdt.Invalidate() + ++ def AddZeroProp(self, prop_name): ++ """Add a new property to the device tree with an integer value of 0. ++ ++ Args: ++ prop_name: Name of property ++ """ ++ self.props[prop_name] = Prop(self, None, prop_name, ++ tools.GetBytes(0, 4)) ++ ++ def AddEmptyProp(self, prop_name, len): ++ """Add a property with a fixed data size, for filling in later ++ ++ The device tree is marked dirty so that the value will be written to ++ the blob on the next sync. ++ ++ Args: ++ prop_name: Name of property ++ len: Length of data in property ++ """ ++ value = tools.GetBytes(0, len) ++ self.props[prop_name] = Prop(self, None, prop_name, value) ++ ++ def _CheckProp(self, prop_name): ++ """Check if a property is present ++ ++ Args: ++ prop_name: Name of property ++ ++ Returns: ++ self ++ ++ Raises: ++ ValueError if the property is missing ++ """ ++ if prop_name not in self.props: ++ raise ValueError("Fdt '%s', node '%s': Missing property '%s'" % ++ (self._fdt._fname, self.path, prop_name)) ++ return self ++ ++ def SetInt(self, prop_name, val): ++ """Update an integer property int the device tree. ++ ++ This is not allowed to change the size of the FDT. ++ ++ The device tree is marked dirty so that the value will be written to ++ the blob on the next sync. ++ ++ Args: ++ prop_name: Name of property ++ val: Value to set ++ """ ++ self._CheckProp(prop_name).props[prop_name].SetInt(val) ++ ++ def SetData(self, prop_name, val): ++ """Set the data value of a property ++ ++ The device tree is marked dirty so that the value will be written to ++ the blob on the next sync. ++ ++ Args: ++ prop_name: Name of property to set ++ val: Data value to set ++ """ ++ self._CheckProp(prop_name).props[prop_name].SetData(val) ++ ++ def SetString(self, prop_name, val): ++ """Set the string value of a property ++ ++ The device tree is marked dirty so that the value will be written to ++ the blob on the next sync. ++ ++ Args: ++ prop_name: Name of property to set ++ val: String value to set (will be \0-terminated in DT) ++ """ ++ if type(val) == str: ++ val = val.encode('utf-8') ++ self._CheckProp(prop_name).props[prop_name].SetData(val + b'\0') ++ ++ def AddString(self, prop_name, val): ++ """Add a new string property to a node ++ ++ The device tree is marked dirty so that the value will be written to ++ the blob on the next sync. ++ ++ Args: ++ prop_name: Name of property to add ++ val: String value of property ++ """ ++ if sys.version_info[0] >= 3: # pragma: no cover ++ val = bytes(val, 'utf-8') ++ self.props[prop_name] = Prop(self, None, prop_name, val + b'\0') ++ ++ def AddSubnode(self, name): ++ """Add a new subnode to the node ++ ++ Args: ++ name: name of node to add ++ ++ Returns: ++ New subnode that was created ++ """ ++ path = self.path + '/' + name ++ subnode = Node(self._fdt, self, None, name, path) ++ self.subnodes.append(subnode) ++ return subnode ++ ++ def Sync(self, auto_resize=False): ++ """Sync node changes back to the device tree ++ ++ This updates the device tree blob with any changes to this node and its ++ subnodes since the last sync. ++ ++ Args: ++ auto_resize: Resize the device tree automatically if it does not ++ have enough space for the update ++ ++ Raises: ++ FdtException if auto_resize is False and there is not enough space ++ """ ++ if self._offset is None: ++ # The subnode doesn't exist yet, so add it ++ fdt_obj = self._fdt._fdt_obj ++ if auto_resize: ++ while True: ++ offset = fdt_obj.add_subnode(self.parent._offset, self.name, ++ (libfdt.NOSPACE,)) ++ if offset != -libfdt.NOSPACE: ++ break ++ fdt_obj.resize(fdt_obj.totalsize() + 1024) ++ else: ++ offset = fdt_obj.add_subnode(self.parent._offset, self.name) ++ self._offset = offset ++ ++ # Sync subnodes in reverse so that we don't disturb node offsets for ++ # nodes that are earlier in the DT. This avoids an O(n^2) rescan of ++ # node offsets. ++ for node in reversed(self.subnodes): ++ node.Sync(auto_resize) ++ ++ # Sync properties now, whose offsets should not have been disturbed. ++ # We do this after subnodes, since this disturbs the offsets of these ++ # properties. Note that new properties will have an offset of None here, ++ # which Python 3 cannot sort against int. So use a large value instead ++ # to ensure that the new properties are added first. ++ prop_list = sorted(self.props.values(), ++ key=lambda prop: prop._offset or 1 << 31, ++ reverse=True) ++ for prop in prop_list: ++ prop.Sync(auto_resize) ++ ++ + class Fdt: + """Provides simple access to a flat device tree blob using libfdts. + + Properties: + fname: Filename of fdt + _root: Root of device tree (a Node object) ++ name: Helpful name for this Fdt for the user (useful when creating the ++ DT from data rather than a file) + """ + def __init__(self, fname): + self._fname = fname + self._cached_offsets = False + self.phandle_to_node = {} ++ self.name = '' + if self._fname: ++ self.name = self._fname + self._fname = fdt_util.EnsureCompiled(self._fname) + +- with open(self._fname) as fd: +- self._fdt = bytearray(fd.read()) +- self._fdt_obj = libfdt.Fdt(self._fdt) ++ with open(self._fname, 'rb') as fd: ++ self._fdt_obj = libfdt.Fdt(fd.read()) ++ ++ @staticmethod ++ def FromData(data, name=''): ++ """Create a new Fdt object from the given data ++ ++ Args: ++ data: Device-tree data blob ++ name: Helpful name for this Fdt for the user ++ ++ Returns: ++ Fdt object containing the data ++ """ ++ fdt = Fdt(None) ++ fdt._fdt_obj = libfdt.Fdt(bytes(data)) ++ fdt.name = name ++ return fdt ++ ++ def LookupPhandle(self, phandle): ++ """Look up a phandle ++ ++ Args: ++ phandle: Phandle to look up (int) ++ ++ Returns: ++ Node object the phandle points to ++ """ ++ return self.phandle_to_node.get(phandle) + + def Scan(self, root='/'): + """Scan a device tree, building up a tree of Node objects +@@ -285,6 +541,7 @@ class Fdt: + + TODO(sjg@chromium.org): Implement the 'root' parameter + """ ++ self._cached_offsets = True + self._root = self.Node(self, None, 0, '/', '/') + self._root.Scan() + +@@ -305,8 +562,13 @@ class Fdt: + Node object, or None if not found + """ + node = self._root +- for part in path.split('/')[1:]: +- node = node._FindNode(part) ++ parts = path.split('/') ++ if len(parts) < 2: ++ return None ++ if len(parts) == 2 and parts[1] == '': ++ return node ++ for part in parts[1:]: ++ node = node.FindNode(part) + if not node: + return None + return node +@@ -317,7 +579,20 @@ class Fdt: + If the device tree has changed in memory, write it back to the file. + """ + with open(self._fname, 'wb') as fd: +- fd.write(self._fdt) ++ fd.write(self._fdt_obj.as_bytearray()) ++ ++ def Sync(self, auto_resize=False): ++ """Make sure any DT changes are written to the blob ++ ++ Args: ++ auto_resize: Resize the device tree automatically if it does not ++ have enough space for the update ++ ++ Raises: ++ FdtException if auto_resize is False and there is not enough space ++ """ ++ self._root.Sync(auto_resize) ++ self.Invalidate() + + def Pack(self): + """Pack the device tree down to its minimum size +@@ -325,23 +600,24 @@ class Fdt: + When nodes and properties shrink or are deleted, wasted space can + build up in the device tree binary. + """ +- CheckErr(libfdt.fdt_pack(self._fdt), 'pack') +- fdt_len = libfdt.fdt_totalsize(self._fdt) +- del self._fdt[fdt_len:] ++ CheckErr(self._fdt_obj.pack(), 'pack') ++ self.Invalidate() + +- def GetFdt(self): ++ def GetContents(self): + """Get the contents of the FDT + + Returns: + The FDT contents as a string of bytes + """ +- return self._fdt ++ return bytes(self._fdt_obj.as_bytearray()) + +- def CheckErr(errnum, msg): +- if errnum: +- raise ValueError('Error %d: %s: %s' % +- (errnum, libfdt.fdt_strerror(errnum), msg)) ++ def GetFdtObj(self): ++ """Get the contents of the FDT + ++ Returns: ++ The FDT contents as a libfdt.Fdt object ++ """ ++ return self._fdt_obj + + def GetProps(self, node): + """Get all properties from a node. +@@ -357,13 +633,15 @@ class Fdt: + ValueError: if the node does not exist. + """ + props_dict = {} +- poffset = libfdt.fdt_first_property_offset(self._fdt, node._offset) ++ poffset = self._fdt_obj.first_property_offset(node._offset, ++ QUIET_NOTFOUND) + while poffset >= 0: + p = self._fdt_obj.get_property_by_offset(poffset) +- prop = Prop(node, poffset, p.name, p.value) ++ prop = Prop(node, poffset, p.name, p) + props_dict[prop.name] = prop + +- poffset = libfdt.fdt_next_property_offset(self._fdt, poffset) ++ poffset = self._fdt_obj.next_property_offset(poffset, ++ QUIET_NOTFOUND) + return props_dict + + def Invalidate(self): +@@ -389,7 +667,7 @@ class Fdt: + Returns: + Position of @offset within the device tree binary + """ +- return libfdt.fdt_off_dt_struct(self._fdt) + offset ++ return self._fdt_obj.off_dt_struct() + offset + + @classmethod + def Node(self, fdt, parent, offset, name, path): +@@ -408,8 +686,16 @@ class Fdt: + node = Node(fdt, parent, offset, name, path) + return node + ++ def GetFilename(self): ++ """Get the filename of the device tree ++ ++ Returns: ++ String filename ++ """ ++ return self._fname ++ + def FdtScan(fname): +- """Returns a new Fdt object from the implementation we are using""" ++ """Returns a new Fdt object""" + dtb = Fdt(fname) + dtb.Scan() + return dtb +diff --git a/tools/dtoc/fdt_util.py b/tools/dtoc/fdt_util.py +index 338d47a5e1..b105faec74 100644 +--- a/tools/dtoc/fdt_util.py ++++ b/tools/dtoc/fdt_util.py +@@ -1,10 +1,12 @@ + #!/usr/bin/python ++# SPDX-License-Identifier: GPL-2.0+ + # + # Copyright (C) 2016 Google, Inc + # Written by Simon Glass + # +-# SPDX-License-Identifier: GPL-2.0+ +-# ++ ++# Utility functions for reading from a device tree. Once the upstream pylibfdt ++# implementation advances far enough, we should be able to drop these. + + import os + import struct +@@ -23,10 +25,6 @@ def fdt32_to_cpu(val): + Return: + A native-endian integer value + """ +- if sys.version_info > (3, 0): +- if isinstance(val, bytes): +- val = val.decode('utf-8') +- val = val.encode('raw_unicode_escape') + return struct.unpack('>I', val)[0] + + def fdt_cells_to_cpu(val, cells): +@@ -36,21 +34,23 @@ def fdt_cells_to_cpu(val, cells): + Value to convert (array of one or more 4-character strings) + + Return: +- A native-endian long value ++ A native-endian integer value + """ + if not cells: + return 0 +- out = long(fdt32_to_cpu(val[0])) ++ out = int(fdt32_to_cpu(val[0])) + if cells == 2: + out = out << 32 | fdt32_to_cpu(val[1]) + return out + +-def EnsureCompiled(fname): ++def EnsureCompiled(fname, tmpdir=None, capture_stderr=False): + """Compile an fdt .dts source file into a .dtb binary blob if needed. + + Args: + fname: Filename (if .dts it will be compiled). It not it will be + left alone ++ tmpdir: Temporary directory for output files, or None to use the ++ tools-module output directory + + Returns: + Filename of resulting .dtb file +@@ -59,8 +59,12 @@ def EnsureCompiled(fname): + if ext != '.dts': + return fname + +- dts_input = tools.GetOutputFilename('source.dts') +- dtb_output = tools.GetOutputFilename('source.dtb') ++ if tmpdir: ++ dts_input = os.path.join(tmpdir, 'source.dts') ++ dtb_output = os.path.join(tmpdir, 'source.dtb') ++ else: ++ dts_input = tools.GetOutputFilename('source.dts') ++ dtb_output = tools.GetOutputFilename('source.dtb') + + search_paths = [os.path.join(os.getcwd(), 'include')] + root, _ = os.path.splitext(fname) +@@ -75,33 +79,128 @@ def EnsureCompiled(fname): + search_list = [] + for path in search_paths: + search_list.extend(['-i', path]) +- args = ['-I', 'dts', '-o', dtb_output, '-O', 'dtb'] ++ args = ['-I', 'dts', '-o', dtb_output, '-O', 'dtb', ++ '-W', 'no-unit_address_vs_reg'] + args.extend(search_list) + args.append(dts_input) +- command.Run('dtc', *args) ++ dtc = os.environ.get('DTC') or 'dtc' ++ command.Run(dtc, *args, capture_stderr=capture_stderr) + return dtb_output + + def GetInt(node, propname, default=None): ++ """Get an integer from a property ++ ++ Args: ++ node: Node object to read from ++ propname: property name to read ++ default: Default value to use if the node/property do not exist ++ ++ Returns: ++ Integer value read, or default if none ++ """ + prop = node.props.get(propname) + if not prop: + return default +- value = fdt32_to_cpu(prop.value) +- if type(value) == type(list): +- raise ValueError("Node '%s' property '%' has list value: expecting" ++ if isinstance(prop.value, list): ++ raise ValueError("Node '%s' property '%s' has list value: expecting " + "a single integer" % (node.name, propname)) ++ value = fdt32_to_cpu(prop.value) + return value + + def GetString(node, propname, default=None): ++ """Get a string from a property ++ ++ Args: ++ node: Node object to read from ++ propname: property name to read ++ default: Default value to use if the node/property do not exist ++ ++ Returns: ++ String value read, or default if none ++ """ + prop = node.props.get(propname) + if not prop: + return default + value = prop.value +- if type(value) == type(list): +- raise ValueError("Node '%s' property '%' has list value: expecting" ++ if isinstance(value, list): ++ raise ValueError("Node '%s' property '%s' has list value: expecting " + "a single string" % (node.name, propname)) + return value + + def GetBool(node, propname, default=False): ++ """Get an boolean from a property ++ ++ Args: ++ node: Node object to read from ++ propname: property name to read ++ default: Default value to use if the node/property do not exist ++ ++ Returns: ++ Boolean value read, or default if none (if you set this to True the ++ function will always return True) ++ """ + if propname in node.props: + return True + return default ++ ++def GetByte(node, propname, default=None): ++ """Get an byte from a property ++ ++ Args: ++ node: Node object to read from ++ propname: property name to read ++ default: Default value to use if the node/property do not exist ++ ++ Returns: ++ Byte value read, or default if none ++ """ ++ prop = node.props.get(propname) ++ if not prop: ++ return default ++ value = prop.value ++ if isinstance(value, list): ++ raise ValueError("Node '%s' property '%s' has list value: expecting " ++ "a single byte" % (node.name, propname)) ++ if len(value) != 1: ++ raise ValueError("Node '%s' property '%s' has length %d, expecting %d" % ++ (node.name, propname, len(value), 1)) ++ return ord(value[0]) ++ ++def GetPhandleList(node, propname): ++ """Get a list of phandles from a property ++ ++ Args: ++ node: Node object to read from ++ propname: property name to read ++ ++ Returns: ++ List of phandles read, each an integer ++ """ ++ prop = node.props.get(propname) ++ if not prop: ++ return None ++ value = prop.value ++ if not isinstance(value, list): ++ value = [value] ++ return [fdt32_to_cpu(v) for v in value] ++ ++def GetDatatype(node, propname, datatype): ++ """Get a value of a given type from a property ++ ++ Args: ++ node: Node object to read from ++ propname: property name to read ++ datatype: Type to read (str or int) ++ ++ Returns: ++ value read, or None if none ++ ++ Raises: ++ ValueError if datatype is not str or int ++ """ ++ if datatype == str: ++ return GetString(node, propname) ++ elif datatype == int: ++ return GetInt(node, propname) ++ raise ValueError("fdt_util internal error: Unknown data type '%s'" % ++ datatype) +diff --git a/tools/patman/test_util.py b/tools/patman/test_util.py +new file mode 100644 +index 0000000000..09f258c26b +--- /dev/null ++++ b/tools/patman/test_util.py +@@ -0,0 +1,92 @@ ++# SPDX-License-Identifier: GPL-2.0+ ++# ++# Copyright (c) 2016 Google, Inc ++# ++ ++from __future__ import print_function ++ ++from contextlib import contextmanager ++import glob ++import os ++import sys ++ ++import command ++ ++try: ++ from StringIO import StringIO ++except ImportError: ++ from io import StringIO ++ ++PYTHON = 'python%d' % sys.version_info[0] ++ ++ ++def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None): ++ """Run tests and check that we get 100% coverage ++ ++ Args: ++ prog: Program to run (with be passed a '-t' argument to run tests ++ filter_fname: Normally all *.py files in the program's directory will ++ be included. If this is not None, then it is used to filter the ++ list so that only filenames that don't contain filter_fname are ++ included. ++ exclude_list: List of file patterns to exclude from the coverage ++ calculation ++ build_dir: Build directory, used to locate libfdt.py ++ required: List of modules which must be in the coverage report ++ ++ Raises: ++ ValueError if the code coverage is not 100% ++ """ ++ # This uses the build output from sandbox_spl to get _libfdt.so ++ path = os.path.dirname(prog) ++ if filter_fname: ++ glob_list = glob.glob(os.path.join(path, '*.py')) ++ glob_list = [fname for fname in glob_list if filter_fname in fname] ++ else: ++ glob_list = [] ++ glob_list += exclude_list ++ glob_list += ['*libfdt.py', '*site-packages*', '*dist-packages*'] ++ test_cmd = 'test' if 'binman.py' in prog else '-t' ++ cmd = ('PYTHONPATH=$PYTHONPATH:%s/sandbox_spl/tools %s-coverage run ' ++ '--omit "%s" %s %s -P1' % (build_dir, PYTHON, ','.join(glob_list), ++ prog, test_cmd)) ++ os.system(cmd) ++ stdout = command.Output('%s-coverage' % PYTHON, 'report') ++ lines = stdout.splitlines() ++ if required: ++ # Convert '/path/to/name.py' just the module name 'name' ++ test_set = set([os.path.splitext(os.path.basename(line.split()[0]))[0] ++ for line in lines if '/etype/' in line]) ++ missing_list = required ++ missing_list.discard('__init__') ++ missing_list.difference_update(test_set) ++ if missing_list: ++ print('Missing tests for %s' % (', '.join(missing_list))) ++ print(stdout) ++ ok = False ++ ++ coverage = lines[-1].split(' ')[-1] ++ ok = True ++ print(coverage) ++ if coverage != '100%': ++ print(stdout) ++ print("Type '%s-coverage html' to get a report in " ++ 'htmlcov/index.html' % PYTHON) ++ print('Coverage error: %s, but should be 100%%' % coverage) ++ ok = False ++ if not ok: ++ raise ValueError('Test coverage failure') ++ ++ ++# Use this to suppress stdout/stderr output: ++# with capture_sys_output() as (stdout, stderr) ++# ...do something... ++@contextmanager ++def capture_sys_output(): ++ capture_out, capture_err = StringIO(), StringIO() ++ old_out, old_err = sys.stdout, sys.stderr ++ try: ++ sys.stdout, sys.stderr = capture_out, capture_err ++ yield capture_out, capture_err ++ finally: ++ sys.stdout, sys.stderr = old_out, old_err +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-bsp/u-boot/files/0001-Revert-Makefile-enable-Werror-option.patch b/bsp/meta-rockchip/recipes-bsp/u-boot/files/0001-Revert-Makefile-enable-Werror-option.patch new file mode 100644 index 0000000000000000000000000000000000000000..a050b59c7d9e4f0aab44094d013dd3d0f6cfce6a --- /dev/null +++ b/bsp/meta-rockchip/recipes-bsp/u-boot/files/0001-Revert-Makefile-enable-Werror-option.patch @@ -0,0 +1,26 @@ +From ae86322b23aef2e4de6abdc1b220c6b56f38bcc8 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 22 Oct 2019 10:12:55 +0800 +Subject: [PATCH] Revert "Makefile: enable -Werror option" + +This reverts commit 76ba1d8a713bc964fc8e0a639f90344c4c60f026. +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 15ec80612b..c39e599a99 100644 +--- a/Makefile ++++ b/Makefile +@@ -360,7 +360,7 @@ KBUILD_CPPFLAGS := -D__KERNEL__ -D__UBOOT__ + KBUILD_CFLAGS := -Wall -Wstrict-prototypes \ + -Wno-format-security \ + -fno-builtin -ffreestanding +-KBUILD_CFLAGS += -fshort-wchar -Werror ++KBUILD_CFLAGS += -fshort-wchar + KBUILD_AFLAGS := -D__ASSEMBLY__ + + # Read UBOOTRELEASE from include/config/uboot.release (if it exists) +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-bsp/u-boot/u-boot-dummy.bb b/bsp/meta-rockchip/recipes-bsp/u-boot/u-boot-dummy.bb new file mode 100644 index 0000000000000000000000000000000000000000..4390040cb93f7e0bece64cc5067a7e4e42989ccb --- /dev/null +++ b/bsp/meta-rockchip/recipes-bsp/u-boot/u-boot-dummy.bb @@ -0,0 +1,17 @@ +# Copyright (c) 2021, Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +#SUMMARY = "Dummy loader for external bootloaders" +#SECTION = "bootloaders" +# +LICENSE = "MIT" +#LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" +# +#PROVIDES = "virtual/bootloader" +# +#addtask do_deploy +# +## Do nothing here +#do_deploy () { +# : +#} diff --git a/bsp/meta-rockchip/recipes-bsp/u-boot/u-boot_%.bbappend b/bsp/meta-rockchip/recipes-bsp/u-boot/u-boot_%.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..68ff7dd4580f239fed3868b9fefe162de8e5972a --- /dev/null +++ b/bsp/meta-rockchip/recipes-bsp/u-boot/u-boot_%.bbappend @@ -0,0 +1,103 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +#PATCHPATH = "${CURDIR}/u-boot" +#inherit auto-patch +# +#inherit python3-dir +# +#PV = "2017.09" +# +## LIC_FILES_CHKSUM = "file://Licenses/README;md5=a2c678cfd4a4d97135585cad908541c6" +# +#inherit freeze-rev local-git +# +#SRCREV = "e3ca3c3805cc60cc9e2fe2a4d78694907b49ee46" +#SRCREV_rkbin = "104659686b734ab041ef958c0abece1a250f48a4" +#SRC_URI = " \ +# git://github.com/JeffyCN/mirrors.git;protocol=https;branch=u-boot; \ +# git://github.com/JeffyCN/mirrors.git;protocol=https;branch=rkbin;name=rkbin;destsuffix=rkbin; \ +#" +#SRC_URI:remove = "file://0001-riscv32-Use-double-float-ABI-for-rv32.patch" +#SRC_URI:remove = "file://0001-riscv-fix-build-with-binutils-2.38.patch" +#SRCREV_FORMAT = "default_rkbin" +# +#DEPENDS:append = " ${PYTHON_PN}-native" +# +## Needed for packing BSP u-boot +#DEPENDS:append = " coreutils-native ${PYTHON_PN}-pyelftools-native" +# +#do_configure:prepend() { +# # Make sure we use /usr/bin/env ${PYTHON_PN} for scripts +# for s in `grep -rIl python ${S}`; do +# sed -i -e '1s|^#!.*python[23]*|#!/usr/bin/env ${PYTHON_PN}|' $s +# done +# +# # Support python3 +# sed -i -e 's/\(open([^,]*\))/\1, "rb")/' \ +# -e 's/print >> \([^,]*\), *\(.*\),*$/print(\2, file=\1)/' \ +# -e 's/print \(.*\)$/print(\1)/' \ +# ${S}/arch/arm/mach-rockchip/make_fit_atf.py +# +# # Remove unneeded stages from make.sh +# sed -i -e '/^select_tool/d' -e '/^clean/d' -e '/^\t*make/d' -e '/which python2/{n;n;s/exit 1/true/}' ${S}/make.sh +# +# if [ "x${RK_ALLOW_PREBUILT_UBOOT}" = "x1" ]; then +# # Copy prebuilt images +# if [ -e "${S}/${UBOOT_BINARY}" ]; then +# bbnote "${PN}: Found prebuilt images." +# mkdir -p ${B}/prebuilt/ +# mv ${S}/*.bin ${S}/*.img ${B}/prebuilt/ +# fi +# fi +# +# [ -e "${S}/.config" ] && make -C ${S} mrproper +#} +# +## Generate Rockchip style loader binaries +#RK_IDBLOCK_IMG = "idblock.img" +#RK_LOADER_BIN = "loader.bin" +#RK_TRUST_IMG = "trust.img" +#UBOOT_BINARY = "uboot.img" +# +#do_compile:append() { +# cd ${B} +# +# if [ -e "${B}/prebuilt/${UBOOT_BINARY}" ]; then +# bbnote "${PN}: Using prebuilt images." +# ln -sf ${B}/prebuilt/*.bin ${B}/prebuilt/*.img ${B}/ +# else +# # Prepare needed files +# for d in make.sh scripts configs arch/arm/mach-rockchip; do +# cp -rT ${S}/${d} ${d} +# done +# +# # Pack rockchip loader images +# ./make.sh +# fi +# +# ln -sf *_loader*.bin "${RK_LOADER_BIN}" +# +# # Generate idblock image +# bbnote "${PN}: Generating ${RK_IDBLOCK_IMG} from ${RK_LOADER_BIN}" +# ./tools/boot_merger --unpack "${RK_LOADER_BIN}" +# +# if [ -f FlashHead ];then +# cat FlashHead FlashData > "${RK_IDBLOCK_IMG}" +# else +# ./tools/mkimage -n "${SOC_FAMILY}" -T rksd -d FlashData \ +# "${RK_IDBLOCK_IMG}" +# fi +# +# cat FlashBoot >> "${RK_IDBLOCK_IMG}" +#} +# +#do_deploy:append() { +# cd ${B} +# +# for binary in "${RK_IDBLOCK_IMG}" "${RK_LOADER_BIN}" "${RK_TRUST_IMG}";do +# [ -f "${binary}" ] || continue +# install "${binary}" "${DEPLOYDIR}/${binary}-${PV}" +# ln -sf "${binary}-${PV}" "${DEPLOYDIR}/${binary}" +# done +#} diff --git a/bsp/meta-rockchip/recipes-connectivity/init-ifupdown/init-ifupdown/interfaces_rk3568 b/bsp/meta-rockchip/recipes-connectivity/init-ifupdown/init-ifupdown/interfaces_rk3568 deleted file mode 100644 index 7f9faa05207a2e29aaec647d731c759c32f6a191..0000000000000000000000000000000000000000 --- a/bsp/meta-rockchip/recipes-connectivity/init-ifupdown/init-ifupdown/interfaces_rk3568 +++ /dev/null @@ -1,38 +0,0 @@ -# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) - -# The loopback interface -auto lo -iface lo inet loopback - -# Wireless interfaces -iface mlan0 inet dhcp - wireless_mode managed - wireless_essid any - wpa-driver wext - wpa-conf /etc/wpa_supplicant.conf - -iface atml0 inet dhcp - -# Wired or wireless interfaces -auto eth0 -iface eth0 inet static - address 192.168.0.7 - netmask 255.255.255.0 - network 192.168.0.0 - gateway 192.168.0.1 -iface eth1 inet static - address 192.168.0.8 - netmask 255.255.255.0 - network 192.168.0.0 - gateway 192.168.0.1 - -# Ethernet/RNDIS gadget (g_ether) -# ... or on host side, usbnet and random hwaddr -iface usb0 inet static - address 192.168.7.2 - netmask 255.255.255.0 - network 192.168.7.0 - gateway 192.168.7.1 - -# Bluetooth networking -iface bnep0 inet dhcp \ No newline at end of file diff --git a/bsp/meta-rockchip/recipes-connectivity/init-ifupdown/init-ifupdown_1.0.bbappend b/bsp/meta-rockchip/recipes-connectivity/init-ifupdown/init-ifupdown_1.0.bbappend deleted file mode 100644 index 695d008d84d3cf03961d0cfc0c9674c48fe836fa..0000000000000000000000000000000000000000 --- a/bsp/meta-rockchip/recipes-connectivity/init-ifupdown/init-ifupdown_1.0.bbappend +++ /dev/null @@ -1,8 +0,0 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" - -SRC_URI:append:rk3568 = " file://interfaces_rk3568 \ -" - -do_install:append:rk3568 () { - install -m 0644 ${WORKDIR}/interfaces_rk3568 ${D}${sysconfdir}/network/interfaces -} diff --git a/bsp/meta-rockchip/recipes-connectivity/wifi_firmware/wififirmware/firmware/nxp/ed_mac_ctrl_V3_8987.conf b/bsp/meta-rockchip/recipes-connectivity/wifi_firmware/wififirmware/firmware/nxp/ed_mac_ctrl_V3_8987.conf deleted file mode 100644 index af2f2da3b322d9cc25ae59c3b1c716a2a9d73292..0000000000000000000000000000000000000000 --- a/bsp/meta-rockchip/recipes-connectivity/wifi_firmware/wififirmware/firmware/nxp/ed_mac_ctrl_V3_8987.conf +++ /dev/null @@ -1,23 +0,0 @@ -# File : ed_mac_ctrl_V3_8987.conf -# -# ed_mac_ctrl_v3 is used for 88W8997, 88W8987, 88W8977 -# ./mlanutl mlan0 hostcmd config/ed_mac_ctrl_V3_8987.conf ed_mac_ctrl_v3 -# -## Set Energy Detect Threshold for EU Adaptivity test - -ed_mac_ctrl_v3={ - CmdCode=0x0130 #Command code, DO NOT change this line - ed_ctrl_2g.enable:2=0x1 # 0 - disable EU adaptivity for 2.4GHz band - # 1 - enable EU adaptivity for 2.4GHz band - - ed_ctrl_2g.offset:2=0x6 # 0 - Default Energy Detect threshold - #offset value range: 0x80 to 0x7F - - ed_ctrl_5g.enable:2=0x1 # 0 - disable EU adaptivity for 5GHz band - # 1 - enable EU adaptivity for 5GHz band - - ed_ctrl_5g.offset:2=0x6 # 0 - Default Energy Detect threshold - #offset value range: 0x80 to 0x7F - - ed_ctrl_txq_lock:4=0xFF #DO NOT Change this line -} diff --git a/bsp/meta-rockchip/recipes-connectivity/wifi_firmware/wififirmware/firmware/nxp/ed_mac_ctrl_V3_8997.conf b/bsp/meta-rockchip/recipes-connectivity/wifi_firmware/wififirmware/firmware/nxp/ed_mac_ctrl_V3_8997.conf deleted file mode 100644 index 6c86bd7060a3ad66f08cb279e1748bd60e508aa5..0000000000000000000000000000000000000000 --- a/bsp/meta-rockchip/recipes-connectivity/wifi_firmware/wififirmware/firmware/nxp/ed_mac_ctrl_V3_8997.conf +++ /dev/null @@ -1,23 +0,0 @@ -# File : ed_mac_ctrl_V3_8997.conf -# -# ed_mac_ctrl_v3 is used for 88W8997, 88W8987, 88W8977 -# ./mlanutl mlan0 hostcmd config/ed_mac_ctrl_V3_8997.conf ed_mac_ctrl_v3 -# -## Set Energy Detect Threshold for EU Adaptivity test - -ed_mac_ctrl_v3={ - CmdCode=0x0130 #Command code, DO NOT change this line - ed_ctrl_2g.enable:2=0x1 # 0 - disable EU adaptivity for 2.4GHz band - # 1 - enable EU adaptivity for 2.4GHz band - - ed_ctrl_2g.offset:2=0x0 # 0 - Default Energy Detect threshold - #offset value range: 0x80 to 0x7F - - ed_ctrl_5g.enable:2=0x1 # 0 - disable EU adaptivity for 5GHz band - # 1 - enable EU adaptivity for 5GHz band - - ed_ctrl_5g.offset:2=0x4 # 0 - Default Energy Detect threshold - #offset value range: 0x80 to 0x7F - - ed_ctrl_txq_lock:4=0xFF #DO NOT Change this line -} diff --git a/bsp/meta-rockchip/recipes-connectivity/wifi_firmware/wififirmware/firmware/nxp/pcieuart8997_combo_v4.bin b/bsp/meta-rockchip/recipes-connectivity/wifi_firmware/wififirmware/firmware/nxp/pcieuart8997_combo_v4.bin deleted file mode 100644 index ca6f9ddba385f76ac1560a1c8033b11cc0ba5003..0000000000000000000000000000000000000000 Binary files a/bsp/meta-rockchip/recipes-connectivity/wifi_firmware/wififirmware/firmware/nxp/pcieuart8997_combo_v4.bin and /dev/null differ diff --git a/bsp/meta-rockchip/recipes-connectivity/wifi_firmware/wififirmware/firmware/nxp/sdiouart8987_combo_v0.bin b/bsp/meta-rockchip/recipes-connectivity/wifi_firmware/wififirmware/firmware/nxp/sdiouart8987_combo_v0.bin deleted file mode 100644 index a385809d4c47520fd186ab83499e80a7c3320d1e..0000000000000000000000000000000000000000 Binary files a/bsp/meta-rockchip/recipes-connectivity/wifi_firmware/wififirmware/firmware/nxp/sdiouart8987_combo_v0.bin and /dev/null differ diff --git a/bsp/meta-rockchip/recipes-connectivity/wifi_firmware/wififirmware/firmware/nxp/txpwrlimit_cfg_8987.conf b/bsp/meta-rockchip/recipes-connectivity/wifi_firmware/wififirmware/firmware/nxp/txpwrlimit_cfg_8987.conf deleted file mode 100644 index 74be6d6a307b8d3a69bb8a356f7d60080d119356..0000000000000000000000000000000000000000 --- a/bsp/meta-rockchip/recipes-connectivity/wifi_firmware/wififirmware/firmware/nxp/txpwrlimit_cfg_8987.conf +++ /dev/null @@ -1,509 +0,0 @@ -# File : txpwrlimit_cfg.conf -## Get CFG data for Tx power limitation -txpwrlimit_2g_cfg_get={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x00 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) -} - - -txpwrlimit_5g_cfg_get_sub0={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x10 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) -} - - -txpwrlimit_5g_cfg_get_sub1={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x11 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) -} - - -txpwrlimit_5g_cfg_get_sub2={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x12 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) -} - - -txpwrlimit_5g_cfg_get_sub3={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x13 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) -} - -## Set CFG data for Tx power limitation -## -## TLVStartFreq: Starting Frequency of the band for this channel -## 2407, 2414 or 2400 for 2.4 GHz -## 5000 -## 4000 -## TLVChanWidth: Channel Width -## 20 -## TLVChanNum : Channel Number -## TLVPwr[] : ModulationGroup -## 0: CCK (1,2,5.5,11 Mbps) -## 1: OFDM (6,9,12,18 Mbps) -## 2: OFDM (24,36 Mbps) -## 3: OFDM (48,54 Mbps) -## 4: HT20 (0,1,2) -## 5: HT20 (3,4) -## 6: HT20 (5,6,7) -## 7: HT40 (0,1,2) -## 8: HT40 (3,4) -## 9: HT40 (5,6,7) -## 10: VHT_QAM256 (MCS8) -## 11: VHT_40_QAM256 (MCS8,9) -## 12: VHT_80_PSK (MCS0,1,2) -## 13: VHT_80_QAM16 (MCS3,4) -## 14: VHT_80_QAM64 (MCS5,6,7) -## 15: VHT_80_QAM256 (MCS8,9) -## Power Limit in dBm -## -## For 40MHz modulation groups, specify same Tx power value for a set of -## two consecutive channel frequencies -## Valid channel sets: -## (36, 40), (44, 48), (52, 56), (60, 64) -## (100, 104), (108, 112), (116, 120), (124, 128), (132, 136), (140, 144) -## (149, 153), (157, 161) -## -## For 80MHz modulation groups, specify same Tx power value for a set of -## four consecutive channel frequencies -## Valid channel sets: -## (36, 40, 44, 48), (52, 56, 60, 64) -## (100, 104, 108, 112), (116, 120, 124, 128), (132, 136, 140, 144) -## (149, 153, 157, 161) - -## 2G Tx power limit CFG -txpwrlimit_2g_cfg_set={ - CmdCode=0x00fb # do NOT change this line - Action:2=1 # 1 - SET - RSVD:2=0 # do NOT change this line - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=1 - TLVPwr:24='0,18,1,18,2,16,3,14,4,18,5,16,6,14,7,18,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=2 - TLVPwr:24='0,18,1,18,2,16,3,14,4,18,5,16,6,14,7,18,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=3 - TLVPwr:24='0,18,1,18,2,16,3,14,4,18,5,16,6,14,7,18,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=4 - TLVPwr:24='0,18,1,18,2,16,3,14,4,18,5,16,6,14,7,18,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=5 - TLVPwr:24='0,18,1,18,2,16,3,14,4,18,5,16,6,14,7,18,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=6 - TLVPwr:24='0,18,1,18,2,16,3,14,4,18,5,16,6,14,7,18,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=7 - TLVPwr:24='0,18,1,18,2,16,3,14,4,18,5,16,6,14,7,18,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=8 - TLVPwr:24='0,18,1,18,2,16,3,14,4,18,5,16,6,14,7,18,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=9 - TLVPwr:24='0,18,1,18,2,16,3,14,4,18,5,16,6,14,7,18,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=10 - TLVPwr:24='0,18,1,18,2,16,3,14,4,18,5,16,6,14,7,18,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=11 - TLVPwr:24='0,18,1,18,2,16,3,14,4,18,5,16,6,14,7,18,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=12 - TLVPwr:24='0,16,1,16,2,16,3,14,4,16,5,16,6,14,7,16,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=13 - TLVPwr:24='0,16,1,16,2,16,3,14,4,16,5,16,6,14,7,16,8,16,9,14,10,16,11,16' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2414 - TLVChanWidth:1=20 - TLVChanNum:1=14 - TLVPwr:24='0,12,1,12,2,12,3,12,4,12,5,12,6,12,7,12,8,12,9,12,10,12,11,12' - } -} - -## 5G Tx power limit CFG -txpwrlimit_5g_cfg_set={ - CmdCode=0x00fb # do NOT change this line - Action:2=1 # 1 - SET - RSVD:2=0 # do NOT change this line - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=36 - TLVPwr:32='0,0,1,16,2,16,3,14,4,16,5,16,6,14,7,16,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=40 - TLVPwr:32='0,0,1,16,2,16,3,14,4,16,5,16,6,14,7,16,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=44 - TLVPwr:32='0,0,1,16,2,16,3,14,4,16,5,16,6,14,7,16,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=48 - TLVPwr:32='0,0,1,16,2,16,3,14,4,16,5,16,6,14,7,16,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=52 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=56 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=60 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=64 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=100 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=104 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=108 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=112 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=116 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=120 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=124 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=128 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=132 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=136 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=140 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=144 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=149 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=153 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=157 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=161 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=165 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=183 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=184 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=185 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=187 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=188 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=189 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=192 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=196 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=7 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=8 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=11 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=12 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=16 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=34 - TLVPwr:32='0,0,1,17,2,16,3,14,4,17,5,16,6,14,7,17,8,16,9,14,10,15,11,14,12,15,13,15,14,14,15,13' - } -} diff --git a/bsp/meta-rockchip/recipes-connectivity/wifi_firmware/wififirmware/firmware/nxp/txpwrlimit_cfg_8997.conf b/bsp/meta-rockchip/recipes-connectivity/wifi_firmware/wififirmware/firmware/nxp/txpwrlimit_cfg_8997.conf deleted file mode 100644 index 0f3b71a5368eca418e4814de39ea4cfdd0603b31..0000000000000000000000000000000000000000 --- a/bsp/meta-rockchip/recipes-connectivity/wifi_firmware/wififirmware/firmware/nxp/txpwrlimit_cfg_8997.conf +++ /dev/null @@ -1,621 +0,0 @@ -# File : txpwrlimit_cfg.conf -## Get CFG data for Tx power limitation -txpwrlimit_2g_cfg_get={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x00 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) -} - - -txpwrlimit_5g_cfg_get_sub0={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x10 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) -} - - -txpwrlimit_5g_cfg_get_sub1={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x11 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) -} - - -txpwrlimit_5g_cfg_get_sub2={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x12 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) -} - - -txpwrlimit_5g_cfg_get_sub3={ - CmdCode=0x00fb # do NOT change this line - Action:2=0 # 0 - GET - SubBand:2=0x13 # 0x00 2G subband (2.4G: channel 1-14) - # 0x10 5G subband0 (5G: channel 36,40,44,48, - # 52,56,60,64) - # 0x11 5G subband1 (5G: channel 100,104,108,112, - # 116,120,124,128, - # 132,136,140,144) - # 0x12 5G subband2 (5G: channel 149,153,157,161,165,172) - # 0x13 5G subband3 (5G: channel 183,184,185,187,188, - # 189, 192,196; - # 5G: channel 7,8,11,12,16,34) -} - -## Set CFG data for Tx power limitation -## -## TLVStartFreq: Starting Frequency of the band for this channel -## 2407, 2414 or 2400 for 2.4 GHz -## 5000 -## 4000 -## TLVChanWidth: Channel Width -## 20 -## TLVChanNum : Channel Number -## TLVPwr[] : ModulationGroup -## 0: CCK (1,2,5.5,11 Mbps) -## 1: OFDM (6,9,12,18 Mbps) -## 2: OFDM (24,36 Mbps) -## 3: OFDM (48,54 Mbps) -## 4: HT20 (MCS0,1,2) -## 5: HT20 (MCS3,4) -## 6: HT20 (MCS5,6,7) -## 7: HT40 (MCS0,1,2) -## 8: HT40 (MCS3,4) -## 9: HT40 (MCS5,6,7) -## 10: HT2_20 (MCS8,9,10) -## 11: HT2_20 (MCS11,12) -## 12: HT2_20 (MCS13,14,15) -## 13: HT2_40 (MCS8,9,10) -## 14: HT2_40 (MCS11,12) -## 15: HT2_40 (MCS13,14,15) -## 16: VHT_QAM256 (MCS8) -## 17: VHT_40_QAM256 (MCS8,9) -## 18: VHT_80_PSK (MCS0,1,2) -## 19: VHT_80_QAM16 (MCS3,4) -## 20: VHT_80_QAM64 (MCS5,6,7) -## 21: VHT_80_QAM256 (MCS8,9) -## 22: VHT2_20_QAM256 (MCS8,9) -## 23: VHT2_40_QAM256 (MCS8,9) -## 24: VHT2_80_PSK (MCS0, 1, 2) -## 25: VHT2_80_QAM16 (MCS3,4) -## 26: VHT2_80_QAM64 (MCS5,6,7) -## 27: VHT2_80_QAM256 (MCS8,9) -## Power Limit in dBm - -## For 40MHz modulation groups, specify same Tx power value for a set of -## two consecutive channel frequencies -## Valid channel sets: -## (36, 40), (44, 48), (52, 56), (60, 64) -## (100, 104), (108, 112), (116, 120), (124, 128), (132, 136), (140, 144) -## (149, 153), (157, 161) -## -## For 80MHz modulation groups, specify same Tx power value for a set of -## four consecutive channel frequencies -## Valid channel sets: -## (36, 40, 44, 48), (52, 56, 60, 64) -## (100, 104, 108, 112), (116, 120, 124, 128), (132, 136, 140, 144) -## (149, 153, 157, 161) - - -## 2G subband0 Tx power limit CFG -txpwrlimit_2g_cfg_set={ - CmdCode=0x00fb # do NOT change this line - Action:2=1 # 1 - SET - SubBand:2=0 # do NOT use this member in set cmd - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=1 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=2 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=3 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=4 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=5 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=6 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=7 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=8 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=9 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=10 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=11 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=12 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=13 - TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15' - } - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=2407 - TLVChanWidth:1=20 - TLVChanNum:1=14 - TLVPwr:32='0,12,1,12,2,12,3,12,4,12,5,12,6,12,7,12,8,12,9,12,10,12,11,12,12,12,13,12,14,12,15,12' - } -} - -## 5G subband1 Tx power limit CFG -txpwrlimit_5g_cfg_set_sub0={ - CmdCode=0x00fb # do NOT change this line - Action:2=1 # 1 - SET - SubBand:2=0 # do NOT use this member in set cmd - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=36 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=40 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=44 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=48 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=52 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=56 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=60 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=64 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } -} - -## 5G subband2 Tx power limit CFG -txpwrlimit_5g_cfg_set_sub1={ - CmdCode=0x00fb # do NOT change this line - Action:2=1 # 1 - SET - SubBand:2=0 # do NOT use this member in set cmd - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=100 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=104 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=108 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=112 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=116 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=120 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=124 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=128 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=132 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=136 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=140 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=144 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - -} - - -## 5G subband3 Tx power limit CFG -txpwrlimit_5g_cfg_set_sub2={ - CmdCode=0x00fb # do NOT change this line - Action:2=1 # 1 - SET - SubBand:2=0 # do NOT use this member in set cmd - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=149 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=153 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=157 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=161 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=165 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } -} - - -## 5G subband4 Tx power limit CFG -txpwrlimit_5g_cfg_set_sub3={ - CmdCode=0x00fb # do NOT change this line - Action:2=1 # 1 - SET - SubBand:2=0 # do NOT use this in set cmd - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=4000 - TLVChanWidth:1=20 - TLVChanNum:1=183 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=4000 - TLVChanWidth:1=20 - TLVChanNum:1=184 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=4000 - TLVChanWidth:1=20 - TLVChanNum:1=185 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=4000 - TLVChanWidth:1=20 - TLVChanNum:1=187 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=4000 - TLVChanWidth:1=20 - TLVChanNum:1=188 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=4000 - TLVChanWidth:1=20 - TLVChanNum:1=189 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=4000 - TLVChanWidth:1=20 - TLVChanNum:1=192 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=4000 - TLVChanWidth:1=20 - TLVChanNum:1=196 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=7 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=8 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=11 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=12 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=16 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } - - - ChanTRPC.TlvType:2=0x0189 - ChanTRPC.TlvLength:2={ - TLVStartFreq:2=5000 - TLVChanWidth:1=20 - TLVChanNum:1=34 - TLVPwr:56='0,17,1,15,2,15,3,11,4,15,5,15,6,11,7,15,8,15,9,11,10,15,11,15,12,14,13,15,14,15,15,14,16,11,17,11,18,13,19,13,20,10,21,10,22,11,23,11,24,13,25,13,26,12,27,10' - } -} diff --git a/bsp/meta-rockchip/recipes-connectivity/wifi_firmware/wififirmware/firmware/nxp/wifi_mod_para.conf b/bsp/meta-rockchip/recipes-connectivity/wifi_firmware/wififirmware/firmware/nxp/wifi_mod_para.conf deleted file mode 100644 index 96179f95d9926b16ef6a77210b1148225cc9c7b8..0000000000000000000000000000000000000000 --- a/bsp/meta-rockchip/recipes-connectivity/wifi_firmware/wififirmware/firmware/nxp/wifi_mod_para.conf +++ /dev/null @@ -1,184 +0,0 @@ -# Not matter how many spaces or tabs are inserted in a line, -# components and ending format must be exactly same as given -# example: -# -# [_] = { -# key=value -# } -# -# card_type : 8XXX (mandatory) -# block_id : configuration block id (optional ) -# key : module parameter name -# value : value for module parameter -# for string value, no need to add "" -# -# card_type supported: 8887/8897/8997/8977/8987/9098 -# block_id: support same chipset with -# different module parameter. -# For example to support mutiple SD8997 cards, usr can -# specify the configuration block id number [0 - 9], if not -# specified, it is taken as 0 by default. -# -# debug related module parameters could not be set via module -# configure file, ex. drvdbg could not be set in this file -# -# line started with "#" will be ignored -# refer to the USB8997_1 for parameters that could be set in -# this configuration file, and set the corresponding value -# according to your real needs - -SD8997 = { - cfg80211_wext=0xf - wfd_name=p2p - max_vir_bss=1 - cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf - drv_mode=7 -} - -#SD8997_1 = { -# cfg80211_wext=0xf -# wfd_name=wfd0 -# max_vir_bss=1 -# cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf -# drv_mode=5 -#} - -#SD8887 = { -# cfg80211_wext=0xf -# wfd_name=p2p -# max_vir_bss=1 -# cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf -# drv_mode=7 -#} - -#SD8897 = { -# cfg80211_wext=0xf -# wfd_name=p2p -# max_vir_bss=1 -# cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf -# drv_mode=7 -#} - -#SD8977 = { -# cfg80211_wext=0xf -# wfd_name=p2p -# max_vir_bss=1 -# cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf -# drv_mode=7 -#} - -SD8987 = { - cfg80211_wext=0xf - wfd_name=p2p - max_vir_bss=1 - cal_data_cfg=none - drv_mode=7 - ps_mode=2 - auto_ds=2 - fw_name=nxp/sdiouart8987_combo_v0.bin -} - -USB8997 = { - cfg80211_wext=0xf - wfd_name=p2p - max_vir_bss=1 - cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf - drv_mode=7 -} - -PCIE8997 = { - cfg80211_wext=0xf - wfd_name=p2p - max_vir_bss=1 - cal_data_cfg=none - drv_mode=7 - ps_mode=2 - auto_ds=2 - fw_name=nxp/pcieuart8997_combo_v4.bin -} - -PCIE9098_0 = { - cfg80211_wext=0xf - wfd_name=p2p - max_vir_bss=1 - cal_data_cfg=none - drv_mode=7 - mac_addr=00:50:43:20:12:34 -} - -PCIE9098_1 = { - cfg80211_wext=0xf - wfd_name=p2p - max_vir_bss=1 - cal_data_cfg=none - drv_mode=7 - mac_addr=00:50:43:20:52:56 -} - -#USB8997 = { -# hw_test=0 -# fw_name="nxp/usbusb8997_combo_v4.bin" -# req_fw_nowait=1 -# fw_reload=3 -# fw_serial=1 -# mac_addr=00:50:43:22:1e:3d -# mfg_mode=0 -# drv_mode=0x5 -# max_sta_bss=1 -# sta_name=wlan -# max_uap_bss=1 -# uap_name=uap -# wfd_name=p2p -# max_vir_bss=1 -# max_mpl_bss=1 -# nan_name=nan -# max_nan_bss=1 -# max_11p_bss=1 -# auto_ds=0 -# ps_mode=1 -# max_tx_buf=4096 -# intmode=0 -# gpiopin=0 -# pm_keep_power=0 -# shutdown_hs=1 -# cfg_11d=1 -# start_11ai_scan=0 -# oob_mode=0 -# sdio_pd=1 -# cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf -# txpwrtlimit_cfg=nxp/txpwr_limit.conf -# cntry_txpwrt=0 -# init_hostcmd_cfg=nxp/init_hostcmd_cfg.conf -# minicard_pwrup=0 -# cfg80211_wext=0xf -# skip_fwdnld=0 -# wq_sched_prio=0 -# wq_sched_policy=0 -# rx_work=1 -# aggrctrl=1 -# usb_aggr=1 -# pcie_int_mode=1 -# low_power_mode_enable=1 -# wakelock_timeout=10 -# dev_cap_mask=0xffffffff -# sdio_rx_aggr=1 -# pmic=1 -# antcfg=0 -# uap_oper_ctrl=0 -# hs_wake_interval=400 -# indication_gpio=0xff -# disconnect_on_suspend=0 -# hs_mimo_switch=1 -# indrstcfg=0xffffffff -# fixed_beacon_buffer=0 -# GoAgeoutTime=0 -# gtk_rekey_offload=1 -# multi_dtim=0 -# inact_tmo=0 -# usb_fw_option=1 -# napi=1 -# dfs_offload=1 -# cfg80211_drcs=1 -# drcs_chantime_mode=0 -# reg_alpha2=US -#} diff --git a/bsp/meta-rockchip/recipes-connectivity/wifi_firmware/wififirmware_v1.0.bb b/bsp/meta-rockchip/recipes-connectivity/wifi_firmware/wififirmware_v1.0.bb deleted file mode 100644 index d8e5b08bdebd0e652fd95962e6ff352e4013e1d8..0000000000000000000000000000000000000000 --- a/bsp/meta-rockchip/recipes-connectivity/wifi_firmware/wififirmware_v1.0.bb +++ /dev/null @@ -1,14 +0,0 @@ -SUMMARY = "add wifi firmware to /lib" -DESCRIPTION = "wifi_firmware" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" -PR = "r0" -SRC_URI = "file://firmware/nxp" - -FILES:${PN} += "/lib/firmware/nxp" -inherit allarch - -do_install() { - install -d ${D}/lib/firmware/nxp - install -m 0755 ${WORKDIR}/firmware/nxp/* ${D}/lib/firmware/nxp/ -} diff --git a/bsp/meta-rockchip/recipes-core/busybox/busybox_%.bbappend b/bsp/meta-rockchip/recipes-core/busybox/busybox_%.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..5eb093729c43c5fa64d613a9a49958babe8aff1b --- /dev/null +++ b/bsp/meta-rockchip/recipes-core/busybox/busybox_%.bbappend @@ -0,0 +1,8 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +SRC_URI:append = " \ + file://gpt-label.cfg \ +" diff --git a/bsp/meta-rockchip/recipes-core/busybox/files/gpt-label.cfg b/bsp/meta-rockchip/recipes-core/busybox/files/gpt-label.cfg new file mode 100644 index 0000000000000000000000000000000000000000..686eb99d1433166a8041dc45f5f91cea8cf7c7c4 --- /dev/null +++ b/bsp/meta-rockchip/recipes-core/busybox/files/gpt-label.cfg @@ -0,0 +1 @@ +CONFIG_FEATURE_GPT_LABEL=y diff --git a/bsp/meta-rockchip/recipes-core/coreutils/coreutils_%.bbappend b/bsp/meta-rockchip/recipes-core/coreutils/coreutils_%.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..d95b0bd8c3f0ed16697a26aeb81368a1e8045fbc --- /dev/null +++ b/bsp/meta-rockchip/recipes-core/coreutils/coreutils_%.bbappend @@ -0,0 +1,4 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +CACHED_CONFIGUREVARS:class-native = " FORCE_UNSAFE_CONFIGURE=1" diff --git a/bsp/meta-rockchip/recipes-core/glibc/glibc-locale_%.bbappend b/bsp/meta-rockchip/recipes-core/glibc/glibc-locale_%.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..16031efaa0881d9cb41562c3d4b94063b8fe4c7f --- /dev/null +++ b/bsp/meta-rockchip/recipes-core/glibc/glibc-locale_%.bbappend @@ -0,0 +1,5 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +# Avoid dup files warning in multilib case +SSTATE_ALLOW_OVERLAP_FILES:append = " ${LOCALETREESRC}" diff --git a/bsp/meta-rockchip/recipes-core/glibc/glibc_%.bbappend b/bsp/meta-rockchip/recipes-core/glibc/glibc_%.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..2b903589f64191bff135896ffe859eb64fdf3877 --- /dev/null +++ b/bsp/meta-rockchip/recipes-core/glibc/glibc_%.bbappend @@ -0,0 +1,5 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +# Avoid dup files warning in multilib case +SSTATE_ALLOW_OVERLAP_FILES:append = " ${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale" diff --git a/bsp/meta-rockchip/recipes-core/images/ok3568.inc b/bsp/meta-rockchip/recipes-core/images/ok3568.inc deleted file mode 100644 index dc85c83ebd92951bdbbe88bd8732ec4cf13c443c..0000000000000000000000000000000000000000 --- a/bsp/meta-rockchip/recipes-core/images/ok3568.inc +++ /dev/null @@ -1 +0,0 @@ -require rk3568.inc diff --git a/bsp/meta-rockchip/recipes-core/images/ryd-3568.inc b/bsp/meta-rockchip/recipes-core/images/ryd-3568.inc deleted file mode 100644 index dc85c83ebd92951bdbbe88bd8732ec4cf13c443c..0000000000000000000000000000000000000000 --- a/bsp/meta-rockchip/recipes-core/images/ryd-3568.inc +++ /dev/null @@ -1 +0,0 @@ -require rk3568.inc diff --git a/bsp/meta-rockchip/recipes-core/systemd/systemd/0001-basic-Allow-unknown-filesystems.patch b/bsp/meta-rockchip/recipes-core/systemd/systemd/0001-basic-Allow-unknown-filesystems.patch new file mode 100644 index 0000000000000000000000000000000000000000..c46ebf639b6ec08af406744d214979270b6cbc0a --- /dev/null +++ b/bsp/meta-rockchip/recipes-core/systemd/systemd/0001-basic-Allow-unknown-filesystems.patch @@ -0,0 +1,28 @@ +From 68cc85baa2ac23e6553ccdf4f7c2ecb9035b98b3 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 8 Feb 2022 16:38:30 +0800 +Subject: [PATCH] basic: Allow unknown filesystems + +Allow unused custom filesystems(e.g. sdcardfs). + +Signed-off-by: Jeffy Chen +--- + src/basic/meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/basic/meson.build b/src/basic/meson.build +index 229ac97c69..3da9cf8560 100644 +--- a/src/basic/meson.build ++++ b/src/basic/meson.build +@@ -386,7 +386,7 @@ filesystem_includes = ['linux/magic.h', + check_filesystems = find_program('check-filesystems.sh') + r = run_command([check_filesystems, cpp, 'filesystems-gperf.gperf'] + filesystem_includes) + if r.returncode() != 0 +- error('found unknown filesystem(s) defined in kernel headers:\n\n' + r.stdout()) ++ warning('found unknown filesystem(s) defined in kernel headers:\n\n' + r.stdout()) + r.stdout() + endif + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-core/systemd/systemd_%.bbappend b/bsp/meta-rockchip/recipes-core/systemd/systemd_%.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..fdbbe9b78f035e681b1480c5a5f6debca4564c4b --- /dev/null +++ b/bsp/meta-rockchip/recipes-core/systemd/systemd_%.bbappend @@ -0,0 +1,11 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" + +SRC_URI:append = " \ + file://0001-basic-Allow-unknown-filesystems.patch \ +" + +# Avoid installing hwdb +EXTRA_OEMAKE:append = " dist_udevhwdb_DATA=" diff --git a/bsp/meta-rockchip/recipes-core/sysvinit/sysvinit/0001-Support-rebooting-with-arg.patch b/bsp/meta-rockchip/recipes-core/sysvinit/sysvinit/0001-Support-rebooting-with-arg.patch new file mode 100644 index 0000000000000000000000000000000000000000..c04c652d9af76a26c10b51230588f2d38a6b6cb3 --- /dev/null +++ b/bsp/meta-rockchip/recipes-core/sysvinit/sysvinit/0001-Support-rebooting-with-arg.patch @@ -0,0 +1,71 @@ +From 142c2f03d9b2b5264112dddd36c658954cf877b8 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 16 Jul 2018 09:53:40 +0800 +Subject: [PATCH] Support rebooting with arg + +Signed-off-by: Jeffy Chen +--- + src/halt.c | 19 +++++++++++++++++-- + 1 file changed, 17 insertions(+), 2 deletions(-) + +diff --git a/src/halt.c b/src/halt.c +index 499e973..26e6c86 100644 +--- a/src/halt.c ++++ b/src/halt.c +@@ -58,6 +58,9 @@ + #include + #include "reboot.h" + ++#include ++#include ++ + char *Version = "@(#)halt 2.86 31-Jul-2004 miquels@cistron.nl"; + char *progname; + +@@ -184,6 +187,7 @@ int main(int argc, char **argv) + int do_poweroff = 0; + int c; + char *tm = NULL; ++ char *extra_arg = NULL; + + /* + * Find out who we are +@@ -232,7 +236,8 @@ int main(int argc, char **argv) + usage(); + } + } +- if (argc != optind) usage(); ++ if (argc != optind) ++ extra_arg = argv[optind]; + + if (geteuid() != 0) { + fprintf(stderr, "%s: must be superuser.\n", progname); +@@ -241,7 +246,7 @@ int main(int argc, char **argv) + + (void)chdir("/"); + +- if (!do_hard && !do_nothing) { ++ if (!do_hard && !do_nothing && !extra_arg) { + /* + * See if we are in runlevel 0 or 6. + */ +@@ -277,6 +282,16 @@ int main(int argc, char **argv) + if (do_nothing) exit(0); + + if (do_reboot) { ++ if (extra_arg) { ++ if (!do_sync) ++ sync(); ++ printf("rebooting with arg(%s)", extra_arg); ++ syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, ++ LINUX_REBOOT_MAGIC2, ++ LINUX_REBOOT_CMD_RESTART2, extra_arg); ++ exit(0); ++ } ++ + init_reboot(BMAGIC_REBOOT); + } else { + /* +-- +2.11.0 + diff --git a/bsp/meta-rockchip/recipes-core/sysvinit/sysvinit_%.bbappend b/bsp/meta-rockchip/recipes-core/sysvinit/sysvinit_%.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..6708fb1633525c73393d7e8e3886bb61aa7b6d6d --- /dev/null +++ b/bsp/meta-rockchip/recipes-core/sysvinit/sysvinit_%.bbappend @@ -0,0 +1,8 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" + +SRC_URI:append = " \ + file://0001-Support-rebooting-with-arg.patch \ +" diff --git a/bsp/meta-rockchip/recipes-core/udev/files/99-rockchip-permissions.rules b/bsp/meta-rockchip/recipes-core/udev/files/99-rockchip-permissions.rules new file mode 100644 index 0000000000000000000000000000000000000000..406a924fc6d9dcd715484af78345aca2ac153f80 --- /dev/null +++ b/bsp/meta-rockchip/recipes-core/udev/files/99-rockchip-permissions.rules @@ -0,0 +1,27 @@ +ACTION=="remove", GOTO="permissions_end" + +# VPU devices +KERNEL=="avsd", MODE="0660", GROUP="video" +KERNEL=="vepu", MODE="0660", GROUP="video" +KERNEL=="h265e", MODE="0660", GROUP="video" +KERNEL=="rkvdec", MODE="0660", GROUP="video" +KERNEL=="rkvenc", MODE="0660", GROUP="video" +KERNEL=="mpp_service", MODE="0660", GROUP="video" +KERNEL=="vpu[_-]service", MODE="0660", GROUP="video" +KERNEL=="hevc[_-]service", MODE="0660", GROUP="video" + +# RGA device +KERNEL=="rga", MODE="0660", GROUP="video" + +# MALI devices (/dev/mali for mali400) +KERNEL=="mali*", MODE="0660", GROUP="video" + +# DMA heap devices +KERNEL=="cma", MODE="0660", GROUP="video" +KERNEL=="cma-uncached", MODE="0660", GROUP="video" +KERNEL=="system", MODE="0660", GROUP="video" +KERNEL=="system-dma32", MODE="0660", GROUP="video" +KERNEL=="system-uncached", MODE="0660", GROUP="video" +KERNEL=="system-uncached-dma32", MODE="0660", GROUP="video" + +LABEL="permissions_end" diff --git a/bsp/meta-rockchip/recipes-core/udev/udev-conf-rockchip.bb b/bsp/meta-rockchip/recipes-core/udev/udev-conf-rockchip.bb new file mode 100644 index 0000000000000000000000000000000000000000..df7ea36f30422fb520e32ad6ef3c704df493b7b3 --- /dev/null +++ b/bsp/meta-rockchip/recipes-core/udev/udev-conf-rockchip.bb @@ -0,0 +1,17 @@ +# Copyright (c) 2022, Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +DESCRIPTION = "Rockchip configuration files for udev." +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +SRC_URI = " \ + file://99-rockchip-permissions.rules \ +" + +S = "${WORKDIR}" + +do_install() { + install -d ${D}${nonarch_base_libdir}/udev/rules.d + install -m 0644 ${WORKDIR}/99-rockchip-permissions.rules ${D}${nonarch_base_libdir}/udev/rules.d/99-rockchip-permissions.rules +} diff --git a/bsp/meta-rockchip/recipes-devtools/android-tools/android-tools-conf-rockchip.bb b/bsp/meta-rockchip/recipes-devtools/android-tools/android-tools-conf-rockchip.bb new file mode 100644 index 0000000000000000000000000000000000000000..7ee964cbfe10dbafb4f4bfed2d39507a35ce34c2 --- /dev/null +++ b/bsp/meta-rockchip/recipes-devtools/android-tools/android-tools-conf-rockchip.bb @@ -0,0 +1,50 @@ +# Copyright (C) 2022, Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +SECTION = "console/utils" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +SRC_URI:append = " \ + file://adbd.sh \ + file://android-gadget-setup \ + file://android-gadget-start \ + file://android-gadget-cleanup \ + file://10-adbd-rockchip.conf \ +" + +do_install:append() { + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/adbd.sh ${D}${sysconfdir}/init.d/adbd.sh + + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/android-gadget-setup ${D}${bindir} + install -m 0755 ${WORKDIR}/android-gadget-start ${D}${bindir} + install -m 0755 ${WORKDIR}/android-gadget-cleanup ${D}${bindir} + + install -d ${D}${systemd_unitdir}/system/android-tools-adbd.service.d + install -m0644 ${WORKDIR}/10-adbd-rockchip.conf \ + ${D}${systemd_unitdir}/system/android-tools-adbd.service.d + + if [ "${USB_DEBUGGING_ENABLED}" = "1" ]; then + install -d ${D}/var + touch ${D}/var/usb-debugging-enabled + fi +} + +inherit update-rc.d + +INITSCRIPT_PACKAGES = "${PN}" +INITSCRIPT_NAME = "adbd.sh" +INITSCRIPT_PARAMS = "start 70 5 4 3 2 . stop 30 0 1 6 ." + +FILES:${PN}:append = " \ + /var/ \ + ${sysconfdir}/ \ + ${systemd_unitdir}/system/ \ +" + +PROVIDES:append = " android-tools-conf" +RPROVIDES:${PN} = "android-tools-conf" diff --git a/bsp/meta-rockchip/recipes-devtools/android-tools/files/10-adbd-rockchip.conf b/bsp/meta-rockchip/recipes-devtools/android-tools/files/10-adbd-rockchip.conf new file mode 100644 index 0000000000000000000000000000000000000000..097bd1b9f64eeaab2250ba0a7656b0aecba40d26 --- /dev/null +++ b/bsp/meta-rockchip/recipes-devtools/android-tools/files/10-adbd-rockchip.conf @@ -0,0 +1,8 @@ +[Service] +Environment="PROC_service.adb.tcp.port=5555" + +# Already in android-tools-adbd.service +# ExecStartPre=/usr/bin/android-gadget-setup + +ExecStartPost=/usr/bin/android-gadget-start +ExecStopPost=/usr/bin/android-gadget-cleanup diff --git a/bsp/meta-rockchip/recipes-devtools/android-tools/files/adbd.sh b/bsp/meta-rockchip/recipes-devtools/android-tools/files/adbd.sh new file mode 100755 index 0000000000000000000000000000000000000000..adff9c02fe87cc3b1e678b243809a243c11a6382 --- /dev/null +++ b/bsp/meta-rockchip/recipes-devtools/android-tools/files/adbd.sh @@ -0,0 +1,58 @@ +#!/bin/sh -e +### BEGIN INIT INFO +# Provides: adbd +# Required-Start: mountvirtfs +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Android Debug Bridge +### END INIT INFO + +PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" + +test -f /var/usb-debugging-enabled || exit 0 + +start_adbd() +{ + android-gadget-setup + + start-stop-daemon -S -b -n adbd -a \ + /usr/bin/env PROC_service.adb.tcp.port=5555 /usr/bin/adbd + + android-gadget-start +} + +stop_adbd() +{ + start-stop-daemon -K -o -n adbd + + android-gadget-cleanup +} + +case "$1" in + start) + echo -n "Starting Android Debug Bridge" + start_adbd + echo "." + ;; + stop) + echo -n "Stopping Android Debug Bridge" + stop_adbd + echo "." + ;; + restart|reload) + echo -n "Stopping Android Debug Bridge" + stop_adbd + echo "." + echo -n "Starting Android Debug Bridge" + start_adbd + echo "." + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit 0 diff --git a/bsp/meta-rockchip/recipes-devtools/android-tools/files/android-gadget-cleanup b/bsp/meta-rockchip/recipes-devtools/android-tools/files/android-gadget-cleanup new file mode 100644 index 0000000000000000000000000000000000000000..d37c6885ea8765b1b37b54f97e48bdf9ae07ea04 --- /dev/null +++ b/bsp/meta-rockchip/recipes-devtools/android-tools/files/android-gadget-cleanup @@ -0,0 +1,21 @@ +#!/bin/sh + +[ -d /sys/kernel/config/usb_gadget/adb ] || exit 0 + +cd /sys/kernel/config/usb_gadget/adb + +echo -n "" > UDC || true + +umount /dev/usb-ffs/adb +rmdir /dev/usb-ffs/adb + +rm configs/c.1/ffs.usb0 + +rmdir configs/c.1/strings/0x409 +rmdir configs/c.1 + +rmdir functions/ffs.usb0 +rmdir strings/0x409 + +cd .. +rmdir adb diff --git a/bsp/meta-rockchip/recipes-devtools/android-tools/files/android-gadget-setup b/bsp/meta-rockchip/recipes-devtools/android-tools/files/android-gadget-setup new file mode 100644 index 0000000000000000000000000000000000000000..2536bc5e8590b80dc1b69245b966ff1d59b69914 --- /dev/null +++ b/bsp/meta-rockchip/recipes-devtools/android-tools/files/android-gadget-setup @@ -0,0 +1,33 @@ +#!/bin/sh + +set -e + +vendor=0x2207 +product=0x0006 +manufacturer=Rockchip +model="RK3xxx" +serial=0123456789ABCDEF + +[ -d /sys/kernel/config/usb_gadget ] || modprobe libcomposite + +cd /sys/kernel/config/usb_gadget + +[ -d adb ] && /usr/bin/android-gadget-cleanup || true + +mkdir adb +cd adb + +mkdir configs/c.1 +mkdir functions/ffs.usb0 +mkdir strings/0x409 +mkdir configs/c.1/strings/0x409 +echo -n "$vendor" > idVendor +echo -n "$product" > idProduct +echo "$serial" > strings/0x409/serialnumber +echo "$manufacturer" > strings/0x409/manufacturer +echo "$model" > strings/0x409/product +echo "adb" > configs/c.1/strings/0x409/configuration +ln -s functions/ffs.usb0 configs/c.1 + +mkdir -p /dev/usb-ffs/adb +mount -t functionfs usb0 /dev/usb-ffs/adb diff --git a/bsp/meta-rockchip/recipes-devtools/android-tools/files/android-gadget-start b/bsp/meta-rockchip/recipes-devtools/android-tools/files/android-gadget-start new file mode 100644 index 0000000000000000000000000000000000000000..8545a740eabbfb0490f1967d11bf53ee8951a916 --- /dev/null +++ b/bsp/meta-rockchip/recipes-devtools/android-tools/files/android-gadget-start @@ -0,0 +1,12 @@ +#!/bin/sh + +set -e + +# Wait for usb ffs ready +for i in `seq 100`;do + fuser /dev/usb-ffs/adb/ep* && break + sleep .01 +done + +ls /sys/class/udc/ | head -n 1 | \ + xargs echo -n > /sys/kernel/config/usb_gadget/adb/UDC diff --git a/bsp/meta-rockchip/recipes-devtools/brcm-tools/brcm-tools.bb b/bsp/meta-rockchip/recipes-devtools/brcm-tools/brcm-tools.bb new file mode 100644 index 0000000000000000000000000000000000000000..fa2a0e73a8d7fc690af24a5d3b381b367f66a5f6 --- /dev/null +++ b/bsp/meta-rockchip/recipes-devtools/brcm-tools/brcm-tools.bb @@ -0,0 +1,25 @@ +# Copyright (c) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +DESCRIPTION = "Broadcom develop tools" +SECTION = "devel" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +SRC_URI = " \ + file://dhd_priv.c \ + file://brcm_patchram_plus1.c \ + file://Makefile \ +" + +S = "${WORKDIR}" + +do_compile:append() { + ${CC} ${CFLAGS} ${LDFLAGS} brcm_patchram_plus1.c -o brcm_patchram_plus +} + +do_install() { + install -d ${D}${bindir} + install -m 0755 dhd_priv ${D}${bindir} + install -m 0755 brcm_patchram_plus ${D}${bindir} +} diff --git a/bsp/meta-rockchip/recipes-devtools/brcm-tools/files/Makefile b/bsp/meta-rockchip/recipes-devtools/brcm-tools/files/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..6be4f8dc45cc36cc583a326c9a17346c6295bd6e --- /dev/null +++ b/bsp/meta-rockchip/recipes-devtools/brcm-tools/files/Makefile @@ -0,0 +1,21 @@ +CC ?= $(CROSS_COMPILE)gcc + +IFLAGS := -g -Wall + +DFLAGS += -DLIB + +#DFLAGS += -DIL_BIGENDIAN + +obj-dhd_priv = dhd_priv.o + +DHD_PRIV := dhd_priv + +CFLAGS += $(IFLAGS) $(DFLAGS) + +all: $(DHD_PRIV) + +$(DHD_PRIV): $(obj-dhd_priv) + $(CC) -o $@ $(obj-dhd_priv) $(CFLAGS) $(LDFLAGS) + +clean: + -rm -f $(DHD_HPRIV) *.o diff --git a/bsp/meta-rockchip/recipes-devtools/brcm-tools/files/brcm_patchram_plus1.c b/bsp/meta-rockchip/recipes-devtools/brcm-tools/files/brcm_patchram_plus1.c new file mode 100644 index 0000000000000000000000000000000000000000..e0ff49aac62d90d412b3b0d0123122d54d8a8744 --- /dev/null +++ b/bsp/meta-rockchip/recipes-devtools/brcm-tools/files/brcm_patchram_plus1.c @@ -0,0 +1,939 @@ +/******************************************************************************* + * + * Copyright (C) 2009-2011 Broadcom Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ******************************************************************************/ + +/***************************************************************************** +** +** Name: brcm_patchram_plus.c +** +** Description: This program downloads a patchram files in the HCD format +** to Broadcom Bluetooth based silicon and combo chips and +** and other utility functions. +** +** It can be invoked from the command line in the form +** <-d> to print a debug log +** <--patchram patchram_file> +** <--baudrate baud_rate> +** <--bd_addr bd_address> +** <--enable_lpm> +** <--enable_hci> +** <--use_baudrate_for_download> +** <--scopcm=sco_routing,pcm_interface_rate,frame_type, +** sync_mode,clock_mode,lsb_first,fill_bits, +** fill_method,fill_num,right_justify> +** +** Where +** +** sco_routing is 0 for PCM, 1 for Transport, +** 2 for Codec and 3 for I2S, +** +** pcm_interface_rate is 0 for 128KBps, 1 for +** 256 KBps, 2 for 512KBps, 3 for 1024KBps, +** and 4 for 2048Kbps, +** +** frame_type is 0 for short and 1 for long, +** +** sync_mode is 0 for slave and 1 for master, +** +** clock_mode is 0 for slabe and 1 for master, +** +** lsb_first is 0 for false aand 1 for true, +** +** fill_bits is the value in decimal for unused bits, +** +** fill_method is 0 for 0's and 1 for 1's, 2 for +** signed and 3 for programmable, +** +** fill_num is the number or bits to fill, +** +** right_justify is 0 for false and 1 for true +** +** <--i2s=i2s_enable,is_master,sample_rate,clock_rate> +** +** Where +** +** i2s_enable is 0 for disable and 1 for enable, +** +** is_master is 0 for slave and 1 for master, +** +** sample_rate is 0 for 8KHz, 1 for 16Khz and +** 2 for 4 KHz, +** +** clock_rate is 0 for 128KHz, 1 for 256KHz, 3 for +** 1024 KHz and 4 for 2048 KHz. +** +** <--no2bytes skips waiting for two byte confirmation +** before starting patchram download. Newer chips +** do not generate these two bytes.> +** <--tosleep=number of microsseconds to sleep before +** patchram download begins.> +** uart_device_name +** +** For example: +** +** brcm_patchram_plus -d --patchram \ +** BCM2045B2_002.002.011.0348.0349.hcd /dev/ttyHS0 +** +** It will return 0 for success and a number greater than 0 +** for any errors. +** +** For Android, this program invoked using a +** "system(2)" call from the beginning of the bt_enable +** function inside the file +** system/bluetooth/bluedroid/bluetooth.c. +** +** If the Android system property "ro.bt.bcm_bdaddr_path" is +** set, then the bd_addr will be read from this path. +** This is overridden by --bd_addr on the command line. +** +******************************************************************************/ + +// TODO: Integrate BCM support into Bluez hciattach + +#include +#include +#include + +#include +#include +#include + +#include +#include + +#ifdef ANDROID +#include +#else +#include +#include +#include +#endif + +#include +#include + +#ifdef ANDROID +#include +#define LOG_TAG "brcm_patchram_plus" +#include +#undef printf +#define printf ALOGD +#undef fprintf +#define fprintf(x, ...) \ + { if(x==stderr) ALOGE(__VA_ARGS__); else fprintf(x, __VA_ARGS__); } + +#endif //ANDROID + +#ifndef N_HCI +#define N_HCI 15 +#endif + +#define HCIUARTSETPROTO _IOW('U', 200, int) +#define HCIUARTGETPROTO _IOR('U', 201, int) +#define HCIUARTGETDEVICE _IOR('U', 202, int) +#define AP_NAME_SUFFIX_LEN 18 + +#define HCI_UART_H4 0 +#define HCI_UART_BCSP 1 +#define HCI_UART_3WIRE 2 +#define HCI_UART_H4DS 3 +#define HCI_UART_LL 4 + +typedef unsigned char uchar; + +int uart_fd = -1; +int hcdfile_fd = -1; +int termios_baudrate = 0; +int bdaddr_flag = 0; +int enable_lpm = 0; +int enable_hci = 0; +int use_baudrate_for_download = 0; +int debug = 0; +int scopcm = 0; +int i2s = 0; +int no2bytes = 0; +int tosleep = 0; + +struct termios termios; +uchar buffer[1024]; + +uchar hci_reset[] = { 0x01, 0x03, 0x0c, 0x00 }; + +uchar hci_download_minidriver[] = { 0x01, 0x2e, 0xfc, 0x00 }; + +uchar hci_update_baud_rate[] = { 0x01, 0x18, 0xfc, 0x06, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 }; + +uchar hci_write_bd_addr[] = { 0x01, 0x01, 0xfc, 0x06, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +uchar hci_write_sleep_mode[] = { 0x01, 0x27, 0xfc, 0x0c, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00 }; + +uchar hci_write_sco_pcm_int[] = + { 0x01, 0x1C, 0xFC, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +uchar hci_write_pcm_data_format[] = + { 0x01, 0x1e, 0xFC, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +uchar hci_write_i2spcm_interface_param[] = + { 0x01, 0x6d, 0xFC, 0x04, 0x00, 0x00, 0x00, 0x00 }; + +int +parse_patchram(char *optarg) +{ + char *p; + + if (!(p = strrchr(optarg, '.'))) { + fprintf(stderr, "file %s not an HCD file\n", optarg); + exit(3); + } + + p++; + + if (strcasecmp("hcd", p) != 0) { + fprintf(stderr, "file %s not an HCD file\n", optarg); + exit(4); + } + + if ((hcdfile_fd = open(optarg, O_RDONLY)) == -1) { + fprintf(stderr, "file %s could not be opened, error %d\n", optarg, errno); + exit(5); + } + + return(0); +} + +void +BRCM_encode_baud_rate(uint baud_rate, uchar *encoded_baud) +{ + if(baud_rate == 0 || encoded_baud == NULL) { + fprintf(stderr, "Baudrate not supported!"); + return; + } + + encoded_baud[3] = (uchar)(baud_rate >> 24); + encoded_baud[2] = (uchar)(baud_rate >> 16); + encoded_baud[1] = (uchar)(baud_rate >> 8); + encoded_baud[0] = (uchar)(baud_rate & 0xFF); +} + +typedef struct { + int baud_rate; + int termios_value; +} tBaudRates; + +tBaudRates baud_rates[] = { + { 115200, B115200 }, + { 230400, B230400 }, + { 460800, B460800 }, + { 500000, B500000 }, + { 576000, B576000 }, + { 921600, B921600 }, + { 1000000, B1000000 }, + { 1152000, B1152000 }, + { 1500000, B1500000 }, + { 2000000, B2000000 }, + { 2500000, B2500000 }, + { 3000000, B3000000 }, +#ifndef __CYGWIN__ + { 3500000, B3500000 }, + { 4000000, B4000000 } +#endif +}; + +int +validate_baudrate(int baud_rate, int *value) +{ + unsigned int i; + + for (i = 0; i < (sizeof(baud_rates) / sizeof(tBaudRates)); i++) { + if (baud_rates[i].baud_rate == baud_rate) { + *value = baud_rates[i].termios_value; + return(1); + } + } + + return(0); +} + +int +parse_baudrate(char *optarg) +{ + int baudrate = atoi(optarg); + + if (validate_baudrate(baudrate, &termios_baudrate)) { + BRCM_encode_baud_rate(baudrate, &hci_update_baud_rate[6]); + } + + return(0); +} + +int +parse_bdaddr(char *optarg) +{ + int bd_addr[6]; + int i; + + sscanf(optarg, "%02X:%02X:%02X:%02X:%02X:%02X", + &bd_addr[5], &bd_addr[4], &bd_addr[3], + &bd_addr[2], &bd_addr[1], &bd_addr[0]); + + for (i = 0; i < 6; i++) { + hci_write_bd_addr[4 + i] = bd_addr[i]; + } + + bdaddr_flag = 1; + + return(0); +} + +int +readApName(char *name, int len) +{ + FILE* devInfo = NULL; + + if(len < AP_NAME_SUFFIX_LEN) { + return -1; + } + + devInfo = fopen("/data/cfg/device_info.txt","rb+"); + if(devInfo) { + fseek(devInfo, 36, SEEK_SET); + fread(name, 1, AP_NAME_SUFFIX_LEN, devInfo); + fclose(devInfo); + // is default value or not + if(0 == strncmp(name, "11:22:33:44:55:66", 17)) { + return -1; + } + } else { + return -1; + } + + return 0; +} + +int +writeApName(const char* name, int len) +{ + FILE* devInfo = NULL; + char nameBuf[AP_NAME_SUFFIX_LEN] = {0}; + + if(len < 17) { + return; + } + + if(0 != strncmp(name, "11:22:33:44:55", 17)) { + devInfo = fopen("/data/cfg/device_info.txt","rb+"); + if(devInfo) { + fseek(devInfo, 36, SEEK_SET); + snprintf(nameBuf, AP_NAME_SUFFIX_LEN, "%s", name); + fwrite(nameBuf, 1, AP_NAME_SUFFIX_LEN, devInfo); + fflush(devInfo); + fsync(fileno(devInfo)); + fclose(devInfo); + } + system("cp /data/cfg/device_info.txt /data/cfg/device_info"); + } +} + +int +parse_bdaddr_rand(char *optarg) +{ + int bd_addr[6]; + int i,j; + char optargtest[18]; + + char mh[]=":"; + char metachar[]="ABCDEF0123456789"; + if(0 != readApName(optargtest,AP_NAME_SUFFIX_LEN)){ + srand(time(NULL)); + for(j=0;j<17;j++){ + if(j%3 == 2){ + optargtest[j]= mh[0]; + }else{ + optargtest[j] = metachar[rand()%16]; + } + } + optargtest[17]="\0"; + + writeApName(optargtest,AP_NAME_SUFFIX_LEN); + } + + sscanf(optargtest, "%02X:%02X:%02X:%02X:%02X:%02X", + &bd_addr[5], &bd_addr[4], &bd_addr[3], + &bd_addr[2], &bd_addr[1], &bd_addr[0]); + + for (i = 0; i < 6; i++) { + hci_write_bd_addr[4 + i] = bd_addr[i]; + } + + bdaddr_flag = 1; + + return(0); +} + +int +parse_enable_lpm(char *optarg) +{ + enable_lpm = 1; + return(0); +} + +int +parse_use_baudrate_for_download(char *optarg) +{ + use_baudrate_for_download = 1; + return(0); +} + +int +parse_enable_hci(char *optarg) +{ + enable_hci = 1; + return(0); +} + +int +parse_scopcm(char *optarg) +{ + int param[10]; + int ret; + int i; + + ret = sscanf(optarg, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", + ¶m[0], ¶m[1], ¶m[2], ¶m[3], ¶m[4], + ¶m[5], ¶m[6], ¶m[7], ¶m[8], ¶m[9]); + + if (ret != 10) { + return(1); + } + + scopcm = 1; + + for (i = 0; i < 5; i++) { + hci_write_sco_pcm_int[4 + i] = param[i]; + } + + for (i = 0; i < 5; i++) { + hci_write_pcm_data_format[4 + i] = param[5 + i]; + } + + return(0); +} + +int +parse_i2s(char *optarg) +{ + int param[4]; + int ret; + int i; + + ret = sscanf(optarg, "%d,%d,%d,%d", ¶m[0], ¶m[1], ¶m[2], + ¶m[3]); + + if (ret != 4) { + return(1); + } + + i2s = 1; + + for (i = 0; i < 4; i++) { + hci_write_i2spcm_interface_param[4 + i] = param[i]; + } + + return(0); +} + +int +parse_no2bytes(char *optarg) +{ + no2bytes = 1; + return(0); +} + +int +parse_tosleep(char *optarg) +{ + tosleep = atoi(optarg); + + if (tosleep <= 0) { + return(1); + } + + return(0); +} + +void +usage(char *argv0) +{ + printf("Usage %s:\n", argv0); + printf("\t<-d> to print a debug log\n"); + printf("\t<--patchram patchram_file>\n"); + printf("\t<--baudrate baud_rate>\n"); + printf("\t<--bd_addr bd_address>\n"); + printf("\t<--enable_lpm>\n"); + printf("\t<--enable_hci>\n"); + printf("\t<--use_baudrate_for_download> - Uses the\n"); + printf("\t\tbaudrate for downloading the firmware\n"); + printf("\t<--scopcm=sco_routing,pcm_interface_rate,frame_type,\n"); + printf("\t\tsync_mode,clock_mode,lsb_first,fill_bits,\n"); + printf("\t\tfill_method,fill_num,right_justify>\n"); + printf("\n\t\tWhere\n"); + printf("\n\t\tsco_routing is 0 for PCM, 1 for Transport,\n"); + printf("\t\t2 for Codec and 3 for I2S,\n"); + printf("\n\t\tpcm_interface_rate is 0 for 128KBps, 1 for\n"); + printf("\t\t256 KBps, 2 for 512KBps, 3 for 1024KBps,\n"); + printf("\t\tand 4 for 2048Kbps,\n"); + printf("\n\t\tframe_type is 0 for short and 1 for long,\n"); + printf("\t\tsync_mode is 0 for slave and 1 for master,\n"); + printf("\n\t\tclock_mode is 0 for slabe and 1 for master,\n"); + printf("\n\t\tlsb_first is 0 for false aand 1 for true,\n"); + printf("\n\t\tfill_bits is the value in decimal for unused bits,\n"); + printf("\n\t\tfill_method is 0 for 0's and 1 for 1's, 2 for\n"); + printf("\t\tsigned and 3 for programmable,\n"); + printf("\n\t\tfill_num is the number or bits to fill,\n"); + printf("\n\t\tright_justify is 0 for false and 1 for true\n"); + printf("\n\t<--i2s=i2s_enable,is_master,sample_rate,clock_rate>\n"); + printf("\n\t\tWhere\n"); + printf("\n\t\ti2s_enable is 0 for disable and 1 for enable,\n"); + printf("\n\t\tis_master is 0 for slave and 1 for master,\n"); + printf("\n\t\tsample_rate is 0 for 8KHz, 1 for 16Khz and\n"); + printf("\t\t2 for 4 KHz,\n"); + printf("\n\t\tclock_rate is 0 for 128KHz, 1 for 256KHz, 3 for\n"); + printf("\t\t1024 KHz and 4 for 2048 KHz.\n\n"); + printf("\t<--no2bytes skips waiting for two byte confirmation\n"); + printf("\t\tbefore starting patchram download. Newer chips\n"); + printf("\t\tdo not generate these two bytes.>\n"); + printf("\t<--tosleep=microseconds>\n"); + printf("\tuart_device_name\n"); +} + +int +parse_cmd_line(int argc, char **argv) +{ + int c; + int ret = 0; + + typedef int (*PFI)(); + + PFI parse[] = { parse_patchram, parse_baudrate, + parse_bdaddr,parse_bdaddr_rand, parse_enable_lpm, parse_enable_hci, + parse_use_baudrate_for_download, + parse_scopcm, parse_i2s, parse_no2bytes, parse_tosleep}; + + while (1) { + int this_option_optind = optind ? optind : 1; + int option_index = 0; + + static struct option long_options[] = { + {"patchram", 1, 0, 0}, + {"baudrate", 1, 0, 0}, + {"bd_addr", 1, 0, 0}, + {"bd_addr_rand", 0, 0, 0}, + {"enable_lpm", 0, 0, 0}, + {"enable_hci", 0, 0, 0}, + {"use_baudrate_for_download", 0, 0, 0}, + {"scopcm", 1, 0, 0}, + {"i2s", 1, 0, 0}, + {"no2bytes", 0, 0, 0}, + {"tosleep", 1, 0, 0}, + {0, 0, 0, 0} + }; + + c = getopt_long_only (argc, argv, "d", long_options, + &option_index); + + if (c == -1) { + break; + } + + switch (c) { + case 0: + if (debug) { + printf ("option %s", + long_options[option_index].name); + if (optarg) + printf (" with arg %s", optarg); + printf ("\n"); + } + + ret = (*parse[option_index])(optarg); + + break; + case 'd': + debug = 1; + break; + + case '?': + //nobreak + default: + usage(argv[0]); + break; + } + + if (ret) { + usage(argv[0]); + break; + } + } + + if (ret) { + return(1); + } + + if (optind < argc) { + if (debug) + printf ("%s \n", argv[optind]); + if ((uart_fd = open(argv[optind], O_RDWR | O_NOCTTY)) == -1) { + fprintf(stderr, "port %s could not be opened, error %d\n", + argv[2], errno); + } + } + + return(0); +} + +void +init_uart() +{ + tcflush(uart_fd, TCIOFLUSH); + tcgetattr(uart_fd, &termios); + +#ifndef __CYGWIN__ + cfmakeraw(&termios); +#else + termios.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP + | INLCR | IGNCR | ICRNL | IXON); + termios.c_oflag &= ~OPOST; + termios.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); + termios.c_cflag &= ~(CSIZE | PARENB); + termios.c_cflag |= CS8; +#endif + + termios.c_cflag |= CRTSCTS; + tcsetattr(uart_fd, TCSANOW, &termios); + tcflush(uart_fd, TCIOFLUSH); + tcsetattr(uart_fd, TCSANOW, &termios); + tcflush(uart_fd, TCIOFLUSH); + tcflush(uart_fd, TCIOFLUSH); + cfsetospeed(&termios, B115200); + cfsetispeed(&termios, B115200); + tcsetattr(uart_fd, TCSANOW, &termios); +} + +void +dump(uchar *out, int len) +{ + int i; + + for (i = 0; i < len; i++) { + if (i && !(i % 16)) { + fprintf(stderr, "\n"); + } + + fprintf(stderr, "%02x ", out[i]); + } + + fprintf(stderr, "\n"); +} + +void +read_event(int fd, uchar *buffer) +{ + int i = 0; + int len = 3; + int count; + + while ((count = read(fd, &buffer[i], len)) < len) { + i += count; + len -= count; + //fprintf(stderr, "received11 %d\n", count); + } + + i += count; + len = buffer[2]; + //fprintf(stderr, "received22 %d\n", count); + + while ((count = read(fd, &buffer[i], len)) < len) { + i += count; + len -= count; + } + //fprintf(stderr, "received33 %d\n", count); + + if (debug) { + count += i; + + fprintf(stderr, "received %d\n", count); + dump(buffer, count); + } +} + +void +hci_send_cmd(uchar *buf, int len) +{ + if (debug) { + fprintf(stderr, "writing\n"); + dump(buf, len); + } + + write(uart_fd, buf, len); +} + +void +expired(int sig) +{ + hci_send_cmd(hci_reset, sizeof(hci_reset)); + alarm(4); +} + +void +proc_reset() +{ + signal(SIGALRM, expired); + + fprintf(stderr, "proc_reset"); + + hci_send_cmd(hci_reset, sizeof(hci_reset)); + + alarm(4); + + read_event(uart_fd, buffer); + + alarm(0); +} + +void +proc_patchram() +{ + int len; + + hci_send_cmd(hci_download_minidriver, sizeof(hci_download_minidriver)); + + fprintf(stderr, "send hci_download_minidriver"); + + read_event(uart_fd, buffer); + + if (!no2bytes) { + read(uart_fd, &buffer[0], 2); + } + + if (tosleep) { + usleep(tosleep); + } + + while (read(hcdfile_fd, &buffer[1], 3)) { + buffer[0] = 0x01; + + len = buffer[3]; + + read(hcdfile_fd, &buffer[4], len); + + hci_send_cmd(buffer, len + 4); + + read_event(uart_fd, buffer); + } + usleep(200000); + + if (use_baudrate_for_download) { + cfsetospeed(&termios, B115200); + cfsetispeed(&termios, B115200); + tcsetattr(uart_fd, TCSANOW, &termios); + } + proc_reset(); +} + +void +proc_baudrate() +{ + hci_send_cmd(hci_update_baud_rate, sizeof(hci_update_baud_rate)); + + read_event(uart_fd, buffer); + + usleep(200000); + + cfsetospeed(&termios, termios_baudrate); + cfsetispeed(&termios, termios_baudrate); + tcsetattr(uart_fd, TCSANOW, &termios); + + if (debug) { + fprintf(stderr, "Done setting baudrate\n"); + } +} + +void +proc_bdaddr() +{ + hci_send_cmd(hci_write_bd_addr, sizeof(hci_write_bd_addr)); + + read_event(uart_fd, buffer); +} + +void +proc_enable_lpm() +{ + hci_send_cmd(hci_write_sleep_mode, sizeof(hci_write_sleep_mode)); + + read_event(uart_fd, buffer); +} + +void +proc_scopcm() +{ + hci_send_cmd(hci_write_sco_pcm_int, + sizeof(hci_write_sco_pcm_int)); + + read_event(uart_fd, buffer); + + hci_send_cmd(hci_write_pcm_data_format, + sizeof(hci_write_pcm_data_format)); + + read_event(uart_fd, buffer); +} + +void +proc_i2s() +{ + hci_send_cmd(hci_write_i2spcm_interface_param, + sizeof(hci_write_i2spcm_interface_param)); + + read_event(uart_fd, buffer); +} + +void +proc_enable_hci() +{ + int i = N_HCI; + int proto = HCI_UART_H4; + if (ioctl(uart_fd, TIOCSETD, &i) < 0) { + fprintf(stderr, "Can't set line discipline\n"); + return; + } + + if (ioctl(uart_fd, HCIUARTSETPROTO, proto) < 0) { + fprintf(stderr, "Can't set hci protocol\n"); + return; + } + fprintf(stderr, "Done setting line discpline\n"); + return; +} + +#ifdef ANDROID +void +read_default_bdaddr() +{ + int sz; + int fd; + + char path[PROPERTY_VALUE_MAX]; + + char bdaddr[18]; + int len = 17; + memset(bdaddr, 0, (len + 1) * sizeof(char)); + + property_get("ro.bt.bdaddr_path", path, ""); + if (path[0] == 0) + return; + + fd = open(path, O_RDONLY); + if (fd < 0) { + fprintf(stderr, "open(%s) failed: %s (%d)", path, strerror(errno), + errno); + return; + } + + sz = read(fd, bdaddr, len); + if (sz < 0) { + fprintf(stderr, "read(%s) failed: %s (%d)", path, strerror(errno), + errno); + close(fd); + return; + } else if (sz != len) { + fprintf(stderr, "read(%s) unexpected size %d", path, sz); + close(fd); + return; + } + + if (debug) { + printf("Read default bdaddr of %s\n", bdaddr); + } + + parse_bdaddr(bdaddr); +} +#endif + + +int +main (int argc, char **argv) +{ +#ifdef ANDROID + read_default_bdaddr(); +#endif + + if (parse_cmd_line(argc, argv)) { + exit(1); + } + + if (uart_fd < 0) { + exit(2); + } + + init_uart(); + + proc_reset(); + + if (use_baudrate_for_download) { + if (termios_baudrate) { + proc_baudrate(); + } + } + + if (hcdfile_fd > 0) { + proc_patchram(); + } + + if (termios_baudrate) { + proc_baudrate(); + } + + if (bdaddr_flag) { + proc_bdaddr(); + } + + if (enable_lpm) { + proc_enable_lpm(); + } + + if (scopcm) { + proc_scopcm(); + } + + if (i2s) { + proc_i2s(); + } + + if (enable_hci) { + proc_enable_hci(); + + while (1) { + sleep(UINT_MAX); + } + } + + exit(0); +} diff --git a/bsp/meta-rockchip/recipes-devtools/brcm-tools/files/dhd_priv.c b/bsp/meta-rockchip/recipes-devtools/brcm-tools/files/dhd_priv.c new file mode 100644 index 0000000000000000000000000000000000000000..053a3f29a807907e9c411ffa44c818663abefacd --- /dev/null +++ b/bsp/meta-rockchip/recipes-devtools/brcm-tools/files/dhd_priv.c @@ -0,0 +1,92 @@ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define VERSION "1.2" + +#define TAG "dhd_priv: " +#if defined(ANDROID) +#include +#include +#include +#include +#include "cutils/misc.h" +#include "cutils/log.h" +#define DHD_PRINTF(...) {__android_log_print(ANDROID_LOG_DEBUG,TAG ,__VA_ARGS__); printf(__VA_ARGS__);} +#else +#define DHD_PRINTF printf +#endif + +typedef struct dhd_priv_cmd { + char *buf; + int used_len; + int total_len; +} dhd_priv_cmd; + +/* +terence 20161127 +*/ + +int +main(int argc, char **argv) +{ + struct ifreq ifr; + dhd_priv_cmd priv_cmd; + int ret = 0; + int ioctl_sock; /* socket for ioctl() use */ + char buf[500]=""; + int i=0; + + DHD_PRINTF(TAG "Version = %s\n", VERSION); + + DHD_PRINTF("argv: "); + while (argv[i]) { + DHD_PRINTF("%s ", argv[i]); + i++; + } + DHD_PRINTF("\n"); + + if (!argv[1]) { + DHD_PRINTF("Please input right cmd\n"); + return 0; + } + + while (*++argv) { + strcat(buf, *argv); + if (*(argv+1)) + strcat(buf, " "); + } + + ioctl_sock = socket(PF_INET, SOCK_DGRAM, 0); + if (ioctl_sock < 0) { + DHD_PRINTF(TAG "socket(PF_INET,SOCK_DGRAM)\n"); + return -1; + } + + memset(&ifr, 0, sizeof(ifr)); + memset(&priv_cmd, 0, sizeof(priv_cmd)); + strncpy(ifr.ifr_name, "wlan0", sizeof(ifr.ifr_name)); + + priv_cmd.buf = buf; + priv_cmd.used_len = 500; + priv_cmd.total_len = 500; + ifr.ifr_data = &priv_cmd; + + if ((ret = ioctl(ioctl_sock, SIOCDEVPRIVATE + 1, &ifr)) < 0) { + DHD_PRINTF(TAG "failed to issue private commands %d\n", ret); + } else { + DHD_PRINTF(TAG "buf = %s, len = %d, ret = %d\n", buf, strlen(buf), ret); + } + + close(ioctl_sock); + return ret; +} + diff --git a/bsp/meta-rockchip/recipes-devtools/io/files/io.c b/bsp/meta-rockchip/recipes-devtools/io/files/io.c new file mode 100644 index 0000000000000000000000000000000000000000..25687455b4c92ccaba9c729a7fe9c960470dd303 --- /dev/null +++ b/bsp/meta-rockchip/recipes-devtools/io/files/io.c @@ -0,0 +1,353 @@ +/* + * Simple app. to do memory accesses via /dev/mem. + * + * $Id: io.c,v 1.5 2000/08/21 09:01:57 richard Exp $ + * + * Copyright (c) Richard Hirst + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef FALSE +#define FALSE 0 +#define TRUE (!FALSE) +#endif + +#ifdef MMAP64 +#define mmap mmap64 +#endif + +static char *argv0; + +static void +usage (void) +{ + fprintf(stderr, +"Raw memory i/o utility - $Revision: 1.5 $\n\n" +"%s -v -1|2|4 -r|w [-l ] [-f ] []\n\n" +" -v Verbose, asks for confirmation\n" +" -1|2|4 Sets memory access size in bytes (default byte)\n" +" -l Length in bytes of area to access (defaults to\n" +" one access, or whole file length)\n" +" -r|w Read from or Write to memory (default read)\n" +" -f File to write on memory read, or\n" +" to read on memory write\n" +" The memory address to access\n" +" The value to write (implies -w)\n\n" +"Examples:\n" +" %s 0x1000 Reads one byte from 0x1000\n" +" %s 0x1000 0x12 Writes 0x12 to location 0x1000\n" +" %s -2 -l 8 0x1000 Reads 8 words from 0x1000\n" +" %s -r -f dmp -l 100 200 Reads 100 bytes from addr 200 to file\n" +" %s -w -f img 0x10000 Writes the whole of file to memory\n" +"\n" +"Note access size (-1|2|4) does not apply to file based accesses.\n\n", + argv0, argv0, argv0, argv0, argv0, argv0); + exit(1); +} + + +static void +memread_memory(unsigned long phys_addr, uint8_t *addr, int len, int iosize) +{ + int i; + + while (len) { + printf("%08lx: ", phys_addr); + i = 0; + while (i < 16 && len) { + switch(iosize) { + case 1: + printf(" %02x", *(uint8_t *)addr); + break; + case 2: + printf(" %04x", *(uint16_t *)addr); + break; + case 4: + printf(" %08x", *(uint32_t *)addr); + break; + } + i += iosize; + addr += iosize; + len -= iosize; + } + phys_addr += 16; + printf("\n"); + } +} + + +static void +write_memory(uint8_t *addr, int len, int iosize, unsigned long value) +{ + switch(iosize) { + case 1: + while (len) { + *(uint8_t *)addr = value; + len -= iosize; + addr += iosize; + } + break; + case 2: + while (len) { + *(uint16_t *)addr = value; + len -= iosize; + addr += iosize; + } + break; + case 4: + while (len) { + *(uint32_t *)addr = value; + len -= iosize; + addr += iosize; + } + break; + } +} + + +int +main (int argc, char **argv) +{ + int mfd, ffd = 0, req_len = 0, opt; + uint8_t *real_io; + unsigned long real_len, real_addr, req_addr, req_value = 0, offset; + char *endptr; + int memread = TRUE; + int iosize = 1; + char *filename = NULL; + int verbose = 0; + + argv0 = argv[0]; + opterr = 0; + if (argc == 1) + usage(); + + while ((opt = getopt(argc, argv, "hv124rwl:f:")) > 0) { + switch (opt) { + case 'h': + usage(); + case 'v': + verbose = 1; + break; + case '1': + case '2': + case '4': + iosize = opt - '0'; + break; + case 'r': + memread = TRUE; + break; + case 'w': + memread = FALSE; + break; + case 'l': + req_len = strtoul(optarg, &endptr, 0); + if (*endptr) { + fprintf(stderr, "Bad value '%s'\n", optarg); + exit(1); + } + break; + case 'f': + filename = strdup(optarg); + break; + default: + fprintf(stderr, "Unknown option: %c\n", opt); + usage(); + } + } + + if (optind == argc) { + fprintf(stderr, "No address given\n"); + exit(1); + } + req_addr = strtoul(argv[optind], &endptr, 0); + if (*endptr) { + fprintf(stderr, "Bad value '%s'\n", argv[optind]); + exit(1); + } + optind++; + if (!filename && optind < argc) + memread = FALSE; + if (filename && optind > argc) { + fprintf(stderr, "Filename AND value given\n"); + exit(1); + } + if (!filename && !memread && optind == argc) { + fprintf(stderr, "No value given for WRITE\n"); + exit(1); + } + if (!filename && !memread) { + req_value = strtoul(argv[optind], &endptr, 0); + if (*endptr) { + fprintf(stderr, "Bad value '%s'\n", argv[optind]); + exit(1); + } + if ((iosize == 1 && (req_value & 0xffffff00)) || + (iosize == 2 && (req_value & 0xffff0000))) { + fprintf(stderr, " too large\n"); + exit(1); + } + optind++; + } + if (filename && memread && !req_len) { + fprintf(stderr, "No size given for file memread\n"); + exit(1); + } + if (optind < argc) { + fprintf(stderr, "Too many arguments '%s'...\n", argv[optind]); + exit(1); + } + if (filename && memread) { + ffd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); + if (ffd < 0) { + fprintf(stderr, "Failed to open destination file '%s': %s\n", filename, strerror(errno)); + exit(1); + } + } + if (filename && !memread) { + ffd = open(filename, O_RDONLY); + if (ffd < 0) { + fprintf(stderr, "Failed to open source file '%s': %s\n", filename, strerror(errno)); + exit(1); + } + } + + if (filename && !req_len) { + req_len = lseek(ffd, 0, SEEK_END); + if (req_len < 0) { + fprintf(stderr, "Failed to seek on '%s': %s\n", + filename, strerror(errno)); + exit(1); + } + if (lseek(ffd, 0, SEEK_SET)) { + fprintf(stderr, "Failed to seek on '%s': %s\n", + filename, strerror(errno)); + exit(1); + } + } + if (!req_len) + req_len = iosize; + + if ((iosize == 2 && (req_addr & 1)) || + (iosize == 4 && (req_addr & 3))) { + fprintf(stderr, "Badly aligned for access size\n"); + exit(1); + } + if ((iosize == 2 && (req_len & 1)) || + (iosize == 4 && (req_len & 3))) { + fprintf(stderr, "Badly aligned for access size\n"); + exit(1); + } + + if (!verbose) + /* Nothing */; + else if (filename && memread) + printf("Request to memread 0x%x bytes from address 0x%08lx\n" + "\tto file %s, using %d byte accesses\n", + req_len, req_addr, filename, iosize); + else if (filename) + printf("Request to write 0x%x bytes to address 0x%08lx\n" + "\tfrom file %s, using %d byte accesses\n", + req_len, req_addr, filename, iosize); + else if (memread) + printf("Request to memread 0x%x bytes from address 0x%08lx\n" + "\tusing %d byte accesses\n", + req_len, req_addr, iosize); + else + printf("Request to write 0x%x bytes to address 0x%08lx\n" + "\tusing %d byte accesses of value 0x%0*lx\n", + req_len, req_addr, iosize, iosize*2, req_value); + + real_addr = req_addr & ~4095; + if (real_addr == 0xfffff000) { + fprintf(stderr, "Sorry, cannot map the top 4K page\n"); + exit(1); + } + offset = req_addr - real_addr; + real_len = req_len + offset; + real_len = (real_len + 4095) & ~ 4095; + if (real_addr + real_len < real_addr) { + fprintf(stderr, "Aligned addr+len exceeds top of address space\n"); + exit(1); + } + if (verbose) + printf("Attempting to map 0x%lx bytes at address 0x%08lx\n", + real_len, real_addr); + + mfd = open("/dev/mem", (memread ? O_RDONLY : O_RDWR) | O_SYNC); + if (mfd == -1) { + perror("open /dev/mem"); + exit(1); + } + if (verbose) + printf("open(/dev/mem) ok\n"); + real_io = mmap(NULL, real_len, + memread ? PROT_READ:PROT_WRITE, + MAP_SHARED, mfd, real_addr); + if (real_io == (void *)(-1)) { + fprintf(stderr, "mmap() failed: %s\n", strerror(errno)); + exit(1); + } + if (verbose) + printf("mmap() ok\n"); + + if (verbose) { + int c; + + printf("OK? "); + fflush(stdout); + c = getchar(); + if (c != 'y' && c != 'Y') { + printf("Aborted\n"); + exit(1); + } + } + + if (filename && memread) { + int n = write(ffd, real_io + offset, req_len); + + if (n < 0) { + fprintf(stderr, "File write failed: %s\n", strerror(errno)); + exit(1); + } + else if (n != req_len) { + fprintf(stderr, "Only wrote %d of %d bytes to file\n", + n, req_len); + exit(1); + } + } + else if (filename) { + int n = read(ffd, real_io + offset, req_len); + + if (n < 0) { + fprintf(stderr, "File read failed: %s\n", strerror(errno)); + exit(1); + } + else if (n != req_len) { + fprintf(stderr, "Only read %d of %d bytes from file\n", + n, req_len); + exit(1); + } + } + else if (memread) + memread_memory(req_addr, real_io + offset, req_len, iosize); + else + write_memory(real_io + offset, req_len, iosize, req_value); + + if (filename) + close(ffd); + close (mfd); + + return 0; +} + diff --git a/bsp/meta-rockchip/recipes-devtools/io/io.bb b/bsp/meta-rockchip/recipes-devtools/io/io.bb new file mode 100644 index 0000000000000000000000000000000000000000..75ec8a2addd247631aa200969d31c466a74ddbe1 --- /dev/null +++ b/bsp/meta-rockchip/recipes-devtools/io/io.bb @@ -0,0 +1,20 @@ +# Copyright (c) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +DESCRIPTION = "Memory accesses tool" +SECTION = "devel" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +SRC_URI = "file://io.c" + +S = "${WORKDIR}" + +do_compile() { + ${CC} ${CFLAGS} ${LDFLAGS} io.c -o io +} + +do_install() { + install -d ${D}${bindir} + install -m 0755 io ${D}${bindir} +} diff --git a/bsp/meta-rockchip/recipes-devtools/rtl-tools/files/Makefile b/bsp/meta-rockchip/recipes-devtools/rtl-tools/files/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..e128b49e8e9daad5c5828e314cd5184dffb5f339 --- /dev/null +++ b/bsp/meta-rockchip/recipes-devtools/rtl-tools/files/Makefile @@ -0,0 +1,19 @@ +CC ?= $(CROSS_COMPILE)gcc + +all: rtk_hciattach + +rtk_hciattach: hciattach.c hciattach_rtk.o + $(CC) -o rtk_hciattach hciattach.c hciattach_rtk.o $(CFLAGS) $(LDFLAGS) + +hciattach_rtk.o:hciattach_rtk.c + $(CC) -c hciattach_rtk.c $(CFLAGS) $(LDFLAGS) + +clean: + rm -f *.o rtk_hciattach tags cscope.* + +tags: FORCE + ctags -R + find ./ -name "*.h" -o -name "*.c" -o -name "*.cc" -o -name "*.cpp" > cscope.files + cscope -bkq -i cscope.files +PHONY += FORCE +FORCE: diff --git a/bsp/meta-rockchip/recipes-devtools/rtl-tools/files/hciattach.c b/bsp/meta-rockchip/recipes-devtools/rtl-tools/files/hciattach.c new file mode 100644 index 0000000000000000000000000000000000000000..32a63456dc198d465f9608e3eeae2e9167b296e0 --- /dev/null +++ b/bsp/meta-rockchip/recipes-devtools/rtl-tools/files/hciattach.c @@ -0,0 +1,1440 @@ +/* + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2000-2001 Qualcomm Incorporated + * Copyright (C) 2002-2003 Maxim Krasnyansky + * Copyright (C) 2002-2010 Marcel Holtmann + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "hciattach.h" + +#ifdef NEED_PPOLL +#include "ppoll.h" +#endif + +struct uart_t { + char *type; + int m_id; + int p_id; + int proto; + int init_speed; + int speed; + int flags; + int pm; + char *bdaddr; + int (*init) (int fd, struct uart_t *u, struct termios *ti); + int (*post) (int fd, struct uart_t *u, struct termios *ti); +}; + +#define FLOW_CTL 0x0001 +#define ENABLE_PM 1 +#define DISABLE_PM 0 + +static volatile sig_atomic_t __io_canceled = 0; + +static void sig_hup(int sig) +{ + printf("sig hup.\n"); +} + +static void sig_term(int sig) +{ + switch (sig) { + case SIGINT: + printf("sig int.\n"); + break; + case SIGTERM: + printf("sig term.\n"); + break; + } + __io_canceled = 1; +} + +static void sig_alarm(int sig) +{ + fprintf(stderr, "Initialization timed out.\n"); + exit(1); +} + +static int uart_speed(int s) +{ + switch (s) { + case 9600: + return B9600; + case 19200: + return B19200; + case 38400: + return B38400; + case 57600: + return B57600; + case 115200: + return B115200; + case 230400: + return B230400; + case 460800: + return B460800; + case 500000: + return B500000; + case 576000: + return B576000; + case 921600: + return B921600; + case 1000000: + return B1000000; + case 1152000: + return B1152000; + case 1500000: + return B1500000; + case 2000000: + return B2000000; +#ifdef B2500000 + case 2500000: + return B2500000; +#endif +#ifdef B3000000 + case 3000000: + return B3000000; +#endif +#ifdef B3500000 + case 3500000: + return B3500000; +#endif +#ifdef B4000000 + case 4000000: + return B4000000; +#endif + default: + return B57600; + } +} + +int set_speed(int fd, struct termios *ti, int speed) +{ + if (cfsetospeed(ti, uart_speed(speed)) < 0) + return -errno; + + if (cfsetispeed(ti, uart_speed(speed)) < 0) + return -errno; + + if (tcsetattr(fd, TCSANOW, ti) < 0) + return -errno; + + return 0; +} + +/* + * Read an HCI event from the given file descriptor. + */ +int read_hci_event(int fd, unsigned char* buf, int size) +{ + int remain, r; + int count = 0; + + if (size <= 0) + return -1; + + /* The first byte identifies the packet type. For HCI event packets, it + * should be 0x04, so we read until we get to the 0x04. */ + while (1) { + r = read(fd, buf, 1); + if (r <= 0) + return -1; + if (buf[0] == 0x04) + break; + } + count++; + + /* The next two bytes are the event code and parameter total length. */ + while (count < 3) { + r = read(fd, buf + count, 3 - count); + if (r <= 0) + return -1; + count += r; + } + + /* Now we read the parameters. */ + if (buf[2] < (size - 3)) + remain = buf[2]; + else + remain = size - 3; + + while ((count - 3) < remain) { + r = read(fd, buf + count, remain - (count - 3)); + if (r <= 0) + return -1; + count += r; + } + + return count; +} + +#if 0 +/* + * Ericsson specific initialization + */ +static int ericsson(int fd, struct uart_t *u, struct termios *ti) +{ + struct timespec tm = {0, 50000}; + char cmd[5]; + + cmd[0] = HCI_COMMAND_PKT; + cmd[1] = 0x09; + cmd[2] = 0xfc; + cmd[3] = 0x01; + + switch (u->speed) { + case 57600: + cmd[4] = 0x03; + break; + case 115200: + cmd[4] = 0x02; + break; + case 230400: + cmd[4] = 0x01; + break; + case 460800: + cmd[4] = 0x00; + break; + case 921600: + cmd[4] = 0x20; + break; + case 2000000: + cmd[4] = 0x25; + break; + case 3000000: + cmd[4] = 0x27; + break; + case 4000000: + cmd[4] = 0x2B; + break; + default: + cmd[4] = 0x03; + u->speed = 57600; + fprintf(stderr, "Invalid speed requested, using %d bps instead\n", u->speed); + break; + } + + /* Send initialization command */ + if (write(fd, cmd, 5) != 5) { + perror("Failed to write init command"); + return -1; + } + + nanosleep(&tm, NULL); + return 0; +} + +/* + * Digianswer specific initialization + */ +static int digi(int fd, struct uart_t *u, struct termios *ti) +{ + struct timespec tm = {0, 50000}; + char cmd[5]; + + /* DigiAnswer set baud rate command */ + cmd[0] = HCI_COMMAND_PKT; + cmd[1] = 0x07; + cmd[2] = 0xfc; + cmd[3] = 0x01; + + switch (u->speed) { + case 57600: + cmd[4] = 0x08; + break; + case 115200: + cmd[4] = 0x09; + break; + default: + cmd[4] = 0x09; + u->speed = 115200; + break; + } + + /* Send initialization command */ + if (write(fd, cmd, 5) != 5) { + perror("Failed to write init command"); + return -1; + } + + nanosleep(&tm, NULL); + return 0; +} + +static int texas(int fd, struct uart_t *u, struct termios *ti) +{ + return texas_init(fd, ti); +} + +static int texas2(int fd, struct uart_t *u, struct termios *ti) +{ + return texas_post(fd, ti); +} + +static int texasalt(int fd, struct uart_t *u, struct termios *ti) +{ + return texasalt_init(fd, u->speed, ti); +} +#endif + + + +static int read_check(int fd, void *buf, int count) +{ + int res; + + do { + res = read(fd, buf, count); + if (res != -1) { + buf += res; + count -= res; + } + } while (count && (errno == 0 || errno == EINTR)); + + if (count) + return -1; + + return 0; +} + +/* + * BCSP specific initialization + */ +static int serial_fd; +static int bcsp_max_retries = 10; + +static void bcsp_tshy_sig_alarm(int sig) +{ + unsigned char bcsp_sync_pkt[10] = {0xc0,0x00,0x41,0x00,0xbe,0xda,0xdc,0xed,0xed,0xc0}; + static int retries = 0; + + if (retries < bcsp_max_retries) { + retries++; + if (write(serial_fd, &bcsp_sync_pkt, 10) < 0) + return; + alarm(1); + return; + } + + tcflush(serial_fd, TCIOFLUSH); + fprintf(stderr, "BCSP initialization timed out\n"); + exit(1); +} + +static void bcsp_tconf_sig_alarm(int sig) +{ + unsigned char bcsp_conf_pkt[10] = {0xc0,0x00,0x41,0x00,0xbe,0xad,0xef,0xac,0xed,0xc0}; + static int retries = 0; + + if (retries < bcsp_max_retries){ + retries++; + if (write(serial_fd, &bcsp_conf_pkt, 10) < 0) + return; + alarm(1); + return; + } + + tcflush(serial_fd, TCIOFLUSH); + fprintf(stderr, "BCSP initialization timed out\n"); + exit(1); +} + +static int bcsp(int fd, struct uart_t *u, struct termios *ti) +{ + unsigned char byte, bcsph[4], bcspp[4], + bcsp_sync_resp_pkt[10] = {0xc0,0x00,0x41,0x00,0xbe,0xac,0xaf,0xef,0xee,0xc0}, + bcsp_conf_resp_pkt[10] = {0xc0,0x00,0x41,0x00,0xbe,0xde,0xad,0xd0,0xd0,0xc0}, + bcspsync[4] = {0xda, 0xdc, 0xed, 0xed}, + bcspsyncresp[4] = {0xac,0xaf,0xef,0xee}, + bcspconf[4] = {0xad,0xef,0xac,0xed}, + bcspconfresp[4] = {0xde,0xad,0xd0,0xd0}; + struct sigaction sa; + int len; + + if (set_speed(fd, ti, u->speed) < 0) { + perror("Can't set default baud rate"); + return -1; + } + + ti->c_cflag |= PARENB; + ti->c_cflag &= ~(PARODD); + + if (tcsetattr(fd, TCSANOW, ti) < 0) { + perror("Can't set port settings"); + return -1; + } + + alarm(0); + + serial_fd = fd; + memset(&sa, 0, sizeof(sa)); + sa.sa_flags = SA_NOCLDSTOP; + sa.sa_handler = bcsp_tshy_sig_alarm; + sigaction(SIGALRM, &sa, NULL); + + /* State = shy */ + + bcsp_tshy_sig_alarm(0); + while (1) { + do { + if (read_check(fd, &byte, 1) == -1){ + perror("Failed to read"); + return -1; + } + } while (byte != 0xC0); + + do { + if ( read_check(fd, &bcsph[0], 1) == -1){ + perror("Failed to read"); + return -1; + } + } while (bcsph[0] == 0xC0); + + if ( read_check(fd, &bcsph[1], 3) == -1){ + perror("Failed to read"); + return -1; + } + + if (((bcsph[0] + bcsph[1] + bcsph[2]) & 0xFF) != (unsigned char)~bcsph[3]) + continue; + if (bcsph[1] != 0x41 || bcsph[2] != 0x00) + continue; + + if (read_check(fd, &bcspp, 4) == -1){ + perror("Failed to read"); + return -1; + } + + if (!memcmp(bcspp, bcspsync, 4)) { + if (write(fd, &bcsp_sync_resp_pkt,10) < 0) + return -1; + } else if (!memcmp(bcspp, bcspsyncresp, 4)) + break; + } + + /* State = curious */ + + alarm(0); + sa.sa_handler = bcsp_tconf_sig_alarm; + sigaction(SIGALRM, &sa, NULL); + alarm(1); + + while (1) { + do { + if (read_check(fd, &byte, 1) == -1){ + perror("Failed to read"); + return -1; + } + } while (byte != 0xC0); + + do { + if (read_check(fd, &bcsph[0], 1) == -1){ + perror("Failed to read"); + return -1; + } + } while (bcsph[0] == 0xC0); + + if (read_check(fd, &bcsph[1], 3) == -1){ + perror("Failed to read"); + return -1; + } + + if (((bcsph[0] + bcsph[1] + bcsph[2]) & 0xFF) != (unsigned char)~bcsph[3]) + continue; + + if (bcsph[1] != 0x41 || bcsph[2] != 0x00) + continue; + + if (read_check(fd, &bcspp, 4) == -1){ + perror("Failed to read"); + return -1; + } + + if (!memcmp(bcspp, bcspsync, 4)) + len = write(fd, &bcsp_sync_resp_pkt, 10); + else if (!memcmp(bcspp, bcspconf, 4)) + len = write(fd, &bcsp_conf_resp_pkt, 10); + else if (!memcmp(bcspp, bcspconfresp, 4)) + break; + else + continue; + + if (len < 0) + return -errno; + } + + /* State = garrulous */ + + return 0; +} + +#if 0 +/* + * CSR specific initialization + * Inspired strongly by code in OpenBT and experimentations with Brainboxes + * Pcmcia card. + * Jean Tourrilhes - 14.11.01 + */ +static int csr(int fd, struct uart_t *u, struct termios *ti) +{ + struct timespec tm = {0, 10000000}; /* 10ms - be generous */ + unsigned char cmd[30]; /* Command */ + unsigned char resp[30]; /* Response */ + int clen = 0; /* Command len */ + static int csr_seq = 0; /* Sequence number of command */ + int divisor; + + /* It seems that if we set the CSR UART speed straight away, it + * won't work, the CSR UART gets into a state where we can't talk + * to it anymore. + * On the other hand, doing a read before setting the CSR speed + * seems to be ok. + * Therefore, the strategy is to read the build ID (useful for + * debugging) and only then set the CSR UART speed. Doing like + * this is more complex but at least it works ;-) + * The CSR UART control may be slow to wake up or something because + * every time I read its speed, its bogus... + * Jean II */ + + /* Try to read the build ID of the CSR chip */ + clen = 5 + (5 + 6) * 2; + /* HCI header */ + cmd[0] = HCI_COMMAND_PKT; + cmd[1] = 0x00; /* CSR command */ + cmd[2] = 0xfc; /* MANUFACTURER_SPEC */ + cmd[3] = 1 + (5 + 6) * 2; /* len */ + /* CSR MSG header */ + cmd[4] = 0xC2; /* first+last+channel=BCC */ + /* CSR BCC header */ + cmd[5] = 0x00; /* type = GET-REQ */ + cmd[6] = 0x00; /* - msB */ + cmd[7] = 5 + 4; /* len */ + cmd[8] = 0x00; /* - msB */ + cmd[9] = csr_seq & 0xFF;/* seq num */ + cmd[10] = (csr_seq >> 8) & 0xFF; /* - msB */ + csr_seq++; + cmd[11] = 0x19; /* var_id = CSR_CMD_BUILD_ID */ + cmd[12] = 0x28; /* - msB */ + cmd[13] = 0x00; /* status = STATUS_OK */ + cmd[14] = 0x00; /* - msB */ + /* CSR BCC payload */ + memset(cmd + 15, 0, 6 * 2); + + /* Send command */ + do { + if (write(fd, cmd, clen) != clen) { + perror("Failed to write init command (GET_BUILD_ID)"); + return -1; + } + + /* Read reply. */ + if (read_hci_event(fd, resp, 100) < 0) { + perror("Failed to read init response (GET_BUILD_ID)"); + return -1; + } + + /* Event code 0xFF is for vendor-specific events, which is + * what we're looking for. */ + } while (resp[1] != 0xFF); + +#ifdef CSR_DEBUG + { + char temp[512]; + int i; + for (i=0; i < rlen; i++) + sprintf(temp + (i*3), "-%02X", resp[i]); + fprintf(stderr, "Reading CSR build ID %d [%s]\n", rlen, temp + 1); + // In theory, it should look like : + // 04-FF-13-FF-01-00-09-00-00-00-19-28-00-00-73-00-00-00-00-00-00-00 + } +#endif + /* Display that to user */ + fprintf(stderr, "CSR build ID 0x%02X-0x%02X\n", + resp[15] & 0xFF, resp[14] & 0xFF); + + /* Try to read the current speed of the CSR chip */ + clen = 5 + (5 + 4)*2; + /* -- HCI header */ + cmd[3] = 1 + (5 + 4)*2; /* len */ + /* -- CSR BCC header -- */ + cmd[9] = csr_seq & 0xFF; /* seq num */ + cmd[10] = (csr_seq >> 8) & 0xFF; /* - msB */ + csr_seq++; + cmd[11] = 0x02; /* var_id = CONFIG_UART */ + cmd[12] = 0x68; /* - msB */ + +#ifdef CSR_DEBUG + /* Send command */ + do { + if (write(fd, cmd, clen) != clen) { + perror("Failed to write init command (GET_BUILD_ID)"); + return -1; + } + + /* Read reply. */ + if (read_hci_event(fd, resp, 100) < 0) { + perror("Failed to read init response (GET_BUILD_ID)"); + return -1; + } + + /* Event code 0xFF is for vendor-specific events, which is + * what we're looking for. */ + } while (resp[1] != 0xFF); + + { + char temp[512]; + int i; + for (i=0; i < rlen; i++) + sprintf(temp + (i*3), "-%02X", resp[i]); + fprintf(stderr, "Reading CSR UART speed %d [%s]\n", rlen, temp+1); + } +#endif + + if (u->speed > 1500000) { + fprintf(stderr, "Speed %d too high. Remaining at %d baud\n", + u->speed, u->init_speed); + u->speed = u->init_speed; + } else if (u->speed != 57600 && uart_speed(u->speed) == B57600) { + /* Unknown speed. Why oh why can't we just pass an int to the kernel? */ + fprintf(stderr, "Speed %d unrecognised. Remaining at %d baud\n", + u->speed, u->init_speed); + u->speed = u->init_speed; + } + if (u->speed == u->init_speed) + return 0; + + /* Now, create the command that will set the UART speed */ + /* CSR BCC header */ + cmd[5] = 0x02; /* type = SET-REQ */ + cmd[6] = 0x00; /* - msB */ + cmd[9] = csr_seq & 0xFF; /* seq num */ + cmd[10] = (csr_seq >> 8) & 0xFF;/* - msB */ + csr_seq++; + + divisor = (u->speed*64+7812)/15625; + + /* No parity, one stop bit -> divisor |= 0x0000; */ + cmd[15] = (divisor) & 0xFF; /* divider */ + cmd[16] = (divisor >> 8) & 0xFF; /* - msB */ + /* The rest of the payload will be 0x00 */ + +#ifdef CSR_DEBUG + { + char temp[512]; + int i; + for(i = 0; i < clen; i++) + sprintf(temp + (i*3), "-%02X", cmd[i]); + fprintf(stderr, "Writing CSR UART speed %d [%s]\n", clen, temp + 1); + // In theory, it should look like : + // 01-00-FC-13-C2-02-00-09-00-03-00-02-68-00-00-BF-0E-00-00-00-00-00-00 + // 01-00-FC-13-C2-02-00-09-00-01-00-02-68-00-00-D8-01-00-00-00-00-00-00 + } +#endif + + /* Send the command to set the CSR UART speed */ + if (write(fd, cmd, clen) != clen) { + perror("Failed to write init command (SET_UART_SPEED)"); + return -1; + } + + nanosleep(&tm, NULL); + return 0; +} + +/* + * Silicon Wave specific initialization + * Thomas Moser + */ +static int swave(int fd, struct uart_t *u, struct termios *ti) +{ + struct timespec tm = { 0, 500000 }; + char cmd[10], rsp[100]; + int r; + + // Silicon Wave set baud rate command + // see HCI Vendor Specific Interface from Silicon Wave + // first send a "param access set" command to set the + // appropriate data fields in RAM. Then send a "HCI Reset + // Subcommand", e.g. "soft reset" to make the changes effective. + + cmd[0] = HCI_COMMAND_PKT; // it's a command packet + cmd[1] = 0x0B; // OCF 0x0B = param access set + cmd[2] = 0xfc; // OGF bx111111 = vendor specific + cmd[3] = 0x06; // 6 bytes of data following + cmd[4] = 0x01; // param sub command + cmd[5] = 0x11; // tag 17 = 0x11 = HCI Transport Params + cmd[6] = 0x03; // length of the parameter following + cmd[7] = 0x01; // HCI Transport flow control enable + cmd[8] = 0x01; // HCI Transport Type = UART + + switch (u->speed) { + case 19200: + cmd[9] = 0x03; + break; + case 38400: + cmd[9] = 0x02; + break; + case 57600: + cmd[9] = 0x01; + break; + case 115200: + cmd[9] = 0x00; + break; + default: + u->speed = 115200; + cmd[9] = 0x00; + break; + } + + /* Send initialization command */ + if (write(fd, cmd, 10) != 10) { + perror("Failed to write init command"); + return -1; + } + + // We should wait for a "GET Event" to confirm the success of + // the baud rate setting. Wait some time before reading. Better: + // read with timeout, parse data + // until correct answer, else error handling ... todo ... + + nanosleep(&tm, NULL); + + r = read(fd, rsp, sizeof(rsp)); + if (r > 0) { + // guess it's okay, but we should parse the reply. But since + // I don't react on an error anyway ... todo + // Response packet format: + // 04 Event + // FF Vendor specific + // 07 Parameter length + // 0B Subcommand + // 01 Setevent + // 11 Tag specifying HCI Transport Layer Parameter + // 03 length + // 01 flow on + // 01 Hci Transport type = Uart + // xx Baud rate set (see above) + } else { + // ups, got error. + return -1; + } + + // we probably got the reply. Now we must send the "soft reset" + // which is standard HCI RESET. + + cmd[0] = HCI_COMMAND_PKT; // it's a command packet + cmd[1] = 0x03; + cmd[2] = 0x0c; + cmd[3] = 0x00; + + /* Send reset command */ + if (write(fd, cmd, 4) != 4) { + perror("Can't write Silicon Wave reset cmd."); + return -1; + } + + nanosleep(&tm, NULL); + + // now the uart baud rate on the silicon wave module is set and effective. + // change our own baud rate as well. Then there is a reset event comming in + // on the *new* baud rate. This is *undocumented*! The packet looks like this: + // 04 FF 01 0B (which would make that a confirmation of 0x0B = "Param + // subcommand class". So: change to new baud rate, read with timeout, parse + // data, error handling. BTW: all param access in Silicon Wave is done this way. + // Maybe this code would belong in a seperate file, or at least code reuse... + + return 0; +} + +/* + * ST Microelectronics specific initialization + * Marcel Holtmann + */ +static int st(int fd, struct uart_t *u, struct termios *ti) +{ + struct timespec tm = {0, 50000}; + char cmd[5]; + + /* ST Microelectronics set baud rate command */ + cmd[0] = HCI_COMMAND_PKT; + cmd[1] = 0x46; // OCF = Hci_Cmd_ST_Set_Uart_Baud_Rate + cmd[2] = 0xfc; // OGF = Vendor specific + cmd[3] = 0x01; + + switch (u->speed) { + case 9600: + cmd[4] = 0x09; + break; + case 19200: + cmd[4] = 0x0b; + break; + case 38400: + cmd[4] = 0x0d; + break; + case 57600: + cmd[4] = 0x0e; + break; + case 115200: + cmd[4] = 0x10; + break; + case 230400: + cmd[4] = 0x12; + break; + case 460800: + cmd[4] = 0x13; + break; + case 921600: + cmd[4] = 0x14; + break; + default: + cmd[4] = 0x10; + u->speed = 115200; + break; + } + + /* Send initialization command */ + if (write(fd, cmd, 5) != 5) { + perror("Failed to write init command"); + return -1; + } + + nanosleep(&tm, NULL); + return 0; +} + +static int stlc2500(int fd, struct uart_t *u, struct termios *ti) +{ + bdaddr_t bdaddr; + unsigned char resp[10]; + int n; + int rvalue; + + /* STLC2500 has an ericsson core */ + rvalue = ericsson(fd, u, ti); + if (rvalue != 0) + return rvalue; + +#ifdef STLC2500_DEBUG + fprintf(stderr, "Setting speed\n"); +#endif + if (set_speed(fd, ti, u->speed) < 0) { + perror("Can't set baud rate"); + return -1; + } + +#ifdef STLC2500_DEBUG + fprintf(stderr, "Speed set...\n"); +#endif + + /* Read reply */ + if ((n = read_hci_event(fd, resp, 10)) < 0) { + fprintf(stderr, "Failed to set baud rate on chip\n"); + return -1; + } + +#ifdef STLC2500_DEBUG + for (i = 0; i < n; i++) { + fprintf(stderr, "resp[%d] = %02x\n", i, resp[i]); + } +#endif + + str2ba(u->bdaddr, &bdaddr); + return stlc2500_init(fd, &bdaddr); +} + +static int bgb2xx(int fd, struct uart_t *u, struct termios *ti) +{ + bdaddr_t bdaddr; + + str2ba(u->bdaddr, &bdaddr); + + return bgb2xx_init(fd, &bdaddr); +} + +/* + * Broadcom specific initialization + * Extracted from Jungo openrg + */ +static int bcm2035(int fd, struct uart_t *u, struct termios *ti) +{ + int n; + unsigned char cmd[30], resp[30]; + + /* Reset the BT Chip */ + memset(cmd, 0, sizeof(cmd)); + memset(resp, 0, sizeof(resp)); + cmd[0] = HCI_COMMAND_PKT; + cmd[1] = 0x03; + cmd[2] = 0x0c; + cmd[3] = 0x00; + + /* Send command */ + if (write(fd, cmd, 4) != 4) { + fprintf(stderr, "Failed to write reset command\n"); + return -1; + } + + /* Read reply */ + if ((n = read_hci_event(fd, resp, 4)) < 0) { + fprintf(stderr, "Failed to reset chip\n"); + return -1; + } + + if (u->bdaddr != NULL) { + /* Set BD_ADDR */ + memset(cmd, 0, sizeof(cmd)); + memset(resp, 0, sizeof(resp)); + cmd[0] = HCI_COMMAND_PKT; + cmd[1] = 0x01; + cmd[2] = 0xfc; + cmd[3] = 0x06; + str2ba(u->bdaddr, (bdaddr_t *) (cmd + 4)); + + /* Send command */ + if (write(fd, cmd, 10) != 10) { + fprintf(stderr, "Failed to write BD_ADDR command\n"); + return -1; + } + + /* Read reply */ + if ((n = read_hci_event(fd, resp, 10)) < 0) { + fprintf(stderr, "Failed to set BD_ADDR\n"); + return -1; + } + } + + /* Read the local version info */ + memset(cmd, 0, sizeof(cmd)); + memset(resp, 0, sizeof(resp)); + cmd[0] = HCI_COMMAND_PKT; + cmd[1] = 0x01; + cmd[2] = 0x10; + cmd[3] = 0x00; + + /* Send command */ + if (write(fd, cmd, 4) != 4) { + fprintf(stderr, "Failed to write \"read local version\" " + "command\n"); + return -1; + } + + /* Read reply */ + if ((n = read_hci_event(fd, resp, 4)) < 0) { + fprintf(stderr, "Failed to read local version\n"); + return -1; + } + + /* Read the local supported commands info */ + memset(cmd, 0, sizeof(cmd)); + memset(resp, 0, sizeof(resp)); + cmd[0] = HCI_COMMAND_PKT; + cmd[1] = 0x02; + cmd[2] = 0x10; + cmd[3] = 0x00; + + /* Send command */ + if (write(fd, cmd, 4) != 4) { + fprintf(stderr, "Failed to write \"read local supported " + "commands\" command\n"); + return -1; + } + + /* Read reply */ + if ((n = read_hci_event(fd, resp, 4)) < 0) { + fprintf(stderr, "Failed to read local supported commands\n"); + return -1; + } + + /* Set the baud rate */ + memset(cmd, 0, sizeof(cmd)); + memset(resp, 0, sizeof(resp)); + cmd[0] = HCI_COMMAND_PKT; + cmd[1] = 0x18; + cmd[2] = 0xfc; + cmd[3] = 0x02; + switch (u->speed) { + case 57600: + cmd[4] = 0x00; + cmd[5] = 0xe6; + break; + case 230400: + cmd[4] = 0x22; + cmd[5] = 0xfa; + break; + case 460800: + cmd[4] = 0x22; + cmd[5] = 0xfd; + break; + case 921600: + cmd[4] = 0x55; + cmd[5] = 0xff; + break; + default: + /* Default is 115200 */ + cmd[4] = 0x00; + cmd[5] = 0xf3; + break; + } + fprintf(stderr, "Baud rate parameters: DHBR=0x%2x,DLBR=0x%2x\n", + cmd[4], cmd[5]); + + /* Send command */ + if (write(fd, cmd, 6) != 6) { + fprintf(stderr, "Failed to write \"set baud rate\" command\n"); + return -1; + } + + if ((n = read_hci_event(fd, resp, 6)) < 0) { + fprintf(stderr, "Failed to set baud rate\n"); + return -1; + } + + return 0; +} +#endif + +static int realtek_init(int fd, struct uart_t *u, struct termios *ti) +{ + + fprintf(stderr, "Realtek Bluetooth init uart with init speed:%d, final_speed:%d, type:HCI UART %s\n", u->init_speed, u->speed, (u->proto == HCI_UART_H4)? "H4":"H5" ); + return rtk_init(fd, u->proto, u->speed, ti); +} + +static int realtek_post(int fd, struct uart_t *u, struct termios *ti) +{ + fprintf(stderr, "Realtek Bluetooth post process\n"); + return rtk_post(fd, u->proto, ti); +} + +struct uart_t uart[] = { + { "any", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, FLOW_CTL, DISABLE_PM, NULL, NULL }, + { "bcsp", 0x0000, 0x0000, HCI_UART_BCSP, 115200, 115200, 0, DISABLE_PM, NULL, bcsp }, + +#if 0 + { "ericsson", 0x0000, 0x0000, HCI_UART_H4, 57600, 115200, FLOW_CTL, NULL, ericsson }, + { "digi", 0x0000, 0x0000, HCI_UART_H4, 9600, 115200, FLOW_CTL, NULL, digi }, + + + /* Xircom PCMCIA cards: Credit Card Adapter and Real Port Adapter */ + { "xircom", 0x0105, 0x080a, HCI_UART_H4, 115200, 115200, FLOW_CTL, NULL, NULL }, + + /* CSR Casira serial adapter or BrainBoxes serial dongle (BL642) */ + { "csr", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, FLOW_CTL, NULL, csr }, + + /* BrainBoxes PCMCIA card (BL620) */ + { "bboxes", 0x0160, 0x0002, HCI_UART_H4, 115200, 460800, FLOW_CTL, NULL, csr }, + + /* Silicon Wave kits */ + { "swave", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, FLOW_CTL, NULL, swave }, + + /* Texas Instruments Bluelink (BRF) modules */ + { "texas", 0x0000, 0x0000, HCI_UART_LL, 115200, 115200, FLOW_CTL, NULL, texas, texas2 }, + { "texasalt", 0x0000, 0x0000, HCI_UART_LL, 115200, 115200, FLOW_CTL, NULL, texasalt, NULL }, + + /* ST Microelectronics minikits based on STLC2410/STLC2415 */ + { "st", 0x0000, 0x0000, HCI_UART_H4, 57600, 115200, FLOW_CTL, NULL, st }, + + /* ST Microelectronics minikits based on STLC2500 */ + { "stlc2500", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, FLOW_CTL, "00:80:E1:00:AB:BA", stlc2500 }, + + /* Philips generic Ericsson IP core based */ + { "philips", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, FLOW_CTL, NULL, NULL }, + + /* Philips BGB2xx Module */ + { "bgb2xx", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, FLOW_CTL, "BD:B2:10:00:AB:BA", bgb2xx }, + + /* Sphinx Electronics PICO Card */ + { "picocard", 0x025e, 0x1000, HCI_UART_H4, 115200, 115200, FLOW_CTL, NULL, NULL }, + + /* Inventel BlueBird Module */ + { "inventel", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, FLOW_CTL, NULL, NULL }, + + /* COM One Platinium Bluetooth PC Card */ + { "comone", 0xffff, 0x0101, HCI_UART_BCSP, 115200, 115200, 0, NULL, bcsp }, + + /* TDK Bluetooth PC Card and IBM Bluetooth PC Card II */ + { "tdk", 0x0105, 0x4254, HCI_UART_BCSP, 115200, 115200, 0, NULL, bcsp }, + + /* Socket Bluetooth CF Card (Rev G) */ + { "socket", 0x0104, 0x0096, HCI_UART_BCSP, 230400, 230400, 0, NULL, bcsp }, + + /* 3Com Bluetooth Card (Version 3.0) */ + { "3com", 0x0101, 0x0041, HCI_UART_H4, 115200, 115200, FLOW_CTL, NULL, csr }, + + /* AmbiCom BT2000C Bluetooth PC/CF Card */ + { "bt2000c", 0x022d, 0x2000, HCI_UART_H4, 57600, 460800, FLOW_CTL, NULL, csr }, + + /* Zoom Bluetooth PCMCIA Card */ + { "zoom", 0x0279, 0x950b, HCI_UART_BCSP, 115200, 115200, 0, NULL, bcsp }, + + /* Sitecom CN-504 PCMCIA Card */ + { "sitecom", 0x0279, 0x950b, HCI_UART_BCSP, 115200, 115200, 0, NULL, bcsp }, + + /* Billionton PCBTC1 PCMCIA Card */ + { "billionton", 0x0279, 0x950b, HCI_UART_BCSP, 115200, 115200, 0, NULL, bcsp }, + + /* Broadcom BCM2035 */ + { "bcm2035", 0x0A5C, 0x2035, HCI_UART_H4, 115200, 460800, FLOW_CTL, NULL, bcm2035 }, + +#endif + + /* Realtek Bluetooth H4*/ + /* H4 will set 115200 baudrate and flow control enable by default*/ + { "rtk_h4", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, 0, DISABLE_PM, NULL, realtek_init, realtek_post}, + + /* Realtek Bluetooth H5*/ + /* H5 will set 115200 baudrate and flow control disable by default */ + { "rtk_h5", 0x0000, 0x0000, HCI_UART_3WIRE, 115200,115200, 0, DISABLE_PM, NULL, realtek_init, realtek_post}, + + { NULL, 0 } +}; + +static struct uart_t * get_by_id(int m_id, int p_id) +{ + int i; + for (i = 0; uart[i].type; i++) { + if (uart[i].m_id == m_id && uart[i].p_id == p_id) + return &uart[i]; + } + return NULL; +} + +static struct uart_t * get_by_type(char *type) +{ + int i; + for (i = 0; uart[i].type; i++) { + if (!strcmp(uart[i].type, type)) + return &uart[i]; + } + return NULL; +} + +/* Initialize UART driver */ +static int init_uart(char *dev, struct uart_t *u, int send_break, int raw) +{ + struct termios ti; + int fd, i; + unsigned long flags = 0; + + if (raw) + flags |= 1 << HCI_UART_RAW_DEVICE; + + fd = open(dev, O_RDWR | O_NOCTTY); + if (fd < 0) { + perror("Can't open serial port"); + return -1; + } + + tcflush(fd, TCIOFLUSH); + + if (tcgetattr(fd, &ti) < 0) { + perror("Can't get port settings"); + return -1; + } + + cfmakeraw(&ti); + + ti.c_cflag |= CLOCAL; + if (u->flags & FLOW_CTL) + ti.c_cflag |= CRTSCTS; + else + ti.c_cflag &= ~CRTSCTS; + + if (tcsetattr(fd, TCSANOW, &ti) < 0) { + perror("Can't set port settings"); + return -1; + } + + /* Set initial baudrate */ + if (set_speed(fd, &ti, u->init_speed) < 0) { + perror("Can't set initial baud rate"); + return -1; + } + + tcflush(fd, TCIOFLUSH); + + if (send_break) { + tcsendbreak(fd, 0); + usleep(500000); + } + + if (u->init && u->init(fd, u, &ti) < 0) + return -1; + + tcflush(fd, TCIOFLUSH); + + /* Set actual baudrate */ + if (set_speed(fd, &ti, u->speed) < 0) { + perror("Can't set baud rate"); + return -1; + } + + /* Set TTY to N_HCI line discipline */ + i = N_HCI; + if (ioctl(fd, TIOCSETD, &i) < 0) { + perror("Can't set line discipline"); + return -1; + } + + if (flags && ioctl(fd, HCIUARTSETFLAGS, flags) < 0) { + perror("Can't set UART flags"); + return -1; + } + + if (ioctl(fd, HCIUARTSETPROTO, u->proto) < 0) { + perror("Can't set device"); + return -1; + } + + if (u->post && u->post(fd, u, &ti) < 0) + return -1; + + return fd; +} + +static void usage(void) +{ + printf("hciattach - HCI UART driver initialization utility\n"); + printf("Usage:\n"); + printf("\thciattach [-n] [-p] [-b] [-r] [-t timeout] [-s initial_speed] [speed] [flow|noflow] [bdaddr]\n"); + printf("\thciattach -l\n"); +} + +int main(int argc, char *argv[]) +{ + struct uart_t *u = NULL; + int detach, printpid, raw, opt, i, n, ld, err; + int to = 10; + int init_speed = 0; + int send_break = 0; + pid_t pid; + struct sigaction sa; + struct pollfd p; + sigset_t sigs; + char dev[PATH_MAX]; + + detach = 1; + printpid = 0; + raw = 0; + + while ((opt=getopt(argc, argv, "bnpt:s:lr")) != EOF) { + switch(opt) { + case 'b': + send_break = 1; + break; + + case 'n': + detach = 0; + break; + + case 'p': + printpid = 1; + break; + + case 't': + to = atoi(optarg); + break; + + case 's': + init_speed = atoi(optarg); + break; + + case 'l': + for (i = 0; uart[i].type; i++) { + printf("%-10s0x%04x,0x%04x\n", uart[i].type, + uart[i].m_id, uart[i].p_id); + } + exit(0); + + case 'r': + raw = 1; + break; + + default: + usage(); + exit(1); + } + } + + n = argc - optind; + if (n < 2) { + usage(); + exit(1); + } + + for (n = 0; optind < argc; n++, optind++) { + char *opt; + + opt = argv[optind]; + + switch(n) { + case 0: + dev[0] = 0; + if (!strchr(opt, '/')) + strcpy(dev, "/dev/"); + strcat(dev, opt); + break; + + case 1: + if (strchr(argv[optind], ',')) { + int m_id, p_id; + sscanf(argv[optind], "%x,%x", &m_id, &p_id); + u = get_by_id(m_id, p_id); + } else { + u = get_by_type(opt); + } + + if (!u) { + fprintf(stderr, "Unknown device type or id\n"); + exit(1); + } + + break; + + case 2: + u->speed = atoi(argv[optind]); + break; + + case 3: + if (!strcmp("flow", argv[optind])) + u->flags |= FLOW_CTL; + else + u->flags &= ~FLOW_CTL; + break; + + case 4: + if (!strcmp("sleep", argv[optind])) + u->pm = ENABLE_PM; + else + u->pm = DISABLE_PM; + break; + + case 5: + u->bdaddr = argv[optind]; + break; + } + } + + if (!u) { + fprintf(stderr, "Unknown device type or id\n"); + exit(1); + } + + /* If user specified a initial speed, use that instead of + the hardware's default */ + if (init_speed) + u->init_speed = init_speed; + + memset(&sa, 0, sizeof(sa)); + sa.sa_flags = SA_NOCLDSTOP; + sa.sa_handler = sig_alarm; + sigaction(SIGALRM, &sa, NULL); + + /* 10 seconds should be enough for initialization */ + alarm(to); + bcsp_max_retries = to; + + n = init_uart(dev, u, send_break, raw); + if (n < 0) { + perror("Can't initialize device"); + exit(1); + } + + printf("Device setup complete\n"); + + alarm(0); + + memset(&sa, 0, sizeof(sa)); + sa.sa_flags = SA_NOCLDSTOP; + sa.sa_handler = SIG_IGN; + sigaction(SIGCHLD, &sa, NULL); + sigaction(SIGPIPE, &sa, NULL); + + sa.sa_handler = sig_term; + sigaction(SIGTERM, &sa, NULL); + sigaction(SIGINT, &sa, NULL); + + sa.sa_handler = sig_hup; + sigaction(SIGHUP, &sa, NULL); + + if (detach) { + if ((pid = fork())) { + if (printpid) + printf("%d\n", pid); + return 0; + } + + for (i = 0; i < 20; i++) + if (i != n) + close(i); + } + + p.fd = n; + p.events = POLLERR | POLLHUP; + + sigfillset(&sigs); + sigdelset(&sigs, SIGCHLD); + sigdelset(&sigs, SIGPIPE); + sigdelset(&sigs, SIGTERM); + sigdelset(&sigs, SIGINT); + sigdelset(&sigs, SIGHUP); + + while (!__io_canceled) { + p.revents = 0; + err = ppoll(&p, 1, NULL, &sigs); + if (err < 0 && errno == EINTR) { + printf("Got EINTR.\n"); + continue; + } if (err) + break; + } + + /* Restore TTY line discipline */ + printf("Restore TTY line discipline\n"); + ld = N_TTY; + if (ioctl(n, TIOCSETD, &ld) < 0) { + perror("Can't restore line discipline"); + exit(1); + } + + return 0; +} diff --git a/bsp/meta-rockchip/recipes-devtools/rtl-tools/files/hciattach.h b/bsp/meta-rockchip/recipes-devtools/rtl-tools/files/hciattach.h new file mode 100644 index 0000000000000000000000000000000000000000..642c97d145a9ea0a0d603ae44a3facd98acc06fc --- /dev/null +++ b/bsp/meta-rockchip/recipes-devtools/rtl-tools/files/hciattach.h @@ -0,0 +1,57 @@ +/* + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2003-2009 Marcel Holtmann + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include + +#ifndef N_HCI +#define N_HCI 15 +#endif + +#define HCIUARTSETPROTO _IOW('U', 200, int) +#define HCIUARTGETPROTO _IOR('U', 201, int) +#define HCIUARTGETDEVICE _IOR('U', 202, int) +#define HCIUARTSETFLAGS _IOW('U', 203, int) +#define HCIUARTGETFLAGS _IOR('U', 204, int) + +#define HCI_UART_H4 0 +#define HCI_UART_BCSP 1 +#define HCI_UART_3WIRE 2 +#define HCI_UART_H4DS 3 +#define HCI_UART_LL 4 +#define HCI_UART_RAW_DEVICE 0 + +int read_hci_event(int fd, unsigned char* buf, int size); +int set_speed(int fd, struct termios *ti, int speed); +/* +int texas_init(int fd, struct termios *ti); +int texas_post(int fd, struct termios *ti); +int texasalt_init(int fd, int speed, struct termios *ti); +int stlc2500_init(int fd, bdaddr_t *bdaddr); +int bgb2xx_init(int dd, bdaddr_t *bdaddr); +*/ + +//Realtek_add_start +//add realtek init and post process for realtek Bluetooth chip +int rtk_init(int fd, int proto, int speed, struct termios *ti); +int rtk_post(int fd, int proto, struct termios *ti); +//Realtek_add_end diff --git a/bsp/meta-rockchip/recipes-devtools/rtl-tools/files/hciattach_rtk.c b/bsp/meta-rockchip/recipes-devtools/rtl-tools/files/hciattach_rtk.c new file mode 100644 index 0000000000000000000000000000000000000000..b195b1b6d3796bb8487f579c29089f018668e7e1 --- /dev/null +++ b/bsp/meta-rockchip/recipes-devtools/rtl-tools/files/hciattach_rtk.c @@ -0,0 +1,3583 @@ +/* + * Copyright (C) 2013 Realtek Semiconductor Corp. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Module Name: + * hciattach_rtk.c + * + * Description: + * H4/H5 specific initialization + * + * Revision History: + * Date Version Author Comment + * ---------- --------- --------------- ----------------------- + * 2013-06-06 1.0.0 gordon_yang Create + * 2013-06-18 1.0.1 lory_xu add support for multi fw + * 2013-06-21 1.0.2 gordon_yang add timeout for get version cmd + * 2013-07-01 1.0.3 lory_xu close file handle + * 2013-07-01 2.0 champion_chen add IC check + * 2013-12-16 2.1 champion_chen fix bug in Additional packet number + * 2013-12-25 2.2 champion_chen open host flow control after send last fw packet + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "hciattach.h" + +#define RTK_VERSION "4.1" + +/* #define RTL_8703A_SUPPORT */ + +#define USE_CUSTOMER_ADDRESS + +#define BAUDRATE_4BYTES +#define FIRMWARE_DIRECTORY "/lib/firmware/rtlbt/" +#define BT_CONFIG_DIRECTORY "/lib/firmware/rtlbt/" + +#ifdef USE_CUSTOMER_ADDRESS +#define BT_ADDR_FILE "/opt/bdaddr" +static uint8_t customer_bdaddr = 0; +#endif + +#define CONFIG_TXPOWER (1 << 0) +#define CONFIG_XTAL (1 << 1) +#define CONFIG_BTMAC (1 << 2) + +#define EXTRA_CONFIG_OPTION +#ifdef EXTRA_CONFIG_OPTION +#define EXTRA_CONFIG_FILE "/opt/rtk_btconfig.txt" +static uint32_t config_flags; +static uint8_t txpower_cfg[4]; +static uint8_t txpower_len; +static uint8_t xtal_cfg; +#endif + +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define cpu_to_le16(d) (d) +#define cpu_to_le32(d) (d) +#define le16_to_cpu(d) (d) +#define le32_to_cpu(d) (d) +#elif __BYTE_ORDER == __BIG_ENDIAN +#define cpu_to_le16(d) bswap_16(d) +#define cpu_to_le32(d) bswap_32(d) +#define le16_to_cpu(d) bswap_16(d) +#define le32_to_cpu(d) bswap_32(d) +#else +#error "Unknown byte order" +#endif + +typedef uint8_t RT_U8, *PRT_U8; +typedef int8_t RT_S8, *PRT_S8; +typedef uint16_t RT_U16, *PRT_U16; +typedef int32_t RT_S32, *PRT_S32; +typedef uint32_t RT_U32, *PRT_U32; + +RT_U8 DBG_ON = 1; +#define LOG_STR "Realtek Bluetooth" +#define RS_DBG(fmt, arg...) \ + do{ \ + if (DBG_ON) \ + fprintf(stderr, "%s :" fmt "\n" , LOG_STR, ##arg); \ + }while(0) + +#define RS_INFO(fmt, arg...) \ + do{ \ + fprintf(stderr, "%s :" fmt "\n", LOG_STR, ##arg); \ + }while(0) + +#define RS_ERR(fmt, arg...) \ + do{ \ + fprintf(stderr, "%s ERROR: " fmt "\n", LOG_STR, ##arg); \ + }while(0) + +#define HCI_COMMAND_HDR_SIZE 3 +#define HCI_EVENT_HDR_SIZE 2 +/* #define RTK_PATCH_LENGTH_MAX 24576 */ //24*1024 +#define RTK_PATCH_LENGTH_MAX (40 * 1024) +#define PATCH_DATA_FIELD_MAX_SIZE 252 +#define READ_DATA_SIZE 16 +#define H5_MAX_RETRY_COUNT 40 + +#define RTK_VENDOR_CONFIG_MAGIC 0x8723ab55 +const RT_U8 RTK_EPATCH_SIGNATURE[8] = + { 0x52, 0x65, 0x61, 0x6C, 0x74, 0x65, 0x63, 0x68 }; +const RT_U8 Extension_Section_SIGNATURE[4] = { 0x51, 0x04, 0xFD, 0x77 }; + +#define HCI_CMD_READ_BD_ADDR 0x1009 +#define HCI_VENDOR_CHANGE_BDRATE 0xfc17 +#define HCI_VENDOR_READ_RTK_ROM_VERISION 0xfc6d +#define HCI_CMD_READ_LOCAL_VERISION 0x1001 +#define HCI_VENDOR_READ_CHIP_TYPE 0xfc61 + +#define ROM_LMP_NONE 0x0000 +#define ROM_LMP_8723a 0x1200 +#define ROM_LMP_8723b 0x8723 +#define ROM_LMP_8821a 0x8821 +#define ROM_LMP_8761a 0x8761 +#define ROM_LMP_8761btc 0x8763 + +#define ROM_LMP_8703a 0x87b3 +#define ROM_LMP_8763a 0x8763 +#define ROM_LMP_8703b 0x8703 +#define ROM_LMP_8723c 0x87c3 /* ??????? */ +#define ROM_LMP_8822b 0x8822 +#define ROM_LMP_8723cs_xx 0x8704 +#define ROM_LMP_8723cs_cg 0x8705 +#define ROM_LMP_8723cs_vf 0x8706 + +/* Chip type */ +#define CHIP_8703AS 1 +#define CHIP_8723CS_CG 3 +#define CHIP_8723CS_VF 4 +#define CHIP_RTL8723CS_XX 5 +#define CHIP_8703BS 7 + +/* software id */ +#define CHIP_UNKNOWN 0x00 +#define CHIP_8761AT 0x1F +#define CHIP_8761ATF 0x2F +#define CHIP_8761BTC 0x3F +#define CHIP_8761B 0x4F +#define CHIP_BEFORE 0x6F +#define CHIP_8822BS 0x70 +#define CHIP_8723DS 0x71 +#define CHIP_8821CS 0x72 + +/* HCI data types */ +#define H5_ACK_PKT 0x00 +#define HCI_COMMAND_PKT 0x01 +#define HCI_ACLDATA_PKT 0x02 +#define HCI_SCODATA_PKT 0x03 +#define HCI_EVENT_PKT 0x04 +#define H5_VDRSPEC_PKT 0x0E +#define H5_LINK_CTL_PKT 0x0F + +#define H5_HDR_SEQ(hdr) ((hdr)[0] & 0x07) +#define H5_HDR_ACK(hdr) (((hdr)[0] >> 3) & 0x07) +#define H5_HDR_CRC(hdr) (((hdr)[0] >> 6) & 0x01) +#define H5_HDR_RELIABLE(hdr) (((hdr)[0] >> 7) & 0x01) +#define H5_HDR_PKT_TYPE(hdr) ((hdr)[1] & 0x0f) +#define H5_HDR_LEN(hdr) ((((hdr)[1] >> 4) & 0xff) + ((hdr)[2] << 4)) +#define H5_HDR_SIZE 4 + +struct sk_buff { + RT_U32 max_len; + RT_U32 data_len; + RT_U8 data[0]; +}; + +/* Skb helpers */ +struct bt_skb_cb { + RT_U8 pkt_type; + RT_U8 incoming; + RT_U16 expect; + RT_U8 tx_seq; + RT_U8 retries; + RT_U8 sar; + unsigned short channel; +}; + +typedef struct { + uint8_t index; + uint8_t data[252]; +} __attribute__ ((packed)) download_vendor_patch_cp; + +struct hci_command_hdr { + RT_U16 opcode; + RT_U8 plen; +} __attribute__ ((packed)); + +struct hci_event_hdr { + RT_U8 evt; + RT_U8 plen; +} __attribute__ ((packed)); + +struct hci_ev_cmd_complete { + RT_U8 ncmd; + RT_U16 opcode; +} __attribute__ ((packed)); + +struct rtk_bt_vendor_config_entry { + RT_U16 offset; + RT_U8 entry_len; + RT_U8 entry_data[0]; +} __attribute__ ((packed)); + +struct rtk_bt_vendor_config { + RT_U32 signature; + RT_U16 data_len; + struct rtk_bt_vendor_config_entry entry[0]; +} __attribute__ ((packed)); + +struct rtk_epatch_entry { + RT_U16 chipID; + RT_U16 patch_length; + RT_U32 start_offset; + RT_U32 svn_ver; + RT_U32 coex_ver; +} __attribute__ ((packed)); + +struct rtk_epatch { + RT_U8 signature[8]; + RT_U32 fw_version; + RT_U16 number_of_patch; + struct rtk_epatch_entry entry[0]; +} __attribute__ ((packed)); + +struct rtk_extension_entry { + uint8_t opcode; + uint8_t length; + uint8_t *data; +} __attribute__ ((packed)); + +typedef enum _RTK_ROM_VERSION_CMD_STATE { + cmd_not_send, + cmd_has_sent, + event_received +} RTK_ROM_VERSION_CMD_STATE; + +typedef enum _H5_RX_STATE { + H5_W4_PKT_DELIMITER, + H5_W4_PKT_START, + H5_W4_HDR, + H5_W4_DATA, + H5_W4_CRC +} H5_RX_STATE; + +typedef enum _H5_RX_ESC_STATE { + H5_ESCSTATE_NOESC, + H5_ESCSTATE_ESC +} H5_RX_ESC_STATE; + +typedef enum _H5_LINK_STATE { + H5_SYNC, + H5_CONFIG, + H5_INIT, + H5_PATCH, + H5_ACTIVE +} H5_LINK_STATE; + +uint16_t project_id[]= +{ + ROM_LMP_8723a, + ROM_LMP_8723b, /* RTL8723BS */ + ROM_LMP_8821a, /* RTL8821AS */ + ROM_LMP_8761a, /* RTL8761ATV */ + + ROM_LMP_8703a, + ROM_LMP_8763a, + ROM_LMP_8703b, + ROM_LMP_8723c, /* index 7 for 8723CS. What is for other 8723CS */ + ROM_LMP_8822b, /* RTL8822BS */ + ROM_LMP_8723b, /* RTL8723DS */ + ROM_LMP_8821a, /* id 10 for RTL8821CS, lmp subver 0x8821 */ + ROM_LMP_NONE +}; + +#define RTL_FW_MATCH_CHIP_TYPE (1 << 0) +#define RTL_FW_MATCH_HCI_VER (1 << 1) +#define RTL_FW_MATCH_HCI_REV (1 << 2) +struct patch_info { + uint32_t match_flags; + uint8_t chip_type; + uint16_t lmp_subver; + uint16_t proj_id; + uint8_t hci_ver; + uint16_t hci_rev; + char *patch_file; + char *config_file; + char *ic_name; +}; + +static struct patch_info h4_patch_table[] = { + /* match flags, chip type, lmp subver, proj id(unused), hci_ver, + * hci_rev, ... + */ + + /* RTL8761AT */ + { RTL_FW_MATCH_CHIP_TYPE, CHIP_8761AT, + 0x8761, 0xffff, 0, 0x000a, + "rtl8761at_fw", "rtl8761at_config", "RTL8761AT" }, + /* RTL8761ATF */ + { RTL_FW_MATCH_CHIP_TYPE, CHIP_8761ATF, + 0x8761, 0xffff, 0, 0x000a, + "rtl8761atf_fw", "rtl8761atf_config", "RTL8761ATF" }, + /* RTL8761B TC + * FW/Config is not used. + */ + { RTL_FW_MATCH_CHIP_TYPE, CHIP_8761BTC, + 0x8763, 0xffff, 0, 0x000b, + "rtl8761btc_fw", "rtl8761btc_config", "RTL8761BTC" }, + /* RTL8761B */ + { RTL_FW_MATCH_CHIP_TYPE, CHIP_8761B, + 0x8761, 0xffff, 0, 0x000b, + "rtl8761b_fw", "rtl8761b_config", "RTL8761B" }, + + { 0, 0, 0, ROM_LMP_NONE, 0, 0, "rtl_none_fw", "rtl_none_config", "NONE"} +}; + +static struct patch_info patch_table[] = { + /* match flags, chip type, lmp subver, proj id(unused), hci_ver, + * hci_rev, ... + */ + + /* RTL8723AS */ + { 0, 0, ROM_LMP_8723a, ROM_LMP_8723a, 0, 0, + "rtl8723a_fw", "rtl8723a_config", "RTL8723AS"}, + /* RTL8821CS */ + { RTL_FW_MATCH_HCI_REV, CHIP_8821CS, + ROM_LMP_8821a, ROM_LMP_8821a, 0, 0x000c, + "rtl8821c_fw", "rtl8821c_config", "RTL8821CS"}, + /* RTL8821AS */ + { 0, 0, ROM_LMP_8821a, ROM_LMP_8821a, 0, 0, + "rtl8821a_fw", "rtl8821a_config", "RTL8821AS"}, + /* RTL8761ATV */ + { 0, 0, ROM_LMP_8761a, ROM_LMP_8761a, 0, 0, + "rtl8761a_fw", "rtl8761a_config", "RTL8761ATV"}, + + /* RTL8703AS + * RTL8822BS + * */ +#ifdef RTL_8703A_SUPPORT + { RTL_FW_MATCH_CHIP_TYPE, CHIP_8703AS, + ROM_LMP_8723b, ROM_LMP_8723b, 0, 0, + "rtl8703a_fw", "rtl8703a_config", "RTL8703AS"}, +#endif + { 0, CHIP_8822BS, ROM_LMP_8822b, ROM_LMP_8822b, 0, 0, + "rtl8822b_fw", "rtl8822b_config", "RTL8822BS"}, + + /* RTL8703BS + * RTL8723CS_XX + * RTL8723CS_CG + * RTL8723CS_VF + * */ + { RTL_FW_MATCH_CHIP_TYPE, CHIP_8703BS, + ROM_LMP_8703b, ROM_LMP_8703b, 0, 0, + "rtl8703b_fw", "rtl8703b_config", "RTL8703BS"}, + { RTL_FW_MATCH_CHIP_TYPE, CHIP_RTL8723CS_XX, + ROM_LMP_8703b, ROM_LMP_8723cs_xx, 0, 0, + "rtl8723cs_xx_fw", "rtl8723cs_xx_config", "RTL8723CS_XX"}, + { RTL_FW_MATCH_CHIP_TYPE, CHIP_8723CS_CG, + ROM_LMP_8703b, ROM_LMP_8723cs_cg, 0, 0, + "rtl8723cs_cg_fw", "rtl8723cs_cg_config", "RTL8723CS_CG"}, + { RTL_FW_MATCH_CHIP_TYPE, CHIP_8723CS_VF, + ROM_LMP_8703b, ROM_LMP_8723cs_vf, 0, 0, + "rtl8723cs_vf_fw", "rtl8723cs_vf_config", "RTL8723CS_VF"}, + + /* RTL8723BS */ + { RTL_FW_MATCH_HCI_VER | RTL_FW_MATCH_HCI_REV, 0, + ROM_LMP_8723b, ROM_LMP_8723b, 6, 0x000b, + "rtl8723b_fw", "rtl8723b_config", "RTL8723BS"}, + /* RTL8723DS */ + { RTL_FW_MATCH_HCI_VER | RTL_FW_MATCH_HCI_REV, CHIP_8723DS, + ROM_LMP_8723b, ROM_LMP_8723b, 8, 0x000d, + "rtl8723d_fw", "rtl8723d_config", "RTL8723DS"}, + /* add entries here*/ + + { 0, 0, 0, ROM_LMP_NONE, 0, 0, "rtl_none_fw", "rtl_none_config", "NONE"} +}; + +typedef struct btrtl_info { +/**********************h5 releated*************************/ + RT_U8 rxseq_txack; /* expected rx seq number */ + RT_U8 rxack; /* last packet sent by us that the peer ack'ed */ + RT_U8 use_crc; + RT_U8 is_txack_req; /* txack required */ + RT_U8 msgq_txseq; /* next pkt seq */ + RT_U16 message_crc; + RT_U32 rx_count; /* expected pkts to recv */ + + H5_RX_STATE rx_state; + H5_RX_ESC_STATE rx_esc_state; + H5_LINK_STATE link_estab_state; + + struct sk_buff *rx_skb; + struct sk_buff *host_last_cmd; + + uint16_t num_of_cmd_sent; + RT_U16 lmp_subver; + uint16_t hci_rev; + uint8_t hci_ver; + RT_U8 eversion; + int h5_max_retries; + RT_U8 chip_type; + +/**********************patch related************************/ + uint32_t baudrate; + uint8_t dl_fw_flag; + int serial_fd; + int hw_flow_control; + int final_speed; + int total_num; /* total pkt number */ + int tx_index; /* current sending pkt number */ + int rx_index; /* ack index from board */ + int fw_len; /* fw patch file len */ + int config_len; /* config patch file len */ + int total_len; /* fw & config extracted buf len */ + uint8_t *fw_buf; /* fw patch file buf */ + uint8_t *config_buf; /* config patch file buf */ + uint8_t *total_buf; /* fw & config extracted buf */ + RTK_ROM_VERSION_CMD_STATE rom_version_cmd_state; + RTK_ROM_VERSION_CMD_STATE hci_version_cmd_state; + RTK_ROM_VERSION_CMD_STATE chip_type_cmd_state; + + struct patch_info *patch_ent; + + int proto; +} rtk_hw_cfg_t; + +static rtk_hw_cfg_t rtk_hw_cfg; + +void util_hexdump(const uint8_t *buf, size_t len) +{ + static const char hexdigits[] = "0123456789abcdef"; + char str[16 * 3]; + size_t i; + + if (!buf || !len) + return; + + for (i = 0; i < len; i++) { + str[((i % 16) * 3)] = hexdigits[buf[i] >> 4]; + str[((i % 16) * 3) + 1] = hexdigits[buf[i] & 0xf]; + str[((i % 16) * 3) + 2] = ' '; + if ((i + 1) % 16 == 0) { + str[16 * 3 - 1] = '\0'; + RS_INFO("%s", str); + } + } + + if (i % 16 > 0) { + str[(i % 16) * 3 - 1] = '\0'; + RS_INFO("%s", str); + } +} + +#ifdef EXTRA_CONFIG_OPTION + +static inline int xtalset_supported(void) +{ + struct patch_info *pent = rtk_hw_cfg.patch_ent; + + /* Only support rtl8723ds, rtl8822bs and rtl8821cs xtal config */ + if (pent->chip_type != CHIP_8723DS && + pent->chip_type != CHIP_8822BS && + pent->chip_type != CHIP_8821CS) + return 0; + + return 1; +} + +static void line_proc(char *buff, int len) +{ + char *argv[32]; + int nargs = 0; + RS_INFO("%s", buff); + + while (nargs < 32) { + /* skip any white space */ + while ((*buff == ' ') || (*buff == '\t') || + *buff == ',') { + ++buff; + } + + if (*buff == '\0') { + /* end of line, no more args */ + argv[nargs] = NULL; + break; + } + + /* begin of argument string */ + argv[nargs++] = buff; + + /* find end of string */ + while (*buff && (*buff != ' ') && (*buff != '\t')) { + ++buff; + } + + if (*buff == '\r' || *buff == '\n') + ++buff; + + if (*buff == '\0') { + /* end of line, no more args */ + argv[nargs] = NULL; + break; + } + + *buff++ = '\0'; /* terminate current arg */ + } + + /* valid config */ + if (nargs >= 4) { + unsigned long int offset; + uint8_t l; + uint8_t i = 0; + + offset = strtoul(argv[0], NULL, 16); + offset = offset | (strtoul(argv[1], NULL, 16) << 8); + RS_INFO("extra config offset %04lx", offset); + l = strtoul(argv[2], NULL, 16); + if (l != (uint8_t)(nargs - 3)) { + RS_ERR("invalid len %u", l); + return; + } + + if (offset == 0x015b && l <= 4) { + /* Tx power */ + for (i = 0; i < l; i++) + txpower_cfg[i] = (uint8_t)strtoul(argv[3 + i], NULL, 16); + txpower_len = l; + config_flags |= CONFIG_TXPOWER; + } else if (offset == 0x01e6) { + /* XTAL for 8822B, 8821C 8723D */ + xtal_cfg = (uint8_t)strtoul(argv[3], NULL, 16); + config_flags |= CONFIG_XTAL; + } else { + RS_ERR("extra config %04lx is not supported", offset); + } + } +} + +static void config_proc(uint8_t *buff, int len) +{ + uint8_t *head = buff; + uint8_t *ptr = buff; + int l; + + while (len > 0) { + ptr = strchr(head, '\n'); + if (!ptr) + break; + *ptr++ = '\0'; + while (*head == ' ' || *head == '\t') + head++; + l = ptr - head; + if (l > 0 && *head != '#') + line_proc(head, l); + head = ptr; + len -= l; + } +} + +static void config_file_proc(const char *path) +{ + int fd; + uint8_t buff[256]; + int result; + + fd = open(path, O_RDONLY); + if (fd == -1) { + RS_INFO("Couldnt open extra config %s, %s", path, strerror(errno)); + return; + } + + result = read(fd, buff, sizeof(buff)); + if (result == -1) { + RS_ERR("Couldnt read %s, %s", path, strerror(errno)); + close(fd); + return; + } else if (result == 0) { + RS_ERR("File is empty"); + close(fd); + return; + } + + config_proc(buff, result); + + close(fd); +} +#endif + +/* Get the entry from patch_table according to LMP subversion */ +struct patch_info *get_patch_entry(struct btrtl_info *btrtl) +{ + struct patch_info *n = NULL; + + if (btrtl->proto == HCI_UART_3WIRE) + n = patch_table; + else + n = h4_patch_table; + for (; n->lmp_subver; n++) { + if ((n->match_flags & RTL_FW_MATCH_CHIP_TYPE) && + n->chip_type != btrtl->chip_type) + continue; + if ((n->match_flags & RTL_FW_MATCH_HCI_VER) && + n->hci_ver != btrtl->hci_ver) + continue; + if ((n->match_flags & RTL_FW_MATCH_HCI_REV) && + n->hci_rev != btrtl->hci_rev) + continue; + if (n->lmp_subver != btrtl->lmp_subver) + continue; + + break; + } + + return n; +} + +// bite reverse in bytes +// 00000001 -> 10000000 +// 00000100 -> 00100000 +const RT_U8 byte_rev_table[256] = { + 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, + 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, + 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, + 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, + 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, + 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, + 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, + 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, + 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, + 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, + 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, + 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, + 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, + 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, + 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, + 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, + 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, + 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, + 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, + 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, + 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, + 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, + 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, + 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, + 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, + 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, + 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, + 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, + 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, + 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, + 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, + 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff, +}; + +static __inline RT_U8 bit_rev8(RT_U8 byte) +{ + return byte_rev_table[byte]; +} + +static __inline RT_U16 bit_rev16(RT_U16 x) +{ + return (bit_rev8(x & 0xff) << 8) | bit_rev8(x >> 8); +} + +static const RT_U16 crc_table[] = { + 0x0000, 0x1081, 0x2102, 0x3183, + 0x4204, 0x5285, 0x6306, 0x7387, + 0x8408, 0x9489, 0xa50a, 0xb58b, + 0xc60c, 0xd68d, 0xe70e, 0xf78f +}; + +// Initialise the crc calculator +#define H5_CRC_INIT(x) x = 0xffff + +/** +* Malloc the socket buffer +* +* @param skb socket buffer +* @return the point to the malloc buffer +*/ +static __inline struct sk_buff *skb_alloc(unsigned int len) +{ + struct sk_buff *skb = NULL; + if ((skb = malloc(len + 8))) { + skb->max_len = len; + skb->data_len = 0; + } else { + RS_ERR("Allocate skb fails!!!"); + skb = NULL; + } + memset(skb->data, 0, len); + return skb; +} + +/** +* Free the socket buffer +* +* @param skb socket buffer +*/ +static __inline void skb_free(struct sk_buff *skb) +{ + free(skb); + return; +} + +/** +* Increase the date length in sk_buffer by len, +* and return the increased header pointer +* +* @param skb socket buffer +* @param len length want to increase +* @return the pointer to increased header +*/ +static RT_U8 *skb_put(struct sk_buff *skb, RT_U32 len) +{ + RT_U32 old_len = skb->data_len; + if ((skb->data_len + len) > (skb->max_len)) { + RS_ERR("Buffer too small"); + return NULL; + } + skb->data_len += len; + return (skb->data + old_len); +} + +/** +* decrease data length in sk_buffer by to len by cut the tail +* +* @warning len should be less than skb->len +* +* @param skb socket buffer +* @param len length want to be changed +*/ +static void skb_trim(struct sk_buff *skb, unsigned int len) +{ + if (skb->data_len > len) { + skb->data_len = len; + } else { + RS_ERR("Error: skb->data_len(%d) < len(%d)", skb->data_len, + len); + } +} + +/** +* Decrease the data length in sk_buffer by len, +* and move the content forward to the header. +* the data in header will be removed. +* +* @param skb socket buffer +* @param len length of data +* @return new data +*/ +static RT_U8 *skb_pull(struct sk_buff *skb, RT_U32 len) +{ + skb->data_len -= len; + unsigned char *buf; + if (!(buf = malloc(skb->data_len))) { + RS_ERR("Unable to allocate file buffer"); + exit(1); + } + memcpy(buf, skb->data + len, skb->data_len); + memcpy(skb->data, buf, skb->data_len); + free(buf); + return (skb->data); +} + +/** +* Add "d" into crc scope, caculate the new crc value +* +* @param crc crc data +* @param d one byte data +*/ +static void h5_crc_update(RT_U16 * crc, RT_U8 d) +{ + RT_U16 reg = *crc; + + reg = (reg >> 4) ^ crc_table[(reg ^ d) & 0x000f]; + reg = (reg >> 4) ^ crc_table[(reg ^ (d >> 4)) & 0x000f]; + + *crc = reg; +} + +struct __una_u16 { + RT_U16 x; +}; +static __inline RT_U16 __get_unaligned_cpu16(const void *p) +{ + const struct __una_u16 *ptr = (const struct __una_u16 *)p; + return ptr->x; +} + +static __inline RT_U16 get_unaligned_be16(const void *p) +{ + return __get_unaligned_cpu16((const RT_U8 *)p); +} + +static __inline RT_U16 get_unaligned_le16(RT_U8 * p) +{ + return (RT_U16) (*p) + ((RT_U16) (*(p + 1)) << 8); +} + +static __inline RT_U32 get_unaligned_le32(RT_U8 * p) +{ + return (RT_U32) (*p) + ((RT_U32) (*(p + 1)) << 8) + + ((RT_U32) (*(p + 2)) << 16) + ((RT_U32) (*(p + 3)) << 24); +} + +/** +* Get crc data. +* +* @param h5 realtek h5 struct +* @return crc data +*/ +static RT_U16 h5_get_crc(rtk_hw_cfg_t * h5) +{ + RT_U16 crc = 0; + RT_U8 *data = h5->rx_skb->data + h5->rx_skb->data_len - 2; + crc = data[1] + (data[0] << 8); + return crc; +// return get_unaligned_be16(&h5->rx_skb->data[h5->rx_skb->data_len - 2]); +} + +/** +* Just add 0xc0 at the end of skb, +* we can also use this to add 0xc0 at start while there is no data in skb +* +* @param skb socket buffer +*/ +static void h5_slip_msgdelim(struct sk_buff *skb) +{ + const char pkt_delim = 0xc0; + memcpy(skb_put(skb, 1), &pkt_delim, 1); +} + +/** +* Slip ecode one byte in h5 proto, as follows: +* 0xc0 -> 0xdb, 0xdc +* 0xdb -> 0xdb, 0xdd +* 0x11 -> 0xdb, 0xde +* 0x13 -> 0xdb, 0xdf +* others will not change +* +* @param skb socket buffer +* @c pure data in the one byte +*/ +static void h5_slip_one_byte(struct sk_buff *skb, RT_U8 c) +{ + const RT_S8 esc_c0[2] = { 0xdb, 0xdc }; + const RT_S8 esc_db[2] = { 0xdb, 0xdd }; + const RT_S8 esc_11[2] = { 0xdb, 0xde }; + const RT_S8 esc_13[2] = { 0xdb, 0xdf }; + + switch (c) { + case 0xc0: + memcpy(skb_put(skb, 2), &esc_c0, 2); + break; + + case 0xdb: + memcpy(skb_put(skb, 2), &esc_db, 2); + break; + + case 0x11: + memcpy(skb_put(skb, 2), &esc_11, 2); + break; + + case 0x13: + memcpy(skb_put(skb, 2), &esc_13, 2); + break; + + default: + memcpy(skb_put(skb, 1), &c, 1); + break; + } +} + +/** +* Decode one byte in h5 proto, as follows: +* 0xdb, 0xdc -> 0xc0 +* 0xdb, 0xdd -> 0xdb +* 0xdb, 0xde -> 0x11 +* 0xdb, 0xdf -> 0x13 +* others will not change +* +* @param h5 realtek h5 struct +* @byte pure data in the one byte +*/ +static void h5_unslip_one_byte(rtk_hw_cfg_t * h5, unsigned char byte) +{ + const RT_U8 c0 = 0xc0, db = 0xdb; + const RT_U8 oof1 = 0x11, oof2 = 0x13; + + if (H5_ESCSTATE_NOESC == h5->rx_esc_state) { + if (0xdb == byte) { + h5->rx_esc_state = H5_ESCSTATE_ESC; + } else { + memcpy(skb_put(h5->rx_skb, 1), &byte, 1); + //Check Pkt Header's CRC enable bit + if ((h5->rx_skb->data[0] & 0x40) != 0 + && h5->rx_state != H5_W4_CRC) { + h5_crc_update(&h5->message_crc, byte); + } + h5->rx_count--; + } + } else if (H5_ESCSTATE_ESC == h5->rx_esc_state) { + switch (byte) { + case 0xdc: + memcpy(skb_put(h5->rx_skb, 1), &c0, 1); + if ((h5->rx_skb->data[0] & 0x40) != 0 + && h5->rx_state != H5_W4_CRC) + h5_crc_update(&h5->message_crc, 0xc0); + h5->rx_esc_state = H5_ESCSTATE_NOESC; + h5->rx_count--; + break; + + case 0xdd: + memcpy(skb_put(h5->rx_skb, 1), &db, 1); + if ((h5->rx_skb->data[0] & 0x40) != 0 + && h5->rx_state != H5_W4_CRC) + h5_crc_update(&h5->message_crc, 0xdb); + h5->rx_esc_state = H5_ESCSTATE_NOESC; + h5->rx_count--; + break; + + case 0xde: + memcpy(skb_put(h5->rx_skb, 1), &oof1, 1); + if ((h5->rx_skb->data[0] & 0x40) != 0 + && h5->rx_state != H5_W4_CRC) + h5_crc_update(&h5->message_crc, oof1); + h5->rx_esc_state = H5_ESCSTATE_NOESC; + h5->rx_count--; + break; + + case 0xdf: + memcpy(skb_put(h5->rx_skb, 1), &oof2, 1); + if ((h5->rx_skb->data[0] & 0x40) != 0 + && h5->rx_state != H5_W4_CRC) + h5_crc_update(&h5->message_crc, oof2); + h5->rx_esc_state = H5_ESCSTATE_NOESC; + h5->rx_count--; + break; + + default: + RS_ERR("Error: Invalid byte %02x after esc byte", byte); + skb_free(h5->rx_skb); + h5->rx_skb = NULL; + h5->rx_state = H5_W4_PKT_DELIMITER; + h5->rx_count = 0; + break; + } + } +} + +/** +* Prepare h5 packet, packet format as follow: +* | LSB 4 octets | 0 ~4095| 2 MSB +* |packet header | payload | data integrity check | +* +* pakcket header fromat is show below: +* | LSB 3 bits | 3 bits | 1 bits | 1 bits | +* | 4 bits | 12 bits | 8 bits MSB +* |sequence number | acknowledgement number | data integrity check present | reliable packet | +* |packet type | payload length | header checksum +* +* @param h5 realtek h5 struct +* @param data pure data +* @param len the length of data +* @param pkt_type packet type +* @return socket buff after prepare in h5 proto +*/ +static struct sk_buff *h5_prepare_pkt(rtk_hw_cfg_t * h5, RT_U8 * data, + RT_S32 len, RT_S32 pkt_type) +{ + struct sk_buff *nskb; + RT_U8 hdr[4]; + RT_U16 H5_CRC_INIT(h5_txmsg_crc); + int rel, i; + + switch (pkt_type) { + case HCI_ACLDATA_PKT: + case HCI_COMMAND_PKT: + case HCI_EVENT_PKT: + rel = 1; // reliable + break; + + case H5_ACK_PKT: + case H5_VDRSPEC_PKT: + case H5_LINK_CTL_PKT: + rel = 0; // unreliable + break; + + default: + RS_ERR("Unknown packet type"); + return NULL; + } + + // Max len of packet: (original len +4(h5 hdr) +2(crc))*2 + // (because bytes 0xc0 and 0xdb are escaped, worst case is + // when the packet is all made of 0xc0 and 0xdb :) ) + // + 2 (0xc0 delimiters at start and end). + + nskb = skb_alloc((len + 6) * 2 + 2); + if (!nskb) + return NULL; + + //Add SLIP start byte: 0xc0 + h5_slip_msgdelim(nskb); + // set AckNumber in SlipHeader + hdr[0] = h5->rxseq_txack << 3; + h5->is_txack_req = 0; + + //RS_DBG("We request packet no(%u) to card", h5->rxseq_txack); + //RS_DBG("Sending packet with seqno %u and wait %u", h5->msgq_txseq, h5->rxseq_txack); + if (rel) { + // set reliable pkt bit and SeqNumber + hdr[0] |= 0x80 + h5->msgq_txseq; + //RS_DBG("Sending packet with seqno(%u)", h5->msgq_txseq); + ++(h5->msgq_txseq); + h5->msgq_txseq = (h5->msgq_txseq) & 0x07; + } + // set DicPresent bit + if (h5->use_crc) + hdr[0] |= 0x40; + + // set packet type and payload length + hdr[1] = ((len << 4) & 0xff) | pkt_type; + hdr[2] = (RT_U8) (len >> 4); + // set checksum + hdr[3] = ~(hdr[0] + hdr[1] + hdr[2]); + + // Put h5 header */ + for (i = 0; i < 4; i++) { + h5_slip_one_byte(nskb, hdr[i]); + + if (h5->use_crc) + h5_crc_update(&h5_txmsg_crc, hdr[i]); + } + + // Put payload */ + for (i = 0; i < len; i++) { + h5_slip_one_byte(nskb, data[i]); + + if (h5->use_crc) + h5_crc_update(&h5_txmsg_crc, data[i]); + } + + // Put CRC */ + if (h5->use_crc) { + h5_txmsg_crc = bit_rev16(h5_txmsg_crc); + h5_slip_one_byte(nskb, (RT_U8) ((h5_txmsg_crc >> 8) & 0x00ff)); + h5_slip_one_byte(nskb, (RT_U8) (h5_txmsg_crc & 0x00ff)); + } + // Add SLIP end byte: 0xc0 + h5_slip_msgdelim(nskb); + return nskb; +} + +/** +* Removed controller acked packet from Host's unacked lists +* +* @param h5 realtek h5 struct +*/ +static void h5_remove_acked_pkt(rtk_hw_cfg_t * h5) +{ + int pkts_to_be_removed = 0; + int seqno = 0; + int i = 0; + + seqno = h5->msgq_txseq; + //pkts_to_be_removed = GetListLength(h5->unacked); + + while (pkts_to_be_removed) { + if (h5->rxack == seqno) + break; + + pkts_to_be_removed--; + seqno = (seqno - 1) & 0x07; + } + + if (h5->rxack != seqno) { + RS_DBG("Peer acked invalid packet"); + } + //skb_queue_walk_safe(&h5->unack, skb, tmp) // remove ack'ed packet from h5->unack queue + for (i = 0; i < 5; ++i) { + if (i >= pkts_to_be_removed) + break; + i++; + //__skb_unlink(skb, &h5->unack); + //skb_free(skb); + } + + // if (skb_queue_empty(&h5->unack)) + // del_timer(&h5->th5); + // spin_unlock_irqrestore(&h5->unack.lock, flags); + + if (i != pkts_to_be_removed) + RS_DBG("Removed only (%u) out of (%u) pkts", i, + pkts_to_be_removed); +} + +/** +* Realtek send pure ack, send a packet only with an ack +* +* @param fd uart file descriptor +* +*/ +static void rtk_send_pure_ack_down(int fd) +{ + struct sk_buff *nskb = h5_prepare_pkt(&rtk_hw_cfg, NULL, 0, H5_ACK_PKT); + write(fd, nskb->data, nskb->data_len); + skb_free(nskb); + return; +} + +/** +* Parse hci event command complete, pull the cmd complete event header +* +* @param skb socket buffer +* +*/ +static void hci_event_cmd_complete(struct sk_buff *skb) +{ + struct hci_event_hdr *hdr = (struct hci_event_hdr *)skb->data; + struct hci_ev_cmd_complete *ev = NULL; + RT_U16 opcode = 0; + RT_U8 status = 0; + + //pull hdr + skb_pull(skb, HCI_EVENT_HDR_SIZE); + ev = (struct hci_ev_cmd_complete *)skb->data; + opcode = le16_to_cpu(ev->opcode); + + RS_DBG("receive hci command complete event with command:%x\n", opcode); + + //pull command complete event header + skb_pull(skb, sizeof(struct hci_ev_cmd_complete)); + + switch (opcode) { + case HCI_VENDOR_CHANGE_BDRATE: + status = skb->data[0]; + RS_DBG("Change BD Rate with status:%x", status); + skb_free(rtk_hw_cfg.host_last_cmd); + rtk_hw_cfg.host_last_cmd = NULL; + rtk_hw_cfg.link_estab_state = H5_PATCH; + break; + + case HCI_CMD_READ_BD_ADDR: + status = skb->data[0]; + RS_DBG("Read BD Address with Status:%x", status); + if (!status) { + RS_DBG("BD Address: %8x%8x", *(int *)&skb->data[1], + *(int *)&skb->data[5]); + } + break; + + case HCI_CMD_READ_LOCAL_VERISION: + rtk_hw_cfg.hci_version_cmd_state = event_received; + status = skb->data[0]; + RS_DBG("Read Local Version Information with Status:%x", status); + if (0 == status) { + rtk_hw_cfg.hci_ver = skb->data[1]; + rtk_hw_cfg.hci_rev = (skb->data[2] | skb->data[3] << 8); + rtk_hw_cfg.lmp_subver = + (skb->data[7] | (skb->data[8] << 8)); + RS_DBG("HCI Version 0x%02x", rtk_hw_cfg.hci_ver); + RS_DBG("HCI Revision 0x%04x", rtk_hw_cfg.hci_rev); + RS_DBG("LMP Subversion 0x%04x", rtk_hw_cfg.lmp_subver); + } else { + RS_ERR("Read Local Version Info status error!"); + //Need to do more + } + skb_free(rtk_hw_cfg.host_last_cmd); + rtk_hw_cfg.host_last_cmd = NULL; + break; + + case HCI_VENDOR_READ_RTK_ROM_VERISION: + rtk_hw_cfg.rom_version_cmd_state = event_received; + status = skb->data[0]; + RS_DBG("Read RTK rom version with Status:%x", status); + if (0 == status) + rtk_hw_cfg.eversion = skb->data[1]; + else if (1 == status) + rtk_hw_cfg.eversion = 0; + else { + RS_ERR("READ_RTK_ROM_VERISION return status error!"); + //Need to do more + } + + skb_free(rtk_hw_cfg.host_last_cmd); + rtk_hw_cfg.host_last_cmd = NULL; + break; + case HCI_VENDOR_READ_CHIP_TYPE: + rtk_hw_cfg.chip_type_cmd_state = event_received; + status = skb->data[0]; + RS_DBG("Read RTK chip type with Status:%x", status); + if (0 == status) + rtk_hw_cfg.chip_type= (skb->data[1] & 0x0f); + else + RS_ERR("READ_RTK_CHIP_TYPE return status error!"); + skb_free(rtk_hw_cfg.host_last_cmd); + rtk_hw_cfg.host_last_cmd = NULL; + break; + default: + return; + } + rtk_hw_cfg.num_of_cmd_sent++; +} + +/** +* Check if it's a hci frame, if it is, complete it with response or parse the cmd complete event +* +* @param skb socket buffer +* +*/ +static void hci_recv_frame(struct sk_buff *skb) +{ + int len; + unsigned char h5sync[2] = { 0x01, 0x7E }, h5syncresp[2] = { + 0x02, 0x7D}, h5_sync_resp_pkt[0x8] = { + 0xc0, 0x00, 0x2F, 0x00, 0xD0, 0x02, 0x7D, 0xc0}, + h5_conf_resp_pkt_to_Ctrl[0x8] = { + 0xc0, 0x00, 0x2F, 0x00, 0xD0, 0x04, 0x7B, 0xc0}, h5conf[3] = { + 0x03, 0xFC, 0x10}, h5confresp[3] = { + 0x04, 0x7B, 0x10}, cmd_complete_evt_code = 0xe; + + if (rtk_hw_cfg.link_estab_state == H5_SYNC) { + if (!memcmp(skb->data, h5sync, 2)) { + RS_DBG("Get SYNC Pkt\n"); + len = + write(rtk_hw_cfg.serial_fd, &h5_sync_resp_pkt, 0x8); + } else if (!memcmp(skb->data, h5syncresp, 2)) { + RS_DBG("Get SYNC Resp Pkt\n"); + rtk_hw_cfg.link_estab_state = H5_CONFIG; + } + skb_free(skb); + } else if (rtk_hw_cfg.link_estab_state == H5_CONFIG) { + if (!memcmp(skb->data, h5sync, 0x2)) { + len = + write(rtk_hw_cfg.serial_fd, &h5_sync_resp_pkt, 0x8); + RS_DBG("Get SYNC pkt-active mode\n"); + } else if (!memcmp(skb->data, h5conf, 0x2)) { + len = + write(rtk_hw_cfg.serial_fd, + &h5_conf_resp_pkt_to_Ctrl, 0x8); + RS_DBG("Get CONFG pkt-active mode\n"); + } else if (!memcmp(skb->data, h5confresp, 0x2)) { + RS_DBG("Get CONFG resp pkt-active mode\n"); + rtk_hw_cfg.link_estab_state = H5_INIT; + } else { + RS_DBG("H5_CONFIG receive event\n"); + rtk_send_pure_ack_down(rtk_hw_cfg.serial_fd); + } + skb_free(skb); + } else if (rtk_hw_cfg.link_estab_state == H5_INIT) { + if (skb->data[0] == cmd_complete_evt_code) { + hci_event_cmd_complete(skb); + } + + rtk_send_pure_ack_down(rtk_hw_cfg.serial_fd); + usleep(10000); + rtk_send_pure_ack_down(rtk_hw_cfg.serial_fd); + usleep(10000); + rtk_send_pure_ack_down(rtk_hw_cfg.serial_fd); + skb_free(skb); + } else if (rtk_hw_cfg.link_estab_state == H5_PATCH) { + if (skb->data[0] != 0x0e) { + RS_DBG("Received event 0x%x\n", skb->data[0]); + skb_free(skb); + rtk_send_pure_ack_down(rtk_hw_cfg.serial_fd); + return; + } + + rtk_hw_cfg.rx_index = skb->data[6]; + + RS_DBG("rtk_hw_cfg.rx_index %d\n", rtk_hw_cfg.rx_index); + + /* Download fw/config done */ + if (rtk_hw_cfg.rx_index & 0x80) { + rtk_hw_cfg.rx_index &= ~0x80; + rtk_hw_cfg.link_estab_state = H5_ACTIVE; + } + + skb_free(skb); + } else { + RS_ERR("receive packets in active state"); + skb_free(skb); + } +} + +/** +* after rx data is parsed, and we got a rx frame saved in h5->rx_skb, +* this routinue is called. +* things todo in this function: +* 1. check if it's a hci frame, if it is, complete it with response or ack +* 2. see the ack number, free acked frame in queue +* 3. reset h5->rx_state, set rx_skb to null. +* +* @param h5 realtek h5 struct +* +*/ +static void h5_complete_rx_pkt(rtk_hw_cfg_t * h5) +{ + int pass_up = 1; + uint8_t *h5_hdr = NULL; + + h5_hdr = (uint8_t *) (h5->rx_skb->data); + if (H5_HDR_RELIABLE(h5_hdr)) { + RS_DBG("Received reliable seqno %u from card", h5->rxseq_txack); + h5->rxseq_txack = H5_HDR_SEQ(h5_hdr) + 1; + h5->rxseq_txack %= 8; + h5->is_txack_req = 1; + } + + h5->rxack = H5_HDR_ACK(h5_hdr); + + switch (H5_HDR_PKT_TYPE(h5_hdr)) { + case HCI_ACLDATA_PKT: + case HCI_EVENT_PKT: + case HCI_SCODATA_PKT: + case HCI_COMMAND_PKT: + case H5_LINK_CTL_PKT: + pass_up = 1; + break; + + default: + pass_up = 0; + break; + } + + h5_remove_acked_pkt(h5); + + if (pass_up) { + skb_pull(h5->rx_skb, H5_HDR_SIZE); + hci_recv_frame(h5->rx_skb); + } else { + skb_free(h5->rx_skb); + } + + h5->rx_state = H5_W4_PKT_DELIMITER; + h5->rx_skb = NULL; +} + +/** +* Parse the receive data in h5 proto. +* +* @param h5 realtek h5 struct +* @param data point to data received before parse +* @param count num of data +* @return reserved count +*/ +static int h5_recv(rtk_hw_cfg_t * h5, void *data, int count) +{ + unsigned char *ptr; + //RS_DBG("count %d rx_state %d rx_count %ld", count, h5->rx_state, h5->rx_count); + ptr = (unsigned char *)data; + + while (count) { + if (h5->rx_count) { + if (*ptr == 0xc0) { + RS_ERR("short h5 packet"); + skb_free(h5->rx_skb); + h5->rx_state = H5_W4_PKT_START; + h5->rx_count = 0; + } else + h5_unslip_one_byte(h5, *ptr); + + ptr++; + count--; + continue; + } + + switch (h5->rx_state) { + case H5_W4_HDR: + /* check header checksum. see Core Spec V4 "3-wire uart" page 67 */ + if ((0xff & (RT_U8) ~ + (h5->rx_skb->data[0] + h5->rx_skb->data[1] + + h5->rx_skb->data[2])) != h5->rx_skb->data[3]) { + RS_ERR("h5 hdr checksum error!!!"); + skb_free(h5->rx_skb); + h5->rx_state = H5_W4_PKT_DELIMITER; + h5->rx_count = 0; + continue; + } + + /* reliable pkt & h5->hdr->SeqNumber != h5->Rxseq_txack */ + if (h5->rx_skb->data[0] & 0x80 + && (h5->rx_skb->data[0] & 0x07) != + h5->rxseq_txack) { + RS_ERR + ("Out-of-order packet arrived, got(%u)expected(%u)", + h5->rx_skb->data[0] & 0x07, + h5->rxseq_txack); + h5->is_txack_req = 1; + + skb_free(h5->rx_skb); + h5->rx_state = H5_W4_PKT_DELIMITER; + h5->rx_count = 0; + + /* depend on weather remote will reset ack numb or not!!!!!!special */ + if (rtk_hw_cfg.tx_index == rtk_hw_cfg.total_num) { + rtk_hw_cfg.rxseq_txack = + h5->rx_skb->data[0] & 0x07; + } + continue; + } + h5->rx_state = H5_W4_DATA; + h5->rx_count = + (h5->rx_skb->data[1] >> 4) + + (h5->rx_skb->data[2] << 4); + continue; + + case H5_W4_DATA: + /* pkt with crc */ + if (h5->rx_skb->data[0] & 0x40) { + h5->rx_state = H5_W4_CRC; + h5->rx_count = 2; + } else { + h5_complete_rx_pkt(h5); + //RS_DBG(DF_SLIP,("--------> H5_W4_DATA ACK\n")); + } + continue; + + case H5_W4_CRC: + if (bit_rev16(h5->message_crc) != h5_get_crc(h5)) { + RS_ERR + ("Checksum failed, computed(%04x)received(%04x)", + bit_rev16(h5->message_crc), + h5_get_crc(h5)); + skb_free(h5->rx_skb); + h5->rx_state = H5_W4_PKT_DELIMITER; + h5->rx_count = 0; + continue; + } + skb_trim(h5->rx_skb, h5->rx_skb->data_len - 2); + h5_complete_rx_pkt(h5); + continue; + + case H5_W4_PKT_DELIMITER: + switch (*ptr) { + case 0xc0: + h5->rx_state = H5_W4_PKT_START; + break; + + default: + break; + } + ptr++; + count--; + break; + + case H5_W4_PKT_START: + switch (*ptr) { + case 0xc0: + ptr++; + count--; + break; + + default: + h5->rx_state = H5_W4_HDR; + h5->rx_count = 4; + h5->rx_esc_state = H5_ESCSTATE_NOESC; + H5_CRC_INIT(h5->message_crc); + + // Do not increment ptr or decrement count + // Allocate packet. Max len of a H5 pkt= + // 0xFFF (payload) +4 (header) +2 (crc) + h5->rx_skb = skb_alloc(0x1005); + if (!h5->rx_skb) { + h5->rx_state = H5_W4_PKT_DELIMITER; + h5->rx_count = 0; + return 0; + } + break; + } + break; + + default: + break; + } + } + return count; +} + +/** +* Read data to buf from uart. +* +* @param fd uart file descriptor +* @param buf point to the addr where read data stored +* @param count num of data want to read +* @return num of data successfully read +*/ +static int read_check_rtk(int fd, void *buf, int count) +{ + int res; + do { + res = read(fd, buf, count); + if (res != -1) { + buf = (RT_U8 *) buf + res; + count -= res; + return res; + } + } while (count && (errno == 0 || errno == EINTR)); + return res; +} + +/** +* Retry to sync when timeout in h5 proto, max retry times is 10. +* +* @warning Each time to retry, the time for timeout will be set as 1s. +* +* @param sig signaction for timeout +* +*/ +static void h5_tsync_sig_alarm(int sig) +{ + unsigned char h5sync[2] = { 0x01, 0x7E }; + static int retries = 0; + struct itimerval value; + + if (retries < rtk_hw_cfg.h5_max_retries) { + retries++; + struct sk_buff *nskb = + h5_prepare_pkt(&rtk_hw_cfg, h5sync, sizeof(h5sync), + H5_LINK_CTL_PKT); + int len = + write(rtk_hw_cfg.serial_fd, nskb->data, nskb->data_len); + RS_DBG("3-wire sync pattern resend : %d, len: %d\n", retries, + len); + + skb_free(nskb); + //gordon add 2013-6-7 retry per 250ms + value.it_value.tv_sec = 0; + value.it_value.tv_usec = 250000; + value.it_interval.tv_sec = 0; + value.it_interval.tv_usec = 250000; + setitimer(ITIMER_REAL, &value, NULL); + //gordon end + + return; + } + + tcflush(rtk_hw_cfg.serial_fd, TCIOFLUSH); + RS_ERR("H5 sync timed out\n"); + exit(1); +} + +/** +* Retry to config when timeout in h5 proto, max retry times is 10. +* +* @warning Each time to retry, the time for timeout will be set as 1s. +* +* @param sig signaction for timeout +* +*/ +static void h5_tconf_sig_alarm(int sig) +{ + unsigned char h5conf[3] = { 0x03, 0xFC, 0x14 }; + static int retries = 0; + struct itimerval value; + + if (retries < rtk_hw_cfg.h5_max_retries) { + retries++; + struct sk_buff *nskb = + h5_prepare_pkt(&rtk_hw_cfg, h5conf, 3, H5_LINK_CTL_PKT); + int len = + write(rtk_hw_cfg.serial_fd, nskb->data, nskb->data_len); + RS_DBG("3-wire config pattern resend : %d , len: %d", retries, + len); + skb_free(nskb); + + //gordon add 2013-6-7 retry per 250ms + value.it_value.tv_sec = 0; + value.it_value.tv_usec = 250000; + value.it_interval.tv_sec = 0; + value.it_interval.tv_usec = 250000; + setitimer(ITIMER_REAL, &value, NULL); + + return; + } + + tcflush(rtk_hw_cfg.serial_fd, TCIOFLUSH); + RS_ERR("H5 config timed out\n"); + exit(1); +} + +/** +* Retry to init when timeout in h5 proto, max retry times is 10. +* +* @warning Each time to retry, the time for timeout will be set as 1s. +* +* @param sig signaction for timeout +* +*/ +static void h5_tinit_sig_alarm(int sig) +{ + static int retries = 0; + if (retries < rtk_hw_cfg.h5_max_retries) { + retries++; + if (rtk_hw_cfg.host_last_cmd) { + int len = + write(rtk_hw_cfg.serial_fd, + rtk_hw_cfg.host_last_cmd->data, + rtk_hw_cfg.host_last_cmd->data_len); + RS_DBG("3-wire change baudrate re send:%d, len:%d", + retries, len); + alarm(1); + return; + } else { + RS_DBG + ("3-wire init timeout without last command stored\n"); + } + } + + tcflush(rtk_hw_cfg.serial_fd, TCIOFLUSH); + RS_ERR("H5 init process timed out"); + exit(1); +} + +/** +* Retry to download patch when timeout in h5 proto, max retry times is 10. +* +* @warning Each time to retry, the time for timeout will be set as 3s. +* +* @param sig signaction for timeout +* +*/ +static void h5_tpatch_sig_alarm(int sig) +{ + static int retries = 0; + if (retries < rtk_hw_cfg.h5_max_retries) { + RS_ERR("patch timerout, retry:\n"); + if (rtk_hw_cfg.host_last_cmd) { + int len = + write(rtk_hw_cfg.serial_fd, + rtk_hw_cfg.host_last_cmd->data, + rtk_hw_cfg.host_last_cmd->data_len); + RS_DBG("3-wire download patch re send:%d", retries); + } + retries++; + alarm(3); + return; + } + RS_ERR("H5 patch timed out\n"); + exit(1); +} + +/** +* Download patch using hci. For h5 proto, not recv reply for 2s will timeout. +* Call h5_tpatch_sig_alarm for retry. +* +* @param dd uart file descriptor +* @param index current index +* @param data point to the config file +* @param len current buf length +* @return #0 on success +* +*/ +static int hci_download_patch(int dd, int index, uint8_t * data, int len, + struct termios *ti) +{ + unsigned char hcipatch[256] = { 0x20, 0xfc, 00 }; + unsigned char bytes[READ_DATA_SIZE]; + int retlen; + struct sigaction sa; + + sa.sa_handler = h5_tpatch_sig_alarm; + sigaction(SIGALRM, &sa, NULL); + alarm(2); + + download_vendor_patch_cp cp; + memset(&cp, 0, sizeof(cp)); + cp.index = index; + if (data != NULL) { + memcpy(cp.data, data, len); + } + + if (index & 0x80) + rtk_hw_cfg.tx_index = index & 0x7f; + else + rtk_hw_cfg.tx_index = index; + + hcipatch[2] = len + 1; + memcpy(hcipatch + 3, &cp, len + 1); + + struct sk_buff *nskb = h5_prepare_pkt(&rtk_hw_cfg, hcipatch, len + 4, HCI_COMMAND_PKT); //data:len+head:4 + + if (rtk_hw_cfg.host_last_cmd) { + skb_free(rtk_hw_cfg.host_last_cmd); + rtk_hw_cfg.host_last_cmd = NULL; + } + + rtk_hw_cfg.host_last_cmd = nskb; + + len = write(dd, nskb->data, nskb->data_len); + RS_DBG("hci_download_patch tx_index:%d rx_index: %d\n", + rtk_hw_cfg.tx_index, rtk_hw_cfg.rx_index); + + while (rtk_hw_cfg.rx_index != rtk_hw_cfg.tx_index) { //receive data and wait last pkt + if ((retlen = read_check_rtk(dd, &bytes, READ_DATA_SIZE)) == -1) { + RS_ERR("read fail\n"); + return -1; + } + h5_recv(&rtk_hw_cfg, &bytes, retlen); + } + + alarm(0); + + return 0; +} + +#define READ_TRY_MAX 6 +int os_read(int fd, uint8_t * buff, int len) +{ + int n; + int i; + int try = 0; + + i = 0; + n = 0; + while (n < len) { + i = read(fd, buff + n, len - n); + if (i > 0) + n += i; + else if (i == 0) { + RS_DBG("read nothing."); + continue; + } else { + RS_ERR("read error, %s\n", strerror(errno)); + try++; + if (try > READ_TRY_MAX) { + RS_ERR("read reaches max try number.\n"); + return -1; + } + continue; + } + } + + return n; +} + +#define DUMP_HCI_EVT +#ifdef DUMP_HCI_EVT +#define HCI_DUMP_BUF_LEN 128 +static char hci_dump_buf[HCI_DUMP_BUF_LEN]; +void hci_dump_evt(uint8_t * buf, uint16_t len) +{ + int n; + int i; + + if (!buf || !len) { + RS_ERR("Invalid parameters %p, %u.\n", buf, len); + return; + } + + n = 0; + for (i = 0; i < len; i++) { + n += sprintf(hci_dump_buf + n, "%02x ", buf[i]); + if ((i + 1) % 16 == 0) { + RS_DBG(" %s\n", hci_dump_buf); + n = 0; + } + } + + if (i % 16) + RS_DBG(" %s\n", hci_dump_buf); +} +#endif + +int read_hci_evt(int fd, uint8_t * buff, uint8_t evt_code) +{ + uint8_t *evt_buff = buff; + int ret; + int try_type = 0; + uint8_t vendor_evt = 0xff; + +start_read: + do { + ret = os_read(fd, evt_buff, 1); + if (ret == 1 && evt_buff[0] == 0x04) + break; + else { + RS_DBG("no pkt type, continue."); + try_type++; + continue; + } + } while (try_type < 6); + + if (try_type >= 6) + return -1; + + ret = os_read(fd, evt_buff + 1, 1); + if (ret < 0) { + RS_ERR("%s: failed to read event code\n", __func__); + return -1; + } + + ret = os_read(fd, evt_buff + 2, 1); + if (ret < 0) { + RS_ERR("%s: failed to read parameter total len.\n", __func__); + return -1; + } + + ret = os_read(fd, evt_buff + 3, evt_buff[2]); + if (ret < 0) { + RS_ERR("%s: failed to read payload of event.\n", __func__); + return -1; + } +#ifdef DUMP_HCI_EVT + hci_dump_evt(evt_buff, ret + 3); +#endif + + /* This event to wake up host. */ + if (evt_buff[1] == vendor_evt) { + try_type = 0; + RS_DBG("%s: found vendor evt, continue reading.\n", __func__); + goto start_read; + } + + if (evt_buff[1] != evt_code) { + RS_ERR("%s: event code mismatches, %x, expect %x.\n", + __func__, evt_buff[1], evt_code); + return -1; + } + + return (ret + 3); +} + +/** +* Download h4 patch +* +* @param dd uart file descriptor +* @param index current index +* @param data point to the config file +* @param len current buf length +* @return ret_index +* +*/ +static int hci_download_patch_h4(int dd, int index, uint8_t * data, int len) +{ + unsigned char bytes[257] = { 0 }; + unsigned char buf[257] = { 0x01, 0x20, 0xfc, 00 }; + uint16_t readbytes = 0; + int cur_index = index; + int ret_Index = -1; + uint16_t res = 0; + int i = 0; + size_t total_len; + uint16_t w_len; + uint8_t rstatus; + int ret; + uint8_t opcode[2] = { + 0x20, 0xfc, + }; + + RS_DBG("dd:%d, index:%d, len:%d", dd, index, len); + if (NULL != data) { + memcpy(&buf[5], data, len); + } + + buf[3] = len + 1; + buf[4] = cur_index; + total_len = len + 5; + + w_len = write(dd, buf, total_len); + RS_DBG("h4 write success with len: %d\n", w_len); + + ret = read_hci_evt(dd, bytes, 0x0e); + if (ret < 0) { + RS_ERR("%s: read hci evt error.\n", __func__); + return -1; + } + + /* RS_DBG("%s: bytes: %x %x %x %x %x %x.\n", + * __func__, bytes[0], bytes[1], bytes[2], + * bytes[3], bytes[4], bytes[5]); */ + + if ((0x04 == bytes[0]) && (opcode[0] == bytes[4]) + && (opcode[1] == bytes[5])) { + ret_Index = bytes[7]; + rstatus = bytes[6]; + RS_DBG("---->ret_Index:%d, ----->rstatus:%d\n", ret_Index, + rstatus); + if (0x00 != rstatus) { + RS_ERR("---->read event status is wrong\n"); + return -1; + } + } else { + RS_ERR("==========>Didn't read curret data\n"); + return -1; + } + + return ret_Index; +} + +/** +* Realtek change speed with h4 proto. Using vendor specified command packet to achieve this. +* +* @warning before write, need to wait 1s for device up +* +* @param fd uart file descriptor +* @param baudrate the speed want to change +* @return #0 on success +*/ +static int rtk_vendor_change_speed_h4(int fd, RT_U32 baudrate) +{ + int res; + unsigned char bytes[257]; + RT_U8 cmd[8] = { 0 }; + + cmd[0] = 1; //cmd; + cmd[1] = 0x17; //ocf + cmd[2] = 0xfc; //ogf + cmd[3] = 4; //length; + + baudrate = cpu_to_le32(baudrate); +#ifdef BAUDRATE_4BYTES + memcpy((RT_U16 *) & cmd[4], &baudrate, 4); +#else + memcpy((RT_U16 *) & cmd[4], &baudrate, 2); + cmd[6] = 0; + cmd[7] = 0; +#endif + + //wait for a while for device to up, just h4 need it + sleep(1); + RS_DBG("baudrate in change speed command: 0x%x 0x%x 0x%x 0x%x \n", + cmd[4], cmd[5], cmd[6], cmd[7]); + + if (write(fd, cmd, 8) != 8) { + RS_ERR + ("H4 change uart speed error when writing vendor command"); + return -1; + } + RS_DBG("H4 Change uart Baudrate after write "); + + res = read_hci_evt(fd, bytes, 0x0e); + if (res < 0) { + RS_ERR("%s: Failed to read hci evt.\n", __func__); + return -1; + } + + if ((0x04 == bytes[0]) && (0x17 == bytes[4]) && (0xfc == bytes[5])) { + RS_DBG("H4 change uart speed success, receving status:%x", + bytes[6]); + if (bytes[6] == 0) + return 0; + } + return -1; +} + +/** +* Parse realtek Bluetooth config file. +* The config file if begin with vendor magic: RTK_VENDOR_CONFIG_MAGIC(8723ab55) +* bt_addr is followed by 0x3c offset, it will be changed by bt_addr param +* proto, baudrate and flow control is followed by 0xc offset, +* +* @param config_buf point to config file content +* @param *plen length of config file +* @param bt_addr where bt addr is stored +* @return +* 1. new config buf +* 2. new config length *plen +* 3. result (for baudrate) +* +*/ + +uint8_t *rtk_parse_config_file(RT_U8 *config_buf, size_t *plen, + uint8_t bt_addr[6], uint32_t *result) +{ + + struct rtk_bt_vendor_config *config = + (struct rtk_bt_vendor_config *)config_buf; + RT_U16 config_len = 0, temp = 0; + struct rtk_bt_vendor_config_entry *entry = NULL; + RT_U16 i; + RT_U32 baudrate = 0; + uint32_t flags = 0; + uint32_t add_flags; +#ifdef USE_CUSTOMER_ADDRESS + uint8_t j = 0; + struct patch_info *pent = rtk_hw_cfg.patch_ent; +#endif +#ifdef EXTRA_CONFIG_OPTION + uint8_t *head = config_buf; + + add_flags = config_flags; +#endif + + if (!config || !plen) + return NULL; + + RS_INFO("Original Cfg len %u", *plen); + config_len = le16_to_cpu(config->data_len); + entry = config->entry; + + if (le32_to_cpu(config->signature) != RTK_VENDOR_CONFIG_MAGIC) { + RS_ERR("signature magic number(%x) is incorrect", + (unsigned int)config->signature); + return NULL; + } + + if (config_len != *plen - sizeof(struct rtk_bt_vendor_config)) { + RS_ERR("config len(%d) is incorrect(%zd)", config_len, + *plen - sizeof(struct rtk_bt_vendor_config)); + return NULL; + } + + for (i = 0; i < config_len;) { + + switch (le16_to_cpu(entry->offset)) { +#ifdef USE_CUSTOMER_ADDRESS + case 0x003c: + case 0x0044: + if (!customer_bdaddr) + break; + if (pent->chip_type > CHIP_BEFORE && + le16_to_cpu(entry->offset) != 0x44) + break; + if (pent->chip_type <= CHIP_BEFORE && + le16_to_cpu(entry->offset) != 0x3c) + break; + for (j = 0; j < entry->entry_len; j++) + entry->entry_data[j] = bt_addr[j]; + flags |= CONFIG_BTMAC; + RS_INFO("BT MAC found %02x:%02x:%02x:%02x:%02x:%02x", + entry->entry_data[5], + entry->entry_data[4], + entry->entry_data[3], + entry->entry_data[2], + entry->entry_data[1], + entry->entry_data[0]); + break; +#endif + case 0xc: + { +#ifdef BAUDRATE_4BYTES + baudrate = + get_unaligned_le32(entry->entry_data); +#else + baudrate = + get_unaligned_le16(entry->entry_data); +#endif + + if (entry->entry_len >= 12) //0ffset 0x18 - 0xc + { + rtk_hw_cfg.hw_flow_control = (entry->entry_data[12] & 0x4) ? 1 : 0; //0x18 byte bit2 + //rtk_hw_cfg.hw_flow_control = 0; + } + RS_DBG + ("config baud rate to :0x%08x, hwflowcontrol:%x, %x", + (unsigned int)baudrate, + entry->entry_data[12], + rtk_hw_cfg.hw_flow_control); + break; + } +#ifdef EXTRA_CONFIG_OPTION + case 0x015b: + if (!(add_flags & CONFIG_TXPOWER)) + break; + add_flags &= ~CONFIG_TXPOWER; + if (txpower_len != entry->entry_len) { + RS_ERR("invalid tx power cfg len %u, %u", + txpower_len, entry->entry_len); + break; + } + memcpy(entry->entry_data, txpower_cfg, txpower_len); + RS_INFO("Replace Tx power Cfg %02x %02x %02x %02x", + txpower_cfg[0], txpower_cfg[1], txpower_cfg[2], + txpower_cfg[3]); + break; + case 0x01e6: + if (!(add_flags & CONFIG_XTAL)) + break; + add_flags &= ~CONFIG_XTAL; + RS_INFO("Replace XTAL Cfg 0x%02x", xtal_cfg); + entry->entry_data[0] = xtal_cfg; + break; +#endif + default: + RS_DBG("cfg offset (%04x),length (%02x)", entry->offset, + entry->entry_len); + break; + } + temp = entry->entry_len + + sizeof(struct rtk_bt_vendor_config_entry); + i += temp; + entry = (struct rtk_bt_vendor_config_entry *)((RT_U8 *)entry + + temp); + } + +#ifdef USE_CUSTOMER_ADDRESS + if (!(flags & CONFIG_BTMAC) && customer_bdaddr) { + uint8_t *b; + + b = config_buf + *plen; + if (pent->chip_type > CHIP_BEFORE) { + b[0] = 0x44; + b[1] = 0x00; + } else { + b[0] = 0x3c; + b[1] = 0x00; + } + RS_INFO("add bdaddr sec, offset %02x%02x", b[1], b[0]); + b[2] = 6; + for (j = 0; j < 6; j++) + b[3 + j] = bt_addr[j]; + + *plen += 9; + config_len += 9; + temp = *plen - 6; + + config_buf[4] = (temp & 0xff); + config_buf[5] = ((temp >> 8) & 0xff); + } +#endif + +#ifdef EXTRA_CONFIG_OPTION + temp = *plen; + if (add_flags & CONFIG_TXPOWER) + temp += (2 + 1 + txpower_len); + if ((add_flags & CONFIG_XTAL)) + temp += (2 + 1 + 1); + + if (add_flags) { + RS_INFO("Add extra configs"); + config_buf = head; + temp -= sizeof(struct rtk_bt_vendor_config); + config_buf[4] = (temp & 0xff); + config_buf[5] = ((temp >> 8) & 0xff); + config_buf += *plen; + if (add_flags & CONFIG_TXPOWER) { + RS_INFO("Add Tx power Cfg"); + *config_buf++ = 0x5b; + *config_buf++ = 0x01; + *config_buf++ = txpower_len; + memcpy(config_buf, txpower_cfg, txpower_len); + config_buf += txpower_len; + } + if ((add_flags & CONFIG_XTAL)) { + RS_INFO("Add XTAL Cfg"); + *config_buf++ = 0xe6; + *config_buf++ = 0x01; + *config_buf++ = 1; + *config_buf++ = xtal_cfg; + } + *plen = config_buf - head; + config_buf = head; + } +#endif + +done: + *result = baudrate; + return config_buf; +} + +#ifdef USE_CUSTOMER_ADDRESS +int bachk(const char *str) +{ + if (!str) + return -1; + + if (strlen(str) != 17) + return -1; + + while (*str) { + if (!isxdigit(*str++)) + return -1; + + if (!isxdigit(*str++)) + return -1; + + if (*str == 0) + break; + + if (*str++ != ':') + return -1; + } + + return 0; +} +/** +* get random realtek Bluetooth addr. +* +* @param bt_addr where bt addr is stored +* +*/ +/* static void rtk_get_ram_addr(char bt_addr[0]) + * { + * srand(time(NULL) + getpid() + getpid() * 987654 + rand()); + * + * RT_U32 addr = rand(); + * memcpy(bt_addr, &addr, sizeof(RT_U8)); + * } + */ + +/** +* Write the random bt addr to the file /data/misc/bluetoothd/bt_mac/btmac.txt. +* +* @param bt_addr where bt addr is stored +* +*/ +/* static void rtk_write_btmac2file(char bt_addr[6]) + * { + * int fd; + * fd = open(BT_ADDR_FILE, O_CREAT | O_RDWR | O_TRUNC); + * + * if (fd > 0) { + * chmod(BT_ADDR_FILE, 0666); + * char addr[18] = { 0 }; + * addr[17] = '\0'; + * sprintf(addr, "%2x:%2x:%2x:%2x:%2x:%2x", bt_addr[0], bt_addr[1], + * bt_addr[2], bt_addr[3], bt_addr[4], bt_addr[5]); + * write(fd, addr, strlen(addr)); + * close(fd); + * } else { + * RS_ERR("open file error:%s\n", BT_ADDR_FILE); + * } + * } + */ +#endif + +/** +* Get realtek Bluetooth config file. The bt addr arg is stored in /data/btmac.txt, if there is not this file, +* change to /data/misc/bluetoothd/bt_mac/btmac.txt. If both of them are not found, using +* random bt addr. +* +* @param config_buf point to the content of realtek Bluetooth config file +* @param config_baud_rate the baudrate set in the config file +* @return file_len the length of config file +*/ +int rtk_get_bt_config(struct btrtl_info *btrtl, uint8_t **config_buf, + RT_U32 *config_baud_rate) +{ + char bt_config_file_name[PATH_MAX] = { 0 }; + RT_U8 *bt_addr_temp = NULL; + uint8_t bt_addr[6] = { 0x00, 0xe0, 0x4c, 0x88, 0x88, 0x88 }; + struct stat st; + size_t filelen; + size_t tlength; + int fd; + int ret = 0; + int i = 0; + +#ifdef USE_CUSTOMER_ADDRESS +#define BDADDR_STRING_LEN 17 + size_t size; + size_t result; + uint8_t tbuf[BDADDR_STRING_LEN + 1]; + char *str; + + if (stat(BT_ADDR_FILE, &st) < 0) { + RS_INFO("Couldnt access customer BT MAC file %s", + BT_ADDR_FILE); + + /* for (i = 0; i < 6; i++) + * rtk_get_ram_addr(&bt_addr[i]); + * rtk_write_btmac2file(bt_addr); + */ + goto GET_CONFIG; + } + + size = st.st_size; + /* Only read the first 17-byte if the file length is larger */ + if (size > BDADDR_STRING_LEN) + size = BDADDR_STRING_LEN; + + fd = open(BT_ADDR_FILE, O_RDONLY); + if (fd == -1) { + RS_ERR("Couldnt open BT MAC file %s, %s", BT_ADDR_FILE, + strerror(errno)); + } else { + memset(tbuf, 0, sizeof(tbuf)); + result = read(fd, tbuf, size); + close(fd); + if (result == -1) { + RS_ERR("Couldnt read BT MAC file %s, err %s", + BT_ADDR_FILE, strerror(errno)); + goto GET_CONFIG; + } + + if (bachk(tbuf) < 0) { + goto GET_CONFIG; + } + + str = tbuf; + for (i = 5; i >= 0; i--) { + bt_addr[i] = (uint8_t)strtoul(str, NULL, 16); + str += 3; + } + + /*reserve LAP addr from 0x9e8b00 to 0x9e8b3f, change to 0x008b** */ + if (0x9e == bt_addr[3] && 0x8b == bt_addr[4] + && (bt_addr[5] <= 0x3f)) { + bt_addr[3] = 0x00; + } + + RS_DBG("BT MAC is %02x:%02x:%02x:%02x:%02x:%02x", + bt_addr[5], bt_addr[4], + bt_addr[3], bt_addr[2], + bt_addr[1], bt_addr[0]); + customer_bdaddr = 1; + } +#endif + +GET_CONFIG: + //ret = sprintf(bt_config_file_name, BT_CONFIG_DIRECTORY "rtlbt_config"); + ret = sprintf(bt_config_file_name, "%s", BT_CONFIG_DIRECTORY); + strcat(bt_config_file_name, btrtl->patch_ent->config_file); + if (stat(bt_config_file_name, &st) < 0) { + RS_ERR("can't access bt config file:%s, errno:%d\n", + bt_config_file_name, errno); + return -1; + } + + filelen = st.st_size; + + if ((fd = open(bt_config_file_name, O_RDONLY)) < 0) { + perror("Can't open bt config file"); + return -1; + } + + tlength = filelen; +#ifdef USE_CUSTOMER_ADDRESS + tlength += 9; +#endif + +#ifdef EXTRA_CONFIG_OPTION + config_file_proc(EXTRA_CONFIG_FILE); + if (!xtalset_supported()) + config_flags &= ~CONFIG_XTAL; + if (config_flags & CONFIG_TXPOWER) + tlength += 7; + if (config_flags & CONFIG_XTAL) + tlength += 4; +#endif + + if ((*config_buf = malloc(tlength)) == NULL) { + RS_DBG("Couldnt malloc buffer for config (%zd)\n", tlength); + close(fd); + return -1; + } + //we may need to parse this config file. + //for easy debug, only get need data. + + if (read(fd, *config_buf, filelen) < (ssize_t) filelen) { + perror("Can't load bt config file"); + free(*config_buf); + close(fd); + return -1; + } + + *config_buf = rtk_parse_config_file(*config_buf, &filelen, bt_addr, + config_baud_rate); + util_hexdump((const uint8_t *)*config_buf, filelen); + RS_INFO("Cfg length %u", filelen); + RS_DBG("Get config baud rate from config file:%x", + (unsigned int)*config_baud_rate); + + close(fd); + return filelen; +} + +/** +* Realtek change speed with h5 proto. Using vendor specified command packet to achieve this. +* +* @warning it will waiting 2s for reply. +* +* @param fd uart file descriptor +* @param baudrate the speed want to change +* +*/ +int rtk_vendor_change_speed_h5(int fd, RT_U32 baudrate) +{ + struct sk_buff *cmd_change_bdrate = NULL; + unsigned char cmd[7] = { 0 }; + int retlen; + unsigned char bytes[READ_DATA_SIZE]; + struct sigaction sa; + + sa.sa_handler = h5_tinit_sig_alarm; + sigaction(SIGALRM, &sa, NULL); + + cmd[0] = 0x17; //ocf + cmd[1] = 0xfc; //ogf, vendor specified + + cmd[2] = 4; //length; + + baudrate = cpu_to_le32(baudrate); +#ifdef BAUDRATE_4BYTES + memcpy((RT_U16 *) & cmd[3], &baudrate, 4); +#else + memcpy((RT_U16 *) & cmd[3], &baudrate, 2); + + cmd[5] = 0; + cmd[6] = 0; +#endif + + RS_DBG("baudrate in change speed command: 0x%x 0x%x 0x%x 0x%x \n", + cmd[3], cmd[4], cmd[5], cmd[6]); + + cmd_change_bdrate = + h5_prepare_pkt(&rtk_hw_cfg, cmd, 7, HCI_COMMAND_PKT); + if (!cmd_change_bdrate) { + RS_ERR("Prepare command packet for change speed fail"); + return -1; + } + + rtk_hw_cfg.host_last_cmd = cmd_change_bdrate; + alarm(1); + write(fd, cmd_change_bdrate->data, cmd_change_bdrate->data_len); + + while (rtk_hw_cfg.link_estab_state == H5_INIT) { + if ((retlen = read_check_rtk(fd, &bytes, READ_DATA_SIZE)) == -1) { + perror("read fail"); + return -1; + } + //add pure ack check + h5_recv(&rtk_hw_cfg, &bytes, retlen); + } + + alarm(0); + return 0; +} + +/** +* Init realtek Bluetooth h5 proto. h5 proto is added by realtek in the right kernel. +* Generally there are two steps: h5 sync and h5 config +* +* @param fd uart file descriptor +* @param ti termios struct +* +*/ +int rtk_init_h5(int fd, struct termios *ti) +{ + unsigned char bytes[READ_DATA_SIZE]; + struct sigaction sa; + int retlen; + struct itimerval value; + + /* set even parity */ + ti->c_cflag |= PARENB; + ti->c_cflag &= ~(PARODD); + if (tcsetattr(fd, TCSANOW, ti) < 0) { + RS_ERR("Can't set port settings"); + return -1; + } + + rtk_hw_cfg.h5_max_retries = H5_MAX_RETRY_COUNT; + + alarm(0); + memset(&sa, 0, sizeof(sa)); + sa.sa_flags = SA_NOCLDSTOP; + sa.sa_handler = h5_tsync_sig_alarm; + sigaction(SIGALRM, &sa, NULL); + + /* h5 sync */ + h5_tsync_sig_alarm(0); + rtk_hw_cfg.link_estab_state = H5_SYNC; + while (rtk_hw_cfg.link_estab_state == H5_SYNC) { + if ((retlen = read_check_rtk(fd, &bytes, READ_DATA_SIZE)) == -1) { + RS_ERR("H5 Read Sync Response Failed"); + + value.it_value.tv_sec = 0; + value.it_value.tv_usec = 0; + value.it_interval.tv_sec = 0; + value.it_interval.tv_usec = 0; + setitimer(ITIMER_REAL, &value, NULL); + + return -1; + } + h5_recv(&rtk_hw_cfg, &bytes, retlen); + } + + value.it_value.tv_sec = 0; + value.it_value.tv_usec = 0; + value.it_interval.tv_sec = 0; + value.it_interval.tv_usec = 0; + setitimer(ITIMER_REAL, &value, NULL); + + /* h5 config */ + sa.sa_handler = h5_tconf_sig_alarm; + sigaction(SIGALRM, &sa, NULL); + h5_tconf_sig_alarm(0); + while (rtk_hw_cfg.link_estab_state == H5_CONFIG) { + if ((retlen = read_check_rtk(fd, &bytes, READ_DATA_SIZE)) == -1) { + RS_ERR("H5 Read Config Response Failed"); + value.it_value.tv_sec = 0; + value.it_value.tv_usec = 0; + value.it_interval.tv_sec = 0; + value.it_interval.tv_usec = 0; + setitimer(ITIMER_REAL, &value, NULL); + return -1; + } + h5_recv(&rtk_hw_cfg, &bytes, retlen); + } + + value.it_value.tv_sec = 0; + value.it_value.tv_usec = 0; + value.it_interval.tv_sec = 0; + value.it_interval.tv_usec = 0; + setitimer(ITIMER_REAL, &value, NULL); + + rtk_send_pure_ack_down(fd); + RS_DBG("H5 init finished\n"); + + rtk_hw_cfg.rom_version_cmd_state = cmd_not_send; + rtk_hw_cfg.hci_version_cmd_state = cmd_not_send; + return 0; +} + +/** +* Download realtek firmware and config file from uart with the proto. +* Parse the content to serval packets follow the proto and then write the packets from uart +* +* @param fd uart file descriptor +* @param buf addr where stor the content of firmware and config file +* @param filesize length of buf +* @param is_sent_changerate if baudrate need to be changed +* @param proto realtek Bluetooth protocol, shall be either HCI_UART_H4 or HCI_UART_3WIRE +* +*/ +static int rtk_download_fw_config(int fd, RT_U8 * buf, size_t filesize, + int is_sent_changerate, int proto, + struct termios *ti) +{ + uint8_t iCurIndex = 0; + uint8_t iCurLen = 0; + uint8_t iEndIndex = 0; + uint8_t iLastPacketLen = 0; + uint8_t iAdditionPkt = 0; + uint8_t iTotalIndex = 0; + uint8_t iCmdSentNum = 0; + unsigned char *bufpatch; + uint8_t i, j; + + iEndIndex = (uint8_t) ((filesize - 1) / PATCH_DATA_FIELD_MAX_SIZE); + iLastPacketLen = (filesize) % PATCH_DATA_FIELD_MAX_SIZE; + + /* if (is_sent_changerate) + * iCmdSentNum++; + * if (rtk_hw_cfg.rom_version_cmd_state >= cmd_has_sent) + * iCmdSentNum++; + * if (rtk_hw_cfg.hci_version_cmd_state >= cmd_has_sent) + * iCmdSentNum++; */ + iCmdSentNum += rtk_hw_cfg.num_of_cmd_sent; + + iAdditionPkt = + (iEndIndex + 1 + iCmdSentNum) % 8 ? (8 - + (iEndIndex + 1 + + iCmdSentNum) % 8) : 0; + iTotalIndex = iAdditionPkt + iEndIndex; + rtk_hw_cfg.total_num = iTotalIndex; //init TotalIndex + + RS_DBG("iEndIndex:%d iLastPacketLen:%d iAdditionpkt:%d\n", iEndIndex, + iLastPacketLen, iAdditionPkt); + + if (iLastPacketLen == 0) + iLastPacketLen = PATCH_DATA_FIELD_MAX_SIZE; + + bufpatch = buf; + + for (i = 0; i <= iTotalIndex; i++) { + /* Index will roll over when it reaches 0x80. */ + if (i > 0x7f) + j = (i & 0x7f) + 1; + else + j = i; + + if (i < iEndIndex) { + iCurIndex = j; + iCurLen = PATCH_DATA_FIELD_MAX_SIZE; + } else if (i == iEndIndex) { + /* Send last data packets */ + if (i == iTotalIndex) + iCurIndex = j | 0x80; + else + iCurIndex = j; + iCurLen = iLastPacketLen; + } else if (i < iTotalIndex) { + /* Send additional packets */ + iCurIndex = j; + bufpatch = NULL; + iCurLen = 0; + RS_DBG("Send additional packet %u", iCurIndex); + } else { + /* Send end packet */ + iCurIndex = j | 0x80; + bufpatch = NULL; + iCurLen = 0; + RS_DBG("Send end packet %u", iCurIndex); + } + + if (iCurIndex & 0x80) + RS_DBG("Send FW last command"); + + if (proto == HCI_UART_H4) { + iCurIndex = hci_download_patch_h4(fd, iCurIndex, + bufpatch, iCurLen); + if ((iCurIndex != j) && (i != rtk_hw_cfg.total_num)) { + RS_DBG( + "index mismatch j %d, iCurIndex:%d, fail\n", + j, iCurIndex); + return -1; + } + } else if (proto == HCI_UART_3WIRE) { + if (hci_download_patch(fd, iCurIndex, bufpatch, iCurLen, + ti) < 0) + return -1; + } + + if (iCurIndex < iEndIndex) { + bufpatch += PATCH_DATA_FIELD_MAX_SIZE; + } + } + + /* Set last ack packet down */ + if (proto == HCI_UART_3WIRE) { + rtk_send_pure_ack_down(fd); + } + + return 0; +} + +/** +* Get realtek Bluetooth firmaware file. The content will be saved in *fw_buf which is malloc here. +* The length malloc here will be lager than length of firmware file if there is a config file. +* The content of config file will copy to the tail of *fw_buf in rtk_config. +* +* @param fw_buf point to the addr where stored the content of firmware. +* @param addi_len length of config file. +* @return length of *fw_buf. +* +*/ +int rtk_get_bt_firmware(struct btrtl_info *btrtl, RT_U8 **fw_buf) +{ + const char *filename; + struct stat st; + int fd = -1; + size_t fwsize; + static char firmware_file_name[PATH_MAX] = { 0 }; + int ret = 0; + + sprintf(firmware_file_name, "%s", FIRMWARE_DIRECTORY); + strcat(firmware_file_name, btrtl->patch_ent->patch_file); + filename = firmware_file_name; + + if (stat(filename, &st) < 0) { + RS_ERR("Can't access firmware %s, %s", filename, + strerror(errno)); + return -1; + } + + fwsize = st.st_size; + + if ((fd = open(filename, O_RDONLY)) < 0) { + RS_ERR("Can't open firmware, errno:%d", errno); + return -1; + } + + if (!(*fw_buf = malloc(fwsize))) { + RS_ERR("Can't alloc memory for fw&config, errno:%d", errno); + close(fd); + return -1; + } + + if (read(fd, *fw_buf, fwsize) < (ssize_t) fwsize) { + free(*fw_buf); + *fw_buf = NULL; + close(fd); + return -1; + } + RS_DBG("Load FW OK"); + close(fd); + return fwsize; +} + +//These two function(rtk<-->uart speed transfer) need check Host uart speed at first!!!! IMPORTANT +//add more speed if neccessary +typedef struct _baudrate_ex { + RT_U32 rtk_speed; + int uart_speed; +} baudrate_ex; + +#ifdef BAUDRATE_4BYTES +baudrate_ex baudrates[] = { +#ifdef RTL_8703A_SUPPORT + {0x00004003, 1500000}, /* for rtl8703as */ +#endif + {0x0252C014, 115200}, + {0x0252C00A, 230400}, + {0x05F75004, 921600}, + {0x00005004, 1000000}, + {0x04928002, 1500000}, + {0x01128002, 1500000}, //8761AT + {0x00005002, 2000000}, + {0x0000B001, 2500000}, + {0x04928001, 3000000}, + {0x052A6001, 3500000}, + {0x00005001, 4000000}, +}; +#else +baudrate_ex baudrates[] = { + {0x701d, 115200} + {0x6004, 921600}, + {0x4003, 1500000}, + {0x5002, 2000000}, + {0x8001, 3000000}, + {0x9001, 3000000}, + {0x7001, 3500000}, + {0x5001, 4000000}, +}; +#endif + +/** +* Change realtek Bluetooth speed to uart speed. It is matching in the struct baudrates: +* +* @code +* baudrate_ex baudrates[] = +* { +* {0x7001, 3500000}, +* {0x6004, 921600}, +* {0x4003, 1500000}, +* {0x5001, 4000000}, +* {0x5002, 2000000}, +* {0x8001, 3000000}, +* {0x701d, 115200} +* }; +* @endcode +* +* If there is no match in baudrates, uart speed will be set as #115200. +* +* @param rtk_speed realtek Bluetooth speed +* @param uart_speed uart speed +* +*/ +static void rtk_speed_to_uart_speed(RT_U32 rtk_speed, RT_U32 * uart_speed) +{ + *uart_speed = 115200; + + unsigned int i; + for (i = 0; i < sizeof(baudrates) / sizeof(baudrate_ex); i++) { + if (baudrates[i].rtk_speed == rtk_speed) { + *uart_speed = baudrates[i].uart_speed; + return; + } + } + return; +} + +/** +* Change uart speed to realtek Bluetooth speed. It is matching in the struct baudrates: +* +* @code +* baudrate_ex baudrates[] = +* { +* {0x7001, 3500000}, +* {0x6004, 921600}, +* {0x4003, 1500000}, +* {0x5001, 4000000}, +* {0x5002, 2000000}, +* {0x8001, 3000000}, +* {0x701d, 115200} +* }; +* @endcode +* +* If there is no match in baudrates, realtek Bluetooth speed will be set as #0x701D. +* +* @param uart_speed uart speed +* @param rtk_speed realtek Bluetooth speed +* +*/ +static inline void uart_speed_to_rtk_speed(int uart_speed, RT_U32 * rtk_speed) +{ + *rtk_speed = 0x701D; + + unsigned int i; + for (i = 0; i < sizeof(baudrates) / sizeof(baudrate_ex); i++) { + if (baudrates[i].uart_speed == uart_speed) { + *rtk_speed = baudrates[i].rtk_speed; + return; + } + } + + return; +} + +static void rtk_get_chip_type_timeout(int sig) +{ + static int retries = 0; + int len = 0; + struct btrtl_info *btrtl = &rtk_hw_cfg; + + RS_INFO("RTK get HCI_VENDOR_READ_RTK_CHIP_TYPE_Command\n"); + if (retries < btrtl->h5_max_retries) { + RS_DBG("rtk get chip type timerout, retry:%d\n", retries); + if (btrtl->host_last_cmd) { + len = write(btrtl->serial_fd, + btrtl->host_last_cmd->data, + btrtl->host_last_cmd->data_len); + } + retries++; + alarm(3); + return; + } + tcflush(btrtl->serial_fd, TCIOFLUSH); + RS_ERR("rtk get chip type cmd complete event timed out\n"); + exit(1); +} + +void rtk_get_chip_type(int dd) +{ + unsigned char bytes[READ_DATA_SIZE]; + int retlen; + struct sigaction sa; + /* 0xB000A094 */ + unsigned char cmd_buff[] = {0x61, 0xfc, + 0x05, 0x00, 0x94, 0xa0, 0x00, 0xb0}; + struct sk_buff *nskb; + struct btrtl_info *btrtl = &rtk_hw_cfg; + + nskb = h5_prepare_pkt(btrtl, cmd_buff, sizeof(cmd_buff), + HCI_COMMAND_PKT); + if (btrtl->host_last_cmd){ + skb_free(btrtl->host_last_cmd); + btrtl->host_last_cmd = NULL; + } + + btrtl->host_last_cmd = nskb; + + write(dd, nskb->data, nskb->data_len); + RS_INFO("RTK send HCI_VENDOR_READ_CHIP_TYPE_Command\n"); + + alarm(0); + memset(&sa, 0, sizeof(sa)); + sa.sa_flags = SA_NOCLDSTOP; + sa.sa_handler = rtk_get_chip_type_timeout; + sigaction(SIGALRM, &sa, NULL); + + alarm(3); + while (btrtl->chip_type_cmd_state != event_received) { + if ((retlen = read_check_rtk(dd, &bytes, READ_DATA_SIZE)) == -1) { + perror("rtk get chip type: read fail"); + return; + } + h5_recv(btrtl, &bytes, retlen); + } + alarm(0); + return; +} + +static void rtk_get_eversion_timeout(int sig) +{ + static int retries = 0; + int len = 0; + + RS_DBG("RTK get HCI_VENDOR_READ_RTK_ROM_VERISION_Command\n"); + if (retries < rtk_hw_cfg.h5_max_retries) { + RS_DBG("rtk get eversion timerout, retry:%d\n", retries); + if (rtk_hw_cfg.host_last_cmd) { + len = write(rtk_hw_cfg.serial_fd, + rtk_hw_cfg.host_last_cmd->data, + rtk_hw_cfg.host_last_cmd->data_len); + } + retries++; + alarm(3); + return; + } + tcflush(rtk_hw_cfg.serial_fd, TCIOFLUSH); + RS_ERR("rtk get eversion cmd complete event timed out\n"); + exit(1); +} + +/** +* Send vendor cmd to get eversion: 0xfc6d +* If Rom code does not support this cmd, use default. +*/ +void rtk_get_eversion(int dd) +{ + unsigned char bytes[READ_DATA_SIZE]; + int retlen; + struct sigaction sa; + unsigned char read_rom_patch_cmd[3] = { 0x6d, 0xfc, 00 }; + struct sk_buff *nskb = + h5_prepare_pkt(&rtk_hw_cfg, read_rom_patch_cmd, 3, HCI_COMMAND_PKT); + + if (rtk_hw_cfg.host_last_cmd) { + skb_free(rtk_hw_cfg.host_last_cmd); + rtk_hw_cfg.host_last_cmd = NULL; + } + + rtk_hw_cfg.host_last_cmd = nskb; + + write(dd, nskb->data, nskb->data_len); + rtk_hw_cfg.rom_version_cmd_state = cmd_has_sent; + RS_DBG("RTK send HCI_VENDOR_READ_RTK_ROM_VERISION_Command\n"); + + alarm(0); + memset(&sa, 0, sizeof(sa)); + sa.sa_flags = SA_NOCLDSTOP; + sa.sa_handler = rtk_get_eversion_timeout; + sigaction(SIGALRM, &sa, NULL); + + alarm(3); + while (rtk_hw_cfg.rom_version_cmd_state != event_received) { + if ((retlen = read_check_rtk(dd, &bytes, READ_DATA_SIZE)) == -1) { + perror("rtk get eversion: read fail"); + return; + } + h5_recv(&rtk_hw_cfg, &bytes, retlen); + } + alarm(0); + return; +} + +static void rtk_get_lmp_version_timeout(int sig) +{ + static int retries = 0; + RS_DBG("RTK get HCI_VENDOR_READ_RTK_LMP_VERISION_Command\n"); + if (retries < rtk_hw_cfg.h5_max_retries) { + RS_DBG("rtk get lmp version timeout, retry: %d\n", retries); + if (rtk_hw_cfg.host_last_cmd) { + int len = write(rtk_hw_cfg.serial_fd, + rtk_hw_cfg.host_last_cmd->data, + rtk_hw_cfg.host_last_cmd->data_len); + } + retries++; + alarm(3); + return; + } + tcflush(rtk_hw_cfg.serial_fd, TCIOFLUSH); + RS_ERR("rtk get lmp version cmd complete event timed out\n"); + exit(1); +} + +void rtk_get_lmp_version(int dd) +{ + unsigned char bytes[READ_DATA_SIZE]; + int retlen; + struct sigaction sa; + unsigned char read_rom_patch_cmd[3] = { 0x01, 0x10, 00 }; + struct sk_buff *nskb = h5_prepare_pkt(&rtk_hw_cfg, read_rom_patch_cmd, 3, HCI_COMMAND_PKT); //data:len+head:4 + + if (rtk_hw_cfg.host_last_cmd) { + skb_free(rtk_hw_cfg.host_last_cmd); + rtk_hw_cfg.host_last_cmd = NULL; + } + + rtk_hw_cfg.host_last_cmd = nskb; + + write(dd, nskb->data, nskb->data_len); + rtk_hw_cfg.hci_version_cmd_state = cmd_has_sent; + RS_DBG("RTK send HCI_VENDOR_READ_RTK_ROM_VERISION_Command\n"); + + alarm(0); + memset(&sa, 0, sizeof(sa)); + sa.sa_flags = SA_NOCLDSTOP; + sa.sa_handler = rtk_get_lmp_version_timeout; + sigaction(SIGALRM, &sa, NULL); + + alarm(3); + while (rtk_hw_cfg.hci_version_cmd_state != event_received) { + if ((retlen = read_check_rtk(dd, &bytes, READ_DATA_SIZE)) == -1) { + perror("read fail"); + return; + } + h5_recv(&rtk_hw_cfg, &bytes, retlen); + } + alarm(0); + return; +} + +static int rtk_max_retries = 5; + +static void rtk_local_ver_sig_alarm(int sig) +{ + uint8_t cmd[4] = { 0x01, 0x01, 0x10, 0x00 }; + static int retries; + + if (retries < rtk_max_retries) { + retries++; + if (write(rtk_hw_cfg.serial_fd, cmd, sizeof(cmd)) < 0) + return; + alarm(1); + return; + } + + tcflush(rtk_hw_cfg.serial_fd, TCIOFLUSH); + RS_ERR("init timed out, read local ver fails"); + exit(1); +} + +static void rtk_hci_local_ver(int fd) +{ + struct sigaction sa; + uint8_t result[258]; + int ret; + + alarm(0); + + memset(&sa, 0, sizeof(sa)); + sa.sa_flags = SA_NOCLDSTOP; + sa.sa_handler = rtk_local_ver_sig_alarm; + sigaction(SIGALRM, &sa, NULL); + + rtk_local_ver_sig_alarm(0); + + while (1) { + ret = read_hci_evt(fd, result, 0x0e); + /* break down is not needed if read fails, because the program + * will exit when alarm timeout + */ + if (ret < 0) + RS_ERR("%s: Read HCI event error.", __func__); + else + break; + } + + /* Cancel pending alarm */ + alarm(0); + + if (ret != 15) { + RS_ERR("%s: incorrect complete event, len %u", __func__, ret); + exit(1); + } + + if (result[6]) { + RS_ERR("%s: status is %u", __func__, result[6]); + exit(1); + } + + rtk_hw_cfg.hci_rev = (uint32_t)result[9] << 8 | result[8]; + rtk_hw_cfg.lmp_subver = (uint32_t)result[14] << 8 | result[13]; +} + +static void rtk_rom_ver_sig_alarm(int sig) +{ + uint8_t cmd[4] = { 0x01, 0x6d, 0xfc, 0x00 }; + static int retries; + + if (retries < rtk_max_retries) { + retries++; + if (write(rtk_hw_cfg.serial_fd, cmd, sizeof(cmd)) < 0) + return; + alarm(1); + return; + } + + tcflush(rtk_hw_cfg.serial_fd, TCIOFLUSH); + RS_ERR("init timed out, read rom ver fails"); + exit(1); +} + +static void rtk_hci_rom_ver(int fd) +{ + struct sigaction sa; + uint8_t result[256]; + int ret; + + alarm(0); + + memset(&sa, 0, sizeof(sa)); + sa.sa_flags = SA_NOCLDSTOP; + sa.sa_handler = rtk_rom_ver_sig_alarm; + sigaction(SIGALRM, &sa, NULL); + + rtk_rom_ver_sig_alarm(0); + + while (1) { + ret = read_hci_evt(fd, result, 0x0e); + /* break down is not needed if read fails, because the program + * will exit when alarm timeout + */ + if (ret < 0) + RS_ERR("%s: Read HCI event error.", __func__); + else + break; + } + + /* Cancel pending alarm */ + alarm(0); + + if (ret != 8) { + RS_ERR("%s: incorrect complete event, len %u", __func__, ret); + exit(1); + } + + if (result[6]) { + RS_ERR("%s: status is %u", __func__, result[6]); + rtk_hw_cfg.eversion = 0; + } else + rtk_hw_cfg.eversion = result[7]; +} + +uint8_t rtk_get_fw_project_id(uint8_t * p_buf) +{ + uint8_t opcode; + uint8_t len; + uint8_t data = 0; + + do { + opcode = *p_buf; + len = *(p_buf - 1); + if (opcode == 0x00) { + if (len == 1) { + data = *(p_buf - 2); + RS_DBG + ("rtk_get_fw_project_id: opcode %d, len %d, data %d", + opcode, len, data); + break; + } else { + RS_ERR("rtk_get_fw_project_id: invalid len %d", + len); + } + } + p_buf -= len + 2; + } while (*p_buf != 0xFF); + + return data; +} + +struct rtk_epatch_entry *rtk_get_patch_entry(void) +{ + uint16_t i; + struct rtk_epatch *patch; + struct rtk_epatch_entry *entry; + uint8_t *p; + uint16_t chip_id; + uint32_t tmp; + + patch = (struct rtk_epatch *)rtk_hw_cfg.fw_buf; + entry = (struct rtk_epatch_entry *)malloc(sizeof(*entry)); + if (!entry) { + RS_ERR("failed to allocate mem for patch entry"); + return NULL; + } + + patch->number_of_patch = le16_to_cpu(patch->number_of_patch); + + RS_DBG("fw_ver 0x%08x, patch_num %d", + le32_to_cpu(patch->fw_version), patch->number_of_patch); + + for (i = 0; i < patch->number_of_patch; i++) { + RS_DBG("chip id 0x%04x", + get_unaligned_le16(rtk_hw_cfg.fw_buf + 14 + 2 * i)); + if (get_unaligned_le16(rtk_hw_cfg.fw_buf + 14 + 2 * i) == + rtk_hw_cfg.eversion + 1) { + entry->chipID = rtk_hw_cfg.eversion + 1; + entry->patch_length = + get_unaligned_le16(rtk_hw_cfg.fw_buf + 14 + + 2 * patch->number_of_patch + + 2 * i); + entry->start_offset = + get_unaligned_le32(rtk_hw_cfg.fw_buf + 14 + + 4 * patch->number_of_patch + + 4 * i); + RS_DBG("patch length is 0x%x", entry->patch_length); + RS_DBG("start offset is 0x%x", entry->start_offset); + + entry->svn_ver = get_unaligned_le32(rtk_hw_cfg.fw_buf + + entry->start_offset + + entry->patch_length - 8); + entry->coex_ver = get_unaligned_le32(rtk_hw_cfg.fw_buf + + entry->start_offset + + entry->patch_length - 12); + + RS_INFO("Svn version: %8d\n", entry->svn_ver); + tmp = ((entry->coex_ver >> 16) & 0x7ff) + + (entry->coex_ver >> 27) * 10000; + RS_INFO("Coexistence: BTCOEX_20%06d-%04x\n", tmp, + (entry->coex_ver & 0xffff)); + + break; + } + + } + + if (i == patch->number_of_patch) { + RS_ERR("failed to get entry"); + free(entry); + entry = NULL; + } + + return entry; +} + +void rtk_get_final_patch(int fd, int proto) +{ + struct btrtl_info *rtl = &rtk_hw_cfg; + uint8_t proj_id = 0; + struct rtk_epatch_entry *entry = NULL; + struct rtk_epatch *patch = (struct rtk_epatch *)rtl->fw_buf; + uint32_t svn_ver, coex_ver, tmp; + + if ((proto == HCI_UART_H4) || + ((proto == HCI_UART_3WIRE) && (rtl->lmp_subver == ROM_LMP_8723a))) { + if (memcmp(rtl->fw_buf, RTK_EPATCH_SIGNATURE, 8) == 0) { + RS_ERR("Check signature error!"); + rtl->dl_fw_flag = 0; + goto free_buf; + } else { + rtl->total_len = rtl->config_len + rtl->fw_len; + if (!(rtl->total_buf = malloc(rtl->total_len))) { + RS_ERR("Can't alloc mem for fw/config, errno:%d", + errno); + rtl->dl_fw_flag = 0; + rtl->total_len = 0; + goto free_buf; + } else { + RS_DBG("fw copy directy"); + + svn_ver = get_unaligned_le32( + rtl->fw_buf + rtl->fw_len - 8); + coex_ver = get_unaligned_le32( + rtl->fw_buf + rtl->fw_len - 12); + + RS_INFO("Svn version: %8d\n", svn_ver); + tmp = ((coex_ver >> 16) & 0x7ff) + + (coex_ver >> 27) * 10000; + RS_INFO("Coexistence: BTCOEX_20%06d-%04x\n", tmp, + (coex_ver & 0xffff)); + + memcpy(rtl->total_buf, rtl->fw_buf, + rtl->fw_len); + if (rtl->config_len) + memcpy(rtl->total_buf + + rtl->fw_len, + rtl->config_buf, + rtl->config_len); + rtl->dl_fw_flag = 1; + goto free_buf; + } + } + } + + if (memcmp(rtl->fw_buf, RTK_EPATCH_SIGNATURE, 8)) { + RS_DBG("check signature error!"); + rtl->dl_fw_flag = 0; + goto free_buf; + } + + if (memcmp + (rtl->fw_buf + rtl->fw_len - 4, + Extension_Section_SIGNATURE, 4)) { + RS_ERR("check extension section signature error"); + rtl->dl_fw_flag = 0; + goto free_buf; + } + + proj_id = rtk_get_fw_project_id(rtl->fw_buf + rtl->fw_len - 5); + +#ifdef RTL_8703A_SUPPORT + if (rtl->hci_ver == 0x4 && rtl->lmp_subver == ROM_LMP_8723b) { + RS_DBG("HCI version = 0x4, IC is 8703A."); + } else { + RS_ERR("error: lmp_version %x, hci_version %x, project_id %x", + rtl->lmp_subver, rtl->hci_ver, project_id[proj_id]); + rtk_hw_cfg.dl_fw_flag = 0; + goto free_buf; + } +#else + if (rtl->lmp_subver != ROM_LMP_8703b) { + if (rtl->lmp_subver != project_id[proj_id]) { + RS_ERR("lmp_subver %04x, project id %04x, mismatch\n", + rtl->lmp_subver, project_id[proj_id]); + rtl->dl_fw_flag = 0; + goto free_buf; + } + } else { + /* if (rtk_hw_cfg.patch_ent->proj_id != project_id[proj_id]) { + * RS_ERR("proj_id %04x, version %04x from firmware " + * "project_id[%u], mismatch\n", + * rtk_hw_cfg.patch_ent->proj_id, + * project_id[proj_id], proj_id); + * rtk_hw_cfg.dl_fw_flag = 0; + * goto free_buf; + * } */ + } +#endif + + entry = rtk_get_patch_entry(); + + if (entry) + rtl->total_len = + entry->patch_length + rtl->config_len; + else { + rtl->dl_fw_flag = 0; + goto free_buf; + } + + if (!(rtl->total_buf = malloc(rtl->total_len))) { + RS_ERR("Can't alloc memory for multi fw&config, errno:%d", + errno); + rtl->dl_fw_flag = 0; + rtl->total_len = 0; + goto free_buf; + } else { + memcpy(rtl->total_buf, + rtl->fw_buf + entry->start_offset, + entry->patch_length); + memcpy(rtl->total_buf + entry->patch_length - 4, + &patch->fw_version, 4); + + if (rtl->config_len) + memcpy(rtl->total_buf + entry->patch_length, + rtl->config_buf, rtl->config_len); + rtl->dl_fw_flag = 1; + } + + RS_DBG("fw:%s exists, config file:%s exists", + (rtl->fw_len > 0) ? "" : "not", + (rtl->config_len > 0) ? "" : "not"); + +free_buf: + if (rtl->fw_len > 0) { + free(rtl->fw_buf); + rtl->fw_len = 0; + } + + if (rtl->config_len > 0) { + free(rtl->config_buf); + rtl->config_len = 0; + } + + if (entry) + free(entry); +} + +/** +* Config realtek Bluetooth. The configuration parameter is get from config file and fw. +* Config file is rtk8723_bt_config. which is set in rtk_get_bt_config. +* fw file is "rlt8723a_chip_b_cut_bt40_fw", which is set in get_firmware_name. +* +* @warning maybe only one of config file and fw file exists. The bt_addr arg is stored in "/data/btmac.txt" +* or "/data/misc/bluetoothd/bt_mac/btmac.txt", +* +* @param fd uart file descriptor +* @param proto realtek Bluetooth protocol, shall be either HCI_UART_H4 or HCI_UART_3WIRE +* @param speed init_speed in uart struct +* @param ti termios struct +* @returns #0 on success +*/ +static int rtk_config(int fd, int proto, int speed, struct termios *ti) +{ + int final_speed = 0; + int ret = 0; + struct btrtl_info *btrtl = &rtk_hw_cfg; + + btrtl->proto = proto; + + /* Get Local Version Information and RTK ROM version */ + if (proto == HCI_UART_3WIRE) { + RS_INFO("H5 IC"); + rtk_get_lmp_version(fd); + rtk_get_eversion(fd); + } else { + RS_INFO("H4 IC"); + rtk_hci_local_ver(fd); + rtk_hci_rom_ver(fd); + if (rtk_hw_cfg.lmp_subver == ROM_LMP_8761btc) { + rtk_hw_cfg.chip_type = CHIP_8761BTC; + rtk_hw_cfg.hw_flow_control = 1; + /* TODO: Change to different uart baud */ + uart_speed_to_rtk_speed(1500000, &rtk_hw_cfg.baudrate); + goto change_baud; + } + + if (rtk_hw_cfg.lmp_subver == ROM_LMP_8761a) { + if (rtk_hw_cfg.hci_rev == 0x000b) { + rtk_hw_cfg.chip_type = CHIP_8761B; + rtk_hw_cfg.hw_flow_control = 1; + /* TODO: Change to different uart baud */ + uart_speed_to_rtk_speed(1500000, &rtk_hw_cfg.baudrate); + goto change_baud; + } else if (rtk_hw_cfg.hci_rev == 0x000a) { + if (rtk_hw_cfg.eversion == 3) + rtk_hw_cfg.chip_type = CHIP_8761ATF; + else if (rtk_hw_cfg.eversion == 2) + rtk_hw_cfg.chip_type = CHIP_8761AT; + else + rtk_hw_cfg.chip_type = CHIP_UNKNOWN; + } + } + } + + RS_INFO("LMP Subversion 0x%04x", btrtl->lmp_subver); + RS_INFO("EVersion %d", btrtl->eversion); + + switch (rtk_hw_cfg.lmp_subver) { + case ROM_LMP_8723a: + break; + case ROM_LMP_8723b: +#ifdef RTL_8703A_SUPPORT + /* Set chip type for matching fw/config entry */ + rtl->chip_type = CHIP_8703AS; +#endif + break; + case ROM_LMP_8821a: + break; + case ROM_LMP_8761a: + break; + case ROM_LMP_8703b: + rtk_get_chip_type(fd); + break; + } + + btrtl->patch_ent = get_patch_entry(btrtl); + if (btrtl->patch_ent) { + RS_INFO("IC: %s\n", btrtl->patch_ent->ic_name); + RS_INFO("Firmware/config: %s, %s\n", + btrtl->patch_ent->patch_file, + btrtl->patch_ent->config_file); + } else { + RS_ERR("Can not find firmware/config entry\n"); + return -1; + } + + rtk_hw_cfg.config_len = + rtk_get_bt_config(btrtl, &btrtl->config_buf, &btrtl->baudrate); + if (rtk_hw_cfg.config_len < 0) { + RS_ERR("Get Config file error, just use efuse settings"); + rtk_hw_cfg.config_len = 0; + } + + rtk_hw_cfg.fw_len = rtk_get_bt_firmware(btrtl, &btrtl->fw_buf); + if (rtk_hw_cfg.fw_len < 0) { + RS_ERR("Get BT firmware error"); + rtk_hw_cfg.fw_len = 0; + return -1; + } else { + rtk_get_final_patch(fd, proto); + } + + if (rtk_hw_cfg.total_len > RTK_PATCH_LENGTH_MAX) { + RS_ERR("total length of fw&config larger than allowed"); + return -1; + } + + RS_INFO("Total len %d for fw/config", rtk_hw_cfg.total_len); + +change_baud: + /* change baudrate if needed + * rtk_hw_cfg.baudrate is a __u32/__u16 vendor-specific variable + * parsed from config file + * */ + if (rtk_hw_cfg.baudrate == 0) { + uart_speed_to_rtk_speed(speed, &rtk_hw_cfg.baudrate); + RS_DBG("No cfg file, set baudrate, : %u, 0x%08x", + (unsigned int)speed, (unsigned int)rtk_hw_cfg.baudrate); + goto SET_FLOW_CONTRL; + } else + rtk_speed_to_uart_speed(rtk_hw_cfg.baudrate, + (RT_U32 *) & (rtk_hw_cfg.final_speed)); + + if (proto == HCI_UART_3WIRE) + rtk_vendor_change_speed_h5(fd, rtk_hw_cfg.baudrate); + else + rtk_vendor_change_speed_h4(fd, rtk_hw_cfg.baudrate); + + usleep(50000); + final_speed = rtk_hw_cfg.final_speed ? rtk_hw_cfg.final_speed : speed; + RS_DBG("final_speed %d\n", final_speed); + if (set_speed(fd, ti, final_speed) < 0) { + RS_ERR("Can't set baud rate:%x, %x, %x", final_speed, + rtk_hw_cfg.final_speed, speed); + return -1; + } + +SET_FLOW_CONTRL: + if (rtk_hw_cfg.hw_flow_control) { + RS_DBG("hw flow control enable"); + ti->c_cflag |= CRTSCTS; + + if (tcsetattr(fd, TCSANOW, ti) < 0) { + RS_ERR("Can't set port settings"); + return -1; + } + } else { + RS_DBG("hw flow control disable"); + ti->c_cflag &= ~CRTSCTS; + } + + /* wait for while for controller to setup */ + usleep(10000); + + /* For 8761B Test chip, no patch to download */ + if (rtk_hw_cfg.chip_type == CHIP_8761BTC || + rtk_hw_cfg.chip_type == CHIP_8761B) + goto done; + + if ((rtk_hw_cfg.total_len > 0) && (rtk_hw_cfg.dl_fw_flag)) { + rtk_hw_cfg.link_estab_state = H5_PATCH; + rtk_hw_cfg.rx_index = -1; + + ret = + rtk_download_fw_config(fd, rtk_hw_cfg.total_buf, + rtk_hw_cfg.total_len, + rtk_hw_cfg.baudrate, proto, ti); + free(rtk_hw_cfg.total_buf); + + if (ret < 0) + return ret; + } + +done: + RS_DBG("Init Process finished"); + return 0; +} + +/** +* Init uart by realtek Bluetooth. +* +* @param fd uart file descriptor +* @param proto realtek Bluetooth protocol, shall be either HCI_UART_H4 or HCI_UART_3WIRE +* @param speed init_speed in uart struct +* @param ti termios struct +* @returns #0 on success, depend on rtk_config +*/ +int rtk_init(int fd, int proto, int speed, struct termios *ti) +{ + struct sigaction sa; + int retlen; + RS_DBG("Realtek hciattach version %s \n", RTK_VERSION); + + memset(&rtk_hw_cfg, 0, sizeof(rtk_hw_cfg)); + rtk_hw_cfg.serial_fd = fd; + rtk_hw_cfg.dl_fw_flag = 1; + + /* h4 will do nothing for init */ + if (proto == HCI_UART_3WIRE) { + if (rtk_init_h5(fd, ti) < 0) + return -1;; + } + + return rtk_config(fd, proto, speed, ti); +} + +/** +* Post uart by realtek Bluetooth. If gFinalSpeed is set, set uart speed with it. +* +* @param fd uart file descriptor +* @param proto realtek Bluetooth protocol, shall be either HCI_UART_H4 or HCI_UART_3WIRE +* @param ti termios struct +* @returns #0 on success. +*/ +int rtk_post(int fd, int proto, struct termios *ti) +{ + if (rtk_hw_cfg.final_speed) + return set_speed(fd, ti, rtk_hw_cfg.final_speed); + + return 0; +} diff --git a/bsp/meta-rockchip/recipes-devtools/rtl-tools/rtl-tools.bb b/bsp/meta-rockchip/recipes-devtools/rtl-tools/rtl-tools.bb new file mode 100644 index 0000000000000000000000000000000000000000..9289331fd8993b6423d2326b4200946ac6ed289c --- /dev/null +++ b/bsp/meta-rockchip/recipes-devtools/rtl-tools/rtl-tools.bb @@ -0,0 +1,21 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +DESCRIPTION = "Realtek develop tools" +SECTION = "devel" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6" + +SRC_URI = " \ + file://hciattach.c \ + file://hciattach.h \ + file://hciattach_rtk.c \ + file://Makefile \ +" + +S = "${WORKDIR}" + +do_install() { + install -d ${D}${bindir} + install -m 0755 rtk_hciattach ${D}${bindir} +} diff --git a/bsp/meta-rockchip/recipes-graphics/drm-cursor/drm-cursor.bb b/bsp/meta-rockchip/recipes-graphics/drm-cursor/drm-cursor.bb new file mode 100644 index 0000000000000000000000000000000000000000..2582cd9830d71d4e4de2fed5b902925ab39dd4eb --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/drm-cursor/drm-cursor.bb @@ -0,0 +1,18 @@ +# Copyright (C) 2021, Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +DESCRIPTION = "A hook of drm cursor APIs to fake cursor plane" +SECTION = "libs" + +LICENSE = "LGPL-2.1-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=d749e86a105281d7a44c2328acebc4b0" + +DEPENDS = "libdrm virtual/libgles2 virtual/libgbm" + +SRC_URI = " \ + git://github.com/JeffyCN/drm-cursor.git;protocol=https;branch=master \ +" +SRCREV = "733510b21da23a7d9bc6976624e5a0dea14dc667" +S = "${WORKDIR}/git" + +inherit meson pkgconfig diff --git a/bsp/meta-rockchip/recipes-graphics/drm/libdrm_%.bbappend b/bsp/meta-rockchip/recipes-graphics/drm/libdrm_%.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..5bf4500aa8be18c8208ee5fecee31aa8a568e884 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/drm/libdrm_%.bbappend @@ -0,0 +1,17 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +EXTRA_OECONF:append = " \ + --disable-intel \ + --disable-radeon \ + --disable-amdgpu \ + --disable-nouveau \ + --disable-vmwgfx \ + --disable-omap-experimental-api \ + --disable-etnaviv-experimental-api \ + --disable-exynos-experimental-api \ + --disable-freedreno \ + --disable-tegra-experimental-api \ + --disable-vc4 \ + --enable-install-test-programs \ +" diff --git a/bsp/meta-rockchip/recipes-graphics/mesa/mesa-gl_%.bbappend b/bsp/meta-rockchip/recipes-graphics/mesa/mesa-gl_%.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..819d384cc50eefdc61f7604d3022b8ffc79ac7ff --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/mesa/mesa-gl_%.bbappend @@ -0,0 +1,6 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +PACKAGECONFIG:class-target:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'dri3 gallium', 'osmesa', d)}" + +EXTRA_OEMESON:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'x11', '-Dglx=dri', '', d)}" diff --git a/bsp/meta-rockchip/recipes-graphics/mesa/mesa_%.bbappend b/bsp/meta-rockchip/recipes-graphics/mesa/mesa_%.bbappend deleted file mode 100644 index 0706d3252521356a0ab8346a0f5d9c5fc0f5b1af..0000000000000000000000000000000000000000 --- a/bsp/meta-rockchip/recipes-graphics/mesa/mesa_%.bbappend +++ /dev/null @@ -1 +0,0 @@ -PACKAGECONFIG:append:rk3568 = " gallium vc4 v3d kmsro ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'x11 dri3', '', d)}" diff --git a/bsp/meta-rockchip/recipes-graphics/rockchip-libmali/rockchip-libmali.bb b/bsp/meta-rockchip/recipes-graphics/rockchip-libmali/rockchip-libmali.bb new file mode 100644 index 0000000000000000000000000000000000000000..3bf90ff74207d7070ae61af753ec8e97bad38fc1 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/rockchip-libmali/rockchip-libmali.bb @@ -0,0 +1,100 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +DESCRIPTION = "Userspace Mali GPU drivers for Rockchip SoCs" +SECTION = "libs" + +LICENSE = "CLOSED" +LIC_FILES_CHKSUM = "file://END_USER_LICENCE_AGREEMENT.txt;md5=3918cc9836ad038c5a090a0280233eea" + +inherit freeze-rev local-git + +SRC_URI = " \ + git://github.com/JeffyCN/mirrors.git;protocol=https;branch=libmali; \ +" +SRCREV = "309268f7a34ca0bba0ab94a0b09feb0191c77fb8" +S = "${WORKDIR}/git" + +DEPENDS = "coreutils-native libdrm" + +PROVIDES:append = " virtual/egl virtual/libgles1 virtual/libgles2 virtual/libgles3 virtual/libgbm" + +MALI_GPU ??= "midgard-t86x" +MALI_VERSION ??= "r18p0" +MALI_SUBVERSION ??= "none" +MALI_PLATFORM ??= "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland', bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', 'gbm', d), d)}" + +# The utgard DDK would not provide OpenCL. +# The ICD OpenCL implementation should work with opencl-icd-loader. +RDEPENDS:${PN} = " \ + ${@ 'wayland' if 'wayland' == d.getVar('MALI_PLATFORM') else ''} \ + ${@ 'libx11 libxcb' if 'x11' == d.getVar('MALI_PLATFORM') else ''} \ + ${@ 'opencl-icd-loader' if not d.getVar('MALI_GPU').startswith('utgard') else ''} \ +" + +DEPENDS:append = " \ + ${@ 'wayland' if 'wayland' == d.getVar('MALI_PLATFORM') else ''} \ + ${@ 'libx11 libxcb' if 'x11' == d.getVar('MALI_PLATFORM') else ''} \ +" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +ASNEEDED = "" + +# Inject RPROVIDEs/RCONFLICTs on the generic lib name. +python __anonymous() { + pn = d.getVar('PN') + pn_dev = pn + "-dev" + d.setVar("DEBIAN_NOAUTONAME:" + pn, "1") + d.setVar("DEBIAN_NOAUTONAME:" + pn_dev, "1") + + for p in (("libegl", "libegl1"), + ("libgles1", "libglesv1-cm1"), + ("libgles2", "libglesv2-2"), + ("libgles3",)): + pkgs = " " + " ".join(p) + d.appendVar("RREPLACES:" + pn, pkgs) + d.appendVar("RPROVIDES:" + pn, pkgs) + d.appendVar("RCONFLICTS:" + pn, pkgs) + + # For -dev, the first element is both the Debian and original name + pkgs = " " + p[0] + "-dev" + d.appendVar("RREPLACES:" + pn_dev, pkgs) + d.appendVar("RPROVIDES:" + pn_dev, pkgs) + d.appendVar("RCONFLICTS:" + pn_dev, pkgs) +} + +inherit meson pkgconfig + +EXTRA_OEMESON = " \ + -Dgpu=${MALI_GPU} \ + -Dversion=${MALI_VERSION} \ + -Dsubversion=${MALI_SUBVERSION} \ + -Dplatform=${MALI_PLATFORM} \ +" + +do_install:append () { + if grep -q "\-DMESA_EGL_NO_X11_HEADERS" \ + ${D}${libdir}/pkgconfig/egl.pc; then + sed -i 's/defined(MESA_EGL_NO_X11_HEADERS)/1/' \ + ${D}${includedir}/EGL/eglplatform.h + fi +} + +INSANE_SKIP:${PN} = "already-stripped ldflags dev-so textrel" +INSANE_SKIP:${PN}-dev = "staticdev" + +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +INHIBIT_PACKAGE_STRIP = "1" + +RPROVIDES:${PN}:append = " libmali" + +FILES:${PN}-staticdev = "" +FILES:${PN}-dev = " \ + ${includedir} \ + ${libdir}/lib*.a \ + ${libdir}/pkgconfig \ +" + +# Any remaining files, including .so links for utgard DDK's internal dlopen +FILES:${PN} = "*" diff --git a/bsp/meta-rockchip/recipes-graphics/rockchip-librga/rockchip-librga.bb b/bsp/meta-rockchip/recipes-graphics/rockchip-librga/rockchip-librga.bb new file mode 100644 index 0000000000000000000000000000000000000000..e811d09f38a1126d92bf52686fbd57d0daa4ba27 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/rockchip-librga/rockchip-librga.bb @@ -0,0 +1,22 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +DESCRIPTION = "Rockchip RGA 2D graphics acceleration library" +SECTION = "libs" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://COPYING;md5=89aea4e17d99a7cacdbeed46a0096b10" + +DEPENDS = "libdrm" + +inherit freeze-rev local-git + +SRC_URI = " \ + git://github.com/JeffyCN/mirrors.git;protocol=https;branch=linux-rga; \ +" +SRCREV = "274b345f976a7b6b05bf74dcf8faf7b2e28b813d" +S = "${WORKDIR}/git" + +inherit meson pkgconfig + +EXTRA_OEMESON = "-Dlibdrm=true" diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/wayland_%.bbappend b/bsp/meta-rockchip/recipes-graphics/wayland/wayland_%.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..f5f9428f4b8491a0929b99a76e883b88395e17e2 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/wayland_%.bbappend @@ -0,0 +1,12 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +PACKAGECONFIG[no-egl] = "" + +do_install:append:rockchip() { + if ${@bb.utils.contains('PACKAGECONFIG', 'no-egl', 'true', 'false', d)}; then + rm -rf ${D}/${includedir}/wayland-egl*.h + rm -rf ${D}/${libdir}/libwayland-egl* + rm -rf ${D}/${libdir}/pkgconfig/wayland-egl* + fi +} diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_%.bbappend b/bsp/meta-rockchip/recipes-graphics/wayland/weston_%.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..00404da3a5a2e2ffd021bcc83e38090d1369d5fc --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_%.bbappend @@ -0,0 +1,4 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +inherit auto-patch diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0001-Revert-compositor-avoid-setting-WAYLAND_DISPLAY-wayl.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0001-Revert-compositor-avoid-setting-WAYLAND_DISPLAY-wayl.patch new file mode 100644 index 0000000000000000000000000000000000000000..27f8f2ffe0e571b947ff7ffc6d1b98a885aa91bc --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0001-Revert-compositor-avoid-setting-WAYLAND_DISPLAY-wayl.patch @@ -0,0 +1,61 @@ +From 2f72b0bd1cef367cfc26fcb73b6cff32945c383c Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 5 Jan 2022 14:56:17 +0800 +Subject: [PATCH 01/79] Revert "compositor: avoid setting + WAYLAND_DISPLAY=wayland-0" + +This reverts commit ae69381b6eb43ab63992906d1bf29ffd2b4df10d. + +Use "wayland-0" by default. + +Signed-off-by: Jeffy Chen +--- + compositor/main.c | 23 +++++++++-------------- + 1 file changed, 9 insertions(+), 14 deletions(-) + +diff --git a/compositor/main.c b/compositor/main.c +index 322f2ff..d7eb422 100644 +--- a/compositor/main.c ++++ b/compositor/main.c +@@ -869,29 +869,24 @@ handle_primary_client_destroyed(struct wl_listener *listener, void *data) + static int + weston_create_listening_socket(struct wl_display *display, const char *socket_name) + { +- char name_candidate[16]; +- + if (socket_name) { + if (wl_display_add_socket(display, socket_name)) { + weston_log("fatal: failed to add socket: %s\n", + strerror(errno)); + return -1; + } +- +- setenv("WAYLAND_DISPLAY", socket_name, 1); +- return 0; + } else { +- for (int i = 1; i <= 32; i++) { +- sprintf(name_candidate, "wayland-%d", i); +- if (wl_display_add_socket(display, name_candidate) >= 0) { +- setenv("WAYLAND_DISPLAY", name_candidate, 1); +- return 0; +- } ++ socket_name = wl_display_add_socket_auto(display); ++ if (!socket_name) { ++ weston_log("fatal: failed to add socket: %s\n", ++ strerror(errno)); ++ return -1; + } +- weston_log("fatal: failed to add socket: %s\n", +- strerror(errno)); +- return -1; + } ++ ++ setenv("WAYLAND_DISPLAY", socket_name, 1); ++ ++ return 0; + } + + WL_EXPORT void * +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0002-Revert-gl-renderer-Don-t-require-buffer-age-when-usi.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0002-Revert-gl-renderer-Don-t-require-buffer-age-when-usi.patch new file mode 100644 index 0000000000000000000000000000000000000000..548ca667bcd4ef7f02524e5f422740c704202f00 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0002-Revert-gl-renderer-Don-t-require-buffer-age-when-usi.patch @@ -0,0 +1,40 @@ +From c46b2c426ff4f364a9ca6b849fa3f91d679b9af3 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 11 Jan 2022 16:08:40 +0800 +Subject: [PATCH 02/79] Revert "gl-renderer: Don't require buffer age when + using partial update" + +This reverts commit a2a8d382e38fdee65adb91ce7b4e6fb280389c8f. + +This would cause blinking with MALI. + +Signed-off-by: Jeffy Chen +--- + libweston/renderer-gl/gl-renderer.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c +index a5f5eae..7231f73 100644 +--- a/libweston/renderer-gl/gl-renderer.c ++++ b/libweston/renderer-gl/gl-renderer.c +@@ -1404,7 +1404,7 @@ output_get_damage(struct weston_output *output, + EGLBoolean ret; + int i; + +- if (gr->has_egl_buffer_age || gr->has_egl_partial_update) { ++ if (gr->has_egl_buffer_age) { + ret = eglQuerySurface(gr->egl_display, go->egl_surface, + EGL_BUFFER_AGE_EXT, &buffer_age); + if (ret == EGL_FALSE) { +@@ -1444,7 +1444,7 @@ output_rotate_damage(struct weston_output *output, + struct gl_output_state *go = get_output_state(output); + struct gl_renderer *gr = get_renderer(output->compositor); + +- if (!gr->has_egl_buffer_age && !gr->has_egl_partial_update) ++ if (!gr->has_egl_buffer_age) + return; + + go->buffer_damage_index += BUFFER_DAMAGE_COUNT - 1; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0003-launcher-direct-Only-require-tty-when-vt-switching-e.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0003-launcher-direct-Only-require-tty-when-vt-switching-e.patch new file mode 100644 index 0000000000000000000000000000000000000000..220f0a2f78896d8f445b1b92f4ad62703e20d362 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0003-launcher-direct-Only-require-tty-when-vt-switching-e.patch @@ -0,0 +1,27 @@ +From 8ffe3afb0f41f07c69efa17bfce969d0d2255c9d Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 7 Jan 2021 03:38:36 +0800 +Subject: [PATCH 03/79] launcher-direct: Only require tty when vt switching + enabled + +Signed-off-by: Jeffy Chen +--- + libweston/launcher-direct.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libweston/launcher-direct.c b/libweston/launcher-direct.c +index c04ba85..87fe826 100644 +--- a/libweston/launcher-direct.c ++++ b/libweston/launcher-direct.c +@@ -318,7 +318,7 @@ launcher_direct_connect(struct weston_launcher **out, struct weston_compositor * + /* Checking the existance of /dev/tty0 and verifying it's a TTY + * device, as kernels compiled with CONFIG_VT=0 do not create these + * devices. */ +- if (stat("/dev/tty0", &buf) == 0 && ++ if (compositor->vt_switching && stat("/dev/tty0", &buf) == 0 && + strcmp("seat0", seat_id) == 0 && major(buf.st_rdev) == TTY_MAJOR) { + if (setup_tty(launcher, tty) == -1) { + free(launcher); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0004-HACK-backend-drm-Disable-DRM_CLIENT_CAP_ASPECT_RATIO.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0004-HACK-backend-drm-Disable-DRM_CLIENT_CAP_ASPECT_RATIO.patch new file mode 100644 index 0000000000000000000000000000000000000000..6e4d79c8cbdb66e5b06528dd9194442f675229c7 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0004-HACK-backend-drm-Disable-DRM_CLIENT_CAP_ASPECT_RATIO.patch @@ -0,0 +1,43 @@ +From 93ac068576e5012f519027e5e6453f11df2b575f Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 23 Jun 2020 17:17:13 +0800 +Subject: [PATCH 04/79] HACK: backend-drm: Disable DRM_CLIENT_CAP_ASPECT_RATIO + for kernel < 4.19 + +This conflicts with custom cap in Rockchip BSP 4.4 kernel. + +Signed-off-by: Jeffy Chen +--- + libweston/backend-drm/kms.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/libweston/backend-drm/kms.c b/libweston/backend-drm/kms.c +index 780d007..35113d5 100644 +--- a/libweston/backend-drm/kms.c ++++ b/libweston/backend-drm/kms.c +@@ -29,6 +29,8 @@ + + #include "config.h" + ++#include ++ + #include + + #include +@@ -1492,10 +1494,13 @@ init_kms_caps(struct drm_backend *b) + if (!b->atomic_modeset || getenv("WESTON_FORCE_RENDERER")) + b->sprites_are_broken = true; + ++ /* HACK: This conflicts with custom cap in Rockchip BSP 4.4 kernel */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0) + ret = drmSetClientCap(b->drm.fd, DRM_CLIENT_CAP_ASPECT_RATIO, 1); + b->aspect_ratio_supported = (ret == 0); + weston_log("DRM: %s picture aspect ratio\n", + b->aspect_ratio_supported ? "supports" : "does not support"); ++#endif + + return 0; + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0005-backend-drm-Bind-Nth-primary-plane-to-Nth-CRTC.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0005-backend-drm-Bind-Nth-primary-plane-to-Nth-CRTC.patch new file mode 100644 index 0000000000000000000000000000000000000000..77abf9f0f5705723dc69fad49c4f212abe2f8d0c --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0005-backend-drm-Bind-Nth-primary-plane-to-Nth-CRTC.patch @@ -0,0 +1,48 @@ +From b19a3ce2e942bd534760a4316e4a26a5dc113f67 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 2 Apr 2021 11:23:36 +0800 +Subject: [PATCH 05/79] backend-drm: Bind Nth primary plane to Nth CRTC + +The vop2 allows primary planes to bind with random CRTC, but we need to +use the same pair as the driver registered. + +Signed-off-by: Jeffy Chen +--- + libweston/backend-drm/drm.c | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index 4278770..e557d41 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -842,10 +842,26 @@ drm_output_find_special_plane(struct drm_backend *b, struct drm_output *output, + enum wdrm_plane_type type) + { + struct drm_plane *plane; ++ int num_primary; + +- wl_list_for_each(plane, &b->plane_list, link) { ++ num_primary = 0; ++ wl_list_for_each_reverse(plane, &b->plane_list, link) { + struct drm_output *tmp; + bool found_elsewhere = false; ++ bool is_primary = plane->type == WDRM_PLANE_TYPE_PRIMARY; ++ ++ if (is_primary) ++ num_primary ++; ++ ++ /** ++ * HACK: Assuming Nth primary plane (or cursor) is the primary ++ * plane for the Nth crtc. ++ * See: ++ * https://lore.kernel.org/dri-devel/20200807090706.GA2352366@phenom.ffwll.local/ ++ */ ++ if (type == WDRM_PLANE_TYPE_PRIMARY && ++ num_primary - 1 != output->crtc->pipe) ++ continue; + + if (plane->type != type) + continue; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0006-HACK-backend-drm-Avoid-random-crash-when-suspending.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0006-HACK-backend-drm-Avoid-random-crash-when-suspending.patch new file mode 100644 index 0000000000000000000000000000000000000000..af6965ba090901ffd6da80badeebdbb4a4629b90 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0006-HACK-backend-drm-Avoid-random-crash-when-suspending.patch @@ -0,0 +1,47 @@ +From 51ed2576b530653a544d58330557d7aec72fdc79 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 2 Jul 2020 14:58:49 +0800 +Subject: [PATCH 06/79] HACK: backend-drm: Avoid random crash when suspending + +Skip the repaint_status check since the weston_output_finish_frame() +could also be called when turning off dpms. + +Signed-off-by: Jeffy Chen +--- + libweston/backend-drm/drm.c | 6 ++++-- + libweston/compositor.c | 2 -- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index e557d41..d6a8588 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -280,8 +280,10 @@ drm_output_update_complete(struct drm_output *output, uint32_t flags, + wl_list_for_each(ps, &output->state_cur->plane_list, link) + ps->complete = true; + +- drm_output_state_free(output->state_last); +- output->state_last = NULL; ++ if (output->state_last) { ++ drm_output_state_free(output->state_last); ++ output->state_last = NULL; ++ } + + if (output->destroy_pending) { + output->destroy_pending = false; +diff --git a/libweston/compositor.c b/libweston/compositor.c +index f87eb37..bfb4c0f 100644 +--- a/libweston/compositor.c ++++ b/libweston/compositor.c +@@ -3156,8 +3156,6 @@ weston_output_finish_frame(struct weston_output *output, + struct timespec vblank_monotonic; + int64_t msec_rel; + +- assert(output->repaint_status == REPAINT_AWAITING_COMPLETION); +- + /* + * If timestamp of latest vblank is given, it must always go forwards. + * If not given, INVALID flag must be set. +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0007-HACK-xdg-shell-Support-setting-window-position.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0007-HACK-xdg-shell-Support-setting-window-position.patch new file mode 100644 index 0000000000000000000000000000000000000000..8799fa4d186370984bdcc7b847b6569deea60bd1 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0007-HACK-xdg-shell-Support-setting-window-position.patch @@ -0,0 +1,119 @@ +From 8501bfbe04f89db1a2c7c87c09654d3d0966c7bd Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 27 Feb 2019 17:06:58 +0800 +Subject: [PATCH 07/79] HACK: xdg-shell: Support setting window position + +Set window position when .set_window_geometry() called with size 0x0. + +Signed-off-by: Jeffy Chen +--- + desktop-shell/shell.c | 6 ++++++ + include/libweston-desktop/libweston-desktop.h | 3 +++ + include/libweston/libweston.h | 2 ++ + libweston-desktop/surface.c | 10 ++++++++++ + libweston-desktop/xdg-shell.c | 10 ++++++++++ + libweston/compositor.c | 2 ++ + 6 files changed, 33 insertions(+) + +diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c +index 63e1431..3c71192 100644 +--- a/desktop-shell/shell.c ++++ b/desktop-shell/shell.c +@@ -4243,6 +4243,12 @@ weston_view_set_initial_position(struct weston_view *view, + struct weston_seat *seat; + pixman_rectangle32_t area; + ++ if (view->has_position) { ++ weston_view_set_position(view, ++ view->geometry.x, view->geometry.y); ++ return; ++ } ++ + /* As a heuristic place the new window on the same output as the + * pointer. Falling back to the output containing 0, 0. + * +diff --git a/include/libweston-desktop/libweston-desktop.h b/include/libweston-desktop/libweston-desktop.h +index 3e7ac73..6b54d3a 100644 +--- a/include/libweston-desktop/libweston-desktop.h ++++ b/include/libweston-desktop/libweston-desktop.h +@@ -163,6 +163,9 @@ void + weston_desktop_surface_set_size(struct weston_desktop_surface *surface, + int32_t width, int32_t height); + void ++weston_desktop_surface_set_position(struct weston_desktop_surface *surface, ++ int32_t x, int32_t y); ++void + weston_desktop_surface_close(struct weston_desktop_surface *surface); + void + weston_desktop_surface_add_metadata_listener(struct weston_desktop_surface *surface, +diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h +index d99dc76..bfa7e36 100644 +--- a/include/libweston/libweston.h ++++ b/include/libweston/libweston.h +@@ -1326,6 +1326,8 @@ struct weston_view { + pixman_region32_t scissor; /* always a simple rect */ + } geometry; + ++ bool has_position; ++ + /* State derived from geometry state, read-only. + * This is updated by weston_view_update_transform(). + */ +diff --git a/libweston-desktop/surface.c b/libweston-desktop/surface.c +index 433f08a..21ff080 100644 +--- a/libweston-desktop/surface.c ++++ b/libweston-desktop/surface.c +@@ -685,6 +685,16 @@ weston_desktop_surface_get_min_size(struct weston_desktop_surface *surface) + surface->implementation_data); + } + ++void ++weston_desktop_surface_set_position(struct weston_desktop_surface *surface, ++ int32_t x, int32_t y) ++{ ++ struct weston_desktop_view *view; ++ ++ wl_list_for_each(view, &surface->view_list, link) ++ weston_view_set_position(view->view, x, y); ++} ++ + void + weston_desktop_surface_set_title(struct weston_desktop_surface *surface, + const char *title) +diff --git a/libweston-desktop/xdg-shell.c b/libweston-desktop/xdg-shell.c +index 6cbf55e..a0161f6 100644 +--- a/libweston-desktop/xdg-shell.c ++++ b/libweston-desktop/xdg-shell.c +@@ -1266,6 +1266,16 @@ weston_desktop_xdg_surface_protocol_set_window_geometry(struct wl_client *wl_cli + struct weston_desktop_xdg_surface *surface = + weston_desktop_surface_get_implementation_data(dsurface); + ++ /* HACK: For setting window position */ ++ if (!width && !height) { ++ struct weston_desktop_xdg_toplevel *toplevel = ++ weston_desktop_surface_get_implementation_data(dsurface); ++ if (!toplevel->current.state.fullscreen && ++ !toplevel->current.state.maximized) ++ weston_desktop_surface_set_position(dsurface, x, y); ++ return; ++ } ++ + if (!weston_desktop_xdg_surface_check_role(surface)) + return; + +diff --git a/libweston/compositor.c b/libweston/compositor.c +index bfb4c0f..70d7127 100644 +--- a/libweston/compositor.c ++++ b/libweston/compositor.c +@@ -1792,6 +1792,8 @@ weston_surface_damage(struct weston_surface *surface) + WL_EXPORT void + weston_view_set_position(struct weston_view *view, float x, float y) + { ++ view->has_position = true; ++ + if (view->geometry.x == x && view->geometry.y == y) + return; + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0008-compositor-Force-applying-subsurface-position-direct.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0008-compositor-Force-applying-subsurface-position-direct.patch new file mode 100644 index 0000000000000000000000000000000000000000..ecc867311e008fb98c67619b12115d3adab7e6db --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0008-compositor-Force-applying-subsurface-position-direct.patch @@ -0,0 +1,32 @@ +From 923f7189597310fc998f067b09cc43e63e4f8942 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 18 Nov 2019 12:23:48 +0800 +Subject: [PATCH 08/79] compositor: Force applying subsurface position directly + +Currently the subsurface's position would only be applied when +committing it's parent, which might not always happen. + +Force applying new position directly to avoid that. + +Signed-off-by: Jeffy Chen +--- + libweston/compositor.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/libweston/compositor.c b/libweston/compositor.c +index 70d7127..2e38c1b 100644 +--- a/libweston/compositor.c ++++ b/libweston/compositor.c +@@ -4563,6 +4563,9 @@ subsurface_set_position(struct wl_client *client, + sub->position.x = x; + sub->position.y = y; + sub->position.set = 1; ++ ++ // HACK: Force applying position directly ++ weston_subsurface_parent_commit(sub, 0); + } + + static struct weston_subsurface * +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0009-HACK-gl-renderer-Workaround-dmabuf-import-attach-for.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0009-HACK-gl-renderer-Workaround-dmabuf-import-attach-for.patch new file mode 100644 index 0000000000000000000000000000000000000000..4ea9d4ce68a67fc2b6aed5e761ef9c7d391f2401 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0009-HACK-gl-renderer-Workaround-dmabuf-import-attach-for.patch @@ -0,0 +1,140 @@ +From 9129426e8b99ebfcdf3849683b3aed3ebd351f7f Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 6 Dec 2018 18:53:05 +0800 +Subject: [PATCH 09/79] HACK: gl-renderer: Workaround dmabuf import/attach for + old mali + +Tested on px3se with libmali-utgard-400-r7p0-r3p0-wayland.so, the +mpp + waylandsink works. + +Signed-off-by: Jeffy Chen +--- + libweston/renderer-gl/gl-renderer-internal.h | 2 ++ + libweston/renderer-gl/gl-renderer.c | 34 ++++++++++++++++---- + 2 files changed, 30 insertions(+), 6 deletions(-) + +diff --git a/libweston/renderer-gl/gl-renderer-internal.h b/libweston/renderer-gl/gl-renderer-internal.h +index 72101b4..e7e1693 100644 +--- a/libweston/renderer-gl/gl-renderer-internal.h ++++ b/libweston/renderer-gl/gl-renderer-internal.h +@@ -186,6 +186,8 @@ struct gl_renderer { + */ + struct wl_list shader_list; + struct weston_log_scope *shader_scope; ++ ++ bool is_mali_egl; + }; + + static inline struct gl_renderer * +diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c +index 7231f73..053fd52 100644 +--- a/libweston/renderer-gl/gl-renderer.c ++++ b/libweston/renderer-gl/gl-renderer.c +@@ -2257,6 +2257,14 @@ import_simple_dmabuf(struct gl_renderer *gr, + attribs[atti++] = EGL_IMAGE_PRESERVED_KHR; + attribs[atti++] = EGL_TRUE; + ++ /* Old mali needs extra attributes */ ++ if (gr->is_mali_egl) { ++ attribs[atti++] = EGL_YUV_COLOR_SPACE_HINT_EXT; ++ attribs[atti++] = EGL_ITU_REC601_EXT; ++ attribs[atti++] = EGL_SAMPLE_RANGE_HINT_EXT; ++ attribs[atti++] = EGL_YUV_NARROW_RANGE_EXT; ++ } ++ + if (attributes->modifier[0] != DRM_FORMAT_MOD_INVALID) { + if (!gr->has_dmabuf_import_modifiers) + return NULL; +@@ -2661,7 +2669,7 @@ gl_renderer_query_dmabuf_formats(struct weston_compositor *wc, + + if (!gr->has_dmabuf_import_modifiers || + !gr->query_dmabuf_formats(gr->egl_display, 0, NULL, &num)) { +- num = gr->has_gl_texture_rg ? ARRAY_LENGTH(fallback_formats) : 2; ++ num = (gr->has_gl_texture_rg || gr->is_mali_egl) ? ARRAY_LENGTH(fallback_formats) : 2; + fallback = true; + } + +@@ -2791,7 +2799,7 @@ dmabuf_is_opaque(struct linux_dmabuf_buffer *dmabuf) + return pixel_format_is_opaque(info); + } + +-static void ++static int + gl_renderer_attach_dmabuf(struct weston_surface *surface, + struct weston_buffer *buffer, + struct linux_dmabuf_buffer *dmabuf) +@@ -2805,7 +2813,7 @@ gl_renderer_attach_dmabuf(struct weston_surface *surface, + if (!gr->has_dmabuf_import) { + linux_dmabuf_buffer_send_server_error(dmabuf, + "EGL dmabuf import not supported"); +- return; ++ return -1; + } + + buffer->width = dmabuf->attributes.width; +@@ -2839,7 +2847,7 @@ gl_renderer_attach_dmabuf(struct weston_surface *surface, + * Here we release the cache reference which has to be final. + */ + if (dmabuf->direct_display) +- return; ++ return -1; + + image = linux_dmabuf_buffer_get_user_data(dmabuf); + +@@ -2859,6 +2867,8 @@ gl_renderer_attach_dmabuf(struct weston_surface *surface, + } + + gs->shader_variant = image->shader_variant; ++ ++ return 0; + } + + static const struct weston_drm_format_array * +@@ -2960,7 +2970,16 @@ gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer) + else if (gr->has_bind_display && + gr->query_buffer(gr->egl_display, (void *)buffer->resource, + EGL_TEXTURE_FORMAT, &format)) ++ { ++ /* Prefer attaching as dmabuf for old mali */ ++ dmabuf = linux_dmabuf_buffer_get(buffer->resource); ++ if (dmabuf && gr->is_mali_egl) { ++ if (!gl_renderer_attach_dmabuf(es, buffer, dmabuf)) ++ return; ++ } ++ + gl_renderer_attach_egl(es, buffer, format); ++ } + else if ((dmabuf = linux_dmabuf_buffer_get(buffer->resource))) + gl_renderer_attach_dmabuf(es, buffer, dmabuf); + else { +@@ -3253,7 +3272,7 @@ gl_renderer_log_extensions(const char *name, const char *extensions) + } + + static void +-log_egl_info(EGLDisplay egldpy) ++log_egl_info(struct gl_renderer *gr, EGLDisplay egldpy) + { + const char *str; + +@@ -3263,6 +3282,9 @@ log_egl_info(EGLDisplay egldpy) + str = eglQueryString(egldpy, EGL_VENDOR); + weston_log("EGL vendor: %s\n", str ? str : "(null)"); + ++ if (!strcmp(str, "ARM")) ++ gr->is_mali_egl = 1; ++ + str = eglQueryString(egldpy, EGL_CLIENT_APIS); + weston_log("EGL client APIs: %s\n", str ? str : "(null)"); + +@@ -3681,7 +3703,7 @@ gl_renderer_display_create(struct weston_compositor *ec, + + weston_drm_format_array_init(&gr->supported_formats); + +- log_egl_info(gr->egl_display); ++ log_egl_info(gr, gr->egl_display); + + ec->renderer = &gr->base; + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0010-HACK-gl-renderer-Support-making-hole-for-surface.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0010-HACK-gl-renderer-Support-making-hole-for-surface.patch new file mode 100644 index 0000000000000000000000000000000000000000..c2f9795c45938f7f7015b7f6cc3a6919de0b0071 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0010-HACK-gl-renderer-Support-making-hole-for-surface.patch @@ -0,0 +1,172 @@ +From c6a4bb348b8964dc1f4114562e9db4e95f2ad6de Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 7 Jul 2020 17:00:40 +0800 +Subject: [PATCH 10/79] HACK: gl-renderer: Support making hole for surface + +Signed-off-by: Jeffy Chen +--- + include/libweston/libweston.h | 3 ++ + libweston/compositor.c | 29 ++++++++++++ + libweston/renderer-gl/gl-renderer.c | 71 +++++++++++++++++++++++++++++ + 3 files changed, 103 insertions(+) + +diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h +index bfa7e36..be2514a 100644 +--- a/include/libweston/libweston.h ++++ b/include/libweston/libweston.h +@@ -1551,6 +1551,9 @@ struct weston_surface { + enum weston_hdcp_protection desired_protection; + enum weston_hdcp_protection current_protection; + enum weston_surface_protection_mode protection_mode; ++ ++ /* Transparent hole region(excluding it's lower subsurface area) */ ++ pixman_region32_t hole; + }; + + struct weston_subsurface { +diff --git a/libweston/compositor.c b/libweston/compositor.c +index 2e38c1b..9579493 100644 +--- a/libweston/compositor.c ++++ b/libweston/compositor.c +@@ -605,6 +605,7 @@ weston_surface_create(struct weston_compositor *compositor) + pixman_region32_init(&surface->damage); + pixman_region32_init(&surface->opaque); + region_init_infinite(&surface->input); ++ pixman_region32_init(&surface->hole); + + wl_list_init(&surface->views); + wl_list_init(&surface->paint_node_list); +@@ -2341,6 +2342,7 @@ weston_surface_destroy(struct weston_surface *surface) + pixman_region32_fini(&surface->damage); + pixman_region32_fini(&surface->opaque); + pixman_region32_fini(&surface->input); ++ pixman_region32_fini(&surface->hole); + + wl_resource_for_each_safe(cb, next, &surface->frame_callback_list) + wl_resource_destroy(cb); +@@ -3519,6 +3521,33 @@ surface_set_opaque_region(struct wl_client *client, + + if (region_resource) { + region = wl_resource_get_user_data(region_resource); ++ ++ /** ++ * HACK: Make a hole for this surface ++ * Usage: ++ * 1/ Set the hole region ++ * wl_region_add(region, [hole region]); ++ * 2/ Add a special rect to mark the region as a hole ++ * wl_region_add(region, -1, -1, 1, 1); ++ * wl_surface_set_opaque_region(surface, region); ++ */ ++ if (pixman_region32_contains_point(®ion->region, -1, -1, ++ NULL)) { ++ pixman_region32_t hole; ++ ++ // Subtract the special rect ++ pixman_region32_init_rect(&hole, -1, -1, 1, 1); ++ pixman_region32_subtract(&hole, ®ion->region, ++ &hole); ++ ++ pixman_region32_copy(&surface->hole, &hole); ++ pixman_region32_fini(&hole); ++ ++ // Trigger repaint to apply the hole ++ weston_surface_damage(surface); ++ return; ++ } ++ + pixman_region32_copy(&surface->pending.opaque, + ®ion->region); + } else { +diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c +index 053fd52..6e04baa 100644 +--- a/libweston/renderer-gl/gl-renderer.c ++++ b/libweston/renderer-gl/gl-renderer.c +@@ -1034,6 +1034,46 @@ gl_shader_config_init_for_paint_node(struct gl_shader_config *sconf, + return true; + } + ++static void ++clear_region(struct weston_view *ev, pixman_region32_t *region) ++{ ++ pixman_box32_t *rects; ++ int i, n, h = ev->output->height; ++ ++ if (ev->alpha < 0.5f) ++ return; ++ ++ rects = pixman_region32_rectangles(region, &n); ++ for (i = 0; i < n; i++) { ++ pixman_box32_t r = rects[i]; ++ glScissor(r.x1, h - r.y2, r.x2 - r.x1, r.y2 - r.y1); ++ glEnable(GL_SCISSOR_TEST); ++ glClearColor(0, 0, 0, 0); ++ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); ++ glDisable(GL_SCISSOR_TEST); ++ } ++} ++ ++static void ++weston_view_to_global_region(struct weston_view *ev, pixman_region32_t *region, ++ pixman_region32_t *global_region) ++{ ++ pixman_box32_t *rects; ++ int i, n; ++ float x1, y1, x2, y2; ++ ++ pixman_region32_clear(global_region); ++ ++ rects = pixman_region32_rectangles(region, &n); ++ for (i = 0; i < n; i++) { ++ pixman_box32_t r = rects[i]; ++ weston_view_to_global_float(ev, r.x1, r.y1, &x1, &y1); ++ weston_view_to_global_float(ev, r.x2, r.y2, &x2, &y2); ++ pixman_region32_union_rect(global_region, global_region, ++ x1, y1, x2 - x1, y2 - y1); ++ } ++} ++ + static void + draw_paint_node(struct weston_paint_node *pnode, + pixman_region32_t *damage /* in global coordinates */) +@@ -1077,6 +1117,37 @@ draw_paint_node(struct weston_paint_node *pnode, + if (!gl_shader_config_init_for_paint_node(&sconf, pnode, filter)) + goto out; + ++ // HACK: Make hole for the surface(excluding it's lower subsurface area) ++ if (pixman_region32_not_empty(&pnode->surface->hole)) { ++ struct weston_subsurface *child; ++ pixman_region32_t hole, region; ++ ++ pixman_region32_init(®ion); ++ wl_list_for_each_reverse(child, &pnode->surface->subsurface_list, ++ parent_link) { ++ if (child->surface == pnode->surface) ++ break; ++ ++ pixman_region32_union_rect(®ion, ®ion, ++ child->position.x, ++ child->position.y, ++ child->surface->width, ++ child->surface->height); ++ } ++ ++ pixman_region32_subtract(®ion, &pnode->surface->hole, ®ion); ++ pixman_region32_init(&hole); ++ weston_view_to_global_region(pnode->view, ®ion, &hole); ++ ++ pixman_region32_intersect(&hole, &hole, &repaint); ++ ++ weston_output_region_from_global(pnode->output, &hole); ++ clear_region(pnode->view, &hole); ++ ++ pixman_region32_fini(&hole); ++ pixman_region32_fini(®ion); ++ } ++ + /* blended region is whole surface minus opaque region: */ + pixman_region32_init_rect(&surface_blend, 0, 0, + pnode->surface->width, pnode->surface->height); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0011-compositor-Support-freezing-display.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0011-compositor-Support-freezing-display.patch new file mode 100644 index 0000000000000000000000000000000000000000..941b3fec1a1a7aaad58733a97190157a3343bcbe --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0011-compositor-Support-freezing-display.patch @@ -0,0 +1,45 @@ +From 3514354a47d3e60c0ea2c71947cc56fc796c2567 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 3 Dec 2018 10:40:16 +0800 +Subject: [PATCH 11/79] compositor: Support freezing display + +Freeze display when the specified file(from env "WESTON_FREEZE_DISPLAY") +exists. + +For example: +export WESTON_FREEZE_DISPLAY=/tmp/.freeze +touch $WESTON_FREEZE_DISPLAY +weston --tty=2 -Bdrm-backend.so& + +Signed-off-by: Jeffy Chen +--- + libweston/compositor.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/libweston/compositor.c b/libweston/compositor.c +index 9579493..f36ec9b 100644 +--- a/libweston/compositor.c ++++ b/libweston/compositor.c +@@ -3076,6 +3076,11 @@ output_repaint_timer_handler(void *data) + void *repaint_data = NULL; + int ret = 0; + ++ if (!access(getenv("WESTON_FREEZE_DISPLAY") ? : "", F_OK)) { ++ usleep(DEFAULT_REPAINT_WINDOW * 1000); ++ goto out; ++ } ++ + weston_compositor_read_presentation_clock(compositor, &now); + compositor->last_repaint_start = now; + +@@ -3108,6 +3113,7 @@ output_repaint_timer_handler(void *data) + wl_list_for_each(output, &compositor->output_list, link) + output->repainted = false; + ++out: + output_repaint_timer_arm(compositor); + + return 0; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0012-Support-setting-output-flow-direction.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0012-Support-setting-output-flow-direction.patch new file mode 100644 index 0000000000000000000000000000000000000000..6916d2a32d5145b4cf47dc8727219cf3b51996c2 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0012-Support-setting-output-flow-direction.patch @@ -0,0 +1,308 @@ +From 5141e382c9e3bb58fb10c932d6ddafa4570dfa05 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 27 Apr 2022 18:05:28 +0800 +Subject: [PATCH 12/79] Support setting output flow direction + +Set env "WESTON_OUTPUT_FLOW" to change output flow direction: +horizontal: + Place outputs horizontal. +vertical: + Place outputs vertical. +same-as: + Place outputs at (0,0). + +Signed-off-by: Jeffy Chen +--- + clients/desktop-shell.c | 20 +++++++++++++++ + compositor/main.c | 11 +++++++++ + desktop-shell/shell.c | 17 ++++++++++--- + include/libweston/libweston.h | 11 +++++++++ + libweston/compositor.c | 46 +++++++++++++++-------------------- + 5 files changed, 75 insertions(+), 30 deletions(-) + +diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c +index fb53069..56c3976 100644 +--- a/clients/desktop-shell.c ++++ b/clients/desktop-shell.c +@@ -134,6 +134,8 @@ struct output { + int y; + struct panel *panel; + struct background *background; ++ ++ struct desktop *desktop; + }; + + struct panel_launcher { +@@ -1266,10 +1268,27 @@ output_handle_geometry(void *data, + int transform) + { + struct output *output = data; ++ struct desktop *desktop = output->desktop; ++ struct wl_surface *surface; + + output->x = x; + output->y = y; + ++ if (y && output->panel) { ++ /* HACK: Re-set the panel to destroy it */ ++ surface = window_get_wl_surface(output->panel->window); ++ weston_desktop_shell_set_panel(desktop->shell, ++ output->output, surface); ++ } ++ ++ if (!y && desktop->want_panel && !output->panel) { ++ /* based on output_init() */ ++ output->panel = panel_create(desktop, output); ++ surface = window_get_wl_surface(output->panel->window); ++ weston_desktop_shell_set_panel(desktop->shell, ++ output->output, surface); ++ } ++ + if (output->panel) + window_set_buffer_transform(output->panel->window, transform); + if (output->background) +@@ -1339,6 +1358,7 @@ create_output(struct desktop *desktop, uint32_t id) + if (!output) + return; + ++ output->desktop = desktop; + output->output = + display_bind(desktop->display, id, &wl_output_interface, 2); + output->server_output_id = id; +diff --git a/compositor/main.c b/compositor/main.c +index d7eb422..e946b4a 100644 +--- a/compositor/main.c ++++ b/compositor/main.c +@@ -3297,6 +3297,7 @@ wet_main(int argc, char *argv[], const struct weston_testsuite_data *test_data) + struct weston_log_subscriber *logger = NULL; + struct weston_log_subscriber *flight_rec = NULL; + sigset_t mask; ++ char *buf; + + bool wait_for_debugger = false; + struct wl_protocol_logger *protologger = NULL; +@@ -3438,6 +3439,16 @@ wet_main(int argc, char *argv[], const struct weston_testsuite_data *test_data) + goto out; + } + ++ wet.compositor->output_flow = WESTON_OUTPUT_FLOW_HORIZONTAL; ++ ++ buf = getenv("WESTON_OUTPUT_FLOW"); ++ if (buf) { ++ if (!strcmp(buf, "vertical")) ++ wet.compositor->output_flow = WESTON_OUTPUT_FLOW_VERTICAL; ++ else if (!strcmp(buf, "same-as")) ++ wet.compositor->output_flow = WESTON_OUTPUT_FLOW_SAME_AS; ++ } ++ + protocol_scope = + weston_log_ctx_add_log_scope(log_ctx, "proto", + "Wayland protocol dump for all clients.\n", +diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c +index 3c71192..15c148f 100644 +--- a/desktop-shell/shell.c ++++ b/desktop-shell/shell.c +@@ -1490,7 +1490,7 @@ constrain_position(struct weston_move_grab *move, int *cx, int *cy) + y = wl_fixed_to_int(pointer->y + move->dy); + + if (shsurf->shell->panel_position == +- WESTON_DESKTOP_SHELL_PANEL_POSITION_TOP) { ++ WESTON_DESKTOP_SHELL_PANEL_POSITION_TOP && !surface->output->y) { + get_output_work_area(shsurf->shell, surface->output, &area); + geometry = + weston_desktop_surface_get_geometry(shsurf->desktop_surface); +@@ -3091,6 +3091,18 @@ desktop_shell_set_panel(struct wl_client *client, + wl_resource_get_user_data(surface_resource); + struct weston_view *view, *next; + struct shell_output *sh_output; ++ struct weston_output *output; ++ ++ output = weston_head_from_resource(output_resource)->output; ++ sh_output = find_shell_output_from_weston_output(shell, output); ++ ++ if (surface == sh_output->panel_surface) { ++ /* HACK: Re-set to destroy output panel */ ++ weston_desktop_shell_send_configure(resource, 0, ++ surface_resource, ++ 0, 0); ++ return; ++ } + + if (surface->committed) { + wl_resource_post_error(surface_resource, +@@ -3106,10 +3118,9 @@ desktop_shell_set_panel(struct wl_client *client, + surface->committed = panel_committed; + surface->committed_private = shell; + weston_surface_set_label_func(surface, panel_get_label); +- surface->output = weston_head_from_resource(output_resource)->output; ++ surface->output = output; + weston_view_set_output(view, surface->output); + +- sh_output = find_shell_output_from_weston_output(shell, surface->output); + if (sh_output->panel_surface) { + /* The output already has a panel, tell our helper + * there is no need for another one. */ +diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h +index be2514a..c6ba508 100644 +--- a/include/libweston/libweston.h ++++ b/include/libweston/libweston.h +@@ -1057,6 +1057,12 @@ struct weston_color_manager; + struct weston_dmabuf_feedback; + struct weston_dmabuf_feedback_format_table; + ++enum weston_output_flow { ++ WESTON_OUTPUT_FLOW_HORIZONTAL, ++ WESTON_OUTPUT_FLOW_VERTICAL, ++ WESTON_OUTPUT_FLOW_SAME_AS, ++}; ++ + /** Main object, container-like structure which aggregates all other objects. + * + * \ingroup compositor +@@ -1184,6 +1190,8 @@ struct weston_compositor { + struct weston_log_scope *timeline; + + struct content_protection *content_protection; ++ ++ enum weston_output_flow output_flow; + }; + + struct weston_buffer { +@@ -2158,6 +2166,9 @@ struct weston_color_profile * + weston_compositor_load_icc_file(struct weston_compositor *compositor, + const char *path); + ++void ++weston_compositor_reflow_outputs(struct weston_compositor *compositor); ++ + #ifdef __cplusplus + } + #endif +diff --git a/libweston/compositor.c b/libweston/compositor.c +index f36ec9b..e184349 100644 +--- a/libweston/compositor.c ++++ b/libweston/compositor.c +@@ -255,10 +255,6 @@ weston_mode_switch_finish(struct weston_output *output, + mode_changed, scale_changed); + } + +-static void +-weston_compositor_reflow_outputs(struct weston_compositor *compositor, +- struct weston_output *resized_output, int delta_width); +- + /** + * \ingroup output + */ +@@ -269,7 +265,6 @@ weston_output_mode_set_native(struct weston_output *output, + { + int ret; + int mode_changed = 0, scale_changed = 0; +- int32_t old_width; + + if (!output->switch_mode) + return -1; +@@ -285,14 +280,13 @@ weston_output_mode_set_native(struct weston_output *output, + } + } + +- old_width = output->width; + output->native_mode = mode; + output->native_scale = scale; + + weston_mode_switch_finish(output, mode_changed, scale_changed); + + if (mode_changed || scale_changed) { +- weston_compositor_reflow_outputs(output->compositor, output, output->width - old_width); ++ weston_compositor_reflow_outputs(output->compositor); + + wl_signal_emit(&output->compositor->output_resized_signal, output); + } +@@ -6044,27 +6038,26 @@ weston_head_get_destroy_listener(struct weston_head *head, + return wl_signal_get(&head->destroy_signal, notify); + } + +-/* Move other outputs when one is resized so the space remains contiguous. */ +-static void +-weston_compositor_reflow_outputs(struct weston_compositor *compositor, +- struct weston_output *resized_output, int delta_width) ++WL_EXPORT void ++weston_compositor_reflow_outputs(struct weston_compositor *compositor) + { + struct weston_output *output; +- bool start_resizing = false; +- +- if (!delta_width) +- return; ++ int x, y, next_x, next_y; + ++ next_x = next_y = 0; + wl_list_for_each(output, &compositor->output_list, link) { +- if (output == resized_output) { +- start_resizing = true; ++ if (output->destroying) + continue; +- } + +- if (start_resizing) { +- weston_output_move(output, output->x + delta_width, output->y); +- output->dirty = 1; +- } ++ x = next_x; ++ y = next_y; ++ ++ if (compositor->output_flow == WESTON_OUTPUT_FLOW_HORIZONTAL) ++ next_x += output->width; ++ else if (compositor->output_flow == WESTON_OUTPUT_FLOW_VERTICAL) ++ next_y += output->height; ++ ++ weston_output_move(output, x, y); + } + } + +@@ -6174,6 +6167,8 @@ weston_output_transform_scale_init(struct weston_output *output, uint32_t transf + static void + weston_output_init_geometry(struct weston_output *output, int x, int y) + { ++ output->dirty = 1; ++ + output->x = x; + output->y = y; + +@@ -6201,8 +6196,6 @@ weston_output_move(struct weston_output *output, int x, int y) + + weston_output_init_geometry(output, x, y); + +- output->dirty = 1; +- + /* Move views on this output. */ + wl_signal_emit(&output->compositor->output_moved_signal, output); + +@@ -6423,7 +6416,7 @@ weston_compositor_remove_output(struct weston_output *output) + + weston_presentation_feedback_discard_list(&output->feedback_list); + +- weston_compositor_reflow_outputs(compositor, output, -output->width); ++ weston_compositor_reflow_outputs(compositor); + + wl_list_remove(&output->link); + wl_list_insert(compositor->pending_output_list.prev, &output->link); +@@ -6497,7 +6490,7 @@ weston_output_set_transform(struct weston_output *output, + + weston_output_init_geometry(output, output->x, output->y); + +- output->dirty = 1; ++ weston_compositor_reflow_outputs(output->compositor); + + /* Notify clients of the change for output transform. */ + wl_list_for_each(head, &output->head_list, output_link) { +@@ -6765,7 +6758,6 @@ weston_output_enable(struct weston_output *output) + + output->x = x; + output->y = y; +- output->dirty = 1; + output->original_scale = output->scale; + + wl_signal_init(&output->frame_signal); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0013-backend-drm-Support-selecting-monitors.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0013-backend-drm-Support-selecting-monitors.patch new file mode 100644 index 0000000000000000000000000000000000000000..0ead3df350e5e4048d9f6d5ffb865c7d6543bdd2 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0013-backend-drm-Support-selecting-monitors.patch @@ -0,0 +1,1012 @@ +From 475bf406ef30aa6c04efc35caf2ff748a4a20df9 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 23 Jun 2020 10:05:48 +0800 +Subject: [PATCH 13/79] backend-drm: Support selecting monitors + +Using these environments: + +WESTON_DRM_PRIMARY: + Specify primary connector. +WESTON_DRM_SINGLE_HEAD: + Force using single connector. +WESTON_DRM_HEAD_FALLBACK: + Fallback to any available connector if none matched. +WESTON_DRM_HEAD_FALLBACK_ALL: + Fallback to all available connector if none matched. +WESTON_DRM_PREFER_EXTERNAL_DUAL: + Prefer external connectors, and also enable internal ones. +WESTON_DRM_PREFER_EXTERNAL: + Prefer external connectors, and disable internal ones if any matched. + +WESTON_DRM_HEAD_MODE: + default(match primary->internal->external) + primary(match primary only) + internal(match primary->internal) + external(match primary->external) + external-dual(match primary->external->internal) + +Signed-off-by: Jeffy Chen +--- + compositor/main.c | 26 +- + desktop-shell/shell.c | 24 +- + include/libweston/libweston.h | 2 + + libweston/backend-drm/drm-internal.h | 23 ++ + libweston/backend-drm/drm.c | 369 ++++++++++++++++++++++++--- + libweston/backend-drm/kms.c | 42 ++- + libweston/compositor.c | 42 ++- + 7 files changed, 471 insertions(+), 57 deletions(-) + +diff --git a/compositor/main.c b/compositor/main.c +index e946b4a..47bf540 100644 +--- a/compositor/main.c ++++ b/compositor/main.c +@@ -2067,7 +2067,7 @@ drm_head_prepare_enable(struct wet_compositor *wet, + char *output_name = NULL; + char *mode = NULL; + +- section = drm_config_find_controlling_output_section(wet->config, name); ++ section = head->section; + if (section) { + /* skip outputs that are explicitly off, or non-desktop and not + * explicitly enabled. The backend turns them off automatically. +@@ -2097,11 +2097,10 @@ static bool + drm_head_should_force_enable(struct wet_compositor *wet, + struct weston_head *head) + { +- const char *name = weston_head_get_name(head); + struct weston_config_section *section; + bool force; + +- section = drm_config_find_controlling_output_section(wet->config, name); ++ section = head->section; + if (!section) + return false; + +@@ -2289,6 +2288,25 @@ drm_head_disable(struct weston_head *head) + wet_output_destroy(output); + } + ++static bool ++drm_head_update_output_section(struct weston_head *head) ++{ ++ struct weston_compositor *compositor = head->compositor; ++ struct wet_compositor *wet = to_wet_compositor(compositor); ++ const char *name = weston_head_get_name(head); ++ struct weston_config_section *section; ++ ++ if (head->section) ++ return true; ++ ++ section = drm_config_find_controlling_output_section(wet->config, name); ++ if (!section) ++ return false; ++ ++ head->section = section; ++ return true; ++} ++ + static void + drm_heads_changed(struct wl_listener *listener, void *arg) + { +@@ -2304,6 +2322,8 @@ drm_heads_changed(struct wl_listener *listener, void *arg) + * output. + */ + while ((head = weston_compositor_iterate_heads(compositor, head))) { ++ drm_head_update_output_section(head); ++ + connected = weston_head_is_connected(head); + enabled = weston_head_is_enabled(head); + changed = weston_head_is_device_changed(head); +diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c +index 15c148f..515c57f 100644 +--- a/desktop-shell/shell.c ++++ b/desktop-shell/shell.c +@@ -3988,6 +3988,9 @@ shell_fade_done_for_output(struct weston_view_animation *animation, void *data) + struct shell_output *shell_output = data; + struct desktop_shell *shell = shell_output->shell; + ++ if (!shell_output->fade.view) ++ return; ++ + shell_output->fade.animation = NULL; + switch (shell_output->fade.type) { + case FADE_IN: +@@ -4021,6 +4024,7 @@ shell_fade_create_surface_for_output(struct desktop_shell *shell, struct shell_o + + weston_surface_set_size(surface, shell_output->output->width, shell_output->output->height); + weston_view_set_position(view, shell_output->output->x, shell_output->output->y); ++ weston_view_set_output(view, shell_output->output); + weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1.0); + weston_layer_entry_insert(&compositor->fade_layer.view_list, + &view->layer_link); +@@ -4841,8 +4845,11 @@ shell_output_destroy(struct shell_output *shell_output) + } + + if (shell_output->fade.view) { ++ struct weston_view *view = shell_output->fade.view; ++ shell_output->fade.view = NULL; ++ + /* destroys the view as well */ +- weston_surface_destroy(shell_output->fade.view->surface); ++ weston_surface_destroy(view->surface); + } + + if (shell_output->fade.startup_timer) +@@ -4946,12 +4953,25 @@ handle_output_move_layer(struct desktop_shell *shell, + static void + handle_output_move(struct wl_listener *listener, void *data) + { ++ struct weston_output *output = data; ++ struct weston_compositor *compositor = output->compositor; + struct desktop_shell *shell; + + shell = container_of(listener, struct desktop_shell, + output_move_listener); + +- shell_for_each_layer(shell, handle_output_move_layer, data); ++ if (shell->lock_surface) ++ shell->lock_surface->committed(shell->lock_surface, 0, 0); ++ ++ /* Only move normal layers for non-default output */ ++ if (output != get_default_output(compositor)) { ++ shell_for_each_layer(shell, handle_output_move_layer, data); ++ return; ++ } ++ ++ handle_output_move_layer(shell, &shell->lock_layer, data); ++ handle_output_move_layer(shell, &shell->background_layer, data); ++ handle_output_move_layer(shell, &shell->panel_layer, data); + } + + static void +diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h +index c6ba508..bdecc19 100644 +--- a/include/libweston/libweston.h ++++ b/include/libweston/libweston.h +@@ -261,6 +261,8 @@ struct weston_head { + + /** Current content protection status */ + enum weston_hdcp_protection current_protection; ++ ++ struct weston_config_section *section; /**< config section **/ + }; + + /** Content producer for heads +diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h +index 4860088..3f42a25 100644 +--- a/libweston/backend-drm/drm-internal.h ++++ b/libweston/backend-drm/drm-internal.h +@@ -110,6 +110,10 @@ + + #define MAX_CLONED_CONNECTORS 4 + ++/* Min duration between drm outputs update requests, to avoid glith */ ++#define DRM_MIN_UPDATE_MS 1000 ++ ++#define DRM_RESIZE_FREEZE_MS 600 + + /** + * Represents the values of an enum-type KMS property +@@ -249,6 +253,10 @@ enum actions_needed_dmabuf_feedback { + ACTION_NEEDED_REMOVE_SCANOUT_TRANCHE = (1 << 1), + }; + ++struct drm_head; ++struct drm_backend; ++typedef bool (*drm_head_match_t) (struct drm_backend *, struct drm_head *); ++ + struct drm_backend { + struct weston_backend base; + struct weston_compositor *compositor; +@@ -264,6 +272,7 @@ struct drm_backend { + int fd; + char *filename; + dev_t devnum; ++ char *syspath; + } drm; + struct gbm_device *gbm; + struct wl_listener session_listener; +@@ -311,6 +320,18 @@ struct drm_backend { + bool fb_modifiers; + + struct weston_log_scope *debug; ++ ++ struct wl_event_source *hotplug_timer; ++ bool pending_update; ++ int64_t last_update_ms; ++ int64_t last_resize_ms; ++ ++ bool single_head; ++ bool head_fallback; ++ bool head_fallback_all; ++ drm_head_match_t *head_matches; ++ struct drm_head *primary_head; ++ struct wl_listener output_create_listener; + }; + + struct drm_mode { +@@ -574,6 +595,8 @@ struct drm_output { + bool virtual; + + submit_frame_cb virtual_submit_frame; ++ ++ bool state_invalid; + }; + + static inline struct drm_head * +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index d6a8588..4e00933 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -47,6 +47,7 @@ + + #include + ++#include + #include + #include + #include +@@ -68,6 +69,44 @@ + + static const char default_seat[] = "seat0"; + ++static inline bool ++drm_head_is_external(struct drm_head *head) ++{ ++ drmModeConnector *conn = head->connector.conn; ++ switch (conn->connector_type) { ++ case DRM_MODE_CONNECTOR_LVDS: ++ case DRM_MODE_CONNECTOR_eDP: ++#ifdef DRM_MODE_CONNECTOR_DSI ++ case DRM_MODE_CONNECTOR_DSI: ++#endif ++ return false; ++ default: ++ return true; ++ } ++}; ++ ++static void ++drm_backend_update_outputs(struct drm_backend *b) ++{ ++ struct weston_output *primary; ++ ++ if (!b->primary_head) ++ return; ++ ++ primary = b->primary_head->base.output; ++ if (!primary) ++ return; ++ ++ /* Move primary output to (0,0) */ ++ wl_list_remove(&primary->link); ++ wl_list_insert(&b->compositor->output_list, &primary->link); ++ ++ /* Reflow outputs */ ++ weston_compositor_reflow_outputs(b->compositor); ++ ++ weston_compositor_damage_all(b->compositor); ++} ++ + static void + drm_backend_create_faked_zpos(struct drm_backend *b) + { +@@ -460,10 +499,13 @@ drm_output_repaint(struct weston_output *output_base, + pixman_region32_t *damage, + void *repaint_data) + { ++ struct drm_backend *b = to_drm_backend(output_base->compositor); + struct drm_pending_state *pending_state = repaint_data; + struct drm_output *output = to_drm_output(output_base); + struct drm_output_state *state = NULL; + struct drm_plane_state *scanout_state; ++ struct timespec now; ++ int64_t now_ms; + + assert(!output->virtual); + +@@ -472,6 +514,20 @@ drm_output_repaint(struct weston_output *output_base, + + assert(!output->state_last); + ++ weston_compositor_read_presentation_clock(b->compositor, &now); ++ now_ms = timespec_to_msec(&now); ++ if (now_ms < b->last_resize_ms + DRM_RESIZE_FREEZE_MS) { ++ /* Resize fullscreen/maxmium views(not always success) */ ++ if (now_ms < b->last_resize_ms + DRM_RESIZE_FREEZE_MS) ++ wl_signal_emit(&b->compositor->output_resized_signal, ++ output); ++ ++ weston_output_damage(output_base); ++ weston_output_finish_frame(output_base, NULL, ++ WP_PRESENTATION_FEEDBACK_INVALID); ++ return 0; ++ } ++ + /* If planes have been disabled in the core, we might not have + * hit assign_planes at all, so might not have valid output state + * here. */ +@@ -497,7 +553,7 @@ drm_output_repaint(struct weston_output *output_base, + + err: + drm_output_state_free(state); +- return -1; ++ return 0; + } + + /* Determine the type of vblank synchronization to use for the output. +@@ -718,6 +774,7 @@ drm_output_switch_mode(struct weston_output *output_base, struct weston_mode *mo + * content. + */ + b->state_invalid = true; ++ output->state_invalid = true; + + if (b->use_pixman) { + drm_output_fini_pixman(output); +@@ -1271,6 +1328,7 @@ drm_output_attach_head(struct weston_output *output_base, + struct weston_head *head_base) + { + struct drm_backend *b = to_drm_backend(output_base->compositor); ++ struct drm_output *output = to_drm_output(output_base); + + if (wl_list_length(&output_base->head_list) >= MAX_CLONED_CONNECTORS) + return -1; +@@ -1288,6 +1346,7 @@ drm_output_attach_head(struct weston_output *output_base, + * will not clear the flag before this output is updated? + */ + b->state_invalid = true; ++ output->state_invalid = true; + + weston_output_schedule_repaint(output_base); + +@@ -1299,6 +1358,7 @@ drm_output_detach_head(struct weston_output *output_base, + struct weston_head *head_base) + { + struct drm_backend *b = to_drm_backend(output_base->compositor); ++ struct drm_output *output = to_drm_output(output_base); + + if (!output_base->enabled) + return; +@@ -1307,6 +1367,7 @@ drm_output_detach_head(struct weston_output *output_base, + * be driven. */ + /* XXX: Ideally we'd do this per-output, not globally. */ + b->state_invalid = true; ++ output->state_invalid = true; + + weston_output_schedule_repaint(output_base); + } +@@ -1795,6 +1856,7 @@ drm_output_detach_crtc(struct drm_output *output) + + /* Force resetting unused CRTCs */ + b->state_invalid = true; ++ output->state_invalid = true; + } + + static int +@@ -1839,6 +1901,8 @@ drm_output_enable(struct weston_output *base) + output->base.switch_mode = drm_output_switch_mode; + output->base.set_gamma = drm_output_set_gamma; + ++ output->state_invalid = true; ++ + weston_log("Output %s (crtc %d) video modes:\n", + output->base.name, output->crtc->crtc_id); + drm_output_print_modes(output); +@@ -2173,8 +2237,7 @@ drm_head_create(struct drm_backend *backend, drmModeConnector *conn, + + head->backlight = backlight_init(drm_device, conn->connector_type); + +- if (conn->connector_type == DRM_MODE_CONNECTOR_LVDS || +- conn->connector_type == DRM_MODE_CONNECTOR_eDP) ++ if (!drm_head_is_external(head)) + weston_head_set_internal(&head->base); + + if (drm_head_read_current_setup(head, backend) < 0) { +@@ -2335,71 +2398,77 @@ drm_backend_add_connector(struct drm_backend *b, drmModeConnector *conn, + return ret; + } + +-/** Find all connectors of the fd and create drm_head or drm_writeback objects +- * (depending on the type of connector they are) for each of them +- * +- * These objects are added to the DRM-backend lists of heads and writebacks. +- * +- * @param b The DRM-backend structure +- * @param drm_device udev device pointer +- * @param resources The DRM resources, it is taken with drmModeGetResources +- * @return 0 on success, -1 on failure +- */ +-static int +-drm_backend_discover_connectors(struct drm_backend *b, struct udev_device *drm_device, +- drmModeRes *resources) ++static bool ++resources_has_connector(drmModeRes *resources, uint32_t connector_id) + { +- drmModeConnector *conn; +- int i, ret; ++ for (int i = 0; i < resources->count_connectors; i++) { ++ if (resources->connectors[i] == connector_id) ++ return true; ++ } + +- b->min_width = resources->min_width; +- b->max_width = resources->max_width; +- b->min_height = resources->min_height; +- b->max_height = resources->max_height; ++ return false; ++} + +- for (i = 0; i < resources->count_connectors; i++) { +- uint32_t connector_id = resources->connectors[i]; ++/* based on compositor/main.c#drm_head_prepare_enable() */ ++static bool ++drm_head_is_available(struct weston_head *head) ++{ ++ struct weston_config_section *section; ++ char *mode = NULL; + +- conn = drmModeGetConnector(b->drm.fd, connector_id); +- if (!conn) +- continue; ++ section = head->section; ++ if (!section) ++ return true; + +- ret = drm_backend_add_connector(b, conn, drm_device); +- if (ret < 0) +- drmModeFreeConnector(conn); ++ /* skip outputs that are explicitly off, or non-desktop and not ++ * explicitly enabled. ++ */ ++ weston_config_section_get_string(section, "mode", &mode, NULL); ++ if (mode && strcmp(mode, "off") == 0) { ++ free(mode); ++ return false; + } + +- return 0; ++ if (!mode && weston_head_is_non_desktop(head)) ++ return false; ++ ++ free(mode); ++ return true; + } + + static bool +-resources_has_connector(drmModeRes *resources, uint32_t connector_id) ++drm_head_match_fallback(struct drm_backend *b, struct drm_head *head) + { +- for (int i = 0; i < resources->count_connectors; i++) { +- if (resources->connectors[i] == connector_id) +- return true; +- } ++ if (b->head_fallback_all) ++ return true; + +- return false; ++ return b->head_fallback && !b->primary_head; + } + +-static void ++static int + drm_backend_update_connectors(struct drm_backend *b, struct udev_device *drm_device) + { + drmModeRes *resources; + drmModeConnector *conn; + struct weston_head *base, *base_next; +- struct drm_head *head; ++ struct drm_head *head, *old_primary_head; + struct drm_writeback *writeback, *writeback_next; ++ drm_head_match_t *match = b->head_matches; ++ struct timespec now; + uint32_t connector_id; + int i, ret; + + resources = drmModeGetResources(b->drm.fd); + if (!resources) { + weston_log("drmModeGetResources failed\n"); +- return; ++ return -1; + } + ++ b->min_width = resources->min_width; ++ b->max_width = resources->max_width; ++ b->min_height = resources->min_height; ++ b->max_height = resources->max_height; ++ + /* collect new connectors that have appeared, e.g. MST */ + for (i = 0; i < resources->count_connectors; i++) { + connector_id = resources->connectors[i]; +@@ -2456,6 +2525,65 @@ drm_backend_update_connectors(struct drm_backend *b, struct udev_device *drm_dev + } + + drmModeFreeResources(resources); ++ ++ old_primary_head = b->primary_head; ++ b->primary_head = NULL; ++ ++ wl_list_for_each_safe(base, base_next, ++ &b->compositor->head_list, compositor_link) ++ weston_head_set_connection_status(base, false); ++ ++ /* Re-connect matched heads and find primary head */ ++ while (*match) { ++ wl_list_for_each_safe(base, base_next, ++ &b->compositor->head_list, ++ compositor_link) { ++ drmModeConnector *conn; ++ ++ if (!drm_head_is_available(base)) ++ continue; ++ ++ head = to_drm_head(base); ++ conn = head->connector.conn; ++ ++ if (conn->connection != DRM_MODE_CONNECTED || ++ !(*match)(b, head)) ++ continue; ++ ++ weston_head_set_connection_status(base, true); ++ ++ if (!b->primary_head) { ++ b->primary_head = head; ++ ++ /* Done the single-head match */ ++ if (b->single_head) ++ goto match_done; ++ } ++ } ++ ++ /* Done the fallback match */ ++ if (*match == drm_head_match_fallback) ++ goto match_done; ++ ++ match++; ++ ++ /* Try the fallback match */ ++ if (!match && !b->primary_head) ++ *match = drm_head_match_fallback; ++ } ++match_done: ++ ++ drm_backend_update_outputs(b); ++ ++ weston_compositor_read_presentation_clock(b->compositor, &now); ++ b->last_update_ms = timespec_to_msec(&now); ++ ++ /* Assume primary output's size changed */ ++ if (b->primary_head && old_primary_head && ++ b->primary_head != old_primary_head) ++ b->last_resize_ms = b->last_update_ms; ++ ++ return 0; + } + + static enum wdrm_connector_property +@@ -2546,6 +2674,48 @@ udev_event_is_conn_prop_change(struct drm_backend *b, + return 1; + } + ++static void ++udev_hotplug_event(struct drm_backend *b, struct udev_device *device) ++{ ++ struct timespec now; ++ int64_t now_ms, next_ms; ++ ++ weston_compositor_read_presentation_clock(b->compositor, &now); ++ now_ms = timespec_to_msec(&now); ++ ++ /* Already have a pending request */ ++ if (b->pending_update) ++ return; ++ ++ next_ms = b->last_update_ms + DRM_MIN_UPDATE_MS; ++ if (next_ms <= now_ms) { ++ /* Long enough to trigger a new request */ ++ drm_backend_update_connectors(b, device); ++ } else { ++ /* Too close to the last request, schedule a new one */ ++ b->pending_update = true; ++ wl_event_source_timer_update(b->hotplug_timer, ++ next_ms - now_ms); ++ } ++} ++ ++static int ++hotplug_timer_handler(void *data) ++{ ++ struct drm_backend *b = data; ++ struct udev_device *device; ++ struct udev *udev; ++ ++ udev = udev_monitor_get_udev(b->udev_monitor); ++ device = udev_device_new_from_syspath(udev, b->drm.syspath); ++ ++ drm_backend_update_connectors(b, device); ++ b->pending_update = false; ++ ++ udev_device_unref(device); ++ return 0; ++} ++ + static int + udev_drm_event(int fd, uint32_t mask, void *data) + { +@@ -2559,7 +2729,7 @@ udev_drm_event(int fd, uint32_t mask, void *data) + if (udev_event_is_conn_prop_change(b, event, &conn_id, &prop_id)) + drm_backend_update_conn_props(b, conn_id, prop_id); + else +- drm_backend_update_connectors(b, event); ++ udev_hotplug_event(b, event); + } + + udev_device_unref(event); +@@ -2577,6 +2747,7 @@ drm_destroy(struct weston_compositor *ec) + + udev_input_destroy(&b->input); + ++ wl_event_source_remove(b->hotplug_timer); + wl_event_source_remove(b->udev_drm_source); + wl_event_source_remove(b->drm_source); + +@@ -2627,6 +2798,10 @@ session_notify(struct wl_listener *listener, void *data) + weston_compositor_wake(compositor); + weston_compositor_damage_all(compositor); + b->state_invalid = true; ++ ++ wl_list_for_each(output, &compositor->output_list, base.link) ++ output->state_invalid = true; ++ + udev_input_enable(&b->input); + } else { + weston_log("deactivating session\n"); +@@ -2987,6 +3162,14 @@ recorder_binding(struct weston_keyboard *keyboard, const struct timespec *time, + } + #endif + ++static void ++output_create_notify(struct wl_listener *listener, void *data) ++{ ++ struct drm_backend *b = container_of(listener, struct drm_backend, ++ output_create_listener); ++ ++ drm_backend_update_outputs(b); ++} + + static const struct weston_drm_output_api api = { + drm_output_set_mode, +@@ -2994,6 +3177,63 @@ static const struct weston_drm_output_api api = { + drm_output_set_seat, + }; + ++enum drm_head_mode { ++ DRM_HEAD_MODE_DEFAULT, ++ DRM_HEAD_MODE_PRIMARY, ++ DRM_HEAD_MODE_INTERNAL, ++ DRM_HEAD_MODE_EXTERNAL, ++ DRM_HEAD_MODE_EXTERNAL_DUAL, ++}; ++ ++static bool ++drm_head_match_primary(struct drm_backend *b, struct drm_head *head) ++{ ++ const char *buf = getenv("WESTON_DRM_PRIMARY"); ++ return buf && !strcmp(buf, head->base.name); ++} ++ ++static bool ++drm_head_match_external(struct drm_backend *b, struct drm_head *head) ++{ ++ return drm_head_is_external(head); ++} ++ ++static bool ++drm_head_match_internal(struct drm_backend *b, struct drm_head *head) ++{ ++ return !drm_head_is_external(head); ++} ++ ++#define DRM_HEAD_MAX_MATCHES 5 ++static drm_head_match_t drm_head_matches[][DRM_HEAD_MAX_MATCHES] = { ++ [DRM_HEAD_MODE_DEFAULT] = { ++ drm_head_match_primary, ++ drm_head_match_internal, ++ drm_head_match_external, ++ NULL, ++ }, ++ [DRM_HEAD_MODE_PRIMARY] = { ++ drm_head_match_primary, ++ NULL, ++ }, ++ [DRM_HEAD_MODE_INTERNAL] = { ++ drm_head_match_primary, ++ drm_head_match_internal, ++ NULL, ++ }, ++ [DRM_HEAD_MODE_EXTERNAL] = { ++ drm_head_match_primary, ++ drm_head_match_external, ++ NULL, ++ }, ++ [DRM_HEAD_MODE_EXTERNAL_DUAL] = { ++ drm_head_match_primary, ++ drm_head_match_external, ++ drm_head_match_internal, ++ NULL, ++ }, ++}; ++ + static struct drm_backend * + drm_backend_create(struct weston_compositor *compositor, + struct weston_drm_backend_config *config) +@@ -3004,7 +3244,9 @@ drm_backend_create(struct weston_compositor *compositor, + const char *seat_id = default_seat; + const char *session_seat; + struct weston_drm_format_array *scanout_formats; ++ enum drm_head_mode head_mode = DRM_HEAD_MODE_DEFAULT; + drmModeRes *res; ++ char *buf; + int ret; + + session_seat = getenv("XDG_SEAT"); +@@ -3020,6 +3262,42 @@ drm_backend_create(struct weston_compositor *compositor, + if (b == NULL) + return NULL; + ++ buf = getenv("WESTON_DRM_SINGLE_HEAD"); ++ if (buf && buf[0] == '1') ++ b->single_head = true; ++ ++ buf = getenv("WESTON_DRM_HEAD_FALLBACK"); ++ if (buf && buf[0] == '1') ++ b->head_fallback = true; ++ ++ buf = getenv("WESTON_DRM_HEAD_FALLBACK_ALL"); ++ if (buf && buf[0] == '1') ++ b->head_fallback_all = true; ++ ++ buf = getenv("WESTON_DRM_PREFER_EXTERNAL"); ++ if (buf && buf[0] == '1') { ++ head_mode = DRM_HEAD_MODE_EXTERNAL; ++ b->head_fallback = true; ++ } ++ ++ buf = getenv("WESTON_DRM_PREFER_EXTERNAL_DUAL"); ++ if (buf && buf[0] == '1') ++ head_mode = DRM_HEAD_MODE_EXTERNAL_DUAL; ++ ++ buf = getenv("WESTON_DRM_HEAD_MODE"); ++ if (buf) { ++ if (!strcmp(buf, "primary")) ++ head_mode = DRM_HEAD_MODE_PRIMARY; ++ else if (!strcmp(buf, "internal")) ++ head_mode = DRM_HEAD_MODE_INTERNAL; ++ else if (!strcmp(buf, "external")) ++ head_mode = DRM_HEAD_MODE_EXTERNAL; ++ else if (!strcmp(buf, "external-dual")) ++ head_mode = DRM_HEAD_MODE_EXTERNAL_DUAL; ++ } ++ ++ b->head_matches = drm_head_matches[head_mode]; ++ + b->state_invalid = true; + b->drm.fd = -1; + +@@ -3115,7 +3393,7 @@ drm_backend_create(struct weston_compositor *compositor, + } + + wl_list_init(&b->writeback_connector_list); +- if (drm_backend_discover_connectors(b, drm_device, res) < 0) { ++ if (drm_backend_update_connectors(b, drm_device) < 0) { + weston_log("Failed to create heads for %s\n", b->drm.filename); + goto err_udev_input; + } +@@ -3154,6 +3432,10 @@ drm_backend_create(struct weston_compositor *compositor, + + udev_device_unref(drm_device); + ++ b->output_create_listener.notify = output_create_notify; ++ wl_signal_add(&b->compositor->output_created_signal, ++ &b->output_create_listener); ++ + weston_compositor_add_debug_binding(compositor, KEY_O, + planes_binding, b); + weston_compositor_add_debug_binding(compositor, KEY_C, +@@ -3215,6 +3497,9 @@ drm_backend_create(struct weston_compositor *compositor, + goto err_udev_monitor; + } + ++ b->hotplug_timer = ++ wl_event_loop_add_timer(loop, hotplug_timer_handler, b); ++ + return b; + + err_udev_monitor: +diff --git a/libweston/backend-drm/kms.c b/libweston/backend-drm/kms.c +index 35113d5..4426af4 100644 +--- a/libweston/backend-drm/kms.c ++++ b/libweston/backend-drm/kms.c +@@ -704,6 +704,8 @@ drm_output_apply_state_legacy(struct drm_output_state *state) + + scanout_state = + drm_output_state_get_existing_plane(state, scanout_plane); ++ if (!scanout_state || !scanout_state->fb) ++ return 0; + + /* The legacy SetCrtc API doesn't allow us to do scaling, and the + * legacy PageFlip API doesn't allow us to do clipping either. */ +@@ -721,7 +723,7 @@ drm_output_apply_state_legacy(struct drm_output_state *state) + assert(scanout_state->in_fence_fd == -1); + + mode = to_drm_mode(output->base.current_mode); +- if (backend->state_invalid || ++ if (output->state_invalid || + !scanout_plane->state_cur->fb || + scanout_plane->state_cur->fb->strides[0] != + scanout_state->fb->strides[0]) { +@@ -735,6 +737,8 @@ drm_output_apply_state_legacy(struct drm_output_state *state) + weston_log("set mode failed: %s\n", strerror(errno)); + goto err; + } ++ ++ output->state_invalid = false; + } + + pinfo = scanout_state->fb->format; +@@ -945,6 +949,11 @@ drm_output_apply_state_atomic(struct drm_output_state *state, + *flags |= DRM_MODE_ATOMIC_ALLOW_MODESET; + } + ++ if (output->state_invalid) { ++ drm_debug(b, "\t\t\t[atomic] output state invalid, modeset OK\n"); ++ *flags |= DRM_MODE_ATOMIC_ALLOW_MODESET; ++ } ++ + if (state->dpms == WESTON_DPMS_ON) { + ret = drm_mode_ensure_blob(b, current_mode); + if (ret != 0) +@@ -1050,6 +1059,7 @@ drm_pending_state_apply_atomic(struct drm_pending_state *pending_state, + struct drm_output_state *output_state, *tmp; + struct drm_plane *plane; + drmModeAtomicReq *req = drmModeAtomicAlloc(); ++ struct timespec now; + uint32_t flags; + int ret = 0; + +@@ -1180,14 +1190,34 @@ drm_pending_state_apply_atomic(struct drm_pending_state *pending_state, + goto out; + } + ++ weston_compositor_read_presentation_clock(b->compositor, &now); ++ + wl_list_for_each_safe(output_state, tmp, &pending_state->output_list, +- link) ++ link) { ++ struct drm_output *output = output_state->output; ++ struct drm_plane *scanout_plane = output->scanout_plane; ++ struct drm_plane_state *scanout_state = ++ drm_output_state_get_existing_plane(output_state, ++ scanout_plane); ++ ++ /* Don't have a new state to apply */ ++ if (output_state->dpms == WESTON_DPMS_ON && ++ (!scanout_state || !scanout_state->fb)) ++ continue; ++ + drm_output_assign_state(output_state, mode); ++ output->state_invalid = false; ++ ++ /* Not gonna receive flip event when dpms off */ ++ if (output_state->dpms != WESTON_DPMS_ON) ++ drm_output_update_complete(output, ++ WP_PRESENTATION_FEEDBACK_KIND_HW_COMPLETION, ++ now.tv_sec, ++ now.tv_nsec / 1000); ++ } + + b->state_invalid = false; + +- assert(wl_list_empty(&pending_state->output_list)); +- + out: + drmModeAtomicFree(req); + drm_pending_state_free(pending_state); +@@ -1286,8 +1316,6 @@ drm_pending_state_apply(struct drm_pending_state *pending_state) + + b->state_invalid = false; + +- assert(wl_list_empty(&pending_state->output_list)); +- + drm_pending_state_free(pending_state); + + return 0; +@@ -1339,8 +1367,6 @@ drm_pending_state_apply_sync(struct drm_pending_state *pending_state) + + b->state_invalid = false; + +- assert(wl_list_empty(&pending_state->output_list)); +- + drm_pending_state_free(pending_state); + + return 0; +diff --git a/libweston/compositor.c b/libweston/compositor.c +index e184349..22a8593 100644 +--- a/libweston/compositor.c ++++ b/libweston/compositor.c +@@ -157,6 +157,25 @@ weston_paint_node_destroy(struct weston_paint_node *pnode) + free(pnode); + } + ++static struct weston_layer * ++get_view_layer(struct weston_view *view); ++ ++static bool ++weston_compositor_is_static_layer(struct weston_layer *layer) ++{ ++ if (!layer) ++ return false; ++ ++ switch (layer->position) { ++ case WESTON_LAYER_POSITION_BACKGROUND: ++ case WESTON_LAYER_POSITION_UI: ++ case WESTON_LAYER_POSITION_FADE: ++ return true; ++ default: ++ return false; ++ } ++} ++ + /** Send wl_output events for mode and scale changes + * + * \param head Send on all resources bound to this head. +@@ -1367,6 +1386,22 @@ weston_view_assign_output(struct weston_view *ev) + uint32_t max, area, mask; + pixman_box32_t *e; + ++ /* The static views should bind to the specific output */ ++ if (weston_compositor_is_static_layer(get_view_layer(ev))) { ++ struct weston_view *view = ev; ++ ++ while (view && !(output = view->output)) ++ view = view->geometry.parent; ++ ++ if (output && !output->destroying) ++ ev->output_mask |= 1u << output->id; ++ else ++ weston_view_set_output(ev, NULL); ++ ++ weston_surface_assign_output(ev->surface); ++ return; ++ } ++ + new_output = NULL; + max = 0; + mask = 0; +@@ -2942,12 +2977,14 @@ weston_output_repaint(struct weston_output *output, void *repaint_data) + if (output->dirty) + weston_output_update_matrix(output); + ++ output->repaint_needed = false; + r = output->repaint(output, &output_damage, repaint_data); + + pixman_region32_fini(&output_damage); + +- output->repaint_needed = false; +- if (r == 0) ++ if (output->repaint_needed) ++ output->repaint_status = REPAINT_SCHEDULED; ++ else if (r == 0) + output->repaint_status = REPAINT_AWAITING_COMPLETION; + + weston_compositor_repick(ec); +@@ -6407,6 +6444,7 @@ weston_compositor_remove_output(struct weston_output *output) + * Use view_list in case the output did not go through repaint + * after a view came on it, lacking a paint node. Just to be sure. + */ ++ weston_compositor_build_view_list(compositor, NULL); + wl_list_for_each(view, &compositor->view_list, link) { + if (view->output_mask & (1u << output->id)) + weston_view_assign_output(view); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0014-backend-drm-Support-virtual-screen-size.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0014-backend-drm-Support-virtual-screen-size.patch new file mode 100644 index 0000000000000000000000000000000000000000..028b61220f685c3d85ccfdb2f98d513d5c43e064 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0014-backend-drm-Support-virtual-screen-size.patch @@ -0,0 +1,414 @@ +From 0a3e3bf559dea73dd489c0d3cacab6ba649db412 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 24 Jun 2020 11:59:42 +0800 +Subject: [PATCH 14/79] backend-drm: Support virtual screen size + +Support setting virtual screen size, for example: +export WESTON_DRM_VIRTUAL_SIZE=1024x768 + +Signed-off-by: Jeffy Chen +--- + libweston/backend-drm/drm-internal.h | 23 ++++++ + libweston/backend-drm/drm.c | 28 ++++++- + libweston/backend-drm/kms.c | 115 ++++++++++++++++++++++----- + libweston/backend-drm/modes.c | 22 ++++- + 4 files changed, 162 insertions(+), 26 deletions(-) + +diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h +index 3f42a25..996f587 100644 +--- a/libweston/backend-drm/drm-internal.h ++++ b/libweston/backend-drm/drm-internal.h +@@ -166,6 +166,7 @@ enum wdrm_plane_property { + WDRM_PLANE_IN_FENCE_FD, + WDRM_PLANE_FB_DAMAGE_CLIPS, + WDRM_PLANE_ZPOS, ++ WDRM_PLANE_FEATURE, + WDRM_PLANE__COUNT + }; + +@@ -179,6 +180,15 @@ enum wdrm_plane_type { + WDRM_PLANE_TYPE__COUNT + }; + ++/** ++ * Possible values for the WDRM_PLANE_FEATURE property. ++ */ ++enum wdrm_plane_feature { ++ WDRM_PLANE_FEATURE_SCALE = 0, ++ WDRM_PLANE_FEATURE_ALPHA, ++ WDRM_PLANE_FEATURE__COUNT ++}; ++ + /** + * List of properties attached to a DRM connector + */ +@@ -325,6 +335,7 @@ struct drm_backend { + bool pending_update; + int64_t last_update_ms; + int64_t last_resize_ms; ++ int64_t resize_freeze_ms; + + bool single_head; + bool head_fallback; +@@ -332,6 +343,9 @@ struct drm_backend { + drm_head_match_t *head_matches; + struct drm_head *primary_head; + struct wl_listener output_create_listener; ++ ++ int virtual_width; ++ int virtual_height; + }; + + struct drm_mode { +@@ -501,6 +515,8 @@ struct drm_plane { + struct wl_list link; + + struct weston_drm_format_array formats; ++ ++ bool can_scale; + }; + + struct drm_connector { +@@ -597,6 +613,9 @@ struct drm_output { + submit_frame_cb virtual_submit_frame; + + bool state_invalid; ++ ++ /* The dummy framebuffer for SET_CRTC. */ ++ struct drm_fb *fb_dummy; + }; + + static inline struct drm_head * +@@ -694,6 +713,10 @@ uint64_t + drm_property_get_value(struct drm_property_info *info, + const drmModeObjectProperties *props, + uint64_t def); ++bool ++drm_property_has_feature(struct drm_property_info *infos, ++ const drmModeObjectProperties *props, ++ enum wdrm_plane_feature feature); + uint64_t * + drm_property_get_range_values(struct drm_property_info *info, + const drmModeObjectProperties *props); +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index 4e00933..1c839c5 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -324,6 +324,11 @@ drm_output_update_complete(struct drm_output *output, uint32_t flags, + output->state_last = NULL; + } + ++ if (output->fb_dummy) { ++ drm_fb_unref(output->fb_dummy); ++ output->fb_dummy = NULL; ++ } ++ + if (output->destroy_pending) { + output->destroy_pending = false; + output->disable_pending = false; +@@ -397,6 +402,7 @@ drm_output_render(struct drm_output_state *state, pixman_region32_t *damage) + struct drm_property_info *damage_info = + &scanout_plane->props[WDRM_PLANE_FB_DAMAGE_CLIPS]; + struct drm_backend *b = to_drm_backend(c); ++ struct drm_mode *mode; + struct drm_fb *fb; + pixman_region32_t scanout_damage; + pixman_box32_t *rects; +@@ -440,10 +446,11 @@ drm_output_render(struct drm_output_state *state, pixman_region32_t *damage) + scanout_state->src_w = fb->width << 16; + scanout_state->src_h = fb->height << 16; + ++ mode = to_drm_mode(output->base.current_mode); + scanout_state->dest_x = 0; + scanout_state->dest_y = 0; +- scanout_state->dest_w = output->base.current_mode->width; +- scanout_state->dest_h = output->base.current_mode->height; ++ scanout_state->dest_w = mode->mode_info.hdisplay; ++ scanout_state->dest_h = mode->mode_info.vdisplay; + + pixman_region32_subtract(&c->primary_plane.damage, + &c->primary_plane.damage, damage); +@@ -516,7 +523,7 @@ drm_output_repaint(struct weston_output *output_base, + + weston_compositor_read_presentation_clock(b->compositor, &now); + now_ms = timespec_to_msec(&now); +- if (now_ms < b->last_resize_ms + DRM_RESIZE_FREEZE_MS) { ++ if (now_ms < b->last_resize_ms + b->resize_freeze_ms) { + /* Resize fullscreen/maxmium views(not always success) */ + if (now_ms < b->last_resize_ms + DRM_RESIZE_FREEZE_MS) + wl_signal_emit(&b->compositor->output_resized_signal, +@@ -852,6 +859,11 @@ drm_plane_create(struct drm_backend *b, const drmModePlane *kplane) + props, + WDRM_PLANE_TYPE__COUNT); + ++ plane->can_scale = ++ drm_property_has_feature(plane->props, ++ props, ++ WDRM_PLANE_FEATURE_SCALE); ++ + zpos_range_values = + drm_property_get_range_values(&plane->props[WDRM_PLANE_ZPOS], + props); +@@ -3298,6 +3310,16 @@ drm_backend_create(struct weston_compositor *compositor, + + b->head_matches = drm_head_matches[head_mode]; + ++ buf = getenv("WESTON_DRM_VIRTUAL_SIZE"); ++ if (buf) ++ sscanf(buf, "%dx%d", &b->virtual_width, &b->virtual_height); ++ ++ buf = getenv("WESTON_DRM_RESIZE_FREEZE_MS"); ++ if (buf) ++ b->resize_freeze_ms = atoi(buf); ++ else ++ b->resize_freeze_ms = DRM_RESIZE_FREEZE_MS; ++ + b->state_invalid = true; + b->drm.fd = -1; + +diff --git a/libweston/backend-drm/kms.c b/libweston/backend-drm/kms.c +index 4426af4..1fcbdeb 100644 +--- a/libweston/backend-drm/kms.c ++++ b/libweston/backend-drm/kms.c +@@ -56,6 +56,15 @@ struct drm_property_enum_info plane_type_enums[] = { + }, + }; + ++struct drm_property_enum_info plane_feature_enums[] = { ++ [WDRM_PLANE_FEATURE_SCALE] = { ++ .name = "scale", ++ }, ++ [WDRM_PLANE_FEATURE_ALPHA] = { ++ .name = "alpha", ++ }, ++}; ++ + const struct drm_property_info plane_props[] = { + [WDRM_PLANE_TYPE] = { + .name = "type", +@@ -76,6 +85,11 @@ const struct drm_property_info plane_props[] = { + [WDRM_PLANE_IN_FENCE_FD] = { .name = "IN_FENCE_FD" }, + [WDRM_PLANE_FB_DAMAGE_CLIPS] = { .name = "FB_DAMAGE_CLIPS" }, + [WDRM_PLANE_ZPOS] = { .name = "zpos" }, ++ [WDRM_PLANE_FEATURE] = { ++ .name = "FEATURE", ++ .enum_values = plane_feature_enums, ++ .num_enum_values = WDRM_PLANE_FEATURE__COUNT, ++ }, + }; + + struct drm_property_enum_info dpms_state_enums[] = { +@@ -213,6 +227,31 @@ drm_property_get_value(struct drm_property_info *info, + return def; + } + ++bool ++drm_property_has_feature(struct drm_property_info *infos, ++ const drmModeObjectProperties *props, ++ enum wdrm_plane_feature feature) ++{ ++ struct drm_property_info *info = &infos[WDRM_PLANE_FEATURE]; ++ unsigned int i; ++ ++ if (info->prop_id == 0 || ++ feature >= info->num_enum_values || ++ !info->enum_values[feature].valid) ++ return false; ++ ++ for (i = 0; i < props->count_props; i++) { ++ if (props->props[i] != info->prop_id) ++ continue; ++ ++ if (props->prop_values[i] & ++ (1LL << info->enum_values[feature].value)) ++ return true; ++ } ++ ++ return false; ++} ++ + /** + * Get the current range values of a KMS property + * +@@ -333,9 +372,11 @@ drm_property_info_populate(struct drm_backend *b, + } + + if (info[j].num_enum_values == 0 && +- (prop->flags & DRM_MODE_PROP_ENUM)) { ++ (prop->flags & DRM_MODE_PROP_ENUM || ++ prop->flags & DRM_MODE_PROP_BITMASK)) { + weston_log("DRM: expected property %s to not be an" +- " enum, but it is; ignoring\n", prop->name); ++ " enum or bitmask, but it is; ignoring\n", ++ prop->name); + drmModeFreeProperty(prop); + continue; + } +@@ -356,9 +397,11 @@ drm_property_info_populate(struct drm_backend *b, + continue; + } + +- if (!(prop->flags & DRM_MODE_PROP_ENUM)) { +- weston_log("DRM: expected property %s to be an enum," +- " but it is not; ignoring\n", prop->name); ++ if (!(prop->flags & DRM_MODE_PROP_ENUM || ++ prop->flags & DRM_MODE_PROP_BITMASK)) { ++ weston_log("DRM: expected property %s to be an enum or " ++ "bitmask, but it is not; ignoring\n", ++ prop->name); + drmModeFreeProperty(prop); + info[j].prop_id = 0; + continue; +@@ -660,6 +703,7 @@ drm_output_apply_state_legacy(struct drm_output_state *state) + int n_conn = 0; + struct timespec now; + int ret = 0; ++ bool scaling; + + wl_list_for_each(head, &output->base.head_list, base.output_link) { + assert(n_conn < MAX_CLONED_CONNECTORS); +@@ -707,30 +751,36 @@ drm_output_apply_state_legacy(struct drm_output_state *state) + if (!scanout_state || !scanout_state->fb) + return 0; + +- /* The legacy SetCrtc API doesn't allow us to do scaling, and the +- * legacy PageFlip API doesn't allow us to do clipping either. */ +- assert(scanout_state->src_x == 0); +- assert(scanout_state->src_y == 0); +- assert(scanout_state->src_w == +- (unsigned) (output->base.current_mode->width << 16)); +- assert(scanout_state->src_h == +- (unsigned) (output->base.current_mode->height << 16)); +- assert(scanout_state->dest_x == 0); +- assert(scanout_state->dest_y == 0); +- assert(scanout_state->dest_w == scanout_state->src_w >> 16); +- assert(scanout_state->dest_h == scanout_state->src_h >> 16); + /* The legacy SetCrtc API doesn't support fences */ + assert(scanout_state->in_fence_fd == -1); + + mode = to_drm_mode(output->base.current_mode); ++ ++ scaling = scanout_state->src_w >> 16 != scanout_state->dest_w || ++ scanout_state->src_h >> 16 != scanout_state->dest_h; ++ + if (output->state_invalid || +- !scanout_plane->state_cur->fb || +- scanout_plane->state_cur->fb->strides[0] != +- scanout_state->fb->strides[0]) { ++ !scanout_plane->state_cur->fb) { ++ int fb_id = scanout_state->fb->fb_id; ++ ++ /* Use a dummy fb for initial mode setting */ ++ if (!output->fb_dummy) { ++ output->fb_dummy = ++ drm_fb_create_dumb(backend, ++ mode->mode_info.hdisplay, ++ mode->mode_info.vdisplay, ++ output->gbm_format); ++ if (!output->fb_dummy) { ++ weston_log("failed to create fb_dummy\n"); ++ goto err; ++ } ++ } ++ ++ if (n_conn == 1 || scaling) ++ fb_id = output->fb_dummy->fb_id; + + ret = drmModeSetCrtc(backend->drm.fd, crtc->crtc_id, +- scanout_state->fb->fb_id, +- 0, 0, ++ fb_id, 0, 0, + connectors, n_conn, + &mode->mode_info); + if (ret) { +@@ -741,6 +791,27 @@ drm_output_apply_state_legacy(struct drm_output_state *state) + output->state_invalid = false; + } + ++ if (scaling && !output->scanout_plane->can_scale) { ++ weston_log("Couldn't do scaling on output %s\n", ++ output->base.name); ++ weston_output_finish_frame(&output->base, NULL, ++ WP_PRESENTATION_FEEDBACK_INVALID); ++ return 0; ++ } ++ ++ ret = drmModeSetPlane(backend->drm.fd, ++ scanout_state->plane->plane_id, ++ crtc->crtc_id, ++ scanout_state->fb->fb_id, 0, ++ scanout_state->dest_x, scanout_state->dest_y, ++ scanout_state->dest_w, scanout_state->dest_h, ++ scanout_state->src_x, scanout_state->src_y, ++ scanout_state->src_w, scanout_state->src_h); ++ if (ret) { ++ weston_log("set plane failed: %s\n", strerror(errno)); ++ goto err; ++ } ++ + pinfo = scanout_state->fb->format; + drm_debug(backend, "\t[CRTC:%u, PLANE:%u] FORMAT: %s\n", + crtc->crtc_id, scanout_state->plane->plane_id, +diff --git a/libweston/backend-drm/modes.c b/libweston/backend-drm/modes.c +index a071375..e7bbfa5 100644 +--- a/libweston/backend-drm/modes.c ++++ b/libweston/backend-drm/modes.c +@@ -378,6 +378,7 @@ drm_refresh_rate_mHz(const drmModeModeInfo *info) + static struct drm_mode * + drm_output_add_mode(struct drm_output *output, const drmModeModeInfo *info) + { ++ struct drm_backend *b = to_drm_backend(output->base.compositor); + struct drm_mode *mode; + + mode = malloc(sizeof *mode); +@@ -388,6 +389,11 @@ drm_output_add_mode(struct drm_output *output, const drmModeModeInfo *info) + mode->base.width = info->hdisplay; + mode->base.height = info->vdisplay; + ++ if (b->virtual_width && b->virtual_height) { ++ mode->base.width = b->virtual_width; ++ mode->base.height = b->virtual_height; ++ } ++ + mode->base.refresh = drm_refresh_rate_mHz(info); + mode->mode_info = *info; + mode->blob_id = 0; +@@ -434,20 +440,34 @@ drm_output_print_modes(struct drm_output *output) + struct weston_mode *m; + struct drm_mode *dm; + const char *aspect_ratio; ++ bool virtual_size = false; + + wl_list_for_each(m, &output->base.mode_list, link) { + dm = to_drm_mode(m); + + aspect_ratio = aspect_ratio_to_string(m->aspect_ratio); + weston_log_continue(STAMP_SPACE "%dx%d@%.1f%s%s%s, %.1f MHz\n", +- m->width, m->height, m->refresh / 1000.0, ++ dm->mode_info.hdisplay, ++ dm->mode_info.vdisplay, ++ m->refresh / 1000.0, + aspect_ratio, + m->flags & WL_OUTPUT_MODE_PREFERRED ? + ", preferred" : "", + m->flags & WL_OUTPUT_MODE_CURRENT ? + ", current" : "", + dm->mode_info.clock / 1000.0); ++ ++ if(m->flags & WL_OUTPUT_MODE_CURRENT && ++ (dm->mode_info.hdisplay != m->width || ++ dm->mode_info.vdisplay != m->height)) ++ virtual_size = true; + } ++ ++ if (virtual_size) ++ weston_log("Output %s: using virtual size %dx%d\n", ++ output->base.name, ++ output->base.current_mode->width, ++ output->base.current_mode->height); + } + + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0015-backend-drm-Support-mirror-mode.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0015-backend-drm-Support-mirror-mode.patch new file mode 100644 index 0000000000000000000000000000000000000000..e2efad3a15cc64d64d5ef0a12ec44e3aadf2e418 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0015-backend-drm-Support-mirror-mode.patch @@ -0,0 +1,722 @@ +From 15243cd3aec009b59b4b6aa4698b56ed3506c304 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 19 Nov 2020 09:41:47 +0800 +Subject: [PATCH 15/79] backend-drm: Support mirror mode + +Set env "WESTON_DRM_MIRROR" to enable mirror mode, and set env +"WESTON_DRM_KEEP_RATIO" to keep the aspect ratio. + +Signed-off-by: Jeffy Chen +--- + clients/desktop-shell.c | 9 +- + desktop-shell/shell.c | 3 + + include/libweston/libweston.h | 4 + + libweston/backend-drm/drm-gbm.c | 4 +- + libweston/backend-drm/drm-internal.h | 10 + + libweston/backend-drm/drm.c | 328 +++++++++++++++++++++++++- + libweston/backend-drm/meson.build | 3 +- + libweston/backend-drm/state-propose.c | 22 +- + libweston/compositor.c | 24 +- + libweston/input.c | 7 + + meson.build | 5 + + 11 files changed, 398 insertions(+), 21 deletions(-) + +diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c +index 56c3976..8711399 100644 +--- a/clients/desktop-shell.c ++++ b/clients/desktop-shell.c +@@ -1062,9 +1062,14 @@ desktop_shell_configure(void *data, + struct wl_surface *surface, + int32_t width, int32_t height) + { +- struct window *window = wl_surface_get_user_data(surface); +- struct surface *s = window_get_user_data(window); ++ struct window *window; ++ struct surface *s; ++ ++ if (!surface) ++ return; + ++ window = wl_surface_get_user_data(surface); ++ s = window_get_user_data(window); + s->configure(data, desktop_shell, edges, window, width, height); + } + +diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c +index 515c57f..18bec12 100644 +--- a/desktop-shell/shell.c ++++ b/desktop-shell/shell.c +@@ -4280,6 +4280,9 @@ weston_view_set_initial_position(struct weston_view *view, + } + + wl_list_for_each(output, &compositor->output_list, link) { ++ if (output->unavailable) ++ continue; ++ + if (pixman_region32_contains_point(&output->region, ix, iy, NULL)) { + target_output = output; + break; +diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h +index bdecc19..8868622 100644 +--- a/include/libweston/libweston.h ++++ b/include/libweston/libweston.h +@@ -411,7 +411,11 @@ struct weston_output { + */ + void (*detach_head)(struct weston_output *output, + struct weston_head *head); ++ ++ bool unavailable; + }; ++#define weston_output_valid(o) \ ++ ((o) && !(o)->destroying && !(o)->unavailable) + + enum weston_pointer_motion_mask { + WESTON_POINTER_MOTION_ABS = 1 << 0, +diff --git a/libweston/backend-drm/drm-gbm.c b/libweston/backend-drm/drm-gbm.c +index d0a4c6c..d7bd05f 100644 +--- a/libweston/backend-drm/drm-gbm.c ++++ b/libweston/backend-drm/drm-gbm.c +@@ -265,8 +265,8 @@ drm_output_fini_egl(struct drm_output *output) + /* Destroying the GBM surface will destroy all our GBM buffers, + * regardless of refcount. Ensure we destroy them here. */ + if (!b->shutting_down && +- output->scanout_plane->state_cur->fb && +- output->scanout_plane->state_cur->fb->type == BUFFER_GBM_SURFACE) { ++ output->scanout_plane->state_cur->fb && (output->is_mirror || ++ output->scanout_plane->state_cur->fb->type == BUFFER_GBM_SURFACE)) { + drm_plane_reset_state(output->scanout_plane); + } + +diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h +index 996f587..1625be2 100644 +--- a/libweston/backend-drm/drm-internal.h ++++ b/libweston/backend-drm/drm-internal.h +@@ -346,6 +346,8 @@ struct drm_backend { + + int virtual_width; + int virtual_height; ++ ++ bool mirror_mode; + }; + + struct drm_mode { +@@ -603,6 +605,10 @@ struct drm_output { + int current_image; + pixman_region32_t previous_damage; + ++ /* Wrap fb for scale/rotate usage */ ++ struct drm_fb *wrap[2]; ++ int next_wrap; ++ + struct vaapi_recorder *recorder; + struct wl_listener recorder_frame_listener; + +@@ -616,6 +622,10 @@ struct drm_output { + + /* The dummy framebuffer for SET_CRTC. */ + struct drm_fb *fb_dummy; ++ ++ bool is_mirror; ++ ++ pixman_box32_t plane_bounds; + }; + + static inline struct drm_head * +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index 1c839c5..696df68 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -67,6 +67,11 @@ + #include "linux-dmabuf-unstable-v1-server-protocol.h" + #include "linux-explicit-synchronization.h" + ++#ifdef HAVE_RGA ++#include ++#include ++#endif ++ + static const char default_seat[] = "seat0"; + + static inline bool +@@ -85,6 +90,118 @@ drm_head_is_external(struct drm_head *head) + } + }; + ++static int ++drm_output_get_rotation(struct drm_output *output) ++{ ++ switch (output->base.transform) { ++ case WL_OUTPUT_TRANSFORM_90: ++ case WL_OUTPUT_TRANSFORM_FLIPPED_90: ++ return 90; ++ case WL_OUTPUT_TRANSFORM_180: ++ case WL_OUTPUT_TRANSFORM_FLIPPED_180: ++ return 180; ++ case WL_OUTPUT_TRANSFORM_270: ++ case WL_OUTPUT_TRANSFORM_FLIPPED_270: ++ return 270; ++ default: ++ return 0; ++ } ++} ++ ++#ifdef HAVE_RGA ++static inline RgaSURF_FORMAT ++rga_get_format(const struct pixel_format_info *format) ++{ ++ switch (format->bpp) { ++ case 32: ++ return RK_FORMAT_BGRX_8888; ++ case 16: ++ return RK_FORMAT_RGB_565; ++ default: ++ return RK_FORMAT_UNKNOWN; ++ } ++} ++#endif ++ ++static int ++drm_copy_fb(struct drm_fb *src, struct drm_fb *dst, int rotation, ++ int src_width, int src_height) ++{ ++#ifndef HAVE_RGA ++ /* TODO: Use pixman to do the copy */ ++ weston_log("rga not supported\n"); ++ return -1; ++#else ++ RgaSURF_FORMAT src_format, dst_format; ++ rga_info_t src_info = {0}; ++ rga_info_t dst_info = {0}; ++ int src_fd, dst_fd; ++ int ret; ++ ++ static bool rga_supported = true; ++ static bool rga_inited = false; ++ ++ if (!rga_supported) ++ return -1; ++ ++ if (!rga_inited) { ++ ret = c_RkRgaInit(); ++ if (ret < 0) { ++ weston_log("rga not supported\n"); ++ rga_supported = false; ++ return ret; ++ } ++ rga_inited = true; ++ } ++ ++ src_format = rga_get_format(src->format); ++ dst_format = rga_get_format(dst->format); ++ ++ if (src_format == RK_FORMAT_UNKNOWN || ++ dst_format == RK_FORMAT_UNKNOWN) { ++ weston_log("unsupported fb format\n"); ++ return -1; ++ } ++ ++ ret = drmPrimeHandleToFD(src->fd, src->handles[0], ++ DRM_CLOEXEC, &src_fd); ++ if (ret < 0) ++ return ret; ++ ++ ret = drmPrimeHandleToFD(dst->fd, dst->handles[0], ++ DRM_CLOEXEC, &dst_fd); ++ if (ret < 0) ++ goto close_src; ++ ++ src_info.fd = src_fd; ++ src_info.mmuFlag = 1; ++ ++ rga_set_rect(&src_info.rect, 0, 0, src_width, src_height, ++ src->strides[0] * 8 / src->format->bpp, src->height, ++ src_format); ++ ++ if (rotation == 90) ++ src_info.rotation = HAL_TRANSFORM_ROT_90; ++ else if (rotation == 180) ++ src_info.rotation = HAL_TRANSFORM_ROT_180; ++ else if (rotation == 270) ++ src_info.rotation = HAL_TRANSFORM_ROT_270; ++ ++ dst_info.fd = dst_fd; ++ dst_info.mmuFlag = 1; ++ ++ rga_set_rect(&dst_info.rect, 0, 0, dst->width, dst->height, ++ dst->strides[0] * 8 / dst->format->bpp, dst->height, ++ dst_format); ++ ++ ret = c_RkRgaBlit(&src_info, &dst_info, NULL); ++ close(dst_fd); ++close_src: ++ close(src_fd); ++ return ret; ++#endif ++} ++ + static void + drm_backend_update_outputs(struct drm_backend *b) + { +@@ -94,6 +211,26 @@ drm_backend_update_outputs(struct drm_backend *b) + return; + + primary = b->primary_head->base.output; ++ ++ if (b->mirror_mode) { ++ wl_list_for_each(base, &b->compositor->output_list, link) { ++ struct drm_output *output = to_drm_output(base); ++ bool is_mirror = base != primary; ++ ++ if (output->is_mirror == is_mirror) ++ continue; ++ ++ /* Make mirrors unavailable for normal views */ ++ output->base.unavailable = is_mirror; ++ ++ output->is_mirror = is_mirror; ++ output->state_invalid = true; ++ ++ weston_log("Output %s changed to %s output\n", ++ base->name, is_mirror ? "mirror" : "main"); ++ } ++ } ++ + if (!primary) + return; + +@@ -392,6 +529,69 @@ drm_output_render_pixman(struct drm_output_state *state, + return drm_fb_ref(output->dumb[output->current_image]); + } + ++static struct drm_fb * ++drm_output_get_fb(struct drm_pending_state *pending_state, ++ struct weston_output *output_base) ++{ ++ struct drm_output *output = to_drm_output(output_base); ++ struct drm_plane_state *scanout_state; ++ struct drm_output_state *state; ++ struct drm_fb *fb = output->scanout_plane->state_cur->fb; ++ ++ state = drm_pending_state_get_output(pending_state, output); ++ if (!state) ++ return fb; ++ ++ scanout_state = ++ drm_output_state_get_existing_plane(state, ++ output->scanout_plane); ++ if (!scanout_state || !scanout_state->fb) ++ return fb; ++ ++ return scanout_state->fb; ++} ++ ++static void ++drm_output_try_destroy_wrap_fb(struct drm_output *output) ++{ ++ if (output->wrap[0]) { ++ drm_fb_unref(output->wrap[0]); ++ output->wrap[0] = NULL; ++ } ++ ++ if (output->wrap[1]) { ++ drm_fb_unref(output->wrap[1]); ++ output->wrap[1] = NULL; ++ } ++ ++ output->next_wrap = 0; ++} ++ ++static struct drm_fb * ++drm_output_get_wrap_fb(struct drm_backend *b, struct drm_output *output, ++ int width, int height) ++{ ++ struct drm_fb *fb = output->wrap[output->next_wrap]; ++ ++ if (fb) { ++ if (fb->width == width && fb->height == height) ++ goto out; ++ ++ drm_fb_unref(fb); ++ } ++ ++ fb = drm_fb_create_dumb(b, width, height, output->gbm_format); ++ if (!fb) { ++ weston_log("failed to create wrap fb\n"); ++ return NULL; ++ } ++ ++ output->wrap[output->next_wrap] = fb; ++out: ++ output->next_wrap ^= 1; ++ return drm_fb_ref(fb); ++} ++ + void + drm_output_render(struct drm_output_state *state, pixman_region32_t *damage) + { +@@ -403,10 +603,13 @@ drm_output_render(struct drm_output_state *state, pixman_region32_t *damage) + &scanout_plane->props[WDRM_PLANE_FB_DAMAGE_CLIPS]; + struct drm_backend *b = to_drm_backend(c); + struct drm_mode *mode; +- struct drm_fb *fb; ++ struct drm_fb *fb = NULL; + pixman_region32_t scanout_damage; + pixman_box32_t *rects; + int n_rects; ++ int sw, sh, dx, dy, dw, dh; ++ int rotation = 0; ++ bool scaling; + + /* If we already have a client buffer promoted to scanout, then we don't + * want to render. */ +@@ -414,6 +617,35 @@ drm_output_render(struct drm_output_state *state, pixman_region32_t *damage) + if (scanout_state->fb) + return; + ++ if (!output->is_mirror) { ++ struct drm_output *tmp; ++ ++ /* Repaint all mirrors when updating main output */ ++ wl_list_for_each(tmp, &b->compositor->output_list, base.link) ++ if (tmp->is_mirror) ++ weston_output_schedule_repaint(&tmp->base); ++ } else { ++ if (!b->primary_head) ++ goto out; ++ ++ rotation = drm_output_get_rotation(output); ++ ++ fb = drm_output_get_fb(state->pending_state, ++ b->primary_head->base.output); ++ if (fb) { ++ drm_fb_ref(fb); ++ ++ pixman_region32_init(&scanout_damage); ++ wl_signal_emit(&output->base.frame_signal, ++ &scanout_damage); ++ pixman_region32_fini(&scanout_damage); ++ } else { ++ weston_compositor_damage_all(b->compositor); ++ } ++ ++ goto out; ++ } ++ + /* + * If we don't have any damage on the primary plane, and we already + * have a renderer buffer active, we can reuse it; else we pass +@@ -433,24 +665,86 @@ drm_output_render(struct drm_output_state *state, pixman_region32_t *damage) + fb = drm_output_render_gl(state, damage); + } + ++out: + if (!fb) { + drm_plane_state_put_back(scanout_state); + return; + } + ++ sw = fb->width; ++ sh = fb->height; ++ ++ dx = output->plane_bounds.x1; ++ dy = output->plane_bounds.y1; ++ dw = output->plane_bounds.x2 - output->plane_bounds.x1; ++ dh = output->plane_bounds.y2 - output->plane_bounds.y1; ++ ++ if (!dw || !dh) { ++ mode = to_drm_mode(output->base.current_mode); ++ dw = mode->mode_info.hdisplay; ++ dh = mode->mode_info.vdisplay; ++ } ++ ++ if (output->is_mirror && getenv("WESTON_DRM_KEEP_RATIO")) { ++ float src_ratio = (float) sw / sh; ++ float dst_ratio = (float) dw / dh; ++ int offset; ++ ++ if (rotation % 180) ++ src_ratio = 1 / src_ratio; ++ ++ if (src_ratio > dst_ratio) { ++ offset = dh - dw / src_ratio; ++ dy = offset / 2; ++ dh -= offset; ++ } else { ++ offset = dw - dh * src_ratio; ++ dx = offset / 2; ++ dw -= offset; ++ } ++ } ++ ++ scaling = sw != dw || sh != dh; ++ ++ if (rotation || (scaling && !output->scanout_plane->can_scale)) { ++ struct drm_fb *wrap_fb = ++ drm_output_get_wrap_fb(b, output, dw, dh); ++ if (!wrap_fb) { ++ weston_log("failed to get wrap fb\n"); ++ goto err; ++ } ++ ++ if (drm_copy_fb(fb, wrap_fb, rotation, sw, sh) < 0) { ++ weston_log("failed to copy fb\n"); ++ goto err; ++ } ++ ++ sw = dw; ++ sh = dh; ++ ++ drm_fb_unref(fb); ++ fb = wrap_fb; ++ } else { ++ drm_output_try_destroy_wrap_fb(output); ++ } ++ + scanout_state->fb = fb; ++ fb = NULL; ++ + scanout_state->output = output; + + scanout_state->src_x = 0; + scanout_state->src_y = 0; +- scanout_state->src_w = fb->width << 16; +- scanout_state->src_h = fb->height << 16; ++ scanout_state->src_w = sw << 16; ++ scanout_state->src_h = sh << 16; + +- mode = to_drm_mode(output->base.current_mode); +- scanout_state->dest_x = 0; +- scanout_state->dest_y = 0; +- scanout_state->dest_w = mode->mode_info.hdisplay; +- scanout_state->dest_h = mode->mode_info.vdisplay; ++ scanout_state->dest_x = dx; ++ scanout_state->dest_y = dy; ++ scanout_state->dest_w = dw; ++ scanout_state->dest_h = dh; ++ ++ if (output->is_mirror) ++ return; + + pixman_region32_subtract(&c->primary_plane.damage, + &c->primary_plane.damage, damage); +@@ -499,6 +793,12 @@ drm_output_render(struct drm_output_state *state, pixman_region32_t *damage) + &scanout_state->damage_blob_id); + + pixman_region32_fini(&scanout_damage); ++ return; ++err: ++ if (fb) ++ drm_fb_unref(fb); ++ ++ drm_plane_state_put_back(scanout_state); + } + + static int +@@ -1296,8 +1596,8 @@ drm_output_fini_pixman(struct drm_output *output) + /* Destroying the Pixman surface will destroy all our buffers, + * regardless of refcount. Ensure we destroy them here. */ + if (!b->shutting_down && +- output->scanout_plane->state_cur->fb && +- output->scanout_plane->state_cur->fb->type == BUFFER_PIXMAN_DUMB) { ++ output->scanout_plane->state_cur->fb && (output->is_mirror || ++ output->scanout_plane->state_cur->fb->type == BUFFER_PIXMAN_DUMB)) { + drm_plane_reset_state(output->scanout_plane); + } + +@@ -1975,6 +2275,8 @@ drm_output_destroy(struct weston_output *base) + assert(!output->state_last); + drm_output_state_free(output->state_cur); + ++ drm_output_try_destroy_wrap_fb(output); ++ + free(output); + } + +@@ -3320,6 +3622,12 @@ drm_backend_create(struct weston_compositor *compositor, + else + b->resize_freeze_ms = DRM_RESIZE_FREEZE_MS; + ++ buf = getenv("WESTON_DRM_MIRROR"); ++ if (buf && buf[0] == '1') { ++ b->mirror_mode = true; ++ weston_log("Entering mirror mode.\n"); ++ } ++ + b->state_invalid = true; + b->drm.fd = -1; + +diff --git a/libweston/backend-drm/meson.build b/libweston/backend-drm/meson.build +index 23db912..6dbd05d 100644 +--- a/libweston/backend-drm/meson.build ++++ b/libweston/backend-drm/meson.build +@@ -38,7 +38,8 @@ deps_drm = [ + dep_libdrm, + dep_libinput_backend, + dependency('libudev', version: '>= 136'), +- dep_backlight ++ dep_backlight, ++ dep_rga + ] + + if get_option('renderer-gl') +diff --git a/libweston/backend-drm/state-propose.c b/libweston/backend-drm/state-propose.c +index 7b350aa..48e6de2 100644 +--- a/libweston/backend-drm/state-propose.c ++++ b/libweston/backend-drm/state-propose.c +@@ -54,6 +54,21 @@ static const char *const drm_output_propose_state_mode_as_string[] = { + [DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY] = "plane-only state" + }; + ++static bool ++drm_is_mirroring(struct drm_backend *b) ++{ ++ struct drm_output *tmp; ++ ++ if (!b->mirror_mode) ++ return false; ++ ++ wl_list_for_each(tmp, &b->compositor->output_list, base.link) ++ if (tmp->is_mirror) ++ return true; ++ ++ return false; ++} ++ + static const char * + drm_propose_state_mode_to_string(enum drm_output_propose_state_mode mode) + { +@@ -466,7 +481,7 @@ drm_output_try_view_on_plane(struct drm_plane *plane, + + switch (plane->type) { + case WDRM_PLANE_TYPE_CURSOR: +- if (b->cursors_are_broken) { ++ if (b->cursors_are_broken || drm_is_mirroring(b)) { + availability = NO_PLANES_ACCEPTED; + goto out; + } +@@ -1102,7 +1117,10 @@ drm_assign_planes(struct weston_output *output_base, void *repaint_data) + drm_debug(b, "\t[repaint] preparing state for output %s (%lu)\n", + output_base->name, (unsigned long) output_base->id); + +- if (!b->sprites_are_broken && !output->virtual) { ++ /* Force single plane in mirror mode */ ++ if (drm_is_mirroring(b)) { ++ drm_debug(b, "\t[state] no overlay plane in mirror mode\n"); ++ } else if (!b->sprites_are_broken && !output->virtual) { + drm_debug(b, "\t[repaint] trying planes-only build state\n"); + state = drm_output_propose_state(output_base, pending_state, mode); + if (!state) { +diff --git a/libweston/compositor.c b/libweston/compositor.c +index 22a8593..7680445 100644 +--- a/libweston/compositor.c ++++ b/libweston/compositor.c +@@ -1407,7 +1407,7 @@ weston_view_assign_output(struct weston_view *ev) + mask = 0; + pixman_region32_init(®ion); + wl_list_for_each(output, &ec->output_list, link) { +- if (output->destroying) ++ if (!weston_output_valid(output)) + continue; + + pixman_region32_intersect(®ion, &ev->transform.boundingbox, +@@ -5249,6 +5249,9 @@ bind_output(struct wl_client *client, + static void + weston_head_add_global(struct weston_head *head) + { ++ if (head->global || !weston_output_valid(head->output)) ++ return; ++ + head->global = wl_global_create(head->compositor->wl_display, + &wl_output_interface, 3, + head, bind_output); +@@ -5284,6 +5287,15 @@ weston_head_remove_global(struct weston_head *head) + wl_list_init(&head->xdg_output_resource_list); + } + ++static void ++weston_head_update_global(struct weston_head *head) ++{ ++ if (weston_output_valid(head->output)) ++ weston_head_add_global(head); ++ else ++ weston_head_remove_global(head); ++} ++ + /** Get the backing object of wl_output + * + * \param resource A wl_output protocol object. +@@ -6079,11 +6091,15 @@ WL_EXPORT void + weston_compositor_reflow_outputs(struct weston_compositor *compositor) + { + struct weston_output *output; ++ struct weston_head *head; + int x, y, next_x, next_y; + + next_x = next_y = 0; + wl_list_for_each(output, &compositor->output_list, link) { +- if (output->destroying) ++ wl_list_for_each(head, &output->head_list, output_link) ++ weston_head_update_global(head); ++ ++ if (!weston_output_valid(output)) + continue; + + x = next_x; +@@ -6300,11 +6316,11 @@ weston_compositor_add_output(struct weston_compositor *compositor, + wl_list_insert(compositor->output_list.prev, &output->link); + output->enabled = true; + ++ wl_signal_emit(&compositor->output_created_signal, output); ++ + wl_list_for_each(head, &output->head_list, output_link) + weston_head_add_global(head); + +- wl_signal_emit(&compositor->output_created_signal, output); +- + /* + * Use view_list, as paint nodes have not been created for this + * output yet. Any existing view might touch this new output. +diff --git a/libweston/input.c b/libweston/input.c +index 6fb4bed..ec7e416 100644 +--- a/libweston/input.c ++++ b/libweston/input.c +@@ -1688,6 +1688,10 @@ weston_pointer_clamp(struct weston_pointer *pointer, wl_fixed_t *fx, wl_fixed_t + wl_list_for_each(output, &ec->output_list, link) { + if (pointer->seat->output && pointer->seat->output != output) + continue; ++ ++ if (output->unavailable) ++ continue; ++ + if (pixman_region32_contains_point(&output->region, + x, y, NULL)) + valid = 1; +@@ -1757,6 +1761,9 @@ weston_pointer_handle_output_destroy(struct wl_listener *listener, void *data) + y = wl_fixed_to_int(pointer->y); + + wl_list_for_each(output, &ec->output_list, link) { ++ if (output->unavailable) ++ continue; ++ + if (pixman_region32_contains_point(&output->region, + x, y, NULL)) + return; +diff --git a/meson.build b/meson.build +index f5aa460..feecd45 100644 +--- a/meson.build ++++ b/meson.build +@@ -145,6 +145,11 @@ if get_option('deprecated-wl-shell') + config_h.set('HAVE_DEPRECATED_WL_SHELL', '1') + endif + ++dep_rga = dependency('librga', required: false) ++if dep_rga.found() ++ config_h.set('HAVE_RGA', '1') ++endif ++ + dep_wayland_server = dependency('wayland-server', version: '>= 1.18.0') + dep_wayland_client = dependency('wayland-client', version: '>= 1.18.0') + dep_pixman = dependency('pixman-1', version: '>= 0.25.2') +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0016-backend-drm-Support-controlling-output-dynamically.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0016-backend-drm-Support-controlling-output-dynamically.patch new file mode 100644 index 0000000000000000000000000000000000000000..ee6d803e5160ec27ad8fb3b3d0a85ae304154e3f --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0016-backend-drm-Support-controlling-output-dynamically.patch @@ -0,0 +1,830 @@ +From ea9254bbf829ea582c004aeff0058c24f7bb1080 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 3 Jul 2020 12:37:37 +0800 +Subject: [PATCH 16/79] backend-drm: Support controlling output dynamically + +Use config file to set output's rotate/down-scale/size/pos/mode/off/ +freeze/display-rectangle and prefer/primary output. + +Default config file is "/tmp/.weston_drm.conf", can override with +"WESTON_DRM_CONFIG" environment. + +Supported configs format is "output::", for +example: +echo "output:DSI-1:off" >> /tmp/.weston_drm.conf +echo "output:eDP-1:freeze" >> /tmp/.weston_drm.conf +echo "output:all:rotate90" >> /tmp/.weston_drm.conf +echo "output:all:rect=<100,20,1636,2068>" >> /tmp/.weston_drm.conf +echo "output:HDMI-A-1:mode=800x600" >> /tmp/.weston_drm.conf +echo "output:HDMI-A-1:pos=100,200" >> /tmp/.weston_drm.conf +echo "output:HDMI-A-1:size=1920x1080" >> /tmp/.weston_drm.conf +echo "output:HDMI-A-1:prefer" >> /tmp/.weston_drm.conf +echo "output:HDMI-A-1:primary" >> /tmp/.weston_drm.conf +echo "output:HDMI-A-1:down-scale=0.5" >> /tmp/.weston_drm.conf + +Signed-off-by: Jeffy Chen +--- + compositor/main.c | 14 ++ + desktop-shell/shell.c | 58 +++++- + include/libweston/libweston.h | 7 + + libweston/backend-drm/drm-internal.h | 16 ++ + libweston/backend-drm/drm.c | 264 ++++++++++++++++++++++++++- + libweston/backend-drm/modes.c | 20 +- + libweston/compositor.c | 50 +++-- + libweston/pixman-renderer.c | 3 + + libweston/renderer-gl/gl-renderer.c | 4 + + 9 files changed, 397 insertions(+), 39 deletions(-) + +diff --git a/compositor/main.c b/compositor/main.c +index 47bf540..a4f679a 100644 +--- a/compositor/main.c ++++ b/compositor/main.c +@@ -1832,6 +1832,20 @@ drm_backend_output_configure(struct weston_output *output, + } + free(s); + ++ weston_config_section_get_string(section, "pos", &s, NULL); ++ if (s) { ++ if (sscanf(s, "%d,%d", &output->x, &output->y) == 2) ++ output->fixed_position = true; ++ free(s); ++ } ++ ++ weston_config_section_get_string(section, "size", &s, NULL); ++ if (s) { ++ if (sscanf(s, "%dx%d", &output->width, &output->height) == 2) ++ output->fixed_size = true; ++ free(s); ++ } ++ + if (api->set_mode(output, mode, modeline) < 0) { + weston_log("Cannot configure an output using weston_drm_output_api.\n"); + free(modeline); +diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c +index 18bec12..8b4ed45 100644 +--- a/desktop-shell/shell.c ++++ b/desktop-shell/shell.c +@@ -4254,7 +4254,7 @@ weston_view_set_initial_position(struct weston_view *view, + int ix = 0, iy = 0; + int32_t range_x, range_y; + int32_t x, y; +- struct weston_output *output, *target_output = NULL; ++ struct weston_output *output, *target_output = NULL, *prefer_output = NULL; + struct weston_seat *seat; + pixman_rectangle32_t area; + +@@ -4279,16 +4279,20 @@ weston_view_set_initial_position(struct weston_view *view, + } + } + +- wl_list_for_each(output, &compositor->output_list, link) { ++ wl_list_for_each_reverse(output, &compositor->output_list, link) { + if (output->unavailable) + continue; + +- if (pixman_region32_contains_point(&output->region, ix, iy, NULL)) { ++ if (output == compositor->prefer_output) ++ prefer_output = output; ++ ++ if (pixman_region32_contains_point(&output->region, ix, iy, NULL)) + target_output = output; +- break; +- } + } + ++ if (prefer_output) ++ target_output = prefer_output; ++ + if (!target_output) { + weston_view_set_position(view, 10 + random() % 400, + 10 + random() % 400); +@@ -4890,6 +4894,41 @@ shell_resize_surface_to_output(struct desktop_shell *shell, + output->height); + } + ++static void ++handle_output_resize_layer(struct desktop_shell *shell, ++ struct weston_layer *layer, void *data) ++{ ++ struct weston_output *output = data; ++ struct weston_view *view; ++ ++ wl_list_for_each(view, &layer->view_list.link, layer_link.link) { ++ struct weston_desktop_surface *desktop_surface; ++ struct shell_surface *shsurf; ++ bool dirty = false; ++ ++ if (view->output != output) ++ continue; ++ ++ shsurf = get_shell_surface(view->surface); ++ if (!shsurf) ++ continue; ++ ++ desktop_surface = shsurf->desktop_surface; ++ if (weston_desktop_surface_get_fullscreen(desktop_surface)) { ++ set_fullscreen(shsurf, true, output); ++ dirty = true; ++ } ++ if (weston_desktop_surface_get_maximized(desktop_surface)) { ++ set_maximized(shsurf, true); ++ dirty = true; ++ } ++ ++ if (dirty) { ++ weston_view_geometry_dirty(view); ++ weston_surface_damage(view->surface); ++ } ++ } ++} + + static void + handle_output_resized(struct wl_listener *listener, void *data) +@@ -4899,8 +4938,13 @@ handle_output_resized(struct wl_listener *listener, void *data) + struct weston_output *output = (struct weston_output *)data; + struct shell_output *sh_output = find_shell_output_from_weston_output(shell, output); + ++ if (shell->lock_surface) ++ shell->lock_surface->committed(shell->lock_surface, 0, 0); ++ + shell_resize_surface_to_output(shell, sh_output->background_surface, output); + shell_resize_surface_to_output(shell, sh_output->panel_surface, output); ++ ++ shell_for_each_layer(shell, handle_output_resize_layer, data); + } + + static void +@@ -4949,7 +4993,9 @@ handle_output_move_layer(struct desktop_shell *shell, + + x = view->geometry.x + output->move_x; + y = view->geometry.y + output->move_y; +- weston_view_set_position(view, x, y); ++ ++ if (pixman_region32_contains_point(&output->region, x, y, NULL)) ++ weston_view_set_position(view, x, y); + } + } + +diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h +index 8868622..24e44a2 100644 +--- a/include/libweston/libweston.h ++++ b/include/libweston/libweston.h +@@ -413,6 +413,12 @@ struct weston_output { + struct weston_head *head); + + bool unavailable; ++ bool freezing; ++ ++ bool fixed_position; ++ bool fixed_size; ++ ++ double down_scale; + }; + #define weston_output_valid(o) \ + ((o) && !(o)->destroying && !(o)->unavailable) +@@ -1198,6 +1204,7 @@ struct weston_compositor { + struct content_protection *content_protection; + + enum weston_output_flow output_flow; ++ struct weston_output *prefer_output; + }; + + struct weston_buffer { +diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h +index 1625be2..9d24017 100644 +--- a/libweston/backend-drm/drm-internal.h ++++ b/libweston/backend-drm/drm-internal.h +@@ -115,6 +115,9 @@ + + #define DRM_RESIZE_FREEZE_MS 600 + ++#define WESTON_DRM_CONFIG_FILE "/tmp/.weston_drm.conf" ++#define DRM_CONFIG_UPDATE_MS 100 ++ + /** + * Represents the values of an enum-type KMS property + */ +@@ -348,6 +351,9 @@ struct drm_backend { + int virtual_height; + + bool mirror_mode; ++ ++ struct wl_event_source *config_timer; ++ struct stat config_stat; + }; + + struct drm_mode { +@@ -626,6 +632,9 @@ struct drm_output { + bool is_mirror; + + pixman_box32_t plane_bounds; ++ ++ uint32_t original_transform; ++ int64_t last_resize_ms; + }; + + static inline struct drm_head * +@@ -708,6 +717,13 @@ drm_mode_list_destroy(struct drm_backend *backend, struct wl_list *mode_list); + void + drm_output_print_modes(struct drm_output *output); + ++struct drm_mode * ++drm_output_choose_initial_mode(struct drm_backend *backend, ++ struct drm_output *output, ++ enum weston_drm_backend_output_mode mode, ++ const char *modeline, ++ const drmModeModeInfo *current_mode); ++ + int + drm_output_set_mode(struct weston_output *base, + enum weston_drm_backend_output_mode mode, +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index 696df68..1d6f7db 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -40,6 +40,7 @@ + #include + #include + #include ++#include + #include + + #include +@@ -74,6 +75,8 @@ + + static const char default_seat[] = "seat0"; + ++static int config_timer_handler(void *data); ++ + static inline bool + drm_head_is_external(struct drm_head *head) + { +@@ -205,7 +208,7 @@ close_src: + static void + drm_backend_update_outputs(struct drm_backend *b) + { +- struct weston_output *primary; ++ struct weston_output *base, *primary; + + if (!b->primary_head) + return; +@@ -493,6 +496,12 @@ drm_output_update_complete(struct drm_output *output, uint32_t flags, + return; + } + ++ if (!sec && !usec) { ++ weston_output_finish_frame(&output->base, NULL, ++ WP_PRESENTATION_FEEDBACK_INVALID); ++ return; ++ } ++ + ts.tv_sec = sec; + ts.tv_nsec = usec * 1000; + +@@ -671,8 +680,8 @@ out: + return; + } + +- sw = fb->width; +- sh = fb->height; ++ sw = fb->width * output->base.down_scale; ++ sh = fb->height * output->base.down_scale; + + dx = output->plane_bounds.x1; + dy = output->plane_bounds.y1; +@@ -823,7 +832,8 @@ drm_output_repaint(struct weston_output *output_base, + + weston_compositor_read_presentation_clock(b->compositor, &now); + now_ms = timespec_to_msec(&now); +- if (now_ms < b->last_resize_ms + b->resize_freeze_ms) { ++ if (now_ms < b->last_resize_ms + b->resize_freeze_ms || ++ now_ms < output->last_resize_ms + b->resize_freeze_ms) { + /* Resize fullscreen/maxmium views(not always success) */ + if (now_ms < b->last_resize_ms + DRM_RESIZE_FREEZE_MS) + wl_signal_emit(&b->compositor->output_resized_signal, +@@ -832,7 +842,7 @@ drm_output_repaint(struct weston_output *output_base, + weston_output_damage(output_base); + weston_output_finish_frame(output_base, NULL, + WP_PRESENTATION_FEEDBACK_INVALID); +- return 0; ++ goto not_repainted; + } + + /* If planes have been disabled in the core, we might not have +@@ -860,7 +870,8 @@ drm_output_repaint(struct weston_output *output_base, + + err: + drm_output_state_free(state); +- return 0; ++not_repainted: ++ return 1; + } + + /* Determine the type of vblank synchronization to use for the output. +@@ -2213,6 +2224,8 @@ drm_output_enable(struct weston_output *base) + output->base.switch_mode = drm_output_switch_mode; + output->base.set_gamma = drm_output_set_gamma; + ++ output->original_transform = output->base.transform; ++ + output->state_invalid = true; + + weston_log("Output %s (crtc %d) video modes:\n", +@@ -3061,6 +3074,7 @@ drm_destroy(struct weston_compositor *ec) + + udev_input_destroy(&b->input); + ++ wl_event_source_remove(b->config_timer); + wl_event_source_remove(b->hotplug_timer); + wl_event_source_remove(b->udev_drm_source); + wl_event_source_remove(b->drm_source); +@@ -3483,6 +3497,10 @@ output_create_notify(struct wl_listener *listener, void *data) + output_create_listener); + + drm_backend_update_outputs(b); ++ ++ /* Force reload config */ ++ memset(&b->config_stat, 0, sizeof(b->config_stat)); ++ config_timer_handler(b); + } + + static const struct weston_drm_output_api api = { +@@ -3491,6 +3509,236 @@ static const struct weston_drm_output_api api = { + drm_output_set_seat, + }; + ++static void ++drm_output_rotate(struct drm_output *output, int rotate) ++{ ++ struct drm_backend *b = to_drm_backend(output->base.compositor); ++ uint32_t transform = output->original_transform; ++ struct timespec now; ++ ++ /* Hacky way to rotate transform */ ++ transform = (transform / 4) * 4 + (transform + rotate) % 4; ++ ++ if (output->base.transform == transform) ++ return; ++ ++ /* Freeze output when rotating */ ++ weston_compositor_read_presentation_clock(b->compositor, &now); ++ output->last_resize_ms = timespec_to_msec(&now); ++ ++ weston_output_set_transform(&output->base, transform); ++} ++ ++static void ++drm_output_modeset(struct drm_output *output, const char *modeline) ++{ ++ struct drm_backend *b = to_drm_backend(output->base.compositor); ++ struct drm_head *head = ++ to_drm_head(weston_output_get_first_head(&output->base)); ++ struct drm_mode *mode; ++ struct timespec now; ++ ++ /* Unable to switch mode, let's retry later */ ++ if (output->page_flip_pending || output->atomic_complete_pending) { ++ memset(&b->config_stat, 0, sizeof(b->config_stat)); ++ return; ++ } ++ ++ mode = drm_output_choose_initial_mode(b, output, ++ WESTON_DRM_BACKEND_OUTPUT_PREFERRED, ++ modeline, ++ &head->inherited_mode); ++ ++ weston_output_mode_set_native(&output->base, &mode->base, ++ output->base.current_scale); ++ weston_output_damage(&output->base); ++ ++ mode = to_drm_mode(output->base.current_mode); ++ ++ weston_log("Output %s changed to %dx%d@%d for mode(%s)\n", ++ output->base.name, ++ mode->mode_info.hdisplay, mode->mode_info.vdisplay, ++ mode->mode_info.vrefresh, ++ modeline); ++ ++ weston_compositor_read_presentation_clock(b->compositor, &now); ++ b->last_update_ms = timespec_to_msec(&now); ++} ++ ++static void ++drm_output_set_size(struct drm_output *output, const int w, const int h) ++{ ++ struct drm_backend *b = to_drm_backend(output->base.compositor); ++ struct weston_mode *mode; ++ struct timespec now; ++ ++ if (output->base.fixed_size && ++ output->base.current_mode->width == w && ++ output->base.current_mode->height == h) ++ return; ++ ++ wl_list_for_each(mode, &output->base.mode_list, link) { ++ mode->width = w; ++ mode->height = h; ++ } ++ ++ output->base.fixed_size = true; ++ ++ /* Freeze output when resizing */ ++ weston_compositor_read_presentation_clock(b->compositor, &now); ++ output->last_resize_ms = timespec_to_msec(&now); ++ ++ weston_output_set_transform(&output->base, output->base.transform); ++ ++ if (b->use_pixman) { ++ drm_output_fini_pixman(output); ++ if (drm_output_init_pixman(output, b) < 0) ++ weston_log("failed to init output pixman state with " ++ "new mode\n"); ++ } else { ++ drm_output_fini_egl(output); ++ if (drm_output_init_egl(output, b) < 0) ++ weston_log("failed to init output egl state with " ++ "new mode"); ++ } ++ ++ drm_output_print_modes(output); ++} ++ ++static void ++config_handle_output(struct drm_backend *b, const char *name, ++ const char *config) ++{ ++ struct drm_output *output; ++ bool is_all = !strcmp(name, "all"); ++ ++ wl_list_for_each(output, &b->compositor->output_list, base.link) { ++ if (!is_all && strcmp(name, output->base.name)) ++ continue; ++ ++ if (!strcmp(config, "primary")) { ++ setenv("WESTON_DRM_PRIMARY", name, 1); ++ hotplug_timer_handler(b); ++ } else if (!strcmp(config, "prefer")) { ++ b->compositor->prefer_output = &output->base; ++ } else if (!strncmp(config, "rotate", strlen("rotate"))) { ++ int rotate = atoi(config + strlen("rotate")) / 90; ++ drm_output_rotate(output, rotate); ++ } else if (!strncmp(config, "mode=", strlen("mode="))) { ++ drm_output_modeset(output, config + strlen("mode=")); ++ } else if (!strcmp(config, "freeze")) { ++ output->base.freezing = true; ++ } else if (!strcmp(config, "off")) { ++ output->base.freezing = true; ++ if (!output->virtual) ++ drm_set_dpms(&output->base, WESTON_DPMS_OFF); ++ } else if (!strcmp(config, "unfreeze") || ++ !strcmp(config, "on")) { ++ if (!output->base.freezing) ++ continue; ++ ++ output->base.freezing = false; ++ ++ if (!output->virtual) ++ drm_set_dpms(&output->base, WESTON_DPMS_ON); ++ ++ drm_output_update_complete(output, 0, 0, 0); ++ output->page_flip_pending = false; ++ output->atomic_complete_pending = false; ++ ++ weston_output_damage(&output->base); ++ } else if (!strncmp(config, "down-scale=", ++ strlen("down-scale="))) { ++ double down_scale = ++ atof(config + strlen("down-scale=")); ++ if (down_scale == output->base.down_scale || ++ down_scale < 0.125 || down_scale > 1) ++ continue; ++ ++ output->base.down_scale = down_scale; ++ weston_output_damage(&output->base); ++ } else if (!strncmp(config, "size=", strlen("size="))) { ++ int w, h; ++ ++ if (sscanf(config, "size=%dx%d", &w, &h) != 2) ++ continue; ++ ++ drm_output_set_size(output, w, h); ++ } else if (!strncmp(config, "pos=", strlen("pos="))) { ++ int x, y; ++ ++ if (sscanf(config, "pos=%d,%d", &x, &y) != 2) ++ continue; ++ ++ weston_output_move(&output->base, x, y); ++ output->base.fixed_position = true; ++ ++ weston_compositor_reflow_outputs(b->compositor); ++ } else if (!strncmp(config, "rect=", strlen("rect="))) { ++ int x1, y1, x2, y2, ret; ++ ++ ret = sscanf(config, "rect=<%d,%d,%d,%d>", ++ &x1, &y1, &x2, &y2); ++ if (ret != 4) ++ continue; ++ ++ output->plane_bounds.x1 = x1; ++ output->plane_bounds.y1 = y1; ++ output->plane_bounds.x2 = x2; ++ output->plane_bounds.y2 = y2; ++ weston_output_schedule_repaint(&output->base); ++ } ++ } ++} ++ ++static int ++config_timer_handler(void *data) ++{ ++#define MAX_CONF_LEN 32 ++#define _STR(x) #x ++#define STR(x) _STR(x) ++ ++ struct drm_backend *b = data; ++ struct stat st; ++ char type[MAX_CONF_LEN], key[MAX_CONF_LEN], value[MAX_CONF_LEN]; ++ const char *config_file; ++ FILE *conf_fp; ++ ++ wl_event_source_timer_update(b->config_timer, DRM_CONFIG_UPDATE_MS); ++ ++ config_file = getenv("WESTON_DRM_CONFIG"); ++ if (!config_file) ++ config_file = WESTON_DRM_CONFIG_FILE; ++ ++ if (stat(config_file, &st) < 0) ++ return 0; ++ ++ if (st.st_mtime && !memcmp(&st, &b->config_stat, sizeof(st))) ++ return 0; ++ ++ conf_fp = fopen(config_file, "r"); ++ if (!conf_fp) ++ return 0; ++ ++ /** ++ * Parse configs, formated with :: ++ * For example: "output:all:rotate90" ++ */ ++ while (3 == fscanf(conf_fp, ++ "%" STR(MAX_CONF_LEN) "[^:]:" ++ "%" STR(MAX_CONF_LEN) "[^:]:" ++ "%" STR(MAX_CONF_LEN) "s ", type, key, value)) { ++ if (!strcmp(type, "output")) ++ config_handle_output(b, key, value); ++ } ++ ++ fclose(conf_fp); ++ ++ stat(config_file, &st); ++ b->config_stat = st; ++ return 0; ++} ++ + enum drm_head_mode { + DRM_HEAD_MODE_DEFAULT, + DRM_HEAD_MODE_PRIMARY, +@@ -3830,6 +4078,10 @@ drm_backend_create(struct weston_compositor *compositor, + b->hotplug_timer = + wl_event_loop_add_timer(loop, hotplug_timer_handler, b); + ++ b->config_timer = ++ wl_event_loop_add_timer(loop, config_timer_handler, b); ++ config_timer_handler(b); ++ + return b; + + err_udev_monitor: +diff --git a/libweston/backend-drm/modes.c b/libweston/backend-drm/modes.c +index e7bbfa5..ff7421d 100644 +--- a/libweston/backend-drm/modes.c ++++ b/libweston/backend-drm/modes.c +@@ -385,15 +385,19 @@ drm_output_add_mode(struct drm_output *output, const drmModeModeInfo *info) + if (mode == NULL) + return NULL; + +- mode->base.flags = 0; +- mode->base.width = info->hdisplay; +- mode->base.height = info->vdisplay; +- +- if (b->virtual_width && b->virtual_height) { ++ if (output->base.fixed_size) { ++ mode->base.width = output->base.width; ++ mode->base.height = output->base.height; ++ } else if (b->virtual_width && b->virtual_height) { + mode->base.width = b->virtual_width; + mode->base.height = b->virtual_height; ++ } else { ++ mode->base.width = info->hdisplay; ++ mode->base.height = info->vdisplay; + } + ++ mode->base.flags = 0; ++ + mode->base.refresh = drm_refresh_rate_mHz(info); + mode->mode_info = *info; + mode->blob_id = 0; +@@ -566,7 +570,7 @@ update_head_from_connector(struct drm_head *head) + * @param current_mode Mode currently being displayed on this output + * @returns A mode from the output's mode list, or NULL if none available + */ +-static struct drm_mode * ++struct drm_mode * + drm_output_choose_initial_mode(struct drm_backend *backend, + struct drm_output *output, + enum weston_drm_backend_output_mode mode, +@@ -619,8 +623,8 @@ drm_output_choose_initial_mode(struct drm_backend *backend, + } + + wl_list_for_each_reverse(drm_mode, &output->base.mode_list, base.link) { +- if (width == drm_mode->base.width && +- height == drm_mode->base.height && ++ if (width == drm_mode->mode_info.hdisplay && ++ height == drm_mode->mode_info.vdisplay && + (refresh == 0 || refresh == drm_mode->mode_info.vrefresh)) { + if (!backend->aspect_ratio_supported || + aspect_ratio == drm_mode->base.aspect_ratio) +diff --git a/libweston/compositor.c b/libweston/compositor.c +index 7680445..0aa9d1a 100644 +--- a/libweston/compositor.c ++++ b/libweston/compositor.c +@@ -3009,6 +3009,11 @@ weston_output_repaint(struct weston_output *output, void *repaint_data) + static void + weston_output_schedule_repaint_reset(struct weston_output *output) + { ++ if (output->idle_repaint_source) { ++ wl_event_source_remove(output->idle_repaint_source); ++ output->idle_repaint_source = NULL; ++ } ++ + output->repaint_status = REPAINT_NOT_SCHEDULED; + TL_POINT(output->compositor, "core_repaint_exit_loop", + TLP_OUTPUT(output), TLP_END); +@@ -3022,6 +3027,11 @@ weston_output_maybe_repaint(struct weston_output *output, struct timespec *now, + int ret = 0; + int64_t msec_to_repaint; + ++ /* If we're sleeping, drop the repaint machinery entirely; we will ++ * explicitly repaint it when we come back. */ ++ if (output->freezing) ++ goto err; ++ + /* We're not ready yet; come back to make a decision later. */ + if (output->repaint_status != REPAINT_SCHEDULED) + return ret; +@@ -3048,11 +3058,11 @@ weston_output_maybe_repaint(struct weston_output *output, struct timespec *now, + * output. */ + ret = weston_output_repaint(output, repaint_data); + weston_compositor_read_presentation_clock(compositor, now); +- if (ret != 0) ++ if (ret < 0) + goto err; + +- output->repainted = true; +- return ret; ++ output->repainted = !ret; ++ return 0; + + err: + weston_output_schedule_repaint_reset(output); +@@ -3105,7 +3115,7 @@ output_repaint_timer_handler(void *data) + struct weston_output *output; + struct timespec now; + void *repaint_data = NULL; +- int ret = 0; ++ int ret = 0, repainted = 0; + + if (!access(getenv("WESTON_FREEZE_DISPLAY") ? : "", F_OK)) { + usleep(DEFAULT_REPAINT_WINDOW * 1000); +@@ -3122,9 +3132,11 @@ output_repaint_timer_handler(void *data) + ret = weston_output_maybe_repaint(output, &now, repaint_data); + if (ret) + break; ++ ++ repainted |= output->repainted; + } + +- if (ret == 0) { ++ if (ret == 0 && repainted) { + if (compositor->backend->repaint_flush) + ret = compositor->backend->repaint_flush(compositor, + repaint_data); +@@ -6099,7 +6111,7 @@ weston_compositor_reflow_outputs(struct weston_compositor *compositor) + wl_list_for_each(head, &output->head_list, output_link) + weston_head_update_global(head); + +- if (!weston_output_valid(output)) ++ if (!weston_output_valid(output) || output->fixed_position) + continue; + + x = next_x; +@@ -6546,6 +6558,9 @@ weston_output_set_transform(struct weston_output *output, + + weston_compositor_reflow_outputs(output->compositor); + ++ wl_signal_emit(&output->compositor->output_resized_signal, ++ output); ++ + /* Notify clients of the change for output transform. */ + wl_list_for_each(head, &output->head_list, output_link) { + wl_resource_for_each(resource, &head->resource_list) { +@@ -6678,6 +6693,8 @@ weston_output_init(struct weston_output *output, + /* Can't use -1 on uint32_t and 0 is valid enum value */ + output->transform = UINT32_MAX; + ++ output->down_scale = 1.0f; ++ + pixman_region32_init(&output->region); + wl_list_init(&output->mode_list); + } +@@ -6769,11 +6786,8 @@ weston_output_create_heads_string(struct weston_output *output) + WL_EXPORT int + weston_output_enable(struct weston_output *output) + { +- struct weston_compositor *c = output->compositor; +- struct weston_output *iterator; + struct weston_head *head; + char *head_names; +- int x = 0, y = 0; + + if (output->enabled) { + weston_log("Error: attempt to enable an enabled output '%s'\n", +@@ -6798,20 +6812,17 @@ weston_output_enable(struct weston_output *output) + assert(head->model); + } + +- iterator = container_of(c->output_list.prev, +- struct weston_output, link); +- +- if (!wl_list_empty(&c->output_list)) +- x = iterator->x + iterator->width; +- + /* Make sure the scale is set up */ + assert(output->scale); + + /* Make sure we have a transform set */ + assert(output->transform != UINT32_MAX); + +- output->x = x; +- output->y = y; ++ if (!output->fixed_position) { ++ output->x = 0; ++ output->y = 0; ++ } ++ + output->original_scale = output->scale; + + wl_signal_init(&output->frame_signal); +@@ -6820,8 +6831,7 @@ weston_output_enable(struct weston_output *output) + weston_output_transform_scale_init(output, output->transform, output->scale); + weston_output_init_zoom(output); + +- weston_output_init_geometry(output, x, y); +- weston_output_damage(output); ++ weston_output_init_geometry(output, output->x, output->y); + + wl_list_init(&output->animation_list); + wl_list_init(&output->feedback_list); +@@ -6848,6 +6858,8 @@ weston_output_enable(struct weston_output *output) + output->name, head_names); + free(head_names); + ++ weston_compositor_reflow_outputs(output->compositor); ++ + return 0; + } + +diff --git a/libweston/pixman-renderer.c b/libweston/pixman-renderer.c +index 754adce..d7182e7 100644 +--- a/libweston/pixman-renderer.c ++++ b/libweston/pixman-renderer.c +@@ -158,6 +158,9 @@ pixman_renderer_compute_transform(pixman_transform_t *transform_out, + specified buffer transform/scale */ + matrix = output->inverse_matrix; + ++ weston_matrix_scale(&matrix, ++ 1 / output->down_scale, 1 / output->down_scale, 1); ++ + if (ev->transform.enabled) { + weston_matrix_multiply(&matrix, &ev->transform.inverse); + } else { +diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c +index 6e04baa..f853149 100644 +--- a/libweston/renderer-gl/gl-renderer.c ++++ b/libweston/renderer-gl/gl-renderer.c +@@ -1720,6 +1720,10 @@ gl_renderer_repaint_output(struct weston_output *output, + + /* Calculate the global GL matrix */ + go->output_matrix = output->matrix; ++ ++ weston_matrix_scale(&go->output_matrix, ++ output->down_scale, output->down_scale, 1); ++ + weston_matrix_translate(&go->output_matrix, + -(output->current_mode->width / 2.0), + -(output->current_mode->height / 2.0), 0); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0017-pixman-renderer-Support-yuv-formats.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0017-pixman-renderer-Support-yuv-formats.patch new file mode 100644 index 0000000000000000000000000000000000000000..79f0f6edd9b9173b012fc0bb03fd3d67c69dacf2 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0017-pixman-renderer-Support-yuv-formats.patch @@ -0,0 +1,87 @@ +From f9c928db24c24031e01129e20226da1f7c3ec2ed Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 3 Jul 2020 14:23:45 +0800 +Subject: [PATCH 17/79] pixman-renderer: Support yuv formats + +Support yuy2/yv12/i420/nv12/nv16. + +Signed-off-by: Jeffy Chen +--- + libweston/pixel-formats.c | 11 +++++++++++ + meson.build | 10 ++++++++++ + 2 files changed, 21 insertions(+) + +diff --git a/libweston/pixel-formats.c b/libweston/pixel-formats.c +index 9064cb6..172e6cc 100644 +--- a/libweston/pixel-formats.c ++++ b/libweston/pixel-formats.c +@@ -337,6 +337,7 @@ static const struct pixel_format_info pixel_format_table[] = { + SAMPLER_TYPE(EGL_TEXTURE_Y_XUXV_WL), + .num_planes = 1, + .hsub = 2, ++ PIXMAN_FMT(yuy2), + }, + { + DRM_FORMAT(YVYU), +@@ -366,6 +367,9 @@ static const struct pixel_format_info pixel_format_table[] = { + .num_planes = 2, + .hsub = 2, + .vsub = 2, ++#ifdef HAVE_PIXMAN_NV12 ++ PIXMAN_FMT(nv12), ++#endif + }, + { + DRM_FORMAT(NV21), +@@ -381,6 +385,9 @@ static const struct pixel_format_info pixel_format_table[] = { + .num_planes = 2, + .hsub = 2, + .vsub = 1, ++#ifdef HAVE_PIXMAN_NV16 ++ PIXMAN_FMT(nv16), ++#endif + }, + { + DRM_FORMAT(NV61), +@@ -437,6 +444,9 @@ static const struct pixel_format_info pixel_format_table[] = { + .num_planes = 3, + .hsub = 2, + .vsub = 2, ++#ifdef HAVE_PIXMAN_I420 ++ PIXMAN_FMT(i420), ++#endif + }, + { + DRM_FORMAT(YVU420), +@@ -445,6 +455,7 @@ static const struct pixel_format_info pixel_format_table[] = { + .chroma_order = ORDER_VU, + .hsub = 2, + .vsub = 2, ++ PIXMAN_FMT(yv12), + }, + { + DRM_FORMAT(YUV422), +diff --git a/meson.build b/meson.build +index feecd45..b8efc3b 100644 +--- a/meson.build ++++ b/meson.build +@@ -161,6 +161,16 @@ dep_libdrm = dependency('libdrm', version: '>= 2.4.95') + dep_libdrm_headers = dep_libdrm.partial_dependency(compile_args: true) + dep_threads = dependency('threads') + ++if cc.has_header_symbol('pixman.h', 'PIXMAN_nv12', dependencies : dep_pixman) ++ config_h.set('HAVE_PIXMAN_NV12', 1) ++endif ++if cc.has_header_symbol('pixman.h', 'PIXMAN_i420', dependencies : dep_pixman) ++ config_h.set('HAVE_PIXMAN_I420', 1) ++endif ++if cc.has_header_symbol('pixman.h', 'PIXMAN_nv16', dependencies : dep_pixman) ++ config_h.set('HAVE_PIXMAN_NV16', 1) ++endif ++ + dep_libdrm_version = dep_libdrm.version() + if dep_libdrm_version.version_compare('>=2.4.107') + message('Found libdrm with human format modifier support.') +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0018-pixman-renderer-Support-linux-dmabuf.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0018-pixman-renderer-Support-linux-dmabuf.patch new file mode 100644 index 0000000000000000000000000000000000000000..9b91f3421b8e274433676622216a7469554b866c --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0018-pixman-renderer-Support-linux-dmabuf.patch @@ -0,0 +1,367 @@ +From b53115faf91a004249451513f8da6c5b0434d5da Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 3 Jul 2020 14:43:49 +0800 +Subject: [PATCH 18/79] pixman-renderer: Support linux dmabuf + +NOTE: Only support contig dmabuf. + +Signed-off-by: Jeffy Chen +--- + libweston/pixman-renderer.c | 258 +++++++++++++++++++++++++++++++++++- + 1 file changed, 253 insertions(+), 5 deletions(-) + +diff --git a/libweston/pixman-renderer.c b/libweston/pixman-renderer.c +index d7182e7..d5c5422 100644 +--- a/libweston/pixman-renderer.c ++++ b/libweston/pixman-renderer.c +@@ -37,8 +37,15 @@ + #include "pixel-formats.h" + #include "shared/helpers.h" + ++#include ++#include ++#include ++#include + #include + ++#include "linux-dmabuf.h" ++#include "linux-dmabuf-unstable-v1-server-protocol.h" ++ + struct pixman_output_state { + void *shadow_buffer; + pixman_image_t *shadow_image; +@@ -66,6 +73,13 @@ struct pixman_renderer { + struct weston_binding *debug_binding; + + struct wl_signal destroy_signal; ++ ++ struct weston_drm_format_array supported_formats; ++}; ++ ++struct dmabuf_data { ++ void *ptr; ++ size_t size; + }; + + static inline struct pixman_output_state * +@@ -353,7 +367,7 @@ repaint_region(struct weston_view *ev, struct weston_output *output, + else + filter = PIXMAN_FILTER_NEAREST; + +- if (ps->buffer_ref.buffer) ++ if (ps->buffer_ref.buffer && ps->buffer_ref.buffer->shm_buffer) + wl_shm_buffer_begin_access(ps->buffer_ref.buffer->shm_buffer); + + if (ev->alpha < 1.0) { +@@ -373,7 +387,7 @@ repaint_region(struct weston_view *ev, struct weston_output *output, + if (mask_image) + pixman_image_unref(mask_image); + +- if (ps->buffer_ref.buffer) ++ if (ps->buffer_ref.buffer && ps->buffer_ref.buffer->shm_buffer) + wl_shm_buffer_end_access(ps->buffer_ref.buffer->shm_buffer); + + if (pr->repaint_debug) +@@ -622,11 +636,88 @@ buffer_state_handle_buffer_destroy(struct wl_listener *listener, void *data) + ps->buffer_destroy_listener.notify = NULL; + } + ++static void ++pixman_renderer_attach_dmabuf(struct weston_surface *es, ++ struct weston_buffer *buffer, ++ struct linux_dmabuf_buffer *dmabuf) ++{ ++ struct pixman_surface_state *ps = get_surface_state(es); ++ struct dmabuf_attributes *attributes = &dmabuf->attributes; ++ struct dmabuf_data *data; ++ pixman_format_code_t pixman_format; ++ size_t vstride; ++ ++ data = linux_dmabuf_buffer_get_user_data(dmabuf); ++ if (!data || !data->ptr) { ++ weston_buffer_reference(&ps->buffer_ref, NULL); ++ weston_buffer_release_reference(&ps->buffer_release_ref, ++ NULL); ++ return; ++ } ++ ++ buffer->width = attributes->width; ++ buffer->height = attributes->height; ++ ++ if (attributes->n_planes == 1) ++ vstride = attributes->height; ++ else ++ vstride = (attributes->offset[1] - attributes->offset[0]) / ++ attributes->stride[0]; ++ ++ switch (attributes->format) { ++ case DRM_FORMAT_ARGB8888: ++ pixman_format = PIXMAN_a8r8g8b8; ++ break; ++ case DRM_FORMAT_XRGB8888: ++ pixman_format = PIXMAN_x8r8g8b8; ++ break; ++ case DRM_FORMAT_YUYV: ++ pixman_format = PIXMAN_yuy2; ++ break; ++ case DRM_FORMAT_YVU420: ++ pixman_format = PIXMAN_yv12; ++ break; ++#ifdef HAVE_PIXMAN_I420 ++ case DRM_FORMAT_YUV420: ++ pixman_format = PIXMAN_i420; ++ break; ++#endif ++#ifdef HAVE_PIXMAN_NV12 ++ case DRM_FORMAT_NV12: ++ pixman_format = PIXMAN_nv12; ++ break; ++#endif ++#ifdef HAVE_PIXMAN_NV16 ++ case DRM_FORMAT_NV16: ++ pixman_format = PIXMAN_nv16; ++ break; ++#endif ++ default: ++ weston_log("Unsupported dmabuf format\n"); ++ weston_buffer_reference(&ps->buffer_ref, NULL); ++ weston_buffer_release_reference(&ps->buffer_release_ref, ++ NULL); ++ return; ++ break; ++ } ++ ++ ps->image = pixman_image_create_bits(pixman_format, ++ buffer->width, vstride, ++ data->ptr + attributes->offset[0], ++ attributes->stride[0]); ++ ++ ps->buffer_destroy_listener.notify = ++ buffer_state_handle_buffer_destroy; ++ wl_signal_add(&buffer->destroy_signal, ++ &ps->buffer_destroy_listener); ++} ++ + static void + pixman_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer) + { + struct pixman_surface_state *ps = get_surface_state(es); + struct wl_shm_buffer *shm_buffer; ++ struct linux_dmabuf_buffer *dmabuf; + const struct pixel_format_info *pixel_info; + + weston_buffer_reference(&ps->buffer_ref, buffer); +@@ -649,9 +740,17 @@ pixman_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer) + shm_buffer = wl_shm_buffer_get(buffer->resource); + + if (! shm_buffer) { +- weston_log("Pixman renderer supports only SHM buffers\n"); +- weston_buffer_reference(&ps->buffer_ref, NULL); +- weston_buffer_release_reference(&ps->buffer_release_ref, NULL); ++ if ((dmabuf = linux_dmabuf_buffer_get(buffer->resource))) { ++ pixman_renderer_attach_dmabuf(es, buffer, dmabuf); ++ } else { ++ weston_log("unhandled buffer type!\n"); ++ weston_buffer_reference(&ps->buffer_ref, NULL); ++ weston_buffer_release_reference(&ps->buffer_release_ref, ++ NULL); ++ weston_buffer_send_server_error(buffer, ++ "disconnecting due to unhandled buffer type"); ++ } ++ + return; + } + +@@ -750,6 +849,9 @@ pixman_renderer_create_surface(struct weston_surface *surface) + wl_signal_add(&pr->destroy_signal, + &ps->renderer_destroy_listener); + ++ if (surface->buffer_ref.buffer) ++ pixman_renderer_attach(surface, surface->buffer_ref.buffer); ++ + return 0; + } + +@@ -780,6 +882,9 @@ pixman_renderer_destroy(struct weston_compositor *ec) + + wl_signal_emit(&pr->destroy_signal, pr); + weston_binding_destroy(pr->debug_binding); ++ ++ weston_drm_format_array_fini(&pr->supported_formats); ++ + free(pr); + + ec->renderer = NULL; +@@ -853,12 +958,141 @@ debug_binding(struct weston_keyboard *keyboard, const struct timespec *time, + } + } + ++static void ++pixman_renderer_destroy_dmabuf(struct linux_dmabuf_buffer *dmabuf) ++{ ++ struct dmabuf_data *data = dmabuf->user_data; ++ linux_dmabuf_buffer_set_user_data(dmabuf, NULL, NULL); ++ ++ if (data) { ++ if (data->ptr) ++ munmap(data->ptr, data->size); ++ ++ free(data); ++ } ++} ++ ++static bool ++pixman_renderer_import_dmabuf(struct weston_compositor *ec, ++ struct linux_dmabuf_buffer *dmabuf) ++{ ++ struct dmabuf_attributes *attributes = &dmabuf->attributes; ++ struct dmabuf_data *data; ++ size_t total_size, vstride0; ++ int i; ++ ++ for (i = 0; i < attributes->n_planes; i++) { ++ if (attributes->modifier[i] != DRM_FORMAT_MOD_INVALID) ++ return false; ++ } ++ ++ /* reject all flags we do not recognize or handle */ ++ if (attributes->flags & ~ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT) ++ return false; ++ ++ if (attributes->n_planes < 0) ++ return false; ++ ++ if (attributes->n_planes == 1) ++ goto out; ++ ++ total_size = lseek(attributes->fd[0], 0, SEEK_END); ++ vstride0 = (attributes->offset[1] - attributes->offset[0]) / ++ attributes->stride[0]; ++ ++ for (i = 1; i < attributes->n_planes; i++) { ++ size_t size = attributes->offset[i] - attributes->offset[i - 1]; ++ size_t vstride = size / attributes->stride[i - 1]; ++ ++ /* not contig */ ++ if (size <= 0 || vstride <= 0 || ++ attributes->offset[i - 1] + size > total_size) ++ return false; ++ ++ /* stride unmatched */ ++ if ((vstride != vstride0 && vstride != vstride0 / 2) || ++ (attributes->stride[i] != attributes->stride[0] && ++ attributes->stride[i] != attributes->stride[0] / 2)) ++ return false; ++ } ++ ++out: ++ /* Handle contig dma buffer */ ++ ++ data = zalloc(sizeof *data); ++ if (!data) ++ return false; ++ ++ linux_dmabuf_buffer_set_user_data(dmabuf, data, ++ pixman_renderer_destroy_dmabuf); ++ ++ data->size = lseek(attributes->fd[0], 0, SEEK_END); ++ ++ data->ptr = mmap(NULL, data->size, PROT_READ, ++ MAP_SHARED, attributes->fd[0], 0); ++ return data->ptr != MAP_FAILED; ++} ++ ++static const struct weston_drm_format_array * ++pixman_renderer_get_supported_formats(struct weston_compositor *ec) ++{ ++ struct pixman_renderer *pr = get_renderer(ec); ++ ++ return &pr->supported_formats; ++} ++ ++static int ++populate_supported_formats(struct weston_compositor *ec, ++ struct weston_drm_format_array *supported_formats) ++{ ++ struct weston_drm_format *fmt; ++ int i, ret = 0; ++ ++ /* TODO: support more formats */ ++ static const int formats[] = { ++ DRM_FORMAT_ARGB8888, ++ DRM_FORMAT_XRGB8888, ++ DRM_FORMAT_RGBA8888, ++ DRM_FORMAT_RGBX8888, ++ DRM_FORMAT_ABGR8888, ++ DRM_FORMAT_XBGR8888, ++ DRM_FORMAT_BGRA8888, ++ DRM_FORMAT_BGRX8888, ++ DRM_FORMAT_YUYV, ++ DRM_FORMAT_YVU420, ++ DRM_FORMAT_YUV420, ++ DRM_FORMAT_NV12, ++ DRM_FORMAT_NV16, ++ }; ++ ++ int num_formats = ARRAY_LENGTH(formats); ++ ++ for (i = 0; i < num_formats; i++) { ++ fmt = weston_drm_format_array_add_format(supported_formats, ++ formats[i]); ++ if (!fmt) { ++ ret = -1; ++ goto out; ++ } ++ ++ /* Always add DRM_FORMAT_MOD_INVALID, as EGL implementations ++ * support implicit modifiers. */ ++ ret = weston_drm_format_add_modifier(fmt, DRM_FORMAT_MOD_INVALID); ++ if (ret < 0) ++ goto out; ++ } ++ ++out: ++ return ret; ++} ++ + WL_EXPORT int + pixman_renderer_init(struct weston_compositor *ec) + { + struct pixman_renderer *renderer; + const struct pixel_format_info *pixel_info, *info_argb8888, *info_xrgb8888; + unsigned int i, num_formats; ++ int ret; + + renderer = zalloc(sizeof *renderer); + if (renderer == NULL) +@@ -880,6 +1114,15 @@ pixman_renderer_init(struct weston_compositor *ec) + ec->capabilities |= WESTON_CAP_ROTATION_ANY; + ec->capabilities |= WESTON_CAP_VIEW_CLIP_MASK; + ++ weston_drm_format_array_init(&renderer->supported_formats); ++ ++ ret = populate_supported_formats(ec, &renderer->supported_formats); ++ if (ret < 0) { ++ weston_drm_format_array_fini(&renderer->supported_formats); ++ free(renderer); ++ return -1; ++ } ++ + renderer->debug_binding = + weston_compositor_add_debug_binding(ec, KEY_R, + debug_binding, ec); +@@ -902,6 +1145,11 @@ pixman_renderer_init(struct weston_compositor *ec) + + wl_signal_init(&renderer->destroy_signal); + ++ renderer->base.import_dmabuf = pixman_renderer_import_dmabuf; ++ ++ renderer->base.get_supported_formats = ++ pixman_renderer_get_supported_formats; ++ + return 0; + } + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0019-gl-renderer-Support-NV16-shmem-format.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0019-gl-renderer-Support-NV16-shmem-format.patch new file mode 100644 index 0000000000000000000000000000000000000000..36e0c03b94e3e5ea7b79cdd6dc7a677b2080ad51 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0019-gl-renderer-Support-NV16-shmem-format.patch @@ -0,0 +1,74 @@ +From 649de6ed31f7d2450e0917b1928667063ffc188a Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 22 Nov 2019 12:06:35 +0800 +Subject: [PATCH 19/79] gl-renderer: Support NV16 shmem format + +Signed-off-by: Jeffy Chen +--- + libweston/renderer-gl/gl-renderer.c | 36 +++++++++++++++++++++++++++++ + 1 file changed, 36 insertions(+) + +diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c +index f853149..3c60f85 100644 +--- a/libweston/renderer-gl/gl-renderer.c ++++ b/libweston/renderer-gl/gl-renderer.c +@@ -2154,6 +2154,25 @@ gl_renderer_attach_shm(struct weston_surface *es, struct weston_buffer *buffer, + } + es->is_opaque = true; + break; ++ case WL_SHM_FORMAT_NV16: ++ pitch = wl_shm_buffer_get_stride(shm_buffer); ++ gl_pixel_type = GL_UNSIGNED_BYTE; ++ num_planes = 2; ++ gs->offset[1] = gs->offset[0] + (pitch / gs->hsub[0]) * ++ (buffer->height / gs->vsub[0]); ++ gs->hsub[1] = 2; ++ gs->vsub[1] = 1; ++ if (gr->has_gl_texture_rg) { ++ gs->shader_variant = SHADER_VARIANT_Y_UV; ++ gl_format[0] = GL_R8_EXT; ++ gl_format[1] = GL_RG8_EXT; ++ } else { ++ gs->shader_variant = SHADER_VARIANT_Y_XUXV; ++ gl_format[0] = GL_LUMINANCE; ++ gl_format[1] = GL_LUMINANCE_ALPHA; ++ } ++ es->is_opaque = true; ++ break; + case WL_SHM_FORMAT_YUYV: + gs->shader_variant = SHADER_VARIANT_Y_XUXV; + pitch = wl_shm_buffer_get_stride(shm_buffer) / 2; +@@ -2449,6 +2468,22 @@ struct yuv_format_descriptor yuv_formats[] = { + .format = DRM_FORMAT_GR88, + .plane_index = 1 + }} ++ }, { ++ .format = DRM_FORMAT_NV16, ++ .input_planes = 2, ++ .output_planes = 2, ++ .texture_type = EGL_TEXTURE_Y_UV_WL, ++ {{ ++ .width_divisor = 1, ++ .height_divisor = 1, ++ .format = DRM_FORMAT_R8, ++ .plane_index = 0 ++ }, { ++ .width_divisor = 2, ++ .height_divisor = 1, ++ .format = DRM_FORMAT_GR88, ++ .plane_index = 1 ++ }} + }, { + .format = DRM_FORMAT_YUV420, + .input_planes = 3, +@@ -3852,6 +3887,7 @@ gl_renderer_display_create(struct weston_compositor *ec, + wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_RGB565); + wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_YUV420); + wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_NV12); ++ wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_NV16); + wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_YUYV); + wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_XYUV8888); + #if __BYTE_ORDER == __LITTLE_ENDIAN +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0020-HACK-Support-setting-surface-flags-activate-and-alph.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0020-HACK-Support-setting-surface-flags-activate-and-alph.patch new file mode 100644 index 0000000000000000000000000000000000000000..1e7e158e245756710906a512a391f733f11a2bee --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0020-HACK-Support-setting-surface-flags-activate-and-alph.patch @@ -0,0 +1,430 @@ +From c4b8f02cca601a25767de29392940f0dc5ef2e24 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 7 May 2020 08:55:42 +0800 +Subject: [PATCH 20/79] HACK: Support setting surface flags activate and alpha + +Support setting surface flags activate and alpha through app_id or +title, for example: + +xdg_toplevel_set_app_id("flags=stay-on-top|stay-on-bottom|no-focus") +xdg_toplevel_set_title("requests=activate") +xdg_toplevel_set_app_id("attrs=alpha:0.5") + +Signed-off-by: Jeffy Chen +--- + desktop-shell/shell.c | 29 ++++- + desktop-shell/shell.h | 2 + + include/libweston/libweston.h | 13 +++ + libweston-desktop/surface.c | 193 ++++++++++++++++++++++++++++++++++ + libweston/compositor.c | 10 +- + 5 files changed, 244 insertions(+), 3 deletions(-) + +diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c +index 8b4ed45..4cb29dd 100644 +--- a/desktop-shell/shell.c ++++ b/desktop-shell/shell.c +@@ -1895,6 +1895,11 @@ shell_surface_update_layer(struct shell_surface *shsurf) + + new_layer_link = shell_surface_calculate_layer_link(shsurf); + ++ if (surface->flags & SURFACE_STAY_ON_TOP) ++ new_layer_link = &shsurf->shell->top_layer.view_list; ++ else if (surface->flags & SURFACE_STAY_ON_BOTTOM) ++ new_layer_link = &shsurf->shell->bottom_layer.view_list; ++ + if (new_layer_link == NULL) + return; + if (new_layer_link == &shsurf->view->layer_link) +@@ -3220,6 +3225,10 @@ resume_desktop(struct desktop_shell *shell) + weston_layer_set_position(&shell->panel_layer, + WESTON_LAYER_POSITION_UI); + weston_layer_set_position(&ws->layer, WESTON_LAYER_POSITION_NORMAL); ++ weston_layer_set_position(&shell->top_layer, ++ WESTON_LAYER_POSITION_TOP_UI); ++ weston_layer_set_position(&shell->bottom_layer, ++ WESTON_LAYER_POSITION_BOTTOM_UI); + + restore_focus_state(shell, get_current_workspace(shell)); + +@@ -3781,7 +3790,7 @@ activate(struct desktop_shell *shell, struct weston_view *view, + struct weston_surface *main_surface; + struct focus_state *state; + struct workspace *ws; +- struct weston_surface *old_es; ++ struct weston_surface *old_es = NULL; + struct shell_surface *shsurf, *shsurf_child; + struct shell_seat *shseat = get_shell_seat(seat); + +@@ -3801,6 +3810,9 @@ activate(struct desktop_shell *shell, struct weston_view *view, + if (shsurf->output) + lower_fullscreen_layer(shell, shsurf->output); + ++ if (view->surface->flags & SURFACE_NO_FOCUS) ++ goto no_focus; ++ + weston_view_activate_input(view, seat, flags); + + if (shseat && shseat->focused_surface) { +@@ -3821,6 +3833,7 @@ activate(struct desktop_shell *shell, struct weston_view *view, + old_es = state->keyboard_focus; + focus_state_set_focus(state, es); + ++no_focus: + if (weston_desktop_surface_get_fullscreen(shsurf->desktop_surface) && + flags & WESTON_ACTIVATE_FLAG_CONFIGURE) + shell_configure_fullscreen(shsurf); +@@ -3829,7 +3842,7 @@ activate(struct desktop_shell *shell, struct weston_view *view, + * order as appropriate. */ + shell_surface_update_layer(shsurf); + +- if (shell->focus_animation_type != ANIMATION_NONE) { ++ if (old_es && shell->focus_animation_type != ANIMATION_NONE) { + ws = get_current_workspace(shell); + animate_focus_change(shell, ws, get_default_view(old_es), get_default_view(es)); + } +@@ -3942,6 +3955,8 @@ lock(struct desktop_shell *shell) + if (shell->showing_input_panels) + weston_layer_unset_position(&shell->input_panel_layer); + weston_layer_unset_position(&ws->layer); ++ weston_layer_unset_position(&shell->top_layer); ++ weston_layer_unset_position(&shell->bottom_layer); + + weston_layer_set_position(&shell->lock_layer, + WESTON_LAYER_POSITION_LOCK); +@@ -4822,6 +4837,8 @@ shell_for_each_layer(struct desktop_shell *shell, + func(shell, &shell->background_layer, data); + func(shell, &shell->lock_layer, data); + func(shell, &shell->input_panel_layer, data); ++ func(shell, &shell->top_layer, data); ++ func(shell, &shell->bottom_layer, data); + + wl_array_for_each(ws, &shell->workspaces.array) + func(shell, &(*ws)->layer, data); +@@ -5115,6 +5132,8 @@ shell_destroy(struct wl_listener *listener, void *data) + workspace_destroy(*ws); + wl_array_release(&shell->workspaces.array); + ++ desktop_shell_destroy_layer(&shell->bottom_layer); ++ desktop_shell_destroy_layer(&shell->top_layer); + desktop_shell_destroy_layer(&shell->panel_layer); + desktop_shell_destroy_layer(&shell->background_layer); + desktop_shell_destroy_layer(&shell->lock_layer); +@@ -5270,6 +5289,8 @@ wet_shell_init(struct weston_compositor *ec, + weston_layer_init(&shell->background_layer, ec); + weston_layer_init(&shell->lock_layer, ec); + weston_layer_init(&shell->input_panel_layer, ec); ++ weston_layer_init(&shell->top_layer, ec); ++ weston_layer_init(&shell->bottom_layer, ec); + + weston_layer_set_position(&shell->fullscreen_layer, + WESTON_LAYER_POSITION_FULLSCREEN); +@@ -5277,6 +5298,10 @@ wet_shell_init(struct weston_compositor *ec, + WESTON_LAYER_POSITION_UI); + weston_layer_set_position(&shell->background_layer, + WESTON_LAYER_POSITION_BACKGROUND); ++ weston_layer_set_position(&shell->top_layer, ++ WESTON_LAYER_POSITION_TOP_UI); ++ weston_layer_set_position(&shell->bottom_layer, ++ WESTON_LAYER_POSITION_BOTTOM_UI); + + wl_array_init(&shell->workspaces.array); + wl_list_init(&shell->workspaces.client_list); +diff --git a/desktop-shell/shell.h b/desktop-shell/shell.h +index b06b906..e0a0620 100644 +--- a/desktop-shell/shell.h ++++ b/desktop-shell/shell.h +@@ -148,6 +148,8 @@ struct desktop_shell { + struct weston_layer background_layer; + struct weston_layer lock_layer; + struct weston_layer input_panel_layer; ++ struct weston_layer top_layer; ++ struct weston_layer bottom_layer; + + struct wl_listener pointer_focus_listener; + struct weston_surface *grab_surface; +diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h +index 24e44a2..7bc01e3 100644 +--- a/include/libweston/libweston.h ++++ b/include/libweston/libweston.h +@@ -1469,6 +1469,14 @@ struct weston_pointer_constraint { + struct wl_listener surface_activate_listener; + }; + ++enum weston_surface_flags { ++ SURFACE_NO_FOCUS = 1 << 0, ++ SURFACE_STAY_ON_TOP = 1 << 1, ++ SURFACE_STAY_ON_BOTTOM = 1 << 2, ++ SURFACE_BLOCKED = 1 << 3, ++ SURFACE_TRANS_INPUT = 1 << 4, ++}; ++ + struct weston_surface { + struct wl_resource *resource; + struct wl_signal destroy_signal; /* callback argument: this surface */ +@@ -1575,6 +1583,11 @@ struct weston_surface { + + /* Transparent hole region(excluding it's lower subsurface area) */ + pixman_region32_t hole; ++ ++ /* Hacky surface flags */ ++ enum weston_surface_flags flags; ++ ++ double alpha; + }; + + struct weston_subsurface { +diff --git a/libweston-desktop/surface.c b/libweston-desktop/surface.c +index 21ff080..e86ef52 100644 +--- a/libweston-desktop/surface.c ++++ b/libweston-desktop/surface.c +@@ -695,12 +695,202 @@ weston_desktop_surface_set_position(struct weston_desktop_surface *surface, + weston_view_set_position(view->view, x, y); + } + ++static bool ++weston_desktop_surface_set_flags(struct weston_desktop_surface *surface, ++ char *s) ++{ ++ struct weston_surface *wsurface = surface->surface; ++ char *p; ++ ++#define SURFACE_FLAG_PREFIX "flags=" ++ s = strstr(s, SURFACE_FLAG_PREFIX); ++ if (!s) ++ return false; ++ ++ s += strlen(SURFACE_FLAG_PREFIX); ++ ++ p = strtok(s, "|"); ++ while (p) { ++ enum weston_surface_flags flag = 0; ++ bool clear = false; ++ ++ switch (p[0]) { ++ case ';': ++ /* fall through */ ++ case '&': ++ return true; ++ case '-': ++ clear = true; ++ /* fall through */ ++ case '+': ++ p++; ++ default: ++ break; ++ } ++ ++ if (!strcmp(p, "no-focus")) ++ flag = SURFACE_NO_FOCUS; ++ else if (!strcmp(p, "stay-on-top")) ++ flag = SURFACE_STAY_ON_TOP; ++ else if (!strcmp(p, "stay-on-bottom")) ++ flag = SURFACE_STAY_ON_BOTTOM; ++ else if (!strcmp(p, "blocked")) ++ flag = SURFACE_BLOCKED; ++ else if (!strcmp(p, "trans-input")) ++ flag = SURFACE_TRANS_INPUT; ++ else ++ weston_log("%s: warning: unsupported flag: %s\n", ++ __func__, p); ++ ++ if (clear) ++ wsurface->flags &= ~flag; ++ else ++ wsurface->flags |= flag; ++ ++ p = strtok(NULL, "|"); ++ }; ++ ++ return true; ++} ++ ++static bool ++weston_desktop_surface_set_requests(struct weston_desktop_surface *surface, ++ char *s) ++{ ++ struct weston_surface *wsurface = surface->surface; ++ char *p; ++ ++#define SURFACE_REQUEST_PREFIX "requests=" ++ s = strstr(s, SURFACE_REQUEST_PREFIX); ++ if (!s) ++ return false; ++ ++ s += strlen(SURFACE_REQUEST_PREFIX); ++ ++ p = strtok(s, "|"); ++ while (p) { ++ switch (p[0]) { ++ case ';': ++ /* fall through */ ++ case '&': ++ return true; ++ default: ++ break; ++ } ++ ++ if (!strcmp(p, "activate")) { ++ if (weston_surface_is_mapped(wsurface)) ++ weston_surface_unmap(wsurface); ++ ++ weston_desktop_api_committed(surface->desktop, ++ surface, 0, 0); ++ } else { ++ weston_log("%s: warning: unsupported request: %s\n", ++ __func__, p); ++ } ++ ++ p = strtok(NULL, "|"); ++ }; ++ ++ return true; ++} ++ ++static void ++weston_surface_set_alpha(struct weston_surface *wsurface, float alpha) ++{ ++ struct weston_subsurface *sub; ++ struct weston_view *view; ++ ++ wsurface->alpha = alpha; ++ wsurface->is_opaque = !(alpha < 1.0); ++ ++ wl_list_for_each(view, &wsurface->views, ++ surface_link) { ++ view->alpha = alpha; ++ weston_view_geometry_dirty(view); ++ } ++ ++ wl_list_for_each(sub, &wsurface->subsurface_list, ++ parent_link) { ++ if (sub->surface != wsurface) ++ weston_surface_set_alpha(sub->surface, alpha); ++ } ++} ++ ++static bool ++weston_desktop_surface_set_attrs(struct weston_desktop_surface *surface, ++ char *s) ++{ ++ struct weston_surface *wsurface = surface->surface; ++ char *p; ++ ++#define SURFACE_ATTRS_PREFIX "attrs=" ++ s = strstr(s, SURFACE_ATTRS_PREFIX); ++ if (!s) ++ return false; ++ ++ s += strlen(SURFACE_ATTRS_PREFIX); ++ ++ p = strtok(s, "|"); ++ while (p) { ++ switch (p[0]) { ++ case ';': ++ /* fall through */ ++ case '&': ++ return true; ++ default: ++ break; ++ } ++ ++#define SURFACE_ATTR_ALPHA "alpha:" ++ if (!strncmp(p, SURFACE_ATTR_ALPHA, ++ strlen(SURFACE_ATTR_ALPHA))) { ++ double alpha = atof(p + strlen(SURFACE_ATTR_ALPHA)); ++ ++ weston_surface_set_alpha(wsurface, alpha); ++ } else { ++ weston_log("%s: warning: unsupported attr: %s\n", ++ __func__, p); ++ } ++ ++ p = strtok(NULL, "|"); ++ }; ++ ++ return true; ++} ++ ++static bool ++weston_desktop_surface_handle_config(struct weston_desktop_surface *surface, ++ const char *s) ++{ ++ char *tmp; ++ bool handled = false; ++ ++ tmp = strdup(s); ++ if (tmp == NULL) ++ return false; ++ ++ handled |= weston_desktop_surface_set_flags(surface, tmp); ++ ++ strcpy(tmp, s); ++ handled |= weston_desktop_surface_set_requests(surface, tmp); ++ ++ strcpy(tmp, s); ++ handled |= weston_desktop_surface_set_attrs(surface, tmp); ++ ++ free(tmp); ++ return handled; ++} ++ + void + weston_desktop_surface_set_title(struct weston_desktop_surface *surface, + const char *title) + { + char *tmp, *old; + ++ if (weston_desktop_surface_handle_config(surface, title)) ++ return; ++ + tmp = strdup(title); + if (tmp == NULL) + return; +@@ -717,6 +907,9 @@ weston_desktop_surface_set_app_id(struct weston_desktop_surface *surface, + { + char *tmp, *old; + ++ if (weston_desktop_surface_handle_config(surface, app_id)) ++ return; ++ + tmp = strdup(app_id); + if (tmp == NULL) + return; +diff --git a/libweston/compositor.c b/libweston/compositor.c +index 0aa9d1a..b959424 100644 +--- a/libweston/compositor.c ++++ b/libweston/compositor.c +@@ -412,7 +412,7 @@ weston_view_create(struct weston_surface *surface) + + pixman_region32_init(&view->clip); + +- view->alpha = 1.0; ++ view->alpha = surface->alpha; + pixman_region32_init(&view->transform.opaque); + + wl_list_init(&view->geometry.transformation_list); +@@ -608,6 +608,8 @@ weston_surface_create(struct weston_compositor *compositor) + surface->compositor = compositor; + surface->ref_count = 1; + ++ surface->alpha = 1.0; ++ + surface->buffer_viewport.buffer.transform = WL_OUTPUT_TRANSFORM_NORMAL; + surface->buffer_viewport.buffer.scale = 1; + surface->buffer_viewport.buffer.src_width = wl_fixed_from_int(-1); +@@ -2217,6 +2219,12 @@ weston_compositor_pick_view(struct weston_compositor *compositor, + view_ix, view_iy, NULL)) + continue; + ++ if (view->surface->flags & SURFACE_BLOCKED) ++ break; ++ ++ if (view->surface->flags & SURFACE_TRANS_INPUT) ++ continue; ++ + *vx = view_x; + *vy = view_y; + return view; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0021-input-Fix-losing-focus-during-re-attaching-keyboard.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0021-input-Fix-losing-focus-during-re-attaching-keyboard.patch new file mode 100644 index 0000000000000000000000000000000000000000..bb9f85699790dc28335689a1bc70275e9d2bd632 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0021-input-Fix-losing-focus-during-re-attaching-keyboard.patch @@ -0,0 +1,34 @@ +From 5b237ccd52bd61121bcc7488538d5acf532dfbe1 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 12 May 2020 15:35:40 +0800 +Subject: [PATCH 21/79] input: Fix losing focus during re-attaching keyboard + +Call notify_keyboard_focus_out() when releasing the last keyboard to +pair with the notify_keyboard_focus_in(). + +Signed-off-by: Jeffy Chen +--- + libweston/input.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/libweston/input.c b/libweston/input.c +index ec7e416..6438b52 100644 +--- a/libweston/input.c ++++ b/libweston/input.c +@@ -3342,8 +3342,11 @@ weston_seat_release_keyboard(struct weston_seat *seat) + seat->keyboard_device_count--; + assert(seat->keyboard_device_count >= 0); + if (seat->keyboard_device_count == 0) { +- weston_keyboard_set_focus(seat->keyboard_state, NULL); +- weston_keyboard_cancel_grab(seat->keyboard_state); ++ /* Pair with notify_keyboard_focus_in() */ ++ seat->keyboard_device_count = 1; ++ notify_keyboard_focus_out(seat); ++ seat->keyboard_device_count = 0; ++ + weston_keyboard_reset_state(seat->keyboard_state); + seat_send_updated_caps(seat); + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0022-HACK-pixman-renderer-Support-mali-egl-client-and-egl.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0022-HACK-pixman-renderer-Support-mali-egl-client-and-egl.patch new file mode 100644 index 0000000000000000000000000000000000000000..d410816958edd79c325ed0c7ffd296681b5600af --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0022-HACK-pixman-renderer-Support-mali-egl-client-and-egl.patch @@ -0,0 +1,508 @@ +From 0f3dea67852b76216bfe1f8ea59274513000a1a9 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 3 Jul 2020 14:53:52 +0800 +Subject: [PATCH 22/79] HACK: pixman-renderer: Support mali egl client and egl + buffer attaching + +The mali clients requires mali_buffer_sharing extension, and it needs +lots of hacks to attach a wl_buffer created in that way. + +Signed-off-by: Jeffy Chen +--- + libweston/meson.build | 10 +- + libweston/pixman-renderer.c | 365 ++++++++++++++++++++++++++++-------- + 2 files changed, 290 insertions(+), 85 deletions(-) + +diff --git a/libweston/meson.build b/libweston/meson.build +index 257d695..a73e932 100644 +--- a/libweston/meson.build ++++ b/libweston/meson.build +@@ -70,12 +70,10 @@ srcs_libweston = [ + weston_direct_display_server_protocol_h, + ] + +-if get_option('renderer-gl') +- dep_egl = dependency('egl', required: false) +- if not dep_egl.found() +- error('libweston + gl-renderer requires egl which was not found. Or, you can use \'-Drenderer-gl=false\'.') +- endif +- deps_libweston += dep_egl ++dep_egl = dependency('egl', required: false) ++dep_gbm = dependency('gbm', required: false) ++if dep_egl.found() and dep_gbm.found() ++ deps_libweston += [ dep_egl, dep_gbm ] + endif + + lib_weston = shared_library( +diff --git a/libweston/pixman-renderer.c b/libweston/pixman-renderer.c +index d5c5422..ece4d91 100644 +--- a/libweston/pixman-renderer.c ++++ b/libweston/pixman-renderer.c +@@ -46,6 +46,19 @@ + #include "linux-dmabuf.h" + #include "linux-dmabuf-unstable-v1-server-protocol.h" + ++#ifdef ENABLE_EGL ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include "shared/platform.h" ++#include "shared/weston-egl-ext.h" /* for PFN* stuff */ ++#endif ++ + struct pixman_output_state { + void *shadow_buffer; + pixman_image_t *shadow_image; +@@ -75,6 +88,18 @@ struct pixman_renderer { + struct wl_signal destroy_signal; + + struct weston_drm_format_array supported_formats; ++ ++#ifdef ENABLE_EGL ++ PFNEGLBINDWAYLANDDISPLAYWL bind_display; ++ PFNEGLUNBINDWAYLANDDISPLAYWL unbind_display; ++ PFNEGLQUERYWAYLANDBUFFERWL query_buffer; ++ EGLDisplay egl_display; ++ ++ int drm_fd; ++ struct gbm_device *gbm; ++ ++ bool egl_inited; ++#endif + }; + + struct dmabuf_data { +@@ -82,6 +107,16 @@ struct dmabuf_data { + size_t size; + }; + ++#ifdef ENABLE_EGL ++/* HACK: For mali_buffer_sharing */ ++struct egl_buffer_info { ++ int dma_fd; ++ int width; ++ int height; ++ unsigned int stride; ++}; ++#endif ++ + static inline struct pixman_output_state * + get_output_state(struct weston_output *output) + { +@@ -636,6 +671,90 @@ buffer_state_handle_buffer_destroy(struct wl_listener *listener, void *data) + ps->buffer_destroy_listener.notify = NULL; + } + ++static void ++pixman_renderer_destroy_dmabuf(struct linux_dmabuf_buffer *dmabuf) ++{ ++ struct dmabuf_data *data = dmabuf->user_data; ++ linux_dmabuf_buffer_set_user_data(dmabuf, NULL, NULL); ++ ++ if (data) { ++ if (data->ptr) ++ munmap(data->ptr, data->size); ++ ++ free(data); ++ } ++} ++ ++static bool ++pixman_renderer_prepare_dmabuf(struct linux_dmabuf_buffer *dmabuf) ++{ ++ struct dmabuf_attributes *attributes = &dmabuf->attributes; ++ struct dmabuf_data *data; ++ size_t total_size, vstride0; ++ void *ptr; ++ int i; ++ ++ data = linux_dmabuf_buffer_get_user_data(dmabuf); ++ if (data) ++ return true; ++ ++ total_size = lseek(attributes->fd[0], 0, SEEK_END); ++ ++ for (i = 0; i < attributes->n_planes; i++) { ++ if (attributes->modifier[i] != DRM_FORMAT_MOD_INVALID) ++ return false; ++ } ++ ++ /* reject all flags we do not recognize or handle */ ++ if (attributes->flags & ~ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT) ++ return false; ++ ++ if (attributes->n_planes < 0) ++ return false; ++ ++ if (attributes->n_planes == 1) ++ goto out; ++ ++ vstride0 = (attributes->offset[1] - attributes->offset[0]) / ++ attributes->stride[0]; ++ ++ for (i = 1; i < attributes->n_planes; i++) { ++ size_t size = attributes->offset[i] - attributes->offset[i - 1]; ++ size_t vstride = size / attributes->stride[i - 1]; ++ ++ /* not contig */ ++ if (size <= 0 || vstride <= 0 || ++ attributes->offset[i - 1] + size > total_size) ++ return false; ++ ++ /* stride unmatched */ ++ if ((vstride != vstride0 && vstride != vstride0 / 2) || ++ (attributes->stride[i] != attributes->stride[0] && ++ attributes->stride[i] != attributes->stride[0] / 2)) ++ return false; ++ } ++ ++out: ++ /* Handle contig dma buffer */ ++ ++ ptr = mmap(NULL, total_size, PROT_READ, ++ MAP_SHARED, attributes->fd[0], 0); ++ if (!ptr) ++ return false; ++ ++ data = zalloc(sizeof *data); ++ if (!data) { ++ munmap(ptr, total_size); ++ return false; ++ } ++ ++ data->size = total_size; ++ data->ptr = ptr; ++ linux_dmabuf_buffer_set_user_data(dmabuf, data, ++ pixman_renderer_destroy_dmabuf); ++ return true; ++} ++ + static void + pixman_renderer_attach_dmabuf(struct weston_surface *es, + struct weston_buffer *buffer, +@@ -647,13 +766,12 @@ pixman_renderer_attach_dmabuf(struct weston_surface *es, + pixman_format_code_t pixman_format; + size_t vstride; + ++ if (!pixman_renderer_prepare_dmabuf(dmabuf)) ++ goto err; ++ + data = linux_dmabuf_buffer_get_user_data(dmabuf); +- if (!data || !data->ptr) { +- weston_buffer_reference(&ps->buffer_ref, NULL); +- weston_buffer_release_reference(&ps->buffer_release_ref, +- NULL); +- return; +- } ++ if (!data || !data->ptr) ++ goto err; + + buffer->width = attributes->width; + buffer->height = attributes->height; +@@ -694,10 +812,7 @@ pixman_renderer_attach_dmabuf(struct weston_surface *es, + #endif + default: + weston_log("Unsupported dmabuf format\n"); +- weston_buffer_reference(&ps->buffer_ref, NULL); +- weston_buffer_release_reference(&ps->buffer_release_ref, +- NULL); +- return; ++ goto err; + break; + } + +@@ -710,16 +825,25 @@ pixman_renderer_attach_dmabuf(struct weston_surface *es, + buffer_state_handle_buffer_destroy; + wl_signal_add(&buffer->destroy_signal, + &ps->buffer_destroy_listener); ++ return; ++err: ++ weston_buffer_reference(&ps->buffer_ref, NULL); ++ weston_buffer_release_reference(&ps->buffer_release_ref, NULL); + } + + static void + pixman_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer) + { ++ struct pixman_renderer *pr = get_renderer(es->compositor); + struct pixman_surface_state *ps = get_surface_state(es); + struct wl_shm_buffer *shm_buffer; + struct linux_dmabuf_buffer *dmabuf; + const struct pixel_format_info *pixel_info; + ++#ifdef ENABLE_EGL ++ EGLint format; ++#endif ++ + weston_buffer_reference(&ps->buffer_ref, buffer); + weston_buffer_release_reference(&ps->buffer_release_ref, + es->buffer_release_ref.buffer_release); +@@ -742,7 +866,56 @@ pixman_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer) + if (! shm_buffer) { + if ((dmabuf = linux_dmabuf_buffer_get(buffer->resource))) { + pixman_renderer_attach_dmabuf(es, buffer, dmabuf); ++#ifdef ENABLE_EGL ++ } else if (pr->egl_inited && ++ pr->query_buffer(pr->egl_display, ++ (void *)buffer->resource, ++ EGL_TEXTURE_FORMAT, &format)){ ++ struct egl_buffer_info *info; ++ struct linux_dmabuf_buffer dmabuf = { 0 }; ++ struct dmabuf_attributes *attributes = ++ &dmabuf.attributes; ++ struct stat s; ++ int width, height; ++ ++ pr->query_buffer(pr->egl_display, ++ (void *)buffer->resource, ++ EGL_WIDTH, &width); ++ pr->query_buffer(pr->egl_display, ++ (void *)buffer->resource, ++ EGL_HEIGHT, &height); ++ ++ info = wl_resource_get_user_data(buffer->resource); ++ if (!info) ++ goto err; ++ ++ if (fstat(info->dma_fd, &s) < 0 || ++ info->width != width || info->height != height) ++ goto err; ++ ++ switch (format) { ++ case EGL_TEXTURE_RGB: ++ attributes->format = DRM_FORMAT_RGB888; ++ break; ++ case EGL_TEXTURE_RGBA: ++ attributes->format = DRM_FORMAT_ARGB8888; ++ break; ++ default: ++ goto err; ++ } ++ ++ attributes->n_planes = 1; ++ attributes->fd[0] = info->dma_fd; ++ attributes->width = info->width; ++ attributes->height = info->height; ++ attributes->stride[0] = info->stride; ++ ++ pixman_renderer_attach_dmabuf(es, buffer, &dmabuf); ++ } else { ++err: ++#else + } else { ++#endif + weston_log("unhandled buffer type!\n"); + weston_buffer_reference(&ps->buffer_ref, NULL); + weston_buffer_release_reference(&ps->buffer_release_ref, +@@ -880,6 +1053,21 @@ pixman_renderer_destroy(struct weston_compositor *ec) + { + struct pixman_renderer *pr = get_renderer(ec); + ++#ifdef ENABLE_EGL ++ if (pr->egl_inited) { ++ if (pr->unbind_display) ++ pr->unbind_display(pr->egl_display, ec->wl_display); ++ ++ eglTerminate(pr->egl_display); ++ eglReleaseThread(); ++ ++ if (pr->gbm) ++ gbm_device_destroy(pr->gbm); ++ ++ close(pr->drm_fd); ++ } ++#endif ++ + wl_signal_emit(&pr->destroy_signal, pr); + weston_binding_destroy(pr->debug_binding); + +@@ -958,79 +1146,11 @@ debug_binding(struct weston_keyboard *keyboard, const struct timespec *time, + } + } + +-static void +-pixman_renderer_destroy_dmabuf(struct linux_dmabuf_buffer *dmabuf) +-{ +- struct dmabuf_data *data = dmabuf->user_data; +- linux_dmabuf_buffer_set_user_data(dmabuf, NULL, NULL); +- +- if (data) { +- if (data->ptr) +- munmap(data->ptr, data->size); +- +- free(data); +- } +-} +- + static bool + pixman_renderer_import_dmabuf(struct weston_compositor *ec, + struct linux_dmabuf_buffer *dmabuf) + { +- struct dmabuf_attributes *attributes = &dmabuf->attributes; +- struct dmabuf_data *data; +- size_t total_size, vstride0; +- int i; +- +- for (i = 0; i < attributes->n_planes; i++) { +- if (attributes->modifier[i] != DRM_FORMAT_MOD_INVALID) +- return false; +- } +- +- /* reject all flags we do not recognize or handle */ +- if (attributes->flags & ~ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT) +- return false; +- +- if (attributes->n_planes < 0) +- return false; +- +- if (attributes->n_planes == 1) +- goto out; +- +- total_size = lseek(attributes->fd[0], 0, SEEK_END); +- vstride0 = (attributes->offset[1] - attributes->offset[0]) / +- attributes->stride[0]; +- +- for (i = 1; i < attributes->n_planes; i++) { +- size_t size = attributes->offset[i] - attributes->offset[i - 1]; +- size_t vstride = size / attributes->stride[i - 1]; +- +- /* not contig */ +- if (size <= 0 || vstride <= 0 || +- attributes->offset[i - 1] + size > total_size) +- return false; +- +- /* stride unmatched */ +- if ((vstride != vstride0 && vstride != vstride0 / 2) || +- (attributes->stride[i] != attributes->stride[0] && +- attributes->stride[i] != attributes->stride[0] / 2)) +- return false; +- } +- +-out: +- /* Handle contig dma buffer */ +- +- data = zalloc(sizeof *data); +- if (!data) +- return false; +- +- linux_dmabuf_buffer_set_user_data(dmabuf, data, +- pixman_renderer_destroy_dmabuf); +- +- data->size = lseek(attributes->fd[0], 0, SEEK_END); +- +- data->ptr = mmap(NULL, data->size, PROT_READ, +- MAP_SHARED, attributes->fd[0], 0); +- return data->ptr != MAP_FAILED; ++ return pixman_renderer_prepare_dmabuf(dmabuf); + } + + static const struct weston_drm_format_array * +@@ -1086,6 +1206,89 @@ out: + return ret; + } + ++#ifdef ENABLE_EGL ++static bool ++pixman_renderer_init_egl(struct pixman_renderer *pr, ++ struct weston_compositor *ec) ++{ ++ PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display; ++ const char *extensions; ++ ++ get_platform_display = ++ (void *) eglGetProcAddress("eglGetPlatformDisplayEXT"); ++ pr->query_buffer = ++ (void *) eglGetProcAddress("eglQueryWaylandBufferWL"); ++ pr->bind_display = ++ (void *) eglGetProcAddress("eglBindWaylandDisplayWL"); ++ pr->unbind_display = ++ (void *) eglGetProcAddress("eglUnbindWaylandDisplayWL"); ++ ++ if (!get_platform_display || !pr->query_buffer || ++ !pr->bind_display || !pr->unbind_display) { ++ weston_log("Failed to get egl proc\n"); ++ return false; ++ } ++ ++ pr->drm_fd = open("/dev/dri/card0", O_RDWR | O_CLOEXEC); ++ if (pr->drm_fd < 0) { ++ weston_log("Failed to open drm dev\n"); ++ return false; ++ } ++ ++ pr->gbm = gbm_create_device(pr->drm_fd); ++ if (!pr->gbm) { ++ weston_log("Failed to create gbm device\n"); ++ goto err_close_fd; ++ } ++ ++ pr->egl_display = get_platform_display(EGL_PLATFORM_GBM_KHR, ++ (void*) pr->gbm, NULL); ++ if (pr->egl_display == EGL_NO_DISPLAY) { ++ weston_log("Failed to create egl display\n"); ++ goto err_destroy_gbm; ++ } ++ ++ if (!eglInitialize(pr->egl_display, NULL, NULL)) { ++ weston_log("Failed to initialize egl\n"); ++ goto err_terminate_display; ++ } ++ ++ extensions = ++ (const char *) eglQueryString(pr->egl_display, EGL_EXTENSIONS); ++ if (!extensions) { ++ weston_log("Retrieving EGL extension string failed.\n"); ++ goto err_terminate_display; ++ } ++ ++ if (!weston_check_egl_extension(extensions, ++ "EGL_WL_bind_wayland_display")) { ++ weston_log("Wayland extension not supported.\n"); ++ goto err_terminate_display; ++ } ++ ++ if (!eglBindAPI(EGL_OPENGL_ES_API)) { ++ weston_log("Failed to bind api\n"); ++ goto err_terminate_display; ++ } ++ ++ if (!pr->bind_display(pr->egl_display, ec->wl_display)) ++ goto err_terminate_display; ++ ++ pr->egl_inited = true; ++ return true; ++ ++err_terminate_display: ++ eglTerminate(pr->egl_display); ++err_destroy_gbm: ++ gbm_device_destroy(pr->gbm); ++ pr->gbm = NULL; ++err_close_fd: ++ close(pr->drm_fd); ++ pr->drm_fd = -1; ++ return false; ++} ++#endif ++ + WL_EXPORT int + pixman_renderer_init(struct weston_compositor *ec) + { +@@ -1150,6 +1353,10 @@ pixman_renderer_init(struct weston_compositor *ec) + renderer->base.get_supported_formats = + pixman_renderer_get_supported_formats; + ++#ifdef ENABLE_EGL ++ pixman_renderer_init_egl(renderer, ec); ++#endif ++ + return 0; + } + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0023-Avoid-adding-views-to-other-outputs.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0023-Avoid-adding-views-to-other-outputs.patch new file mode 100644 index 0000000000000000000000000000000000000000..4d8130699225c131092bf558b151cf7c58b05273 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0023-Avoid-adding-views-to-other-outputs.patch @@ -0,0 +1,38 @@ +From 6339c12d59e740347c9c6a5922e3a9acf4def32c Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Sat, 7 May 2022 16:41:20 +0800 +Subject: [PATCH 23/79] Avoid adding views to other outputs + +The outputs can be overlapped now. + +Signed-off-by: Jeffy Chen +--- + libweston/compositor.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/libweston/compositor.c b/libweston/compositor.c +index b959424..02d1fa1 100644 +--- a/libweston/compositor.c ++++ b/libweston/compositor.c +@@ -1314,6 +1314,7 @@ weston_view_set_output(struct weston_view *view, struct weston_output *output) + } + view->output = output; + if (output) { ++ view->output_mask |= output->id; + view->output_destroy_listener.notify = + notify_view_output_destroy; + wl_signal_add(&output->destroy_signal, +@@ -2834,6 +2835,10 @@ view_list_add(struct weston_compositor *compositor, + struct weston_paint_node *pnode; + struct weston_subsurface *sub; + ++ /* HACK: Avoid adding views to other outputs */ ++ if (output && !(view->output_mask & 1 << output->id)) ++ output = NULL; ++ + weston_view_update_transform(view); + pnode = view_ensure_paint_node(view, output); + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0024-Support-holding-display-for-the-first-app.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0024-Support-holding-display-for-the-first-app.patch new file mode 100644 index 0000000000000000000000000000000000000000..4e011d36da007fa9b8de269fd93bc0041bf63047 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0024-Support-holding-display-for-the-first-app.patch @@ -0,0 +1,123 @@ +From 0f57092d54f1c3a6082d2cc5a9729928f9b9f6c6 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 3 Jul 2020 10:20:40 +0800 +Subject: [PATCH 24/79] Support holding display for the first app + +Use '-w' or '--warm-up' to enable it. + +Signed-off-by: Jeffy Chen +--- + compositor/main.c | 5 +++++ + include/libweston/libweston.h | 2 ++ + libweston/compositor.c | 30 ++++++++++++++++++++++++++++++ + 3 files changed, 37 insertions(+) + +diff --git a/compositor/main.c b/compositor/main.c +index a4f679a..128016b 100644 +--- a/compositor/main.c ++++ b/compositor/main.c +@@ -679,6 +679,7 @@ usage(int error_code) + " -f, --flight-rec-scopes=SCOPE\n\t\t\tSpecify log scopes to " + "subscribe to.\n\t\t\tCan specify multiple scopes, " + "each followed by comma\n" ++ " -w, --warm-up\t\tHold display for the first app\n" + " -h, --help\t\tThis help message\n\n"); + + #if defined(BUILD_DRM_COMPOSITOR) +@@ -3336,6 +3337,8 @@ wet_main(int argc, char *argv[], const struct weston_testsuite_data *test_data) + bool wait_for_debugger = false; + struct wl_protocol_logger *protologger = NULL; + ++ bool warm_up = false; ++ + const struct weston_option core_options[] = { + { WESTON_OPTION_STRING, "backend", 'B', &backend }, + { WESTON_OPTION_STRING, "shell", 0, &shell }, +@@ -3354,6 +3357,7 @@ wet_main(int argc, char *argv[], const struct weston_testsuite_data *test_data) + { WESTON_OPTION_BOOLEAN, "debug", 0, &debug_protocol }, + { WESTON_OPTION_STRING, "logger-scopes", 'l', &log_scopes }, + { WESTON_OPTION_STRING, "flight-rec-scopes", 'f', &flight_rec_scopes }, ++ { WESTON_OPTION_BOOLEAN, "warm-up", 'w', &warm_up }, + }; + + wl_list_init(&wet.layoutput_list); +@@ -3528,6 +3532,7 @@ wet_main(int argc, char *argv[], const struct weston_testsuite_data *test_data) + wet.compositor->idle_time = idle_time; + wet.compositor->default_pointer_grab = NULL; + wet.compositor->exit = handle_exit; ++ wet.compositor->warm_up = warm_up; + + weston_compositor_log_capabilities(wet.compositor); + +diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h +index 7bc01e3..4e8bfec 100644 +--- a/include/libweston/libweston.h ++++ b/include/libweston/libweston.h +@@ -1205,6 +1205,8 @@ struct weston_compositor { + + enum weston_output_flow output_flow; + struct weston_output *prefer_output; ++ ++ bool warm_up; + }; + + struct weston_buffer { +diff --git a/libweston/compositor.c b/libweston/compositor.c +index 02d1fa1..121871c 100644 +--- a/libweston/compositor.c ++++ b/libweston/compositor.c +@@ -176,6 +176,24 @@ weston_compositor_is_static_layer(struct weston_layer *layer) + } + } + ++static bool ++weston_compositor_is_system_layer(struct weston_layer *layer) ++{ ++ if (!layer) ++ return false; ++ ++ switch (layer->position) { ++ case WESTON_LAYER_POSITION_BACKGROUND: ++ case WESTON_LAYER_POSITION_UI: ++ case WESTON_LAYER_POSITION_LOCK: ++ case WESTON_LAYER_POSITION_CURSOR: ++ case WESTON_LAYER_POSITION_FADE: ++ return true; ++ default: ++ return false; ++ } ++} ++ + /** Send wl_output events for mode and scale changes + * + * \param head Send on all resources bound to this head. +@@ -2879,7 +2897,14 @@ weston_compositor_build_view_list(struct weston_compositor *compositor, + wl_list_init(&compositor->view_list); + + wl_list_for_each(layer, &compositor->layer_list, link) { ++ bool system_layer = weston_compositor_is_system_layer(layer); ++ + wl_list_for_each(view, &layer->view_list.link, layer_link.link) { ++ if (compositor->warm_up && !system_layer) { ++ weston_log("seeing the first app\n"); ++ compositor->warm_up = false; ++ } ++ + view_list_add(compositor, view, output); + } + } +@@ -2935,6 +2960,11 @@ weston_output_repaint(struct weston_output *output, void *repaint_data) + /* Rebuild the surface list and update surface transforms up front. */ + weston_compositor_build_view_list(ec, output); + ++ if (ec->warm_up) { ++ weston_log("holding display for the first app...\n"); ++ return -1; ++ } ++ + /* Find the highest protection desired for an output */ + wl_list_for_each(pnode, &output->paint_node_z_order_list, + z_order_link) { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0025-Support-setting-touch-calibration-through-environmen.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0025-Support-setting-touch-calibration-through-environmen.patch new file mode 100644 index 0000000000000000000000000000000000000000..330dbced0cb9ad810f0820b220bd324326b4755c --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0025-Support-setting-touch-calibration-through-environmen.patch @@ -0,0 +1,102 @@ +From 97fafec553e2d8b926ff305629f9ed708beadcc1 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 4 Aug 2020 14:30:33 +0800 +Subject: [PATCH 25/79] Support setting touch calibration through environment + +For example: +1/ Use weston-calibrator tool to get calibration data +[root@rk3399:/]# weston-calibrator +Final calibration values: -0.846961 0.122487 0.864176 -0.110204 -0.685913 0.958219 + +2/ Export calibration data through environment: +export WESTON_TOUCH_CALIBRATION="-0.846961 0.122487 0.864176 -0.110204 -0.685913 0.958219" + +Signed-off-by: Jeffy Chen +--- + clients/calibrator.c | 9 +++++++++ + clients/touch-calibrator.c | 12 ++++++++---- + libweston/libinput-device.c | 13 +++++++++++++ + 3 files changed, 30 insertions(+), 4 deletions(-) + +diff --git a/clients/calibrator.c b/clients/calibrator.c +index be65d9b..20fc1e7 100644 +--- a/clients/calibrator.c ++++ b/clients/calibrator.c +@@ -106,6 +106,7 @@ finish_calibration (struct calibrator *calibrator) + struct weston_matrix m; + struct weston_matrix inverse; + struct weston_vector x_calib, y_calib; ++ struct rectangle allocation; + int i; + + +@@ -141,6 +142,14 @@ finish_calibration (struct calibrator *calibrator) + x_calib.f[0], x_calib.f[1], x_calib.f[2], + y_calib.f[0], y_calib.f[1], y_calib.f[2]); + ++ widget_get_allocation(calibrator->widget, &allocation); ++ x_calib.f[2] /= allocation.width; ++ y_calib.f[2] /= allocation.height; ++ ++ printf ("Final calibration values: %f %f %f %f %f %f\n", ++ x_calib.f[0], x_calib.f[1], x_calib.f[2], ++ y_calib.f[0], y_calib.f[1], y_calib.f[2]); ++ + exit(0); + } + +diff --git a/clients/touch-calibrator.c b/clients/touch-calibrator.c +index 49dd920..04a966b 100644 +--- a/clients/touch-calibrator.c ++++ b/clients/touch-calibrator.c +@@ -772,15 +772,19 @@ touch_device_handler(void *data, struct weston_touch_calibration *c, + + if (!cal->match_name) { + printf("device \"%s\" - head \"%s\"\n", device, head); +- return; +- } + +- if (cal->device_name) ++ if (!cal->device_name) ++ cal->device_name = strdup(device); + return; ++ } + + if (strcmp(cal->match_name, device) == 0 || +- strcmp(cal->match_name, head) == 0) ++ strcmp(cal->match_name, head) == 0) { ++ if (cal->device_name) ++ free(cal->device_name); ++ + cal->device_name = strdup(device); ++ } + } + + struct weston_touch_calibration_listener touch_calibration_listener = { +diff --git a/libweston/libinput-device.c b/libweston/libinput-device.c +index 4ea89de..09bd459 100644 +--- a/libweston/libinput-device.c ++++ b/libweston/libinput-device.c +@@ -627,6 +627,19 @@ evdev_device_set_calibration(struct evdev_device *device) + return; + } + ++ calibration_values = getenv("WESTON_TOUCH_CALIBRATION"); ++ if (calibration_values && sscanf(calibration_values, ++ "%f %f %f %f %f %f", ++ &calibration.m[0], ++ &calibration.m[1], ++ &calibration.m[2], ++ &calibration.m[3], ++ &calibration.m[4], ++ &calibration.m[5]) == 6) { ++ do_set_calibration(device, &calibration); ++ return; ++ } ++ + width = device->output->width; + height = device->output->height; + if (width == 0 || height == 0) +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0026-backend-drm-Support-controlling-compositor-dynamical.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0026-backend-drm-Support-controlling-compositor-dynamical.patch new file mode 100644 index 0000000000000000000000000000000000000000..e7beb5ba282e273f3288027a2ee5a20163e6158d --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0026-backend-drm-Support-controlling-compositor-dynamical.patch @@ -0,0 +1,93 @@ +From 6527d1d6c7809bb50213778cac81228523a9d9e1 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 3 Jul 2020 12:37:37 +0800 +Subject: [PATCH 26/79] backend-drm: Support controlling compositor dynamically + +Use config file to control compositor's state. + +Default config file is "/tmp/.weston_drm.conf", can override with +"WESTON_DRM_CONFIG" environment. + +Supported configs format is "compositor::", for +example: +echo "compositor:state:sleep" > /tmp/.weston_drm.conf +echo "compositor:state:block" > /tmp/.weston_drm.conf +echo "compositor:state:freeze" > /tmp/.weston_drm.conf +echo "compositor:state:off" > /tmp/.weston_drm.conf +echo "compositor:state:on" > /tmp/.weston_drm.conf +echo "compositor:hotplug:off" > /tmp/.weston_drm.conf +echo "compositor:hotplug:on" > /tmp/.weston_drm.conf +echo "compositor:hotplug:force" > /tmp/.weston_drm.conf + +Signed-off-by: Jeffy Chen +--- + libweston/backend-drm/drm.c | 39 ++++++++++++++++++++++++++++++++++++- + 1 file changed, 38 insertions(+), 1 deletion(-) + +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index 1d6f7db..53a3d49 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -3691,6 +3691,39 @@ config_handle_output(struct drm_backend *b, const char *name, + } + } + ++static void ++config_handle_compositor(struct drm_backend *b, const char *key, ++ const char *value) ++{ ++ if (!strncmp(key, "state", strlen("state"))) { ++ if (!strncmp(value, "sleep", strlen("sleep"))) { ++ weston_compositor_sleep(b->compositor); ++ } else if (!strncmp(value, "block", strlen("block"))) { ++ udev_input_disable(&b->input); ++ } else if (!strncmp(value, "freeze", strlen("freeze"))) { ++ udev_input_disable(&b->input); ++ weston_compositor_offscreen(b->compositor); ++ } else if (!strncmp(value, "off", strlen("off"))) { ++ udev_input_disable(&b->input); ++ weston_compositor_sleep(b->compositor); ++ } else { ++ weston_compositor_wake(b->compositor); ++ weston_compositor_damage_all(b->compositor); ++ ++ if (b->input.suspended) ++ udev_input_enable(&b->input); ++ } ++ } else if (!strncmp(key, "hotplug", strlen("hotplug"))) { ++ if (!strncmp(value, "off", strlen("off"))) ++ wl_event_source_fd_update(b->udev_drm_source, 0); ++ else if (!strncmp(value, "on", strlen("on"))) ++ wl_event_source_fd_update(b->udev_drm_source, ++ WL_EVENT_READABLE); ++ else if (!strncmp(value, "force", strlen("force"))) ++ hotplug_timer_handler(b); ++ } ++} ++ + static int + config_timer_handler(void *data) + { +@@ -3722,7 +3755,9 @@ config_timer_handler(void *data) + + /** + * Parse configs, formated with :: +- * For example: "output:all:rotate90" ++ * For example: ++ * output:all:rotate90 ++ * compositor:state:off + */ + while (3 == fscanf(conf_fp, + "%" STR(MAX_CONF_LEN) "[^:]:" +@@ -3730,6 +3765,8 @@ config_timer_handler(void *data) + "%" STR(MAX_CONF_LEN) "s ", type, key, value)) { + if (!strcmp(type, "output")) + config_handle_output(b, key, value); ++ else if (!strcmp(type, "compositor")) ++ config_handle_compositor(b, key, value); + } + + fclose(conf_fp); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0027-HACK-backend-drm-Consider-linear-and-invalid-modifie.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0027-HACK-backend-drm-Consider-linear-and-invalid-modifie.patch new file mode 100644 index 0000000000000000000000000000000000000000..8ada4e51847af76228bcc07589ebe73f0e7b1b74 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0027-HACK-backend-drm-Consider-linear-and-invalid-modifie.patch @@ -0,0 +1,235 @@ +From 9ae9bc0f952538ee7abd79798f608b1bb433f604 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 1 Sep 2020 08:51:17 +0800 +Subject: [PATCH 27/79] HACK: backend-drm: Consider linear and invalid modifier + are the same + +That is true with Rockchip BSP drivers and packages. + +Signed-off-by: Jeffy Chen +--- + clients/simple-dmabuf-egl.c | 8 ++++++-- + libweston/backend-drm/drm-gbm.c | 3 ++- + libweston/backend-drm/drm-virtual.c | 8 +------- + libweston/backend-drm/fb.c | 10 ++++++---- + libweston/backend-drm/kms.c | 2 +- + libweston/linux-dmabuf.h | 4 ++++ + libweston/pixman-renderer.c | 4 ++-- + libweston/renderer-gl/gl-renderer.c | 8 ++++---- + 8 files changed, 26 insertions(+), 21 deletions(-) + +diff --git a/clients/simple-dmabuf-egl.c b/clients/simple-dmabuf-egl.c +index ef0d9de..e984503 100644 +--- a/clients/simple-dmabuf-egl.c ++++ b/clients/simple-dmabuf-egl.c +@@ -68,6 +68,9 @@ + + #define MAX_BUFFER_PLANES 4 + ++#define DRM_MOD_VALID(mod) \ ++ ((mod) != DRM_FORMAT_MOD_LINEAR && (mod) != DRM_FORMAT_MOD_INVALID) ++ + struct display { + struct wl_display *display; + struct wl_registry *registry; +@@ -265,7 +268,8 @@ create_fbo_for_buffer(struct display *display, struct buffer *buffer) + attribs[atti++] = (int) buffer->offsets[plane_idx]; \ + attribs[atti++] = EGL_DMA_BUF_PLANE ## plane_idx ## _PITCH_EXT; \ + attribs[atti++] = (int) buffer->strides[plane_idx]; \ +- if (display->egl.has_dma_buf_import_modifiers) { \ ++ if (DRM_MOD_VALID(buffer->modifier) && \ ++ display->egl.has_dma_buf_import_modifiers) { \ + attribs[atti++] = EGL_DMA_BUF_PLANE ## plane_idx ## _MODIFIER_LO_EXT; \ + attribs[atti++] = buffer->modifier & 0xFFFFFFFF; \ + attribs[atti++] = EGL_DMA_BUF_PLANE ## plane_idx ## _MODIFIER_HI_EXT; \ +@@ -1008,7 +1012,7 @@ dmabuf_modifiers(void *data, struct zwp_linux_dmabuf_v1 *zwp_linux_dmabuf, + + d->format_supported = true; + +- if (modifier != DRM_FORMAT_MOD_INVALID) { ++ if (DRM_MOD_VALID(modifier)) { + ++d->modifiers_count; + d->modifiers = realloc(d->modifiers, + d->modifiers_count * sizeof(*d->modifiers)); +diff --git a/libweston/backend-drm/drm-gbm.c b/libweston/backend-drm/drm-gbm.c +index d7bd05f..ecc7a5f 100644 +--- a/libweston/backend-drm/drm-gbm.c ++++ b/libweston/backend-drm/drm-gbm.c +@@ -196,7 +196,8 @@ create_gbm_surface(struct gbm_device *gbm, struct drm_output *output) + } + + #ifdef HAVE_GBM_MODIFIERS +- if (!weston_drm_format_has_modifier(fmt, DRM_FORMAT_MOD_INVALID)) { ++ if (!weston_drm_format_has_modifier(fmt, DRM_FORMAT_MOD_INVALID) && ++ !weston_drm_format_has_modifier(fmt, DRM_FORMAT_MOD_LINEAR)) { + modifiers = weston_drm_format_get_modifiers(fmt, &num_modifiers); + output->gbm_surface = + gbm_surface_create_with_modifiers(gbm, +diff --git a/libweston/backend-drm/drm-virtual.c b/libweston/backend-drm/drm-virtual.c +index 597e71c..20f6809 100644 +--- a/libweston/backend-drm/drm-virtual.c ++++ b/libweston/backend-drm/drm-virtual.c +@@ -112,13 +112,7 @@ drm_virtual_plane_create(struct drm_backend *b, struct drm_output *output) + if (!fmt) + goto err; + +- /* If output supports linear modifier, we add it to the plane. +- * Otherwise we add DRM_FORMAT_MOD_INVALID, as explicit modifiers +- * are not supported. */ +- if ((output->gbm_bo_flags & GBM_BO_USE_LINEAR) && b->fb_modifiers) +- mod = DRM_FORMAT_MOD_LINEAR; +- else +- mod = DRM_FORMAT_MOD_INVALID; ++ mod = DRM_FORMAT_MOD_LINEAR; + + if (weston_drm_format_add_modifier(fmt, mod) < 0) + goto err; +diff --git a/libweston/backend-drm/fb.c b/libweston/backend-drm/fb.c +index ba0c177..af31a8a 100644 +--- a/libweston/backend-drm/fb.c ++++ b/libweston/backend-drm/fb.c +@@ -77,7 +77,7 @@ drm_fb_addfb(struct drm_backend *b, struct drm_fb *fb) + + /* If we have a modifier set, we must only use the WithModifiers + * entrypoint; we cannot import it through legacy ioctls. */ +- if (b->fb_modifiers && fb->modifier != DRM_FORMAT_MOD_INVALID) { ++ if (b->fb_modifiers && DRM_MOD_VALID(fb->modifier)) { + /* KMS demands that if a modifier is set, it must be the same + * for all planes. */ + for (i = 0; i < ARRAY_LENGTH(mods) && fb->handles[i]; i++) +@@ -150,7 +150,7 @@ drm_fb_create_dumb(struct drm_backend *b, int width, int height, + goto err_fb; + + fb->type = BUFFER_PIXMAN_DUMB; +- fb->modifier = DRM_FORMAT_MOD_INVALID; ++ fb->modifier = DRM_FORMAT_MOD_LINEAR; + fb->handles[0] = create_arg.handle; + fb->strides[0] = create_arg.pitch; + fb->num_planes = 1; +@@ -237,6 +237,7 @@ drm_fb_get_from_dmabuf(struct linux_dmabuf_buffer *dmabuf, + .modifier = dmabuf->attributes.modifier[0], + }; + ++#if 0 + /* We should not import to KMS a buffer that has been allocated using no + * modifiers. Usually drivers use linear layouts to allocate with no + * modifiers, but this is not a rule. The driver could use, for +@@ -250,6 +251,7 @@ drm_fb_get_from_dmabuf(struct linux_dmabuf_buffer *dmabuf, + FAILURE_REASONS_DMABUF_MODIFIER_INVALID; + return NULL; + } ++#endif + + /* XXX: TODO: + * +@@ -375,7 +377,7 @@ drm_fb_get_from_bo(struct gbm_bo *bo, struct drm_backend *backend, + fb->num_planes = 1; + fb->strides[0] = gbm_bo_get_stride(bo); + fb->handles[0] = gbm_bo_get_handle(bo).u32; +- fb->modifier = DRM_FORMAT_MOD_INVALID; ++ fb->modifier = DRM_FORMAT_MOD_LINEAR; + #endif + + if (!fb->format) { +@@ -482,7 +484,7 @@ drm_fb_compatible_with_plane(struct drm_fb *fb, struct drm_plane *plane) + * wl_drm is being used for scanout. Mesa is the only user we + * care in this case (even though recent versions are also using + * dmabufs), and it should know better what works or not. */ +- if (fb->modifier == DRM_FORMAT_MOD_INVALID) ++ if (!DRM_MOD_VALID(fb->modifier)) + return true; + + if (weston_drm_format_has_modifier(fmt, fb->modifier)) +diff --git a/libweston/backend-drm/kms.c b/libweston/backend-drm/kms.c +index 1fcbdeb..4b5ba42 100644 +--- a/libweston/backend-drm/kms.c ++++ b/libweston/backend-drm/kms.c +@@ -542,7 +542,7 @@ fallback: + kplane->formats[i]); + if (!fmt) + return -1; +- ret = weston_drm_format_add_modifier(fmt, DRM_FORMAT_MOD_INVALID); ++ ret = weston_drm_format_add_modifier(fmt, DRM_FORMAT_MOD_LINEAR); + if (ret < 0) + return -1; + } +diff --git a/libweston/linux-dmabuf.h b/libweston/linux-dmabuf.h +index 7cae93c..cfbdc28 100644 +--- a/libweston/linux-dmabuf.h ++++ b/libweston/linux-dmabuf.h +@@ -31,6 +31,10 @@ + + #define MAX_DMABUF_PLANES 4 + ++/* modifier is not linear or invalid */ ++#define DRM_MOD_VALID(mod) \ ++ ((mod) != DRM_FORMAT_MOD_LINEAR && (mod) != DRM_FORMAT_MOD_INVALID) ++ + struct linux_dmabuf_buffer; + typedef void (*dmabuf_user_data_destroy_func)( + struct linux_dmabuf_buffer *buffer); +diff --git a/libweston/pixman-renderer.c b/libweston/pixman-renderer.c +index ece4d91..b245fd6 100644 +--- a/libweston/pixman-renderer.c ++++ b/libweston/pixman-renderer.c +@@ -701,7 +701,7 @@ pixman_renderer_prepare_dmabuf(struct linux_dmabuf_buffer *dmabuf) + total_size = lseek(attributes->fd[0], 0, SEEK_END); + + for (i = 0; i < attributes->n_planes; i++) { +- if (attributes->modifier[i] != DRM_FORMAT_MOD_INVALID) ++ if (DRM_MOD_VALID(attributes->modifier[i])) + return false; + } + +@@ -1197,7 +1197,7 @@ populate_supported_formats(struct weston_compositor *ec, + + /* Always add DRM_FORMAT_MOD_INVALID, as EGL implementations + * support implicit modifiers. */ +- ret = weston_drm_format_add_modifier(fmt, DRM_FORMAT_MOD_INVALID); ++ ret = weston_drm_format_add_modifier(fmt, DRM_FORMAT_MOD_LINEAR); + if (ret < 0) + goto out; + } +diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c +index 3c60f85..f891478 100644 +--- a/libweston/renderer-gl/gl-renderer.c ++++ b/libweston/renderer-gl/gl-renderer.c +@@ -2359,7 +2359,7 @@ import_simple_dmabuf(struct gl_renderer *gr, + attribs[atti++] = EGL_YUV_NARROW_RANGE_EXT; + } + +- if (attributes->modifier[0] != DRM_FORMAT_MOD_INVALID) { ++ if (DRM_MOD_VALID(attributes->modifier[0])) { + if (!gr->has_dmabuf_import_modifiers) + return NULL; + has_modifier = true; +@@ -2871,7 +2871,7 @@ gl_renderer_import_dmabuf(struct weston_compositor *ec, + + for (i = 0; i < dmabuf->attributes.n_planes; i++) { + /* return if EGL doesn't support import modifiers */ +- if (dmabuf->attributes.modifier[i] != DRM_FORMAT_MOD_INVALID) ++ if (DRM_MOD_VALID(dmabuf->attributes.modifier[i])) + if (!gr->has_dmabuf_import_modifiers) + return false; + +@@ -3016,7 +3016,7 @@ populate_supported_formats(struct weston_compositor *ec, + + /* Always add DRM_FORMAT_MOD_INVALID, as EGL implementations + * support implicit modifiers. */ +- ret = weston_drm_format_add_modifier(fmt, DRM_FORMAT_MOD_INVALID); ++ ret = weston_drm_format_add_modifier(fmt, DRM_FORMAT_MOD_LINEAR); + if (ret < 0) + goto out; + +@@ -3027,7 +3027,7 @@ populate_supported_formats(struct weston_compositor *ec, + + for (j = 0; j < num_modifiers; j++) { + /* Skip MOD_INVALID, as it has already been added. */ +- if (modifiers[j] == DRM_FORMAT_MOD_INVALID) ++ if (!DRM_MOD_VALID(modifiers[j])) + continue; + ret = weston_drm_format_add_modifier(fmt, modifiers[j]); + if (ret < 0) { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0028-backend-drm-Add-dummy-output-when-no-screens-connect.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0028-backend-drm-Add-dummy-output-when-no-screens-connect.patch new file mode 100644 index 0000000000000000000000000000000000000000..d8f20722ff9bb98695674b9095d44396dc83ea15 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0028-backend-drm-Add-dummy-output-when-no-screens-connect.patch @@ -0,0 +1,377 @@ +From 54619af12a927bbef47382587f977e8ca6062625 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 12 Nov 2020 16:59:50 +0800 +Subject: [PATCH 28/79] backend-drm: Add dummy output when no screens connected + +Some clients are not expecting no screens, add a dummy output for them. + +Signed-off-by: Jeffy Chen +--- + compositor/main.c | 3 + + desktop-shell/shell.c | 7 +- + libweston/backend-drm/drm-internal.h | 3 + + libweston/backend-drm/drm.c | 203 ++++++++++++++++++++++++++- + libweston/backend-drm/kms.c | 3 + + libweston/compositor.c | 3 + + 6 files changed, 216 insertions(+), 6 deletions(-) + +diff --git a/compositor/main.c b/compositor/main.c +index 128016b..3824404 100644 +--- a/compositor/main.c ++++ b/compositor/main.c +@@ -2337,6 +2337,9 @@ drm_heads_changed(struct wl_listener *listener, void *arg) + * output. + */ + while ((head = weston_compositor_iterate_heads(compositor, head))) { ++ if (!strcasecmp(weston_head_get_name(head), "dummy")) ++ continue; ++ + drm_head_update_output_section(head); + + connected = weston_head_is_connected(head); +diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c +index 4cb29dd..a8b8f35 100644 +--- a/desktop-shell/shell.c ++++ b/desktop-shell/shell.c +@@ -4820,10 +4820,6 @@ shell_reposition_view_on_output_change(struct weston_view *view) + shsurf = get_shell_surface(view->surface); + if (!shsurf) + return; +- +- shsurf->saved_position_valid = false; +- set_maximized(shsurf, false); +- set_fullscreen(shsurf, false, NULL); + } + + void +@@ -4955,6 +4951,9 @@ handle_output_resized(struct wl_listener *listener, void *data) + struct weston_output *output = (struct weston_output *)data; + struct shell_output *sh_output = find_shell_output_from_weston_output(shell, output); + ++ if (!sh_output) ++ return; ++ + if (shell->lock_surface) + shell->lock_surface->committed(shell->lock_surface, 0, 0); + +diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h +index 9d24017..67e6dd2 100644 +--- a/libweston/backend-drm/drm-internal.h ++++ b/libweston/backend-drm/drm-internal.h +@@ -354,6 +354,9 @@ struct drm_backend { + + struct wl_event_source *config_timer; + struct stat config_stat; ++ ++ struct weston_output *dummy_output; ++ struct drm_head *dummy_head; + }; + + struct drm_mode { +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index 53a3d49..e829d77 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -210,8 +210,14 @@ drm_backend_update_outputs(struct drm_backend *b) + { + struct weston_output *base, *primary; + +- if (!b->primary_head) ++ if (!b->primary_head) { ++ if (!b->dummy_output->enabled) ++ weston_output_enable(b->dummy_output); + return; ++ } else { ++ if (b->dummy_output->enabled) ++ weston_output_disable(b->dummy_output); ++ } + + primary = b->primary_head->base.output; + +@@ -1245,7 +1251,7 @@ drm_output_find_special_plane(struct drm_backend *b, struct drm_output *output, + num_primary - 1 != output->crtc->pipe) + continue; + +- if (plane->type != type) ++ if (!plane->plane_id || plane->type != type) + continue; + if (!drm_plane_is_available(plane, output)) + continue; +@@ -2591,11 +2597,15 @@ drm_head_destroy(struct drm_head *head) + { + weston_head_release(&head->base); + ++ if (!head->connector.connector_id) ++ goto out; ++ + drm_connector_fini(&head->connector); + + if (head->backlight) + backlight_destroy(head->backlight); + ++out: + free(head); + } + +@@ -2827,6 +2837,9 @@ drm_backend_update_connectors(struct drm_backend *b, struct udev_device *drm_dev + wl_list_for_each_safe(base, base_next, + &b->compositor->head_list, compositor_link) { + head = to_drm_head(base); ++ if (!head->connector.connector_id) ++ continue; ++ + connector_id = head->connector.connector_id; + + if (resources_has_connector(resources, connector_id)) +@@ -2871,6 +2884,9 @@ drm_backend_update_connectors(struct drm_backend *b, struct udev_device *drm_dev + continue; + + head = to_drm_head(base); ++ if (!head->connector.connector_id) ++ continue; ++ + conn = head->connector.conn; + + if (conn->connection != DRM_MODE_CONNECTED || +@@ -2900,6 +2916,8 @@ drm_backend_update_connectors(struct drm_backend *b, struct udev_device *drm_dev + } + match_done: + ++ weston_head_set_connection_status(&b->dummy_head->base, ++ !b->primary_head); + drm_backend_update_outputs(b); + + weston_compositor_read_presentation_clock(b->compositor, &now); +@@ -3072,6 +3090,8 @@ drm_destroy(struct weston_compositor *ec) + struct drm_crtc *crtc, *crtc_tmp; + struct drm_writeback *writeback, *writeback_tmp; + ++ weston_output_destroy(b->dummy_output); ++ + udev_input_destroy(&b->input); + + wl_event_source_remove(b->config_timer); +@@ -3776,6 +3796,180 @@ config_timer_handler(void *data) + return 0; + } + ++static int ++drm_dummy_output_start_repaint_loop(struct weston_output *output_base) ++{ ++ weston_output_finish_frame(output_base, NULL, ++ WP_PRESENTATION_FEEDBACK_INVALID); ++ ++ return 0; ++} ++ ++static int ++drm_dummy_output_repaint(struct weston_output *output_base, ++ pixman_region32_t *damage, ++ void *repaint_data) ++{ ++ struct drm_backend *b = to_drm_backend(output_base->compositor); ++ ++ wl_signal_emit(&output_base->frame_signal, damage); ++ ++ if (b->use_pixman) ++ return -1; ++ ++ /* Switch GL output context to avoid corruption */ ++ output_base->compositor->renderer->repaint_output(output_base, damage); ++ return -1; ++} ++ ++static int ++drm_dummy_output_enable(struct weston_output *output_base) ++{ ++ struct drm_backend *b = to_drm_backend(output_base->compositor); ++ struct drm_output *output = to_drm_output(output_base); ++ ++ if (b->use_pixman) ++ return 0; ++ ++ return drm_output_init_egl(output, b); ++} ++ ++static int ++drm_dummy_output_disable(struct weston_output *output_base) ++{ ++ struct drm_backend *b = to_drm_backend(output_base->compositor); ++ struct drm_output *output = to_drm_output(output_base); ++ ++ if (!b->use_pixman) ++ drm_output_fini_egl(output); ++ ++ return 0; ++} ++ ++static void ++drm_dummy_output_destroy(struct weston_output *output_base) ++{ ++ struct drm_output *output = to_drm_output(output_base); ++ struct drm_plane *plane = output->scanout_plane; ++ struct weston_mode *mode, *next; ++ ++ if (output->base.enabled) ++ drm_dummy_output_disable(&output->base); ++ ++ wl_list_for_each_safe(mode, next, &output_base->mode_list, link) { ++ wl_list_remove(&mode->link); ++ free(mode); ++ } ++ ++ drm_plane_state_free(plane->state_cur, true); ++ weston_plane_release(&plane->base); ++ wl_list_remove(&plane->link); ++ weston_drm_format_array_fini(&plane->formats); ++ free(plane); ++ ++ weston_output_release(output_base); ++ free(output); ++} ++ ++static struct weston_output * ++drm_dummy_output_create(struct drm_backend *b) ++{ ++ struct drm_output *output; ++ struct drm_plane *plane; ++ struct weston_drm_format *fmt; ++ ++ output = zalloc(sizeof *output); ++ if (!output) ++ return NULL; ++ ++ weston_output_init(&output->base, b->compositor, "DUMMY"); ++ ++ output->base.enable = drm_dummy_output_enable; ++ output->base.destroy = drm_dummy_output_destroy; ++ output->base.disable = drm_dummy_output_disable; ++ ++ output->base.start_repaint_loop = drm_dummy_output_start_repaint_loop; ++ output->base.repaint = drm_dummy_output_repaint; ++ output->base.set_dpms = NULL; ++ output->base.switch_mode = NULL; ++ output->base.gamma_size = 0; ++ output->base.set_gamma = NULL; ++ output->base.unavailable = true; ++ ++ weston_compositor_add_pending_output(&output->base, b->compositor); ++ ++#ifdef BUILD_DRM_GBM ++ output->gbm_bo_flags = GBM_BO_USE_LINEAR | GBM_BO_USE_RENDERING; ++ output->gbm_format = DRM_FORMAT_XRGB8888; ++#endif ++ ++ plane = zalloc(sizeof(*plane)); ++ if (!plane) { ++ weston_output_release(&output->base); ++ free(output); ++ return NULL; ++ } ++ ++ plane->type = WDRM_PLANE_TYPE_PRIMARY; ++ plane->backend = b; ++ plane->state_cur = drm_plane_state_alloc(NULL, plane); ++ plane->state_cur->complete = true; ++ ++ weston_drm_format_array_init(&plane->formats); ++ fmt = weston_drm_format_array_add_format(&plane->formats, ++ output->gbm_format); ++ weston_drm_format_add_modifier(fmt, DRM_FORMAT_MOD_LINEAR); ++ ++ weston_plane_init(&plane->base, b->compositor, 0, 0); ++ wl_list_insert(&b->plane_list, &plane->link); ++ ++ output->scanout_plane = plane; ++ ++ return &output->base; ++} ++ ++static int drm_backend_init_dummy(struct drm_backend *b) ++{ ++ struct weston_mode *mode; ++ ++ b->dummy_output = drm_dummy_output_create(b); ++ if (!b->dummy_output) ++ return -1; ++ ++ mode = zalloc(sizeof *mode); ++ if (!mode) ++ goto err; ++ ++ mode->flags = WL_OUTPUT_MODE_CURRENT; ++ mode->width = 1920; ++ mode->height = 1080; ++ mode->refresh = 60 * 1000LL; ++ ++ wl_list_insert(b->dummy_output->mode_list.prev, &mode->link); ++ ++ b->dummy_output->current_mode = mode; ++ ++ weston_output_set_scale(b->dummy_output, 1); ++ weston_output_set_transform(b->dummy_output, ++ WL_OUTPUT_TRANSFORM_NORMAL); ++ ++ b->dummy_head = zalloc(sizeof *b->dummy_head); ++ if (!b->dummy_head) ++ goto err; ++ ++ weston_head_init(&b->dummy_head->base, "DUMMY"); ++ weston_head_set_monitor_strings(&b->dummy_head->base, ++ "DUMMY", "DUMMY", "DUMMY"); ++ weston_compositor_add_head(b->compositor, &b->dummy_head->base); ++ weston_output_attach_head(b->dummy_output, &b->dummy_head->base); ++ ++ return 0; ++err: ++ drm_dummy_output_destroy(b->dummy_output); ++ b->dummy_output = NULL; ++ return -1; ++} ++ + enum drm_head_mode { + DRM_HEAD_MODE_DEFAULT, + DRM_HEAD_MODE_PRIMARY, +@@ -4007,6 +4201,11 @@ drm_backend_create(struct weston_compositor *compositor, + goto err_sprite; + } + ++ if (drm_backend_init_dummy(b) < 0) { ++ weston_log("Failed to init dummy output\n"); ++ goto err_udev_input; ++ } ++ + wl_list_init(&b->writeback_connector_list); + if (drm_backend_update_connectors(b, drm_device) < 0) { + weston_log("Failed to create heads for %s\n", b->drm.filename); +diff --git a/libweston/backend-drm/kms.c b/libweston/backend-drm/kms.c +index 4b5ba42..a3c55bd 100644 +--- a/libweston/backend-drm/kms.c ++++ b/libweston/backend-drm/kms.c +@@ -1170,6 +1170,9 @@ drm_pending_state_apply_atomic(struct drm_pending_state *pending_state, + continue; + + head = to_drm_head(head_base); ++ if (head == b->dummy_head) ++ continue; ++ + connector_id = head->connector.connector_id; + + drm_debug(b, "\t\t[atomic] disabling inactive head %s\n", +diff --git a/libweston/compositor.c b/libweston/compositor.c +index 121871c..67766df 100644 +--- a/libweston/compositor.c ++++ b/libweston/compositor.c +@@ -6436,6 +6436,9 @@ weston_output_set_color_transforms(struct weston_output *output) + struct weston_color_transform *sRGB_to_blend = NULL; + bool ok; + ++ if (!cm) ++ return false; ++ + ok = cm->get_output_color_transform(cm, output, &blend_to_output); + ok = ok && cm->get_sRGB_to_output_color_transform(cm, output, + &sRGB_to_output); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0029-libweston-animation-Fix-double-destroy.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0029-libweston-animation-Fix-double-destroy.patch new file mode 100644 index 0000000000000000000000000000000000000000..896ceb6df173592fb49274e5d572af77e1cc5c0a --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0029-libweston-animation-Fix-double-destroy.patch @@ -0,0 +1,50 @@ +From 4744081f6a23e934097a8ce3a19dc80bc909a76e Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 9 Oct 2020 18:00:11 +0800 +Subject: [PATCH 29/79] libweston: animation: Fix double-destroy + +Signed-off-by: Jeffy Chen +--- + libweston/animation.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/libweston/animation.c b/libweston/animation.c +index f11754c..b228558 100644 +--- a/libweston/animation.c ++++ b/libweston/animation.c +@@ -136,6 +136,7 @@ struct weston_view_animation { + weston_view_animation_frame_func_t frame; + weston_view_animation_frame_func_t reset; + weston_view_animation_done_func_t done; ++ struct wl_event_source *idle_destroy_source; + void *data; + void *private; + }; +@@ -143,6 +144,9 @@ struct weston_view_animation { + WL_EXPORT void + weston_view_animation_destroy(struct weston_view_animation *animation) + { ++ if (animation->idle_destroy_source) ++ wl_event_source_remove(animation->idle_destroy_source); ++ + wl_list_remove(&animation->animation.link); + wl_list_remove(&animation->listener.link); + wl_list_remove(&animation->transform.link); +@@ -248,10 +252,13 @@ weston_view_animation_create(struct weston_view *view, + if (view->output) { + wl_list_insert(&view->output->animation_list, + &animation->animation.link); ++ animation->idle_destroy_source = NULL; + } else { + wl_list_init(&animation->animation.link); + loop = wl_display_get_event_loop(ec->wl_display); +- wl_event_loop_add_idle(loop, idle_animation_destroy, animation); ++ animation->idle_destroy_source = ++ wl_event_loop_add_idle(loop, idle_animation_destroy, ++ animation); + } + + return animation; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0030-compositor-Force-the-first-app-on-bottom-in-warm-up-.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0030-compositor-Force-the-first-app-on-bottom-in-warm-up-.patch new file mode 100644 index 0000000000000000000000000000000000000000..27d276f12eded9afb29ef3b67c1b4ecdecd06d1a --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0030-compositor-Force-the-first-app-on-bottom-in-warm-up-.patch @@ -0,0 +1,46 @@ +From 86a1eecf27d4bdb253eaa233868667c6a97ef215 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 15 Oct 2020 12:43:00 +0800 +Subject: [PATCH 30/79] compositor: Force the first app on bottom in warm-up + mode + +When warm-up enabled, assume the first app is a launcher and put it on +the bottom layer. + +Signed-off-by: Jeffy Chen +--- + compositor/main.c | 3 +++ + libweston/compositor.c | 3 +++ + 2 files changed, 6 insertions(+) + +diff --git a/compositor/main.c b/compositor/main.c +index 3824404..2010c02 100644 +--- a/compositor/main.c ++++ b/compositor/main.c +@@ -3532,6 +3532,9 @@ wet_main(int argc, char *argv[], const struct weston_testsuite_data *test_data) + if (idle_time < 0) + idle_time = 300; /* default idle timeout, in seconds */ + ++ if (!warm_up) ++ weston_config_section_get_bool(section, "warm-up", &warm_up, false); ++ + wet.compositor->idle_time = idle_time; + wet.compositor->default_pointer_grab = NULL; + wet.compositor->exit = handle_exit; +diff --git a/libweston/compositor.c b/libweston/compositor.c +index 67766df..af69ab3 100644 +--- a/libweston/compositor.c ++++ b/libweston/compositor.c +@@ -2903,6 +2903,9 @@ weston_compositor_build_view_list(struct weston_compositor *compositor, + if (compositor->warm_up && !system_layer) { + weston_log("seeing the first app\n"); + compositor->warm_up = false; ++ ++ /* Assuming it's a launcher */ ++ view->surface->flags |= SURFACE_STAY_ON_BOTTOM; + } + + view_list_add(compositor, view, output); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0031-touch-calibrator-Ignore-verify-errors.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0031-touch-calibrator-Ignore-verify-errors.patch new file mode 100644 index 0000000000000000000000000000000000000000..1ce5f1ad8b773976049a6c4b88f68395ede8dd94 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0031-touch-calibrator-Ignore-verify-errors.patch @@ -0,0 +1,29 @@ +From 86a154394255a6b256a0eb36dbf2030313d712ba Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 16 Oct 2020 12:19:44 +0800 +Subject: [PATCH 31/79] touch-calibrator: Ignore verify errors + +Print warnings instead, this is useful when emulating a small screen. + +Signed-off-by: Jeffy Chen +--- + clients/touch-calibrator.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/clients/touch-calibrator.c b/clients/touch-calibrator.c +index 04a966b..815b89a 100644 +--- a/clients/touch-calibrator.c ++++ b/clients/touch-calibrator.c +@@ -854,7 +854,8 @@ calibrator_run(struct calibrator *cal) + return CAL_EXIT_ERROR; + + if (verify_calibration(cal, result) < 0) +- return CAL_EXIT_ERROR; ++ //return CAL_EXIT_ERROR; ++ pr_ver("Ignoring verify errors.\n"); + + pr_ver("Calibration values:"); + for (i = 0; i < 6; i++) +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0032-HACK-xdg-shell-Don-t-abort-when-client-size-mismatch.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0032-HACK-xdg-shell-Don-t-abort-when-client-size-mismatch.patch new file mode 100644 index 0000000000000000000000000000000000000000..268a4c38b2a3f3580181083dc73a0dbbf685f519 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0032-HACK-xdg-shell-Don-t-abort-when-client-size-mismatch.patch @@ -0,0 +1,71 @@ +From a0546b5268ad815cb71157afaaf924f12d73e617 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 19 Oct 2020 18:13:23 +0800 +Subject: [PATCH 32/79] HACK: xdg-shell: Don't abort when client size + mismatched + +There's a race in qtwayland might causing size mismatch, let's +workaround it here for now. + +Signed-off-by: Jeffy Chen +--- + libweston-desktop/xdg-shell.c | 38 +++++++++++------------------------ + 1 file changed, 12 insertions(+), 26 deletions(-) + +diff --git a/libweston-desktop/xdg-shell.c b/libweston-desktop/xdg-shell.c +index a0161f6..f375e3a 100644 +--- a/libweston-desktop/xdg-shell.c ++++ b/libweston-desktop/xdg-shell.c +@@ -706,37 +706,23 @@ weston_desktop_xdg_toplevel_committed(struct weston_desktop_xdg_toplevel *toplev + if (toplevel->next.state.maximized && + (toplevel->next.size.width != geometry.width || + toplevel->next.size.height != geometry.height)) { +- struct weston_desktop_client *client = +- weston_desktop_surface_get_client(toplevel->base.desktop_surface); +- struct wl_resource *client_resource = +- weston_desktop_client_get_resource(client); +- +- wl_resource_post_error(client_resource, +- XDG_WM_BASE_ERROR_INVALID_SURFACE_STATE, +- "xdg_surface geometry (%" PRIi32 " x %" PRIi32 ") " +- "does not match the configured maximized state (%" PRIi32 " x %" PRIi32 ")", +- geometry.width, geometry.height, +- toplevel->next.size.width, +- toplevel->next.size.height); +- return; ++ weston_desktop_xdg_surface_schedule_configure(&toplevel->base); ++ weston_log("xdg_surface buffer (%" PRIi32 " x %" PRIi32 ") " ++ "does not match the configured maximized state (%" PRIi32 " x %" PRIi32 ")", ++ geometry.width, geometry.height, ++ toplevel->next.size.width, ++ toplevel->next.size.height); + } + + if (toplevel->next.state.fullscreen && + (toplevel->next.size.width < geometry.width || + toplevel->next.size.height < geometry.height)) { +- struct weston_desktop_client *client = +- weston_desktop_surface_get_client(toplevel->base.desktop_surface); +- struct wl_resource *client_resource = +- weston_desktop_client_get_resource(client); +- +- wl_resource_post_error(client_resource, +- XDG_WM_BASE_ERROR_INVALID_SURFACE_STATE, +- "xdg_surface geometry (%" PRIi32 " x %" PRIi32 ") " +- "is larger than the configured fullscreen state (%" PRIi32 " x %" PRIi32 ")", +- geometry.width, geometry.height, +- toplevel->next.size.width, +- toplevel->next.size.height); +- return; ++ weston_desktop_xdg_surface_schedule_configure(&toplevel->base); ++ weston_log("xdg_surface geometry (%" PRIi32 " x %" PRIi32 ") " ++ "is larger than the configured fullscreen state (%" PRIi32 " x %" PRIi32 ")", ++ geometry.width, geometry.height, ++ toplevel->next.size.width, ++ toplevel->next.size.height); + } + + toplevel->current.state = toplevel->next.state; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0033-backend-drm-Support-setting-interlaced-mode.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0033-backend-drm-Support-setting-interlaced-mode.patch new file mode 100644 index 0000000000000000000000000000000000000000..4f7b22c4bab13868546c0e698ea300eeed1f61ee --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0033-backend-drm-Support-setting-interlaced-mode.patch @@ -0,0 +1,107 @@ +From 7e43521bb942516f810dde29745ba9f8360708e0 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 21 Oct 2020 15:27:38 +0800 +Subject: [PATCH 33/79] backend-drm: Support setting interlaced mode + +Tested with: +echo "output:HDMI-A-1:mode=1920x1080i" > /tmp/.weston_drm.conf +> Output HDMI-A-1 changed to 1920x1080i@60 for mode(1920x1080i) + +Signed-off-by: Jeffy Chen +--- + libweston/backend-drm/drm.c | 4 ++-- + libweston/backend-drm/modes.c | 24 ++++++++++++++---------- + 2 files changed, 16 insertions(+), 12 deletions(-) + +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index e829d77..3667b8d 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -3575,9 +3575,9 @@ drm_output_modeset(struct drm_output *output, const char *modeline) + + mode = to_drm_mode(output->base.current_mode); + +- weston_log("Output %s changed to %dx%d@%d for mode(%s)\n", ++ weston_log("Output %s changed to %s@%d for mode(%s)\n", + output->base.name, +- mode->mode_info.hdisplay, mode->mode_info.vdisplay, ++ mode->mode_info.name, + mode->mode_info.vrefresh, + modeline); + +diff --git a/libweston/backend-drm/modes.c b/libweston/backend-drm/modes.c +index ff7421d..25f61b8 100644 +--- a/libweston/backend-drm/modes.c ++++ b/libweston/backend-drm/modes.c +@@ -450,9 +450,8 @@ drm_output_print_modes(struct drm_output *output) + dm = to_drm_mode(m); + + aspect_ratio = aspect_ratio_to_string(m->aspect_ratio); +- weston_log_continue(STAMP_SPACE "%dx%d@%.1f%s%s%s, %.1f MHz\n", +- dm->mode_info.hdisplay, +- dm->mode_info.vdisplay, ++ weston_log_continue(STAMP_SPACE "%s@%.1f%s%s%s, %.1f MHz\n", ++ dm->mode_info.name, + m->refresh / 1000.0, + aspect_ratio, + m->flags & WL_OUTPUT_MODE_PREFERRED ? +@@ -495,11 +494,14 @@ drm_output_choose_mode(struct drm_output *output, + enum weston_mode_aspect_ratio target_aspect = WESTON_MODE_PIC_AR_NONE; + struct drm_backend *b; + ++#define WESTON_MODE_NAME(mode) \ ++ to_drm_mode(mode)->mode_info.name ++ + b = to_drm_backend(output->base.compositor); + target_aspect = target_mode->aspect_ratio; + src_aspect = output->base.current_mode->aspect_ratio; +- if (output->base.current_mode->width == target_mode->width && +- output->base.current_mode->height == target_mode->height && ++ if (!strcmp(WESTON_MODE_NAME(output->base.current_mode), ++ WESTON_MODE_NAME(target_mode)) && + (output->base.current_mode->refresh == target_mode->refresh || + target_mode->refresh == 0)) { + if (!b->aspect_ratio_supported || src_aspect == target_aspect) +@@ -509,8 +511,8 @@ drm_output_choose_mode(struct drm_output *output, + wl_list_for_each(mode, &output->base.mode_list, base.link) { + + src_aspect = mode->base.aspect_ratio; +- if (mode->mode_info.hdisplay == target_mode->width && +- mode->mode_info.vdisplay == target_mode->height) { ++ if (!strcmp(mode->mode_info.name, ++ WESTON_MODE_NAME(target_mode))) { + if (mode->base.refresh == target_mode->refresh || + target_mode->refresh == 0) { + if (!b->aspect_ratio_supported || +@@ -584,6 +586,7 @@ drm_output_choose_initial_mode(struct drm_backend *backend, + struct drm_mode *best = NULL; + struct drm_mode *drm_mode; + drmModeModeInfo drm_modeline; ++ char name[16] = {0}; + int32_t width = 0; + int32_t height = 0; + uint32_t refresh = 0; +@@ -593,7 +596,9 @@ drm_output_choose_initial_mode(struct drm_backend *backend, + int n; + + if (mode == WESTON_DRM_BACKEND_OUTPUT_PREFERRED && modeline) { +- n = sscanf(modeline, "%dx%d@%d %u:%u", &width, &height, ++ sscanf(modeline, "%12[^@pP]", name); ++ ++ n = sscanf(modeline, "%dx%d%*[^0-9]%d %u:%u", &width, &height, + &refresh, &aspect_width, &aspect_height); + if (backend->aspect_ratio_supported && n == 5) { + if (aspect_width == 4 && aspect_height == 3) +@@ -623,8 +628,7 @@ drm_output_choose_initial_mode(struct drm_backend *backend, + } + + wl_list_for_each_reverse(drm_mode, &output->base.mode_list, base.link) { +- if (width == drm_mode->mode_info.hdisplay && +- height == drm_mode->mode_info.vdisplay && ++ if (!strcmp(name, drm_mode->mode_info.name) && + (refresh == 0 || refresh == drm_mode->mode_info.vrefresh)) { + if (!backend->aspect_ratio_supported || + aspect_ratio == drm_mode->base.aspect_ratio) +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0034-backend-drm-Support-using-ARGB8888-gbm_format.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0034-backend-drm-Support-using-ARGB8888-gbm_format.patch new file mode 100644 index 0000000000000000000000000000000000000000..da24b1a1eecb0ee6083e2407f1705d74e90711cb --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0034-backend-drm-Support-using-ARGB8888-gbm_format.patch @@ -0,0 +1,61 @@ +From d4c7770214227985ca61182ec5096b764bd1f1a8 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 23 Oct 2020 17:37:04 +0800 +Subject: [PATCH 34/79] backend-drm: Support using ARGB8888 gbm_format + +Tested with: +/etc/xdg/weston/weston.ini: +[core] +gbm-format=argb8888 + +Signed-off-by: Jeffy Chen +--- + libweston/backend-drm/drm-gbm.c | 8 ++++++-- + libweston/backend-drm/drm.c | 3 +++ + 2 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/libweston/backend-drm/drm-gbm.c b/libweston/backend-drm/drm-gbm.c +index ecc7a5f..bcc2b17 100644 +--- a/libweston/backend-drm/drm-gbm.c ++++ b/libweston/backend-drm/drm-gbm.c +@@ -282,8 +282,10 @@ drm_output_render_gl(struct drm_output_state *state, pixman_region32_t *damage) + { + struct drm_output *output = state->output; + struct drm_backend *b = to_drm_backend(output->base.compositor); ++ const struct pixel_format_info *format; + struct gbm_bo *bo; + struct drm_fb *ret; ++ bool is_opaque; + + output->base.compositor->renderer->repaint_output(&output->base, + damage); +@@ -295,8 +297,10 @@ drm_output_render_gl(struct drm_output_state *state, pixman_region32_t *damage) + return NULL; + } + +- /* The renderer always produces an opaque image. */ +- ret = drm_fb_get_from_bo(bo, b, true, BUFFER_GBM_SURFACE); ++ format = pixel_format_get_info(output->gbm_format); ++ is_opaque = format && pixel_format_is_opaque(format); ++ ++ ret = drm_fb_get_from_bo(bo, b, is_opaque, BUFFER_GBM_SURFACE); + if (!ret) { + weston_log("failed to get drm_fb for bo\n"); + gbm_surface_release_buffer(output->gbm_surface, bo); +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index 3667b8d..df9db5c 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -1554,6 +1554,9 @@ drm_output_init_pixman(struct drm_output *output, struct drm_backend *b) + }; + + switch (format) { ++ case DRM_FORMAT_ARGB8888: ++ pixman_format = PIXMAN_a8r8g8b8; ++ break; + case DRM_FORMAT_XRGB8888: + pixman_format = PIXMAN_x8r8g8b8; + break; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0035-pixman-renderer-Allow-disabling-egl-support.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0035-pixman-renderer-Allow-disabling-egl-support.patch new file mode 100644 index 0000000000000000000000000000000000000000..d850a12e2659d20b1db6609a0c34637ab81764e7 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0035-pixman-renderer-Allow-disabling-egl-support.patch @@ -0,0 +1,29 @@ +From f6357b23b9aa48451960cd8e1369dc500137f1e3 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 26 Oct 2020 16:05:51 +0800 +Subject: [PATCH 35/79] pixman-renderer: Allow disabling egl support + +Set env WESTON_PIXMAN_WITHOUT_EGL to disable egl support. + +Signed-off-by: Jeffy Chen +--- + libweston/pixman-renderer.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/libweston/pixman-renderer.c b/libweston/pixman-renderer.c +index b245fd6..c6d1cbb 100644 +--- a/libweston/pixman-renderer.c ++++ b/libweston/pixman-renderer.c +@@ -1354,7 +1354,8 @@ pixman_renderer_init(struct weston_compositor *ec) + pixman_renderer_get_supported_formats; + + #ifdef ENABLE_EGL +- pixman_renderer_init_egl(renderer, ec); ++ if (!getenv("WESTON_PIXMAN_WITHOUT_EGL")) ++ pixman_renderer_init_egl(renderer, ec); + #endif + + return 0; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0036-backend-drm-Allow-disabling-plane-scale.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0036-backend-drm-Allow-disabling-plane-scale.patch new file mode 100644 index 0000000000000000000000000000000000000000..9837091b4ce09ac70ae9439dd164dcce21204044 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0036-backend-drm-Allow-disabling-plane-scale.patch @@ -0,0 +1,29 @@ +From 827c18bcd116964554ee841fdf4aeda95d81f5a3 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 26 Oct 2020 16:23:27 +0800 +Subject: [PATCH 36/79] backend-drm: Allow disabling plane scale + +Set env WESTON_DRM_DISABLE_PLANE_SCALE to disable plane scale. + +Signed-off-by: Jeffy Chen +--- + libweston/backend-drm/drm.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index df9db5c..2b887eb 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -1181,6 +1181,9 @@ drm_plane_create(struct drm_backend *b, const drmModePlane *kplane) + props, + WDRM_PLANE_FEATURE_SCALE); + ++ if (getenv("WESTON_DRM_DISABLE_PLANE_SCALE")) ++ plane->can_scale = false; ++ + zpos_range_values = + drm_property_get_range_values(&plane->props[WDRM_PLANE_ZPOS], + props); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0037-HACK-backend-drm-Workaround-atomic-flip-for-BSP-4.4-.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0037-HACK-backend-drm-Workaround-atomic-flip-for-BSP-4.4-.patch new file mode 100644 index 0000000000000000000000000000000000000000..d83abc75bea5b6b04b9db17a70a3ac15a26f49da --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0037-HACK-backend-drm-Workaround-atomic-flip-for-BSP-4.4-.patch @@ -0,0 +1,34 @@ +From 7fc7a6264a02657b3623f1e591eb5effd76d5b02 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 26 Oct 2020 17:50:06 +0800 +Subject: [PATCH 37/79] HACK: backend-drm: Workaround atomic flip for BSP 4.4 + kernel + +The Rockchip BSP 4.4 kernel might generate unexpected flip events +when dpms changed. + +Signed-off-by: Jeffy Chen +--- + libweston/backend-drm/kms.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/libweston/backend-drm/kms.c b/libweston/backend-drm/kms.c +index a3c55bd..cf37773 100644 +--- a/libweston/backend-drm/kms.c ++++ b/libweston/backend-drm/kms.c +@@ -1502,7 +1502,11 @@ atomic_flip_handler(int fd, unsigned int frame, unsigned int sec, + + drm_debug(b, "[atomic][CRTC:%u] flip processing started\n", crtc_id); + assert(b->atomic_modeset); +- assert(output->atomic_complete_pending); ++ ++ /* HACK: Disable this check sink the Rockchip BSP 4.4 kernel might ++ * generate unexpected flip events when dpms changed. */ ++ //assert(output->atomic_complete_pending); ++ + output->atomic_complete_pending = false; + + drm_output_update_complete(output, flags, sec, usec); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0038-backend-drm-Fix-disabling-output-error-when-using-at.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0038-backend-drm-Fix-disabling-output-error-when-using-at.patch new file mode 100644 index 0000000000000000000000000000000000000000..7b0c45594d9ee815e7d728a76e8bd4012f2b396a --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0038-backend-drm-Fix-disabling-output-error-when-using-at.patch @@ -0,0 +1,45 @@ +From 62f978297547f0e632ce4f74df0d703c60785dc8 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 6 Jan 2021 10:13:40 +0800 +Subject: [PATCH 38/79] backend-drm: Fix disabling output error when using + atomic + +Disabling output in async mode is not allow by drm driver's +drm_atomic_crtc_check() for "requesting event but off" error. + +Signed-off-by: Jeffy Chen +--- + libweston/backend-drm/kms.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/libweston/backend-drm/kms.c b/libweston/backend-drm/kms.c +index cf37773..4443741 100644 +--- a/libweston/backend-drm/kms.c ++++ b/libweston/backend-drm/kms.c +@@ -1137,6 +1137,14 @@ drm_pending_state_apply_atomic(struct drm_pending_state *pending_state, + if (!req) + return -1; + ++ wl_list_for_each(output_state, &pending_state->output_list, link) { ++ if (output_state->output->virtual) ++ continue; ++ if (output_state->dpms == WESTON_DPMS_OFF && ++ mode == DRM_STATE_APPLY_ASYNC) ++ mode = DRM_STATE_APPLY_SYNC; ++ } ++ + switch (mode) { + case DRM_STATE_APPLY_SYNC: + flags = 0; +@@ -1238,8 +1246,6 @@ drm_pending_state_apply_atomic(struct drm_pending_state *pending_state, + wl_list_for_each(output_state, &pending_state->output_list, link) { + if (output_state->output->virtual) + continue; +- if (mode == DRM_STATE_APPLY_SYNC) +- assert(output_state->dpms == WESTON_DPMS_OFF); + ret |= drm_output_apply_state_atomic(output_state, req, &flags); + } + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0039-backend-drm-Support-modifier.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0039-backend-drm-Support-modifier.patch new file mode 100644 index 0000000000000000000000000000000000000000..9f15693d792beb296f97b0ef0ff4ee8b336ae3bd --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0039-backend-drm-Support-modifier.patch @@ -0,0 +1,240 @@ +From 4bee4b39fde94de80077778ad25fc744bdf0aa7a Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 6 Jan 2021 04:11:48 +0800 +Subject: [PATCH 39/79] backend-drm: Support modifier + +Tested on rk356x with ARM AFBC modifier. + +Signed-off-by: Jeffy Chen +--- + libweston/backend-drm/drm-internal.h | 1 + + libweston/backend-drm/drm.c | 84 ++++++++++++++++++++++++---- + libweston/backend-drm/kms.c | 6 +- + libweston/pixel-formats.c | 2 + + 4 files changed, 80 insertions(+), 13 deletions(-) + +diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h +index 67e6dd2..161c1ee 100644 +--- a/libweston/backend-drm/drm-internal.h ++++ b/libweston/backend-drm/drm-internal.h +@@ -528,6 +528,7 @@ struct drm_plane { + struct weston_drm_format_array formats; + + bool can_scale; ++ bool has_modifiers; + }; + + struct drm_connector { +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index 2b887eb..149ac01 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -1221,6 +1221,42 @@ err: + return NULL; + } + ++static inline bool ++drm_plane_has_modifier(struct drm_plane *plane, uint32_t format) ++{ ++ struct weston_drm_format *fmt; ++ const uint64_t *modifiers; ++ unsigned int num_modifiers, i; ++ ++ fmt = weston_drm_format_array_find_format(&plane->formats, format); ++ if (!fmt) ++ return false; ++ ++ modifiers = weston_drm_format_get_modifiers(fmt, &num_modifiers); ++ for (i = 0; i < num_modifiers; i++) { ++ if (DRM_MOD_VALID(modifiers[i])) ++ return true; ++ } ++ ++ return false; ++} ++ ++static inline bool ++drm_planes_have_modifier(struct drm_backend *b) ++{ ++ struct drm_plane *plane; ++ ++ if (!b->fb_modifiers) ++ return false; ++ ++ wl_list_for_each_reverse(plane, &b->plane_list, link) { ++ if (plane->has_modifiers) ++ return true; ++ } ++ ++ return false; ++} ++ + /** + * Find, or create, a special-purpose plane + * +@@ -1233,8 +1269,11 @@ drm_output_find_special_plane(struct drm_backend *b, struct drm_output *output, + enum wdrm_plane_type type) + { + struct drm_plane *plane; ++ bool prefer_modifier = ++ b->fb_modifiers && type == WDRM_PLANE_TYPE_PRIMARY; + int num_primary; + ++retry: + num_primary = 0; + wl_list_for_each_reverse(plane, &b->plane_list, link) { + struct drm_output *tmp; +@@ -1254,7 +1293,7 @@ drm_output_find_special_plane(struct drm_backend *b, struct drm_output *output, + num_primary - 1 != output->crtc->pipe) + continue; + +- if (!plane->plane_id || plane->type != type) ++ if (!plane->plane_id) + continue; + if (!drm_plane_is_available(plane, output)) + continue; +@@ -1273,10 +1312,22 @@ drm_output_find_special_plane(struct drm_backend *b, struct drm_output *output, + if (found_elsewhere) + continue; + ++ if (prefer_modifier && ++ !drm_plane_has_modifier(plane, output->gbm_format)) ++ continue; ++ ++ if (plane->type != type) ++ continue; ++ + plane->possible_crtcs = (1 << output->crtc->pipe); + return plane; + } + ++ if (prefer_modifier) { ++ prefer_modifier = false; ++ goto retry; ++ } ++ + return NULL; + } + +@@ -4127,9 +4178,6 @@ drm_backend_create(struct weston_compositor *compositor, + + compositor->backend = &b->base; + +- if (parse_gbm_format(config->gbm_format, DRM_FORMAT_XRGB8888, &b->gbm_format) < 0) +- goto err_compositor; +- + /* Check if we run drm-backend using weston-launch */ + compositor->launcher = weston_launcher_connect(compositor, config->tty, + seat_id, true); +@@ -4163,15 +4211,30 @@ drm_backend_create(struct weston_compositor *compositor, + goto err_udev_dev; + } + ++ wl_list_init(&b->plane_list); ++ create_sprites(b); ++ ++ if (!drm_planes_have_modifier(b)) ++ b->fb_modifiers = false; ++ ++ b->gbm_format = DRM_FORMAT_XRGB8888; ++ ++ /* HACK: The modifiers only work with xbgr8888 now */ ++ if (b->fb_modifiers) ++ b->gbm_format = DRM_FORMAT_XBGR8888; ++ ++ if (parse_gbm_format(config->gbm_format, b->gbm_format, &b->gbm_format) < 0) ++ goto err_sprite; ++ + if (b->use_pixman) { + if (init_pixman(b) < 0) { + weston_log("failed to initialize pixman renderer\n"); +- goto err_udev_dev; ++ goto err_sprite; + } + } else { + if (init_egl(b) < 0) { + weston_log("failed to initialize egl\n"); +- goto err_udev_dev; ++ goto err_sprite; + } + } + +@@ -4188,7 +4251,7 @@ drm_backend_create(struct weston_compositor *compositor, + res = drmModeGetResources(b->drm.fd); + if (!res) { + weston_log("Failed to get drmModeRes\n"); +- goto err_udev_dev; ++ goto err_sprite; + } + + wl_list_init(&b->crtc_list); +@@ -4197,9 +4260,6 @@ drm_backend_create(struct weston_compositor *compositor, + goto err_create_crtc_list; + } + +- wl_list_init(&b->plane_list); +- create_sprites(b); +- + if (udev_input_init(&b->input, + compositor, b->udev, seat_id, + config->configure_device) < 0) { +@@ -4333,10 +4393,10 @@ err_drm_source: + wl_event_source_remove(b->drm_source); + err_udev_input: + udev_input_destroy(&b->input); +-err_sprite: +- destroy_sprites(b); + err_create_crtc_list: + drmModeFreeResources(res); ++err_sprite: ++ destroy_sprites(b); + err_udev_dev: + udev_device_unref(drm_device); + err_udev: +diff --git a/libweston/backend-drm/kms.c b/libweston/backend-drm/kms.c +index 4443741..6596d9e 100644 +--- a/libweston/backend-drm/kms.c ++++ b/libweston/backend-drm/kms.c +@@ -38,6 +38,7 @@ + + #include + #include ++#include + #include "shared/helpers.h" + #include "shared/weston-drm-fourcc.h" + #include "drm-internal.h" +@@ -525,6 +526,9 @@ drm_plane_populate_formats(struct drm_plane *plane, const drmModePlane *kplane, + ret = weston_drm_format_add_modifier(fmt, mod->modifier); + if (ret < 0) + goto out; ++ ++ if (DRM_MOD_VALID(mod->modifier)) ++ plane->has_modifiers = true; + } + + if (fmt->modifiers.size == 0) +@@ -1583,7 +1587,7 @@ init_kms_caps(struct drm_backend *b) + weston_log("DRM: %s atomic modesetting\n", + b->atomic_modeset ? "supports" : "does not support"); + +- if (!getenv("WESTON_DISABLE_GBM_MODIFIERS")) { ++ if (getenv("WESTON_ALLOW_GBM_MODIFIERS")) { + ret = drmGetCap(b->drm.fd, DRM_CAP_ADDFB2_MODIFIERS, &cap); + if (ret == 0) + b->fb_modifiers = cap; +diff --git a/libweston/pixel-formats.c b/libweston/pixel-formats.c +index 172e6cc..85fae20 100644 +--- a/libweston/pixel-formats.c ++++ b/libweston/pixel-formats.c +@@ -220,6 +220,8 @@ static const struct pixel_format_info pixel_format_table[] = { + { + DRM_FORMAT(XBGR8888), + BITS_RGBA_FIXED(8, 8, 8, 0), ++ .depth = 24, ++ .bpp = 32, + GL_FORMAT(GL_RGBA), + GL_TYPE(GL_UNSIGNED_BYTE), + #if __BYTE_ORDER == __LITTLE_ENDIAN +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0040-desktop-shell-Use-real-size-for-non-image-background.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0040-desktop-shell-Use-real-size-for-non-image-background.patch new file mode 100644 index 0000000000000000000000000000000000000000..c9eda2d51eef224c84a8b4cd99e8b2bd13a1a707 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0040-desktop-shell-Use-real-size-for-non-image-background.patch @@ -0,0 +1,33 @@ +From 616e75ea3717757aec4495ac35c87cf41f519cfa Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 22 Mar 2021 22:54:28 +0800 +Subject: [PATCH 40/79] desktop-shell: Use real size for non-image background + +Currently we are faking 1x1 size for non-image background, which would +causing incorrect opaque region. + +Signed-off-by: Jeffy Chen +--- + clients/desktop-shell.c | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c +index 8711399..6cf21da 100644 +--- a/clients/desktop-shell.c ++++ b/clients/desktop-shell.c +@@ -870,12 +870,6 @@ background_configure(void *data, + return; + } + +- if (!background->image && background->color) { +- widget_set_viewport_destination(background->widget, width, height); +- width = 1; +- height = 1; +- } +- + widget_schedule_resize(background->widget, width, height); + } + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0041-gl-renderer-Honer-opaque-surface-s-alpha-channel.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0041-gl-renderer-Honer-opaque-surface-s-alpha-channel.patch new file mode 100644 index 0000000000000000000000000000000000000000..3d4ecacaa6e07bba2c1b3572544dda34e7798458 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0041-gl-renderer-Honer-opaque-surface-s-alpha-channel.patch @@ -0,0 +1,33 @@ +From 4a65c4e8863abd774415905daad201340b7cb1f5 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 23 Mar 2021 03:09:33 +0800 +Subject: [PATCH 41/79] gl-renderer: Honer opaque surface's alpha channel + +Signed-off-by: Jeffy Chen +--- + libweston/renderer-gl/gl-renderer.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c +index f891478..0947efd 100644 +--- a/libweston/renderer-gl/gl-renderer.c ++++ b/libweston/renderer-gl/gl-renderer.c +@@ -1171,6 +1171,7 @@ draw_paint_node(struct weston_paint_node *pnode, + if (pixman_region32_not_empty(&surface_opaque)) { + struct gl_shader_config alt = sconf; + ++#if 0 + if (alt.req.variant == SHADER_VARIANT_RGBA) { + /* Special case for RGBA textures with possibly + * bad data in alpha channel: use the shader +@@ -1179,6 +1180,7 @@ draw_paint_node(struct weston_paint_node *pnode, + */ + alt.req.variant = SHADER_VARIANT_RGBX; + } ++#endif + + if (pnode->view->alpha < 1.0) + glEnable(GL_BLEND); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0042-desktop-shell-Disable-fullscreen-black-background-by.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0042-desktop-shell-Disable-fullscreen-black-background-by.patch new file mode 100644 index 0000000000000000000000000000000000000000..464c7f8b35eecc5656817eb45e99783b02d725c0 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0042-desktop-shell-Disable-fullscreen-black-background-by.patch @@ -0,0 +1,51 @@ +From ac9bb72d96af6b834450a91fbc878369240110ae Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 23 Mar 2021 22:34:54 +0800 +Subject: [PATCH 42/79] desktop-shell: Disable fullscreen black background by + default + +There's a force black background for fullscreen views. + +Let's disable it by default, set this env to enable: +"WESTON_FULLSCREEN_BLACK_BACKGROUND" + +Signed-off-by: Jeffy Chen +--- + desktop-shell/shell.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c +index a8b8f35..ce6d660 100644 +--- a/desktop-shell/shell.c ++++ b/desktop-shell/shell.c +@@ -2146,7 +2146,8 @@ shell_configure_fullscreen(struct shell_surface *shsurf) + return; + } + +- shell_ensure_fullscreen_black_view(shsurf); ++ if (getenv("WESTON_FULLSCREEN_BLACK_BACKGROUND")) ++ shell_ensure_fullscreen_black_view(shsurf); + + surface_subsurfaces_boundingbox(surface, &surf_x, &surf_y, + &surf_width, &surf_height); +@@ -3752,7 +3753,7 @@ lower_fullscreen_layer(struct desktop_shell *shell, + + /* We can have a non-fullscreen popup for a fullscreen surface + * in the fullscreen layer. */ +- if (weston_desktop_surface_get_fullscreen(shsurf->desktop_surface)) { ++ if (weston_desktop_surface_get_fullscreen(shsurf->desktop_surface) && shsurf->fullscreen.black_view) { + /* Hide the black view */ + weston_layer_entry_remove(&shsurf->fullscreen.black_view->layer_link); + wl_list_init(&shsurf->fullscreen.black_view->layer_link.link); +@@ -4522,7 +4523,7 @@ switcher_next(struct switcher *switcher) + view->alpha = 1.0; + + shsurf = get_shell_surface(switcher->current->surface); +- if (shsurf && weston_desktop_surface_get_fullscreen(shsurf->desktop_surface)) ++ if (shsurf && weston_desktop_surface_get_fullscreen(shsurf->desktop_surface) && shsurf->fullscreen.black_view) + shsurf->fullscreen.black_view->alpha = 1.0; + } + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0043-desktop-shell-Resize-views-when-work-area-changed.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0043-desktop-shell-Resize-views-when-work-area-changed.patch new file mode 100644 index 0000000000000000000000000000000000000000..fb5c5c358cc3feee2b755d0eef227a43234c7197 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0043-desktop-shell-Resize-views-when-work-area-changed.patch @@ -0,0 +1,53 @@ +From 87315047d46abfa39d7bb663ecbce071d8aa9cf7 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 2 Apr 2021 01:50:22 +0800 +Subject: [PATCH 43/79] desktop-shell: Resize views when work area changed + +Signed-off-by: Jeffy Chen +--- + desktop-shell/shell.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c +index ce6d660..f572f8f 100644 +--- a/desktop-shell/shell.c ++++ b/desktop-shell/shell.c +@@ -48,6 +48,10 @@ + #define DEFAULT_NUM_WORKSPACES 1 + #define DEFAULT_WORKSPACE_CHANGE_ANIMATION_LENGTH 200 + ++static void ++handle_output_resize_layer(struct desktop_shell *shell, ++ struct weston_layer *layer, void *data); ++ + struct focus_state { + struct desktop_shell *shell; + struct weston_seat *seat; +@@ -3052,6 +3056,7 @@ panel_committed(struct weston_surface *es, int32_t sx, int32_t sy) + { + struct desktop_shell *shell = es->committed_private; + struct weston_view *view; ++ pixman_rectangle32_t old_area, new_area; + int width, height; + int x = 0, y = 0; + +@@ -3071,7 +3076,16 @@ panel_committed(struct weston_surface *es, int32_t sx, int32_t sy) + break; + } + ++ get_output_work_area(shell, view->output, &old_area); + configure_static_view(view, &shell->panel_layer, x, y); ++ get_output_work_area(shell, view->output, &new_area); ++ ++ if (old_area.x == new_area.x && old_area.y == new_area.y && ++ old_area.width == new_area.width && ++ old_area.height == new_area.height) ++ return; ++ ++ shell_for_each_layer(shell, handle_output_resize_layer, view->output); + } + + static void +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0044-libinput-seat-Improve-input-device-and-output-associ.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0044-libinput-seat-Improve-input-device-and-output-associ.patch new file mode 100644 index 0000000000000000000000000000000000000000..447f5cee8362c9dc755891ce9ccb15f34733ae42 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0044-libinput-seat-Improve-input-device-and-output-associ.patch @@ -0,0 +1,236 @@ +From 3b70a8c738bf618d59fd20328882648490562487 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 2 Apr 2021 09:49:09 +0800 +Subject: [PATCH 44/79] libinput-seat: Improve input device and output + associating + +An input device can associate with an output using udev rules's +WL_OUTPUT property, for example: +ATTRS{idVendor}=="0eef", ATTRS{idProduct}=="0001", ENV{WL_OUTPUT}="HDMI-A-1" + +An input device can be added into a wl_seat using udev rules's WL_SEAT +property, for example: +ATTRS{idVendor}=="0eef", ATTRS{idProduct}=="0001", ENV{WL_SEAT}="seat1" + +An output can associate with a wl_seat using seat entry in weston.ini's +output section, for example: +[output] +name=HDMI-A-1 +seat=seat1 + +Signed-off-by: Jeffy Chen +--- + libweston/backend-drm/drm.c | 1 + + libweston/libinput-seat.c | 117 +++++++++++++++++++++++------------- + libweston/libinput-seat.h | 5 +- + 3 files changed, 79 insertions(+), 44 deletions(-) + +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index 149ac01..884dcba 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -1700,6 +1700,7 @@ setup_output_seat_constraint(struct drm_backend *b, + return; + + seat->base.output = output; ++ seat->has_output = true; + + pointer = weston_seat_get_pointer(&seat->base); + if (pointer) +diff --git a/libweston/libinput-seat.c b/libweston/libinput-seat.c +index a9c7d6f..57ff181 100644 +--- a/libweston/libinput-seat.c ++++ b/libweston/libinput-seat.c +@@ -89,12 +89,54 @@ output_find_by_head_name(struct weston_compositor *compositor, + return NULL; + } + ++static void ++udev_seat_update_output(struct udev_seat *seat) ++{ ++ struct weston_compositor *c = seat->base.compositor; ++ struct weston_output *found, *prefered = NULL; ++ struct evdev_device *device; ++ ++ if (seat->has_output) { ++ if (weston_output_valid(seat->base.output)) ++ prefered = seat->base.output; ++ else ++ /* The seat's output been removed */ ++ seat->base.output = NULL; ++ } else { ++ struct weston_output *output; ++ ++ /* default assignment to an arbitrary output */ ++ wl_list_for_each(output, &c->output_list, link) { ++ if (weston_output_valid(output)) { ++ prefered = output; ++ break; ++ } ++ } ++ } ++ ++ wl_list_for_each(device, &seat->devices_list, link) { ++ /* If we find any input device without an associated output ++ * or an output name to associate with, just tie it with the ++ * output we got here - the default assignment. ++ */ ++ if (!device->output_name) { ++ evdev_device_set_output(device, prefered); ++ continue; ++ } ++ ++ /* Update all devices' output associations, may they gain or ++ * lose it. ++ */ ++ found = output_find_by_head_name(c, device->output_name); ++ evdev_device_set_output(device, found); ++ } ++} ++ + static int + device_added(struct udev_input *input, struct libinput_device *libinput_device) + { + struct weston_compositor *c; + struct evdev_device *device; +- struct weston_output *output; + const char *output_name; + struct weston_seat *seat; + struct udev_seat *udev_seat; +@@ -128,16 +170,10 @@ device_added(struct udev_input *input, struct libinput_device *libinput_device) + &pointer->y); + + output_name = libinput_device_get_output_name(libinput_device); +- if (output_name) { ++ if (output_name) + device->output_name = strdup(output_name); +- output = output_find_by_head_name(c, output_name); +- evdev_device_set_output(device, output); +- } else if (!wl_list_empty(&c->output_list)) { +- /* default assignment to an arbitrary output */ +- output = container_of(c->output_list.next, +- struct weston_output, link); +- evdev_device_set_output(device, output); +- } ++ ++ udev_seat_update_output(udev_seat); + + if (!input->suspended) { + weston_seat_repick(seat); +@@ -403,40 +439,27 @@ udev_seat_led_update(struct weston_seat *seat_base, enum weston_led leds) + } + + static void +-udev_seat_output_changed(struct udev_seat *seat, struct weston_output *output) ++notify_output_created(struct wl_listener *listener, void *data) + { +- struct evdev_device *device; +- struct weston_output *found; +- +- wl_list_for_each(device, &seat->devices_list, link) { +- /* If we find any input device without an associated output +- * or an output name to associate with, just tie it with the +- * output we got here - the default assignment. +- */ +- if (!device->output_name) { +- if (!device->output) +- evdev_device_set_output(device, output); +- +- continue; +- } +- +- /* Update all devices' output associations, may they gain or +- * lose it. +- */ +- found = output_find_by_head_name(output->compositor, +- device->output_name); +- evdev_device_set_output(device, found); +- } ++ struct udev_seat *seat = container_of(listener, struct udev_seat, ++ output_created_listener); ++ udev_seat_update_output(seat); + } + + static void +-notify_output_create(struct wl_listener *listener, void *data) ++notify_output_moved(struct wl_listener *listener, void *data) + { + struct udev_seat *seat = container_of(listener, struct udev_seat, +- output_create_listener); +- struct weston_output *output = data; ++ output_moved_listener); ++ udev_seat_update_output(seat); ++} + +- udev_seat_output_changed(seat, output); ++static void ++notify_output_destroyed(struct wl_listener *listener, void *data) ++{ ++ struct udev_seat *seat = container_of(listener, struct udev_seat, ++ output_destroyed_listener); ++ udev_seat_update_output(seat); + } + + static void +@@ -444,9 +467,7 @@ notify_output_heads_changed(struct wl_listener *listener, void *data) + { + struct udev_seat *seat = container_of(listener, struct udev_seat, + output_heads_listener); +- struct weston_output *output = data; +- +- udev_seat_output_changed(seat, output); ++ udev_seat_update_output(seat); + } + + static struct udev_seat * +@@ -462,9 +483,17 @@ udev_seat_create(struct udev_input *input, const char *seat_name) + weston_seat_init(&seat->base, c, seat_name); + seat->base.led_update = udev_seat_led_update; + +- seat->output_create_listener.notify = notify_output_create; ++ seat->output_created_listener.notify = notify_output_created; + wl_signal_add(&c->output_created_signal, +- &seat->output_create_listener); ++ &seat->output_created_listener); ++ ++ seat->output_destroyed_listener.notify = notify_output_destroyed; ++ wl_signal_add(&c->output_destroyed_signal, ++ &seat->output_destroyed_listener); ++ ++ seat->output_moved_listener.notify = notify_output_moved; ++ wl_signal_add(&c->output_moved_signal, ++ &seat->output_moved_listener); + + seat->output_heads_listener.notify = notify_output_heads_changed; + wl_signal_add(&c->output_heads_changed_signal, +@@ -486,7 +515,9 @@ udev_seat_destroy(struct udev_seat *seat) + + udev_seat_remove_devices(seat); + weston_seat_release(&seat->base); +- wl_list_remove(&seat->output_create_listener.link); ++ wl_list_remove(&seat->output_created_listener.link); ++ wl_list_remove(&seat->output_destroyed_listener.link); ++ wl_list_remove(&seat->output_moved_listener.link); + wl_list_remove(&seat->output_heads_listener.link); + free(seat); + } +diff --git a/libweston/libinput-seat.h b/libweston/libinput-seat.h +index 315980d..636636f 100644 +--- a/libweston/libinput-seat.h ++++ b/libweston/libinput-seat.h +@@ -37,8 +37,11 @@ struct libinput_device; + + struct udev_seat { + struct weston_seat base; ++ bool has_output; + struct wl_list devices_list; +- struct wl_listener output_create_listener; ++ struct wl_listener output_created_listener; ++ struct wl_listener output_destroyed_listener; ++ struct wl_listener output_moved_listener; + struct wl_listener output_heads_listener; + }; + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0045-config-parser-Support-loading-multiple-configs.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0045-config-parser-Support-loading-multiple-configs.patch new file mode 100644 index 0000000000000000000000000000000000000000..915b77b849419a50ab4c26b249300ec3e5ff13b7 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0045-config-parser-Support-loading-multiple-configs.patch @@ -0,0 +1,225 @@ +From 569d1effe8ceaec9f085ded004c7845957ef7b90 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 7 Apr 2021 08:25:57 +0800 +Subject: [PATCH 45/79] config-parser: Support loading multiple configs + +Try loading .ini configs under ".d/". + +Tested with: +/etc/xdg/weston/weston.ini.d/99-pixman.ini +[core] +use-pixman=true + +Signed-off-by: Jeffy Chen +--- + shared/config-parser.c | 132 +++++++++++++++++++++++++++++++++-------- + 1 file changed, 106 insertions(+), 26 deletions(-) + +diff --git a/shared/config-parser.c b/shared/config-parser.c +index ed120d5..7df5a3b 100644 +--- a/shared/config-parser.c ++++ b/shared/config-parser.c +@@ -31,6 +31,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -70,6 +71,13 @@ open_config_file(struct weston_config *c, const char *name) + const char *p, *next; + int fd; + ++ if (!c) { ++ if (name[0] != '/') ++ return -1; ++ ++ return open(name, O_RDONLY | O_CLOEXEC); ++ } ++ + if (name[0] == '/') { + snprintf(c->path, sizeof c->path, "%s", name); + return open(name, O_RDONLY | O_CLOEXEC); +@@ -345,6 +353,15 @@ config_add_section(struct weston_config *config, const char *name) + { + struct weston_config_section *section; + ++ /* squash single sessions */ ++ if (strcmp(name, "launcher") && strcmp(name, "ivi-launcher") && ++ strcmp(name, "output") && strcmp(name, "remote-output") && ++ strcmp(name, "pipewire-output")) { ++ section = weston_config_get_section(config, name, NULL, NULL); ++ if (section) ++ return section; ++ } ++ + section = zalloc(sizeof *section); + if (section == NULL) + return NULL; +@@ -367,6 +384,19 @@ section_add_entry(struct weston_config_section *section, + { + struct weston_config_entry *entry; + ++ /* hack for removing entry */ ++ if (key[0] == '-') { ++ entry = config_section_get_entry(section, key + 1); ++ if (!entry) ++ return NULL; ++ ++ wl_list_remove(&entry->link); ++ free(entry->key); ++ free(entry->value); ++ free(entry); ++ return NULL; ++ } ++ + entry = zalloc(sizeof *entry); + if (entry == NULL) + return NULL; +@@ -389,41 +419,27 @@ section_add_entry(struct weston_config_section *section, + return entry; + } + +-WL_EXPORT +-struct weston_config * +-weston_config_parse(const char *name) ++static bool ++weston_config_parse_fd(struct weston_config *config, int fd) + { + FILE *fp; + char line[512], *p; + struct stat filestat; +- struct weston_config *config; + struct weston_config_section *section = NULL; +- int i, fd; +- +- config = zalloc(sizeof *config); +- if (config == NULL) +- return NULL; ++ int i; + +- wl_list_init(&config->section_list); +- +- fd = open_config_file(config, name); +- if (fd == -1) { +- free(config); +- return NULL; +- } ++ if (fd < 0 || !config) ++ return false; + + if (fstat(fd, &filestat) < 0 || + !S_ISREG(filestat.st_mode)) { + close(fd); +- free(config); +- return NULL; ++ return false; + } + + fp = fdopen(fd, "r"); +- if (fp == NULL) { +- free(config); +- return NULL; +- } ++ if (fp == NULL) ++ return false; + + while (fgets(line, sizeof line, fp)) { + switch (line[0]) { +@@ -436,8 +452,7 @@ weston_config_parse(const char *name) + fprintf(stderr, "malformed " + "section header: %s\n", line); + fclose(fp); +- weston_config_destroy(config); +- return NULL; ++ return false; + } + p[0] = '\0'; + section = config_add_section(config, &line[1]); +@@ -448,8 +463,7 @@ weston_config_parse(const char *name) + fprintf(stderr, "malformed " + "config line: %s\n", line); + fclose(fp); +- weston_config_destroy(config); +- return NULL; ++ return false; + } + + p[0] = '\0'; +@@ -468,6 +482,72 @@ weston_config_parse(const char *name) + + fclose(fp); + ++ return true; ++} ++ ++static int ++accept_config_file(const struct dirent *entry) ++{ ++ const char *suffix = ".ini"; ++ char *end = strstr(entry->d_name, suffix); ++ return end && end[strlen(suffix)] == '\0'; ++} ++ ++WL_EXPORT ++struct weston_config * ++weston_config_parse(const char *name) ++{ ++ struct stat st; ++ struct dirent **namelist; ++ struct weston_config *config; ++ char path[sizeof(config->path) + 2]; ++ int n, fd; ++ ++ config = zalloc(sizeof *config); ++ if (config == NULL) ++ return NULL; ++ ++ wl_list_init(&config->section_list); ++ ++ fd = open_config_file(config, name); ++ if (fd >= 0 && !weston_config_parse_fd(config, fd)) { ++ fprintf(stderr, "failed to parse %s\n", config->path); ++ free(config); ++ return NULL; ++ } ++ ++ strcpy(path, config->path); ++ strcat(path, ".d"); ++ if (stat(path, &st) < 0 || !S_ISDIR(st.st_mode)) ++ return config; ++ ++ n = scandir(path, &namelist, accept_config_file, alphasort); ++ if (n < 0) ++ return config; ++ ++ while (n--) { ++ char *file = namelist[n]->d_name; ++ char *sep = "/"; ++ char fpath[strlen(path)+strlen(sep)+strlen(file) + 1]; ++ strcpy(fpath, path); ++ strcat(fpath, sep); ++ strcat(fpath, file); ++ free(namelist[n]); ++ ++ fd = open_config_file(NULL, fpath); ++ if (fd < 0) ++ continue; ++ ++ if (!weston_config_parse_fd(config, fd)) { ++ fprintf(stderr, "failed to parse '%s'\n", fpath); ++ free(namelist); ++ free(config); ++ return NULL; ++ } ++ } ++ ++ free(namelist); ++ + return config; + } + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0046-HACK-gl-renderer-Fix-random-hang-during-hotplug.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0046-HACK-gl-renderer-Fix-random-hang-during-hotplug.patch new file mode 100644 index 0000000000000000000000000000000000000000..1360d1935fb4209b0ab26cf1b3455ab02a3f3c10 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0046-HACK-gl-renderer-Fix-random-hang-during-hotplug.patch @@ -0,0 +1,38 @@ +From 73fc5e13c266d83b46bae30b984b249ea337b965 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 19 Apr 2021 09:40:10 +0800 +Subject: [PATCH 46/79] HACK: gl-renderer: Fix random hang during hotplug + +Try to bind to a valid output before attaching buffers for mali. + +Signed-off-by: Jeffy Chen +--- + libweston/renderer-gl/gl-renderer.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c +index 0947efd..15b2292 100644 +--- a/libweston/renderer-gl/gl-renderer.c ++++ b/libweston/renderer-gl/gl-renderer.c +@@ -1913,6 +1913,7 @@ gl_renderer_flush_damage(struct weston_surface *surface) + const struct weston_testsuite_quirks *quirks = + &surface->compositor->test_data.test_quirks; + struct gl_surface_state *gs = get_surface_state(surface); ++ struct gl_renderer *gr = get_renderer(surface->compositor); + struct weston_buffer *buffer = gs->buffer_ref.buffer; + struct weston_view *view; + bool texture_used; +@@ -1934,6 +1935,10 @@ gl_renderer_flush_damage(struct weston_surface *surface) + texture_used = false; + wl_list_for_each(view, &surface->views, surface_link) { + if (view->plane == &surface->compositor->primary_plane) { ++ /* HACK: Mali needs a valid context for uploading */ ++ if (gr->is_mali_egl && view->output) ++ use_output(view->output); ++ + texture_used = true; + break; + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0047-Support-sw-cursor-config.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0047-Support-sw-cursor-config.patch new file mode 100644 index 0000000000000000000000000000000000000000..fa65f7944eec4c87cd42da8877f6f0b7ab253c4d --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0047-Support-sw-cursor-config.patch @@ -0,0 +1,58 @@ +From 77f9ebdfd31791471add2ec7228f4d47558d68cd Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 13 Jul 2021 10:56:56 +0800 +Subject: [PATCH 47/79] Support sw-cursor config + +Tested with: +[core] +sw-cursor=true + +Signed-off-by: Jeffy Chen +--- + compositor/main.c | 2 ++ + include/libweston/backend-drm.h | 2 ++ + libweston/backend-drm/drm.c | 2 ++ + 3 files changed, 6 insertions(+) + +diff --git a/compositor/main.c b/compositor/main.c +index 2010c02..33dd4e5 100644 +--- a/compositor/main.c ++++ b/compositor/main.c +@@ -2685,6 +2685,8 @@ load_drm_backend(struct weston_compositor *c, + &config.pageflip_timeout, 0); + weston_config_section_get_bool(section, "pixman-shadow", + &config.use_pixman_shadow, true); ++ weston_config_section_get_bool(section, "sw-cursor", ++ &config.use_sw_cursor, false); + if (without_input) + c->require_input = !without_input; + +diff --git a/include/libweston/backend-drm.h b/include/libweston/backend-drm.h +index af2da4a..cfbf69a 100644 +--- a/include/libweston/backend-drm.h ++++ b/include/libweston/backend-drm.h +@@ -223,6 +223,8 @@ struct weston_drm_backend_config { + + /** Use shadow buffer if using Pixman-renderer. */ + bool use_pixman_shadow; ++ ++ bool use_sw_cursor; + }; + + #ifdef __cplusplus +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index 884dcba..4979bf5 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -4284,6 +4284,8 @@ drm_backend_create(struct weston_compositor *compositor, + /* 'compute' faked zpos values in case HW doesn't expose any */ + drm_backend_create_faked_zpos(b); + ++ b->cursors_are_broken |= config->use_sw_cursor; ++ + /* A this point we have some idea of whether or not we have a working + * cursor plane. */ + if (!b->cursors_are_broken) +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0048-gl-renderer-Support-NV16-dma-buf.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0048-gl-renderer-Support-NV16-dma-buf.patch new file mode 100644 index 0000000000000000000000000000000000000000..dde417813c318e79f755274e4145a0e1aec7dc7e --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0048-gl-renderer-Support-NV16-dma-buf.patch @@ -0,0 +1,25 @@ +From 9f848ce6a00ee4c1a3bf65434fb84756e19aff70 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 15 Jul 2021 14:38:13 +0800 +Subject: [PATCH 48/79] gl-renderer: Support NV16 dma buf + +Signed-off-by: Jeffy Chen +--- + libweston/renderer-gl/gl-renderer.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c +index 15b2292..a059f36 100644 +--- a/libweston/renderer-gl/gl-renderer.c ++++ b/libweston/renderer-gl/gl-renderer.c +@@ -2775,6 +2775,7 @@ gl_renderer_query_dmabuf_formats(struct weston_compositor *wc, + DRM_FORMAT_XRGB8888, + DRM_FORMAT_YUYV, + DRM_FORMAT_NV12, ++ DRM_FORMAT_NV16, + DRM_FORMAT_YUV420, + DRM_FORMAT_YUV444, + DRM_FORMAT_XYUV8888, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0049-backend-drm-Allow-pageflip-error.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0049-backend-drm-Allow-pageflip-error.patch new file mode 100644 index 0000000000000000000000000000000000000000..111ecefc219bd62bb7047d8e14af2d829d3b31a5 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0049-backend-drm-Allow-pageflip-error.patch @@ -0,0 +1,72 @@ +From dd4d7281071283f73d5c2e237ddaeddd85227bdf Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 13 Aug 2021 10:10:01 +0800 +Subject: [PATCH 49/79] backend-drm: Allow pageflip error + +Allow to recover from pageflip error: +[02:08:14.089] queueing pageflip failed: Operation not permitted +[02:08:14.090] Couldn't apply state for output eDP-1 +[02:08:14.090] repaint-flush failed: No such file or directory + +Signed-off-by: Jeffy Chen +--- + libweston/backend-drm/kms.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/libweston/backend-drm/kms.c b/libweston/backend-drm/kms.c +index 6596d9e..47ce5c5 100644 +--- a/libweston/backend-drm/kms.c ++++ b/libweston/backend-drm/kms.c +@@ -1353,6 +1353,7 @@ drm_pending_state_apply(struct drm_pending_state *pending_state) + struct drm_backend *b = pending_state->backend; + struct drm_output_state *output_state, *tmp; + struct drm_crtc *crtc; ++ int has_error = 0; + + if (b->atomic_modeset) + return drm_pending_state_apply_atomic(pending_state, +@@ -1395,6 +1396,7 @@ drm_pending_state_apply(struct drm_pending_state *pending_state) + drm_output_fini_egl(output); + drm_output_init_egl(output, b); + } ++ has_error = 1; + } + } + +@@ -1402,7 +1404,7 @@ drm_pending_state_apply(struct drm_pending_state *pending_state) + + drm_pending_state_free(pending_state); + +- return 0; ++ return has_error ? -EACCES : 0; + } + + /** +@@ -1418,6 +1420,7 @@ drm_pending_state_apply_sync(struct drm_pending_state *pending_state) + struct drm_backend *b = pending_state->backend; + struct drm_output_state *output_state, *tmp; + struct drm_crtc *crtc; ++ int has_error = 0; + + if (b->atomic_modeset) + return drm_pending_state_apply_atomic(pending_state, +@@ -1446,6 +1449,7 @@ drm_pending_state_apply_sync(struct drm_pending_state *pending_state) + if (ret != 0) { + weston_log("Couldn't apply state for output %s\n", + output_state->output->base.name); ++ has_error = 1; + } + } + +@@ -1453,7 +1457,7 @@ drm_pending_state_apply_sync(struct drm_pending_state *pending_state) + + drm_pending_state_free(pending_state); + +- return 0; ++ return has_error ? -EACCES : 0; + } + + void +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0050-HACK-pixman-renderer-Support-passing-dma-fd-to-pixma.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0050-HACK-pixman-renderer-Support-passing-dma-fd-to-pixma.patch new file mode 100644 index 0000000000000000000000000000000000000000..eb1eb6feea973f175432e55bd66fed04f97b5cc7 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0050-HACK-pixman-renderer-Support-passing-dma-fd-to-pixma.patch @@ -0,0 +1,116 @@ +From 451240bd3bf00ca2319c0625bcdba76ccc3d7e22 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Sat, 9 Oct 2021 12:33:33 +0800 +Subject: [PATCH 50/79] HACK: pixman-renderer: Support passing dma fd to pixman + +Usage: +pixman_image_set_destroy_function(image, NULL, (void *)(ptrdiff_t)dma_fd) + +Signed-off-by: Jeffy Chen +--- + libweston/backend-drm/drm-internal.h | 1 + + libweston/backend-drm/drm.c | 3 +++ + libweston/backend-drm/fb.c | 15 +++++++++++++++ + libweston/pixman-renderer.c | 2 ++ + libweston/pixman-renderer.h | 4 ++++ + 5 files changed, 25 insertions(+) + +diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h +index 161c1ee..a2019ce 100644 +--- a/libweston/backend-drm/drm-internal.h ++++ b/libweston/backend-drm/drm-internal.h +@@ -388,6 +388,7 @@ struct drm_fb { + uint64_t modifier; + int width, height; + int fd; ++ int dma_fd; + + uint32_t plane_mask; + +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index 4979bf5..d9beca0 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -1634,6 +1634,9 @@ drm_output_init_pixman(struct drm_output *output, struct drm_backend *b) + output->dumb[i]->strides[0]); + if (!output->image[i]) + goto err; ++ ++ pixman_image_set_dma_fd(output->image[i], ++ output->dumb[i]->dma_fd); + } + + if (pixman_renderer_output_create(&output->base, &options) < 0) +diff --git a/libweston/backend-drm/fb.c b/libweston/backend-drm/fb.c +index af31a8a..748c641 100644 +--- a/libweston/backend-drm/fb.c ++++ b/libweston/backend-drm/fb.c +@@ -58,6 +58,9 @@ drm_fb_destroy_dumb(struct drm_fb *fb) + + assert(fb->type == BUFFER_PIXMAN_DUMB); + ++ if (fb->dma_fd >= 0) ++ close(fb->dma_fd); ++ + if (fb->map && fb->size > 0) + munmap(fb->map, fb->size); + +@@ -121,6 +124,7 @@ drm_fb_create_dumb(struct drm_backend *b, int width, int height, + struct drm_mode_create_dumb create_arg; + struct drm_mode_destroy_dumb destroy_arg; + struct drm_mode_map_dumb map_arg; ++ struct drm_prime_handle prime_arg; + + fb = zalloc(sizeof *fb); + if (!fb) +@@ -175,8 +179,19 @@ drm_fb_create_dumb(struct drm_backend *b, int width, int height, + if (fb->map == MAP_FAILED) + goto err_add_fb; + ++ memset(&prime_arg, 0, sizeof(prime_arg)); ++ prime_arg.fd = -1; ++ prime_arg.handle = fb->handles[0]; ++ ret = drmIoctl(fb->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &prime_arg); ++ if (ret) ++ goto err_unmap_fb; ++ ++ fb->dma_fd = prime_arg.fd; ++ + return fb; + ++err_unmap_fb: ++ munmap(fb->map, fb->size); + err_add_fb: + drmModeRmFB(b->drm.fd, fb->fb_id); + err_bo: +diff --git a/libweston/pixman-renderer.c b/libweston/pixman-renderer.c +index c6d1cbb..b56e9b5 100644 +--- a/libweston/pixman-renderer.c ++++ b/libweston/pixman-renderer.c +@@ -821,6 +821,8 @@ pixman_renderer_attach_dmabuf(struct weston_surface *es, + data->ptr + attributes->offset[0], + attributes->stride[0]); + ++ pixman_image_set_dma_fd(ps->image, attributes->fd[0]); ++ + ps->buffer_destroy_listener.notify = + buffer_state_handle_buffer_destroy; + wl_signal_add(&buffer->destroy_signal, +diff --git a/libweston/pixman-renderer.h b/libweston/pixman-renderer.h +index 2b81dde..bcd248f 100644 +--- a/libweston/pixman-renderer.h ++++ b/libweston/pixman-renderer.h +@@ -29,6 +29,10 @@ + #include "backend.h" + #include "libweston-internal.h" + ++/* HACK: Pass dma fd to pixman through destroy data */ ++#define pixman_image_set_dma_fd(image, fd) \ ++ pixman_image_set_destroy_function(image, NULL, (void *)(ptrdiff_t)fd) ++ + int + pixman_renderer_init(struct weston_compositor *ec); + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0051-HACK-Use-negative-value-for-dynamic-repaint-window.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0051-HACK-Use-negative-value-for-dynamic-repaint-window.patch new file mode 100644 index 0000000000000000000000000000000000000000..64bfa9becf0ea2b539c3b6d6afb4905604914bc0 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0051-HACK-Use-negative-value-for-dynamic-repaint-window.patch @@ -0,0 +1,53 @@ +From 2c89288a271cb0db7ba6b9ded9cb444daa119234 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 28 Oct 2021 12:47:09 +0800 +Subject: [PATCH 51/79] HACK: Use negative value for dynamic repaint window + +Support using negative value for a vblank based dynamic repaint window: +When negative, repaint-window = vblank-duration - abs(repaint-window) + +Signed-off-by: Jeffy Chen +--- + compositor/main.c | 2 +- + libweston/compositor.c | 9 ++++++++- + 2 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/compositor/main.c b/compositor/main.c +index 33dd4e5..558537e 100644 +--- a/compositor/main.c ++++ b/compositor/main.c +@@ -1127,7 +1127,7 @@ weston_compositor_init_config(struct weston_compositor *ec, + s = weston_config_get_section(config, "core", NULL, NULL); + weston_config_section_get_int(s, "repaint-window", &repaint_msec, + ec->repaint_msec); +- if (repaint_msec < -10 || repaint_msec > 1000) { ++ if (repaint_msec < -1000 || repaint_msec > 1000) { + weston_log("Invalid repaint_window value in config: %d\n", + repaint_msec); + } else { +diff --git a/libweston/compositor.c b/libweston/compositor.c +index af69ab3..02cb51b 100644 +--- a/libweston/compositor.c ++++ b/libweston/compositor.c +@@ -3288,10 +3288,17 @@ weston_output_finish_frame(struct weston_output *output, + + output->frame_time = *stamp; + +- timespec_add_nsec(&output->next_repaint, stamp, refresh_nsec); ++ /* HACK: Use negative value for dynamic repaint window */ ++ if (compositor->repaint_msec > 0) ++ timespec_add_nsec(&output->next_repaint, stamp, refresh_nsec); ++ + timespec_add_msec(&output->next_repaint, &output->next_repaint, + -compositor->repaint_msec); + msec_rel = timespec_sub_to_msec(&output->next_repaint, &now); ++ if (msec_rel < 0) { ++ output->next_repaint = now; ++ msec_rel = 0; ++ } + + if (msec_rel < -1000 || msec_rel > 1000) { + static bool warned; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0052-compositor-Support-placing-subsurface-above-or-below.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0052-compositor-Support-placing-subsurface-above-or-below.patch new file mode 100644 index 0000000000000000000000000000000000000000..b4f3218f59a698adfbdbcdeb65f6be103111205e --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0052-compositor-Support-placing-subsurface-above-or-below.patch @@ -0,0 +1,48 @@ +From 3bcea58d2349a886c7aba8941b0587647e77ca54 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 3 Nov 2021 17:52:51 +0800 +Subject: [PATCH 52/79] compositor: Support placing subsurface above or below + all siblings + +By passing itself as sibling in ::place_above or ::place_below. + +Signed-off-by: Jeffy Chen +--- + libweston/compositor.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/libweston/compositor.c b/libweston/compositor.c +index 02cb51b..9ef5669 100644 +--- a/libweston/compositor.c ++++ b/libweston/compositor.c +@@ -4748,7 +4748,12 @@ subsurface_place_above(struct wl_client *client, + if (!sub) + return; + +- sibling = subsurface_sibling_check(sub, surface, "place_above"); ++ if (surface == sub->surface) ++ sibling = container_of(sub->parent->subsurface_list.next, ++ struct weston_subsurface, parent_link); ++ else ++ sibling = subsurface_sibling_check(sub, surface, "place_above"); ++ + if (!sibling) + return; + +@@ -4772,7 +4777,12 @@ subsurface_place_below(struct wl_client *client, + if (!sub) + return; + +- sibling = subsurface_sibling_check(sub, surface, "place_below"); ++ if (surface == sub->surface) ++ sibling = container_of(sub->parent->subsurface_list.prev, ++ struct weston_subsurface, parent_link); ++ else ++ sibling = subsurface_sibling_check(sub, surface, "place_below"); ++ + if (!sibling) + return; + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0053-gl-renderer-dmabuf-Support-NV12-AFBC-and-NV12_10-AFB.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0053-gl-renderer-dmabuf-Support-NV12-AFBC-and-NV12_10-AFB.patch new file mode 100644 index 0000000000000000000000000000000000000000..f9ad8f9e03e7e230ca788356811ee7f803cc869c --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0053-gl-renderer-dmabuf-Support-NV12-AFBC-and-NV12_10-AFB.patch @@ -0,0 +1,58 @@ +From d7e3f87bca25242f475a507ddbdfa37d358a7947 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 15 Nov 2021 15:12:54 +0800 +Subject: [PATCH 53/79] gl-renderer: dmabuf: Support NV12(AFBC) and + NV12_10(AFBC) + +Support importing DRM_FORMAT_YUV420_(8|10)BIT dmabuf. + +Tested on RK356x with: +gst-play-1.0 video.mp4 --videosink=waylandsink + +Signed-off-by: Jeffy Chen +--- + libweston/renderer-gl/gl-renderer.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c +index a059f36..ac79edd 100644 +--- a/libweston/renderer-gl/gl-renderer.c ++++ b/libweston/renderer-gl/gl-renderer.c +@@ -63,6 +63,14 @@ + + #define BUFFER_DAMAGE_COUNT 2 + ++#ifndef DRM_FORMAT_YUV420_8BIT ++#define DRM_FORMAT_YUV420_8BIT fourcc_code('Y', 'U', '0', '8') ++#endif ++ ++#ifndef DRM_FORMAT_YUV420_10BIT ++#define DRM_FORMAT_YUV420_10BIT fourcc_code('Y', 'U', '1', '0') ++#endif ++ + enum gl_border_status { + BORDER_STATUS_CLEAN = 0, + BORDER_TOP_DIRTY = 1 << GL_RENDERER_BORDER_TOP, +@@ -2717,6 +2725,8 @@ choose_texture_target(struct gl_renderer *gr, + return GL_TEXTURE_EXTERNAL_OES; + + switch (attributes->format & ~DRM_FORMAT_BIG_ENDIAN) { ++ case DRM_FORMAT_YUV420_8BIT: ++ case DRM_FORMAT_YUV420_10BIT: + case DRM_FORMAT_YUYV: + case DRM_FORMAT_YVYU: + case DRM_FORMAT_UYVY: +@@ -2909,6 +2919,10 @@ dmabuf_is_opaque(struct linux_dmabuf_buffer *dmabuf) + { + const struct pixel_format_info *info; + ++ if (dmabuf->attributes.format == DRM_FORMAT_YUV420_8BIT || ++ dmabuf->attributes.format == DRM_FORMAT_YUV420_10BIT) ++ return true; ++ + info = pixel_format_get_info(dmabuf->attributes.format & + ~DRM_FORMAT_BIG_ENDIAN); + if (!info) +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0054-pixman-renderer-Allow-DRM_FORMAT_ABGR8888-and-DRM_FO.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0054-pixman-renderer-Allow-DRM_FORMAT_ABGR8888-and-DRM_FO.patch new file mode 100644 index 0000000000000000000000000000000000000000..fc8a2516c01245430e0b0a512ea560b1bddf2051 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0054-pixman-renderer-Allow-DRM_FORMAT_ABGR8888-and-DRM_FO.patch @@ -0,0 +1,31 @@ +From e1a6370b5c78314651320950e2c36919696e8ee2 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 12 Jan 2022 18:22:03 +0800 +Subject: [PATCH 54/79] pixman-renderer: Allow DRM_FORMAT_ABGR8888 and + DRM_FORMAT_XBGR8888 + +Signed-off-by: Jeffy Chen +--- + libweston/backend-drm/drm.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index d9beca0..64d12a5 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -1614,6 +1614,12 @@ drm_output_init_pixman(struct drm_output *output, struct drm_backend *b) + case DRM_FORMAT_XRGB8888: + pixman_format = PIXMAN_x8r8g8b8; + break; ++ case DRM_FORMAT_ABGR8888: ++ pixman_format = PIXMAN_a8b8g8r8; ++ break; ++ case DRM_FORMAT_XBGR8888: ++ pixman_format = PIXMAN_x8b8g8r8; ++ break; + case DRM_FORMAT_RGB565: + pixman_format = PIXMAN_r5g6b5; + break; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0055-HACK-compositor-Re-build-view-list-when-committing-a.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0055-HACK-compositor-Re-build-view-list-when-committing-a.patch new file mode 100644 index 0000000000000000000000000000000000000000..49e0632e6c62f04ec363a282645bb19fbd625774 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0055-HACK-compositor-Re-build-view-list-when-committing-a.patch @@ -0,0 +1,31 @@ +From bdb4cda8609e3da959d7fb59a0386d958ba3598b Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 22 Feb 2022 09:51:29 +0800 +Subject: [PATCH 55/79] HACK: compositor: Re-build view list when committing an + unassigned surface + +To avoid skipping repaint for unassigned surface. + +Signed-off-by: Jeffy Chen +--- + libweston/compositor.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/libweston/compositor.c b/libweston/compositor.c +index 9ef5669..6d8a878 100644 +--- a/libweston/compositor.c ++++ b/libweston/compositor.c +@@ -4038,6 +4038,10 @@ weston_surface_commit(struct weston_surface *surface) + + weston_surface_commit_subsurface_order(surface); + ++ /* HACK: Assign outputs */ ++ if (!surface->output_mask) ++ weston_compositor_build_view_list(surface->compositor, NULL); ++ + weston_surface_schedule_repaint(surface); + } + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0056-backend-drm-Remove-fb-destroy-listener-before-freein.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0056-backend-drm-Remove-fb-destroy-listener-before-freein.patch new file mode 100644 index 0000000000000000000000000000000000000000..8fdc1550e1d659525c3c25eabc001c460ae683d8 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0056-backend-drm-Remove-fb-destroy-listener-before-freein.patch @@ -0,0 +1,29 @@ +From ec0fb9badef0c305907e9fdc462c5b24f9327dfb Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 24 Feb 2022 09:25:54 +0800 +Subject: [PATCH 56/79] backend-drm: Remove fb destroy listener before freeing + it + +Fix use-after-free. + +Signed-off-by: Jeffy Chen +--- + libweston/backend-drm/fb.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libweston/backend-drm/fb.c b/libweston/backend-drm/fb.c +index 748c641..3790a73 100644 +--- a/libweston/backend-drm/fb.c ++++ b/libweston/backend-drm/fb.c +@@ -531,6 +531,8 @@ drm_fb_handle_buffer_destroy(struct wl_listener *listener, void *data) + drm_fb_unref(buf_fb->fb); + } + ++ wl_list_remove(&listener->link); ++ + free(buf_fb); + } + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0057-backend-drm-Support-getting-drm-fb-from-dmabuf-direc.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0057-backend-drm-Support-getting-drm-fb-from-dmabuf-direc.patch new file mode 100644 index 0000000000000000000000000000000000000000..06b9158526a636981da80ddbc00a289006b52756 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0057-backend-drm-Support-getting-drm-fb-from-dmabuf-direc.patch @@ -0,0 +1,88 @@ +From 1ae29ca69d05cb28e60488ba90811ff9fe5fadbf Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 7 Mar 2022 15:56:19 +0800 +Subject: [PATCH 57/79] backend-drm: Support getting drm fb from dmabuf + directly + +Try to import dmabuf to drm fb directly when GBM fd-import not working. + +Signed-off-by: Jeffy Chen +--- + libweston/backend-drm/fb.c | 46 ++++++++++++++++++++++++-------------- + 1 file changed, 29 insertions(+), 17 deletions(-) + +diff --git a/libweston/backend-drm/fb.c b/libweston/backend-drm/fb.c +index 3790a73..aba17bf 100644 +--- a/libweston/backend-drm/fb.c ++++ b/libweston/backend-drm/fb.c +@@ -224,10 +224,18 @@ drm_fb_destroy_gbm(struct gbm_bo *bo, void *data) + static void + drm_fb_destroy_dmabuf(struct drm_fb *fb) + { +- /* We deliberately do not close the GEM handles here; GBM manages +- * their lifetime through the BO. */ +- if (fb->bo) ++ if (fb->bo) { ++ /* We deliberately do not close the GEM handles here; GBM manages ++ * their lifetime through the BO. */ + gbm_bo_destroy(fb->bo); ++ } else { ++ int i; ++ for (i = 0; i < fb->num_planes; i++) { ++ struct drm_gem_close arg = { fb->handles[i], }; ++ drmIoctl(fb->fd, DRM_IOCTL_GEM_CLOSE, &arg); ++ } ++ } ++ + drm_fb_destroy(fb); + } + +@@ -293,13 +301,6 @@ drm_fb_get_from_dmabuf(struct linux_dmabuf_buffer *dmabuf, + + fb->bo = gbm_bo_import(backend->gbm, GBM_BO_IMPORT_FD_MODIFIER, + &import_mod, GBM_BO_USE_SCANOUT); +- if (!fb->bo) { +- if (try_view_on_plane_failure_reasons) +- *try_view_on_plane_failure_reasons |= +- FAILURE_REASONS_GBM_BO_IMPORT_FAILED; +- goto err_free; +- } +- + fb->width = dmabuf->attributes.width; + fb->height = dmabuf->attributes.height; + fb->modifier = dmabuf->attributes.modifier[0]; +@@ -328,13 +329,24 @@ drm_fb_get_from_dmabuf(struct linux_dmabuf_buffer *dmabuf, + } + + fb->num_planes = dmabuf->attributes.n_planes; +- for (i = 0; i < dmabuf->attributes.n_planes; i++) { +- union gbm_bo_handle handle; +- +- handle = gbm_bo_get_handle_for_plane(fb->bo, i); +- if (handle.s32 == -1) +- goto err_free; +- fb->handles[i] = handle.u32; ++ if (fb->bo) { ++ for (i = 0; i < fb->num_planes; i++) { ++ union gbm_bo_handle handle; ++ ++ handle = gbm_bo_get_handle_for_plane(fb->bo, i); ++ if (handle.s32 == -1) ++ goto err_free; ++ fb->handles[i] = handle.u32; ++ } ++ } else { ++ for (i = 0; i < fb->num_planes; i++) { ++ if (drmPrimeFDToHandle(fb->fd, import_mod.fds[i], ++ &fb->handles[i])) { ++ *try_view_on_plane_failure_reasons |= ++ FAILURE_REASONS_GBM_BO_IMPORT_FAILED; ++ goto err_free; ++ } ++ } + } + + if (drm_fb_addfb(backend, fb) != 0) { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0058-backend-drm-Allow-overriding-plane-type-when-using-a.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0058-backend-drm-Allow-overriding-plane-type-when-using-a.patch new file mode 100644 index 0000000000000000000000000000000000000000..fa4423b3f64a33ee101ac62f627b8500cf4ad013 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0058-backend-drm-Allow-overriding-plane-type-when-using-a.patch @@ -0,0 +1,89 @@ +From a67fec3ec21d323b5b0a75433df393b548be5a77 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 7 Mar 2022 17:20:59 +0800 +Subject: [PATCH 58/79] backend-drm: Allow overriding plane type when using + atomic + +Set env DRM_PLANE_TYPE_ to primary|overlay|cursor. + +Signed-off-by: Jeffy Chen +--- + libweston/backend-drm/drm-internal.h | 3 +++ + libweston/backend-drm/drm.c | 6 ++---- + libweston/backend-drm/kms.c | 29 ++++++++++++++++++++++++++++ + 3 files changed, 34 insertions(+), 4 deletions(-) + +diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h +index a2019ce..9543f1b 100644 +--- a/libweston/backend-drm/drm-internal.h ++++ b/libweston/backend-drm/drm-internal.h +@@ -758,6 +758,9 @@ drm_plane_populate_formats(struct drm_plane *plane, const drmModePlane *kplane, + void + drm_property_info_free(struct drm_property_info *info, int num_props); + ++enum wdrm_plane_type ++drm_plane_get_type(struct drm_plane *plane, drmModeObjectProperties *props); ++ + extern struct drm_property_enum_info plane_type_enums[]; + extern const struct drm_property_info plane_props[]; + extern struct drm_property_enum_info dpms_state_enums[]; +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index 64d12a5..ff41669 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -1171,10 +1171,8 @@ drm_plane_create(struct drm_backend *b, const drmModePlane *kplane) + + drm_property_info_populate(b, plane_props, plane->props, + WDRM_PLANE__COUNT, props); +- plane->type = +- drm_property_get_value(&plane->props[WDRM_PLANE_TYPE], +- props, +- WDRM_PLANE_TYPE__COUNT); ++ ++ plane->type = drm_plane_get_type(plane, props); + + plane->can_scale = + drm_property_has_feature(plane->props, +diff --git a/libweston/backend-drm/kms.c b/libweston/backend-drm/kms.c +index 47ce5c5..8f3412e 100644 +--- a/libweston/backend-drm/kms.c ++++ b/libweston/backend-drm/kms.c +@@ -457,6 +457,35 @@ drm_property_info_free(struct drm_property_info *info, int num_props) + memset(info, 0, sizeof(*info) * num_props); + } + ++enum wdrm_plane_type ++drm_plane_get_type(struct drm_plane *plane, drmModeObjectProperties *props) ++{ ++ struct drm_backend *b = plane->backend; ++ enum wdrm_plane_type type; ++ const char *env; ++ char buf[256]; ++ ++ type = drm_property_get_value(&plane->props[WDRM_PLANE_TYPE], ++ props, ++ WDRM_PLANE_TYPE__COUNT); ++ if (!b->atomic_modeset) ++ return type; ++ ++ snprintf(buf, sizeof(buf), "DRM_PLANE_TYPE_%d", plane->plane_id); ++ env = getenv(buf); ++ if (!env) ++ return type; ++ ++ if (!strcmp(env, "primary")) ++ return WDRM_PLANE_TYPE_PRIMARY; ++ else if (!strcmp(env, "overlay")) ++ return WDRM_PLANE_TYPE_OVERLAY; ++ else if (!strcmp(env, "cursor")) ++ return WDRM_PLANE_TYPE_CURSOR; ++ ++ return type; ++} ++ + static inline uint32_t * + formats_ptr(struct drm_format_modifier_blob *blob) + { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0059-pixel-formats-Support-NV15-YU08-YU10.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0059-pixel-formats-Support-NV15-YU08-YU10.patch new file mode 100644 index 0000000000000000000000000000000000000000..a86dc8058dce08d1d42943333c5fbde8b2eb5b4c --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0059-pixel-formats-Support-NV15-YU08-YU10.patch @@ -0,0 +1,62 @@ +From eaa1f13dfdd0679fbb6d48e3521a0a1d50fe9f07 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 7 Mar 2022 18:22:04 +0800 +Subject: [PATCH 59/79] pixel-formats: Support NV15/YU08/YU10 + +Only for importing dmabuf to drm fb. + +Signed-off-by: Jeffy Chen +--- + libweston/pixel-formats.c | 12 ++++++++++++ + libweston/pixel-formats.h | 12 ++++++++++++ + 2 files changed, 24 insertions(+) + +diff --git a/libweston/pixel-formats.c b/libweston/pixel-formats.c +index 85fae20..18f9c0e 100644 +--- a/libweston/pixel-formats.c ++++ b/libweston/pixel-formats.c +@@ -485,6 +485,18 @@ static const struct pixel_format_info pixel_format_table[] = { + .num_planes = 3, + .chroma_order = ORDER_VU, + }, ++ { ++ DRM_FORMAT(NV15), ++ .num_planes = 1, ++ }, ++ { ++ DRM_FORMAT(YUV420_8BIT), ++ .num_planes = 1, ++ }, ++ { ++ DRM_FORMAT(YUV420_10BIT), ++ .num_planes = 1, ++ }, + }; + + WL_EXPORT const struct pixel_format_info * +diff --git a/libweston/pixel-formats.h b/libweston/pixel-formats.h +index 0b1a5f5..4592ce3 100644 +--- a/libweston/pixel-formats.h ++++ b/libweston/pixel-formats.h +@@ -28,6 +28,18 @@ + #include + #include + ++#ifndef DRM_FORMAT_NV15 ++#define DRM_FORMAT_NV15 fourcc_code('N', 'V', '1', '5') ++#endif ++ ++#ifndef DRM_FORMAT_YUV420_8BIT ++#define DRM_FORMAT_YUV420_8BIT fourcc_code('Y', 'U', '0', '8') ++#endif ++ ++#ifndef DRM_FORMAT_YUV420_10BIT ++#define DRM_FORMAT_YUV420_10BIT fourcc_code('Y', 'U', '1', '0') ++#endif ++ + /** + * Contains information about pixel formats, mapping format codes from + * wl_shm and drm_fourcc.h (which are deliberately identical, but for the +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0060-backend-drm-Ignore-case-when-populating-drm-properti.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0060-backend-drm-Ignore-case-when-populating-drm-properti.patch new file mode 100644 index 0000000000000000000000000000000000000000..64ee2a8b55862e0b762618f3e7e252edb47b0f4c --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0060-backend-drm-Ignore-case-when-populating-drm-properti.patch @@ -0,0 +1,37 @@ +From 074ce22fa7aeaf89e83e528ad3f05c6fd68ea3d1 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Sun, 20 Mar 2022 00:32:14 +0800 +Subject: [PATCH 60/79] backend-drm: Ignore case when populating drm properties + +For BSP kernel 4.4. + +Signed-off-by: Jeffy Chen +--- + libweston/backend-drm/kms.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libweston/backend-drm/kms.c b/libweston/backend-drm/kms.c +index 8f3412e..82247fb 100644 +--- a/libweston/backend-drm/kms.c ++++ b/libweston/backend-drm/kms.c +@@ -358,7 +358,7 @@ drm_property_info_populate(struct drm_backend *b, + continue; + + for (j = 0; j < num_infos; j++) { +- if (!strcmp(prop->name, info[j].name)) ++ if (!strcasecmp(prop->name, info[j].name)) + break; + } + +@@ -412,7 +412,7 @@ drm_property_info_populate(struct drm_backend *b, + int l; + + for (l = 0; l < prop->count_enums; l++) { +- if (!strcmp(prop->enums[l].name, ++ if (!strcasecmp(prop->enums[l].name, + info[j].enum_values[k].name)) + break; + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0061-backend-drm-Stop-disabling-unused-CRTCs-by-default.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0061-backend-drm-Stop-disabling-unused-CRTCs-by-default.patch new file mode 100644 index 0000000000000000000000000000000000000000..c5f3bfd47157af7b740bf81bbd90d9de46f38712 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0061-backend-drm-Stop-disabling-unused-CRTCs-by-default.patch @@ -0,0 +1,87 @@ +From fc3415733e84b0f9f635b793a0ab18d6fcb8a727 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 27 Apr 2022 15:17:39 +0800 +Subject: [PATCH 61/79] backend-drm: Stop disabling unused CRTCs by default + +So that we can launch multiple weston instances for different monitors. + +Set env "WESTON_DRM_MASTER" to take charge of all CRTCs again. + +Signed-off-by: Jeffy Chen +--- + libweston/backend-drm/drm-internal.h | 1 + + libweston/backend-drm/drm.c | 7 +++++++ + libweston/backend-drm/kms.c | 6 +++--- + 3 files changed, 11 insertions(+), 3 deletions(-) + +diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h +index 9543f1b..8035826 100644 +--- a/libweston/backend-drm/drm-internal.h ++++ b/libweston/backend-drm/drm-internal.h +@@ -340,6 +340,7 @@ struct drm_backend { + int64_t last_resize_ms; + int64_t resize_freeze_ms; + ++ bool master; + bool single_head; + bool head_fallback; + bool head_fallback_all; +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index ff41669..ed28956 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -2251,6 +2251,9 @@ drm_output_detach_crtc(struct drm_output *output) + /* Force resetting unused CRTCs */ + b->state_invalid = true; + output->state_invalid = true; ++ ++ /* HACK: Do it here rather than in the kms.c for drm-master config */ ++ drmModeSetCrtc(b->drm.fd, crtc->crtc_id, 0, 0, 0, NULL, 0, NULL); + } + + static int +@@ -4120,6 +4123,10 @@ drm_backend_create(struct weston_compositor *compositor, + if (b == NULL) + return NULL; + ++ buf = getenv("WESTON_DRM_MASTER"); ++ if (buf && buf[0] == '1') ++ b->master = true; ++ + buf = getenv("WESTON_DRM_SINGLE_HEAD"); + if (buf && buf[0] == '1') + b->single_head = true; +diff --git a/libweston/backend-drm/kms.c b/libweston/backend-drm/kms.c +index 82247fb..37da3f6 100644 +--- a/libweston/backend-drm/kms.c ++++ b/libweston/backend-drm/kms.c +@@ -1190,7 +1190,7 @@ drm_pending_state_apply_atomic(struct drm_pending_state *pending_state, + break; + } + +- if (b->state_invalid) { ++ if (b->state_invalid && b->master) { + struct weston_head *head_base; + struct drm_head *head; + struct drm_crtc *crtc; +@@ -1388,7 +1388,7 @@ drm_pending_state_apply(struct drm_pending_state *pending_state) + return drm_pending_state_apply_atomic(pending_state, + DRM_STATE_APPLY_ASYNC); + +- if (b->state_invalid) { ++ if (b->state_invalid && b->master) { + /* If we need to reset all our state (e.g. because we've + * just started, or just been VT-switched in), explicitly + * disable all the CRTCs we aren't using. This also disables +@@ -1455,7 +1455,7 @@ drm_pending_state_apply_sync(struct drm_pending_state *pending_state) + return drm_pending_state_apply_atomic(pending_state, + DRM_STATE_APPLY_SYNC); + +- if (b->state_invalid) { ++ if (b->state_invalid && b->master) { + /* If we need to reset all our state (e.g. because we've + * just started, or just been VT-switched in), explicitly + * disable all the CRTCs we aren't using. This also disables +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0062-Revert-gl-renderer-require-GL_EXT_unpack_subimage.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0062-Revert-gl-renderer-require-GL_EXT_unpack_subimage.patch new file mode 100644 index 0000000000000000000000000000000000000000..d35efaf4cc96a1bdd76075da503bc2bab0dd0667 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0062-Revert-gl-renderer-require-GL_EXT_unpack_subimage.patch @@ -0,0 +1,94 @@ +From 363ab921c577c045cc50b2e90eeca1cfc4abcaee Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 27 Apr 2022 22:59:32 +0800 +Subject: [PATCH 62/79] Revert "gl-renderer: require GL_EXT_unpack_subimage" + +This reverts commit 593d5af43a8e2c2a3371088fa7ae430d0517c82d. + +For old mali, e.g. utgard. + +Signed-off-by: Jeffy Chen +--- + libweston/renderer-gl/gl-renderer-internal.h | 2 ++ + libweston/renderer-gl/gl-renderer.c | 30 ++++++++++++++++---- + 2 files changed, 26 insertions(+), 6 deletions(-) + +diff --git a/libweston/renderer-gl/gl-renderer-internal.h b/libweston/renderer-gl/gl-renderer-internal.h +index e7e1693..ebeaadb 100644 +--- a/libweston/renderer-gl/gl-renderer-internal.h ++++ b/libweston/renderer-gl/gl-renderer-internal.h +@@ -133,6 +133,8 @@ struct gl_renderer { + PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC create_platform_window; + bool has_platform_base; + ++ bool has_unpack_subimage; ++ + PFNEGLBINDWAYLANDDISPLAYWL bind_display; + PFNEGLUNBINDWAYLANDDISPLAYWL unbind_display; + PFNEGLQUERYWAYLANDBUFFERWL query_buffer; +diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c +index ac79edd..c0863c1 100644 +--- a/libweston/renderer-gl/gl-renderer.c ++++ b/libweston/renderer-gl/gl-renderer.c +@@ -1920,8 +1920,8 @@ gl_renderer_flush_damage(struct weston_surface *surface) + { + const struct weston_testsuite_quirks *quirks = + &surface->compositor->test_data.test_quirks; +- struct gl_surface_state *gs = get_surface_state(surface); + struct gl_renderer *gr = get_renderer(surface->compositor); ++ struct gl_surface_state *gs = get_surface_state(surface); + struct weston_buffer *buffer = gs->buffer_ref.buffer; + struct weston_view *view; + bool texture_used; +@@ -1962,6 +1962,24 @@ gl_renderer_flush_damage(struct weston_surface *surface) + + glActiveTexture(GL_TEXTURE0); + ++ if (!gr->has_unpack_subimage) { ++ wl_shm_buffer_begin_access(buffer->shm_buffer); ++ for (j = 0; j < gs->num_textures; j++) { ++ glBindTexture(GL_TEXTURE_2D, gs->textures[j]); ++ glTexImage2D(GL_TEXTURE_2D, 0, ++ gs->gl_format[j], ++ gs->pitch / gs->hsub[j], ++ buffer->height / gs->vsub[j], ++ 0, ++ gl_format_from_internal(gs->gl_format[j]), ++ gs->gl_pixel_type, ++ data + gs->offset[j]); ++ } ++ wl_shm_buffer_end_access(buffer->shm_buffer); ++ ++ goto done; ++ } ++ + if (gs->needs_full_upload || quirks->gl_force_full_upload) { + glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, 0); + glPixelStorei(GL_UNPACK_SKIP_ROWS_EXT, 0); +@@ -4087,11 +4105,9 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface) + else + ec->read_format = PIXMAN_a8b8g8r8; + +- if (gr->gl_version < gr_gl_version(3, 0) && +- !weston_check_egl_extension(extensions, "GL_EXT_unpack_subimage")) { +- weston_log("GL_EXT_unpack_subimage not available.\n"); +- return -1; +- } ++ if (gr->gl_version >= gr_gl_version(3, 0) || ++ weston_check_egl_extension(extensions, "GL_EXT_unpack_subimage")) ++ gr->has_unpack_subimage = true; + + if (gr->gl_version >= gr_gl_version(3, 0) || + weston_check_egl_extension(extensions, "GL_EXT_texture_type_2_10_10_10_REV")) +@@ -4132,6 +4148,8 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface) + gr_gl_version_minor(gr->gl_version)); + weston_log_continue(STAMP_SPACE "read-back format: %s\n", + ec->read_format == PIXMAN_a8r8g8b8 ? "BGRA" : "RGBA"); ++ weston_log_continue(STAMP_SPACE "wl_shm sub-image to texture: %s\n", ++ gr->has_unpack_subimage ? "yes" : "no"); + weston_log_continue(STAMP_SPACE "EGL Wayland extension: %s\n", + gr->has_bind_display ? "yes" : "no"); + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0063-HACK-clients-Drop-dmabuf-feedback.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0063-HACK-clients-Drop-dmabuf-feedback.patch new file mode 100644 index 0000000000000000000000000000000000000000..8841196a23f5bb3805517b73194985fc5bfebb58 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0063-HACK-clients-Drop-dmabuf-feedback.patch @@ -0,0 +1,76 @@ +From b1bd49d963d6c7cb8e36d0a030a1119ef23dc641 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 16 May 2022 15:54:21 +0800 +Subject: [PATCH 63/79] HACK: clients: Drop dmabuf-feedback + +We don't need it. + +Signed-off-by: Jeffy Chen +--- + clients/meson.build | 50 ++++++++++++++++++++++----------------------- + 1 file changed, 25 insertions(+), 25 deletions(-) + +diff --git a/clients/meson.build b/clients/meson.build +index 362f7fe..ff8374f 100644 +--- a/clients/meson.build ++++ b/clients/meson.build +@@ -53,31 +53,31 @@ simple_clients = [ + ], + 'dep_objs': [ dep_wayland_client, dep_libshared ] + }, +- { +- 'name': 'dmabuf-feedback', +- 'sources': [ +- 'simple-dmabuf-feedback.c', +- '../libweston/pixel-formats.c', +- linux_dmabuf_unstable_v1_client_protocol_h, +- linux_dmabuf_unstable_v1_protocol_c, +- xdg_shell_client_protocol_h, +- xdg_shell_protocol_c, +- ], +- 'dep_objs': [ +- dep_wayland_client, +- dep_libshared, +- dep_pixman, +- dep_libdrm, +- dependency('libudev', version: '>= 136'), +- # gbm_bo_get_fd_for_plane() from 21.1.0 +- dependency('gbm', version: '>= 21.1.1', +- required: simple_build_all or simple_clients_enabled.contains('dmabuf-feedback'), +- not_found_message: 'dmabuf-feedback requires gbm which was not found. If you rather not build this, drop "dmabuf-feedback" from simple-clients option.', +- disabler: true) +- ], +- 'deps': [ 'egl', 'glesv2', 'gbm' ], +- 'options': [ 'renderer-gl' ] +- }, ++# { ++# 'name': 'dmabuf-feedback', ++# 'sources': [ ++# 'simple-dmabuf-feedback.c', ++# '../libweston/pixel-formats.c', ++# linux_dmabuf_unstable_v1_client_protocol_h, ++# linux_dmabuf_unstable_v1_protocol_c, ++# xdg_shell_client_protocol_h, ++# xdg_shell_protocol_c, ++# ], ++# 'dep_objs': [ ++# dep_wayland_client, ++# dep_libshared, ++# dep_pixman, ++# dep_libdrm, ++# dependency('libudev', version: '>= 136'), ++# # gbm_bo_get_fd_for_plane() from 21.1.0 ++# dependency('gbm', version: '>= 21.1.1', ++# required: simple_build_all or simple_clients_enabled.contains('dmabuf-feedback'), ++# not_found_message: 'dmabuf-feedback requires gbm which was not found. If you rather not build this, drop "dmabuf-feedback" from simple-clients option.', ++# disabler: true) ++# ], ++# 'deps': [ 'egl', 'glesv2', 'gbm' ], ++# 'options': [ 'renderer-gl' ] ++# }, + { + 'name': 'dmabuf-egl', + 'sources': [ +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0064-compositor-Use-current-timestamp-for-animation.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0064-compositor-Use-current-timestamp-for-animation.patch new file mode 100644 index 0000000000000000000000000000000000000000..92007aab5b5b8b0f90e95a519b3a3fb720262863 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0064-compositor-Use-current-timestamp-for-animation.patch @@ -0,0 +1,40 @@ +From f773de2eacbe734d762a0a0312d19395d69c37f9 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 27 May 2022 15:39:10 +0800 +Subject: [PATCH 64/79] compositor: Use current timestamp for animation + +Avoid "unexpectedly large timestamp jump" warning for the first frame of +animation. + +Signed-off-by: Jeffy Chen +--- + libweston/compositor.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/libweston/compositor.c b/libweston/compositor.c +index 6d8a878..7db212f 100644 +--- a/libweston/compositor.c ++++ b/libweston/compositor.c +@@ -2954,6 +2954,7 @@ weston_output_repaint(struct weston_output *output, void *repaint_data) + int r; + uint32_t frame_time_msec; + enum weston_hdcp_protection highest_requested = WESTON_HDCP_DISABLE; ++ struct timespec now; + + if (output->destroying) + return 0; +@@ -3042,9 +3043,10 @@ weston_output_repaint(struct weston_output *output, void *repaint_data) + wl_resource_destroy(cb); + } + ++ weston_compositor_read_presentation_clock(ec, &now); + wl_list_for_each_safe(animation, next, &output->animation_list, link) { + animation->frame_counter++; +- animation->frame(animation, output, &output->frame_time); ++ animation->frame(animation, output, &now); + } + + TL_POINT(ec, "core_repaint_posted", TLP_OUTPUT(output), TLP_END); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0065-desktop-shell-Fix-crash-when-activating-destroyed-de.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0065-desktop-shell-Fix-crash-when-activating-destroyed-de.patch new file mode 100644 index 0000000000000000000000000000000000000000..64e9cd2accc6ba1bbd55b511a6d6652a51a0a5c5 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0065-desktop-shell-Fix-crash-when-activating-destroyed-de.patch @@ -0,0 +1,31 @@ +From 04105af49099660b4ecdeedee5c4b40e8bc9ae04 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 31 May 2022 12:32:18 +0800 +Subject: [PATCH 65/79] desktop-shell: Fix crash when activating destroyed + desktop surface + +Tested with Qt's Windows Flags Example, by switching between Popup and +Tool repeatedly. + +Signed-off-by: Jeffy Chen +--- + desktop-shell/shell.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c +index f572f8f..0643418 100644 +--- a/desktop-shell/shell.c ++++ b/desktop-shell/shell.c +@@ -3811,7 +3811,8 @@ activate(struct desktop_shell *shell, struct weston_view *view, + + main_surface = weston_surface_get_main_surface(es); + shsurf = get_shell_surface(main_surface); +- assert(shsurf); ++ if (!shsurf) ++ return; + + shsurf_child = get_last_child(shsurf); + if (shsurf_child) { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0066-desktop-shell-Delay-locking-when-having-pending-fade.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0066-desktop-shell-Delay-locking-when-having-pending-fade.patch new file mode 100644 index 0000000000000000000000000000000000000000..00e8b260827deb2916009002289f3d44e026b75d --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0066-desktop-shell-Delay-locking-when-having-pending-fade.patch @@ -0,0 +1,80 @@ +From f938f8c7d225535ad41058e38b699cb712a3eb03 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 1 Jun 2022 11:28:24 +0800 +Subject: [PATCH 66/79] desktop-shell: Delay locking when having pending + fade-out animations + +Avoid "unexpectedly large timestamp jump" warning when resuming with +multi-head. + +Signed-off-by: Jeffy Chen +--- + desktop-shell/shell.c | 14 +++++++++++++- + include/libweston/libweston.h | 1 + + 2 files changed, 14 insertions(+), 1 deletion(-) + +diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c +index 0643418..eca22c6 100644 +--- a/desktop-shell/shell.c ++++ b/desktop-shell/shell.c +@@ -4018,18 +4018,24 @@ shell_fade_done_for_output(struct weston_view_animation *animation, void *data) + { + struct shell_output *shell_output = data; + struct desktop_shell *shell = shell_output->shell; ++ struct weston_compositor *compositor = shell->compositor; ++ ++ if (shell_output->fade.type == FADE_OUT) ++ shell->compositor->pending_fade_out --; + + if (!shell_output->fade.view) + return; + + shell_output->fade.animation = NULL; ++ + switch (shell_output->fade.type) { + case FADE_IN: + weston_surface_destroy(shell_output->fade.view->surface); + shell_output->fade.view = NULL; + break; + case FADE_OUT: +- lock(shell); ++ if (!compositor->pending_fade_out) ++ lock(shell); + break; + default: + break; +@@ -4131,6 +4137,9 @@ shell_fade(struct desktop_shell *shell, enum fade_type type) + } else if (shell_output->fade.animation) { + weston_fade_update(shell_output->fade.animation, tint); + } else { ++ if (type == FADE_OUT) ++ shell->compositor->pending_fade_out ++; ++ + shell_output->fade.animation = + weston_fade_run(shell_output->fade.view, + 1.0 - tint, tint, 300.0, +@@ -4878,6 +4887,9 @@ shell_output_destroy(struct shell_output *shell_output) + if (shell_output->fade.animation) { + weston_view_animation_destroy(shell_output->fade.animation); + shell_output->fade.animation = NULL; ++ ++ if (shell_output->fade.type == FADE_OUT) ++ shell->compositor->pending_fade_out --; + } + + if (shell_output->fade.view) { +diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h +index 4e8bfec..74dec9d 100644 +--- a/include/libweston/libweston.h ++++ b/include/libweston/libweston.h +@@ -1207,6 +1207,7 @@ struct weston_compositor { + struct weston_output *prefer_output; + + bool warm_up; ++ uint32_t pending_fade_out; + }; + + struct weston_buffer { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0067-compositor-Fix-damage-tracking-error-when-overlapped.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0067-compositor-Fix-damage-tracking-error-when-overlapped.patch new file mode 100644 index 0000000000000000000000000000000000000000..80fac56a5a987897041c6289d1e909656fb327d9 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0067-compositor-Fix-damage-tracking-error-when-overlapped.patch @@ -0,0 +1,120 @@ +From 4ad42486d8c95f316c25d3c0c5d7b7bd16a71e81 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 2 Jun 2022 18:22:38 +0800 +Subject: [PATCH 67/79] compositor: Fix damage tracking error when overlapped + outputs + +Signed-off-by: Jeffy Chen +--- + include/libweston/libweston.h | 2 ++ + libweston/compositor.c | 32 ++++++++++++++++++++++++++------ + 2 files changed, 28 insertions(+), 6 deletions(-) + +diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h +index 74dec9d..26804e2 100644 +--- a/include/libweston/libweston.h ++++ b/include/libweston/libweston.h +@@ -326,6 +326,8 @@ struct weston_output { + /** For cancelling the idle_repaint callback on output destruction. */ + struct wl_event_source *idle_repaint_source; + ++ pixman_region32_t damage; ++ + struct weston_output_zoom zoom; + int dirty; + struct wl_signal frame_signal; +diff --git a/libweston/compositor.c b/libweston/compositor.c +index 7db212f..fc8cef3 100644 +--- a/libweston/compositor.c ++++ b/libweston/compositor.c +@@ -1113,6 +1113,22 @@ weston_view_move_to_plane(struct weston_view *view, + weston_surface_damage(view->surface); + } + ++static void ++weston_add_damage(struct weston_compositor *compositor, ++ struct weston_plane *plane, pixman_region32_t *damage) ++{ ++ struct weston_output *output; ++ ++ if (plane) ++ pixman_region32_union(&plane->damage, &plane->damage, damage); ++ ++ if (plane != &compositor->primary_plane) ++ return; ++ ++ wl_list_for_each(output, &compositor->output_list, link) ++ pixman_region32_union(&output->damage, &output->damage, damage); ++} ++ + /** Inflict damage on the plane where the view is visible. + * + * \param view The view that causes the damage. +@@ -1137,9 +1153,7 @@ weston_view_damage_below(struct weston_view *view) + pixman_region32_init(&damage); + pixman_region32_subtract(&damage, &view->transform.boundingbox, + &view->clip); +- if (view->plane) +- pixman_region32_union(&view->plane->damage, +- &view->plane->damage, &damage); ++ weston_add_damage(view->surface->compositor, view->plane, &damage); + pixman_region32_fini(&damage); + weston_view_schedule_repaint(view); + } +@@ -2611,6 +2625,7 @@ weston_output_damage(struct weston_output *output) + pixman_region32_union(&compositor->primary_plane.damage, + &compositor->primary_plane.damage, + &output->region); ++ pixman_region32_copy(&output->damage, &output->region); + weston_output_schedule_repaint(output); + } + +@@ -2649,8 +2664,7 @@ view_accumulate_damage(struct weston_view *view, + pixman_region32_intersect(&damage, &damage, + &view->transform.boundingbox); + pixman_region32_subtract(&damage, &damage, opaque); +- pixman_region32_union(&view->plane->damage, +- &view->plane->damage, &damage); ++ weston_add_damage(view->surface->compositor, view->plane, &damage); + pixman_region32_fini(&damage); + pixman_region32_copy(&view->clip, opaque); + pixman_region32_union(opaque, opaque, &view->transform.opaque); +@@ -3017,7 +3031,7 @@ weston_output_repaint(struct weston_output *output, void *repaint_data) + + pixman_region32_init(&output_damage); + pixman_region32_intersect(&output_damage, +- &ec->primary_plane.damage, &output->region); ++ &output->damage, &output->region); + pixman_region32_subtract(&output_damage, + &output_damage, &ec->primary_plane.clip); + +@@ -3027,6 +3041,10 @@ weston_output_repaint(struct weston_output *output, void *repaint_data) + output->repaint_needed = false; + r = output->repaint(output, &output_damage, repaint_data); + ++ /* Clear painted primary damage */ ++ pixman_region32_intersect(&output->damage, ++ &output->damage, &ec->primary_plane.damage); ++ + pixman_region32_fini(&output_damage); + + if (output->repaint_needed) +@@ -6767,6 +6785,7 @@ weston_output_init(struct weston_output *output, + + output->down_scale = 1.0f; + ++ pixman_region32_init(&output->damage); + pixman_region32_init(&output->region); + wl_list_init(&output->mode_list); + } +@@ -7082,6 +7101,7 @@ weston_output_release(struct weston_output *output) + + weston_color_profile_unref(output->color_profile); + ++ pixman_region32_fini(&output->damage); + pixman_region32_fini(&output->region); + wl_list_remove(&output->link); + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0068-desktop-shell-Support-setting-panel-scale-in-weston..patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0068-desktop-shell-Support-setting-panel-scale-in-weston..patch new file mode 100644 index 0000000000000000000000000000000000000000..8d8a08e652c33e99772f92d86dab3956e9786c29 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0068-desktop-shell-Support-setting-panel-scale-in-weston..patch @@ -0,0 +1,160 @@ +From a9aadf9c310805dd43866c494b01ce891158eedd Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 2 Jun 2022 19:00:40 +0800 +Subject: [PATCH 68/79] desktop-shell: Support setting panel scale in + weston.ini + +Tested with: +[shell] +panel-scale=2 + +Signed-off-by: Jeffy Chen +--- + clients/desktop-shell.c | 41 ++++++++++++++++++++++++++--------------- + 1 file changed, 26 insertions(+), 15 deletions(-) + +diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c +index 6cf21da..a81eb0a 100644 +--- a/clients/desktop-shell.c ++++ b/clients/desktop-shell.c +@@ -109,6 +109,7 @@ struct panel { + enum weston_desktop_shell_panel_position panel_position; + enum clock_format clock_format; + uint32_t color; ++ double scale; + }; + + struct background { +@@ -242,17 +243,18 @@ panel_launcher_redraw_handler(struct widget *widget, void *data) + { + struct panel_launcher *launcher = data; + struct rectangle allocation; ++ double scale = launcher->panel->scale; + cairo_t *cr; + + cr = widget_cairo_create(launcher->panel->widget); + + widget_get_allocation(widget, &allocation); + allocation.x += allocation.width / 2 - +- cairo_image_surface_get_width(launcher->icon) / 2; ++ cairo_image_surface_get_width(launcher->icon) * scale / 2; + if (allocation.width > allocation.height) + allocation.x += allocation.width / 2 - allocation.height / 2; + allocation.y += allocation.height / 2 - +- cairo_image_surface_get_height(launcher->icon) / 2; ++ cairo_image_surface_get_height(launcher->icon) * scale / 2; + if (allocation.height > allocation.width) + allocation.y += allocation.height / 2 - allocation.width / 2; + if (launcher->pressed) { +@@ -260,14 +262,15 @@ panel_launcher_redraw_handler(struct widget *widget, void *data) + allocation.y++; + } + ++ cairo_scale(cr, scale, scale); + cairo_set_source_surface(cr, launcher->icon, +- allocation.x, allocation.y); ++ allocation.x / scale, allocation.y / scale); + cairo_paint(cr); + + if (launcher->focused) { + cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, 0.4); + cairo_mask_surface(cr, launcher->icon, +- allocation.x, allocation.y); ++ allocation.x / scale, allocation.y / scale); + } + + cairo_destroy(cr); +@@ -394,6 +397,8 @@ panel_clock_redraw_handler(struct widget *widget, void *data) + time_t rawtime; + struct tm * timeinfo; + char string[128]; ++ double scale = clock->panel->scale; ++ int spacing = DEFAULT_SPACING * scale; + + time(&rawtime); + timeinfo = localtime(&rawtime); +@@ -404,11 +409,11 @@ panel_clock_redraw_handler(struct widget *widget, void *data) + return; + + cr = widget_cairo_create(clock->panel->widget); +- cairo_set_font_size(cr, 14); ++ cairo_set_font_size(cr, 14 * scale); + cairo_text_extents(cr, string, &extents); + if (allocation.x > 0) + allocation.x += +- allocation.width - DEFAULT_SPACING * 1.5 - extents.width; ++ allocation.width - spacing * 1.5 - extents.width; + else + allocation.x += + allocation.width / 2 - extents.width / 2; +@@ -499,8 +504,10 @@ panel_resize_handler(struct widget *widget, + int w = height > width ? width : height; + int h = w; + int horizontal = panel->panel_position == WESTON_DESKTOP_SHELL_PANEL_POSITION_TOP || panel->panel_position == WESTON_DESKTOP_SHELL_PANEL_POSITION_BOTTOM; +- int first_pad_h = horizontal ? 0 : DEFAULT_SPACING / 2; +- int first_pad_w = horizontal ? DEFAULT_SPACING / 2 : 0; ++ double scale = panel->scale; ++ int spacing = DEFAULT_SPACING * scale; ++ int first_pad_h = horizontal ? 0 : spacing / 2; ++ int first_pad_w = horizontal ? spacing / 2 : 0; + + wl_list_for_each(launcher, &panel->launcher_list, link) { + widget_set_allocation(launcher->widget, x, y, +@@ -513,14 +520,14 @@ panel_resize_handler(struct widget *widget, + } + + if (panel->clock_format == CLOCK_FORMAT_SECONDS) +- w = 170; ++ w = 170 * scale; + else /* CLOCK_FORMAT_MINUTES and 24H versions */ +- w = 150; ++ w = 150 * scale; + + if (horizontal) + x = width - w; + else +- y = height - (h = DEFAULT_SPACING * 3); ++ y = height - (h = spacing * 3); + + if (panel->clock) + widget_set_allocation(panel->clock->widget, +@@ -552,21 +559,21 @@ panel_configure(void *data, + switch (desktop->panel_position) { + case WESTON_DESKTOP_SHELL_PANEL_POSITION_TOP: + case WESTON_DESKTOP_SHELL_PANEL_POSITION_BOTTOM: +- height = 32; ++ height = 32 * panel->scale; + break; + case WESTON_DESKTOP_SHELL_PANEL_POSITION_LEFT: + case WESTON_DESKTOP_SHELL_PANEL_POSITION_RIGHT: + switch (desktop->clock_format) { + case CLOCK_FORMAT_NONE: +- width = 32; ++ width = 32 * panel->scale; + break; + case CLOCK_FORMAT_MINUTES: + case CLOCK_FORMAT_MINUTES_24H: + case CLOCK_FORMAT_SECONDS_24H: +- width = 150; ++ width = 150 * panel->scale; + break; + case CLOCK_FORMAT_SECONDS: +- width = 170; ++ width = 170 * panel->scale; + break; + } + break; +@@ -636,6 +643,10 @@ panel_create(struct desktop *desktop, struct output *output) + s = weston_config_get_section(desktop->config, "shell", NULL, NULL); + weston_config_section_get_color(s, "panel-color", + &panel->color, 0xaa000000); ++ weston_config_section_get_double(s, "panel-scale", ++ &panel->scale, 1.0f); ++ if (!panel->scale) ++ panel->scale = 1.0f; + + panel_add_launchers(panel, desktop); + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0069-desktop-shell-Fix-crash-when-destroying-uncommited-s.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0069-desktop-shell-Fix-crash-when-destroying-uncommited-s.patch new file mode 100644 index 0000000000000000000000000000000000000000..28221b761c5a64abd208bfd8edf4226caea41d08 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0069-desktop-shell-Fix-crash-when-destroying-uncommited-s.patch @@ -0,0 +1,31 @@ +From 4d4a99035f99231633d4bc281780d2a1ad66ed28 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 8 Jun 2022 09:53:19 +0800 +Subject: [PATCH 69/79] desktop-shell: Fix crash when destroying uncommited + surface + +By adding a sanity check for it's wsurface_anim_fade. + +Signed-off-by: Jeffy Chen +--- + desktop-shell/shell.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c +index eca22c6..bea4d1d 100644 +--- a/desktop-shell/shell.c ++++ b/desktop-shell/shell.c +@@ -275,7 +275,9 @@ desktop_shell_destroy_surface(struct shell_surface *shsurf) + weston_view_destroy(shsurf->view); + + wl_signal_emit(&shsurf->destroy_signal, shsurf); +- weston_surface_destroy(shsurf->wsurface_anim_fade); ++ ++ if (shsurf->wsurface_anim_fade) ++ weston_surface_destroy(shsurf->wsurface_anim_fade); + + if (shsurf->output_destroy_listener.notify) { + wl_list_remove(&shsurf->output_destroy_listener.link); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0070-desktop-shell-Support-clock-without-date.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0070-desktop-shell-Support-clock-without-date.patch new file mode 100644 index 0000000000000000000000000000000000000000..0b30b3fbc81d0f492411e849db5c362058079831 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0070-desktop-shell-Support-clock-without-date.patch @@ -0,0 +1,175 @@ +From d7c6d93ed8b27f2dc12dd4f918a255318df505c4 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 15 Jun 2022 11:02:44 +0800 +Subject: [PATCH 70/79] desktop-shell: Support clock without date + +Tested with: +[shell] +clock-with-date=false + +Signed-off-by: Jeffy Chen +--- + clients/desktop-shell.c | 73 ++++++++++++++++++++++++++++------------- + 1 file changed, 50 insertions(+), 23 deletions(-) + +diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c +index a81eb0a..b2414be 100644 +--- a/clients/desktop-shell.c ++++ b/clients/desktop-shell.c +@@ -75,6 +75,7 @@ struct desktop { + int want_panel; + enum weston_desktop_shell_panel_position panel_position; + enum clock_format clock_format; ++ bool clock_with_date; + + struct window *grab_window; + struct widget *grab_widget; +@@ -108,6 +109,7 @@ struct panel { + int painted; + enum weston_desktop_shell_panel_position panel_position; + enum clock_format clock_format; ++ bool clock_with_date; + uint32_t color; + double scale; + }; +@@ -154,7 +156,7 @@ struct panel_clock { + struct widget *widget; + struct panel *panel; + struct toytimer timer; +- char *format_string; ++ char format_string[128]; + time_t refresh_timer; + }; + +@@ -167,6 +169,36 @@ struct unlock_dialog { + struct desktop *desktop; + }; + ++static int ++clock_get_preferred_width(enum clock_format clock_format, bool with_date) ++{ ++ int width; ++ ++ switch (clock_format) { ++ case CLOCK_FORMAT_NONE: ++ return 0; ++ case CLOCK_FORMAT_MINUTES: ++ width = 160; ++ break; ++ case CLOCK_FORMAT_MINUTES_24H: ++ width = 130; ++ break; ++ case CLOCK_FORMAT_SECONDS: ++ width = 180; ++ break; ++ case CLOCK_FORMAT_SECONDS_24H: ++ width = 160; ++ break; ++ default: ++ assert(!"not reached"); ++ } ++ ++ if (!with_date) ++ width -= 80; ++ ++ return width; ++} ++ + static void + panel_add_launchers(struct panel *panel, struct desktop *desktop); + +@@ -413,7 +445,7 @@ panel_clock_redraw_handler(struct widget *widget, void *data) + cairo_text_extents(cr, string, &extents); + if (allocation.x > 0) + allocation.x += +- allocation.width - spacing * 1.5 - extents.width; ++ allocation.width - spacing - extents.width; + else + allocation.x += + allocation.width / 2 - extents.width / 2; +@@ -464,21 +496,24 @@ panel_add_clock(struct panel *panel) + clock->panel = panel; + panel->clock = clock; + ++ if (panel->clock_with_date) ++ strcpy(clock->format_string, "%a %b %d, "); ++ + switch (panel->clock_format) { + case CLOCK_FORMAT_MINUTES: +- clock->format_string = "%a %b %d, %I:%M %p"; ++ strcat(clock->format_string, "%I:%M %p"); + clock->refresh_timer = 60; + break; + case CLOCK_FORMAT_SECONDS: +- clock->format_string = "%a %b %d, %I:%M:%S %p"; ++ strcat(clock->format_string, "%I:%M:%S %p"); + clock->refresh_timer = 1; + break; + case CLOCK_FORMAT_MINUTES_24H: +- clock->format_string = "%a %b %d, %H:%M"; ++ strcat(clock->format_string, "%H:%M"); + clock->refresh_timer = 60; + break; + case CLOCK_FORMAT_SECONDS_24H: +- clock->format_string = "%a %b %d, %H:%M:%S"; ++ strcat(clock->format_string, "%H:%M:%S"); + clock->refresh_timer = 1; + break; + case CLOCK_FORMAT_NONE: +@@ -519,10 +554,8 @@ panel_resize_handler(struct widget *widget, + first_pad_h = first_pad_w = 0; + } + +- if (panel->clock_format == CLOCK_FORMAT_SECONDS) +- w = 170 * scale; +- else /* CLOCK_FORMAT_MINUTES and 24H versions */ +- w = 150 * scale; ++ w = clock_get_preferred_width(panel->clock_format, ++ panel->clock_with_date) * scale; + + if (horizontal) + x = width - w; +@@ -563,19 +596,9 @@ panel_configure(void *data, + break; + case WESTON_DESKTOP_SHELL_PANEL_POSITION_LEFT: + case WESTON_DESKTOP_SHELL_PANEL_POSITION_RIGHT: +- switch (desktop->clock_format) { +- case CLOCK_FORMAT_NONE: +- width = 32 * panel->scale; +- break; +- case CLOCK_FORMAT_MINUTES: +- case CLOCK_FORMAT_MINUTES_24H: +- case CLOCK_FORMAT_SECONDS_24H: +- width = 150 * panel->scale; +- break; +- case CLOCK_FORMAT_SECONDS: +- width = 170 * panel->scale; +- break; +- } ++ width = clock_get_preferred_width(desktop->clock_format, ++ desktop->clock_with_date); ++ width = MAX(32, width) * panel->scale; + break; + } + window_schedule_resize(panel->window, width, height); +@@ -637,6 +660,7 @@ panel_create(struct desktop *desktop, struct output *output) + + panel->panel_position = desktop->panel_position; + panel->clock_format = desktop->clock_format; ++ panel->clock_with_date = desktop->clock_with_date; + if (panel->clock_format != CLOCK_FORMAT_NONE) + panel_add_clock(panel); + +@@ -1556,6 +1580,9 @@ parse_clock_format(struct desktop *desktop, struct weston_config_section *s) + else + desktop->clock_format = DEFAULT_CLOCK_FORMAT; + free(clock_format); ++ ++ weston_config_section_get_bool(s, "clock-with-date", ++ &desktop->clock_with_date, true); + } + + int main(int argc, char *argv[]) +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0071-config-parser-Strip-leading-spaces.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0071-config-parser-Strip-leading-spaces.patch new file mode 100644 index 0000000000000000000000000000000000000000..23ae33358efa416988cf1abe8b08fa793830f9ec --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0071-config-parser-Strip-leading-spaces.patch @@ -0,0 +1,47 @@ +From 26b2f84053bb90aa3b502802dc89ee0e3f4e9532 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 15 Jun 2022 12:08:39 +0800 +Subject: [PATCH 71/79] config-parser: Strip leading spaces + +Tested with: +[core] + gbm-format=argb8888 + +Signed-off-by: Jeffy Chen +--- + shared/config-parser.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/shared/config-parser.c b/shared/config-parser.c +index 7df5a3b..fd347ee 100644 +--- a/shared/config-parser.c ++++ b/shared/config-parser.c +@@ -423,7 +423,7 @@ static bool + weston_config_parse_fd(struct weston_config *config, int fd) + { + FILE *fp; +- char line[512], *p; ++ char buf[512], *line, *p; + struct stat filestat; + struct weston_config_section *section = NULL; + int i; +@@ -441,10 +441,15 @@ weston_config_parse_fd(struct weston_config *config, int fd) + if (fp == NULL) + return false; + +- while (fgets(line, sizeof line, fp)) { ++ while (fgets(buf, sizeof buf, fp)) { ++ line = buf; ++ while (isspace(*line)) ++ line++; ++ + switch (line[0]) { + case '#': + case '\n': ++ case '\0': + continue; + case '[': + p = strchr(&line[1], ']'); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0072-desktop-shell-Avoid-lowering-the-requested-fullscree.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0072-desktop-shell-Avoid-lowering-the-requested-fullscree.patch new file mode 100644 index 0000000000000000000000000000000000000000..d1ab5214f9a494fc72aec81f264e68baac8372f1 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0072-desktop-shell-Avoid-lowering-the-requested-fullscree.patch @@ -0,0 +1,86 @@ +From 9e3e9e3585879693df47719afa7bbd06f712e86b Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 24 Jun 2022 16:25:11 +0800 +Subject: [PATCH 72/79] desktop-shell: Avoid lowering the requested fullscreen + surface + +Don't lower itself. + +Signed-off-by: Jeffy Chen +--- + desktop-shell/exposay.c | 2 +- + desktop-shell/shell.c | 9 +++++---- + desktop-shell/shell.h | 3 ++- + 3 files changed, 8 insertions(+), 6 deletions(-) + +diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c +index c7c064b..0981f1a 100644 +--- a/desktop-shell/exposay.c ++++ b/desktop-shell/exposay.c +@@ -646,7 +646,7 @@ exposay_transition_active(struct desktop_shell *shell) + shell->exposay.clicked = NULL; + wl_list_init(&shell->exposay.surface_list); + +- lower_fullscreen_layer(shell, NULL); ++ lower_fullscreen_layer(shell, NULL, NULL); + shell->exposay.grab_kbd.interface = &exposay_kbd_grab; + weston_keyboard_start_grab(keyboard, + &shell->exposay.grab_kbd); +diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c +index bea4d1d..d4879b2 100644 +--- a/desktop-shell/shell.c ++++ b/desktop-shell/shell.c +@@ -3747,7 +3747,8 @@ rotate_binding(struct weston_pointer *pointer, const struct timespec *time, + * the alt-tab switcher, which need to de-promote fullscreen layers. */ + void + lower_fullscreen_layer(struct desktop_shell *shell, +- struct weston_output *lowering_output) ++ struct weston_output *lowering_output, ++ struct shell_surface *orig_shsurf) + { + struct workspace *ws; + struct weston_view *view, *prev; +@@ -3758,7 +3759,7 @@ lower_fullscreen_layer(struct desktop_shell *shell, + layer_link.link) { + struct shell_surface *shsurf = get_shell_surface(view->surface); + +- if (!shsurf) ++ if (!shsurf || shsurf == orig_shsurf) + continue; + + /* Only lower surfaces which have lowering_output as their fullscreen +@@ -3826,7 +3827,7 @@ activate(struct desktop_shell *shell, struct weston_view *view, + /* Only demote fullscreen surfaces on the output of activated shsurf. + * Leave fullscreen surfaces on unrelated outputs alone. */ + if (shsurf->output) +- lower_fullscreen_layer(shell, shsurf->output); ++ lower_fullscreen_layer(shell, shsurf->output, shsurf); + + if (view->surface->flags & SURFACE_NO_FOCUS) + goto no_focus; +@@ -4657,7 +4658,7 @@ switcher_binding(struct weston_keyboard *keyboard, const struct timespec *time, + wl_list_init(&switcher->listener.link); + wl_array_init(&switcher->minimized_array); + +- lower_fullscreen_layer(switcher->shell, NULL); ++ lower_fullscreen_layer(switcher->shell, NULL, NULL); + switcher->grab.interface = &switcher_grab; + weston_keyboard_start_grab(keyboard, &switcher->grab); + weston_keyboard_set_focus(keyboard, NULL); +diff --git a/desktop-shell/shell.h b/desktop-shell/shell.h +index e0a0620..269648a 100644 +--- a/desktop-shell/shell.h ++++ b/desktop-shell/shell.h +@@ -242,7 +242,8 @@ get_output_work_area(struct desktop_shell *shell, + + void + lower_fullscreen_layer(struct desktop_shell *shell, +- struct weston_output *lowering_output); ++ struct weston_output *lowering_output, ++ struct shell_surface *orig_shsurf); + + void + activate(struct desktop_shell *shell, struct weston_view *view, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0073-backend-drm-Don-t-try-to-prepare-non-cursor-view-in-.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0073-backend-drm-Don-t-try-to-prepare-non-cursor-view-in-.patch new file mode 100644 index 0000000000000000000000000000000000000000..b2d754f6811738e29951aec81b48b763df81e941 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0073-backend-drm-Don-t-try-to-prepare-non-cursor-view-in-.patch @@ -0,0 +1,56 @@ +From 88a61ee8da70073c50f70b544ad51d8f80f36f29 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 30 Jun 2022 09:16:58 +0800 +Subject: [PATCH 73/79] backend-drm: Don't try to prepare non-cursor view in + renderer-only mode + +It would fail out in the later check anyway. + +Signed-off-by: Jeffy Chen +--- + libweston/backend-drm/state-propose.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/libweston/backend-drm/state-propose.c b/libweston/backend-drm/state-propose.c +index 48e6de2..961efc0 100644 +--- a/libweston/backend-drm/state-propose.c ++++ b/libweston/backend-drm/state-propose.c +@@ -695,6 +695,14 @@ dmabuf_feedback_maybe_update(struct drm_backend *b, struct weston_view *ev, + return true; + } + ++static struct weston_layer * ++get_view_layer(struct weston_view *view) ++{ ++ if (view->parent_view) ++ return get_view_layer(view->parent_view); ++ return view->layer_link.layer; ++} ++ + static struct drm_plane_state * + drm_output_prepare_plane_view(struct drm_output_state *state, + struct weston_view *ev, +@@ -711,6 +719,7 @@ drm_output_prepare_plane_view(struct drm_output_state *state, + struct drm_plane_zpos *p_zpos, *p_zpos_next; + struct wl_list zpos_candidate_list; + ++ struct weston_layer *layer; + struct weston_buffer *buffer; + struct wl_shm_buffer *shmbuf; + struct drm_fb *fb; +@@ -721,6 +730,12 @@ drm_output_prepare_plane_view(struct drm_output_state *state, + if (!weston_view_has_valid_buffer(ev)) + return ps; + ++ /* only allow cursor in renderer-only mode */ ++ layer = get_view_layer(ev); ++ if (mode == DRM_OUTPUT_PROPOSE_STATE_RENDERER_ONLY && ++ layer->position != WESTON_LAYER_POSITION_CURSOR) ++ return NULL; ++ + buffer = ev->surface->buffer_ref.buffer; + shmbuf = wl_shm_buffer_get(buffer->resource); + fb = drm_fb_get_from_view(state, ev, try_view_on_plane_failure_reasons); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0074-gl-renderer-Support-more-SHM-RGB-formats.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0074-gl-renderer-Support-more-SHM-RGB-formats.patch new file mode 100644 index 0000000000000000000000000000000000000000..d34b0f267965235d4aaffc2a60735cd4864bf17f --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0074-gl-renderer-Support-more-SHM-RGB-formats.patch @@ -0,0 +1,249 @@ +From 4371f386630d35b6b85d1623f3d988cc0e5ffceb Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 7 Jul 2022 11:09:23 +0800 +Subject: [PATCH 74/79] gl-renderer: Support more SHM RGB formats + +Signed-off-by: Jeffy Chen +--- + libweston/renderer-gl/fragment.glsl | 21 +++++- + libweston/renderer-gl/gl-renderer-internal.h | 11 ++- + libweston/renderer-gl/gl-renderer.c | 71 ++++++++++++++++++++ + libweston/renderer-gl/gl-shaders.c | 17 +++++ + 4 files changed, 116 insertions(+), 4 deletions(-) + +diff --git a/libweston/renderer-gl/fragment.glsl b/libweston/renderer-gl/fragment.glsl +index cfadb88..4414b63 100644 +--- a/libweston/renderer-gl/fragment.glsl ++++ b/libweston/renderer-gl/fragment.glsl +@@ -46,6 +46,12 @@ + #define SHADER_COLOR_CURVE_IDENTITY 0 + #define SHADER_COLOR_CURVE_LUT_3x1D 1 + ++/* enum gl_shader_color_swap */ ++#define SHADER_COLOR_SWAP_NONE 0 ++#define SHADER_COLOR_SWAP_RGB 1 ++#define SHADER_COLOR_SWAP_ALPHA 2 ++#define SHADER_COLOR_SWAP_ALL 3 ++ + #if DEF_VARIANT == SHADER_VARIANT_EXTERNAL + #extension GL_OES_EGL_image_external : require + #endif +@@ -62,6 +68,7 @@ precision HIGHPRECISION float; + * These undeclared identifiers will be #defined by a runtime generated code + * snippet. + */ ++compile_const int c_color_swap = DEF_COLOR_SWAP; + compile_const int c_variant = DEF_VARIANT; + compile_const bool c_input_is_premult = DEF_INPUT_IS_PREMULT; + compile_const bool c_green_tint = DEF_GREEN_TINT; +@@ -124,13 +131,11 @@ sample_input_texture() + return unicolor; + + if (c_variant == SHADER_VARIANT_RGBA || ++ c_variant == SHADER_VARIANT_RGBX || + c_variant == SHADER_VARIANT_EXTERNAL) { + return texture2D(tex, v_texcoord); + } + +- if (c_variant == SHADER_VARIANT_RGBX) +- return vec4(texture2D(tex, v_texcoord).rgb, 1.0); +- + /* Requires conversion to RGBA */ + + if (c_variant == SHADER_VARIANT_Y_U_V) { +@@ -218,6 +223,16 @@ main() + /* Electrical (non-linear) RGBA values, may be premult or not */ + color = sample_input_texture(); + ++ if (c_color_swap == SHADER_COLOR_SWAP_RGB) ++ color.bgr = color.rgb; ++ else if (c_color_swap == SHADER_COLOR_SWAP_ALPHA) ++ color.argb = color; ++ else if (c_color_swap == SHADER_COLOR_SWAP_ALL) ++ color.abgr = color; ++ ++ if (c_variant == SHADER_VARIANT_RGBX) ++ color.a = 1.0; ++ + if (c_need_color_pipeline) { + /* Ensure straight alpha */ + if (c_input_is_premult) { +diff --git a/libweston/renderer-gl/gl-renderer-internal.h b/libweston/renderer-gl/gl-renderer-internal.h +index ebeaadb..441f154 100644 +--- a/libweston/renderer-gl/gl-renderer-internal.h ++++ b/libweston/renderer-gl/gl-renderer-internal.h +@@ -56,6 +56,14 @@ enum gl_shader_color_curve { + SHADER_COLOR_CURVE_LUT_3x1D, + }; + ++/* Keep the following in sync with fragment.glsl. */ ++enum gl_shader_color_swap { ++ SHADER_COLOR_SWAP_NONE = 0, ++ SHADER_COLOR_SWAP_RGB, ++ SHADER_COLOR_SWAP_ALPHA, ++ SHADER_COLOR_SWAP_ALL, ++}; ++ + /** GL shader requirements key + * + * This structure is used as a binary blob key for building and searching +@@ -71,12 +79,13 @@ struct gl_shader_requirements + bool input_is_premult:1; + bool green_tint:1; + unsigned color_pre_curve:1; /* enum gl_shader_color_curve */ ++ unsigned color_swap:2; /* enum gl_shader_color_swap */ + + /* + * The total size of all bitfields plus pad_bits_ must fill up exactly + * how many bytes the compiler allocates for them together. + */ +- unsigned pad_bits_:25; ++ unsigned pad_bits_:23; + }; + static_assert(sizeof(struct gl_shader_requirements) == + 4 /* total bitfield size in bytes */, +diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c +index c0863c1..33c1a8e 100644 +--- a/libweston/renderer-gl/gl-renderer.c ++++ b/libweston/renderer-gl/gl-renderer.c +@@ -193,6 +193,7 @@ struct gl_surface_state { + struct egl_image* images[3]; + int num_images; + enum gl_shader_texture_variant shader_variant; ++ enum gl_shader_color_swap color_swap; + + struct weston_buffer_reference buffer_ref; + struct weston_buffer_release_reference buffer_release_ref; +@@ -1002,6 +1003,7 @@ gl_shader_config_set_input_textures(struct gl_shader_config *sconf, + int i; + + sconf->req.variant = gs->shader_variant; ++ sconf->req.color_swap = gs->color_swap; + sconf->req.input_is_premult = + gl_shader_texture_variant_can_be_premult(gs->shader_variant); + +@@ -2097,6 +2099,67 @@ gl_renderer_attach_shm(struct weston_surface *es, struct weston_buffer *buffer, + gl_pixel_type = GL_UNSIGNED_BYTE; + es->is_opaque = false; + break; ++ case WL_SHM_FORMAT_XBGR8888: ++ gs->shader_variant = SHADER_VARIANT_RGBX; ++ pitch = wl_shm_buffer_get_stride(shm_buffer) / 4; ++ gl_format[0] = GL_RGBA; ++ gl_pixel_type = GL_UNSIGNED_BYTE; ++ es->is_opaque = true; ++ break; ++ case WL_SHM_FORMAT_ABGR8888: ++ gs->shader_variant = SHADER_VARIANT_RGBA; ++ pitch = wl_shm_buffer_get_stride(shm_buffer) / 4; ++ gl_format[0] = GL_RGBA; ++ gl_pixel_type = GL_UNSIGNED_BYTE; ++ es->is_opaque = false; ++ break; ++ case WL_SHM_FORMAT_RGBX8888: ++ gs->shader_variant = SHADER_VARIANT_RGBX; ++ gs->color_swap = SHADER_COLOR_SWAP_ALL; ++ pitch = wl_shm_buffer_get_stride(shm_buffer) / 4; ++ gl_format[0] = GL_RGBA; ++ gl_pixel_type = GL_UNSIGNED_BYTE; ++ es->is_opaque = true; ++ break; ++ case WL_SHM_FORMAT_RGBA8888: ++ gs->shader_variant = SHADER_VARIANT_RGBA; ++ gs->color_swap = SHADER_COLOR_SWAP_ALL; ++ pitch = wl_shm_buffer_get_stride(shm_buffer) / 4; ++ gl_format[0] = GL_RGBA; ++ gl_pixel_type = GL_UNSIGNED_BYTE; ++ es->is_opaque = false; ++ break; ++ case WL_SHM_FORMAT_BGRX8888: ++ gs->shader_variant = SHADER_VARIANT_RGBX; ++ gs->color_swap = SHADER_COLOR_SWAP_ALPHA; ++ pitch = wl_shm_buffer_get_stride(shm_buffer) / 4; ++ gl_format[0] = GL_RGBA; ++ gl_pixel_type = GL_UNSIGNED_BYTE; ++ es->is_opaque = true; ++ break; ++ case WL_SHM_FORMAT_BGRA8888: ++ gs->shader_variant = SHADER_VARIANT_RGBA; ++ gs->color_swap = SHADER_COLOR_SWAP_ALPHA; ++ pitch = wl_shm_buffer_get_stride(shm_buffer) / 4; ++ gl_format[0] = GL_RGBA; ++ gl_pixel_type = GL_UNSIGNED_BYTE; ++ es->is_opaque = false; ++ break; ++ case WL_SHM_FORMAT_RGB888: ++ gs->shader_variant = SHADER_VARIANT_RGBX; ++ pitch = wl_shm_buffer_get_stride(shm_buffer) / 3; ++ gl_format[0] = GL_RGB; ++ gl_pixel_type = GL_UNSIGNED_BYTE; ++ es->is_opaque = true; ++ break; ++ case WL_SHM_FORMAT_BGR888: ++ gs->shader_variant = SHADER_VARIANT_RGBX; ++ gs->color_swap = SHADER_COLOR_SWAP_RGB; ++ pitch = wl_shm_buffer_get_stride(shm_buffer) / 3; ++ gl_format[0] = GL_RGB; ++ gl_pixel_type = GL_UNSIGNED_BYTE; ++ es->is_opaque = true; ++ break; + case WL_SHM_FORMAT_RGB565: + gs->shader_variant = SHADER_VARIANT_RGBX; + pitch = wl_shm_buffer_get_stride(shm_buffer) / 2; +@@ -3924,6 +3987,14 @@ gl_renderer_display_create(struct weston_compositor *ec, + goto fail_with_error; + } + ++ wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_XBGR8888); ++ wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_ABGR8888); ++ wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_RGBX8888); ++ wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_RGBA8888); ++ wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_BGRX8888); ++ wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_BGRA8888); ++ wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_RGB888); ++ wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_BGR888); + wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_RGB565); + wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_YUV420); + wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_NV12); +diff --git a/libweston/renderer-gl/gl-shaders.c b/libweston/renderer-gl/gl-shaders.c +index 97f288c..6c515a6 100644 +--- a/libweston/renderer-gl/gl-shaders.c ++++ b/libweston/renderer-gl/gl-shaders.c +@@ -97,6 +97,21 @@ gl_shader_color_curve_to_string(enum gl_shader_color_curve kind) + return "!?!?"; /* never reached */ + } + ++static const char * ++gl_shader_color_swap_to_string(enum gl_shader_color_swap kind) ++{ ++ switch (kind) { ++#define CASERET(x) case x: return #x; ++ CASERET(SHADER_COLOR_SWAP_NONE) ++ CASERET(SHADER_COLOR_SWAP_RGB) ++ CASERET(SHADER_COLOR_SWAP_ALPHA) ++ CASERET(SHADER_COLOR_SWAP_ALL) ++#undef CASERET ++ } ++ ++ return "!?!?"; /* never reached */ ++} ++ + static void + dump_program_with_line_numbers(int count, const char **sources) + { +@@ -182,10 +197,12 @@ create_shader_config_string(const struct gl_shader_requirements *req) + "#define DEF_GREEN_TINT %s\n" + "#define DEF_INPUT_IS_PREMULT %s\n" + "#define DEF_COLOR_PRE_CURVE %s\n" ++ "#define DEF_COLOR_SWAP %s\n" + "#define DEF_VARIANT %s\n", + req->green_tint ? "true" : "false", + req->input_is_premult ? "true" : "false", + gl_shader_color_curve_to_string(req->color_pre_curve), ++ gl_shader_color_swap_to_string(req->color_swap), + gl_shader_texture_variant_to_string(req->variant)); + if (size < 0) + return NULL; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0075-gl-renderer-Clear-RGB-when-alpha-is-zero-in-fast-pat.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0075-gl-renderer-Clear-RGB-when-alpha-is-zero-in-fast-pat.patch new file mode 100644 index 0000000000000000000000000000000000000000..9167da86ebd699023c89b5982872cd7c1ce82379 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0075-gl-renderer-Clear-RGB-when-alpha-is-zero-in-fast-pat.patch @@ -0,0 +1,32 @@ +From f896699c8cdac55e0460c506ba633d22b9086626 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 5 Aug 2022 11:27:54 +0800 +Subject: [PATCH 75/79] gl-renderer: Clear RGB when alpha is zero in fast path + +Signed-off-by: Jeffy Chen +--- + libweston/renderer-gl/fragment.glsl | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/libweston/renderer-gl/fragment.glsl b/libweston/renderer-gl/fragment.glsl +index 4414b63..a90cbfa 100644 +--- a/libweston/renderer-gl/fragment.glsl ++++ b/libweston/renderer-gl/fragment.glsl +@@ -253,8 +253,12 @@ main() + /* Fast path for disabled color management */ + + if (c_input_is_premult) { +- /* View alpha (opacity) */ +- color *= alpha; ++ if (color.a == 0.0) { ++ color.rgb = vec3(0, 0, 0); ++ } else { ++ /* View alpha (opacity) */ ++ color *= alpha; ++ } + } else { + /* View alpha (opacity) */ + color.a *= alpha; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0076-HACK-compositor-Allow-mapping-bufferless-subsurfaces.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0076-HACK-compositor-Allow-mapping-bufferless-subsurfaces.patch new file mode 100644 index 0000000000000000000000000000000000000000..95ac871ba9676a5914d304f3bf3f1e3e56959669 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0076-HACK-compositor-Allow-mapping-bufferless-subsurfaces.patch @@ -0,0 +1,32 @@ +From c0757c5bf57f4ba4566795682940767fec5e95b8 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 8 Aug 2022 15:46:35 +0800 +Subject: [PATCH 76/79] HACK: compositor: Allow mapping bufferless subsurfaces + +The current qtwayland needs it. + +Signed-off-by: Jeffy Chen +--- + libweston/compositor.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/libweston/compositor.c b/libweston/compositor.c +index fc8cef3..79a72bd 100644 +--- a/libweston/compositor.c ++++ b/libweston/compositor.c +@@ -4493,6 +4493,12 @@ subsurface_committed(struct weston_surface *surface, int32_t dx, int32_t dy) + if (!weston_surface_is_mapped(surface)) { + surface->is_mapped = surface->buffer_ref.buffer != NULL; + ++ /** ++ * HACK: Allow mapping bufferless subsurfaces ++ * See: https://bugreports.qt.io/browse/QTBUG-86229 ++ */ ++ surface->is_mapped = true; ++ + /* Cannot call weston_view_update_transform(), + * because that would call it also for the parent surface, + * which might not be mapped yet. That would lead to +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0077-HACK-Honour-cursor-size-config.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0077-HACK-Honour-cursor-size-config.patch new file mode 100644 index 0000000000000000000000000000000000000000..e6f02c8b67ceac6bdf37382acb436837baaa390e --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0077-HACK-Honour-cursor-size-config.patch @@ -0,0 +1,235 @@ +From 48c41795fe5f02f7f4051b0e0849e36a2fb8edee Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 23 Sep 2022 17:24:12 +0800 +Subject: [PATCH 77/79] HACK: Honour cursor-size config + +By scaling the cursor surface. + +Signed-off-by: Jeffy Chen +--- + compositor/main.c | 4 ++++ + include/libweston/libweston.h | 4 ++++ + libweston/backend-drm/drm.c | 3 +++ + libweston/compositor.c | 36 +++++++++++++++++++++------- + libweston/input.c | 44 +++++++++++++++++++++++++++++++---- + 5 files changed, 79 insertions(+), 12 deletions(-) + +diff --git a/compositor/main.c b/compositor/main.c +index 558537e..039307b 100644 +--- a/compositor/main.c ++++ b/compositor/main.c +@@ -3542,6 +3542,10 @@ wet_main(int argc, char *argv[], const struct weston_testsuite_data *test_data) + wet.compositor->exit = handle_exit; + wet.compositor->warm_up = warm_up; + ++ section = weston_config_get_section(config, "shell", NULL, NULL); ++ weston_config_section_get_int(section, "cursor-size", ++ &wet.compositor->cursor_size, 0); ++ + weston_compositor_log_capabilities(wet.compositor); + + server_socket = getenv("WAYLAND_SERVER_SOCKET"); +diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h +index 26804e2..2d15924 100644 +--- a/include/libweston/libweston.h ++++ b/include/libweston/libweston.h +@@ -578,6 +578,8 @@ struct weston_pointer { + struct wl_listener output_destroy_listener; + + struct wl_list timestamps_list; ++ ++ float scale; + }; + + /** libinput style calibration matrix +@@ -1210,6 +1212,8 @@ struct weston_compositor { + + bool warm_up; + uint32_t pending_fade_out; ++ ++ int cursor_size; + }; + + struct weston_buffer { +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index ed28956..d632a27 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -4226,6 +4226,9 @@ drm_backend_create(struct weston_compositor *compositor, + goto err_udev_dev; + } + ++ if (compositor->cursor_size) ++ b->cursor_width = b->cursor_height = compositor->cursor_size; ++ + wl_list_init(&b->plane_list); + create_sprites(b); + +diff --git a/libweston/compositor.c b/libweston/compositor.c +index 79a72bd..6e917f3 100644 +--- a/libweston/compositor.c ++++ b/libweston/compositor.c +@@ -757,8 +757,14 @@ weston_transformed_coord(int width, int height, + break; + } + +- *bx *= scale; +- *by *= scale; ++ /* HACK: Use -scale as 1/scale */ ++ if (scale < 0) { ++ *bx /= -scale; ++ *by /= -scale; ++ } else { ++ *bx *= scale; ++ *by *= scale; ++ } + } + + /** Transform a rectangle to buffer coordinates +@@ -2143,22 +2149,31 @@ convert_size_by_transform_scale(int32_t *width_out, int32_t *height_out, + uint32_t transform, + int32_t scale) + { +- assert(scale > 0); ++ assert(scale); ++ ++ /* HACK: Use -scale as 1/scale */ ++ if (scale < 0) { ++ width *= -scale; ++ height *= -scale; ++ } else { ++ width /= scale; ++ height /= scale; ++ } + + switch (transform) { + case WL_OUTPUT_TRANSFORM_NORMAL: + case WL_OUTPUT_TRANSFORM_180: + case WL_OUTPUT_TRANSFORM_FLIPPED: + case WL_OUTPUT_TRANSFORM_FLIPPED_180: +- *width_out = width / scale; +- *height_out = height / scale; ++ *width_out = width; ++ *height_out = height; + break; + case WL_OUTPUT_TRANSFORM_90: + case WL_OUTPUT_TRANSFORM_270: + case WL_OUTPUT_TRANSFORM_FLIPPED_90: + case WL_OUTPUT_TRANSFORM_FLIPPED_270: +- *width_out = height / scale; +- *height_out = width / scale; ++ *width_out = height; ++ *height_out = width; + break; + default: + assert(0 && "invalid transform"); +@@ -3734,6 +3749,7 @@ weston_surface_build_buffer_matrix(const struct weston_surface *surface, + { + const struct weston_buffer_viewport *vp = &surface->buffer_viewport; + double src_width, src_height, dest_width, dest_height; ++ float scale = vp->buffer.scale; + + weston_matrix_init(matrix); + +@@ -3801,7 +3817,11 @@ weston_surface_build_buffer_matrix(const struct weston_surface *surface, + break; + } + +- weston_matrix_scale(matrix, vp->buffer.scale, vp->buffer.scale, 1); ++ /* HACK: Use -scale as 1/scale */ ++ if (scale < 0) ++ scale = 1.0 / -scale; ++ ++ weston_matrix_scale(matrix, scale, scale, 1); + } + + /** +diff --git a/libweston/input.c b/libweston/input.c +index 6438b52..9c140aa 100644 +--- a/libweston/input.c ++++ b/libweston/input.c +@@ -1723,8 +1723,8 @@ weston_pointer_move_to(struct weston_pointer *pointer, + + if (pointer->sprite) { + weston_view_set_position(pointer->sprite, +- ix - pointer->hotspot_x, +- iy - pointer->hotspot_y); ++ ix - pointer->hotspot_x * pointer->scale, ++ iy - pointer->hotspot_y * pointer->scale); + weston_view_schedule_repaint(pointer->sprite); + } + +@@ -2677,6 +2677,36 @@ pointer_cursor_surface_get_label(struct weston_surface *surface, + return snprintf(buf, len, "cursor"); + } + ++static void ++pointer_cursor_scale(struct weston_pointer *pointer, ++ struct weston_surface *surface) ++{ ++ struct weston_compositor *compositor = surface->compositor; ++ float scale; ++ ++ if (!compositor->cursor_size || !surface->width || ++ surface->width == compositor->cursor_size) ++ return; ++ ++ if (surface->buffer_viewport.buffer.scale != 1) ++ return; ++ ++ if (compositor->cursor_size > surface->width) { ++ scale = compositor->cursor_size / surface->width; ++ ++ /* HACK: Use -scale as 1/scale */ ++ surface->buffer_viewport.buffer.scale = -scale; ++ } else { ++ scale = 1.0 / (surface->width / compositor->cursor_size); ++ surface->buffer_viewport.buffer.scale = 1 / scale; ++ } ++ ++ surface->width *= scale; ++ surface->height *= scale; ++ ++ pointer->scale = scale; ++} ++ + static void + pointer_cursor_surface_committed(struct weston_surface *es, + int32_t dx, int32_t dy) +@@ -2689,11 +2719,13 @@ pointer_cursor_surface_committed(struct weston_surface *es, + + assert(es == pointer->sprite->surface); + ++ pointer_cursor_scale(pointer, es); ++ + pointer->hotspot_x -= dx; + pointer->hotspot_y -= dy; + +- x = wl_fixed_to_int(pointer->x) - pointer->hotspot_x; +- y = wl_fixed_to_int(pointer->y) - pointer->hotspot_y; ++ x = wl_fixed_to_int(pointer->x) - pointer->hotspot_x * pointer->scale; ++ y = wl_fixed_to_int(pointer->y) - pointer->hotspot_y * pointer->scale; + + weston_view_set_position(pointer->sprite, x, y); + +@@ -2764,6 +2796,8 @@ pointer_set_cursor(struct wl_client *client, struct wl_resource *resource, + pointer->sprite = weston_view_create(surface); + } + ++ pointer_cursor_scale(pointer, surface); ++ + pointer->hotspot_x = x; + pointer->hotspot_y = y; + +@@ -3374,6 +3408,8 @@ weston_seat_init_pointer(struct weston_seat *seat) + + seat_send_updated_caps(seat); + ++ pointer->scale = 1.0; ++ + return 0; + } + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0078-compositor-Stop-bootanim-after-warm-up.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0078-compositor-Stop-bootanim-after-warm-up.patch new file mode 100644 index 0000000000000000000000000000000000000000..ce9af173a8b3a4ea67534508e4bd476ed1bef832 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0078-compositor-Stop-bootanim-after-warm-up.patch @@ -0,0 +1,36 @@ +From 5810584bc2167652bada505ec11f509283103cc0 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 28 Sep 2022 10:44:07 +0800 +Subject: [PATCH 78/79] compositor: Stop bootanim after warm-up + +Signed-off-by: Jeffy Chen +--- + libweston/compositor.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/libweston/compositor.c b/libweston/compositor.c +index 6e917f3..f0ddf80 100644 +--- a/libweston/compositor.c ++++ b/libweston/compositor.c +@@ -2933,6 +2933,10 @@ weston_compositor_build_view_list(struct weston_compositor *compositor, + weston_log("seeing the first app\n"); + compositor->warm_up = false; + ++#define BOOTANIM "/usr/bin/bootanim" ++ if (!access(BOOTANIM, X_OK)) ++ (void)!system(BOOTANIM " stop&"); ++ + /* Assuming it's a launcher */ + view->surface->flags |= SURFACE_STAY_ON_BOTTOM; + } +@@ -3200,6 +3204,7 @@ output_repaint_timer_handler(void *data) + + if (!access(getenv("WESTON_FREEZE_DISPLAY") ? : "", F_OK)) { + usleep(DEFAULT_REPAINT_WINDOW * 1000); ++ weston_compositor_build_view_list(compositor, NULL); + goto out; + } + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0079-desktop-shell-Fix-crash-when-hotplugging-screens.patch b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0079-desktop-shell-Fix-crash-when-hotplugging-screens.patch new file mode 100644 index 0000000000000000000000000000000000000000..0f47b7c812cc38d355e5d282233c8b7cbc481760 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/wayland/weston_10.0.2/0079-desktop-shell-Fix-crash-when-hotplugging-screens.patch @@ -0,0 +1,48 @@ +From e0cbe1a1e704639c40de2c82f1547b0b5a5d4052 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 3 Oct 2022 21:03:04 +0800 +Subject: [PATCH 79/79] desktop-shell: Fix crash when hotplugging screens + +1/ Force allowing respawn. +2/ Panel's output might not be available when committing. + +Signed-off-by: Jeffy Chen +--- + desktop-shell/shell.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c +index d4879b2..36a15d3 100644 +--- a/desktop-shell/shell.c ++++ b/desktop-shell/shell.c +@@ -3064,6 +3064,10 @@ panel_committed(struct weston_surface *es, int32_t sx, int32_t sy) + + view = container_of(es->views.next, struct weston_view, surface_link); + ++ /* The output might be unavaiable */ ++ if (!view->output) ++ return; ++ + get_panel_size(shell, view, &width, &height); + switch (shell->panel_position) { + case WESTON_DESKTOP_SHELL_PANEL_POSITION_TOP: +@@ -4370,6 +4374,8 @@ check_desktop_shell_crash_too_early(struct desktop_shell *shell) + if (clock_gettime(CLOCK_MONOTONIC, &now) < 0) + return false; + ++ /* HACK: The shell might be crashed too early when hotplugging */ ++#if 0 + /* + * If the shell helper client dies before the session has been + * up for roughly 30 seconds, better just make Weston shut down, +@@ -4385,6 +4391,7 @@ check_desktop_shell_crash_too_early(struct desktop_shell *shell) + + return true; + } ++#endif + + return false; + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-graphics/xorg-xserver/files/20-modesetting.conf b/bsp/meta-rockchip/recipes-graphics/xorg-xserver/files/20-modesetting.conf new file mode 100644 index 0000000000000000000000000000000000000000..0e25bfa2b5d497c271b347ad473cdaae07b3ffdc --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/xorg-xserver/files/20-modesetting.conf @@ -0,0 +1,32 @@ +Section "Device" + Identifier "Rockchip Graphics" + Driver "modesetting" + +### Use Rockchip RGA 2D HW accel +# Option "AccelMethod" "exa" + +### Use GPU HW accel + Option "AccelMethod" "glamor" + + Option "DRI" "2" + +### Set to "always" to avoid tearing, could lead to up 50% performance loss + Option "FlipFB" "none" + +### Limit flip rate and drop frames for "FlipFB" to reduce performance lost +# Option "MaxFlipRate" "25" + + Option "NoEDID" "true" +EndSection + +Section "Screen" + Identifier "Default Screen" + Device "Rockchip Graphics" + Monitor "Default Monitor" +EndSection + +### Valid values for rotation are "normal", "left", "right" +Section "Monitor" + Identifier "Default Monitor" + Option "Rotate" "normal" +EndSection diff --git a/bsp/meta-rockchip/recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend b/bsp/meta-rockchip/recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..52269bc52258a0b8f6c15728ad7e38d6cc31f731 --- /dev/null +++ b/bsp/meta-rockchip/recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend @@ -0,0 +1,23 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +DEPENDS:append = " automake-native autoconf-native util-macros-native font-util-native xtrans-native libxshmfence rockchip-librga" + +SRCREV = "${AUTOREV}" +SRC_URI:append = " git://github.com/JeffyCN/xorg-xserver;protocol=https;nobranch=1;branch=${PV}_2022_11_03;" +SRC_URI:remove = "https://www.x.org/releases//individual/xserver/xorg-server-${PV}.tar.bz2" +S = "${WORKDIR}/git" + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +SRC_URI:append = " file://20-modesetting.conf" + +do_configure:prepend() { + NOCONFIGURE="yes" ${S}/autogen.sh +} + +do_install:append() { + install -d ${D}${datadir}/X11/xorg.conf.d + install -m 0755 ${WORKDIR}/20-modesetting.conf \ + ${D}${datadir}/X11/xorg.conf.d/20-modesetting.conf +} diff --git a/bsp/meta-rockchip/recipes-kernel/linux-firmware/files/firmware/rockchip/dptx.bin b/bsp/meta-rockchip/recipes-kernel/linux-firmware/files/firmware/rockchip/dptx.bin new file mode 100644 index 0000000000000000000000000000000000000000..c22653a49cc42b2e9d5a877d990c5cf988185b20 Binary files /dev/null and b/bsp/meta-rockchip/recipes-kernel/linux-firmware/files/firmware/rockchip/dptx.bin differ diff --git a/bsp/meta-rockchip/recipes-kernel/linux-firmware/linux-firmware_%.bbappend b/bsp/meta-rockchip/recipes-kernel/linux-firmware/linux-firmware_%.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..81ef38b5fa38287ea4da37f29e4627be85ad2810 --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux-firmware/linux-firmware_%.bbappend @@ -0,0 +1,35 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +# Install addition firmwares +do_install:append() { + cp -r ${WORKDIR}/firmware ${D}${nonarch_base_libdir}/ +} + +# For rockchip +SRC_URI:append = " \ + file://firmware/rockchip/dptx.bin \ +" + +PACKAGES:prepend = " \ + ${PN}-rk-cdndp \ + ${PN}-rockchip-license \ +" + +LICENSE:append = " & LICENSE.rockchip" +LIC_FILES_CHKSUM:append = " file://${RKBASE}/licenses/LICENSE.rockchip;md5=d63890e209bf038f44e708bbb13e4ed9" +LICENSE:${PN}-rk-cdndp = "LICENSE.rockchip" +LICENSE:${PN}-rockchip-license = "LICENSE.rockchip" + +FILES:${PN}-rockchip-license = " \ + ${nonarch_base_libdir}/firmware/LICENCE.rockchip \ +" +FILES:${PN}-rk-cdndp = " \ + ${nonarch_base_libdir}/firmware/rockchip/dptx.bin \ +" + +RDEPENDS:${PN}-rk-cdndp = "${PN}-rockchip-license" + +INSANE_SKIP:append = " host-user-contaminated" diff --git a/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.19-custom.bb b/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.19-custom.bb new file mode 100644 index 0000000000000000000000000000000000000000..8d6cbc4815c1f24f7cacd9f1a4f9a1e60d30e2cb --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.19-custom.bb @@ -0,0 +1,17 @@ +# Copyright (C) 2020, Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +require recipes-kernel/linux-libc-headers/linux-libc-headers.inc + +inherit auto-patch + +inherit freeze-rev local-git + +SRCREV = "82957dba3977fd50d4c013e0d359f3203072a0f2" +SRC_URI = " \ + git://github.com/JeffyCN/mirrors.git;protocol=https;nobranch=1;branch=kernel-4.19-2022_01_10; \ +" + +S = "${WORKDIR}/git" + +LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814" diff --git a/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom.bb b/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom.bb new file mode 100644 index 0000000000000000000000000000000000000000..ec6211c73d00ca863fd34bdf5527b6ebc6a3858b --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom.bb @@ -0,0 +1,21 @@ +# Copyright (C) 2020, Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +require recipes-kernel/linux-libc-headers/linux-libc-headers.inc + +inherit auto-patch + +inherit freeze-rev local-git + +SRCREV = "f207a103477d8c601d89db381f07246d6942d9d0" +SRC_URI = " \ + git://github.com/JeffyCN/mirrors.git;protocol=https;nobranch=1;branch=kernel-2022_06_27; \ +" + +S = "${WORKDIR}/git" + +LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7" + +do_install_armmultilib:prepend() { + touch ${D}${includedir}/asm/bpf_perf_event.h +} diff --git a/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom/0001-v4l-add-Mediatek-compressed-video-block-format.patch b/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom/0001-v4l-add-Mediatek-compressed-video-block-format.patch new file mode 100644 index 0000000000000000000000000000000000000000..827757c01ee3a5d1f3bb8d289ffe900acf8ca73e --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom/0001-v4l-add-Mediatek-compressed-video-block-format.patch @@ -0,0 +1,48 @@ +From 4b8d34fdfeb4a83f0cf87a6a750ac3260c000792 Mon Sep 17 00:00:00 2001 +From: Tiffany Lin +Date: Fri, 9 Sep 2016 12:48:04 -0300 +Subject: [PATCH 1/5] v4l: add Mediatek compressed video block format + +Add V4L2_PIX_FMT_MT21C format used on MT8173 driver. +It is compressed format and need MT8173 MDP driver to transfer to other +standard format. + +Signed-off-by: Tiffany Lin +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit d4de663458bd00a579742e966c2db0d86352358b) + +Change-Id: Iad20515a78d4fdbe74d597a453deadb6dabc3613 +Signed-off-by: Jeffy Chen +--- + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + + include/uapi/linux/videodev2.h | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c +index 29dd31748f18..0d308e6c8b50 100644 +--- a/drivers/media/v4l2-core/v4l2-ioctl.c ++++ b/drivers/media/v4l2-core/v4l2-ioctl.c +@@ -1301,6 +1301,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) + case V4L2_PIX_FMT_JPGL: descr = "JPEG Lite"; break; + case V4L2_PIX_FMT_SE401: descr = "GSPCA SE401"; break; + case V4L2_PIX_FMT_S5C_UYVY_JPG: descr = "S5C73MX interleaved UYVY/JPEG"; break; ++ case V4L2_PIX_FMT_MT21C: descr = "Mediatek Compressed Format"; break; + default: + WARN(1, "Unknown pixelformat 0x%08x\n", fmt->pixelformat); + if (fmt->description[0]) +diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h +index e21c709f18ef..1333216515b0 100644 +--- a/include/uapi/linux/videodev2.h ++++ b/include/uapi/linux/videodev2.h +@@ -634,6 +634,7 @@ struct v4l2_pix_format { + #define V4L2_PIX_FMT_Y8I v4l2_fourcc('Y', '8', 'I', ' ') /* Greyscale 8-bit L/R interleaved */ + #define V4L2_PIX_FMT_Y12I v4l2_fourcc('Y', '1', '2', 'I') /* Greyscale 12-bit L/R interleaved */ + #define V4L2_PIX_FMT_Z16 v4l2_fourcc('Z', '1', '6', ' ') /* Depth data 16-bit */ ++#define V4L2_PIX_FMT_MT21C v4l2_fourcc('M', 'T', '2', '1') /* Mediatek compressed block mode */ + + /* SDR formats - used only for Software Defined Radio devices */ + #define V4L2_SDR_FMT_CU8 v4l2_fourcc('C', 'U', '0', '8') /* IQ u8 */ +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom/0002-videodev2.h-add-V4L2_PIX_FMT_VP9-format.patch b/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom/0002-videodev2.h-add-V4L2_PIX_FMT_VP9-format.patch new file mode 100644 index 0000000000000000000000000000000000000000..d609e14dede815c23fd6e3adee7e409962158515 --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom/0002-videodev2.h-add-V4L2_PIX_FMT_VP9-format.patch @@ -0,0 +1,37 @@ +From 01f1facb222453ab18dd5a18edd20966603ba297 Mon Sep 17 00:00:00 2001 +From: Wu-Cheng Li +Date: Fri, 2 Sep 2016 09:19:57 -0300 +Subject: [PATCH 2/5] videodev2.h: add V4L2_PIX_FMT_VP9 format + +This adds VP9 video coding format, a successor to VP8. + +Signed-off-by: Wu-Cheng Li +Signed-off-by: Tiffany Lin +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit a8b4a1ea0cecda1089739cfda1b247d17981062d) + +Conflicts: + include/uapi/linux/videodev2.h + +Change-Id: Ic5348e3fd6458f64e0acfbf8eb3d691eb4b4f788 +Signed-off-by: Jeffy Chen +--- + include/uapi/linux/videodev2.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h +index 1333216515b0..19470c0669d3 100644 +--- a/include/uapi/linux/videodev2.h ++++ b/include/uapi/linux/videodev2.h +@@ -603,6 +603,7 @@ struct v4l2_pix_format { + #define V4L2_PIX_FMT_VC1_ANNEX_L v4l2_fourcc('V', 'C', '1', 'L') /* SMPTE 421M Annex L compliant stream */ + #define V4L2_PIX_FMT_VP8 v4l2_fourcc('V', 'P', '8', '0') /* VP8 */ + #define V4L2_PIX_FMT_VP8_FRAME v4l2_fourcc('V', 'P', '8', 'F') /* VP8 parsed frames */ ++#define V4L2_PIX_FMT_VP9 v4l2_fourcc('V', 'P', '9', '0') /* VP9 */ + + /* Vendor-specific formats */ + #define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */ +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom/0003-uapi-fix-linux-if.h-userspace-compilation-errors.patch b/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom/0003-uapi-fix-linux-if.h-userspace-compilation-errors.patch new file mode 100644 index 0000000000000000000000000000000000000000..b0beabc068c152b9bfc55a1c4edc80e09c5e95b5 --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom/0003-uapi-fix-linux-if.h-userspace-compilation-errors.patch @@ -0,0 +1,74 @@ +From e9b500b3fea1ab678502f85a4bd360119e737215 Mon Sep 17 00:00:00 2001 +From: "Dmitry V. Levin" +Date: Mon, 20 Feb 2017 14:58:41 +0300 +Subject: [PATCH 3/5] uapi: fix linux/if.h userspace compilation errors + +Include (guarded by ifndef __KERNEL__) to fix +the following linux/if.h userspace compilation errors: + +/usr/include/linux/if.h:234:19: error: field 'ifru_addr' has incomplete type + struct sockaddr ifru_addr; +/usr/include/linux/if.h:235:19: error: field 'ifru_dstaddr' has incomplete type + struct sockaddr ifru_dstaddr; +/usr/include/linux/if.h:236:19: error: field 'ifru_broadaddr' has incomplete type + struct sockaddr ifru_broadaddr; +/usr/include/linux/if.h:237:19: error: field 'ifru_netmask' has incomplete type + struct sockaddr ifru_netmask; +/usr/include/linux/if.h:238:20: error: field 'ifru_hwaddr' has incomplete type + struct sockaddr ifru_hwaddr; + +This also fixes userspace compilation of the following uapi headers: + linux/atmbr2684.h + linux/gsmmux.h + linux/if_arp.h + linux/if_bonding.h + linux/if_frad.h + linux/if_pppox.h + linux/if_tunnel.h + linux/netdevice.h + linux/route.h + linux/wireless.h + +As no uapi header provides a definition of struct sockaddr, inclusion +of seems to be the most conservative and the only safe +fix available. + +All current users of are very likely to be including + already because the latter is the sole provider +of struct sockaddr definition in libc, so adding a uapi header +with a definition of struct sockaddr would create a potential +conflict with . + +Replacing struct sockaddr in the definition of struct ifreq with +a different type would create a potential incompatibility with current +users of struct ifreq who might rely on ifru_addr et al members being +of type struct sockaddr. + +Signed-off-by: Dmitry V. Levin +Signed-off-by: David S. Miller +(cherry picked from commit 2618be7dccf8739b89e1906b64bd8d551af351e6) + +Change-Id: Ic0f66c7a623b63436496b28e7265d806420bf912 +Signed-off-by: Jeffy Chen +--- + include/uapi/linux/if.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/include/uapi/linux/if.h b/include/uapi/linux/if.h +index 752f5dc040a5..21cfd1298913 100644 +--- a/include/uapi/linux/if.h ++++ b/include/uapi/linux/if.h +@@ -24,6 +24,10 @@ + #include /* for "struct sockaddr" et al */ + #include /* for "__user" et al */ + ++#ifndef __KERNEL__ ++#include /* for struct sockaddr. */ ++#endif ++ + #if __UAPI_DEF_IF_IFNAMSIZ + #define IFNAMSIZ 16 + #endif /* __UAPI_DEF_IF_IFNAMSIZ */ +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom/0004-uapi-netlink.h-Add-more-definations-from-upstream.patch b/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom/0004-uapi-netlink.h-Add-more-definations-from-upstream.patch new file mode 100644 index 0000000000000000000000000000000000000000..c146bd04614c12206b91c38b1f4c444d93198c0c --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom/0004-uapi-netlink.h-Add-more-definations-from-upstream.patch @@ -0,0 +1,68 @@ +From 30ff5d1f742e2ed1be3fd9c42dcc902b6f3a19cc Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 27 May 2020 15:24:19 +0800 +Subject: [PATCH 4/5] uapi: netlink.h: Add more definations from upstream + +No functional changes. + +Change-Id: I7fb817dda7f9755e6d068594cbc71e2202a5ade5 +Signed-off-by: Jeffy Chen +--- + include/uapi/linux/netlink.h | 27 +++++++++++++++++++++++++++ + 1 file changed, 27 insertions(+) + +diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h +index 0dba4e4ed2be..c4999c6552f1 100644 +--- a/include/uapi/linux/netlink.h ++++ b/include/uapi/linux/netlink.h +@@ -68,6 +68,10 @@ struct nlmsghdr { + #define NLM_F_CREATE 0x400 /* Create, if it does not exist */ + #define NLM_F_APPEND 0x800 /* Add to end of list */ + ++/* Flags for ACK message */ ++#define NLM_F_CAPPED 0x100 /* request was capped */ ++#define NLM_F_ACK_TLVS 0x200 /* extended ACK TVLs were included */ ++ + /* + 4.4BSD ADD NLM_F_CREATE|NLM_F_EXCL + 4.4BSD CHANGE NLM_F_REPLACE +@@ -102,6 +106,28 @@ struct nlmsgerr { + struct nlmsghdr msg; + }; + ++/** ++ * enum nlmsgerr_attrs - nlmsgerr attributes ++ * @NLMSGERR_ATTR_UNUSED: unused ++ * @NLMSGERR_ATTR_MSG: error message string (string) ++ * @NLMSGERR_ATTR_OFFS: offset of the invalid attribute in the original ++ * message, counting from the beginning of the header (u32) ++ * @NLMSGERR_ATTR_COOKIE: arbitrary subsystem specific cookie to ++ * be used - in the success case - to identify a created ++ * object or operation or similar (binary) ++ * @__NLMSGERR_ATTR_MAX: number of attributes ++ * @NLMSGERR_ATTR_MAX: highest attribute number ++ */ ++enum nlmsgerr_attrs { ++ NLMSGERR_ATTR_UNUSED, ++ NLMSGERR_ATTR_MSG, ++ NLMSGERR_ATTR_OFFS, ++ NLMSGERR_ATTR_COOKIE, ++ ++ __NLMSGERR_ATTR_MAX, ++ NLMSGERR_ATTR_MAX = __NLMSGERR_ATTR_MAX - 1 ++}; ++ + #define NETLINK_ADD_MEMBERSHIP 1 + #define NETLINK_DROP_MEMBERSHIP 2 + #define NETLINK_PKTINFO 3 +@@ -114,6 +140,7 @@ struct nlmsgerr { + #define NETLINK_LISTEN_ALL_NSID 8 + #define NETLINK_LIST_MEMBERSHIPS 9 + #define NETLINK_CAP_ACK 10 ++#define NETLINK_EXT_ACK 11 + + struct nl_pktinfo { + __u32 group; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom/0005-uapi-ioctls.h-Add-TIOCGPTPEER-from-upstream.patch b/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom/0005-uapi-ioctls.h-Add-TIOCGPTPEER-from-upstream.patch new file mode 100644 index 0000000000000000000000000000000000000000..738631ac15f0aec49ef1a13ebf9b2ef5e6ef5ede --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom/0005-uapi-ioctls.h-Add-TIOCGPTPEER-from-upstream.patch @@ -0,0 +1,28 @@ +From deb6bd966f6b26a0892e4b35069aafb1abe38dd2 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 17 Sep 2020 17:51:12 +0800 +Subject: [PATCH 5/5] uapi: ioctls.h: Add TIOCGPTPEER from upstream + +No functional changes. + +Change-Id: Ie31d5e668347c2ee1125c5741d30bbda6ef1ed4c +Signed-off-by: Jeffy Chen +--- + include/uapi/asm-generic/ioctls.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/uapi/asm-generic/ioctls.h b/include/uapi/asm-generic/ioctls.h +index 143dacbb7d9a..14baf9f23a14 100644 +--- a/include/uapi/asm-generic/ioctls.h ++++ b/include/uapi/asm-generic/ioctls.h +@@ -77,6 +77,7 @@ + #define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */ + #define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */ + #define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */ ++#define TIOCGPTPEER _IO('T', 0x41) /* Safely open the slave */ + + #define FIONCLEX 0x5450 + #define FIOCLEX 0x5451 +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom/0006-BACKPORT-arm64-Introduce-prctl-options-to-control-th.patch b/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom/0006-BACKPORT-arm64-Introduce-prctl-options-to-control-th.patch new file mode 100644 index 0000000000000000000000000000000000000000..07da09a6fa064335136bdbae3583ce174cda4014 --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom/0006-BACKPORT-arm64-Introduce-prctl-options-to-control-th.patch @@ -0,0 +1,62 @@ +From f7b3134457e764badb5b24d6fcd1636d1950b1ef Mon Sep 17 00:00:00 2001 +From: Catalin Marinas +Date: Tue, 23 Jul 2019 19:58:39 +0200 +Subject: [PATCH] BACKPORT: arm64: Introduce prctl() options to control the + tagged user addresses ABI + +(Upstream commit 63f0c60379650d82250f22e4cf4137ef3dc4f43d). + +It is not desirable to relax the ABI to allow tagged user addresses into +the kernel indiscriminately. This patch introduces a prctl() interface +for enabling or disabling the tagged ABI with a global sysctl control +for preventing applications from enabling the relaxed ABI (meant for +testing user-space prctl() return error checking without reconfiguring +the kernel). The ABI properties are inherited by threads of the same +application and fork()'ed children but cleared on execve(). A Kconfig +option allows the overall disabling of the relaxed ABI. + +The PR_SET_TAGGED_ADDR_CTRL will be expanded in the future to handle +MTE-specific settings like imprecise vs precise exceptions. + +Reviewed-by: Kees Cook +Signed-off-by: Catalin Marinas +Signed-off-by: Andrey Konovalov +Signed-off-by: Will Deacon +Change-Id: I2d52c5589b05415faab315c116245f1058d64750 +Signed-off-by: Andrey Konovalov +Bug: 135692346 +(cherry picked from commit f077ee260964eb925a593dcf30553432b3243ac8) + +Conflicts: + arch/arm64/Kconfig + arch/arm64/include/asm/processor.h + arch/arm64/include/asm/thread_info.h + arch/arm64/include/asm/uaccess.h + arch/arm64/kernel/process.c + include/uapi/linux/prctl.h + kernel/sys.c + +Only port definations to pass newest glibc compiling. + +Signed-off-by: Jeffy Chen +--- + include/uapi/linux/prctl.h | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/include/uapi/linux/prctl.h b/include/uapi/linux/prctl.h +index 4d05aad2e4c5..eabab9f1ee38 100644 +--- a/include/uapi/linux/prctl.h ++++ b/include/uapi/linux/prctl.h +@@ -219,4 +219,9 @@ struct prctl_mm_map { + # define PR_SPEC_DISABLE (1UL << 2) + # define PR_SPEC_FORCE_DISABLE (1UL << 3) + ++/* Tagged user address controls for arm64 */ ++#define PR_SET_TAGGED_ADDR_CTRL 55 ++#define PR_GET_TAGGED_ADDR_CTRL 56 ++# define PR_TAGGED_ADDR_ENABLE (1UL << 0) ++ + #endif /* _LINUX_PRCTL_H */ +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom/0007-netfilter-nft_log-complete-NFTA_LOG_FLAGS-attr-suppo.patch b/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom/0007-netfilter-nft_log-complete-NFTA_LOG_FLAGS-attr-suppo.patch new file mode 100644 index 0000000000000000000000000000000000000000..99c724f356f2f1c5055d07199c6f325e7d43404f --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom/0007-netfilter-nft_log-complete-NFTA_LOG_FLAGS-attr-suppo.patch @@ -0,0 +1,235 @@ +From 787d025edb59453e15a8653bb1eb912b6d6eb365 Mon Sep 17 00:00:00 2001 +From: Liping Zhang +Date: Sun, 25 Sep 2016 16:35:56 +0800 +Subject: [PATCH] netfilter: nft_log: complete NFTA_LOG_FLAGS attr support + +NFTA_LOG_FLAGS attribute is already supported, but the related +NF_LOG_XXX flags are not exposed to the userspace. So we cannot +explicitly enable log flags to log uid, tcp sequence, ip options +and so on, i.e. such rule "nft add rule filter output log uid" +is not supported yet. + +So move NF_LOG_XXX macro definitions to the uapi/../nf_log.h. In +order to keep consistent with other modules, change NF_LOG_MASK to +refer to all supported log flags. On the other hand, add a new +NF_LOG_DEFAULT_MASK to refer to the original default log flags. + +Finally, if user specify the unsupported log flags or NFTA_LOG_GROUP +and NFTA_LOG_FLAGS are set at the same time, report EINVAL to the +userspace. + +Signed-off-by: Liping Zhang +Signed-off-by: Pablo Neira Ayuso +(cherry picked from commit ff107d27761ff4b644c82c209e004ec9c8fbbc22) +Signed-off-by: Jeffy Chen + +Change-Id: Ia03f25437ab23cc82e1d326bb93a0756ccdaaa21 +Signed-off-by: Jeffy Chen +--- + include/net/netfilter/nf_log.h | 11 +++-------- + include/uapi/linux/netfilter/Kbuild | 1 + + include/uapi/linux/netfilter/nf_log.h | 12 ++++++++++++ + net/bridge/netfilter/ebt_log.c | 2 +- + net/ipv4/netfilter/ip_tables.c | 2 +- + net/ipv4/netfilter/nf_log_arp.c | 2 +- + net/ipv4/netfilter/nf_log_ipv4.c | 4 ++-- + net/ipv6/netfilter/ip6_tables.c | 2 +- + net/ipv6/netfilter/nf_log_ipv6.c | 4 ++-- + net/netfilter/nf_tables_core.c | 2 +- + net/netfilter/nft_log.c | 9 ++++++++- + 11 files changed, 33 insertions(+), 18 deletions(-) + create mode 100644 include/uapi/linux/netfilter/nf_log.h + +diff --git a/include/net/netfilter/nf_log.h b/include/net/netfilter/nf_log.h +index 57639fca223a..457fbee67dd4 100644 +--- a/include/net/netfilter/nf_log.h ++++ b/include/net/netfilter/nf_log.h +@@ -2,15 +2,10 @@ + #define _NF_LOG_H + + #include ++#include + +-/* those NF_LOG_* defines and struct nf_loginfo are legacy definitios that will +- * disappear once iptables is replaced with pkttables. Please DO NOT use them +- * for any new code! */ +-#define NF_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ +-#define NF_LOG_TCPOPT 0x02 /* Log TCP options */ +-#define NF_LOG_IPOPT 0x04 /* Log IP options */ +-#define NF_LOG_UID 0x08 /* Log UID owning local socket */ +-#define NF_LOG_MASK 0x0f ++/* Log tcp sequence, tcp options, ip options and uid owning local socket */ ++#define NF_LOG_DEFAULT_MASK 0x0f + + enum nf_log_type { + NF_LOG_TYPE_LOG = 0, +diff --git a/include/uapi/linux/netfilter/Kbuild b/include/uapi/linux/netfilter/Kbuild +index 1d973d2ba417..5cb8da88df9f 100644 +--- a/include/uapi/linux/netfilter/Kbuild ++++ b/include/uapi/linux/netfilter/Kbuild +@@ -5,6 +5,7 @@ header-y += nf_conntrack_ftp.h + header-y += nf_conntrack_sctp.h + header-y += nf_conntrack_tcp.h + header-y += nf_conntrack_tuple_common.h ++header-y += nf_log.h + header-y += nf_tables.h + header-y += nf_tables_compat.h + header-y += nf_nat.h +diff --git a/include/uapi/linux/netfilter/nf_log.h b/include/uapi/linux/netfilter/nf_log.h +new file mode 100644 +index 000000000000..8be21e02387d +--- /dev/null ++++ b/include/uapi/linux/netfilter/nf_log.h +@@ -0,0 +1,12 @@ ++#ifndef _NETFILTER_NF_LOG_H ++#define _NETFILTER_NF_LOG_H ++ ++#define NF_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ ++#define NF_LOG_TCPOPT 0x02 /* Log TCP options */ ++#define NF_LOG_IPOPT 0x04 /* Log IP options */ ++#define NF_LOG_UID 0x08 /* Log UID owning local socket */ ++#define NF_LOG_NFLOG 0x10 /* Unsupported, don't reuse */ ++#define NF_LOG_MACDECODE 0x20 /* Decode MAC header */ ++#define NF_LOG_MASK 0x2f ++ ++#endif /* _NETFILTER_NF_LOG_H */ +diff --git a/net/bridge/netfilter/ebt_log.c b/net/bridge/netfilter/ebt_log.c +index 0ad639a96142..0cc6ea58a429 100644 +--- a/net/bridge/netfilter/ebt_log.c ++++ b/net/bridge/netfilter/ebt_log.c +@@ -93,7 +93,7 @@ ebt_log_packet(struct net *net, u_int8_t pf, unsigned int hooknum, + if (loginfo->type == NF_LOG_TYPE_LOG) + bitmask = loginfo->u.log.logflags; + else +- bitmask = NF_LOG_MASK; ++ bitmask = NF_LOG_DEFAULT_MASK; + + if ((bitmask & EBT_LOG_IP) && eth_hdr(skb)->h_proto == + htons(ETH_P_IP)) { +diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c +index 53d664a7774c..bdea23e3d282 100644 +--- a/net/ipv4/netfilter/ip_tables.c ++++ b/net/ipv4/netfilter/ip_tables.c +@@ -210,7 +210,7 @@ static struct nf_loginfo trace_loginfo = { + .u = { + .log = { + .level = 4, +- .logflags = NF_LOG_MASK, ++ .logflags = NF_LOG_DEFAULT_MASK, + }, + }, + }; +diff --git a/net/ipv4/netfilter/nf_log_arp.c b/net/ipv4/netfilter/nf_log_arp.c +index e7ad950cf9ef..ad9cd0f0d5cd 100644 +--- a/net/ipv4/netfilter/nf_log_arp.c ++++ b/net/ipv4/netfilter/nf_log_arp.c +@@ -30,7 +30,7 @@ static struct nf_loginfo default_loginfo = { + .u = { + .log = { + .level = LOGLEVEL_NOTICE, +- .logflags = NF_LOG_MASK, ++ .logflags = NF_LOG_DEFAULT_MASK, + }, + }, + }; +diff --git a/net/ipv4/netfilter/nf_log_ipv4.c b/net/ipv4/netfilter/nf_log_ipv4.c +index 076aadda0473..00e7a0ad1ea2 100644 +--- a/net/ipv4/netfilter/nf_log_ipv4.c ++++ b/net/ipv4/netfilter/nf_log_ipv4.c +@@ -29,7 +29,7 @@ static struct nf_loginfo default_loginfo = { + .u = { + .log = { + .level = LOGLEVEL_NOTICE, +- .logflags = NF_LOG_MASK, ++ .logflags = NF_LOG_DEFAULT_MASK, + }, + }, + }; +@@ -46,7 +46,7 @@ static void dump_ipv4_packet(struct nf_log_buf *m, + if (info->type == NF_LOG_TYPE_LOG) + logflags = info->u.log.logflags; + else +- logflags = NF_LOG_MASK; ++ logflags = NF_LOG_DEFAULT_MASK; + + ih = skb_header_pointer(skb, iphoff, sizeof(_iph), &_iph); + if (ih == NULL) { +diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c +index f563cf3fcc4c..35f1075a97bd 100644 +--- a/net/ipv6/netfilter/ip6_tables.c ++++ b/net/ipv6/netfilter/ip6_tables.c +@@ -239,7 +239,7 @@ static struct nf_loginfo trace_loginfo = { + .u = { + .log = { + .level = LOGLEVEL_WARNING, +- .logflags = NF_LOG_MASK, ++ .logflags = NF_LOG_DEFAULT_MASK, + }, + }, + }; +diff --git a/net/ipv6/netfilter/nf_log_ipv6.c b/net/ipv6/netfilter/nf_log_ipv6.c +index 8dd869642f45..98c8586a94a2 100644 +--- a/net/ipv6/netfilter/nf_log_ipv6.c ++++ b/net/ipv6/netfilter/nf_log_ipv6.c +@@ -30,7 +30,7 @@ static struct nf_loginfo default_loginfo = { + .u = { + .log = { + .level = LOGLEVEL_NOTICE, +- .logflags = NF_LOG_MASK, ++ .logflags = NF_LOG_DEFAULT_MASK, + }, + }, + }; +@@ -52,7 +52,7 @@ static void dump_ipv6_packet(struct nf_log_buf *m, + if (info->type == NF_LOG_TYPE_LOG) + logflags = info->u.log.logflags; + else +- logflags = NF_LOG_MASK; ++ logflags = NF_LOG_DEFAULT_MASK; + + ih = skb_header_pointer(skb, ip6hoff, sizeof(_ip6h), &_ip6h); + if (ih == NULL) { +diff --git a/net/netfilter/nf_tables_core.c b/net/netfilter/nf_tables_core.c +index 99bc2f87a974..2e80a50f3899 100644 +--- a/net/netfilter/nf_tables_core.c ++++ b/net/netfilter/nf_tables_core.c +@@ -39,7 +39,7 @@ static struct nf_loginfo trace_loginfo = { + .u = { + .log = { + .level = LOGLEVEL_WARNING, +- .logflags = NF_LOG_MASK, ++ .logflags = NF_LOG_DEFAULT_MASK, + }, + }, + }; +diff --git a/net/netfilter/nft_log.c b/net/netfilter/nft_log.c +index 319c22b4bca2..2e5db32c82f1 100644 +--- a/net/netfilter/nft_log.c ++++ b/net/netfilter/nft_log.c +@@ -68,8 +68,11 @@ static int nft_log_init(const struct nft_ctx *ctx, + if (tb[NFTA_LOG_LEVEL] != NULL && + tb[NFTA_LOG_GROUP] != NULL) + return -EINVAL; +- if (tb[NFTA_LOG_GROUP] != NULL) ++ if (tb[NFTA_LOG_GROUP] != NULL) { + li->type = NF_LOG_TYPE_ULOG; ++ if (tb[NFTA_LOG_FLAGS] != NULL) ++ return -EINVAL; ++ } + + switch (li->type) { + case NF_LOG_TYPE_LOG: +@@ -82,6 +85,10 @@ static int nft_log_init(const struct nft_ctx *ctx, + if (tb[NFTA_LOG_FLAGS] != NULL) { + li->u.log.logflags = + ntohl(nla_get_be32(tb[NFTA_LOG_FLAGS])); ++ if (li->u.log.logflags & ~NF_LOG_MASK) { ++ err = -EINVAL; ++ goto err1; ++ } + } + break; + case NF_LOG_TYPE_ULOG: +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom/0008-netfilter-nft_log-restrict-the-log-prefix-length-to-.patch b/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom/0008-netfilter-nft_log-restrict-the-log-prefix-length-to-.patch new file mode 100644 index 0000000000000000000000000000000000000000..85bd50f441f0e4da0eeba6c244aadde86a989bb4 --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4-custom/0008-netfilter-nft_log-restrict-the-log-prefix-length-to-.patch @@ -0,0 +1,75 @@ +From 69cfdf5cbb0c848916db2b1bfd4495a382f43330 Mon Sep 17 00:00:00 2001 +From: Liping Zhang +Date: Sun, 22 Jan 2017 22:10:32 +0800 +Subject: [PATCH] netfilter: nft_log: restrict the log prefix length to 127 + +First, log prefix will be truncated to NF_LOG_PREFIXLEN-1, i.e. 127, +at nf_log_packet(), so the extra part is useless. + +Second, after adding a log rule with a very very long prefix, we will +fail to dump the nft rules after this _special_ one, but acctually, +they do exist. For example: + # name_65000=$(printf "%0.sQ" {1..65000}) + # nft add rule filter output log prefix "$name_65000" + # nft add rule filter output counter + # nft add rule filter output counter + # nft list chain filter output + table ip filter { + chain output { + type filter hook output priority 0; policy accept; + } + } + +So now, restrict the log prefix length to NF_LOG_PREFIXLEN-1. + +Fixes: 96518518cc41 ("netfilter: add nftables") +Signed-off-by: Liping Zhang +Signed-off-by: Pablo Neira Ayuso +(cherry picked from commit 5ce6b04ce96896e8a79e6f60740ced911eaac7a4) +Signed-off-by: Jeffy Chen +--- + include/uapi/linux/netfilter/nf_log.h | 2 ++ + net/netfilter/nf_log.c | 1 - + net/netfilter/nft_log.c | 3 ++- + 3 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/include/uapi/linux/netfilter/nf_log.h b/include/uapi/linux/netfilter/nf_log.h +index 8be21e02387d..d0b5fa91ff54 100644 +--- a/include/uapi/linux/netfilter/nf_log.h ++++ b/include/uapi/linux/netfilter/nf_log.h +@@ -9,4 +9,6 @@ + #define NF_LOG_MACDECODE 0x20 /* Decode MAC header */ + #define NF_LOG_MASK 0x2f + ++#define NF_LOG_PREFIXLEN 128 ++ + #endif /* _NETFILTER_NF_LOG_H */ +diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c +index f94a2e1172f0..45d0215ba584 100644 +--- a/net/netfilter/nf_log.c ++++ b/net/netfilter/nf_log.c +@@ -13,7 +13,6 @@ + /* Internal logging interface, which relies on the real + LOG target modules */ + +-#define NF_LOG_PREFIXLEN 128 + #define NFLOGGER_NAME_LEN 64 + + static struct nf_logger __rcu *loggers[NFPROTO_NUMPROTO][NF_LOG_TYPE_MAX] __read_mostly; +diff --git a/net/netfilter/nft_log.c b/net/netfilter/nft_log.c +index 2e5db32c82f1..5991f4bd6990 100644 +--- a/net/netfilter/nft_log.c ++++ b/net/netfilter/nft_log.c +@@ -38,7 +38,8 @@ static void nft_log_eval(const struct nft_expr *expr, + + static const struct nla_policy nft_log_policy[NFTA_LOG_MAX + 1] = { + [NFTA_LOG_GROUP] = { .type = NLA_U16 }, +- [NFTA_LOG_PREFIX] = { .type = NLA_STRING }, ++ [NFTA_LOG_PREFIX] = { .type = NLA_STRING, ++ .len = NF_LOG_PREFIXLEN - 1 }, + [NFTA_LOG_SNAPLEN] = { .type = NLA_U32 }, + [NFTA_LOG_QTHRESHOLD] = { .type = NLA_U16 }, + [NFTA_LOG_LEVEL] = { .type = NLA_U32 }, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_5.10-custom.bb b/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_5.10-custom.bb new file mode 100644 index 0000000000000000000000000000000000000000..25756114814d45d5cec07a1429df9e3621cb7077 --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_5.10-custom.bb @@ -0,0 +1,17 @@ +# Copyright (C) 2021, Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +require recipes-kernel/linux-libc-headers/linux-libc-headers.inc + +inherit auto-patch + +inherit freeze-rev local-git + +SRCREV = "72de5a560a44fb81549f1da325a1b3e323a7aaf7" +SRC_URI = " \ + git://github.com/JeffyCN/mirrors.git;protocol=https;nobranch=1;branch=kernel-5.10-2022_01_10; \ +" + +S = "${WORKDIR}/git" + +LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" diff --git a/bsp/meta-rockchip/recipes-kernel/linux/files/cgroups.cfg b/bsp/meta-rockchip/recipes-kernel/linux/files/cgroups.cfg new file mode 100644 index 0000000000000000000000000000000000000000..de40ae788fd1c9c10e55e2bf830742703016c6b3 --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux/files/cgroups.cfg @@ -0,0 +1 @@ +CONFIG_CGROUPS=y diff --git a/bsp/meta-rockchip/recipes-kernel/linux/files/config/ok3568/defconfig-kernel b/bsp/meta-rockchip/recipes-kernel/linux/files/config/ok3568/defconfig-kernel deleted file mode 100644 index 4adc4e50fbfbf2076e0a2ee3b0ee5d527f61f412..0000000000000000000000000000000000000000 --- a/bsp/meta-rockchip/recipes-kernel/linux/files/config/ok3568/defconfig-kernel +++ /dev/null @@ -1,6511 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# Linux/arm64 5.10.0 Kernel Configuration -# -CONFIG_CC_VERSION_TEXT="aarch64-openeuler-linux-gnu-gcc (crosstool-NG 1.25.0) 10.3.1" -CONFIG_CC_IS_GCC=y -CONFIG_GCC_VERSION=100301 -CONFIG_LD_VERSION=237000000 -CONFIG_CLANG_VERSION=0 -CONFIG_LLD_VERSION=0 -CONFIG_CC_CAN_LINK=y -CONFIG_CC_CAN_LINK_STATIC=y -CONFIG_CC_HAS_ASM_GOTO=y -CONFIG_CC_HAS_ASM_INLINE=y -CONFIG_IRQ_WORK=y -CONFIG_BUILDTIME_TABLE_SORT=y -CONFIG_THREAD_INFO_IN_TASK=y - -# -# General setup -# -CONFIG_INIT_ENV_ARG_LIMIT=32 -# CONFIG_COMPILE_TEST is not set -CONFIG_LOCALVERSION="" -# CONFIG_LOCALVERSION_AUTO is not set -CONFIG_BUILD_SALT="" -CONFIG_DEFAULT_INIT="" -CONFIG_DEFAULT_HOSTNAME="localhost" -CONFIG_SWAP=y -CONFIG_SYSVIPC=y -CONFIG_SYSVIPC_SYSCTL=y -CONFIG_POSIX_MQUEUE=y -CONFIG_POSIX_MQUEUE_SYSCTL=y -# CONFIG_WATCH_QUEUE is not set -CONFIG_CROSS_MEMORY_ATTACH=y -# CONFIG_USELIB is not set -# CONFIG_AUDIT is not set -CONFIG_HAVE_ARCH_AUDITSYSCALL=y - -# -# IRQ subsystem -# -CONFIG_GENERIC_IRQ_PROBE=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_IRQ_SHOW_LEVEL=y -CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y -CONFIG_GENERIC_IRQ_MIGRATION=y -CONFIG_HARDIRQS_SW_RESEND=y -CONFIG_GENERIC_IRQ_CHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_DOMAIN_HIERARCHY=y -CONFIG_GENERIC_IRQ_IPI=y -CONFIG_GENERIC_MSI_IRQ=y -CONFIG_GENERIC_MSI_IRQ_DOMAIN=y -CONFIG_IRQ_MSI_IOMMU=y -CONFIG_HANDLE_DOMAIN_IRQ=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_SPARSE_IRQ=y -# CONFIG_GENERIC_IRQ_DEBUGFS is not set -# end of IRQ subsystem - -CONFIG_GENERIC_IRQ_MULTI_HANDLER=y -CONFIG_GENERIC_TIME_VSYSCALL=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_ARCH_HAS_TICK_BROADCAST=y -CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y - -# -# Timers subsystem -# -CONFIG_TICK_ONESHOT=y -CONFIG_NO_HZ_COMMON=y -# CONFIG_HZ_PERIODIC is not set -CONFIG_NO_HZ_IDLE=y -# CONFIG_NO_HZ_FULL is not set -CONFIG_NO_HZ=y -CONFIG_HIGH_RES_TIMERS=y -# end of Timers subsystem - -# CONFIG_PREEMPT_NONE is not set -# CONFIG_PREEMPT_VOLUNTARY is not set -CONFIG_PREEMPT=y - -# -# CPU/Task time and stats accounting -# -CONFIG_TICK_CPU_ACCOUNTING=y -# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set -# CONFIG_IRQ_TIME_ACCOUNTING is not set -CONFIG_SCHED_THERMAL_PRESSURE=y -# CONFIG_BSD_PROCESS_ACCT is not set -# CONFIG_TASKSTATS is not set -# CONFIG_PSI is not set -# end of CPU/Task time and stats accounting - -CONFIG_CPU_ISOLATION=y - -# -# RCU Subsystem -# -CONFIG_TREE_RCU=y -# CONFIG_RCU_EXPERT is not set -CONFIG_SRCU=y -CONFIG_TREE_SRCU=y -CONFIG_TASKS_RCU_GENERIC=y -CONFIG_TASKS_RUDE_RCU=y -CONFIG_RCU_STALL_COMMON=y -CONFIG_RCU_NEED_SEGCBLIST=y -# end of RCU Subsystem - -CONFIG_IKCONFIG=y -CONFIG_IKCONFIG_PROC=y -# CONFIG_IKHEADERS is not set -CONFIG_LOG_BUF_SHIFT=18 -CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 -CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=13 -CONFIG_GENERIC_SCHED_CLOCK=y - -# -# Scheduler features -# -# CONFIG_UCLAMP_TASK is not set -# end of Scheduler features - -CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y -CONFIG_CC_HAS_INT128=y -CONFIG_ARCH_SUPPORTS_INT128=y -CONFIG_CGROUPS=y -# CONFIG_MEMCG is not set -# CONFIG_BLK_CGROUP is not set -CONFIG_CGROUP_SCHED=y -# CONFIG_QOS_SCHED is not set -# CONFIG_SCHED_PRIO_LB is not set -CONFIG_FAIR_GROUP_SCHED=y -CONFIG_CFS_BANDWIDTH=y -# CONFIG_RT_GROUP_SCHED is not set -# CONFIG_CGROUP_PIDS is not set -# CONFIG_CGROUP_RDMA is not set -CONFIG_CGROUP_FREEZER=y -CONFIG_CPUSETS=y -CONFIG_PROC_PID_CPUSET=y -CONFIG_CGROUP_DEVICE=y -CONFIG_CGROUP_CPUACCT=y -# CONFIG_CGROUP_PERF is not set -# CONFIG_CGROUP_DEBUG is not set -# CONFIG_CGROUP_FILES is not set -CONFIG_NAMESPACES=y -CONFIG_UTS_NS=y -CONFIG_TIME_NS=y -CONFIG_IPC_NS=y -CONFIG_USER_NS=y -CONFIG_PID_NS=y -CONFIG_NET_NS=y -# CONFIG_SCHED_STEAL is not set -# CONFIG_CHECKPOINT_RESTORE is not set -# CONFIG_SCHED_AUTOGROUP is not set -# CONFIG_SYSFS_DEPRECATED is not set -CONFIG_RELAY=y -CONFIG_BLK_DEV_INITRD=y -CONFIG_INITRAMFS_SOURCE="" -CONFIG_RD_GZIP=y -CONFIG_RD_BZIP2=y -CONFIG_RD_LZMA=y -CONFIG_RD_XZ=y -CONFIG_RD_LZO=y -CONFIG_RD_LZ4=y -CONFIG_RD_ZSTD=y -CONFIG_INITRAMFS_FILE_METADATA="" -# CONFIG_BOOT_CONFIG is not set -# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set -CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_LD_ORPHAN_WARN=y -CONFIG_SYSCTL=y -CONFIG_SYSCTL_EXCEPTION_TRACE=y -CONFIG_BPF=y -CONFIG_EXPERT=y -CONFIG_MULTIUSER=y -# CONFIG_SGETMASK_SYSCALL is not set -CONFIG_SYSFS_SYSCALL=y -CONFIG_FHANDLE=y -CONFIG_POSIX_TIMERS=y -CONFIG_PRINTK=y -CONFIG_PRINTK_NMI=y -CONFIG_BUG=y -CONFIG_ELF_CORE=y -CONFIG_BASE_FULL=y -CONFIG_FUTEX=y -CONFIG_FUTEX_PI=y -CONFIG_HAVE_FUTEX_CMPXCHG=y -CONFIG_EPOLL=y -CONFIG_SIGNALFD=y -CONFIG_TIMERFD=y -CONFIG_EVENTFD=y -CONFIG_SHMEM=y -CONFIG_AIO=y -CONFIG_IO_URING=y -CONFIG_ADVISE_SYSCALLS=y -CONFIG_MEMBARRIER=y -CONFIG_KALLSYMS=y -# CONFIG_KALLSYMS_ALL is not set -CONFIG_KALLSYMS_BASE_RELATIVE=y -# CONFIG_BPF_SYSCALL is not set -CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y -# CONFIG_USERFAULTFD is not set -CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y -CONFIG_KCMP=y -CONFIG_RSEQ=y -# CONFIG_DEBUG_RSEQ is not set -CONFIG_EMBEDDED=y -CONFIG_HAVE_PERF_EVENTS=y -# CONFIG_PC104 is not set - -# -# Kernel Performance Events And Counters -# -CONFIG_PERF_EVENTS=y -# CONFIG_DEBUG_PERF_USE_VMALLOC is not set -# end of Kernel Performance Events And Counters - -CONFIG_VM_EVENT_COUNTERS=y -CONFIG_SLUB_DEBUG=y -# CONFIG_COMPAT_BRK is not set -# CONFIG_SLAB is not set -CONFIG_SLUB=y -# CONFIG_SLOB is not set -CONFIG_SLAB_MERGE_DEFAULT=y -# CONFIG_SLAB_FREELIST_RANDOM is not set -# CONFIG_SLAB_FREELIST_HARDENED is not set -# CONFIG_SHUFFLE_PAGE_ALLOCATOR is not set -CONFIG_SLUB_CPU_PARTIAL=y -CONFIG_SYSTEM_DATA_VERIFICATION=y -CONFIG_PROFILING=y -CONFIG_TRACEPOINTS=y -CONFIG_KABI_RESERVE=y -CONFIG_KABI_SIZE_ALIGN_CHECKS=y -# end of General setup - -CONFIG_ARM64=y -CONFIG_64BIT=y -CONFIG_MMU=y -CONFIG_ARM64_PAGE_SHIFT=12 -CONFIG_ARM64_CONT_PTE_SHIFT=4 -CONFIG_ARM64_CONT_PMD_SHIFT=4 -CONFIG_ARCH_MMAP_RND_BITS_MIN=18 -CONFIG_ARCH_MMAP_RND_BITS_MAX=24 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 -CONFIG_STACKTRACE_SUPPORT=y -CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 -CONFIG_LOCKDEP_SUPPORT=y -CONFIG_TRACE_IRQFLAGS_SUPPORT=y -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y -CONFIG_GENERIC_HWEIGHT=y -CONFIG_GENERIC_CSUM=y -CONFIG_GENERIC_CALIBRATE_DELAY=y -CONFIG_ZONE_DMA=y -CONFIG_ZONE_DMA32=y -CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y -CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y -CONFIG_SMP=y -CONFIG_KERNEL_MODE_NEON=y -CONFIG_FIX_EARLYCON_MEM=y -CONFIG_PGTABLE_LEVELS=3 -CONFIG_ARCH_SUPPORTS_UPROBES=y -CONFIG_ARCH_PROC_KCORE_TEXT=y -CONFIG_ARCH_HAS_CPU_RELAX=y - -# -# Platform selection -# -# CONFIG_ARCH_ACTIONS is not set -# CONFIG_ARCH_AGILEX is not set -# CONFIG_ARCH_SUNXI is not set -# CONFIG_ARCH_ALPINE is not set -# CONFIG_ARCH_BCM2835 is not set -# CONFIG_ARCH_BCM_IPROC is not set -# CONFIG_ARCH_BERLIN is not set -# CONFIG_ARCH_BITMAIN is not set -# CONFIG_ARCH_BRCMSTB is not set -# CONFIG_ARCH_EXYNOS is not set -# CONFIG_ARCH_SPARX5 is not set -# CONFIG_ARCH_K3 is not set -# CONFIG_ARCH_LAYERSCAPE is not set -# CONFIG_ARCH_LG1K is not set -# CONFIG_ARCH_HISI is not set -# CONFIG_ARCH_KEEMBAY is not set -# CONFIG_ARCH_MEDIATEK is not set -# CONFIG_ARCH_MESON is not set -# CONFIG_ARCH_MVEBU is not set -# CONFIG_ARCH_MXC is not set -# CONFIG_ARCH_PHYTIUM is not set -# CONFIG_ARCH_QCOM is not set -# CONFIG_ARCH_REALTEK is not set -# CONFIG_ARCH_RENESAS is not set -CONFIG_ARCH_ROCKCHIP=y -# CONFIG_ARCH_S32 is not set -# CONFIG_ARCH_SEATTLE is not set -# CONFIG_ARCH_STRATIX10 is not set -# CONFIG_ARCH_SYNQUACER is not set -# CONFIG_ARCH_TEGRA is not set -# CONFIG_ARCH_SPRD is not set -# CONFIG_ARCH_THUNDER is not set -# CONFIG_ARCH_THUNDER2 is not set -# CONFIG_ARCH_UNIPHIER is not set -# CONFIG_ARCH_VEXPRESS is not set -# CONFIG_ARCH_VISCONTI is not set -# CONFIG_ARCH_XGENE is not set -# CONFIG_ARCH_ZX is not set -# CONFIG_ARCH_ZYNQMP is not set -# end of Platform selection - -CONFIG_HAVE_LIVEPATCH_WO_FTRACE=y - -# -# Enable Livepatch -# -# end of Enable Livepatch - -# -# Kernel Features -# - -# -# ARM errata workarounds via the alternatives framework -# -# CONFIG_ARM64_ERRATUM_826319 is not set -# CONFIG_ARM64_ERRATUM_827319 is not set -# CONFIG_ARM64_ERRATUM_824069 is not set -# CONFIG_ARM64_ERRATUM_819472 is not set -# CONFIG_ARM64_ERRATUM_832075 is not set -CONFIG_ARM64_ERRATUM_843419=y -CONFIG_ARM64_ERRATUM_1024718=y -CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT=y -CONFIG_ARM64_ERRATUM_1165522=y -CONFIG_ARM64_ERRATUM_1319367=y -CONFIG_ARM64_ERRATUM_1530923=y -CONFIG_ARM64_WORKAROUND_REPEAT_TLBI=y -CONFIG_ARM64_ERRATUM_1286807=y -CONFIG_ARM64_ERRATUM_1463225=y -CONFIG_ARM64_ERRATUM_1542419=y -CONFIG_ARM64_ERRATUM_1508412=y -# CONFIG_CAVIUM_ERRATUM_22375 is not set -# CONFIG_CAVIUM_ERRATUM_23154 is not set -CONFIG_CAVIUM_ERRATUM_27456=y -CONFIG_CAVIUM_ERRATUM_30115=y -CONFIG_CAVIUM_TX2_ERRATUM_219=y -CONFIG_FUJITSU_ERRATUM_010001=y -CONFIG_HISILICON_ERRATUM_161600802=y -# CONFIG_HISILICON_ERRATUM_1980005 is not set -CONFIG_QCOM_FALKOR_ERRATUM_1003=y -CONFIG_QCOM_FALKOR_ERRATUM_1009=y -CONFIG_QCOM_QDF2400_ERRATUM_0065=y -CONFIG_QCOM_FALKOR_ERRATUM_E1041=y -CONFIG_SOCIONEXT_SYNQUACER_PREITS=y -CONFIG_HISILICON_ERRATUM_HIP08_RU_PREFETCH=y -# CONFIG_HISILICON_HIP08_RU_PREFETCH_DEFAULT_OFF is not set -# end of ARM errata workarounds via the alternatives framework - -CONFIG_ARM64_4K_PAGES=y -# CONFIG_ARM64_16K_PAGES is not set -# CONFIG_ARM64_64K_PAGES is not set -CONFIG_ARM64_VA_BITS_39=y -# CONFIG_ARM64_VA_BITS_48 is not set -CONFIG_ARM64_VA_BITS=39 -CONFIG_ARM64_PA_BITS_48=y -CONFIG_ARM64_PA_BITS=48 -# CONFIG_CPU_BIG_ENDIAN is not set -CONFIG_CPU_LITTLE_ENDIAN=y -CONFIG_SCHED_MC=y -# CONFIG_SCHED_CLUSTER is not set -# CONFIG_SCHED_SMT is not set -CONFIG_NR_CPUS=8 -CONFIG_HOTPLUG_CPU=y -# CONFIG_ARM64_BOOTPARAM_HOTPLUG_CPU0 is not set -# CONFIG_NUMA is not set -# CONFIG_HZ_100 is not set -# CONFIG_HZ_250 is not set -CONFIG_HZ_300=y -# CONFIG_HZ_1000 is not set -CONFIG_HZ=300 -CONFIG_SCHED_HRTICK=y -CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y -CONFIG_ARCH_SPARSEMEM_ENABLE=y -CONFIG_ARCH_SPARSEMEM_DEFAULT=y -CONFIG_ARCH_SELECT_MEMORY_MODEL=y -CONFIG_ARCH_FLATMEM_ENABLE=y -CONFIG_HAVE_ARCH_PFN_VALID=y -CONFIG_HW_PERF_EVENTS=y -CONFIG_SYS_SUPPORTS_HUGETLBFS=y -CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y -CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y -CONFIG_ARCH_LLC_128_LINE_SIZE=y -CONFIG_ARCH_HAS_FILTER_PGPROT=y -CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK=y -# CONFIG_PARAVIRT is not set -# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set -# CONFIG_KEXEC is not set -# CONFIG_KEXEC_FILE is not set -# CONFIG_CRASH_DUMP is not set -# CONFIG_XEN is not set -CONFIG_FORCE_MAX_ZONEORDER=11 -CONFIG_UNMAP_KERNEL_AT_EL0=y -CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY=y -CONFIG_RODATA_FULL_DEFAULT_ENABLED=y -# CONFIG_ARM64_PMEM_LEGACY is not set -# CONFIG_ARM64_SW_TTBR0_PAN is not set -CONFIG_ARM64_TAGGED_ADDR_ABI=y -# CONFIG_AARCH32_EL0 is not set - -# -# ARMv8.1 architectural features -# -CONFIG_ARM64_HW_AFDBM=y -CONFIG_ARM64_PAN=y -CONFIG_AS_HAS_LSE_ATOMICS=y -CONFIG_ARM64_VHE=y -# end of ARMv8.1 architectural features - -# -# ARMv8.2 architectural features -# -# CONFIG_ARM64_PMEM is not set -CONFIG_ARM64_RAS_EXTN=y -CONFIG_ARM64_CNP=y -# end of ARMv8.2 architectural features - -# -# ARMv8.3 architectural features -# -CONFIG_ARM64_PTR_AUTH=y -CONFIG_CC_HAS_BRANCH_PROT_PAC_RET=y -CONFIG_CC_HAS_SIGN_RETURN_ADDRESS=y -CONFIG_AS_HAS_PAC=y -CONFIG_AS_HAS_CFI_NEGATE_RA_STATE=y -# end of ARMv8.3 architectural features - -# -# ARMv8.4 architectural features -# -CONFIG_ARM64_AMU_EXTN=y -CONFIG_AS_HAS_ARMV8_4=y -CONFIG_ARM64_TLB_RANGE=y -# end of ARMv8.4 architectural features - -# -# ARMv8.5 architectural features -# -CONFIG_ARM64_BTI=y -CONFIG_ARM64_BTI_KERNEL=y -CONFIG_CC_HAS_BRANCH_PROT_PAC_RET_BTI=y -CONFIG_ARM64_E0PD=y -CONFIG_ARCH_RANDOM=y -CONFIG_ARM64_AS_HAS_MTE=y -CONFIG_ARM64_MTE=y -# end of ARMv8.5 architectural features - -# -# ARMv8.6 architectural features -# -CONFIG_ARM64_TWED=y -# end of ARMv8.6 architectural features - -# -# ARMv8.7 architectural features -# -CONFIG_ARM64_EPAN=y -# end of ARMv8.7 architectural features - -CONFIG_ARM64_SVE=y -CONFIG_ARM64_SME=y -CONFIG_ARM64_MODULE_PLTS=y -# CONFIG_ARM64_PSEUDO_NMI is not set -CONFIG_RELOCATABLE=y -# CONFIG_RANDOMIZE_BASE is not set -CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y -CONFIG_STACKPROTECTOR_PER_TASK=y -# CONFIG_ASCEND_FEATURES is not set -# end of Kernel Features - -# -# Boot options -# -CONFIG_CMDLINE="" -# CONFIG_EFI is not set -# end of Boot options - -# -# Power management options -# -CONFIG_SUSPEND=y -CONFIG_SUSPEND_FREEZER=y -# CONFIG_SUSPEND_SKIP_SYNC is not set -# CONFIG_HIBERNATION is not set -CONFIG_PM_SLEEP=y -CONFIG_PM_SLEEP_SMP=y -# CONFIG_PM_AUTOSLEEP is not set -# CONFIG_PM_WAKELOCKS is not set -CONFIG_PM=y -CONFIG_PM_DEBUG=y -CONFIG_PM_ADVANCED_DEBUG=y -# CONFIG_PM_TEST_SUSPEND is not set -CONFIG_PM_SLEEP_DEBUG=y -# CONFIG_DPM_WATCHDOG is not set -CONFIG_PM_CLK=y -CONFIG_PM_GENERIC_DOMAINS=y -CONFIG_WQ_POWER_EFFICIENT_DEFAULT=y -CONFIG_PM_GENERIC_DOMAINS_SLEEP=y -CONFIG_PM_GENERIC_DOMAINS_OF=y -CONFIG_CPU_PM=y -CONFIG_ENERGY_MODEL=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -# end of Power management options - -# -# CPU Power Management -# - -# -# CPU Idle -# -CONFIG_CPU_IDLE=y -CONFIG_CPU_IDLE_MULTIPLE_DRIVERS=y -# CONFIG_CPU_IDLE_GOV_LADDER is not set -CONFIG_CPU_IDLE_GOV_MENU=y -# CONFIG_CPU_IDLE_GOV_TEO is not set -# CONFIG_CPU_IDLE_GOV_HALTPOLL is not set -CONFIG_DT_IDLE_STATES=y - -# -# ARM CPU Idle Drivers -# -CONFIG_ARM_CPUIDLE=y -# CONFIG_ARM_PSCI_CPUIDLE is not set -# end of ARM CPU Idle Drivers - -CONFIG_HALTPOLL_CPUIDLE=y -# end of CPU Idle - -# -# CPU Frequency scaling -# -CONFIG_CPU_FREQ=y -CONFIG_CPU_FREQ_GOV_ATTR_SET=y -CONFIG_CPU_FREQ_GOV_COMMON=y -# CONFIG_CPU_FREQ_STAT is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set -CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL=y -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -CONFIG_CPU_FREQ_GOV_POWERSAVE=y -CONFIG_CPU_FREQ_GOV_USERSPACE=y -CONFIG_CPU_FREQ_GOV_ONDEMAND=y -CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y -CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y - -# -# CPU frequency scaling drivers -# -CONFIG_CPUFREQ_DT=y -CONFIG_CPUFREQ_DT_PLATDEV=y -# CONFIG_ARM_SCMI_CPUFREQ is not set -# end of CPU Frequency scaling -# end of CPU Power Management - -# -# Firmware Drivers -# -CONFIG_ARM_SCMI_PROTOCOL=y -CONFIG_ARM_SCMI_POWER_DOMAIN=y -# CONFIG_ARM_SCPI_PROTOCOL is not set -# CONFIG_ARM_SDE_INTERFACE is not set -# CONFIG_FIRMWARE_MEMMAP is not set -# CONFIG_FW_CFG_SYSFS is not set -CONFIG_ROCKCHIP_SIP=y -# CONFIG_GOOGLE_FIRMWARE is not set -CONFIG_ARM_PSCI_FW=y -# CONFIG_ARM_PSCI_CHECKER is not set -CONFIG_HAVE_ARM_SMCCC=y -CONFIG_HAVE_ARM_SMCCC_DISCOVERY=y -CONFIG_ARM_SMCCC_SOC_ID=y - -# -# Tegra firmware driver -# -# end of Tegra firmware driver -# end of Firmware Drivers - -# CONFIG_VIRTUALIZATION is not set -CONFIG_ARM64_CRYPTO=y -CONFIG_CRYPTO_SHA256_ARM64=y -# CONFIG_CRYPTO_SHA512_ARM64 is not set -CONFIG_CRYPTO_SHA1_ARM64_CE=y -CONFIG_CRYPTO_SHA2_ARM64_CE=y -# CONFIG_CRYPTO_SHA512_ARM64_CE is not set -# CONFIG_CRYPTO_SHA3_ARM64 is not set -# CONFIG_CRYPTO_SM3_ARM64_CE is not set -# CONFIG_CRYPTO_SM4_ARM64_CE is not set -# CONFIG_CRYPTO_SM4_ARM64_CE_BLK is not set -# CONFIG_CRYPTO_SM4_ARM64_NEON_BLK is not set -CONFIG_CRYPTO_GHASH_ARM64_CE=y -# CONFIG_CRYPTO_CRCT10DIF_ARM64_CE is not set -CONFIG_CRYPTO_AES_ARM64=y -CONFIG_CRYPTO_AES_ARM64_CE=y -CONFIG_CRYPTO_AES_ARM64_CE_CCM=y -CONFIG_CRYPTO_AES_ARM64_CE_BLK=y -# CONFIG_CRYPTO_AES_ARM64_NEON_BLK is not set -# CONFIG_CRYPTO_CHACHA20_NEON is not set -# CONFIG_CRYPTO_POLY1305_NEON is not set -# CONFIG_CRYPTO_NHPOLY1305_NEON is not set -# CONFIG_CRYPTO_AES_ARM64_BS is not set - -# -# General architecture-dependent options -# -# CONFIG_KPROBES is not set -# CONFIG_JUMP_LABEL is not set -CONFIG_UPROBES=y -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_HAVE_KPROBES=y -CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_FUNCTION_ERROR_INJECTION=y -CONFIG_HAVE_NMI=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_IDLE_POLL_SETUP=y -CONFIG_ARCH_HAS_FORTIFY_SOURCE=y -CONFIG_ARCH_HAS_KEEPINITRD=y -CONFIG_ARCH_HAS_SET_MEMORY=y -CONFIG_ARCH_HAS_SET_DIRECT_MAP=y -CONFIG_HAVE_ARCH_THREAD_STRUCT_WHITELIST=y -# CONFIG_HAVE_ASM_MODVERSIONS is not set -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y -CONFIG_HAVE_RSEQ=y -CONFIG_HAVE_RUST=y -CONFIG_HAVE_FUNCTION_ARG_ACCESS_API=y -CONFIG_HAVE_HW_BREAKPOINT=y -CONFIG_HAVE_PERF_REGS=y -CONFIG_HAVE_PERF_USER_STACK_DUMP=y -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_HAVE_ARCH_JUMP_LABEL_RELATIVE=y -CONFIG_MMU_GATHER_TABLE_FREE=y -CONFIG_MMU_GATHER_RCU_TABLE_FREE=y -CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y -CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y -CONFIG_HAVE_CMPXCHG_LOCAL=y -CONFIG_HAVE_CMPXCHG_DOUBLE=y -CONFIG_HAVE_ARCH_SECCOMP=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_SECCOMP=y -CONFIG_SECCOMP_FILTER=y -# CONFIG_SECCOMP_CACHE_DEBUG is not set -CONFIG_HAVE_ARCH_STACKLEAK=y -CONFIG_HAVE_STACKPROTECTOR=y -CONFIG_STACKPROTECTOR=y -CONFIG_STACKPROTECTOR_STRONG=y -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y -CONFIG_HAVE_MOVE_PUD=y -CONFIG_HAVE_MOVE_PMD=y -CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y -CONFIG_HAVE_ARCH_HUGE_VMAP=y -CONFIG_HAVE_ARCH_HUGE_VMALLOC=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_MODULES_USE_ELF_RELA=y -CONFIG_ARCH_HAS_ELF_RANDOMIZE=y -CONFIG_HAVE_ARCH_MMAP_RND_BITS=y -CONFIG_ARCH_MMAP_RND_BITS=18 -CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT=y -CONFIG_CLONE_BACKWARDS=y -# CONFIG_COMPAT_32BIT_TIME is not set -CONFIG_HAVE_ARCH_VMAP_STACK=y -CONFIG_VMAP_STACK=y -CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y -CONFIG_STRICT_KERNEL_RWX=y -CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y -CONFIG_STRICT_MODULE_RWX=y -CONFIG_HAVE_ARCH_COMPILER_H=y -CONFIG_HAVE_ARCH_PREL32_RELOCATIONS=y -# CONFIG_LOCK_EVENT_COUNTS is not set -CONFIG_ARCH_HAS_RELR=y -CONFIG_ARCH_WANT_LD_ORPHAN_WARN=y -CONFIG_ARCH_SUPPORTS_PAGE_TABLE_CHECK=y - -# -# GCOV-based kernel profiling -# -# CONFIG_GCOV_KERNEL is not set -CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y -# end of GCOV-based kernel profiling - -CONFIG_HAVE_GCC_PLUGINS=y -CONFIG_GCC_PLUGINS=y -# CONFIG_GCC_PLUGIN_CYC_COMPLEXITY is not set -# CONFIG_GCC_PLUGIN_LATENT_ENTROPY is not set -# CONFIG_GCC_PLUGIN_RANDSTRUCT is not set -# end of General architecture-dependent options - -CONFIG_RT_MUTEXES=y -CONFIG_BASE_SMALL=0 -CONFIG_MODULES=y -CONFIG_MODULE_FORCE_LOAD=y -CONFIG_MODULE_UNLOAD=y -CONFIG_MODULE_FORCE_UNLOAD=y -# CONFIG_MODVERSIONS is not set -# CONFIG_MODULE_SRCVERSION_ALL is not set -# CONFIG_MODULE_SIG is not set -# CONFIG_MODULE_COMPRESS is not set -# CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS is not set -# CONFIG_UNUSED_SYMBOLS is not set -# CONFIG_TRIM_UNUSED_KSYMS is not set -CONFIG_MODULES_TREE_LOOKUP=y -CONFIG_BLOCK=y -CONFIG_BLK_SCSI_REQUEST=y -CONFIG_BLK_DEV_BSG=y -# CONFIG_BLK_DEV_BSGLIB is not set -# CONFIG_BLK_DEV_INTEGRITY is not set -# CONFIG_BLK_DEV_ZONED is not set -# CONFIG_BLK_CMDLINE_PARSER is not set -# CONFIG_BLK_WBT is not set -CONFIG_BLK_DEBUG_FS=y -# CONFIG_BLK_SED_OPAL is not set -# CONFIG_BLK_INLINE_ENCRYPTION is not set - -# -# Partition Types -# -CONFIG_PARTITION_ADVANCED=y -# CONFIG_ACORN_PARTITION is not set -# CONFIG_AIX_PARTITION is not set -# CONFIG_OSF_PARTITION is not set -# CONFIG_AMIGA_PARTITION is not set -# CONFIG_ATARI_PARTITION is not set -# CONFIG_MAC_PARTITION is not set -CONFIG_MSDOS_PARTITION=y -# CONFIG_BSD_DISKLABEL is not set -# CONFIG_MINIX_SUBPARTITION is not set -# CONFIG_SOLARIS_X86_PARTITION is not set -# CONFIG_UNIXWARE_DISKLABEL is not set -# CONFIG_LDM_PARTITION is not set -# CONFIG_SGI_PARTITION is not set -# CONFIG_ULTRIX_PARTITION is not set -# CONFIG_SUN_PARTITION is not set -# CONFIG_KARMA_PARTITION is not set -CONFIG_EFI_PARTITION=y -# CONFIG_SYSV68_PARTITION is not set -# CONFIG_CMDLINE_PARTITION is not set -# end of Partition Types - -CONFIG_BLK_MQ_PCI=y -CONFIG_BLK_PM=y - -# -# IO Schedulers -# -CONFIG_MQ_IOSCHED_DEADLINE=y -CONFIG_MQ_IOSCHED_KYBER=y -# CONFIG_IOSCHED_BFQ is not set -# end of IO Schedulers - -CONFIG_ASN1=y -CONFIG_ARCH_INLINE_SPIN_TRYLOCK=y -CONFIG_ARCH_INLINE_SPIN_TRYLOCK_BH=y -CONFIG_ARCH_INLINE_SPIN_LOCK=y -CONFIG_ARCH_INLINE_SPIN_LOCK_BH=y -CONFIG_ARCH_INLINE_SPIN_LOCK_IRQ=y -CONFIG_ARCH_INLINE_SPIN_LOCK_IRQSAVE=y -CONFIG_ARCH_INLINE_SPIN_UNLOCK=y -CONFIG_ARCH_INLINE_SPIN_UNLOCK_BH=y -CONFIG_ARCH_INLINE_SPIN_UNLOCK_IRQ=y -CONFIG_ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE=y -CONFIG_ARCH_INLINE_READ_LOCK=y -CONFIG_ARCH_INLINE_READ_LOCK_BH=y -CONFIG_ARCH_INLINE_READ_LOCK_IRQ=y -CONFIG_ARCH_INLINE_READ_LOCK_IRQSAVE=y -CONFIG_ARCH_INLINE_READ_UNLOCK=y -CONFIG_ARCH_INLINE_READ_UNLOCK_BH=y -CONFIG_ARCH_INLINE_READ_UNLOCK_IRQ=y -CONFIG_ARCH_INLINE_READ_UNLOCK_IRQRESTORE=y -CONFIG_ARCH_INLINE_WRITE_LOCK=y -CONFIG_ARCH_INLINE_WRITE_LOCK_BH=y -CONFIG_ARCH_INLINE_WRITE_LOCK_IRQ=y -CONFIG_ARCH_INLINE_WRITE_LOCK_IRQSAVE=y -CONFIG_ARCH_INLINE_WRITE_UNLOCK=y -CONFIG_ARCH_INLINE_WRITE_UNLOCK_BH=y -CONFIG_ARCH_INLINE_WRITE_UNLOCK_IRQ=y -CONFIG_ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE=y -CONFIG_UNINLINE_SPIN_UNLOCK=y -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_MUTEX_SPIN_ON_OWNER=y -CONFIG_RWSEM_SPIN_ON_OWNER=y -CONFIG_LOCK_SPIN_ON_OWNER=y -CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y -CONFIG_QUEUED_SPINLOCKS=y -CONFIG_ARCH_USE_QUEUED_RWLOCKS=y -CONFIG_QUEUED_RWLOCKS=y -CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE=y -CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y -CONFIG_FREEZER=y - -# -# Executable file formats -# -CONFIG_BINFMT_ELF=y -CONFIG_ARCH_BINFMT_ELF_STATE=y -CONFIG_ARCH_HAVE_ELF_PROT=y -CONFIG_ARCH_USE_GNU_PROPERTY=y -CONFIG_ELFCORE=y -CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y -CONFIG_BINFMT_SCRIPT=y -# CONFIG_BINFMT_MISC is not set -CONFIG_COREDUMP=y -# end of Executable file formats - -# -# Memory Management options -# -CONFIG_SELECT_MEMORY_MODEL=y -# CONFIG_FLATMEM_MANUAL is not set -CONFIG_SPARSEMEM_MANUAL=y -CONFIG_SPARSEMEM=y -CONFIG_SPARSEMEM_EXTREME=y -CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y -CONFIG_SPARSEMEM_VMEMMAP=y -CONFIG_HAVE_FAST_GUP=y -CONFIG_HOLES_IN_ZONE=y -CONFIG_ARCH_KEEP_MEMBLOCK=y -CONFIG_MEMORY_ISOLATION=y -# CONFIG_MEMORY_HOTPLUG is not set -CONFIG_SPLIT_PTLOCK_CPUS=4 -# CONFIG_COMPACTION is not set -# CONFIG_PAGE_REPORTING is not set -CONFIG_MIGRATION=y -# CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED is not set -CONFIG_CONTIG_ALLOC=y -CONFIG_PHYS_ADDR_T_64BIT=y -CONFIG_BOUNCE=y -# CONFIG_KSM is not set -CONFIG_DEFAULT_MMAP_MIN_ADDR=32768 -CONFIG_ARCH_SUPPORTS_MEMORY_FAILURE=y -# CONFIG_MEMORY_FAILURE is not set -# CONFIG_TRANSPARENT_HUGEPAGE is not set -# CONFIG_CLEANCACHE is not set -# CONFIG_FRONTSWAP is not set -# CONFIG_ETMEM_SCAN is not set -# CONFIG_ETMEM_SWAP is not set -# CONFIG_PAGE_CACHE_LIMIT is not set -CONFIG_CMA=y -# CONFIG_CMA_DEBUG is not set -# CONFIG_CMA_DEBUGFS is not set -CONFIG_CMA_AREAS=7 -# CONFIG_ZPOOL is not set -# CONFIG_ZBUD is not set -CONFIG_ZSMALLOC=y -# CONFIG_ZSMALLOC_STAT is not set -CONFIG_GENERIC_EARLY_IOREMAP=y -# CONFIG_DEFERRED_STRUCT_PAGE_INIT is not set -# CONFIG_IDLE_PAGE_TRACKING is not set -CONFIG_ARCH_HAS_PTE_DEVMAP=y -CONFIG_FRAME_VECTOR=y -CONFIG_ARCH_USES_HIGH_VMA_FLAGS=y -# CONFIG_PERCPU_STATS is not set -# CONFIG_GUP_BENCHMARK is not set -CONFIG_ARCH_HAS_PTE_SPECIAL=y -# CONFIG_PIN_MEMORY is not set -# CONFIG_CLEAR_FREELIST_PAGE is not set - -# -# Data Access Monitoring -# -# CONFIG_DAMON is not set -# end of Data Access Monitoring -# end of Memory Management options - -CONFIG_NET=y -CONFIG_NET_INGRESS=y -CONFIG_SKB_EXTENSIONS=y - -# -# Networking options -# -CONFIG_PACKET=y -# CONFIG_PACKET_DIAG is not set -CONFIG_UNIX=y -CONFIG_UNIX_SCM=y -# CONFIG_UNIX_DIAG is not set -# CONFIG_TLS is not set -CONFIG_XFRM=y -CONFIG_XFRM_ALGO=y -CONFIG_XFRM_USER=y -# CONFIG_XFRM_INTERFACE is not set -# CONFIG_XFRM_SUB_POLICY is not set -# CONFIG_XFRM_MIGRATE is not set -# CONFIG_XFRM_STATISTICS is not set -CONFIG_NET_KEY=y -# CONFIG_NET_KEY_MIGRATE is not set -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -CONFIG_IP_ADVANCED_ROUTER=y -# CONFIG_IP_FIB_TRIE_STATS is not set -# CONFIG_IP_MULTIPLE_TABLES is not set -# CONFIG_IP_ROUTE_MULTIPATH is not set -# CONFIG_IP_ROUTE_VERBOSE is not set -# CONFIG_IP_PNP is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPGRE_DEMUX is not set -CONFIG_IP_MROUTE_COMMON=y -CONFIG_IP_MROUTE=y -# CONFIG_IP_MROUTE_MULTIPLE_TABLES is not set -# CONFIG_IP_PIMSM_V1 is not set -# CONFIG_IP_PIMSM_V2 is not set -CONFIG_SYN_COOKIES=y -# CONFIG_NET_IPVTI is not set -# CONFIG_NET_FOU is not set -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_INET_DIAG is not set -# CONFIG_TCP_CONG_ADVANCED is not set -CONFIG_TCP_CONG_CUBIC=y -CONFIG_DEFAULT_TCP_CONG="cubic" -# CONFIG_TCP_MD5SIG is not set -# CONFIG_TCP_COMP is not set -CONFIG_IPV6=y -# CONFIG_IPV6_ROUTER_PREF is not set -# CONFIG_IPV6_OPTIMISTIC_DAD is not set -# CONFIG_INET6_AH is not set -# CONFIG_INET6_ESP is not set -# CONFIG_INET6_IPCOMP is not set -# CONFIG_IPV6_MIP6 is not set -# CONFIG_IPV6_ILA is not set -# CONFIG_IPV6_VTI is not set -# CONFIG_IPV6_SIT is not set -# CONFIG_IPV6_TUNNEL is not set -# CONFIG_IPV6_MULTIPLE_TABLES is not set -# CONFIG_IPV6_MROUTE is not set -# CONFIG_IPV6_SEG6_LWTUNNEL is not set -# CONFIG_IPV6_SEG6_HMAC is not set -# CONFIG_IPV6_RPL_LWTUNNEL is not set -# CONFIG_MPTCP is not set -# CONFIG_NETWORK_SECMARK is not set -CONFIG_NET_PTP_CLASSIFY=y -# CONFIG_NETWORK_PHY_TIMESTAMPING is not set -CONFIG_NETFILTER=y -CONFIG_NETFILTER_ADVANCED=y - -# -# Core Netfilter Configuration -# -CONFIG_NETFILTER_INGRESS=y -# CONFIG_NETFILTER_NETLINK_ACCT is not set -# CONFIG_NETFILTER_NETLINK_QUEUE is not set -# CONFIG_NETFILTER_NETLINK_LOG is not set -# CONFIG_NETFILTER_NETLINK_OSF is not set -CONFIG_NF_CONNTRACK=y -# CONFIG_NF_LOG_NETDEV is not set -# CONFIG_NF_CONNTRACK_MARK is not set -# CONFIG_NF_CONNTRACK_ZONES is not set -CONFIG_NF_CONNTRACK_PROCFS=y -# CONFIG_NF_CONNTRACK_EVENTS is not set -# CONFIG_NF_CONNTRACK_TIMEOUT is not set -# CONFIG_NF_CONNTRACK_TIMESTAMP is not set -# CONFIG_NF_CONNTRACK_LABELS is not set -CONFIG_NF_CT_PROTO_DCCP=y -CONFIG_NF_CT_PROTO_SCTP=y -CONFIG_NF_CT_PROTO_UDPLITE=y -# CONFIG_NF_CONNTRACK_AMANDA is not set -# CONFIG_NF_CONNTRACK_FTP is not set -# CONFIG_NF_CONNTRACK_H323 is not set -# CONFIG_NF_CONNTRACK_IRC is not set -# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set -# CONFIG_NF_CONNTRACK_SNMP is not set -# CONFIG_NF_CONNTRACK_PPTP is not set -# CONFIG_NF_CONNTRACK_SANE is not set -# CONFIG_NF_CONNTRACK_SIP is not set -# CONFIG_NF_CONNTRACK_TFTP is not set -# CONFIG_NF_CT_NETLINK is not set -CONFIG_NF_NAT=y -CONFIG_NF_NAT_REDIRECT=y -CONFIG_NF_NAT_MASQUERADE=y -# CONFIG_NF_TABLES is not set -CONFIG_NETFILTER_XTABLES=y - -# -# Xtables combined modules -# -# CONFIG_NETFILTER_XT_MARK is not set -# CONFIG_NETFILTER_XT_CONNMARK is not set - -# -# Xtables targets -# -# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set -# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set -# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set -# CONFIG_NETFILTER_XT_TARGET_DSCP is not set -# CONFIG_NETFILTER_XT_TARGET_HL is not set -# CONFIG_NETFILTER_XT_TARGET_HMARK is not set -# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set -# CONFIG_NETFILTER_XT_TARGET_LED is not set -# CONFIG_NETFILTER_XT_TARGET_LOG is not set -# CONFIG_NETFILTER_XT_TARGET_MARK is not set -CONFIG_NETFILTER_XT_NAT=y -CONFIG_NETFILTER_XT_TARGET_NETMAP=y -# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set -# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set -# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set -CONFIG_NETFILTER_XT_TARGET_REDIRECT=y -CONFIG_NETFILTER_XT_TARGET_MASQUERADE=y -# CONFIG_NETFILTER_XT_TARGET_TEE is not set -# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set -# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set -# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set - -# -# Xtables matches -# -# CONFIG_NETFILTER_XT_MATCH_ADDRTYPE is not set -# CONFIG_NETFILTER_XT_MATCH_BPF is not set -# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set -# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set -# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set -# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set -# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set -# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set -# CONFIG_NETFILTER_XT_MATCH_CONNTRACK is not set -# CONFIG_NETFILTER_XT_MATCH_CPU is not set -# CONFIG_NETFILTER_XT_MATCH_DCCP is not set -# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set -# CONFIG_NETFILTER_XT_MATCH_DSCP is not set -# CONFIG_NETFILTER_XT_MATCH_ECN is not set -# CONFIG_NETFILTER_XT_MATCH_ESP is not set -# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_HELPER is not set -# CONFIG_NETFILTER_XT_MATCH_HL is not set -# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set -# CONFIG_NETFILTER_XT_MATCH_IPRANGE is not set -# CONFIG_NETFILTER_XT_MATCH_L2TP is not set -# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set -# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_MAC is not set -# CONFIG_NETFILTER_XT_MATCH_MARK is not set -# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set -# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set -# CONFIG_NETFILTER_XT_MATCH_OSF is not set -# CONFIG_NETFILTER_XT_MATCH_OWNER is not set -# CONFIG_NETFILTER_XT_MATCH_POLICY is not set -# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set -# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set -# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set -# CONFIG_NETFILTER_XT_MATCH_REALM is not set -# CONFIG_NETFILTER_XT_MATCH_RECENT is not set -# CONFIG_NETFILTER_XT_MATCH_SCTP is not set -# CONFIG_NETFILTER_XT_MATCH_SOCKET is not set -# CONFIG_NETFILTER_XT_MATCH_STATE is not set -# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set -# CONFIG_NETFILTER_XT_MATCH_STRING is not set -# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set -# CONFIG_NETFILTER_XT_MATCH_TIME is not set -# CONFIG_NETFILTER_XT_MATCH_U32 is not set -# end of Core Netfilter Configuration - -# CONFIG_IP_SET is not set -# CONFIG_IP_VS is not set - -# -# IP: Netfilter Configuration -# -CONFIG_NF_DEFRAG_IPV4=y -# CONFIG_NF_SOCKET_IPV4 is not set -# CONFIG_NF_TPROXY_IPV4 is not set -# CONFIG_NF_DUP_IPV4 is not set -# CONFIG_NF_LOG_ARP is not set -# CONFIG_NF_LOG_IPV4 is not set -# CONFIG_NF_REJECT_IPV4 is not set -CONFIG_IP_NF_IPTABLES=y -# CONFIG_IP_NF_MATCH_AH is not set -# CONFIG_IP_NF_MATCH_ECN is not set -# CONFIG_IP_NF_MATCH_RPFILTER is not set -# CONFIG_IP_NF_MATCH_TTL is not set -CONFIG_IP_NF_FILTER=y -# CONFIG_IP_NF_TARGET_REJECT is not set -# CONFIG_IP_NF_TARGET_SYNPROXY is not set -CONFIG_IP_NF_NAT=y -CONFIG_IP_NF_TARGET_MASQUERADE=y -CONFIG_IP_NF_TARGET_NETMAP=y -CONFIG_IP_NF_TARGET_REDIRECT=y -CONFIG_IP_NF_MANGLE=y -# CONFIG_IP_NF_TARGET_CLUSTERIP is not set -# CONFIG_IP_NF_TARGET_ECN is not set -# CONFIG_IP_NF_TARGET_TTL is not set -# CONFIG_IP_NF_RAW is not set -# CONFIG_IP_NF_ARPTABLES is not set -# end of IP: Netfilter Configuration - -# -# IPv6: Netfilter Configuration -# -# CONFIG_NF_SOCKET_IPV6 is not set -# CONFIG_NF_TPROXY_IPV6 is not set -# CONFIG_NF_DUP_IPV6 is not set -# CONFIG_NF_REJECT_IPV6 is not set -# CONFIG_NF_LOG_IPV6 is not set -# CONFIG_IP6_NF_IPTABLES is not set -# end of IPv6: Netfilter Configuration - -CONFIG_NF_DEFRAG_IPV6=y -# CONFIG_NF_CONNTRACK_BRIDGE is not set -# CONFIG_BPFILTER is not set -# CONFIG_IP_DCCP is not set -# CONFIG_IP_SCTP is not set -# CONFIG_RDS is not set -# CONFIG_TIPC is not set -# CONFIG_ATM is not set -# CONFIG_L2TP is not set -# CONFIG_BRIDGE is not set -CONFIG_HAVE_NET_DSA=y -# CONFIG_NET_DSA is not set -# CONFIG_VLAN_8021Q is not set -# CONFIG_DECNET is not set -# CONFIG_LLC2 is not set -# CONFIG_ATALK is not set -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -# CONFIG_PHONET is not set -# CONFIG_6LOWPAN is not set -# CONFIG_IEEE802154 is not set -# CONFIG_NET_SCHED is not set -# CONFIG_DCB is not set -CONFIG_DNS_RESOLVER=y -# CONFIG_BATMAN_ADV is not set -# CONFIG_OPENVSWITCH is not set -# CONFIG_VSOCKETS is not set -# CONFIG_NETLINK_DIAG is not set -# CONFIG_MPLS is not set -# CONFIG_NET_NSH is not set -# CONFIG_HSR is not set -# CONFIG_NET_SWITCHDEV is not set -# CONFIG_NET_L3_MASTER_DEV is not set -# CONFIG_QRTR is not set -# CONFIG_NET_NCSI is not set -CONFIG_RPS=y -CONFIG_RFS_ACCEL=y -CONFIG_XPS=y -# CONFIG_CGROUP_NET_PRIO is not set -# CONFIG_CGROUP_NET_CLASSID is not set -CONFIG_NET_RX_BUSY_POLL=y -CONFIG_BQL=y -# CONFIG_BPF_JIT is not set -CONFIG_NET_FLOW_LIMIT=y - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -# CONFIG_NET_DROP_MONITOR is not set -# end of Network testing -# end of Networking options - -# CONFIG_HAMRADIO is not set -CONFIG_CAN=y -CONFIG_CAN_RAW=y -CONFIG_CAN_BCM=y -CONFIG_CAN_GW=y -# CONFIG_CAN_J1939 is not set -# CONFIG_CAN_ISOTP is not set - -# -# CAN Device Drivers -# -# CONFIG_CAN_VCAN is not set -# CONFIG_CAN_VXCAN is not set -# CONFIG_CAN_SLCAN is not set -CONFIG_CAN_DEV=y -CONFIG_CAN_CALC_BITTIMING=y -# CONFIG_CAN_FLEXCAN is not set -# CONFIG_CAN_GRCAN is not set -# CONFIG_CAN_KVASER_PCIEFD is not set -# CONFIG_CAN_XILINXCAN is not set -# CONFIG_CAN_C_CAN is not set -# CONFIG_CAN_CC770 is not set -# CONFIG_CAN_IFI_CANFD is not set -# CONFIG_CAN_M_CAN is not set -# CONFIG_CAN_PEAK_PCIEFD is not set -# CONFIG_CAN_SJA1000 is not set -# CONFIG_CAN_SOFTING is not set - -# -# CAN SPI interfaces -# -# CONFIG_CAN_HI311X is not set -# CONFIG_CAN_MCP251X is not set -# CONFIG_CAN_MCP251XFD is not set -# end of CAN SPI interfaces - -# -# CAN USB interfaces -# -# CONFIG_CAN_8DEV_USB is not set -# CONFIG_CAN_EMS_USB is not set -# CONFIG_CAN_ESD_USB2 is not set -# CONFIG_CAN_GS_USB is not set -# CONFIG_CAN_KVASER_USB is not set -# CONFIG_CAN_MCBA_USB is not set -# CONFIG_CAN_PEAK_USB is not set -# CONFIG_CAN_UCAN is not set -# end of CAN USB interfaces - -# CONFIG_CAN_DEBUG_DEVICES is not set -# end of CAN Device Drivers - -CONFIG_BT=y -CONFIG_BT_BREDR=y -CONFIG_BT_RFCOMM=y -# CONFIG_BT_RFCOMM_TTY is not set -# CONFIG_BT_BNEP is not set -CONFIG_BT_HIDP=y -# CONFIG_BT_HS is not set -CONFIG_BT_LE=y -# CONFIG_BT_LEDS is not set -# CONFIG_BT_MSFTEXT is not set -CONFIG_BT_DEBUGFS=y -# CONFIG_BT_SELFTEST is not set - -# -# Bluetooth device drivers -# -CONFIG_BT_INTEL=y -CONFIG_BT_BCM=y -CONFIG_BT_RTL=y -CONFIG_BT_HCIBTUSB=y -# CONFIG_BT_HCIBTUSB_AUTOSUSPEND is not set -CONFIG_BT_HCIBTUSB_BCM=y -# CONFIG_BT_HCIBTUSB_MTK is not set -CONFIG_BT_HCIBTUSB_RTL=y -# CONFIG_BT_HCIBTSDIO is not set -CONFIG_BT_HCIUART=y -CONFIG_BT_HCIUART_H4=y -# CONFIG_BT_HCIUART_BCSP is not set -CONFIG_BT_HCIUART_ATH3K=y -# CONFIG_BT_HCIUART_INTEL is not set -# CONFIG_BT_HCIUART_AG6XX is not set -# CONFIG_BT_HCIBCM203X is not set -# CONFIG_BT_HCIBPA10X is not set -CONFIG_BT_HCIBFUSB=y -CONFIG_BT_HCIVHCI=y -CONFIG_BT_MRVL=y -CONFIG_BT_MRVL_SDIO=y -# CONFIG_BT_ATH3K is not set -# CONFIG_BT_MTKSDIO is not set -# end of Bluetooth device drivers - -# CONFIG_AF_RXRPC is not set -# CONFIG_AF_KCM is not set -CONFIG_WIRELESS=y -CONFIG_WIRELESS_EXT=y -CONFIG_WEXT_CORE=y -CONFIG_WEXT_PROC=y -CONFIG_WEXT_PRIV=y -CONFIG_CFG80211=y -CONFIG_NL80211_TESTMODE=y -# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set -# CONFIG_CFG80211_CERTIFICATION_ONUS is not set -CONFIG_CFG80211_REQUIRE_SIGNED_REGDB=y -CONFIG_CFG80211_USE_KERNEL_REGDB_KEYS=y -CONFIG_CFG80211_DEFAULT_PS=y -CONFIG_CFG80211_DEBUGFS=y -CONFIG_CFG80211_CRDA_SUPPORT=y -CONFIG_CFG80211_WEXT=y -CONFIG_MAC80211=y -CONFIG_MAC80211_HAS_RC=y -CONFIG_MAC80211_RC_MINSTREL=y -CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y -CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" -# CONFIG_MAC80211_MESH is not set -CONFIG_MAC80211_LEDS=y -CONFIG_MAC80211_DEBUGFS=y -# CONFIG_MAC80211_MESSAGE_TRACING is not set -CONFIG_MAC80211_DEBUG_MENU=y -# CONFIG_MAC80211_NOINLINE is not set -CONFIG_MAC80211_VERBOSE_DEBUG=y -# CONFIG_MAC80211_MLME_DEBUG is not set -# CONFIG_MAC80211_STA_DEBUG is not set -# CONFIG_MAC80211_HT_DEBUG is not set -# CONFIG_MAC80211_OCB_DEBUG is not set -# CONFIG_MAC80211_IBSS_DEBUG is not set -# CONFIG_MAC80211_PS_DEBUG is not set -# CONFIG_MAC80211_TDLS_DEBUG is not set -# CONFIG_MAC80211_DEBUG_COUNTERS is not set -CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 -# CONFIG_WIMAX is not set -CONFIG_RFKILL=y -CONFIG_RFKILL_LEDS=y -# CONFIG_RFKILL_INPUT is not set -# CONFIG_RFKILL_GPIO is not set -# CONFIG_NET_9P is not set -# CONFIG_CAIF is not set -# CONFIG_CEPH_LIB is not set -# CONFIG_NFC is not set -# CONFIG_PSAMPLE is not set -# CONFIG_NET_IFE is not set -# CONFIG_LWTUNNEL is not set -CONFIG_GRO_CELLS=y -CONFIG_PAGE_POOL=y -# CONFIG_FAILOVER is not set -CONFIG_ETHTOOL_NETLINK=y -CONFIG_HAVE_EBPF_JIT=y - -# -# Device Drivers -# -CONFIG_ARM_AMBA=y -CONFIG_HAVE_PCI=y -CONFIG_PCI=y -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_DOMAINS_GENERIC=y -CONFIG_PCI_SYSCALL=y -CONFIG_PCIEPORTBUS=y -# CONFIG_PCIEAER is not set -CONFIG_PCIEASPM=y -CONFIG_PCIEASPM_DEFAULT=y -# CONFIG_PCIEASPM_POWERSAVE is not set -# CONFIG_PCIEASPM_POWER_SUPERSAVE is not set -# CONFIG_PCIEASPM_PERFORMANCE is not set -CONFIG_PCIE_PME=y -# CONFIG_PCIE_PTM is not set -CONFIG_PCI_MSI=y -CONFIG_PCI_MSI_IRQ_DOMAIN=y -CONFIG_PCI_QUIRKS=y -# CONFIG_PCI_DEBUG is not set -# CONFIG_PCI_STUB is not set -# CONFIG_PCI_IOV is not set -# CONFIG_PCI_PRI is not set -# CONFIG_PCI_PASID is not set -# CONFIG_PCIE_BUS_TUNE_OFF is not set -CONFIG_PCIE_BUS_DEFAULT=y -# CONFIG_PCIE_BUS_SAFE is not set -# CONFIG_PCIE_BUS_PERFORMANCE is not set -# CONFIG_PCIE_BUS_PEER2PEER is not set -# CONFIG_HOTPLUG_PCI is not set - -# -# PCI controller drivers -# -# CONFIG_PCI_FTPCI100 is not set -# CONFIG_PCI_HOST_GENERIC is not set -# CONFIG_PCIE_XILINX is not set -# CONFIG_PCI_XGENE is not set -# CONFIG_PCIE_ALTERA is not set -# CONFIG_PCI_HOST_THUNDER_PEM is not set -# CONFIG_PCI_HOST_THUNDER_ECAM is not set -# CONFIG_PCIE_ROCKCHIP_HOST is not set - -# -# DesignWare PCI Core Support -# -# CONFIG_PCIE_DW_PLAT_HOST is not set -# CONFIG_PCI_HISI is not set -# CONFIG_PCIE_KIRIN is not set -# CONFIG_PCI_MESON is not set -# CONFIG_PCIE_AL is not set -# end of DesignWare PCI Core Support - -# -# Mobiveil PCIe Core Support -# -# CONFIG_PCIE_LAYERSCAPE_GEN4 is not set -# end of Mobiveil PCIe Core Support - -# -# Cadence PCIe controllers support -# -# CONFIG_PCIE_CADENCE_PLAT_HOST is not set -# CONFIG_PCI_J721E_HOST is not set -# end of Cadence PCIe controllers support -# end of PCI controller drivers - -# -# PCI Endpoint -# -# CONFIG_PCI_ENDPOINT is not set -# end of PCI Endpoint - -# -# PCI switch controller drivers -# -# CONFIG_PCI_SW_SWITCHTEC is not set -# end of PCI switch controller drivers - -# CONFIG_PCCARD is not set -# CONFIG_RAPIDIO is not set - -# -# Generic Driver Options -# -# CONFIG_UEVENT_HELPER is not set -CONFIG_DEVTMPFS=y -CONFIG_DEVTMPFS_MOUNT=y -CONFIG_STANDALONE=y -CONFIG_PREVENT_FIRMWARE_BUILD=y - -# -# Firmware loader -# -CONFIG_FW_LOADER=y -CONFIG_EXTRA_FIRMWARE="" -# CONFIG_FW_LOADER_USER_HELPER is not set -# CONFIG_FW_LOADER_COMPRESS is not set -CONFIG_FW_CACHE=y -# end of Firmware loader - -CONFIG_WANT_DEV_COREDUMP=y -CONFIG_ALLOW_DEV_COREDUMP=y -CONFIG_DEV_COREDUMP=y -# CONFIG_DEBUG_DRIVER is not set -CONFIG_DEBUG_DEVRES=y -# CONFIG_DEBUG_TEST_DRIVER:remove is not set -# CONFIG_TEST_ASYNC_DRIVER_PROBE is not set -CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_GENERIC_CPU_VULNERABILITIES=y -CONFIG_SOC_BUS=y -CONFIG_REGMAP=y -CONFIG_REGMAP_I2C=y -CONFIG_REGMAP_MMIO=y -CONFIG_REGMAP_IRQ=y -CONFIG_DMA_SHARED_BUFFER=y -# CONFIG_DMA_FENCE_TRACE is not set -CONFIG_GENERIC_ARCH_TOPOLOGY=y -# end of Generic Driver Options - -# -# Bus devices -# -# CONFIG_BRCMSTB_GISB_ARB is not set -# CONFIG_MOXTET is not set -# CONFIG_SIMPLE_PM_BUS is not set -# CONFIG_VEXPRESS_CONFIG is not set -# CONFIG_MHI_BUS is not set -# end of Bus devices - -CONFIG_CONNECTOR=y -CONFIG_PROC_EVENTS=y -# CONFIG_GNSS is not set -CONFIG_MTD=y -# CONFIG_MTD_TESTS is not set - -# -# Partition parsers -# -# CONFIG_MTD_AR7_PARTS is not set -CONFIG_MTD_CMDLINE_PARTS=y -CONFIG_MTD_OF_PARTS=y -# CONFIG_MTD_AFS_PARTS is not set -# CONFIG_MTD_REDBOOT_PARTS is not set -# end of Partition parsers - -# -# User Modules And Translation Layers -# -CONFIG_MTD_BLKDEVS=y -CONFIG_MTD_BLOCK=y -# CONFIG_FTL is not set -# CONFIG_NFTL is not set -# CONFIG_INFTL is not set -# CONFIG_RFD_FTL is not set -# CONFIG_SSFDC is not set -# CONFIG_SM_FTL is not set -# CONFIG_MTD_OOPS is not set -# CONFIG_MTD_SWAP is not set -# CONFIG_MTD_PARTITIONED_MASTER is not set - -# -# RAM/ROM/Flash chip drivers -# -# CONFIG_MTD_CFI is not set -# CONFIG_MTD_JEDECPROBE is not set -CONFIG_MTD_MAP_BANK_WIDTH_1=y -CONFIG_MTD_MAP_BANK_WIDTH_2=y -CONFIG_MTD_MAP_BANK_WIDTH_4=y -CONFIG_MTD_CFI_I1=y -CONFIG_MTD_CFI_I2=y -# CONFIG_MTD_RAM is not set -# CONFIG_MTD_ROM is not set -# CONFIG_MTD_ABSENT is not set -# end of RAM/ROM/Flash chip drivers - -# -# Mapping drivers for chip access -# -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -# CONFIG_MTD_INTEL_VR_NOR is not set -# CONFIG_MTD_PLATRAM is not set -# end of Mapping drivers for chip access - -# -# Self-contained MTD device drivers -# -# CONFIG_MTD_PMC551 is not set -# CONFIG_MTD_DATAFLASH is not set -# CONFIG_MTD_MCHP23K256 is not set -# CONFIG_MTD_SST25L is not set -# CONFIG_MTD_SLRAM is not set -# CONFIG_MTD_PHRAM is not set -# CONFIG_MTD_MTDRAM is not set -# CONFIG_MTD_BLOCK2MTD is not set - -# -# Disk-On-Chip Device Drivers -# -# CONFIG_MTD_DOCG3 is not set -# end of Self-contained MTD device drivers - -# -# NAND -# -# CONFIG_MTD_ONENAND is not set -# CONFIG_MTD_RAW_NAND is not set -# CONFIG_MTD_SPI_NAND is not set - -# -# ECC engine support -# -# end of ECC engine support -# end of NAND - -# -# LPDDR & LPDDR2 PCM memory drivers -# -# CONFIG_MTD_LPDDR is not set -# end of LPDDR & LPDDR2 PCM memory drivers - -# CONFIG_MTD_SPI_NOR is not set -CONFIG_MTD_UBI=y -CONFIG_MTD_UBI_WL_THRESHOLD=4096 -CONFIG_MTD_UBI_BEB_LIMIT=20 -# CONFIG_MTD_UBI_FASTMAP is not set -# CONFIG_MTD_UBI_GLUEBI is not set -# CONFIG_MTD_UBI_BLOCK is not set -# CONFIG_MTD_HYPERBUS is not set -CONFIG_DTC=y -CONFIG_OF=y -# CONFIG_OF_UNITTEST is not set -CONFIG_OF_FLATTREE=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_KOBJ=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_IRQ=y -CONFIG_OF_NET=y -CONFIG_OF_RESERVED_MEM=y -# CONFIG_OF_OVERLAY is not set -# CONFIG_PARPORT is not set -CONFIG_BLK_DEV=y -# CONFIG_BLK_DEV_NULL_BLK is not set -CONFIG_CDROM=y -# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set -CONFIG_ZRAM=y -# CONFIG_ZRAM_WRITEBACK is not set -# CONFIG_ZRAM_MEMORY_TRACKING is not set -# CONFIG_BLK_DEV_UMEM is not set -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_LOOP_MIN_COUNT=8 -# CONFIG_BLK_DEV_CRYPTOLOOP is not set -# CONFIG_BLK_DEV_DRBD is not set -# CONFIG_BLK_DEV_NBD is not set -# CONFIG_BLK_DEV_SKD is not set -# CONFIG_BLK_DEV_SX8 is not set -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_COUNT=1 -CONFIG_BLK_DEV_RAM_SIZE=4096 -# CONFIG_CDROM_PKTCDVD is not set -# CONFIG_ATA_OVER_ETH is not set -# CONFIG_BLK_DEV_RBD is not set -# CONFIG_BLK_DEV_RSXX is not set - -# -# NVME Support -# -CONFIG_NVME_CORE=y -CONFIG_BLK_DEV_NVME=y -# CONFIG_NVME_MULTIPATH is not set -# CONFIG_NVME_HWMON is not set -# CONFIG_NVME_FC is not set -# CONFIG_NVME_TCP is not set -# CONFIG_NVME_TARGET is not set -# end of NVME Support - -# -# Misc devices -# -# CONFIG_AD525X_DPOT is not set -# CONFIG_DUMMY_IRQ is not set -# CONFIG_PHANTOM is not set -# CONFIG_TIFM_CORE is not set -# CONFIG_ICS932S401 is not set -# CONFIG_ENCLOSURE_SERVICES is not set -# CONFIG_HP_ILO is not set -# CONFIG_APDS9802ALS is not set -# CONFIG_ISL29003 is not set -# CONFIG_ISL29020 is not set -# CONFIG_SENSORS_TSL2550 is not set -# CONFIG_SENSORS_BH1770 is not set -# CONFIG_SENSORS_APDS990X is not set -# CONFIG_HMC6352 is not set -# CONFIG_DS1682 is not set -# CONFIG_LATTICE_ECP3_CONFIG is not set -CONFIG_SRAM=y -# CONFIG_PCI_ENDPOINT_TEST is not set -# CONFIG_XILINX_SDFEC is not set -# CONFIG_PVPANIC is not set -# CONFIG_HISI_HIKEY_USB is not set -# CONFIG_C2PORT is not set - -# -# EEPROM support -# -# CONFIG_EEPROM_AT24 is not set -# CONFIG_EEPROM_AT25 is not set -# CONFIG_EEPROM_LEGACY is not set -# CONFIG_EEPROM_MAX6875 is not set -# CONFIG_EEPROM_93CX6 is not set -# CONFIG_EEPROM_93XX46 is not set -# CONFIG_EEPROM_IDT_89HPESX is not set -# CONFIG_EEPROM_EE1004 is not set -# end of EEPROM support - -# CONFIG_CB710_CORE is not set - -# -# Texas Instruments shared transport line discipline -# -# CONFIG_TI_ST is not set -# end of Texas Instruments shared transport line discipline - -# CONFIG_SENSORS_LIS3_SPI is not set -# CONFIG_SENSORS_LIS3_I2C is not set -# CONFIG_ALTERA_STAPL is not set -# CONFIG_GENWQE is not set -# CONFIG_ECHO is not set -# CONFIG_MISC_ALCOR_PCI is not set -# CONFIG_MISC_RTSX_PCI is not set -# CONFIG_MISC_RTSX_USB is not set -# CONFIG_HABANA_AI is not set -# CONFIG_UACCE is not set -# end of Misc devices - -# -# SCSI device support -# -CONFIG_SCSI_MOD=y -# CONFIG_RAID_ATTRS is not set -CONFIG_SCSI=y -CONFIG_SCSI_DMA=y -CONFIG_SCSI_PROC_FS=y - -# -# SCSI support type (disk, tape, CD-ROM) -# -CONFIG_BLK_DEV_SD=y -# CONFIG_CHR_DEV_ST is not set -CONFIG_BLK_DEV_SR=y -# CONFIG_CHR_DEV_SG is not set -# CONFIG_CHR_DEV_SCH is not set -# CONFIG_SCSI_CONSTANTS is not set -# CONFIG_SCSI_LOGGING is not set -CONFIG_SCSI_SCAN_ASYNC=y - -# -# SCSI Transports -# -CONFIG_SCSI_SPI_ATTRS=y -# CONFIG_SCSI_FC_ATTRS is not set -# CONFIG_SCSI_ISCSI_ATTRS is not set -# CONFIG_SCSI_SAS_ATTRS is not set -# CONFIG_SCSI_SAS_LIBSAS is not set -# CONFIG_SCSI_SRP_ATTRS is not set -# end of SCSI Transports - -CONFIG_SCSI_LOWLEVEL=y -# CONFIG_ISCSI_TCP is not set -# CONFIG_ISCSI_BOOT_SYSFS is not set -# CONFIG_SCSI_CXGB3_ISCSI is not set -# CONFIG_SCSI_CXGB4_ISCSI is not set -# CONFIG_SCSI_BNX2_ISCSI is not set -# CONFIG_BE2ISCSI is not set -# CONFIG_BLK_DEV_3W_XXXX_RAID is not set -# CONFIG_SCSI_HPSA is not set -# CONFIG_SCSI_3W_9XXX is not set -# CONFIG_SCSI_3W_SAS is not set -# CONFIG_SCSI_ACARD is not set -# CONFIG_SCSI_AACRAID is not set -# CONFIG_SCSI_AIC7XXX is not set -# CONFIG_SCSI_AIC79XX is not set -# CONFIG_SCSI_AIC94XX is not set -# CONFIG_SCSI_HISI_SAS is not set -# CONFIG_SCSI_MVSAS is not set -# CONFIG_SCSI_MVUMI is not set -# CONFIG_SCSI_ADVANSYS is not set -# CONFIG_SCSI_ARCMSR is not set -# CONFIG_SCSI_ESAS2R is not set -# CONFIG_MEGARAID_NEWGEN is not set -# CONFIG_MEGARAID_LEGACY is not set -# CONFIG_MEGARAID_SAS is not set -# CONFIG_SCSI_MPT3SAS is not set -# CONFIG_SCSI_MPT2SAS is not set -# CONFIG_SCSI_SMARTPQI is not set -# CONFIG_SCSI_UFSHCD is not set -# CONFIG_RAMAXEL_SPRAID is not set -# CONFIG_SCSI_HPTIOP is not set -# CONFIG_SCSI_MYRB is not set -# CONFIG_SCSI_MYRS is not set -# CONFIG_SCSI_SNIC is not set -# CONFIG_SCSI_DMX3191D is not set -# CONFIG_SCSI_FDOMAIN_PCI is not set -# CONFIG_SCSI_GDTH is not set -# CONFIG_SCSI_IPS is not set -# CONFIG_SCSI_INITIO is not set -# CONFIG_SCSI_INIA100 is not set -# CONFIG_SCSI_STEX is not set -# CONFIG_SCSI_SYM53C8XX_2 is not set -# CONFIG_SCSI_IPR is not set -# CONFIG_SCSI_QLOGIC_1280 is not set -# CONFIG_SCSI_QLA_ISCSI is not set -# CONFIG_SCSI_DC395x is not set -# CONFIG_SCSI_AM53C974 is not set -# CONFIG_SCSI_WD719X is not set -# CONFIG_SCSI_DEBUG is not set -# CONFIG_SCSI_PMCRAID is not set -# CONFIG_SCSI_PM8001 is not set -# CONFIG_SCSI_DH is not set -# end of SCSI device support - -CONFIG_HAVE_PATA_PLATFORM=y -CONFIG_ATA=y -CONFIG_SATA_HOST=y -CONFIG_ATA_VERBOSE_ERROR=y -CONFIG_ATA_FORCE=y -CONFIG_SATA_PMP=y - -# -# Controllers with non-SFF native interface -# -CONFIG_SATA_AHCI=y -CONFIG_SATA_MOBILE_LPM_POLICY=0 -CONFIG_SATA_AHCI_PLATFORM=y -# CONFIG_AHCI_CEVA is not set -# CONFIG_AHCI_QORIQ is not set -# CONFIG_SATA_INIC162X is not set -# CONFIG_SATA_ACARD_AHCI is not set -# CONFIG_SATA_SIL24 is not set -# CONFIG_ATA_SFF is not set -CONFIG_MD=y -# CONFIG_BLK_DEV_MD is not set -# CONFIG_BCACHE is not set -# CONFIG_BLK_DEV_DM is not set -# CONFIG_TARGET_CORE is not set -# CONFIG_FUSION is not set - -# -# IEEE 1394 (FireWire) support -# -# CONFIG_FIREWIRE is not set -# CONFIG_FIREWIRE_NOSY is not set -# end of IEEE 1394 (FireWire) support - -CONFIG_NETDEVICES=y -CONFIG_MII=y -CONFIG_NET_CORE=y -# CONFIG_BONDING is not set -# CONFIG_DUMMY is not set -# CONFIG_WIREGUARD is not set -# CONFIG_EQUALIZER is not set -# CONFIG_NET_FC is not set -# CONFIG_NET_TEAM is not set -# CONFIG_MACVLAN is not set -# CONFIG_IPVLAN is not set -# CONFIG_VXLAN is not set -# CONFIG_GENEVE is not set -# CONFIG_BAREUDP is not set -# CONFIG_GTP is not set -# CONFIG_MACSEC is not set -# CONFIG_NETCONSOLE is not set -# CONFIG_TUN is not set -# CONFIG_TUN_VNET_CROSS_LE is not set -# CONFIG_VETH is not set -# CONFIG_NLMON is not set -# CONFIG_ARCNET is not set - -# -# Distributed Switch Architecture drivers -# -# end of Distributed Switch Architecture drivers - -CONFIG_ETHERNET=y -# CONFIG_NET_VENDOR_3COM is not set -# CONFIG_NET_VENDOR_ADAPTEC is not set -# CONFIG_NET_VENDOR_AGERE is not set -CONFIG_NET_VENDOR_ALACRITECH=y -# CONFIG_SLICOSS is not set -# CONFIG_NET_VENDOR_ALTEON is not set -# CONFIG_ALTERA_TSE is not set -CONFIG_NET_VENDOR_AMAZON=y -# CONFIG_ENA_ETHERNET is not set -# CONFIG_NET_VENDOR_AMD is not set -CONFIG_NET_VENDOR_AQUANTIA=y -# CONFIG_AQTION is not set -# CONFIG_NET_VENDOR_ARC is not set -# CONFIG_NET_VENDOR_ATHEROS is not set -CONFIG_NET_VENDOR_AURORA=y -# CONFIG_AURORA_NB8800 is not set -# CONFIG_NET_VENDOR_BROADCOM is not set -# CONFIG_NET_VENDOR_BROCADE is not set -CONFIG_NET_VENDOR_CADENCE=y -# CONFIG_MACB is not set -# CONFIG_NET_VENDOR_CAVIUM is not set -# CONFIG_NET_VENDOR_CHELSIO is not set -# CONFIG_NET_VENDOR_CISCO is not set -CONFIG_NET_VENDOR_CORTINA=y -# CONFIG_GEMINI_ETHERNET is not set -# CONFIG_DNET is not set -# CONFIG_NET_VENDOR_DEC is not set -# CONFIG_NET_VENDOR_DLINK is not set -# CONFIG_NET_VENDOR_EMULEX is not set -# CONFIG_NET_VENDOR_EZCHIP is not set -CONFIG_NET_VENDOR_GOOGLE=y -# CONFIG_GVE is not set -# CONFIG_NET_VENDOR_HISILICON is not set -CONFIG_NET_VENDOR_HUAWEI=y -# CONFIG_BMA is not set -CONFIG_NET_VENDOR_I825XX=y -CONFIG_NET_VENDOR_INTEL=y -# CONFIG_E100 is not set -# CONFIG_E1000 is not set -CONFIG_E1000E=y -# CONFIG_IGB is not set -# CONFIG_IGBVF is not set -# CONFIG_IXGB is not set -# CONFIG_IXGBE is not set -# CONFIG_IXGBEVF is not set -# CONFIG_I40E is not set -# CONFIG_I40EVF is not set -# CONFIG_ICE is not set -# CONFIG_FM10K is not set -# CONFIG_IGC is not set -CONFIG_NET_VENDOR_NETSWIFT=y -# CONFIG_JME is not set -# CONFIG_NET_VENDOR_MARVELL is not set -# CONFIG_NET_VENDOR_MELLANOX is not set -# CONFIG_NET_VENDOR_MICREL is not set -# CONFIG_NET_VENDOR_MICROCHIP is not set -CONFIG_NET_VENDOR_MICROSEMI=y -# CONFIG_NET_VENDOR_MYRI is not set -# CONFIG_FEALNX is not set -# CONFIG_NET_VENDOR_NATSEMI is not set -CONFIG_NET_VENDOR_NETERION=y -# CONFIG_S2IO is not set -# CONFIG_VXGE is not set -CONFIG_NET_VENDOR_NETRONOME=y -# CONFIG_NFP is not set -CONFIG_NET_VENDOR_NI=y -# CONFIG_NI_XGE_MANAGEMENT_ENET is not set -# CONFIG_NET_VENDOR_NVIDIA is not set -# CONFIG_NET_VENDOR_OKI is not set -# CONFIG_ETHOC is not set -CONFIG_NET_VENDOR_PACKET_ENGINES=y -# CONFIG_HAMACHI is not set -# CONFIG_YELLOWFIN is not set -CONFIG_NET_VENDOR_PENSANDO=y -# CONFIG_IONIC is not set -# CONFIG_NET_VENDOR_QLOGIC is not set -# CONFIG_NET_VENDOR_QUALCOMM is not set -# CONFIG_NET_VENDOR_RDC is not set -# CONFIG_NET_VENDOR_REALTEK is not set -# CONFIG_NET_VENDOR_RENESAS is not set -# CONFIG_NET_VENDOR_ROCKER is not set -# CONFIG_NET_VENDOR_SAMSUNG is not set -# CONFIG_NET_VENDOR_SEEQ is not set -CONFIG_NET_VENDOR_SOLARFLARE=y -# CONFIG_SFC is not set -# CONFIG_SFC_FALCON is not set -# CONFIG_NET_VENDOR_SILAN is not set -# CONFIG_NET_VENDOR_SIS is not set -# CONFIG_NET_VENDOR_SMSC is not set -CONFIG_NET_VENDOR_SOCIONEXT=y -CONFIG_NET_VENDOR_STMICRO=y -CONFIG_STMMAC_ETH=y -# CONFIG_STMMAC_SELFTESTS is not set -CONFIG_STMMAC_PLATFORM=y -# CONFIG_DWMAC_DWC_QOS_ETH is not set -CONFIG_DWMAC_GENERIC=y -CONFIG_DWMAC_ROCKCHIP=y -CONFIG_DWMAC_ROCKCHIP_TOOL=y -CONFIG_DWMAC_RK_AUTO_DELAYLINE=y -# CONFIG_DWMAC_INTEL_PLAT is not set -# CONFIG_STMMAC_PCI is not set -# CONFIG_NET_VENDOR_SUN is not set -# CONFIG_NET_VENDOR_SYNOPSYS is not set -# CONFIG_NET_VENDOR_TEHUTI is not set -# CONFIG_NET_VENDOR_TI is not set -# CONFIG_NET_VENDOR_VIA is not set -# CONFIG_NET_VENDOR_WIZNET is not set -CONFIG_NET_VENDOR_XILINX=y -# CONFIG_XILINX_AXI_EMAC is not set -# CONFIG_XILINX_LL_TEMAC is not set -# CONFIG_FDDI is not set -# CONFIG_HIPPI is not set -CONFIG_PHYLINK=y -CONFIG_PHYLIB=y -CONFIG_SWPHY=y -# CONFIG_LED_TRIGGER_PHY is not set -CONFIG_FIXED_PHY=y -# CONFIG_SFP is not set - -# -# MII PHY device drivers -# -# CONFIG_AMD_PHY is not set -# CONFIG_ADIN_PHY is not set -# CONFIG_AQUANTIA_PHY is not set -# CONFIG_AX88796B_PHY is not set -# CONFIG_BROADCOM_PHY is not set -# CONFIG_BCM54140_PHY is not set -# CONFIG_BCM7XXX_PHY is not set -# CONFIG_BCM84881_PHY is not set -# CONFIG_BCM87XX_PHY is not set -# CONFIG_CICADA_PHY is not set -# CONFIG_CORTINA_PHY is not set -# CONFIG_DAVICOM_PHY is not set -# CONFIG_ICPLUS_PHY is not set -# CONFIG_LXT_PHY is not set -# CONFIG_INTEL_XWAY_PHY is not set -# CONFIG_LSI_ET1011C_PHY is not set -# CONFIG_MARVELL_PHY is not set -# CONFIG_MARVELL_10G_PHY is not set -# CONFIG_MICREL_PHY is not set -# CONFIG_MICROCHIP_PHY is not set -# CONFIG_MICROCHIP_T1_PHY is not set -# CONFIG_MICROSEMI_PHY is not set -# CONFIG_NATIONAL_PHY is not set -# CONFIG_NXP_TJA11XX_PHY is not set -# CONFIG_AT803X_PHY is not set -# CONFIG_QSEMI_PHY is not set -CONFIG_REALTEK_PHY=y -# CONFIG_RENESAS_PHY is not set -CONFIG_ROCKCHIP_PHY=y -# CONFIG_SMSC_PHY is not set -# CONFIG_STE10XP is not set -# CONFIG_TERANETICS_PHY is not set -# CONFIG_DP83822_PHY is not set -# CONFIG_DP83TC811_PHY is not set -# CONFIG_DP83848_PHY is not set -# CONFIG_DP83867_PHY is not set -# CONFIG_DP83869_PHY is not set -# CONFIG_VITESSE_PHY is not set -# CONFIG_XILINX_GMII2RGMII is not set -# CONFIG_MICREL_KS8995MA is not set -CONFIG_MDIO_DEVICE=y -CONFIG_MDIO_BUS=y -CONFIG_OF_MDIO=y -CONFIG_MDIO_DEVRES=y -# CONFIG_MDIO_BITBANG is not set -# CONFIG_MDIO_BCM_UNIMAC is not set -# CONFIG_MDIO_HISI_FEMAC is not set -# CONFIG_MDIO_MVUSB is not set -# CONFIG_MDIO_MSCC_MIIM is not set -# CONFIG_MDIO_OCTEON is not set -# CONFIG_MDIO_IPQ4019 is not set -# CONFIG_MDIO_IPQ8064 is not set -# CONFIG_MDIO_THUNDER is not set - -# -# MDIO Multiplexers -# -# CONFIG_MDIO_BUS_MUX_GPIO is not set -# CONFIG_MDIO_BUS_MUX_MULTIPLEXER is not set -# CONFIG_MDIO_BUS_MUX_MMIOREG is not set - -# -# PCS device drivers -# -CONFIG_PCS_XPCS=y -# end of PCS device drivers - -# CONFIG_PPP is not set -# CONFIG_SLIP is not set -CONFIG_USB_NET_DRIVERS=y -# CONFIG_USB_CATC is not set -# CONFIG_USB_KAWETH is not set -# CONFIG_USB_PEGASUS is not set -CONFIG_USB_RTL8150=y -CONFIG_USB_RTL8152=y -# CONFIG_USB_LAN78XX is not set -CONFIG_USB_USBNET=y -CONFIG_USB_NET_AX8817X=y -CONFIG_USB_NET_AX88179_178A=y -CONFIG_USB_NET_CDCETHER=y -# CONFIG_USB_NET_CDC_EEM is not set -CONFIG_USB_NET_CDC_NCM=y -# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set -CONFIG_USB_NET_CDC_MBIM=y -# CONFIG_USB_NET_DM9601 is not set -# CONFIG_USB_NET_SR9700 is not set -# CONFIG_USB_NET_SR9800 is not set -# CONFIG_USB_NET_SMSC75XX is not set -# CONFIG_USB_NET_SMSC95XX is not set -# CONFIG_USB_NET_GL620A is not set -# CONFIG_USB_NET_NET1080 is not set -# CONFIG_USB_NET_PLUSB is not set -# CONFIG_USB_NET_MCS7830 is not set -CONFIG_USB_NET_RNDIS_HOST=y -# CONFIG_USB_NET_CDC_SUBSET is not set -# CONFIG_USB_NET_ZAURUS is not set -# CONFIG_USB_NET_CX82310_ETH is not set -# CONFIG_USB_NET_KALMIA is not set -# CONFIG_USB_NET_QMI_WWAN is not set -# CONFIG_USB_HSO is not set -# CONFIG_USB_NET_INT51X1 is not set -# CONFIG_USB_IPHETH is not set -# CONFIG_USB_SIERRA_NET is not set -# CONFIG_USB_VL600 is not set -# CONFIG_USB_NET_CH9200 is not set -# CONFIG_USB_NET_AQC111 is not set -CONFIG_WLAN=y -# CONFIG_WIRELESS_WDS is not set -CONFIG_WLAN_VENDOR_ADMTEK=y -# CONFIG_ADM8211 is not set -CONFIG_WLAN_VENDOR_ATH=y -# CONFIG_ATH_DEBUG is not set -# CONFIG_ATH5K is not set -# CONFIG_ATH5K_PCI is not set -# CONFIG_ATH9K is not set -# CONFIG_ATH9K_HTC is not set -# CONFIG_CARL9170 is not set -# CONFIG_ATH6KL is not set -# CONFIG_AR5523 is not set -# CONFIG_WIL6210 is not set -# CONFIG_ATH10K is not set -# CONFIG_WCN36XX is not set -CONFIG_WLAN_VENDOR_ATMEL=y -# CONFIG_ATMEL is not set -# CONFIG_AT76C50X_USB is not set -CONFIG_WLAN_VENDOR_BROADCOM=y -# CONFIG_B43 is not set -# CONFIG_B43LEGACY is not set -# CONFIG_BRCMSMAC is not set -# CONFIG_BRCMFMAC is not set -CONFIG_WLAN_VENDOR_CISCO=y -CONFIG_WLAN_VENDOR_INTEL=y -# CONFIG_IPW2100 is not set -# CONFIG_IPW2200 is not set -# CONFIG_IWL4965 is not set -# CONFIG_IWL3945 is not set -# CONFIG_IWLWIFI is not set -CONFIG_WLAN_VENDOR_INTERSIL=y -# CONFIG_HOSTAP is not set -# CONFIG_HERMES is not set -# CONFIG_P54_COMMON is not set -# CONFIG_PRISM54 is not set -CONFIG_WLAN_VENDOR_MARVELL=y -# CONFIG_LIBERTAS is not set -# CONFIG_LIBERTAS_THINFIRM is not set -# CONFIG_MWIFIEX is not set -# CONFIG_MWL8K is not set -CONFIG_WLAN_VENDOR_MEDIATEK=y -# CONFIG_MT7601U is not set -# CONFIG_MT76x0U is not set -# CONFIG_MT76x0E is not set -# CONFIG_MT76x2E is not set -# CONFIG_MT76x2U is not set -# CONFIG_MT7603E is not set -# CONFIG_MT7615E is not set -# CONFIG_MT7663U is not set -# CONFIG_MT7663S is not set -# CONFIG_MT7915E is not set -CONFIG_WLAN_VENDOR_MICROCHIP=y -# CONFIG_WILC1000_SDIO is not set -# CONFIG_WILC1000_SPI is not set -CONFIG_WLAN_VENDOR_RALINK=y -# CONFIG_RT2X00 is not set -CONFIG_WLAN_VENDOR_REALTEK=y -# CONFIG_RTL8180 is not set -# CONFIG_RTL8187 is not set -CONFIG_RTL_CARDS=y -# CONFIG_RTL8192CE is not set -# CONFIG_RTL8192SE is not set -# CONFIG_RTL8192DE is not set -# CONFIG_RTL8723AE is not set -# CONFIG_RTL8723BE is not set -# CONFIG_RTL8188EE is not set -# CONFIG_RTL8192EE is not set -# CONFIG_RTL8821AE is not set -# CONFIG_RTL8192CU is not set -# CONFIG_RTL8XXXU is not set -# CONFIG_RTW88 is not set -CONFIG_WLAN_VENDOR_RSI=y -# CONFIG_RSI_91X is not set -CONFIG_WLAN_VENDOR_ST=y -# CONFIG_CW1200 is not set -CONFIG_WLAN_VENDOR_TI=y -# CONFIG_WL1251 is not set -# CONFIG_WL12XX is not set -# CONFIG_WL18XX is not set -# CONFIG_WLCORE is not set -CONFIG_WLAN_VENDOR_ZYDAS=y -# CONFIG_USB_ZD1201 is not set -# CONFIG_ZD1211RW is not set -CONFIG_WLAN_VENDOR_QUANTENNA=y -# CONFIG_QTNFMAC_PCIE is not set -CONFIG_WL_ROCKCHIP=y -CONFIG_WIFI_BUILD_MODULE=y -CONFIG_WIFI_LOAD_DRIVER_WHEN_KERNEL_BOOTUP=y -# CONFIG_WIFI_GENERATE_RANDOM_MAC_ADDR is not set -CONFIG_BCMDHD=y -CONFIG_BCMDHD_SDIO=y -# CONFIG_BCMDHD_PCIE is not set -CONFIG_BCMDHD_FW_PATH="/vendor/etc/firmware/fw_bcmdhd.bin" -CONFIG_BCMDHD_NVRAM_PATH="/vendor/etc/firmware/nvram.txt" -# CONFIG_BCMDHD_STATIC_IF is not set -CONFIG_MXMWIFIEX=m -# CONFIG_MAC80211_HWSIM is not set -CONFIG_USB_NET_RNDIS_WLAN=y -# CONFIG_VIRT_WIFI is not set - -# -# Enable WiMAX (Networking options) to see the WiMAX drivers -# -# CONFIG_WAN is not set -# CONFIG_VMXNET3 is not set -# CONFIG_NETDEVSIM is not set -# CONFIG_NET_FAILOVER is not set -# CONFIG_ISDN is not set - -# -# Input device support -# -CONFIG_INPUT=y -CONFIG_INPUT_LEDS=y -CONFIG_INPUT_FF_MEMLESS=y -# CONFIG_INPUT_POLLDEV is not set -# CONFIG_INPUT_SPARSEKMAP is not set -# CONFIG_INPUT_MATRIXKMAP is not set - -# -# Userland interfaces -# -# CONFIG_INPUT_MOUSEDEV is not set -# CONFIG_INPUT_JOYDEV is not set -CONFIG_INPUT_EVDEV=y -# CONFIG_INPUT_EVBUG is not set - -# -# Input Device Drivers -# -CONFIG_INPUT_KEYBOARD=y -CONFIG_KEYBOARD_ADC=y -# CONFIG_KEYBOARD_ADP5588 is not set -# CONFIG_KEYBOARD_ADP5589 is not set -# CONFIG_KEYBOARD_ATKBD is not set -# CONFIG_KEYBOARD_QT1050 is not set -# CONFIG_KEYBOARD_QT1070 is not set -# CONFIG_KEYBOARD_QT2160 is not set -# CONFIG_KEYBOARD_DLINK_DIR685 is not set -# CONFIG_KEYBOARD_LKKBD is not set -CONFIG_KEYBOARD_GPIO=y -CONFIG_KEYBOARD_GPIO_POLLED=y -# CONFIG_KEYBOARD_TCA6416 is not set -# CONFIG_KEYBOARD_TCA8418 is not set -# CONFIG_KEYBOARD_MATRIX is not set -# CONFIG_KEYBOARD_LM8323 is not set -# CONFIG_KEYBOARD_LM8333 is not set -# CONFIG_KEYBOARD_MAX7359 is not set -# CONFIG_KEYBOARD_MCS is not set -# CONFIG_KEYBOARD_MPR121 is not set -# CONFIG_KEYBOARD_NEWTON is not set -# CONFIG_KEYBOARD_OPENCORES is not set -# CONFIG_KEYBOARD_SAMSUNG is not set -# CONFIG_KEYBOARD_STOWAWAY is not set -# CONFIG_KEYBOARD_SUNKBD is not set -# CONFIG_KEYBOARD_OMAP4 is not set -# CONFIG_KEYBOARD_TM2_TOUCHKEY is not set -# CONFIG_KEYBOARD_XTKBD is not set -# CONFIG_KEYBOARD_CAP11XX is not set -# CONFIG_KEYBOARD_BCM is not set -CONFIG_INPUT_MOUSE=y -# CONFIG_MOUSE_PS2 is not set -# CONFIG_MOUSE_SERIAL is not set -# CONFIG_MOUSE_APPLETOUCH is not set -# CONFIG_MOUSE_BCM5974 is not set -CONFIG_MOUSE_CYAPA=y -CONFIG_MOUSE_ELAN_I2C=y -CONFIG_MOUSE_ELAN_I2C_I2C=y -# CONFIG_MOUSE_ELAN_I2C_SMBUS is not set -# CONFIG_MOUSE_VSXXXAA is not set -# CONFIG_MOUSE_GPIO is not set -# CONFIG_MOUSE_SYNAPTICS_I2C is not set -# CONFIG_MOUSE_SYNAPTICS_USB is not set -# CONFIG_INPUT_JOYSTICK is not set -# CONFIG_INPUT_TABLET is not set -CONFIG_INPUT_TOUCHSCREEN=y -CONFIG_TOUCHSCREEN_PROPERTIES=y -# CONFIG_TOUCHSCREEN_ADS7846 is not set -# CONFIG_TOUCHSCREEN_AD7877 is not set -# CONFIG_TOUCHSCREEN_AD7879 is not set -# CONFIG_TOUCHSCREEN_ADC is not set -# CONFIG_TOUCHSCREEN_AR1021_I2C is not set -CONFIG_TOUCHSCREEN_ATMEL_MXT=y -# CONFIG_TOUCHSCREEN_ATMEL_MXT_T37 is not set -# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set -# CONFIG_TOUCHSCREEN_BU21013 is not set -# CONFIG_TOUCHSCREEN_BU21029 is not set -# CONFIG_TOUCHSCREEN_CHIPONE_ICN8318 is not set -# CONFIG_TOUCHSCREEN_CY8CTMA140 is not set -# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set -# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set -# CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set -# CONFIG_TOUCHSCREEN_DYNAPRO is not set -# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set -# CONFIG_TOUCHSCREEN_EETI is not set -# CONFIG_TOUCHSCREEN_EGALAX is not set -# CONFIG_TOUCHSCREEN_EGALAX_SERIAL is not set -# CONFIG_TOUCHSCREEN_EXC3000 is not set -# CONFIG_TOUCHSCREEN_FUJITSU is not set -CONFIG_TOUCHSCREEN_GOODIX=y -# CONFIG_TOUCHSCREEN_HIDEEP is not set -# CONFIG_TOUCHSCREEN_ILI210X is not set -# CONFIG_TOUCHSCREEN_S6SY761 is not set -# CONFIG_TOUCHSCREEN_GUNZE is not set -# CONFIG_TOUCHSCREEN_EKTF2127 is not set -CONFIG_TOUCHSCREEN_ELAN=y -# CONFIG_TOUCHSCREEN_ELO is not set -# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set -# CONFIG_TOUCHSCREEN_WACOM_I2C is not set -# CONFIG_TOUCHSCREEN_MAX11801 is not set -# CONFIG_TOUCHSCREEN_MCS5000 is not set -# CONFIG_TOUCHSCREEN_MMS114 is not set -# CONFIG_TOUCHSCREEN_MELFAS_MIP4 is not set -# CONFIG_TOUCHSCREEN_MTOUCH is not set -# CONFIG_TOUCHSCREEN_IMX6UL_TSC is not set -# CONFIG_TOUCHSCREEN_INEXIO is not set -# CONFIG_TOUCHSCREEN_MK712 is not set -# CONFIG_TOUCHSCREEN_PENMOUNT is not set -CONFIG_TOUCHSCREEN_EDT_FT5X06=y -# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set -# CONFIG_TOUCHSCREEN_TOUCHWIN is not set -# CONFIG_TOUCHSCREEN_PIXCIR is not set -# CONFIG_TOUCHSCREEN_WDT87XX_I2C is not set -CONFIG_TOUCHSCREEN_USB_COMPOSITE=y -CONFIG_TOUCHSCREEN_USB_EGALAX=y -CONFIG_TOUCHSCREEN_USB_PANJIT=y -CONFIG_TOUCHSCREEN_USB_3M=y -CONFIG_TOUCHSCREEN_USB_ITM=y -CONFIG_TOUCHSCREEN_USB_ETURBO=y -CONFIG_TOUCHSCREEN_USB_GUNZE=y -CONFIG_TOUCHSCREEN_USB_DMC_TSC10=y -CONFIG_TOUCHSCREEN_USB_IRTOUCH=y -CONFIG_TOUCHSCREEN_USB_IDEALTEK=y -CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH=y -CONFIG_TOUCHSCREEN_USB_GOTOP=y -CONFIG_TOUCHSCREEN_USB_JASTEC=y -CONFIG_TOUCHSCREEN_USB_ELO=y -CONFIG_TOUCHSCREEN_USB_E2I=y -CONFIG_TOUCHSCREEN_USB_ZYTRONIC=y -CONFIG_TOUCHSCREEN_USB_ETT_TC45USB=y -CONFIG_TOUCHSCREEN_USB_NEXIO=y -CONFIG_TOUCHSCREEN_USB_EASYTOUCH=y -# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set -# CONFIG_TOUCHSCREEN_TSC_SERIO is not set -# CONFIG_TOUCHSCREEN_TSC2004 is not set -# CONFIG_TOUCHSCREEN_TSC2005 is not set -# CONFIG_TOUCHSCREEN_TSC2007 is not set -# CONFIG_TOUCHSCREEN_RM_TS is not set -# CONFIG_TOUCHSCREEN_SILEAD is not set -# CONFIG_TOUCHSCREEN_SIS_I2C is not set -# CONFIG_TOUCHSCREEN_ST1232 is not set -# CONFIG_TOUCHSCREEN_STMFTS is not set -# CONFIG_TOUCHSCREEN_SUR40 is not set -# CONFIG_TOUCHSCREEN_SURFACE3_SPI is not set -# CONFIG_TOUCHSCREEN_SX8654 is not set -# CONFIG_TOUCHSCREEN_TPS6507X is not set -# CONFIG_TOUCHSCREEN_ZET6223 is not set -# CONFIG_TOUCHSCREEN_ZFORCE is not set -# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set -# CONFIG_TOUCHSCREEN_IQS5XX is not set -# CONFIG_TOUCHSCREEN_ZINITIX is not set -CONFIG_INPUT_MISC=y -# CONFIG_INPUT_AD714X is not set -# CONFIG_INPUT_ATMEL_CAPTOUCH is not set -# CONFIG_INPUT_BMA150 is not set -# CONFIG_INPUT_E3X0_BUTTON is not set -# CONFIG_INPUT_MMA8450 is not set -# CONFIG_INPUT_GPIO_BEEPER is not set -# CONFIG_INPUT_GPIO_DECODER is not set -# CONFIG_INPUT_GPIO_VIBRA is not set -# CONFIG_INPUT_ATI_REMOTE2 is not set -# CONFIG_INPUT_KEYSPAN_REMOTE is not set -# CONFIG_INPUT_KXTJ9 is not set -# CONFIG_INPUT_POWERMATE is not set -# CONFIG_INPUT_YEALINK is not set -# CONFIG_INPUT_CM109 is not set -# CONFIG_INPUT_REGULATOR_HAPTIC is not set -CONFIG_INPUT_UINPUT=y -# CONFIG_INPUT_PCF8574 is not set -# CONFIG_INPUT_PWM_BEEPER is not set -# CONFIG_INPUT_PWM_VIBRA is not set -CONFIG_INPUT_RK805_PWRKEY=y -# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set -# CONFIG_INPUT_ADXL34X is not set -# CONFIG_INPUT_IMS_PCU is not set -# CONFIG_INPUT_IQS269A is not set -# CONFIG_INPUT_CMA3000 is not set -# CONFIG_INPUT_DRV260X_HAPTICS is not set -# CONFIG_INPUT_DRV2665_HAPTICS is not set -# CONFIG_INPUT_DRV2667_HAPTICS is not set -# CONFIG_RMI4_CORE is not set - -# -# Hardware I/O ports -# -# CONFIG_SERIO is not set -# CONFIG_GAMEPORT is not set -# end of Hardware I/O ports -# end of Input device support - -# -# Character devices -# -CONFIG_TTY=y -CONFIG_VT=y -CONFIG_CONSOLE_TRANSLATIONS=y -CONFIG_VT_CONSOLE=y -CONFIG_VT_CONSOLE_SLEEP=y -CONFIG_HW_CONSOLE=y -CONFIG_VT_HW_CONSOLE_BINDING=y -CONFIG_UNIX98_PTYS=y -# CONFIG_LEGACY_PTYS is not set -CONFIG_LDISC_AUTOLOAD=y - -# -# Serial drivers -# -CONFIG_SERIAL_EARLYCON=y -CONFIG_SERIAL_8250=y -CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y -CONFIG_SERIAL_8250_16550A_VARIANTS=y -# CONFIG_SERIAL_8250_FINTEK is not set -CONFIG_SERIAL_8250_CONSOLE=y -CONFIG_SERIAL_8250_DMA=y -# CONFIG_SERIAL_8250_PCI is not set -CONFIG_SERIAL_8250_NR_UARTS=10 -CONFIG_SERIAL_8250_RUNTIME_UARTS=10 -# CONFIG_SERIAL_8250_EXTENDED is not set -# CONFIG_SERIAL_8250_ASPEED_VUART is not set -CONFIG_SERIAL_8250_DWLIB=y -CONFIG_SERIAL_8250_FSL=y -CONFIG_SERIAL_8250_DW=y -# CONFIG_SERIAL_8250_RT288X is not set -CONFIG_SERIAL_OF_PLATFORM=y - -# -# Non-8250 serial port support -# -# CONFIG_SERIAL_AMBA_PL010 is not set -# CONFIG_SERIAL_AMBA_PL011 is not set -# CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST is not set -# CONFIG_SERIAL_MAX3100 is not set -# CONFIG_SERIAL_MAX310X is not set -# CONFIG_SERIAL_UARTLITE is not set -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -# CONFIG_SERIAL_JSM is not set -# CONFIG_SERIAL_SIFIVE is not set -# CONFIG_SERIAL_SCCNXP is not set -# CONFIG_SERIAL_SC16IS7XX is not set -# CONFIG_SERIAL_ALTERA_JTAGUART is not set -# CONFIG_SERIAL_ALTERA_UART is not set -# CONFIG_SERIAL_IFX6X60 is not set -# CONFIG_SERIAL_XILINX_PS_UART is not set -# CONFIG_SERIAL_ARC is not set -# CONFIG_SERIAL_RP2 is not set -# CONFIG_SERIAL_FSL_LPUART is not set -# CONFIG_SERIAL_FSL_LINFLEXUART is not set -# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set -# CONFIG_SERIAL_SPRD is not set -# end of Serial drivers - -CONFIG_SERIAL_MCTRL_GPIO=y -# CONFIG_SERIAL_NONSTANDARD is not set -# CONFIG_N_GSM is not set -# CONFIG_NOZOMI is not set -# CONFIG_NULL_TTY is not set -# CONFIG_TRACE_SINK is not set -# CONFIG_HVC_DCC is not set -# CONFIG_SERIAL_DEV_BUS is not set -# CONFIG_TTY_PRINTK is not set -# CONFIG_VIRTIO_CONSOLE is not set -# CONFIG_IPMI_HANDLER is not set -CONFIG_HW_RANDOM=y -# CONFIG_HW_RANDOM_TIMERIOMEM is not set -# CONFIG_HW_RANDOM_BA431 is not set -CONFIG_HW_RANDOM_OPTEE=y -# CONFIG_HW_RANDOM_CCTRNG is not set -# CONFIG_HW_RANDOM_XIPHERA is not set -# CONFIG_APPLICOM is not set -CONFIG_DEVMEM=y -# CONFIG_RAW_DRIVER is not set -CONFIG_DEVPORT=y -CONFIG_TCG_TPM=y -CONFIG_HW_RANDOM_TPM=y -# CONFIG_TCG_TIS is not set -# CONFIG_TCG_TIS_SPI is not set -# CONFIG_TCG_TIS_I2C_ATMEL is not set -CONFIG_TCG_TIS_I2C_INFINEON=y -# CONFIG_TCG_TIS_I2C_NUVOTON is not set -# CONFIG_TCG_ATMEL is not set -# CONFIG_TCG_VTPM_PROXY is not set -# CONFIG_TCG_FTPM_TEE is not set -# CONFIG_TCG_TIS_ST33ZP24_I2C is not set -# CONFIG_TCG_TIS_ST33ZP24_SPI is not set -# CONFIG_XILLYBUS is not set -# end of Character devices - -# CONFIG_RANDOM_TRUST_CPU is not set -# CONFIG_RANDOM_TRUST_BOOTLOADER is not set - -# -# I2C support -# -CONFIG_I2C=y -CONFIG_I2C_BOARDINFO=y -CONFIG_I2C_COMPAT=y -CONFIG_I2C_CHARDEV=y -# CONFIG_I2C_MUX is not set -CONFIG_I2C_HELPER_AUTO=y -CONFIG_I2C_ALGOBIT=y - -# -# I2C Hardware Bus support -# - -# -# PC SMBus host controller drivers -# -# CONFIG_I2C_ALI1535 is not set -# CONFIG_I2C_ALI1563 is not set -# CONFIG_I2C_ALI15X3 is not set -# CONFIG_I2C_AMD756 is not set -# CONFIG_I2C_AMD8111 is not set -# CONFIG_I2C_I801 is not set -# CONFIG_I2C_ISCH is not set -# CONFIG_I2C_PIIX4 is not set -# CONFIG_I2C_NFORCE2 is not set -# CONFIG_I2C_NVIDIA_GPU is not set -# CONFIG_I2C_SIS5595 is not set -# CONFIG_I2C_SIS630 is not set -# CONFIG_I2C_SIS96X is not set -# CONFIG_I2C_VIA is not set -# CONFIG_I2C_VIAPRO is not set - -# -# I2C system bus drivers (mostly embedded / system-on-chip) -# -# CONFIG_I2C_CADENCE is not set -# CONFIG_I2C_CBUS_GPIO is not set -# CONFIG_I2C_DESIGNWARE_PLATFORM is not set -# CONFIG_I2C_DESIGNWARE_PCI is not set -# CONFIG_I2C_EMEV2 is not set -# CONFIG_I2C_GPIO is not set -# CONFIG_I2C_HISI is not set -# CONFIG_I2C_NOMADIK is not set -# CONFIG_I2C_OCORES is not set -# CONFIG_I2C_PCA_PLATFORM is not set -CONFIG_I2C_RK3X=y -# CONFIG_I2C_SIMTEC is not set -# CONFIG_I2C_THUNDERX is not set -# CONFIG_I2C_XILINX is not set - -# -# External I2C/SMBus adapter drivers -# -# CONFIG_I2C_DIOLAN_U2C is not set -# CONFIG_I2C_ROBOTFUZZ_OSIF is not set -# CONFIG_I2C_TAOS_EVM is not set -# CONFIG_I2C_TINY_USB is not set - -# -# Other I2C/SMBus bus drivers -# -# end of I2C Hardware Bus support - -# CONFIG_I2C_STUB is not set -# CONFIG_I2C_SLAVE is not set -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set -# end of I2C support - -# CONFIG_I3C is not set -CONFIG_SPI=y -# CONFIG_SPI_DEBUG is not set -CONFIG_SPI_MASTER=y -# CONFIG_SPI_MEM is not set - -# -# SPI Master Controller Drivers -# -# CONFIG_SPI_ALTERA is not set -# CONFIG_SPI_AXI_SPI_ENGINE is not set -CONFIG_SPI_BITBANG=y -# CONFIG_SPI_CADENCE is not set -# CONFIG_SPI_CADENCE_QUADSPI is not set -# CONFIG_SPI_DESIGNWARE is not set -# CONFIG_SPI_NXP_FLEXSPI is not set -# CONFIG_SPI_GPIO is not set -# CONFIG_SPI_FSL_SPI is not set -# CONFIG_SPI_OC_TINY is not set -# CONFIG_SPI_PL022 is not set -# CONFIG_SPI_PXA2XX is not set -CONFIG_SPI_ROCKCHIP=y -# CONFIG_SPI_SC18IS602 is not set -# CONFIG_SPI_SIFIVE is not set -# CONFIG_SPI_MXIC is not set -# CONFIG_SPI_THUNDERX is not set -# CONFIG_SPI_XCOMM is not set -# CONFIG_SPI_XILINX is not set -# CONFIG_SPI_ZYNQMP_GQSPI is not set -# CONFIG_SPI_AMD is not set - -# -# SPI Multiplexer support -# -# CONFIG_SPI_MUX is not set - -# -# SPI Protocol Masters -# -CONFIG_SPI_SPIDEV=y -# CONFIG_SPI_LOOPBACK_TEST is not set -# CONFIG_SPI_TLE62X0 is not set -# CONFIG_SPI_SLAVE is not set -# CONFIG_SPMI is not set -# CONFIG_HSI is not set -CONFIG_PPS=y -# CONFIG_PPS_DEBUG is not set - -# -# PPS clients support -# -# CONFIG_PPS_CLIENT_KTIMER is not set -# CONFIG_PPS_CLIENT_LDISC is not set -# CONFIG_PPS_CLIENT_GPIO is not set - -# -# PPS generators support -# - -# -# PTP clock support -# -CONFIG_PTP_1588_CLOCK=y - -# -# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. -# -# CONFIG_PTP_1588_CLOCK_IDT82P33 is not set -# CONFIG_PTP_1588_CLOCK_IDTCM is not set -# end of PTP clock support - -CONFIG_PINCTRL=y -CONFIG_PINMUX=y -CONFIG_PINCONF=y -CONFIG_GENERIC_PINCONF=y -# CONFIG_DEBUG_PINCTRL is not set -# CONFIG_PINCTRL_MCP23S08 is not set -CONFIG_PINCTRL_ROCKCHIP=y -# CONFIG_PINCTRL_SINGLE is not set -# CONFIG_PINCTRL_SX150X is not set -# CONFIG_PINCTRL_STMFX is not set -CONFIG_PINCTRL_RK805=y -# CONFIG_PINCTRL_OCELOT is not set - -# -# Renesas pinctrl drivers -# -# end of Renesas pinctrl drivers - -CONFIG_GPIOLIB=y -CONFIG_GPIOLIB_FASTPATH_LIMIT=512 -CONFIG_OF_GPIO=y -CONFIG_GPIOLIB_IRQCHIP=y -# CONFIG_DEBUG_GPIO is not set -CONFIG_GPIO_SYSFS=y -CONFIG_GPIO_CDEV=y -CONFIG_GPIO_CDEV_V1=y -CONFIG_GPIO_GENERIC=y - -# -# Memory mapped GPIO drivers -# -# CONFIG_GPIO_74XX_MMIO is not set -# CONFIG_GPIO_ALTERA is not set -# CONFIG_GPIO_CADENCE is not set -# CONFIG_GPIO_DWAPB is not set -# CONFIG_GPIO_FTGPIO010 is not set -CONFIG_GPIO_GENERIC_PLATFORM=y -# CONFIG_GPIO_GRGPIO is not set -# CONFIG_GPIO_HLWD is not set -# CONFIG_GPIO_LOGICVC is not set -# CONFIG_GPIO_MB86S7X is not set -# CONFIG_GPIO_PL061 is not set -CONFIG_GPIO_ROCKCHIP=y -# CONFIG_GPIO_SAMA5D2_PIOBU is not set -# CONFIG_GPIO_SIFIVE is not set -# CONFIG_GPIO_SYSCON is not set -# CONFIG_GPIO_XGENE is not set -# CONFIG_GPIO_XILINX is not set -# CONFIG_GPIO_AMD_FCH is not set -# end of Memory mapped GPIO drivers - -# -# I2C GPIO expanders -# -# CONFIG_GPIO_ADP5588 is not set -# CONFIG_GPIO_ADNP is not set -# CONFIG_GPIO_GW_PLD is not set -# CONFIG_GPIO_MAX7300 is not set -# CONFIG_GPIO_MAX732X is not set -# CONFIG_GPIO_PCA953X is not set -# CONFIG_GPIO_PCA9570 is not set -# CONFIG_GPIO_PCF857X is not set -# CONFIG_GPIO_TPIC2810 is not set -# end of I2C GPIO expanders - -# -# MFD GPIO expanders -# -# CONFIG_GPIO_TPS6586X is not set -# end of MFD GPIO expanders - -# -# PCI GPIO expanders -# -# CONFIG_GPIO_BT8XX is not set -# CONFIG_GPIO_PCI_IDIO_16 is not set -# CONFIG_GPIO_PCIE_IDIO_24 is not set -# CONFIG_GPIO_RDC321X is not set -# end of PCI GPIO expanders - -# -# SPI GPIO expanders -# -# CONFIG_GPIO_74X164 is not set -# CONFIG_GPIO_MAX3191X is not set -# CONFIG_GPIO_MAX7301 is not set -# CONFIG_GPIO_MC33880 is not set -# CONFIG_GPIO_PISOSR is not set -# CONFIG_GPIO_XRA1403 is not set -# end of SPI GPIO expanders - -# -# USB GPIO expanders -# -# end of USB GPIO expanders - -# CONFIG_GPIO_AGGREGATOR is not set -# CONFIG_GPIO_MOCKUP is not set -# CONFIG_W1 is not set -CONFIG_POWER_RESET=y -# CONFIG_POWER_RESET_BRCMSTB is not set -CONFIG_POWER_RESET_GPIO=y -CONFIG_POWER_RESET_GPIO_RESTART=y -# CONFIG_POWER_RESET_LTC2952 is not set -# CONFIG_POWER_RESET_RESTART is not set -# CONFIG_POWER_RESET_XGENE is not set -# CONFIG_POWER_RESET_SYSCON is not set -# CONFIG_POWER_RESET_SYSCON_POWEROFF is not set -CONFIG_REBOOT_MODE=y -CONFIG_SYSCON_REBOOT_MODE=y -# CONFIG_NVMEM_REBOOT_MODE is not set -CONFIG_POWER_SUPPLY=y -# CONFIG_POWER_SUPPLY_DEBUG is not set -CONFIG_POWER_SUPPLY_HWMON=y -# CONFIG_PDA_POWER is not set -# CONFIG_GENERIC_ADC_BATTERY is not set -# CONFIG_TEST_POWER is not set -# CONFIG_CHARGER_ADP5061 is not set -# CONFIG_BATTERY_CW2015 is not set -# CONFIG_BATTERY_DS2780 is not set -# CONFIG_BATTERY_DS2781 is not set -# CONFIG_BATTERY_DS2782 is not set -CONFIG_BATTERY_SBS=y -# CONFIG_CHARGER_SBS is not set -# CONFIG_BATTERY_BQ27XXX is not set -# CONFIG_BATTERY_MAX17040 is not set -# CONFIG_BATTERY_MAX17042 is not set -# CONFIG_CHARGER_ISP1704 is not set -# CONFIG_CHARGER_MAX8903 is not set -# CONFIG_CHARGER_LP8727 is not set -CONFIG_CHARGER_GPIO=y -# CONFIG_CHARGER_MANAGER is not set -# CONFIG_CHARGER_LT3651 is not set -# CONFIG_CHARGER_DETECTOR_MAX14656 is not set -# CONFIG_CHARGER_BQ2415X is not set -# CONFIG_CHARGER_BQ24190 is not set -# CONFIG_CHARGER_BQ24257 is not set -CONFIG_CHARGER_BQ24735=y -# CONFIG_CHARGER_BQ2515X is not set -# CONFIG_CHARGER_BQ25890 is not set -# CONFIG_CHARGER_BQ25980 is not set -# CONFIG_CHARGER_SMB347 is not set -# CONFIG_BATTERY_GAUGE_LTC2941 is not set -# CONFIG_BATTERY_RT5033 is not set -# CONFIG_CHARGER_RT9455 is not set -# CONFIG_CHARGER_UCS1002 is not set -# CONFIG_CHARGER_BD99954 is not set -CONFIG_HWMON=y -# CONFIG_HWMON_DEBUG_CHIP is not set - -# -# Native drivers -# -# CONFIG_SENSORS_AD7314 is not set -# CONFIG_SENSORS_AD7414 is not set -# CONFIG_SENSORS_AD7418 is not set -# CONFIG_SENSORS_ADM1021 is not set -# CONFIG_SENSORS_ADM1025 is not set -# CONFIG_SENSORS_ADM1026 is not set -# CONFIG_SENSORS_ADM1029 is not set -# CONFIG_SENSORS_ADM1031 is not set -# CONFIG_SENSORS_ADM1177 is not set -# CONFIG_SENSORS_ADM9240 is not set -# CONFIG_SENSORS_ADT7310 is not set -# CONFIG_SENSORS_ADT7410 is not set -# CONFIG_SENSORS_ADT7411 is not set -# CONFIG_SENSORS_ADT7462 is not set -# CONFIG_SENSORS_ADT7470 is not set -# CONFIG_SENSORS_ADT7475 is not set -# CONFIG_SENSORS_AS370 is not set -# CONFIG_SENSORS_ASC7621 is not set -# CONFIG_SENSORS_AXI_FAN_CONTROL is not set -# CONFIG_SENSORS_ARM_SCMI is not set -# CONFIG_SENSORS_ASPEED is not set -# CONFIG_SENSORS_ATXP1 is not set -# CONFIG_SENSORS_CORSAIR_CPRO is not set -# CONFIG_SENSORS_DRIVETEMP is not set -# CONFIG_SENSORS_DS620 is not set -# CONFIG_SENSORS_DS1621 is not set -# CONFIG_SENSORS_I5K_AMB is not set -# CONFIG_SENSORS_F71805F is not set -# CONFIG_SENSORS_F71882FG is not set -# CONFIG_SENSORS_F75375S is not set -# CONFIG_SENSORS_FTSTEUTATES is not set -# CONFIG_SENSORS_GL518SM is not set -# CONFIG_SENSORS_GL520SM is not set -# CONFIG_SENSORS_G760A is not set -# CONFIG_SENSORS_G762 is not set -# CONFIG_SENSORS_GPIO_FAN is not set -# CONFIG_SENSORS_HIH6130 is not set -# CONFIG_SENSORS_IIO_HWMON is not set -# CONFIG_SENSORS_IT87 is not set -# CONFIG_SENSORS_JC42 is not set -# CONFIG_SENSORS_POWR1220 is not set -# CONFIG_SENSORS_LINEAGE is not set -# CONFIG_SENSORS_LTC2945 is not set -# CONFIG_SENSORS_LTC2947_I2C is not set -# CONFIG_SENSORS_LTC2947_SPI is not set -# CONFIG_SENSORS_LTC2990 is not set -# CONFIG_SENSORS_LTC4151 is not set -# CONFIG_SENSORS_LTC4215 is not set -# CONFIG_SENSORS_LTC4222 is not set -# CONFIG_SENSORS_LTC4245 is not set -# CONFIG_SENSORS_LTC4260 is not set -# CONFIG_SENSORS_LTC4261 is not set -# CONFIG_SENSORS_MAX1111 is not set -# CONFIG_SENSORS_MAX16065 is not set -# CONFIG_SENSORS_MAX1619 is not set -# CONFIG_SENSORS_MAX1668 is not set -# CONFIG_SENSORS_MAX197 is not set -# CONFIG_SENSORS_MAX31722 is not set -# CONFIG_SENSORS_MAX31730 is not set -# CONFIG_SENSORS_MAX6621 is not set -# CONFIG_SENSORS_MAX6639 is not set -# CONFIG_SENSORS_MAX6642 is not set -# CONFIG_SENSORS_MAX6650 is not set -# CONFIG_SENSORS_MAX6697 is not set -# CONFIG_SENSORS_MAX31790 is not set -# CONFIG_SENSORS_MCP3021 is not set -# CONFIG_SENSORS_TC654 is not set -# CONFIG_SENSORS_MR75203 is not set -# CONFIG_SENSORS_ADCXX is not set -# CONFIG_SENSORS_LM63 is not set -# CONFIG_SENSORS_LM70 is not set -# CONFIG_SENSORS_LM73 is not set -# CONFIG_SENSORS_LM75 is not set -# CONFIG_SENSORS_LM77 is not set -# CONFIG_SENSORS_LM78 is not set -# CONFIG_SENSORS_LM80 is not set -# CONFIG_SENSORS_LM83 is not set -# CONFIG_SENSORS_LM85 is not set -# CONFIG_SENSORS_LM87 is not set -# CONFIG_SENSORS_LM90 is not set -# CONFIG_SENSORS_LM92 is not set -# CONFIG_SENSORS_LM93 is not set -# CONFIG_SENSORS_LM95234 is not set -# CONFIG_SENSORS_LM95241 is not set -# CONFIG_SENSORS_LM95245 is not set -# CONFIG_SENSORS_PC87360 is not set -# CONFIG_SENSORS_PC87427 is not set -# CONFIG_SENSORS_NTC_THERMISTOR is not set -# CONFIG_SENSORS_NCT6683 is not set -# CONFIG_SENSORS_NCT6775 is not set -# CONFIG_SENSORS_NCT7802 is not set -# CONFIG_SENSORS_NCT7904 is not set -# CONFIG_SENSORS_NPCM7XX is not set -# CONFIG_SENSORS_OCC_P8_I2C is not set -# CONFIG_SENSORS_PCF8591 is not set -# CONFIG_PMBUS is not set -# CONFIG_SENSORS_PWM_FAN is not set -# CONFIG_SENSORS_SHT15 is not set -# CONFIG_SENSORS_SHT21 is not set -# CONFIG_SENSORS_SHT3x is not set -# CONFIG_SENSORS_SHTC1 is not set -# CONFIG_SENSORS_SIS5595 is not set -# CONFIG_SENSORS_DME1737 is not set -# CONFIG_SENSORS_EMC1403 is not set -# CONFIG_SENSORS_EMC2103 is not set -# CONFIG_SENSORS_EMC6W201 is not set -# CONFIG_SENSORS_SMSC47M1 is not set -# CONFIG_SENSORS_SMSC47M192 is not set -# CONFIG_SENSORS_SMSC47B397 is not set -# CONFIG_SENSORS_SCH5627 is not set -# CONFIG_SENSORS_SCH5636 is not set -# CONFIG_SENSORS_STTS751 is not set -# CONFIG_SENSORS_SMM665 is not set -# CONFIG_SENSORS_ADC128D818 is not set -# CONFIG_SENSORS_ADS7828 is not set -# CONFIG_SENSORS_ADS7871 is not set -# CONFIG_SENSORS_AMC6821 is not set -# CONFIG_SENSORS_INA209 is not set -# CONFIG_SENSORS_INA2XX is not set -# CONFIG_SENSORS_INA3221 is not set -# CONFIG_SENSORS_TC74 is not set -# CONFIG_SENSORS_THMC50 is not set -# CONFIG_SENSORS_TMP102 is not set -# CONFIG_SENSORS_TMP103 is not set -# CONFIG_SENSORS_TMP108 is not set -# CONFIG_SENSORS_TMP401 is not set -# CONFIG_SENSORS_TMP421 is not set -# CONFIG_SENSORS_TMP513 is not set -# CONFIG_SENSORS_VIA686A is not set -# CONFIG_SENSORS_VT1211 is not set -# CONFIG_SENSORS_VT8231 is not set -# CONFIG_SENSORS_W83773G is not set -# CONFIG_SENSORS_W83781D is not set -# CONFIG_SENSORS_W83791D is not set -# CONFIG_SENSORS_W83792D is not set -# CONFIG_SENSORS_W83793 is not set -# CONFIG_SENSORS_W83795 is not set -# CONFIG_SENSORS_W83L785TS is not set -# CONFIG_SENSORS_W83L786NG is not set -# CONFIG_SENSORS_W83627HF is not set -# CONFIG_SENSORS_W83627EHF is not set -CONFIG_THERMAL=y -# CONFIG_THERMAL_NETLINK is not set -# CONFIG_THERMAL_STATISTICS is not set -CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 -CONFIG_THERMAL_HWMON=y -CONFIG_THERMAL_OF=y -CONFIG_THERMAL_WRITABLE_TRIPS=y -CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y -# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set -# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set -CONFIG_THERMAL_GOV_FAIR_SHARE=y -CONFIG_THERMAL_GOV_STEP_WISE=y -# CONFIG_THERMAL_GOV_BANG_BANG is not set -# CONFIG_THERMAL_GOV_USER_SPACE is not set -# CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not set -CONFIG_CPU_THERMAL=y -CONFIG_CPU_FREQ_THERMAL=y -CONFIG_DEVFREQ_THERMAL=y -# CONFIG_THERMAL_EMULATION is not set -# CONFIG_THERMAL_MMIO is not set -CONFIG_ROCKCHIP_THERMAL=y -# CONFIG_GENERIC_ADC_THERMAL is not set -CONFIG_WATCHDOG=y -CONFIG_WATCHDOG_CORE=y -# CONFIG_WATCHDOG_NOWAYOUT is not set -CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED=y -CONFIG_WATCHDOG_OPEN_TIMEOUT=0 -# CONFIG_WATCHDOG_SYSFS is not set - -# -# Watchdog Pretimeout Governors -# -# CONFIG_WATCHDOG_PRETIMEOUT_GOV is not set - -# -# Watchdog Device Drivers -# -# CONFIG_SOFT_WATCHDOG is not set -# CONFIG_GPIO_WATCHDOG is not set -# CONFIG_XILINX_WATCHDOG is not set -# CONFIG_ZIIRAVE_WATCHDOG is not set -# CONFIG_ARM_SP805_WATCHDOG is not set -# CONFIG_ARM_SBSA_WATCHDOG is not set -# CONFIG_CADENCE_WATCHDOG is not set -CONFIG_DW_WATCHDOG=y -# CONFIG_MAX63XX_WATCHDOG is not set -# CONFIG_ARM_SMC_WATCHDOG is not set -# CONFIG_ALIM7101_WDT is not set -# CONFIG_I6300ESB_WDT is not set -# CONFIG_MEN_A21_WDT is not set - -# -# PCI-based Watchdog Cards -# -# CONFIG_PCIPCWATCHDOG is not set -# CONFIG_WDTPCI is not set - -# -# USB-based Watchdog Cards -# -# CONFIG_USBPCWATCHDOG is not set -CONFIG_SSB_POSSIBLE=y -# CONFIG_SSB is not set -CONFIG_BCMA_POSSIBLE=y -# CONFIG_BCMA is not set - -# -# Multifunction device drivers -# -CONFIG_MFD_CORE=y -# CONFIG_MFD_ACT8945A is not set -# CONFIG_MFD_AS3711 is not set -# CONFIG_MFD_AS3722 is not set -# CONFIG_PMIC_ADP5520 is not set -# CONFIG_MFD_AAT2870_CORE is not set -# CONFIG_MFD_ATMEL_FLEXCOM is not set -# CONFIG_MFD_ATMEL_HLCDC is not set -# CONFIG_MFD_BCM590XX is not set -# CONFIG_MFD_BD9571MWV is not set -# CONFIG_MFD_AXP20X_I2C is not set -# CONFIG_MFD_MADERA is not set -# CONFIG_PMIC_DA903X is not set -# CONFIG_MFD_DA9052_SPI is not set -# CONFIG_MFD_DA9052_I2C is not set -# CONFIG_MFD_DA9055 is not set -# CONFIG_MFD_DA9062 is not set -# CONFIG_MFD_DA9063 is not set -# CONFIG_MFD_DA9150 is not set -# CONFIG_MFD_DLN2 is not set -# CONFIG_MFD_GATEWORKS_GSC is not set -# CONFIG_MFD_MC13XXX_SPI is not set -# CONFIG_MFD_MC13XXX_I2C is not set -# CONFIG_MFD_MP2629 is not set -# CONFIG_MFD_HI6421_PMIC is not set -# CONFIG_HTC_PASIC3 is not set -# CONFIG_HTC_I2CPLD is not set -# CONFIG_LPC_ICH is not set -# CONFIG_LPC_SCH is not set -# CONFIG_MFD_INTEL_PMT is not set -# CONFIG_MFD_IQS62X is not set -# CONFIG_MFD_JANZ_CMODIO is not set -# CONFIG_MFD_KEMPLD is not set -# CONFIG_MFD_88PM800 is not set -# CONFIG_MFD_88PM805 is not set -# CONFIG_MFD_88PM860X is not set -# CONFIG_MFD_MAX14577 is not set -# CONFIG_MFD_MAX77620 is not set -# CONFIG_MFD_MAX77650 is not set -# CONFIG_MFD_MAX77686 is not set -# CONFIG_MFD_MAX77693 is not set -# CONFIG_MFD_MAX77843 is not set -# CONFIG_MFD_MAX8907 is not set -# CONFIG_MFD_MAX8925 is not set -# CONFIG_MFD_MAX8997 is not set -# CONFIG_MFD_MAX8998 is not set -# CONFIG_MFD_MT6360 is not set -# CONFIG_MFD_MT6397 is not set -# CONFIG_MFD_MENF21BMC is not set -# CONFIG_EZX_PCAP is not set -# CONFIG_MFD_CPCAP is not set -# CONFIG_MFD_VIPERBOARD is not set -# CONFIG_MFD_RETU is not set -# CONFIG_MFD_PCF50633 is not set -# CONFIG_MFD_RDC321X is not set -# CONFIG_MFD_RT5033 is not set -# CONFIG_MFD_RC5T583 is not set -CONFIG_MFD_RK808=y -# CONFIG_MFD_RN5T618 is not set -# CONFIG_MFD_SEC_CORE is not set -# CONFIG_MFD_SI476X_CORE is not set -# CONFIG_MFD_SM501 is not set -# CONFIG_MFD_SKY81452 is not set -# CONFIG_ABX500_CORE is not set -# CONFIG_MFD_STMPE is not set -CONFIG_MFD_SYSCON=y -# CONFIG_MFD_TI_AM335X_TSCADC is not set -# CONFIG_MFD_LP3943 is not set -# CONFIG_MFD_LP8788 is not set -# CONFIG_MFD_TI_LMU is not set -# CONFIG_MFD_PALMAS is not set -# CONFIG_TPS6105X is not set -# CONFIG_TPS65010 is not set -# CONFIG_TPS6507X is not set -# CONFIG_MFD_TPS65086 is not set -# CONFIG_MFD_TPS65090 is not set -# CONFIG_MFD_TPS65217 is not set -# CONFIG_MFD_TI_LP873X is not set -# CONFIG_MFD_TI_LP87565 is not set -# CONFIG_MFD_TPS65218 is not set -CONFIG_MFD_TPS6586X=y -# CONFIG_MFD_TPS65910 is not set -# CONFIG_MFD_TPS65912_I2C is not set -# CONFIG_MFD_TPS65912_SPI is not set -# CONFIG_MFD_TPS80031 is not set -# CONFIG_TWL4030_CORE is not set -# CONFIG_TWL6040_CORE is not set -# CONFIG_MFD_WL1273_CORE is not set -# CONFIG_MFD_LM3533 is not set -# CONFIG_MFD_TC3589X is not set -# CONFIG_MFD_TQMX86 is not set -# CONFIG_MFD_VX855 is not set -# CONFIG_MFD_LOCHNAGAR is not set -# CONFIG_MFD_ARIZONA_I2C is not set -# CONFIG_MFD_ARIZONA_SPI is not set -# CONFIG_MFD_WM8400 is not set -# CONFIG_MFD_WM831X_I2C is not set -# CONFIG_MFD_WM831X_SPI is not set -# CONFIG_MFD_WM8350_I2C is not set -# CONFIG_MFD_WM8994 is not set -# CONFIG_MFD_ROHM_BD718XX is not set -# CONFIG_MFD_ROHM_BD70528 is not set -# CONFIG_MFD_ROHM_BD71828 is not set -# CONFIG_MFD_STPMIC1 is not set -# CONFIG_MFD_STMFX is not set -# CONFIG_MFD_KHADAS_MCU is not set -# CONFIG_MFD_INTEL_M10_BMC is not set -# end of Multifunction device drivers - -CONFIG_REGULATOR=y -CONFIG_REGULATOR_DEBUG=y -CONFIG_REGULATOR_FIXED_VOLTAGE=y -# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set -# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set -# CONFIG_REGULATOR_88PG86X is not set -CONFIG_REGULATOR_ACT8865=y -# CONFIG_REGULATOR_AD5398 is not set -# CONFIG_REGULATOR_DA9210 is not set -# CONFIG_REGULATOR_DA9211 is not set -CONFIG_REGULATOR_FAN53555=y -# CONFIG_REGULATOR_FAN53880 is not set -CONFIG_REGULATOR_GPIO=y -# CONFIG_REGULATOR_ISL9305 is not set -# CONFIG_REGULATOR_ISL6271A is not set -# CONFIG_REGULATOR_LP3971 is not set -# CONFIG_REGULATOR_LP3972 is not set -# CONFIG_REGULATOR_LP872X is not set -# CONFIG_REGULATOR_LP8755 is not set -# CONFIG_REGULATOR_LTC3589 is not set -# CONFIG_REGULATOR_LTC3676 is not set -# CONFIG_REGULATOR_MAX1586 is not set -# CONFIG_REGULATOR_MAX8649 is not set -# CONFIG_REGULATOR_MAX8660 is not set -# CONFIG_REGULATOR_MAX8952 is not set -# CONFIG_REGULATOR_MAX8973 is not set -# CONFIG_REGULATOR_MAX77826 is not set -# CONFIG_REGULATOR_MCP16502 is not set -# CONFIG_REGULATOR_MP5416 is not set -# CONFIG_REGULATOR_MP8859 is not set -# CONFIG_REGULATOR_MP886X is not set -# CONFIG_REGULATOR_MPQ7920 is not set -# CONFIG_REGULATOR_MT6311 is not set -# CONFIG_REGULATOR_PCA9450 is not set -# CONFIG_REGULATOR_PFUZE100 is not set -# CONFIG_REGULATOR_PV88060 is not set -# CONFIG_REGULATOR_PV88080 is not set -# CONFIG_REGULATOR_PV88090 is not set -CONFIG_REGULATOR_PWM=y -# CONFIG_REGULATOR_RASPBERRYPI_TOUCHSCREEN_ATTINY is not set -CONFIG_REGULATOR_RK808=y -# CONFIG_REGULATOR_RT4801 is not set -# CONFIG_REGULATOR_RTMV20 is not set -# CONFIG_REGULATOR_SLG51000 is not set -# CONFIG_REGULATOR_SY8106A is not set -# CONFIG_REGULATOR_SY8824X is not set -# CONFIG_REGULATOR_SY8827N is not set -# CONFIG_REGULATOR_TPS51632 is not set -# CONFIG_REGULATOR_TPS62360 is not set -# CONFIG_REGULATOR_TPS65023 is not set -# CONFIG_REGULATOR_TPS6507X is not set -CONFIG_REGULATOR_TPS65132=y -# CONFIG_REGULATOR_TPS6524X is not set -CONFIG_REGULATOR_TPS6586X=y -# CONFIG_REGULATOR_VCTRL is not set -# CONFIG_RC_CORE is not set -CONFIG_CEC_CORE=y -CONFIG_CEC_NOTIFIER=y -CONFIG_MEDIA_CEC_SUPPORT=y -# CONFIG_CEC_CH7322 is not set -# CONFIG_USB_PULSE8_CEC is not set -# CONFIG_USB_RAINSHADOW_CEC is not set -CONFIG_MEDIA_SUPPORT=y -# CONFIG_MEDIA_SUPPORT_FILTER is not set -# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set - -# -# Media device types -# -CONFIG_MEDIA_CAMERA_SUPPORT=y -CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -CONFIG_MEDIA_RADIO_SUPPORT=y -CONFIG_MEDIA_SDR_SUPPORT=y -CONFIG_MEDIA_PLATFORM_SUPPORT=y -CONFIG_MEDIA_TEST_SUPPORT=y -# end of Media device types - -# -# Media core support -# -CONFIG_VIDEO_DEV=y -CONFIG_MEDIA_CONTROLLER=y -CONFIG_DVB_CORE=y -# end of Media core support - -# -# Video4Linux options -# -CONFIG_VIDEO_V4L2=y -CONFIG_VIDEO_V4L2_I2C=y -CONFIG_VIDEO_V4L2_SUBDEV_API=y -# CONFIG_VIDEO_ADV_DEBUG is not set -# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set -# end of Video4Linux options - -# -# Media controller options -# -# CONFIG_MEDIA_CONTROLLER_DVB is not set -# end of Media controller options - -# -# Digital TV options -# -# CONFIG_DVB_MMAP is not set -CONFIG_DVB_NET=y -CONFIG_DVB_MAX_ADAPTERS=16 -CONFIG_DVB_DYNAMIC_MINORS=y -# CONFIG_DVB_DEMUX_SECTION_LOSS_LOG is not set -# CONFIG_DVB_ULE_DEBUG is not set -# end of Digital TV options - -# -# Media drivers -# -CONFIG_MEDIA_USB_SUPPORT=y - -# -# Webcam devices -# -CONFIG_USB_VIDEO_CLASS=y -# CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV is not set -# CONFIG_USB_GSPCA is not set -# CONFIG_USB_PWC is not set -# CONFIG_VIDEO_CPIA2 is not set -# CONFIG_USB_ZR364XX is not set -# CONFIG_USB_STKWEBCAM is not set -# CONFIG_USB_S2255 is not set - -# -# Analog TV USB devices -# -# CONFIG_VIDEO_PVRUSB2 is not set -# CONFIG_VIDEO_HDPVR is not set -# CONFIG_VIDEO_STK1160_COMMON is not set - -# -# Analog/digital TV USB devices -# -# CONFIG_VIDEO_AU0828 is not set - -# -# Digital TV USB devices -# -# CONFIG_DVB_USB_V2 is not set -# CONFIG_DVB_TTUSB_BUDGET is not set -# CONFIG_DVB_TTUSB_DEC is not set -# CONFIG_SMS_USB_DRV is not set -# CONFIG_DVB_B2C2_FLEXCOP_USB is not set -# CONFIG_DVB_AS102 is not set - -# -# Webcam, TV (analog/digital) USB devices -# -# CONFIG_VIDEO_EM28XX is not set - -# -# Software defined radio USB devices -# -# CONFIG_USB_AIRSPY is not set -# CONFIG_USB_HACKRF is not set -# CONFIG_USB_MSI2500 is not set -# CONFIG_MEDIA_PCI_SUPPORT is not set -CONFIG_RADIO_ADAPTERS=y -# CONFIG_RADIO_SI470X is not set -# CONFIG_RADIO_SI4713 is not set -# CONFIG_USB_MR800 is not set -# CONFIG_USB_DSBR is not set -# CONFIG_RADIO_MAXIRADIO is not set -# CONFIG_RADIO_SHARK is not set -# CONFIG_RADIO_SHARK2 is not set -# CONFIG_USB_KEENE is not set -# CONFIG_USB_RAREMONO is not set -# CONFIG_USB_MA901 is not set -# CONFIG_RADIO_TEA5764 is not set -# CONFIG_RADIO_SAA7706H is not set -# CONFIG_RADIO_TEF6862 is not set -# CONFIG_RADIO_WL1273 is not set -CONFIG_VIDEOBUF2_CORE=y -CONFIG_VIDEOBUF2_V4L2=y -CONFIG_VIDEOBUF2_MEMOPS=y -CONFIG_VIDEOBUF2_VMALLOC=y -CONFIG_V4L_PLATFORM_DRIVERS=y -# CONFIG_VIDEO_CAFE_CCIC is not set -# CONFIG_VIDEO_CADENCE is not set -# CONFIG_VIDEO_ASPEED is not set -# CONFIG_VIDEO_MUX is not set -# CONFIG_VIDEO_XILINX is not set -# CONFIG_V4L_MEM2MEM_DRIVERS is not set -# CONFIG_DVB_PLATFORM_DRIVERS is not set -# CONFIG_SDR_PLATFORM_DRIVERS is not set - -# -# MMC/SDIO DVB adapters -# -# CONFIG_SMS_SDIO_DRV is not set -# CONFIG_V4L_TEST_DRIVERS is not set -# CONFIG_DVB_TEST_DRIVERS is not set -# end of Media drivers - -# -# Media ancillary drivers -# -CONFIG_MEDIA_ATTACH=y - -# -# Audio decoders, processors and mixers -# -# CONFIG_VIDEO_TVAUDIO is not set -# CONFIG_VIDEO_TDA7432 is not set -# CONFIG_VIDEO_TDA9840 is not set -# CONFIG_VIDEO_TEA6415C is not set -# CONFIG_VIDEO_TEA6420 is not set -# CONFIG_VIDEO_MSP3400 is not set -# CONFIG_VIDEO_CS3308 is not set -# CONFIG_VIDEO_CS5345 is not set -# CONFIG_VIDEO_CS53L32A is not set -# CONFIG_VIDEO_TLV320AIC23B is not set -# CONFIG_VIDEO_UDA1342 is not set -# CONFIG_VIDEO_WM8775 is not set -# CONFIG_VIDEO_WM8739 is not set -# CONFIG_VIDEO_VP27SMPX is not set -# CONFIG_VIDEO_SONY_BTF_MPX is not set -# end of Audio decoders, processors and mixers - -# -# RDS decoders -# -# CONFIG_VIDEO_SAA6588 is not set -# end of RDS decoders - -# -# Video decoders -# -# CONFIG_VIDEO_ADV7180 is not set -# CONFIG_VIDEO_ADV7183 is not set -# CONFIG_VIDEO_ADV748X is not set -# CONFIG_VIDEO_ADV7604 is not set -# CONFIG_VIDEO_ADV7842 is not set -# CONFIG_VIDEO_BT819 is not set -# CONFIG_VIDEO_BT856 is not set -# CONFIG_VIDEO_BT866 is not set -# CONFIG_VIDEO_KS0127 is not set -# CONFIG_VIDEO_ML86V7667 is not set -# CONFIG_VIDEO_SAA7110 is not set -# CONFIG_VIDEO_SAA711X is not set -# CONFIG_VIDEO_TC358743 is not set -# CONFIG_VIDEO_TVP514X is not set -# CONFIG_VIDEO_TVP5150 is not set -# CONFIG_VIDEO_TVP7002 is not set -# CONFIG_VIDEO_TW2804 is not set -# CONFIG_VIDEO_TW9903 is not set -# CONFIG_VIDEO_TW9906 is not set -# CONFIG_VIDEO_TW9910 is not set -# CONFIG_VIDEO_VPX3220 is not set - -# -# Video and audio decoders -# -# CONFIG_VIDEO_SAA717X is not set -# CONFIG_VIDEO_CX25840 is not set -# end of Video decoders - -# -# Video encoders -# -# CONFIG_VIDEO_SAA7127 is not set -# CONFIG_VIDEO_SAA7185 is not set -# CONFIG_VIDEO_ADV7170 is not set -# CONFIG_VIDEO_ADV7175 is not set -# CONFIG_VIDEO_ADV7343 is not set -# CONFIG_VIDEO_ADV7393 is not set -# CONFIG_VIDEO_ADV7511 is not set -# CONFIG_VIDEO_AD9389B is not set -# CONFIG_VIDEO_AK881X is not set -# CONFIG_VIDEO_THS8200 is not set -# end of Video encoders - -# -# Video improvement chips -# -# CONFIG_VIDEO_UPD64031A is not set -# CONFIG_VIDEO_UPD64083 is not set -# end of Video improvement chips - -# -# Audio/Video compression chips -# -# CONFIG_VIDEO_SAA6752HS is not set -# end of Audio/Video compression chips - -# -# SDR tuner chips -# -# CONFIG_SDR_MAX2175 is not set -# end of SDR tuner chips - -# -# Miscellaneous helper chips -# -# CONFIG_VIDEO_THS7303 is not set -# CONFIG_VIDEO_M52790 is not set -# CONFIG_VIDEO_I2C is not set -# CONFIG_VIDEO_ST_MIPID02 is not set -# end of Miscellaneous helper chips - -# -# Camera sensor devices -# -# CONFIG_VIDEO_HI556 is not set -# CONFIG_VIDEO_IMX214 is not set -# CONFIG_VIDEO_IMX219 is not set -# CONFIG_VIDEO_IMX258 is not set -# CONFIG_VIDEO_IMX274 is not set -# CONFIG_VIDEO_IMX290 is not set -# CONFIG_VIDEO_IMX319 is not set -# CONFIG_VIDEO_IMX355 is not set -# CONFIG_VIDEO_OV2640 is not set -# CONFIG_VIDEO_OV2659 is not set -# CONFIG_VIDEO_OV2680 is not set -# CONFIG_VIDEO_OV2685 is not set -# CONFIG_VIDEO_OV5640 is not set -# CONFIG_VIDEO_OV5645 is not set -# CONFIG_VIDEO_OV5647 is not set -# CONFIG_VIDEO_OV6650 is not set -# CONFIG_VIDEO_OV5670 is not set -# CONFIG_VIDEO_OV5675 is not set -# CONFIG_VIDEO_OV5695 is not set -# CONFIG_VIDEO_OV7251 is not set -# CONFIG_VIDEO_OV772X is not set -# CONFIG_VIDEO_OV7640 is not set -# CONFIG_VIDEO_OV7670 is not set -# CONFIG_VIDEO_OV7740 is not set -# CONFIG_VIDEO_OV8856 is not set -# CONFIG_VIDEO_OV9640 is not set -# CONFIG_VIDEO_OV9650 is not set -# CONFIG_VIDEO_OV13858 is not set -# CONFIG_VIDEO_VS6624 is not set -# CONFIG_VIDEO_MT9M001 is not set -# CONFIG_VIDEO_MT9M032 is not set -# CONFIG_VIDEO_MT9M111 is not set -# CONFIG_VIDEO_MT9P031 is not set -# CONFIG_VIDEO_MT9T001 is not set -# CONFIG_VIDEO_MT9T112 is not set -# CONFIG_VIDEO_MT9V011 is not set -# CONFIG_VIDEO_MT9V032 is not set -# CONFIG_VIDEO_MT9V111 is not set -# CONFIG_VIDEO_SR030PC30 is not set -# CONFIG_VIDEO_NOON010PC30 is not set -# CONFIG_VIDEO_M5MOLS is not set -# CONFIG_VIDEO_RDACM20 is not set -# CONFIG_VIDEO_RJ54N1 is not set -# CONFIG_VIDEO_S5K6AA is not set -# CONFIG_VIDEO_S5K6A3 is not set -# CONFIG_VIDEO_S5K4ECGX is not set -# CONFIG_VIDEO_S5K5BAF is not set -# CONFIG_VIDEO_SMIAPP is not set -# CONFIG_VIDEO_ET8EK8 is not set -# CONFIG_VIDEO_S5C73M3 is not set -# end of Camera sensor devices - -# -# Lens drivers -# -# CONFIG_VIDEO_AD5820 is not set -# CONFIG_VIDEO_AK7375 is not set -# CONFIG_VIDEO_DW9714 is not set -# CONFIG_VIDEO_DW9768 is not set -# CONFIG_VIDEO_DW9807_VCM is not set -# end of Lens drivers - -# -# Flash devices -# -# CONFIG_VIDEO_ADP1653 is not set -# CONFIG_VIDEO_LM3560 is not set -# CONFIG_VIDEO_LM3646 is not set -# end of Flash devices - -# -# SPI helper chips -# -# CONFIG_VIDEO_GS1662 is not set -# end of SPI helper chips - -# -# Media SPI Adapters -# -CONFIG_CXD2880_SPI_DRV=m -# end of Media SPI Adapters - -CONFIG_MEDIA_TUNER=y - -# -# Customize TV tuners -# -CONFIG_MEDIA_TUNER_SIMPLE=m -CONFIG_MEDIA_TUNER_TDA18250=m -CONFIG_MEDIA_TUNER_TDA8290=m -CONFIG_MEDIA_TUNER_TDA827X=m -CONFIG_MEDIA_TUNER_TDA18271=m -CONFIG_MEDIA_TUNER_TDA9887=m -CONFIG_MEDIA_TUNER_TEA5761=m -CONFIG_MEDIA_TUNER_TEA5767=m -CONFIG_MEDIA_TUNER_MSI001=m -CONFIG_MEDIA_TUNER_MT20XX=m -CONFIG_MEDIA_TUNER_MT2060=m -CONFIG_MEDIA_TUNER_MT2063=m -CONFIG_MEDIA_TUNER_MT2266=m -CONFIG_MEDIA_TUNER_MT2131=m -CONFIG_MEDIA_TUNER_QT1010=m -CONFIG_MEDIA_TUNER_XC2028=m -CONFIG_MEDIA_TUNER_XC5000=m -CONFIG_MEDIA_TUNER_XC4000=m -CONFIG_MEDIA_TUNER_MXL5005S=m -CONFIG_MEDIA_TUNER_MXL5007T=m -CONFIG_MEDIA_TUNER_MC44S803=m -CONFIG_MEDIA_TUNER_MAX2165=m -CONFIG_MEDIA_TUNER_TDA18218=m -CONFIG_MEDIA_TUNER_FC0011=m -CONFIG_MEDIA_TUNER_FC0012=m -CONFIG_MEDIA_TUNER_FC0013=m -CONFIG_MEDIA_TUNER_TDA18212=m -CONFIG_MEDIA_TUNER_E4000=m -CONFIG_MEDIA_TUNER_FC2580=m -CONFIG_MEDIA_TUNER_M88RS6000T=m -CONFIG_MEDIA_TUNER_TUA9001=m -CONFIG_MEDIA_TUNER_SI2157=m -CONFIG_MEDIA_TUNER_IT913X=m -CONFIG_MEDIA_TUNER_R820T=m -CONFIG_MEDIA_TUNER_MXL301RF=m -CONFIG_MEDIA_TUNER_QM1D1C0042=m -CONFIG_MEDIA_TUNER_QM1D1B0004=m -# end of Customize TV tuners - -# -# Customise DVB Frontends -# - -# -# Multistandard (satellite) frontends -# -CONFIG_DVB_STB0899=m -CONFIG_DVB_STB6100=m -CONFIG_DVB_STV090x=m -CONFIG_DVB_STV0910=m -CONFIG_DVB_STV6110x=m -CONFIG_DVB_STV6111=m -CONFIG_DVB_MXL5XX=m - -# -# Multistandard (cable + terrestrial) frontends -# -CONFIG_DVB_DRXK=m -CONFIG_DVB_TDA18271C2DD=m -CONFIG_DVB_SI2165=m -CONFIG_DVB_MN88472=m -CONFIG_DVB_MN88473=m - -# -# DVB-S (satellite) frontends -# -CONFIG_DVB_CX24110=m -CONFIG_DVB_CX24123=m -CONFIG_DVB_MT312=m -CONFIG_DVB_ZL10036=m -CONFIG_DVB_ZL10039=m -CONFIG_DVB_S5H1420=m -CONFIG_DVB_STV0288=m -CONFIG_DVB_STB6000=m -CONFIG_DVB_STV0299=m -CONFIG_DVB_STV6110=m -CONFIG_DVB_STV0900=m -CONFIG_DVB_TDA8083=m -CONFIG_DVB_TDA10086=m -CONFIG_DVB_TDA8261=m -CONFIG_DVB_VES1X93=m -CONFIG_DVB_TUNER_ITD1000=m -CONFIG_DVB_TUNER_CX24113=m -CONFIG_DVB_TDA826X=m -CONFIG_DVB_TUA6100=m -CONFIG_DVB_CX24116=m -CONFIG_DVB_CX24117=m -CONFIG_DVB_CX24120=m -CONFIG_DVB_SI21XX=m -CONFIG_DVB_TS2020=m -CONFIG_DVB_DS3000=m -CONFIG_DVB_MB86A16=m -CONFIG_DVB_TDA10071=m - -# -# DVB-T (terrestrial) frontends -# -CONFIG_DVB_SP8870=m -CONFIG_DVB_SP887X=m -CONFIG_DVB_CX22700=m -CONFIG_DVB_CX22702=m -CONFIG_DVB_S5H1432=m -CONFIG_DVB_DRXD=m -CONFIG_DVB_L64781=m -CONFIG_DVB_TDA1004X=m -CONFIG_DVB_NXT6000=m -CONFIG_DVB_MT352=m -CONFIG_DVB_ZL10353=m -CONFIG_DVB_DIB3000MB=m -CONFIG_DVB_DIB3000MC=m -CONFIG_DVB_DIB7000M=m -CONFIG_DVB_DIB7000P=m -CONFIG_DVB_DIB9000=m -CONFIG_DVB_TDA10048=m -CONFIG_DVB_EC100=m -CONFIG_DVB_STV0367=m -CONFIG_DVB_CXD2820R=m -CONFIG_DVB_CXD2841ER=m -CONFIG_DVB_ZD1301_DEMOD=m -CONFIG_DVB_CXD2880=m - -# -# DVB-C (cable) frontends -# -CONFIG_DVB_VES1820=m -CONFIG_DVB_TDA10021=m -CONFIG_DVB_TDA10023=m -CONFIG_DVB_STV0297=m - -# -# ATSC (North American/Korean Terrestrial/Cable DTV) frontends -# -CONFIG_DVB_NXT200X=m -CONFIG_DVB_OR51211=m -CONFIG_DVB_OR51132=m -CONFIG_DVB_BCM3510=m -CONFIG_DVB_LGDT330X=m -CONFIG_DVB_LGDT3305=m -CONFIG_DVB_LG2160=m -CONFIG_DVB_S5H1409=m -CONFIG_DVB_AU8522=m -CONFIG_DVB_AU8522_DTV=m -CONFIG_DVB_AU8522_V4L=m -CONFIG_DVB_S5H1411=m - -# -# ISDB-T (terrestrial) frontends -# -CONFIG_DVB_S921=m -CONFIG_DVB_DIB8000=m -CONFIG_DVB_MB86A20S=m - -# -# ISDB-S (satellite) & ISDB-T (terrestrial) frontends -# -CONFIG_DVB_TC90522=m -CONFIG_DVB_MN88443X=m - -# -# Digital terrestrial only tuners/PLL -# -CONFIG_DVB_PLL=m -CONFIG_DVB_TUNER_DIB0070=m -CONFIG_DVB_TUNER_DIB0090=m - -# -# SEC control devices for DVB-S -# -CONFIG_DVB_DRX39XYJ=m -CONFIG_DVB_LNBH25=m -CONFIG_DVB_LNBH29=m -CONFIG_DVB_LNBP21=m -CONFIG_DVB_LNBP22=m -CONFIG_DVB_ISL6405=m -CONFIG_DVB_ISL6421=m -CONFIG_DVB_ISL6423=m -CONFIG_DVB_A8293=m -CONFIG_DVB_LGS8GL5=m -CONFIG_DVB_LGS8GXX=m -CONFIG_DVB_ATBM8830=m -CONFIG_DVB_TDA665x=m -CONFIG_DVB_IX2505V=m -CONFIG_DVB_M88RS2000=m -CONFIG_DVB_AF9033=m -CONFIG_DVB_HORUS3A=m -CONFIG_DVB_ASCOT2E=m -CONFIG_DVB_HELENE=m - -# -# Common Interface (EN50221) controller drivers -# -CONFIG_DVB_CXD2099=m -CONFIG_DVB_SP2=m -# end of Customise DVB Frontends - -# -# Tools to develop new frontends -# -# CONFIG_DVB_DUMMY_FE is not set -# end of Media ancillary drivers - -# -# Graphics support -# -# CONFIG_VGA_ARB is not set -CONFIG_DRM=y -CONFIG_DRM_MIPI_DSI=y -# CONFIG_DRM_DP_AUX_CHARDEV is not set -# CONFIG_DRM_DEBUG_MM is not set -# CONFIG_DRM_DEBUG_SELFTEST is not set -CONFIG_DRM_KMS_HELPER=y -CONFIG_DRM_KMS_FB_HELPER=y -# CONFIG_DRM_DEBUG_DP_MST_TOPOLOGY_REFS is not set -CONFIG_DRM_FBDEV_EMULATION=y -CONFIG_DRM_FBDEV_OVERALLOC=100 -# CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM is not set -# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set -# CONFIG_DRM_DP_CEC is not set -CONFIG_DRM_GEM_CMA_HELPER=y - -# -# I2C encoder or helper chips -# -# CONFIG_DRM_I2C_CH7006 is not set -# CONFIG_DRM_I2C_SIL164 is not set -# CONFIG_DRM_I2C_NXP_TDA998X is not set -# CONFIG_DRM_I2C_NXP_TDA9950 is not set -# end of I2C encoder or helper chips - -# -# ARM devices -# -# CONFIG_DRM_HDLCD is not set -# CONFIG_DRM_MALI_DISPLAY is not set -# CONFIG_DRM_KOMEDA is not set -# end of ARM devices - -# CONFIG_DRM_RADEON is not set -# CONFIG_DRM_AMDGPU is not set -# CONFIG_DRM_NOUVEAU is not set -# CONFIG_DRM_VGEM is not set -# CONFIG_DRM_VKMS is not set -CONFIG_DRM_ROCKCHIP=y -# CONFIG_ROCKCHIP_DRM_CUBIC_LUT is not set -# CONFIG_ROCKCHIP_DRM_DEBUG is not set -# CONFIG_ROCKCHIP_DRM_DIRECT_SHOW is not set -# CONFIG_ROCKCHIP_VOP is not set -CONFIG_ROCKCHIP_VOP2=y -# CONFIG_ROCKCHIP_ANALOGIX_DP is not set -# CONFIG_ROCKCHIP_CDN_DP is not set -CONFIG_ROCKCHIP_DW_HDMI=y -CONFIG_ROCKCHIP_DW_MIPI_DSI=y -# CONFIG_ROCKCHIP_DW_DP is not set -# CONFIG_ROCKCHIP_INNO_HDMI is not set -# CONFIG_ROCKCHIP_LVDS is not set -# CONFIG_ROCKCHIP_RGB is not set -# CONFIG_ROCKCHIP_RK3066_HDMI is not set -# CONFIG_ROCKCHIP_VCONN is not set -# CONFIG_DRM_ROCKCHIP_VVOP is not set -# CONFIG_DRM_UDL is not set -# CONFIG_DRM_AST is not set -# CONFIG_DRM_MGAG200 is not set -# CONFIG_DRM_RCAR_DW_HDMI is not set -# CONFIG_DRM_RCAR_LVDS is not set -# CONFIG_DRM_QXL is not set -# CONFIG_DRM_BOCHS is not set -CONFIG_DRM_PANEL=y - -# -# Display Panels -# -# CONFIG_DRM_PANEL_ARM_VERSATILE is not set -# CONFIG_DRM_PANEL_ASUS_Z00T_TM5P5_NT35596 is not set -# CONFIG_DRM_PANEL_BOE_HIMAX8279D is not set -# CONFIG_DRM_PANEL_BOE_TV101WUM_NL6 is not set -# CONFIG_DRM_PANEL_LVDS is not set -CONFIG_DRM_PANEL_SIMPLE=y -# CONFIG_DRM_PANEL_ELIDA_KD35T133 is not set -# CONFIG_DRM_PANEL_FEIXIN_K101_IM2BA02 is not set -# CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D is not set -# CONFIG_DRM_PANEL_ILITEK_IL9322 is not set -# CONFIG_DRM_PANEL_ILITEK_ILI9881C is not set -# CONFIG_DRM_PANEL_INNOLUX_P079ZCA is not set -# CONFIG_DRM_PANEL_JDI_LT070ME05000 is not set -# CONFIG_DRM_PANEL_KINGDISPLAY_KD097D04 is not set -# CONFIG_DRM_PANEL_LEADTEK_LTK050H3146W is not set -# CONFIG_DRM_PANEL_LEADTEK_LTK500HD1829 is not set -# CONFIG_DRM_PANEL_SAMSUNG_LD9040 is not set -# CONFIG_DRM_PANEL_LG_LB035Q02 is not set -# CONFIG_DRM_PANEL_LG_LG4573 is not set -# CONFIG_DRM_PANEL_NEC_NL8048HL11 is not set -# CONFIG_DRM_PANEL_NOVATEK_NT35510 is not set -# CONFIG_DRM_PANEL_NOVATEK_NT39016 is not set -# CONFIG_DRM_PANEL_MANTIX_MLAF057WE51 is not set -# CONFIG_DRM_PANEL_OLIMEX_LCD_OLINUXINO is not set -# CONFIG_DRM_PANEL_ORISETECH_OTM8009A is not set -# CONFIG_DRM_PANEL_OSD_OSD101T2587_53TS is not set -# CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00 is not set -# CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN is not set -# CONFIG_DRM_PANEL_RAYDIUM_RM67191 is not set -# CONFIG_DRM_PANEL_RAYDIUM_RM68200 is not set -# CONFIG_DRM_PANEL_RONBO_RB070D30 is not set -# CONFIG_DRM_PANEL_SAMSUNG_S6D16D0 is not set -# CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2 is not set -# CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03 is not set -# CONFIG_DRM_PANEL_SAMSUNG_S6E63M0 is not set -# CONFIG_DRM_PANEL_SAMSUNG_S6E88A0_AMS452EF01 is not set -# CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0 is not set -# CONFIG_DRM_PANEL_SEIKO_43WVF1G is not set -# CONFIG_DRM_PANEL_SHARP_LQ101R1SX01 is not set -# CONFIG_DRM_PANEL_SHARP_LS037V7DW01 is not set -# CONFIG_DRM_PANEL_SHARP_LS043T1LE01 is not set -# CONFIG_DRM_PANEL_SITRONIX_ST7701 is not set -# CONFIG_DRM_PANEL_SITRONIX_ST7703 is not set -# CONFIG_DRM_PANEL_SITRONIX_ST7789V is not set -# CONFIG_DRM_PANEL_SONY_ACX424AKP is not set -# CONFIG_DRM_PANEL_SONY_ACX565AKM is not set -# CONFIG_DRM_PANEL_TPO_TD028TTEC1 is not set -# CONFIG_DRM_PANEL_TPO_TD043MTEA1 is not set -# CONFIG_DRM_PANEL_TPO_TPG110 is not set -# CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA is not set -# CONFIG_DRM_PANEL_VISIONOX_RM69299 is not set -# CONFIG_DRM_PANEL_XINPENG_XPP055C272 is not set -# end of Display Panels - -CONFIG_DRM_BRIDGE=y -CONFIG_DRM_PANEL_BRIDGE=y - -# -# Display Interface Bridges -# -# CONFIG_DRM_CDNS_DSI is not set -# CONFIG_DRM_CHRONTEL_CH7033 is not set -# CONFIG_DRM_DISPLAY_CONNECTOR is not set -# CONFIG_DRM_LONTIUM_LT9611 is not set -# CONFIG_DRM_LVDS_CODEC is not set -# CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW is not set -# CONFIG_DRM_NWL_MIPI_DSI is not set -# CONFIG_DRM_NXP_PTN3460 is not set -# CONFIG_DRM_PARADE_PS8622 is not set -# CONFIG_DRM_PARADE_PS8640 is not set -# CONFIG_DRM_SIL_SII8620 is not set -# CONFIG_DRM_SII902X is not set -# CONFIG_DRM_SII9234 is not set -# CONFIG_DRM_SIMPLE_BRIDGE is not set -# CONFIG_DRM_THINE_THC63LVD1024 is not set -# CONFIG_DRM_TOSHIBA_TC358762 is not set -# CONFIG_DRM_TOSHIBA_TC358764 is not set -# CONFIG_DRM_TOSHIBA_TC358767 is not set -# CONFIG_DRM_TOSHIBA_TC358768 is not set -# CONFIG_DRM_TOSHIBA_TC358775 is not set -# CONFIG_DRM_TI_TFP410 is not set -# CONFIG_DRM_TI_SN65DSI86 is not set -# CONFIG_DRM_TI_TPD12S015 is not set -# CONFIG_DRM_ANALOGIX_ANX6345 is not set -# CONFIG_DRM_ANALOGIX_ANX78XX is not set -# CONFIG_DRM_I2C_ADV7511 is not set -# CONFIG_DRM_CDNS_MHDP8546 is not set -CONFIG_DRM_DW_HDMI=y -CONFIG_DRM_DW_HDMI_CEC=y -CONFIG_DRM_DW_MIPI_DSI=y -# end of Display Interface Bridges - -# CONFIG_DRM_ETNAVIV is not set -# CONFIG_DRM_ARCPGU is not set -# CONFIG_DRM_HISI_HIBMC is not set -# CONFIG_DRM_HISI_KIRIN is not set -# CONFIG_DRM_MXSFB is not set -# CONFIG_DRM_CIRRUS_QEMU is not set -# CONFIG_DRM_GM12U320 is not set -# CONFIG_TINYDRM_HX8357D is not set -# CONFIG_TINYDRM_ILI9225 is not set -# CONFIG_TINYDRM_ILI9341 is not set -# CONFIG_TINYDRM_ILI9486 is not set -# CONFIG_TINYDRM_MI0283QT is not set -# CONFIG_TINYDRM_REPAPER is not set -# CONFIG_TINYDRM_ST7586 is not set -# CONFIG_TINYDRM_ST7735R is not set -# CONFIG_DRM_PL111 is not set -# CONFIG_DRM_LIMA is not set -# CONFIG_DRM_PANFROST is not set -# CONFIG_DRM_TIDSS is not set -# CONFIG_DRM_LEGACY is not set -CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y -CONFIG_MALI_BIFROST=y -CONFIG_MALI_PLATFORM_NAME="rk" -CONFIG_MALI_REAL_HW=y - -# -# Platform specific options -# -# CONFIG_MALI_CSF_SUPPORT is not set -CONFIG_MALI_BIFROST_DEVFREQ=y -CONFIG_MALI_BIFROST_GATOR_SUPPORT=y -# CONFIG_MALI_BIFROST_ENABLE_TRACE is not set -# CONFIG_MALI_BIFROST_DMA_FENCE is not set -# CONFIG_MALI_ARBITER_SUPPORT is not set -# CONFIG_MALI_DMA_BUF_MAP_ON_DEMAND is not set -# CONFIG_MALI_DMA_BUF_LEGACY_COMPAT is not set -# CONFIG_MALI_BIFROST_EXPERT is not set -# CONFIG_MALI_ARBITRATION is not set - -# -# Frame buffer Devices -# -CONFIG_FB_CMDLINE=y -CONFIG_FB_NOTIFY=y -CONFIG_FB=y -# CONFIG_FIRMWARE_EDID is not set -CONFIG_FB_CFB_FILLRECT=y -CONFIG_FB_CFB_COPYAREA=y -CONFIG_FB_CFB_IMAGEBLIT=y -CONFIG_FB_SYS_FILLRECT=y -CONFIG_FB_SYS_COPYAREA=y -CONFIG_FB_SYS_IMAGEBLIT=y -# CONFIG_FB_FOREIGN_ENDIAN is not set -CONFIG_FB_SYS_FOPS=y -CONFIG_FB_DEFERRED_IO=y -# CONFIG_FB_MODE_HELPERS is not set -# CONFIG_FB_TILEBLITTING is not set - -# -# Frame buffer hardware drivers -# -# CONFIG_FB_CIRRUS is not set -# CONFIG_FB_PM2 is not set -# CONFIG_FB_ARMCLCD is not set -# CONFIG_FB_CYBER2000 is not set -# CONFIG_FB_ASILIANT is not set -# CONFIG_FB_IMSTT is not set -# CONFIG_FB_UVESA is not set -# CONFIG_FB_OPENCORES is not set -# CONFIG_FB_S1D13XXX is not set -# CONFIG_FB_NVIDIA is not set -# CONFIG_FB_RIVA is not set -# CONFIG_FB_I740 is not set -# CONFIG_FB_MATROX is not set -# CONFIG_FB_RADEON is not set -# CONFIG_FB_ATY128 is not set -# CONFIG_FB_ATY is not set -# CONFIG_FB_S3 is not set -# CONFIG_FB_SAVAGE is not set -# CONFIG_FB_SIS is not set -# CONFIG_FB_NEOMAGIC is not set -# CONFIG_FB_KYRO is not set -# CONFIG_FB_3DFX is not set -# CONFIG_FB_VOODOO1 is not set -# CONFIG_FB_VT8623 is not set -# CONFIG_FB_TRIDENT is not set -# CONFIG_FB_ARK is not set -# CONFIG_FB_PM3 is not set -# CONFIG_FB_CARMINE is not set -# CONFIG_FB_SMSCUFX is not set -# CONFIG_FB_UDL is not set -# CONFIG_FB_IBM_GXT4500 is not set -# CONFIG_FB_VIRTUAL is not set -# CONFIG_FB_METRONOME is not set -# CONFIG_FB_MB862XX is not set -# CONFIG_FB_SIMPLE is not set -# CONFIG_FB_SSD1307 is not set -# CONFIG_FB_SM712 is not set -# end of Frame buffer Devices - -# -# Backlight & LCD device support -# -# CONFIG_LCD_CLASS_DEVICE is not set -CONFIG_BACKLIGHT_CLASS_DEVICE=y -# CONFIG_BACKLIGHT_KTD253 is not set -CONFIG_BACKLIGHT_PWM=y -# CONFIG_BACKLIGHT_QCOM_WLED is not set -# CONFIG_BACKLIGHT_ADP8860 is not set -# CONFIG_BACKLIGHT_ADP8870 is not set -# CONFIG_BACKLIGHT_LM3630A is not set -# CONFIG_BACKLIGHT_LM3639 is not set -# CONFIG_BACKLIGHT_LP855X is not set -# CONFIG_BACKLIGHT_GPIO is not set -# CONFIG_BACKLIGHT_LV5207LP is not set -# CONFIG_BACKLIGHT_BD6107 is not set -# CONFIG_BACKLIGHT_ARCXCNN is not set -# CONFIG_BACKLIGHT_LED is not set -# end of Backlight & LCD device support - -# -# Rockchip Misc Video driver -# - -# -# RGA -# -# CONFIG_ROCKCHIP_RGA is not set -# end of RGA - -CONFIG_ROCKCHIP_RGA2=y -# CONFIG_ROCKCHIP_RGA2_PROC_FS is not set -CONFIG_ROCKCHIP_RGA2_DEBUG_FS=y -CONFIG_ROCKCHIP_RGA2_DEBUGGER=y -# CONFIG_ROCKCHIP_MULTI_RGA is not set -# CONFIG_ROCKCHIP_RVE is not set - -# -# IEP -# -# CONFIG_IEP is not set -# end of IEP - -CONFIG_ROCKCHIP_MPP_SERVICE=y -CONFIG_ROCKCHIP_MPP_PROC_FS=y -CONFIG_ROCKCHIP_MPP_RKVDEC=y -CONFIG_ROCKCHIP_MPP_RKVDEC2=y -CONFIG_ROCKCHIP_MPP_RKVENC=y -# CONFIG_ROCKCHIP_MPP_RKVENC2 is not set -CONFIG_ROCKCHIP_MPP_VDPU1=y -CONFIG_ROCKCHIP_MPP_VEPU1=y -CONFIG_ROCKCHIP_MPP_VDPU2=y -CONFIG_ROCKCHIP_MPP_VEPU2=y -CONFIG_ROCKCHIP_MPP_IEP2=y -CONFIG_ROCKCHIP_MPP_JPGDEC=y -# CONFIG_ROCKCHIP_MPP_AV1DEC is not set -# CONFIG_ROCKCHIP_DVBM is not set -# end of Rockchip Misc Video driver - -CONFIG_VIDEOMODE_HELPERS=y -CONFIG_HDMI=y - -# -# Console display driver support -# -CONFIG_DUMMY_CONSOLE=y -CONFIG_DUMMY_CONSOLE_COLUMNS=80 -CONFIG_DUMMY_CONSOLE_ROWS=25 -CONFIG_FRAMEBUFFER_CONSOLE=y -# CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION is not set -CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y -# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set -# CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER is not set -# end of Console display driver support - -# CONFIG_LOGO is not set -# end of Graphics support - -# CONFIG_SOUND is not set - -# -# HID support -# -CONFIG_HID=y -CONFIG_HID_BATTERY_STRENGTH=y -CONFIG_HIDRAW=y -CONFIG_UHID=y -CONFIG_HID_GENERIC=y - -# -# Special HID drivers -# -# CONFIG_HID_A4TECH is not set -# CONFIG_HID_ACCUTOUCH is not set -# CONFIG_HID_ACRUX is not set -# CONFIG_HID_APPLE is not set -# CONFIG_HID_APPLEIR is not set -# CONFIG_HID_ASUS is not set -# CONFIG_HID_AUREAL is not set -# CONFIG_HID_BELKIN is not set -# CONFIG_HID_BETOP_FF is not set -# CONFIG_HID_BIGBEN_FF is not set -# CONFIG_HID_CHERRY is not set -# CONFIG_HID_CHICONY is not set -# CONFIG_HID_CORSAIR is not set -# CONFIG_HID_COUGAR is not set -# CONFIG_HID_MACALLY is not set -# CONFIG_HID_CMEDIA is not set -# CONFIG_HID_CP2112 is not set -# CONFIG_HID_CREATIVE_SB0540 is not set -# CONFIG_HID_CYPRESS is not set -# CONFIG_HID_DRAGONRISE is not set -# CONFIG_HID_EMS_FF is not set -# CONFIG_HID_ELAN is not set -# CONFIG_HID_ELECOM is not set -# CONFIG_HID_ELO is not set -# CONFIG_HID_EZKEY is not set -# CONFIG_HID_GEMBIRD is not set -# CONFIG_HID_GFRM is not set -# CONFIG_HID_GLORIOUS is not set -# CONFIG_HID_HOLTEK is not set -# CONFIG_HID_VIVALDI is not set -# CONFIG_HID_GT683R is not set -# CONFIG_HID_KEYTOUCH is not set -# CONFIG_HID_KYE is not set -# CONFIG_HID_UCLOGIC is not set -# CONFIG_HID_WALTOP is not set -# CONFIG_HID_VIEWSONIC is not set -# CONFIG_HID_GYRATION is not set -# CONFIG_HID_ICADE is not set -# CONFIG_HID_ITE is not set -# CONFIG_HID_JABRA is not set -# CONFIG_HID_TWINHAN is not set -CONFIG_HID_KENSINGTON=y -# CONFIG_HID_LCPOWER is not set -# CONFIG_HID_LED is not set -# CONFIG_HID_LENOVO is not set -# CONFIG_HID_LOGITECH is not set -# CONFIG_HID_MAGICMOUSE is not set -# CONFIG_HID_MALTRON is not set -# CONFIG_HID_MAYFLASH is not set -# CONFIG_HID_REDRAGON is not set -# CONFIG_HID_MICROSOFT is not set -# CONFIG_HID_MONTEREY is not set -CONFIG_HID_MULTITOUCH=y -# CONFIG_HID_NTI is not set -# CONFIG_HID_NTRIG is not set -# CONFIG_HID_ORTEK is not set -# CONFIG_HID_PANTHERLORD is not set -# CONFIG_HID_PENMOUNT is not set -# CONFIG_HID_PETALYNX is not set -# CONFIG_HID_PICOLCD is not set -# CONFIG_HID_PLANTRONICS is not set -# CONFIG_HID_PRIMAX is not set -# CONFIG_HID_RETRODE is not set -# CONFIG_HID_ROCCAT is not set -# CONFIG_HID_SAITEK is not set -# CONFIG_HID_SAMSUNG is not set -# CONFIG_HID_SONY is not set -# CONFIG_HID_SPEEDLINK is not set -# CONFIG_HID_STEAM is not set -# CONFIG_HID_STEELSERIES is not set -# CONFIG_HID_SUNPLUS is not set -# CONFIG_HID_RMI is not set -# CONFIG_HID_GREENASIA is not set -# CONFIG_HID_SMARTJOYPLUS is not set -# CONFIG_HID_TIVO is not set -# CONFIG_HID_TOPSEED is not set -# CONFIG_HID_THINGM is not set -# CONFIG_HID_THRUSTMASTER is not set -# CONFIG_HID_UDRAW_PS3 is not set -# CONFIG_HID_U2FZERO is not set -# CONFIG_HID_WACOM is not set -# CONFIG_HID_WIIMOTE is not set -# CONFIG_HID_XINMO is not set -# CONFIG_HID_ZEROPLUS is not set -# CONFIG_HID_ZYDACRON is not set -# CONFIG_HID_SENSOR_HUB is not set -# CONFIG_HID_ALPS is not set -# CONFIG_HID_MCP2221 is not set -# end of Special HID drivers - -# -# USB HID support -# -CONFIG_USB_HID=y -# CONFIG_HID_PID is not set -CONFIG_USB_HIDDEV=y -# end of USB HID support - -# -# I2C HID support -# -CONFIG_I2C_HID=y -# end of I2C HID support -# end of HID support - -CONFIG_USB_OHCI_LITTLE_ENDIAN=y -CONFIG_USB_SUPPORT=y -CONFIG_USB_COMMON=y -# CONFIG_USB_LED_TRIG is not set -# CONFIG_USB_ULPI_BUS is not set -# CONFIG_USB_CONN_GPIO is not set -CONFIG_USB_ARCH_HAS_HCD=y -CONFIG_USB=y -CONFIG_USB_PCI=y -CONFIG_USB_ANNOUNCE_NEW_DEVICES=y - -# -# Miscellaneous USB options -# -# CONFIG_USB_DEFAULT_PERSIST is not set -# CONFIG_USB_FEW_INIT_RETRIES is not set -# CONFIG_USB_DYNAMIC_MINORS is not set -CONFIG_USB_OTG=y -# CONFIG_USB_OTG_PRODUCTLIST is not set -# CONFIG_USB_OTG_DISABLE_EXTERNAL_HUB is not set -# CONFIG_USB_OTG_FSM is not set -# CONFIG_USB_LEDS_TRIGGER_USBPORT is not set -CONFIG_USB_AUTOSUSPEND_DELAY=2 -CONFIG_USB_MON=y - -# -# USB Host Controller Drivers -# -# CONFIG_USB_C67X00_HCD is not set -CONFIG_USB_XHCI_HCD=y -# CONFIG_USB_XHCI_DBGCAP is not set -CONFIG_USB_XHCI_PCI=y -# CONFIG_USB_XHCI_PCI_RENESAS is not set -CONFIG_USB_XHCI_PLATFORM=y -CONFIG_USB_EHCI_HCD=y -CONFIG_USB_EHCI_ROOT_HUB_TT=y -CONFIG_USB_EHCI_TT_NEWSCHED=y -CONFIG_USB_EHCI_PCI=y -# CONFIG_USB_EHCI_FSL is not set -CONFIG_USB_EHCI_HCD_PLATFORM=y -# CONFIG_USB_OXU210HP_HCD is not set -# CONFIG_USB_ISP116X_HCD is not set -# CONFIG_USB_FOTG210_HCD is not set -# CONFIG_USB_MAX3421_HCD is not set -CONFIG_USB_OHCI_HCD=y -# CONFIG_USB_OHCI_HCD_PCI is not set -CONFIG_USB_OHCI_HCD_PLATFORM=y -# CONFIG_USB_UHCI_HCD is not set -# CONFIG_USB_SL811_HCD is not set -# CONFIG_USB_R8A66597_HCD is not set -# CONFIG_USB_HCD_TEST_MODE is not set - -# -# USB Device Class drivers -# -CONFIG_USB_ACM=y -# CONFIG_USB_PRINTER is not set -CONFIG_USB_WDM=y -# CONFIG_USB_TMC is not set - -# -# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may -# - -# -# also be needed; see USB_STORAGE Help for more info -# -CONFIG_USB_STORAGE=y -# CONFIG_USB_STORAGE_DEBUG is not set -# CONFIG_USB_STORAGE_REALTEK is not set -# CONFIG_USB_STORAGE_DATAFAB is not set -# CONFIG_USB_STORAGE_FREECOM is not set -# CONFIG_USB_STORAGE_ISD200 is not set -# CONFIG_USB_STORAGE_USBAT is not set -# CONFIG_USB_STORAGE_SDDR09 is not set -# CONFIG_USB_STORAGE_SDDR55 is not set -# CONFIG_USB_STORAGE_JUMPSHOT is not set -# CONFIG_USB_STORAGE_ALAUDA is not set -# CONFIG_USB_STORAGE_ONETOUCH is not set -# CONFIG_USB_STORAGE_KARMA is not set -# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set -# CONFIG_USB_STORAGE_ENE_UB6250 is not set -CONFIG_USB_UAS=y - -# -# USB Imaging devices -# -# CONFIG_USB_MDC800 is not set -# CONFIG_USB_MICROTEK is not set -# CONFIG_USBIP_CORE is not set -# CONFIG_USB_CDNS3 is not set -# CONFIG_USB_MUSB_HDRC is not set -CONFIG_USB_DWC3=y -# CONFIG_USB_DWC3_HOST is not set -# CONFIG_USB_DWC3_GADGET is not set -CONFIG_USB_DWC3_DUAL_ROLE=y - -# -# Platform Glue Driver Support -# -CONFIG_USB_DWC3_HAPS=y -CONFIG_USB_DWC3_OF_SIMPLE=y -CONFIG_USB_DWC2=y -# CONFIG_USB_DWC2_HOST is not set - -# -# Gadget/Dual-role mode requires USB Gadget support to be enabled -# -# CONFIG_USB_DWC2_PERIPHERAL is not set -CONFIG_USB_DWC2_DUAL_ROLE=y -# CONFIG_USB_DWC2_PCI is not set -# CONFIG_USB_DWC2_DEBUG is not set -# CONFIG_USB_DWC2_TRACK_MISSED_SOFS is not set -# CONFIG_USB_CHIPIDEA is not set -# CONFIG_USB_ISP1760 is not set - -# -# USB port drivers -# -CONFIG_USB_SERIAL=y -# CONFIG_USB_SERIAL_CONSOLE is not set -CONFIG_USB_SERIAL_GENERIC=y -# CONFIG_USB_SERIAL_SIMPLE is not set -# CONFIG_USB_SERIAL_AIRCABLE is not set -# CONFIG_USB_SERIAL_ARK3116 is not set -# CONFIG_USB_SERIAL_BELKIN is not set -# CONFIG_USB_SERIAL_CH341 is not set -# CONFIG_USB_SERIAL_WHITEHEAT is not set -# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set -CONFIG_USB_SERIAL_CP210X=y -# CONFIG_USB_SERIAL_CYPRESS_M8 is not set -# CONFIG_USB_SERIAL_EMPEG is not set -CONFIG_USB_SERIAL_FTDI_SIO=y -# CONFIG_USB_SERIAL_VISOR is not set -# CONFIG_USB_SERIAL_IPAQ is not set -# CONFIG_USB_SERIAL_IR is not set -# CONFIG_USB_SERIAL_EDGEPORT is not set -# CONFIG_USB_SERIAL_EDGEPORT_TI is not set -# CONFIG_USB_SERIAL_F81232 is not set -# CONFIG_USB_SERIAL_F8153X is not set -# CONFIG_USB_SERIAL_GARMIN is not set -# CONFIG_USB_SERIAL_IPW is not set -# CONFIG_USB_SERIAL_IUU is not set -# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set -CONFIG_USB_SERIAL_KEYSPAN=y -# CONFIG_USB_SERIAL_KLSI is not set -# CONFIG_USB_SERIAL_KOBIL_SCT is not set -# CONFIG_USB_SERIAL_MCT_U232 is not set -# CONFIG_USB_SERIAL_METRO is not set -# CONFIG_USB_SERIAL_MOS7720 is not set -# CONFIG_USB_SERIAL_MOS7840 is not set -# CONFIG_USB_SERIAL_MXUPORT is not set -# CONFIG_USB_SERIAL_NAVMAN is not set -CONFIG_USB_SERIAL_PL2303=y -CONFIG_USB_SERIAL_OTI6858=y -# CONFIG_USB_SERIAL_QCAUX is not set -CONFIG_USB_SERIAL_QUALCOMM=y -# CONFIG_USB_SERIAL_SPCP8X5 is not set -# CONFIG_USB_SERIAL_SAFE is not set -CONFIG_USB_SERIAL_SIERRAWIRELESS=y -# CONFIG_USB_SERIAL_SYMBOL is not set -# CONFIG_USB_SERIAL_TI is not set -# CONFIG_USB_SERIAL_CYBERJACK is not set -# CONFIG_USB_SERIAL_XIRCOM is not set -CONFIG_USB_SERIAL_WWAN=y -CONFIG_USB_SERIAL_OPTION=y -# CONFIG_USB_SERIAL_OMNINET is not set -# CONFIG_USB_SERIAL_OPTICON is not set -# CONFIG_USB_SERIAL_XSENS_MT is not set -# CONFIG_USB_SERIAL_WISHBONE is not set -# CONFIG_USB_SERIAL_SSU100 is not set -# CONFIG_USB_SERIAL_QT2 is not set -# CONFIG_USB_SERIAL_UPD78F0730 is not set -# CONFIG_USB_SERIAL_DEBUG is not set - -# -# USB Miscellaneous drivers -# -# CONFIG_USB_EMI62 is not set -# CONFIG_USB_EMI26 is not set -# CONFIG_USB_ADUTUX is not set -# CONFIG_USB_SEVSEG is not set -# CONFIG_USB_LEGOTOWER is not set -# CONFIG_USB_LCD is not set -# CONFIG_USB_CYPRESS_CY7C63 is not set -# CONFIG_USB_CYTHERM is not set -# CONFIG_USB_IDMOUSE is not set -# CONFIG_USB_FTDI_ELAN is not set -# CONFIG_USB_APPLEDISPLAY is not set -# CONFIG_APPLE_MFI_FASTCHARGE is not set -# CONFIG_USB_SISUSBVGA is not set -# CONFIG_USB_LD is not set -# CONFIG_USB_TRANCEVIBRATOR is not set -# CONFIG_USB_IOWARRIOR is not set -# CONFIG_USB_TEST is not set -# CONFIG_USB_EHSET_TEST_FIXTURE is not set -# CONFIG_USB_ISIGHTFW is not set -# CONFIG_USB_YUREX is not set -CONFIG_USB_EZUSB_FX2=y -# CONFIG_USB_HUB_USB251XB is not set -# CONFIG_USB_HSIC_USB3503 is not set -# CONFIG_USB_HSIC_USB4604 is not set -# CONFIG_USB_LINK_LAYER_TEST is not set -# CONFIG_USB_CHAOSKEY is not set - -# -# USB Physical Layer drivers -# -CONFIG_USB_PHY=y -# CONFIG_NOP_USB_XCEIV is not set -# CONFIG_USB_GPIO_VBUS is not set -# CONFIG_USB_ISP1301 is not set -# CONFIG_USB_ULPI is not set -# end of USB Physical Layer drivers - -CONFIG_USB_GADGET=y -# CONFIG_USB_GADGET_DEBUG is not set -CONFIG_USB_GADGET_DEBUG_FILES=y -# CONFIG_USB_GADGET_DEBUG_FS is not set -CONFIG_USB_GADGET_VBUS_DRAW=500 -CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 -# CONFIG_U_SERIAL_CONSOLE is not set - -# -# USB Peripheral Controller -# -# CONFIG_USB_FOTG210_UDC is not set -# CONFIG_USB_GR_UDC is not set -# CONFIG_USB_R8A66597 is not set -# CONFIG_USB_PXA27X is not set -# CONFIG_USB_MV_UDC is not set -# CONFIG_USB_MV_U3D is not set -# CONFIG_USB_SNP_UDC_PLAT is not set -# CONFIG_USB_M66592 is not set -# CONFIG_USB_BDC_UDC is not set -# CONFIG_USB_AMD5536UDC is not set -# CONFIG_USB_NET2272 is not set -# CONFIG_USB_NET2280 is not set -# CONFIG_USB_GOKU is not set -# CONFIG_USB_EG20T is not set -# CONFIG_USB_GADGET_XILINX is not set -# CONFIG_USB_MAX3420_UDC is not set -# CONFIG_USB_DUMMY_HCD is not set -# end of USB Peripheral Controller - -CONFIG_USB_LIBCOMPOSITE=y -CONFIG_USB_F_ACM=y -CONFIG_USB_U_SERIAL=y -CONFIG_USB_F_MASS_STORAGE=y -CONFIG_USB_F_FS=y -CONFIG_USB_F_UVC=y -CONFIG_USB_CONFIGFS=y -# CONFIG_USB_CONFIGFS_SERIAL is not set -CONFIG_USB_CONFIGFS_ACM=y -# CONFIG_USB_CONFIGFS_OBEX is not set -# CONFIG_USB_CONFIGFS_NCM is not set -# CONFIG_USB_CONFIGFS_ECM is not set -# CONFIG_USB_CONFIGFS_ECM_SUBSET is not set -# CONFIG_USB_CONFIGFS_RNDIS is not set -# CONFIG_USB_CONFIGFS_EEM is not set -CONFIG_USB_CONFIGFS_MASS_STORAGE=y -# CONFIG_USB_CONFIGFS_F_LB_SS is not set -CONFIG_USB_CONFIGFS_F_FS=y -# CONFIG_USB_CONFIGFS_F_HID is not set -CONFIG_USB_CONFIGFS_F_UVC=y -# CONFIG_USB_CONFIGFS_F_PRINTER is not set - -# -# USB Gadget precomposed configurations -# -# CONFIG_USB_ZERO is not set -# CONFIG_USB_ETH is not set -# CONFIG_USB_G_NCM is not set -# CONFIG_USB_GADGETFS is not set -# CONFIG_USB_FUNCTIONFS is not set -CONFIG_USB_MASS_STORAGE=m -# CONFIG_USB_G_SERIAL is not set -# CONFIG_USB_G_PRINTER is not set -# CONFIG_USB_CDC_COMPOSITE is not set -# CONFIG_USB_G_ACM_MS is not set -# CONFIG_USB_G_MULTI is not set -# CONFIG_USB_G_HID is not set -# CONFIG_USB_G_DBGP is not set -# CONFIG_USB_G_WEBCAM is not set -# CONFIG_USB_RAW_GADGET is not set -# end of USB Gadget precomposed configurations - -# CONFIG_TYPEC is not set -CONFIG_USB_ROLE_SWITCH=y -CONFIG_MMC=y -CONFIG_PWRSEQ_EMMC=y -# CONFIG_PWRSEQ_SD8787 is not set -CONFIG_PWRSEQ_SIMPLE=y -CONFIG_MMC_BLOCK=y -CONFIG_MMC_BLOCK_MINORS=32 -# CONFIG_SDIO_UART is not set -CONFIG_MMC_TEST=y - -# -# MMC/SD/SDIO Host Controller Drivers -# -# CONFIG_MMC_DEBUG is not set -# CONFIG_MMC_ARMMMCI is not set -CONFIG_MMC_SDHCI=y -# CONFIG_MMC_SDHCI_PCI is not set -CONFIG_MMC_SDHCI_PLTFM=y -CONFIG_MMC_SDHCI_OF_ARASAN=y -# CONFIG_MMC_SDHCI_OF_ASPEED is not set -# CONFIG_MMC_SDHCI_OF_AT91 is not set -CONFIG_MMC_SDHCI_OF_DWCMSHC=y -# CONFIG_MMC_SDHCI_CADENCE is not set -# CONFIG_MMC_SDHCI_F_SDH30 is not set -# CONFIG_MMC_SDHCI_MILBEAUT is not set -# CONFIG_MMC_TIFM_SD is not set -# CONFIG_MMC_SPI is not set -# CONFIG_MMC_CB710 is not set -# CONFIG_MMC_VIA_SDMMC is not set -CONFIG_MMC_DW=y -CONFIG_MMC_DW_PLTFM=y -# CONFIG_MMC_DW_BLUEFIELD is not set -# CONFIG_MMC_DW_EXYNOS is not set -# CONFIG_MMC_DW_HI3798CV200 is not set -# CONFIG_MMC_DW_K3 is not set -# CONFIG_MMC_DW_PCI is not set -CONFIG_MMC_DW_ROCKCHIP=y -# CONFIG_MMC_VUB300 is not set -# CONFIG_MMC_USHC is not set -# CONFIG_MMC_USDHI6ROL0 is not set -CONFIG_MMC_CQHCI=y -# CONFIG_MMC_HSQ is not set -# CONFIG_MMC_TOSHIBA_PCI is not set -# CONFIG_MMC_MTK is not set -# CONFIG_MMC_SDHCI_XENON is not set -# CONFIG_MMC_SDHCI_OMAP is not set -# CONFIG_MMC_SDHCI_AM654 is not set -# CONFIG_MEMSTICK is not set -CONFIG_NEW_LEDS=y -CONFIG_LEDS_CLASS=y -# CONFIG_LEDS_CLASS_FLASH is not set -# CONFIG_LEDS_CLASS_MULTICOLOR is not set -# CONFIG_LEDS_BRIGHTNESS_HW_CHANGED is not set - -# -# LED drivers -# -# CONFIG_LEDS_AN30259A is not set -# CONFIG_LEDS_AW2013 is not set -# CONFIG_LEDS_BCM6328 is not set -# CONFIG_LEDS_BCM6358 is not set -# CONFIG_LEDS_CR0014114 is not set -# CONFIG_LEDS_EL15203000 is not set -# CONFIG_LEDS_LM3530 is not set -# CONFIG_LEDS_LM3532 is not set -# CONFIG_LEDS_LM3642 is not set -# CONFIG_LEDS_LM3692X is not set -# CONFIG_LEDS_PCA9532 is not set -CONFIG_LEDS_GPIO=y -# CONFIG_LEDS_LP3944 is not set -# CONFIG_LEDS_LP3952 is not set -# CONFIG_LEDS_LP50XX is not set -# CONFIG_LEDS_LP55XX_COMMON is not set -# CONFIG_LEDS_LP8860 is not set -# CONFIG_LEDS_PCA955X is not set -# CONFIG_LEDS_PCA963X is not set -# CONFIG_LEDS_DAC124S085 is not set -# CONFIG_LEDS_PWM is not set -# CONFIG_LEDS_REGULATOR is not set -# CONFIG_LEDS_BD2802 is not set -# CONFIG_LEDS_LT3593 is not set -# CONFIG_LEDS_TCA6507 is not set -# CONFIG_LEDS_TLC591XX is not set -# CONFIG_LEDS_LM355x is not set -# CONFIG_LEDS_IS31FL319X is not set -CONFIG_LEDS_IS31FL32XX=y - -# -# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM) -# -# CONFIG_LEDS_BLINKM is not set -# CONFIG_LEDS_SYSCON is not set -# CONFIG_LEDS_MLXREG is not set -# CONFIG_LEDS_USER is not set -# CONFIG_LEDS_SPI_BYTE is not set -# CONFIG_LEDS_TI_LMU_COMMON is not set - -# -# LED Triggers -# -CONFIG_LEDS_TRIGGERS=y -CONFIG_LEDS_TRIGGER_TIMER=y -# CONFIG_LEDS_TRIGGER_ONESHOT is not set -# CONFIG_LEDS_TRIGGER_DISK is not set -# CONFIG_LEDS_TRIGGER_MTD is not set -CONFIG_LEDS_TRIGGER_HEARTBEAT=y -# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set -# CONFIG_LEDS_TRIGGER_CPU is not set -# CONFIG_LEDS_TRIGGER_ACTIVITY is not set -CONFIG_LEDS_TRIGGER_GPIO=y -CONFIG_LEDS_TRIGGER_DEFAULT_ON=y - -# -# iptables trigger is under Netfilter config (LED target) -# -# CONFIG_LEDS_TRIGGER_TRANSIENT is not set -# CONFIG_LEDS_TRIGGER_CAMERA is not set -# CONFIG_LEDS_TRIGGER_PANIC is not set -# CONFIG_LEDS_TRIGGER_NETDEV is not set -# CONFIG_LEDS_TRIGGER_PATTERN is not set -# CONFIG_LEDS_TRIGGER_AUDIO is not set -# CONFIG_ACCESSIBILITY is not set -# CONFIG_INFINIBAND is not set -CONFIG_EDAC_SUPPORT=y -CONFIG_RTC_LIB=y -CONFIG_RTC_CLASS=y -CONFIG_RTC_HCTOSYS=y -CONFIG_RTC_HCTOSYS_DEVICE="rtc0" -CONFIG_RTC_SYSTOHC=y -CONFIG_RTC_SYSTOHC_DEVICE="rtc0" -# CONFIG_RTC_DEBUG is not set -CONFIG_RTC_NVMEM=y - -# -# RTC interfaces -# -CONFIG_RTC_INTF_SYSFS=y -CONFIG_RTC_INTF_PROC=y -CONFIG_RTC_INTF_DEV=y -# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set -# CONFIG_RTC_DRV_TEST is not set - -# -# I2C RTC drivers -# -# CONFIG_RTC_DRV_ABB5ZES3 is not set -# CONFIG_RTC_DRV_ABEOZ9 is not set -# CONFIG_RTC_DRV_ABX80X is not set -# CONFIG_RTC_DRV_DS1307 is not set -# CONFIG_RTC_DRV_DS1374 is not set -# CONFIG_RTC_DRV_DS1672 is not set -# CONFIG_RTC_DRV_HYM8563 is not set -# CONFIG_RTC_DRV_MAX6900 is not set -# CONFIG_RTC_DRV_RK808 is not set -# CONFIG_RTC_DRV_RS5C372 is not set -# CONFIG_RTC_DRV_ISL1208 is not set -# CONFIG_RTC_DRV_ISL12022 is not set -# CONFIG_RTC_DRV_ISL12026 is not set -# CONFIG_RTC_DRV_X1205 is not set -# CONFIG_RTC_DRV_PCF8523 is not set -# CONFIG_RTC_DRV_PCF85063 is not set -# CONFIG_RTC_DRV_PCF85363 is not set -CONFIG_RTC_DRV_PCF8563=y -# CONFIG_RTC_DRV_PCF8583 is not set -# CONFIG_RTC_DRV_M41T80 is not set -# CONFIG_RTC_DRV_BQ32K is not set -# CONFIG_RTC_DRV_TPS6586X is not set -# CONFIG_RTC_DRV_S35390A is not set -# CONFIG_RTC_DRV_FM3130 is not set -# CONFIG_RTC_DRV_RX8010 is not set -# CONFIG_RTC_DRV_RX8581 is not set -# CONFIG_RTC_DRV_RX8025 is not set -# CONFIG_RTC_DRV_EM3027 is not set -# CONFIG_RTC_DRV_RV3028 is not set -# CONFIG_RTC_DRV_RV3032 is not set -# CONFIG_RTC_DRV_RV8803 is not set -# CONFIG_RTC_DRV_SD3078 is not set - -# -# SPI RTC drivers -# -# CONFIG_RTC_DRV_M41T93 is not set -# CONFIG_RTC_DRV_M41T94 is not set -# CONFIG_RTC_DRV_DS1302 is not set -# CONFIG_RTC_DRV_DS1305 is not set -# CONFIG_RTC_DRV_DS1343 is not set -# CONFIG_RTC_DRV_DS1347 is not set -# CONFIG_RTC_DRV_DS1390 is not set -# CONFIG_RTC_DRV_MAX6916 is not set -# CONFIG_RTC_DRV_R9701 is not set -# CONFIG_RTC_DRV_RX4581 is not set -# CONFIG_RTC_DRV_RX6110 is not set -# CONFIG_RTC_DRV_RS5C348 is not set -# CONFIG_RTC_DRV_MAX6902 is not set -# CONFIG_RTC_DRV_PCF2123 is not set -# CONFIG_RTC_DRV_MCP795 is not set -CONFIG_RTC_I2C_AND_SPI=y - -# -# SPI and I2C RTC drivers -# -# CONFIG_RTC_DRV_DS3232 is not set -# CONFIG_RTC_DRV_PCF2127 is not set -# CONFIG_RTC_DRV_RV3029C2 is not set - -# -# Platform RTC drivers -# -# CONFIG_RTC_DRV_DS1286 is not set -# CONFIG_RTC_DRV_DS1511 is not set -# CONFIG_RTC_DRV_DS1553 is not set -# CONFIG_RTC_DRV_DS1685_FAMILY is not set -# CONFIG_RTC_DRV_DS1742 is not set -# CONFIG_RTC_DRV_DS2404 is not set -# CONFIG_RTC_DRV_STK17TA8 is not set -# CONFIG_RTC_DRV_M48T86 is not set -# CONFIG_RTC_DRV_M48T35 is not set -# CONFIG_RTC_DRV_M48T59 is not set -# CONFIG_RTC_DRV_MSM6242 is not set -# CONFIG_RTC_DRV_BQ4802 is not set -# CONFIG_RTC_DRV_RP5C01 is not set -# CONFIG_RTC_DRV_V3020 is not set -# CONFIG_RTC_DRV_ZYNQMP is not set - -# -# on-CPU RTC drivers -# -# CONFIG_RTC_DRV_PL030 is not set -# CONFIG_RTC_DRV_PL031 is not set -# CONFIG_RTC_DRV_CADENCE is not set -# CONFIG_RTC_DRV_FTRTC010 is not set -# CONFIG_RTC_DRV_R7301 is not set - -# -# HID Sensor RTC drivers -# -CONFIG_DMADEVICES=y -# CONFIG_DMADEVICES_DEBUG is not set - -# -# DMA Devices -# -CONFIG_DMA_ENGINE=y -CONFIG_DMA_OF=y -# CONFIG_ALTERA_MSGDMA is not set -# CONFIG_AMBA_PL08X is not set -# CONFIG_DW_AXI_DMAC is not set -# CONFIG_FSL_EDMA is not set -# CONFIG_FSL_QDMA is not set -# CONFIG_HISI_DMA is not set -# CONFIG_INTEL_IDMA64 is not set -# CONFIG_MV_XOR_V2 is not set -CONFIG_PL330_DMA=y -# CONFIG_PLX_DMA is not set -# CONFIG_XILINX_DMA is not set -# CONFIG_XILINX_ZYNQMP_DMA is not set -# CONFIG_XILINX_ZYNQMP_DPDMA is not set -# CONFIG_QCOM_HIDMA_MGMT is not set -# CONFIG_QCOM_HIDMA is not set -# CONFIG_DW_DMAC is not set -# CONFIG_DW_DMAC_PCI is not set -# CONFIG_DW_EDMA is not set -# CONFIG_DW_EDMA_PCIE is not set -# CONFIG_SF_PDMA is not set - -# -# DMA Clients -# -# CONFIG_ASYNC_TX_DMA is not set -# CONFIG_DMATEST is not set - -# -# DMABUF options -# -CONFIG_SYNC_FILE=y -# CONFIG_SW_SYNC is not set -# CONFIG_UDMABUF is not set -# CONFIG_DMABUF_MOVE_NOTIFY is not set -# CONFIG_DMABUF_SELFTESTS is not set -# CONFIG_DMABUF_HEAPS is not set -# end of DMABUF options - -# CONFIG_AUXDISPLAY is not set -# CONFIG_UIO is not set -# CONFIG_VFIO is not set -# CONFIG_VIRT_DRIVERS is not set -CONFIG_VIRTIO_MENU=y -# CONFIG_VIRTIO_PCI is not set -# CONFIG_VIRTIO_MMIO is not set -# CONFIG_VDPA is not set -CONFIG_VHOST_MENU=y -# CONFIG_VHOST_NET is not set -# CONFIG_VHOST_CROSS_ENDIAN_LEGACY is not set - -# -# Microsoft Hyper-V guest support -# -# end of Microsoft Hyper-V guest support - -# CONFIG_GREYBUS is not set -CONFIG_STAGING=y -# CONFIG_PRISM2_USB is not set -# CONFIG_COMEDI is not set -# CONFIG_RTL8192U is not set -# CONFIG_RTLLIB is not set -# CONFIG_RTL8723BS is not set -# CONFIG_R8712U is not set -# CONFIG_R8188EU is not set -# CONFIG_RTS5208 is not set -# CONFIG_VT6655 is not set -# CONFIG_VT6656 is not set - -# -# IIO staging drivers -# - -# -# Accelerometers -# -# CONFIG_ADIS16203 is not set -# CONFIG_ADIS16240 is not set -# end of Accelerometers - -# -# Analog to digital converters -# -# CONFIG_AD7816 is not set -# CONFIG_AD7280 is not set -# end of Analog to digital converters - -# -# Analog digital bi-direction converters -# -# CONFIG_ADT7316 is not set -# end of Analog digital bi-direction converters - -# -# Capacitance to digital converters -# -# CONFIG_AD7150 is not set -# CONFIG_AD7746 is not set -# end of Capacitance to digital converters - -# -# Direct Digital Synthesis -# -# CONFIG_AD9832 is not set -# CONFIG_AD9834 is not set -# end of Direct Digital Synthesis - -# -# Network Analyzer, Impedance Converters -# -# CONFIG_AD5933 is not set -# end of Network Analyzer, Impedance Converters - -# -# Active energy metering IC -# -# CONFIG_ADE7854 is not set -# end of Active energy metering IC - -# -# Resolver to digital converters -# -# CONFIG_AD2S1210 is not set -# end of Resolver to digital converters -# end of IIO staging drivers - -# CONFIG_FB_SM750 is not set -# CONFIG_STAGING_MEDIA is not set - -# -# Android -# -# CONFIG_ASHMEM is not set -# CONFIG_DEBUG_KINFO is not set -# CONFIG_ION is not set -CONFIG_FIQ_DEBUGGER=y -CONFIG_FIQ_DEBUGGER_NO_SLEEP=y -# CONFIG_FIQ_DEBUGGER_WAKEUP_IRQ_ALWAYS_ON is not set -CONFIG_FIQ_DEBUGGER_CONSOLE=y -CONFIG_FIQ_DEBUGGER_CONSOLE_DEFAULT_ENABLE=y -CONFIG_FIQ_DEBUGGER_TRUST_ZONE=y -# CONFIG_FIQ_DEBUGGER_UART_OVERLAY is not set -CONFIG_RK_CONSOLE_THREAD=y -# end of Android - -# CONFIG_STAGING_BOARD is not set -# CONFIG_LTE_GDM724X is not set -# CONFIG_GS_FPGABOOT is not set -# CONFIG_UNISYSSPAR is not set -# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set -# CONFIG_FB_TFT is not set -# CONFIG_KS7010 is not set -# CONFIG_PI433 is not set - -# -# Gasket devices -# -# CONFIG_STAGING_GASKET_FRAMEWORK is not set -# end of Gasket devices - -# CONFIG_XIL_AXIS_FIFO is not set -# CONFIG_FIELDBUS_DEV is not set -# CONFIG_QLGE is not set -# CONFIG_WFX is not set -# CONFIG_GOLDFISH is not set -# CONFIG_CHROME_PLATFORMS is not set -# CONFIG_MELLANOX_PLATFORM is not set -CONFIG_HAVE_CLK=y -CONFIG_CLKDEV_LOOKUP=y -CONFIG_HAVE_CLK_PREPARE=y -CONFIG_COMMON_CLK=y -# CONFIG_COMMON_CLK_MAX9485 is not set -CONFIG_COMMON_CLK_RK808=y -CONFIG_COMMON_CLK_SCMI=y -# CONFIG_COMMON_CLK_SI5341 is not set -# CONFIG_COMMON_CLK_SI5351 is not set -# CONFIG_COMMON_CLK_SI514 is not set -# CONFIG_COMMON_CLK_SI544 is not set -# CONFIG_COMMON_CLK_SI570 is not set -# CONFIG_COMMON_CLK_CDCE706 is not set -# CONFIG_COMMON_CLK_CDCE925 is not set -# CONFIG_COMMON_CLK_CS2000_CP is not set -# CONFIG_CLK_QORIQ is not set -# CONFIG_COMMON_CLK_XGENE is not set -# CONFIG_COMMON_CLK_PWM is not set -# CONFIG_COMMON_CLK_VC5 is not set -# CONFIG_COMMON_CLK_FIXED_MMIO is not set -CONFIG_COMMON_CLK_ROCKCHIP=y -CONFIG_CLK_PX30=y -CONFIG_CLK_RK1808=y -CONFIG_CLK_RK3328=y -CONFIG_CLK_RK3399=y -CONFIG_CLK_RK3568=y -# CONFIG_ROCKCHIP_CLK_COMPENSATION is not set -# CONFIG_ROCKCHIP_CLK_LINK is not set -CONFIG_ROCKCHIP_CLK_BOOST=y -CONFIG_ROCKCHIP_CLK_INV=y -CONFIG_ROCKCHIP_CLK_PVTM=y -CONFIG_ROCKCHIP_DDRCLK=y -# CONFIG_ROCKCHIP_DDRCLK_SCPI is not set -CONFIG_ROCKCHIP_DDRCLK_SIP=y -CONFIG_ROCKCHIP_DDRCLK_SIP_V2=y -# CONFIG_ROCKCHIP_PLL_RK3066 is not set -CONFIG_ROCKCHIP_PLL_RK3399=y -# CONFIG_ROCKCHIP_PLL_RK3588 is not set -# CONFIG_HWSPINLOCK is not set - -# -# Clock Source drivers -# -CONFIG_TIMER_OF=y -CONFIG_TIMER_PROBE=y -CONFIG_CLKSRC_MMIO=y -CONFIG_ROCKCHIP_TIMER=y -CONFIG_ARM_ARCH_TIMER=y -CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y -CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND=y -CONFIG_FSL_ERRATUM_A008585=y -CONFIG_HISILICON_ERRATUM_161010101=y -CONFIG_ARM64_ERRATUM_858921=y -# CONFIG_MICROCHIP_PIT64B is not set -# end of Clock Source drivers - -CONFIG_MAILBOX=y -# CONFIG_ARM_MHU is not set -# CONFIG_PLATFORM_MHU is not set -# CONFIG_PL320_MBOX is not set -# CONFIG_ROCKCHIP_MBOX is not set -# CONFIG_ALTERA_MBOX is not set -# CONFIG_MAILBOX_TEST is not set -CONFIG_IOMMU_IOVA=y -CONFIG_IOMMU_API=y -CONFIG_IOMMU_SUPPORT=y - -# -# Generic IOMMU Pagetable Support -# -# CONFIG_IOMMU_IO_PGTABLE_LPAE is not set -# CONFIG_IOMMU_IO_PGTABLE_ARMV7S is not set -# end of Generic IOMMU Pagetable Support - -# CONFIG_IOMMU_DEBUGFS is not set -# CONFIG_IOMMU_DEFAULT_PASSTHROUGH is not set -CONFIG_OF_IOMMU=y -CONFIG_IOMMU_DMA=y -CONFIG_ROCKCHIP_IOMMU=y -# CONFIG_ARM_SMMU is not set -# CONFIG_ARM_SMMU_V3 is not set - -# -# Remoteproc drivers -# -# CONFIG_REMOTEPROC is not set -# end of Remoteproc drivers - -# -# Rpmsg drivers -# -# CONFIG_RPMSG_QCOM_GLINK_RPM is not set -# CONFIG_RPMSG_VIRTIO is not set -# end of Rpmsg drivers - -# CONFIG_SOUNDWIRE is not set - -# -# SOC (System On Chip) specific Drivers -# - -# -# Amlogic SoC drivers -# -# end of Amlogic SoC drivers - -# -# Aspeed SoC drivers -# -# end of Aspeed SoC drivers - -# -# Broadcom SoC drivers -# -# CONFIG_SOC_BRCMSTB is not set -# end of Broadcom SoC drivers - -# -# NXP/Freescale QorIQ SoC drivers -# -# CONFIG_QUICC_ENGINE is not set -# CONFIG_FSL_RCPM is not set -# end of NXP/Freescale QorIQ SoC drivers - -# -# i.MX SoC drivers -# -# end of i.MX SoC drivers - -# -# Qualcomm SoC drivers -# -# end of Qualcomm SoC drivers - -# -# Rockchip CPU selection -# -CONFIG_CPU_PX30=y -CONFIG_CPU_RK1808=y -# CONFIG_CPU_RK3308 is not set -CONFIG_CPU_RK3328=y -# CONFIG_CPU_RK3368 is not set -CONFIG_CPU_RK3399=y -CONFIG_CPU_RK3568=y -# CONFIG_CPU_RK3588 is not set -# end of Rockchip CPU selection - -CONFIG_NO_GKI=y -# CONFIG_ROCKCHIP_CPUINFO is not set -# CONFIG_ROCKCHIP_GRF is not set -# CONFIG_ROCKCHIP_HW_DECOMPRESS is not set -CONFIG_ROCKCHIP_IODOMAIN=y -# CONFIG_ROCKCHIP_IOMUX is not set -# CONFIG_ROCKCHIP_IPA is not set -# CONFIG_ROCKCHIP_OPP is not set -# CONFIG_ROCKCHIP_PERFORMANCE is not set -CONFIG_ROCKCHIP_PM_DOMAINS=y -CONFIG_ROCKCHIP_PVTM=y -# CONFIG_ROCKCHIP_RAMDISK is not set -CONFIG_ROCKCHIP_SUSPEND_MODE=y -# CONFIG_ROCKCHIP_SYSTEM_MONITOR is not set -CONFIG_ROCKCHIP_VENDOR_STORAGE=y -CONFIG_ROCKCHIP_MMC_VENDOR_STORAGE=y -CONFIG_ROCKCHIP_MTD_VENDOR_STORAGE=y -CONFIG_ROCKCHIP_VENDOR_STORAGE_UPDATE_LOADER=y -CONFIG_ROCKCHIP_FIQ_DEBUGGER=y -# CONFIG_ROCKCHIP_DEBUG is not set -# CONFIG_ROCKCHIP_MINI_KERNEL is not set -# CONFIG_ROCKCHIP_THUNDER_BOOT is not set -# CONFIG_ROCKCHIP_NPOR_POWERGOOD is not set -# CONFIG_RK_CMA_PROCFS is not set -# CONFIG_RK_DMABUF_PROCFS is not set -# CONFIG_RK_MEMBLOCK_PROCFS is not set -# CONFIG_SOC_TI is not set - -# -# Xilinx SoC drivers -# -# CONFIG_XILINX_VCU is not set -# end of Xilinx SoC drivers -# end of SOC (System On Chip) specific Drivers - -CONFIG_PM_DEVFREQ=y - -# -# DEVFREQ Governors -# -CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y -CONFIG_DEVFREQ_GOV_PERFORMANCE=y -CONFIG_DEVFREQ_GOV_POWERSAVE=y -CONFIG_DEVFREQ_GOV_USERSPACE=y -# CONFIG_DEVFREQ_GOV_PASSIVE is not set - -# -# DEVFREQ Drivers -# -# CONFIG_ARM_RK3399_DMC_DEVFREQ is not set -# CONFIG_PM_DEVFREQ_EVENT is not set -CONFIG_EXTCON=y - -# -# Extcon Device Drivers -# -# CONFIG_EXTCON_ADC_JACK is not set -# CONFIG_EXTCON_FSA9480 is not set -# CONFIG_EXTCON_GPIO is not set -# CONFIG_EXTCON_MAX3355 is not set -# CONFIG_EXTCON_PTN5150 is not set -# CONFIG_EXTCON_RT8973A is not set -# CONFIG_EXTCON_SM5502 is not set -# CONFIG_EXTCON_USB_GPIO is not set -CONFIG_MEMORY=y -# CONFIG_ARM_PL172_MPMC is not set -CONFIG_IIO=y -CONFIG_IIO_BUFFER=y -# CONFIG_IIO_BUFFER_CB is not set -# CONFIG_IIO_BUFFER_DMA is not set -# CONFIG_IIO_BUFFER_DMAENGINE is not set -# CONFIG_IIO_BUFFER_HW_CONSUMER is not set -CONFIG_IIO_KFIFO_BUF=y -CONFIG_IIO_TRIGGERED_BUFFER=y -# CONFIG_IIO_CONFIGFS is not set -CONFIG_IIO_TRIGGER=y -CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 -# CONFIG_IIO_SW_DEVICE is not set -# CONFIG_IIO_SW_TRIGGER is not set -# CONFIG_IIO_TRIGGERED_EVENT is not set - -# -# Accelerometers -# -# CONFIG_ADIS16201 is not set -# CONFIG_ADIS16209 is not set -# CONFIG_ADXL345_I2C is not set -# CONFIG_ADXL345_SPI is not set -# CONFIG_ADXL372_SPI is not set -# CONFIG_ADXL372_I2C is not set -# CONFIG_BMA180 is not set -# CONFIG_BMA220 is not set -# CONFIG_BMA400 is not set -# CONFIG_BMC150_ACCEL is not set -# CONFIG_DA280 is not set -# CONFIG_DA311 is not set -# CONFIG_DMARD06 is not set -# CONFIG_DMARD09 is not set -# CONFIG_DMARD10 is not set -# CONFIG_IIO_ST_ACCEL_3AXIS is not set -# CONFIG_KXSD9 is not set -# CONFIG_KXCJK1013 is not set -# CONFIG_MC3230 is not set -# CONFIG_MMA7455_I2C is not set -# CONFIG_MMA7455_SPI is not set -# CONFIG_MMA7660 is not set -# CONFIG_MMA8452 is not set -# CONFIG_MMA9551 is not set -# CONFIG_MMA9553 is not set -# CONFIG_MXC4005 is not set -# CONFIG_MXC6255 is not set -# CONFIG_SCA3000 is not set -# CONFIG_STK8312 is not set -# CONFIG_STK8BA50 is not set -# end of Accelerometers - -# -# Analog to digital converters -# -# CONFIG_AD7091R5 is not set -# CONFIG_AD7124 is not set -# CONFIG_AD7192 is not set -# CONFIG_AD7266 is not set -# CONFIG_AD7291 is not set -# CONFIG_AD7292 is not set -# CONFIG_AD7298 is not set -# CONFIG_AD7476 is not set -# CONFIG_AD7606_IFACE_PARALLEL is not set -# CONFIG_AD7606_IFACE_SPI is not set -# CONFIG_AD7766 is not set -# CONFIG_AD7768_1 is not set -# CONFIG_AD7780 is not set -# CONFIG_AD7791 is not set -# CONFIG_AD7793 is not set -# CONFIG_AD7887 is not set -# CONFIG_AD7923 is not set -# CONFIG_AD7949 is not set -# CONFIG_AD799X is not set -# CONFIG_ADI_AXI_ADC is not set -# CONFIG_CC10001_ADC is not set -# CONFIG_ENVELOPE_DETECTOR is not set -# CONFIG_HI8435 is not set -# CONFIG_HX711 is not set -# CONFIG_INA2XX_ADC is not set -# CONFIG_LTC2471 is not set -# CONFIG_LTC2485 is not set -# CONFIG_LTC2496 is not set -# CONFIG_LTC2497 is not set -# CONFIG_MAX1027 is not set -# CONFIG_MAX11100 is not set -# CONFIG_MAX1118 is not set -# CONFIG_MAX1241 is not set -# CONFIG_MAX1363 is not set -# CONFIG_MAX9611 is not set -# CONFIG_MCP320X is not set -# CONFIG_MCP3422 is not set -# CONFIG_MCP3911 is not set -# CONFIG_NAU7802 is not set -CONFIG_ROCKCHIP_SARADC=y -# CONFIG_SD_ADC_MODULATOR is not set -# CONFIG_TI_ADC081C is not set -# CONFIG_TI_ADC0832 is not set -# CONFIG_TI_ADC084S021 is not set -# CONFIG_TI_ADC12138 is not set -# CONFIG_TI_ADC108S102 is not set -# CONFIG_TI_ADC128S052 is not set -# CONFIG_TI_ADC161S626 is not set -# CONFIG_TI_ADS1015 is not set -# CONFIG_TI_ADS7950 is not set -# CONFIG_TI_ADS8344 is not set -# CONFIG_TI_ADS8688 is not set -# CONFIG_TI_ADS124S08 is not set -# CONFIG_TI_TLC4541 is not set -# CONFIG_VF610_ADC is not set -# CONFIG_XILINX_XADC is not set -# end of Analog to digital converters - -# -# Analog Front Ends -# -# CONFIG_IIO_RESCALE is not set -# end of Analog Front Ends - -# -# Amplifiers -# -# CONFIG_AD8366 is not set -# CONFIG_HMC425 is not set -# end of Amplifiers - -# -# Chemical Sensors -# -# CONFIG_ATLAS_PH_SENSOR is not set -# CONFIG_ATLAS_EZO_SENSOR is not set -# CONFIG_BME680 is not set -# CONFIG_CCS811 is not set -# CONFIG_IAQCORE is not set -# CONFIG_SCD30_CORE is not set -# CONFIG_SENSIRION_SGP30 is not set -# CONFIG_SPS30 is not set -# CONFIG_VZ89X is not set -# end of Chemical Sensors - -# -# Hid Sensor IIO Common -# -# end of Hid Sensor IIO Common - -# -# SSP Sensor Common -# -# CONFIG_IIO_SSP_SENSORHUB is not set -# end of SSP Sensor Common - -# -# Digital to analog converters -# -# CONFIG_AD5064 is not set -# CONFIG_AD5360 is not set -# CONFIG_AD5380 is not set -# CONFIG_AD5421 is not set -# CONFIG_AD5446 is not set -# CONFIG_AD5449 is not set -# CONFIG_AD5592R is not set -# CONFIG_AD5593R is not set -# CONFIG_AD5504 is not set -# CONFIG_AD5624R_SPI is not set -# CONFIG_AD5686_SPI is not set -# CONFIG_AD5696_I2C is not set -# CONFIG_AD5755 is not set -# CONFIG_AD5758 is not set -# CONFIG_AD5761 is not set -# CONFIG_AD5764 is not set -# CONFIG_AD5770R is not set -# CONFIG_AD5791 is not set -# CONFIG_AD7303 is not set -# CONFIG_AD8801 is not set -# CONFIG_DPOT_DAC is not set -# CONFIG_DS4424 is not set -# CONFIG_LTC1660 is not set -# CONFIG_LTC2632 is not set -# CONFIG_M62332 is not set -# CONFIG_MAX517 is not set -# CONFIG_MAX5821 is not set -# CONFIG_MCP4725 is not set -# CONFIG_MCP4922 is not set -# CONFIG_TI_DAC082S085 is not set -# CONFIG_TI_DAC5571 is not set -# CONFIG_TI_DAC7311 is not set -# CONFIG_TI_DAC7612 is not set -# CONFIG_VF610_DAC is not set -# end of Digital to analog converters - -# -# IIO dummy driver -# -# end of IIO dummy driver - -# -# Frequency Synthesizers DDS/PLL -# - -# -# Clock Generator/Distribution -# -# CONFIG_AD9523 is not set -# end of Clock Generator/Distribution - -# -# Phase-Locked Loop (PLL) frequency synthesizers -# -# CONFIG_ADF4350 is not set -# CONFIG_ADF4371 is not set -# end of Phase-Locked Loop (PLL) frequency synthesizers -# end of Frequency Synthesizers DDS/PLL - -# -# Digital gyroscope sensors -# -# CONFIG_ADIS16080 is not set -# CONFIG_ADIS16130 is not set -# CONFIG_ADIS16136 is not set -# CONFIG_ADIS16260 is not set -# CONFIG_ADXRS290 is not set -# CONFIG_ADXRS450 is not set -# CONFIG_BMG160 is not set -# CONFIG_FXAS21002C is not set -# CONFIG_MPU3050_I2C is not set -# CONFIG_IIO_ST_GYRO_3AXIS is not set -# CONFIG_ITG3200 is not set -# end of Digital gyroscope sensors - -# -# Health Sensors -# - -# -# Heart Rate Monitors -# -# CONFIG_AFE4403 is not set -# CONFIG_AFE4404 is not set -# CONFIG_MAX30100 is not set -# CONFIG_MAX30102 is not set -# end of Heart Rate Monitors -# end of Health Sensors - -# -# Humidity sensors -# -# CONFIG_AM2315 is not set -# CONFIG_DHT11 is not set -# CONFIG_HDC100X is not set -# CONFIG_HDC2010 is not set -# CONFIG_HTS221 is not set -# CONFIG_HTU21 is not set -# CONFIG_SI7005 is not set -# CONFIG_SI7020 is not set -# end of Humidity sensors - -# -# Inertial measurement units -# -# CONFIG_ADIS16400 is not set -# CONFIG_ADIS16460 is not set -# CONFIG_ADIS16475 is not set -# CONFIG_ADIS16480 is not set -# CONFIG_BMI160_I2C is not set -# CONFIG_BMI160_SPI is not set -# CONFIG_FXOS8700_I2C is not set -# CONFIG_FXOS8700_SPI is not set -# CONFIG_KMX61 is not set -# CONFIG_INV_ICM42600_I2C is not set -# CONFIG_INV_ICM42600_SPI is not set -# CONFIG_INV_MPU6050_I2C is not set -# CONFIG_INV_MPU6050_SPI is not set -# CONFIG_IIO_ST_LSM6DSX is not set -# end of Inertial measurement units - -# -# Light sensors -# -# CONFIG_ADJD_S311 is not set -# CONFIG_ADUX1020 is not set -# CONFIG_AL3010 is not set -# CONFIG_AL3320A is not set -# CONFIG_APDS9300 is not set -# CONFIG_APDS9960 is not set -# CONFIG_AS73211 is not set -# CONFIG_BH1750 is not set -# CONFIG_BH1780 is not set -# CONFIG_CM32181 is not set -# CONFIG_CM3232 is not set -# CONFIG_CM3323 is not set -# CONFIG_CM3605 is not set -# CONFIG_CM36651 is not set -# CONFIG_GP2AP002 is not set -# CONFIG_GP2AP020A00F is not set -CONFIG_SENSORS_ISL29018=y -# CONFIG_SENSORS_ISL29028 is not set -# CONFIG_ISL29125 is not set -# CONFIG_JSA1212 is not set -# CONFIG_RPR0521 is not set -# CONFIG_LTR501 is not set -# CONFIG_LV0104CS is not set -# CONFIG_MAX44000 is not set -# CONFIG_MAX44009 is not set -# CONFIG_NOA1305 is not set -# CONFIG_OPT3001 is not set -# CONFIG_PA12203001 is not set -# CONFIG_SI1133 is not set -# CONFIG_SI1145 is not set -# CONFIG_STK3310 is not set -# CONFIG_ST_UVIS25 is not set -# CONFIG_TCS3414 is not set -# CONFIG_TCS3472 is not set -CONFIG_SENSORS_TSL2563=y -CONFIG_TSL2583=y -# CONFIG_TSL2772 is not set -# CONFIG_TSL4531 is not set -# CONFIG_US5182D is not set -# CONFIG_VCNL4000 is not set -# CONFIG_VCNL4035 is not set -# CONFIG_VEML6030 is not set -# CONFIG_VEML6070 is not set -# CONFIG_VL6180 is not set -# CONFIG_ZOPT2201 is not set -# end of Light sensors - -# -# Magnetometer sensors -# -# CONFIG_AK8974 is not set -# CONFIG_AK8975 is not set -# CONFIG_AK09911 is not set -# CONFIG_BMC150_MAGN_I2C is not set -# CONFIG_BMC150_MAGN_SPI is not set -# CONFIG_MAG3110 is not set -# CONFIG_MMC35240 is not set -# CONFIG_IIO_ST_MAGN_3AXIS is not set -# CONFIG_SENSORS_HMC5843_I2C is not set -# CONFIG_SENSORS_HMC5843_SPI is not set -# CONFIG_SENSORS_RM3100_I2C is not set -# CONFIG_SENSORS_RM3100_SPI is not set -# end of Magnetometer sensors - -# -# Multiplexers -# -# CONFIG_IIO_MUX is not set -# end of Multiplexers - -# -# Inclinometer sensors -# -# end of Inclinometer sensors - -# -# Triggers - standalone -# -# CONFIG_IIO_INTERRUPT_TRIGGER is not set -CONFIG_IIO_SYSFS_TRIGGER=y -# end of Triggers - standalone - -# -# Linear and angular position sensors -# -# end of Linear and angular position sensors - -# -# Digital potentiometers -# -# CONFIG_AD5272 is not set -# CONFIG_DS1803 is not set -# CONFIG_MAX5432 is not set -# CONFIG_MAX5481 is not set -# CONFIG_MAX5487 is not set -# CONFIG_MCP4018 is not set -# CONFIG_MCP4131 is not set -# CONFIG_MCP4531 is not set -# CONFIG_MCP41010 is not set -# CONFIG_TPL0102 is not set -# end of Digital potentiometers - -# -# Digital potentiostats -# -# CONFIG_LMP91000 is not set -# end of Digital potentiostats - -# -# Pressure sensors -# -# CONFIG_ABP060MG is not set -# CONFIG_BMP280 is not set -# CONFIG_DLHL60D is not set -# CONFIG_DPS310 is not set -# CONFIG_HP03 is not set -# CONFIG_ICP10100 is not set -# CONFIG_MPL115_I2C is not set -# CONFIG_MPL115_SPI is not set -# CONFIG_MPL3115 is not set -# CONFIG_MS5611 is not set -# CONFIG_MS5637 is not set -# CONFIG_IIO_ST_PRESS is not set -# CONFIG_T5403 is not set -# CONFIG_HP206C is not set -# CONFIG_ZPA2326 is not set -# end of Pressure sensors - -# -# Lightning sensors -# -# CONFIG_AS3935 is not set -# end of Lightning sensors - -# -# Proximity and distance sensors -# -# CONFIG_ISL29501 is not set -# CONFIG_LIDAR_LITE_V2 is not set -# CONFIG_MB1232 is not set -# CONFIG_PING is not set -# CONFIG_RFD77402 is not set -# CONFIG_SRF04 is not set -# CONFIG_SX9310 is not set -# CONFIG_SX9500 is not set -# CONFIG_SRF08 is not set -# CONFIG_VCNL3020 is not set -# CONFIG_VL53L0X_I2C is not set -# end of Proximity and distance sensors - -# -# Resolver to digital converters -# -# CONFIG_AD2S90 is not set -# CONFIG_AD2S1200 is not set -# end of Resolver to digital converters - -# -# Temperature sensors -# -# CONFIG_LTC2983 is not set -# CONFIG_MAXIM_THERMOCOUPLE is not set -# CONFIG_MLX90614 is not set -# CONFIG_MLX90632 is not set -# CONFIG_TMP006 is not set -# CONFIG_TMP007 is not set -# CONFIG_TSYS01 is not set -# CONFIG_TSYS02D is not set -# CONFIG_MAX31856 is not set -# end of Temperature sensors - -# CONFIG_NTB is not set -# CONFIG_VME_BUS is not set -CONFIG_PWM=y -CONFIG_PWM_SYSFS=y -# CONFIG_PWM_DEBUG is not set -# CONFIG_PWM_FSL_FTM is not set -# CONFIG_PWM_PCA9685 is not set -CONFIG_PWM_ROCKCHIP=y - -# -# IRQ chip support -# -CONFIG_IRQCHIP=y -CONFIG_ARM_GIC=y -CONFIG_ARM_GIC_MAX_NR=1 -CONFIG_ARM_GIC_V2M=y -CONFIG_ARM_GIC_V3=y -CONFIG_ARM_GIC_V3_ITS=y -CONFIG_ARM_GIC_V3_ITS_PCI=y -# CONFIG_AL_FIC is not set -CONFIG_PARTITION_PERCPU=y -# end of IRQ chip support - -# CONFIG_IPACK_BUS is not set -CONFIG_ARCH_HAS_RESET_CONTROLLER=y -CONFIG_RESET_CONTROLLER=y -CONFIG_RESET_SCMI=y -# CONFIG_RESET_TI_SYSCON is not set - -# -# PHY Subsystem -# -CONFIG_GENERIC_PHY=y -CONFIG_GENERIC_PHY_MIPI_DPHY=y -# CONFIG_PHY_XGENE is not set -# CONFIG_BCM_KONA_USB2_PHY is not set -# CONFIG_PHY_CADENCE_TORRENT is not set -# CONFIG_PHY_CADENCE_DPHY is not set -# CONFIG_PHY_CADENCE_SIERRA is not set -# CONFIG_PHY_CADENCE_SALVO is not set -# CONFIG_PHY_FSL_IMX8MQ_USB is not set -# CONFIG_PHY_MIXEL_MIPI_DPHY is not set -# CONFIG_PHY_PXA_28NM_HSIC is not set -# CONFIG_PHY_PXA_28NM_USB2 is not set -# CONFIG_PHY_CPCAP_USB is not set -# CONFIG_PHY_MAPPHONE_MDM6600 is not set -# CONFIG_PHY_OCELOT_SERDES is not set -# CONFIG_PHY_ROCKCHIP_CSI2_DPHY is not set -# CONFIG_PHY_ROCKCHIP_DP is not set -# CONFIG_PHY_ROCKCHIP_DPHY_RX0 is not set -CONFIG_PHY_ROCKCHIP_EMMC=y -# CONFIG_PHY_ROCKCHIP_INNO_COMBPHY is not set -# CONFIG_PHY_ROCKCHIP_INNO_HDMI is not set -CONFIG_PHY_ROCKCHIP_INNO_USB2=y -CONFIG_PHY_ROCKCHIP_INNO_USB3=y -# CONFIG_PHY_ROCKCHIP_INNO_DSIDPHY is not set -# CONFIG_PHY_ROCKCHIP_MIPI_RX is not set -# CONFIG_PHY_ROCKCHIP_NANENG_COMBO_PHY is not set -# CONFIG_PHY_ROCKCHIP_NANENG_EDP is not set -# CONFIG_PHY_ROCKCHIP_NANENG_USB2 is not set -CONFIG_PHY_ROCKCHIP_PCIE=y -# CONFIG_PHY_ROCKCHIP_SAMSUNG_DCPHY is not set -# CONFIG_PHY_ROCKCHIP_SAMSUNG_HDPTX is not set -# CONFIG_PHY_ROCKCHIP_SAMSUNG_HDPTX_HDMI is not set -CONFIG_PHY_ROCKCHIP_SNPS_PCIE3=y -CONFIG_PHY_ROCKCHIP_TYPEC=y -CONFIG_PHY_ROCKCHIP_USB=y -# CONFIG_PHY_ROCKCHIP_USBDP is not set -# CONFIG_PHY_SAMSUNG_USB2 is not set -# end of PHY Subsystem - -# CONFIG_POWERCAP is not set -# CONFIG_MCB is not set - -# -# Performance monitor support -# -# CONFIG_ARM_CCI_PMU is not set -# CONFIG_ARM_CCN is not set -# CONFIG_ARM_CMN is not set -CONFIG_ARM_PMU=y -# CONFIG_ARM_DSU_PMU is not set -# CONFIG_ARM_SPE_PMU is not set -# CONFIG_HISI_PCIE_PMU is not set -# end of Performance monitor support - -# CONFIG_RAS is not set -# CONFIG_USB4 is not set - -# -# Android -# -CONFIG_ANDROID=y -# CONFIG_ANDROID_BINDER_IPC is not set -# end of Android - -# -# Vendor Hooks -# -# CONFIG_VENDOR_HOOKS is not set -# end of Vendor Hooks - -# CONFIG_LIBNVDIMM is not set -# CONFIG_DAX is not set -CONFIG_NVMEM=y -CONFIG_NVMEM_SYSFS=y -CONFIG_ROCKCHIP_EFUSE=y -CONFIG_ROCKCHIP_OTP=y - -# -# HW tracing support -# -# CONFIG_STM is not set -# CONFIG_INTEL_TH is not set -# end of HW tracing support - -# CONFIG_FPGA is not set -# CONFIG_FSI is not set -CONFIG_TEE=y - -# -# TEE drivers -# -CONFIG_OPTEE=y -CONFIG_OPTEE_SHM_NUM_PRIV_PAGES=1 -# end of TEE drivers - -CONFIG_PM_OPP=y -# CONFIG_SIOX is not set -# CONFIG_SLIMBUS is not set -# CONFIG_INTERCONNECT is not set -# CONFIG_COUNTER is not set -# CONFIG_MOST is not set -# end of Device Drivers - -# -# File systems -# -CONFIG_DCACHE_WORD_ACCESS=y -# CONFIG_VALIDATE_FS_PARSER is not set -CONFIG_FS_IOMAP=y -# CONFIG_EXT2_FS is not set -# CONFIG_EXT3_FS is not set -CONFIG_EXT4_FS=y -CONFIG_EXT4_USE_FOR_EXT2=y -CONFIG_EXT4_FS_POSIX_ACL=y -CONFIG_EXT4_FS_SECURITY=y -# CONFIG_EXT4_DEBUG is not set -CONFIG_JBD2=y -# CONFIG_JBD2_DEBUG is not set -CONFIG_FS_MBCACHE=y -# CONFIG_REISERFS_FS is not set -# CONFIG_JFS_FS is not set -CONFIG_XFS_FS=y -CONFIG_XFS_SUPPORT_V4=y -# CONFIG_XFS_QUOTA is not set -# CONFIG_XFS_POSIX_ACL is not set -# CONFIG_XFS_RT is not set -# CONFIG_XFS_ONLINE_SCRUB is not set -# CONFIG_XFS_WARN is not set -# CONFIG_XFS_DEBUG is not set -# CONFIG_GFS2_FS is not set -# CONFIG_OCFS2_FS is not set -# CONFIG_BTRFS_FS is not set -# CONFIG_NILFS2_FS is not set -# CONFIG_F2FS_FS is not set -# CONFIG_FS_DAX is not set -CONFIG_FS_POSIX_ACL=y -CONFIG_EXPORTFS=y -# CONFIG_EXPORTFS_BLOCK_OPS is not set -CONFIG_FILE_LOCKING=y -CONFIG_MANDATORY_FILE_LOCKING=y -# CONFIG_FS_ENCRYPTION is not set -# CONFIG_FS_VERITY is not set -CONFIG_FSNOTIFY=y -# CONFIG_DNOTIFY is not set -CONFIG_INOTIFY_USER=y -# CONFIG_FANOTIFY is not set -# CONFIG_QUOTA is not set -# CONFIG_AUTOFS4_FS is not set -# CONFIG_AUTOFS_FS is not set -CONFIG_FUSE_FS=y -# CONFIG_CUSE is not set -# CONFIG_VIRTIO_FS is not set -# CONFIG_OVERLAY_FS is not set - -# -# Caches -# -# CONFIG_FSCACHE is not set -# end of Caches - -# -# CD-ROM/DVD Filesystems -# -CONFIG_ISO9660_FS=y -CONFIG_JOLIET=y -CONFIG_ZISOFS=y -# CONFIG_UDF_FS is not set -# end of CD-ROM/DVD Filesystems - -# -# DOS/FAT/EXFAT/NT Filesystems -# -CONFIG_FAT_FS=y -# CONFIG_MSDOS_FS is not set -CONFIG_VFAT_FS=y -CONFIG_FAT_DEFAULT_CODEPAGE=936 -CONFIG_FAT_DEFAULT_IOCHARSET="utf8" -# CONFIG_FAT_DEFAULT_UTF8 is not set -# CONFIG_EXFAT_FS is not set -CONFIG_NTFS_FS=y -# CONFIG_NTFS_DEBUG is not set -# CONFIG_NTFS_RW is not set -# CONFIG_NTFS3_FS is not set -# end of DOS/FAT/EXFAT/NT Filesystems - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -# CONFIG_PROC_KCORE is not set -CONFIG_PROC_SYSCTL=y -CONFIG_PROC_PAGE_MONITOR=y -# CONFIG_PROC_CHILDREN is not set -CONFIG_KERNFS=y -CONFIG_SYSFS=y -CONFIG_TMPFS=y -CONFIG_TMPFS_POSIX_ACL=y -CONFIG_TMPFS_XATTR=y -# CONFIG_TMPFS_INODE64 is not set -# CONFIG_HUGETLBFS is not set -CONFIG_ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP=y -CONFIG_MEMFD_CREATE=y -CONFIG_ARCH_HAS_GIGANTIC_PAGE=y -CONFIG_CONFIGFS_FS=y -# end of Pseudo filesystems - -CONFIG_MISC_FILESYSTEMS=y -# CONFIG_ORANGEFS_FS is not set -# CONFIG_ADFS_FS is not set -# CONFIG_AFFS_FS is not set -# CONFIG_ECRYPT_FS is not set -# CONFIG_HFS_FS is not set -# CONFIG_HFSPLUS_FS is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_EFS_FS is not set -CONFIG_JFFS2_FS=y -CONFIG_JFFS2_FS_DEBUG=0 -CONFIG_JFFS2_FS_WRITEBUFFER=y -# CONFIG_JFFS2_FS_WBUF_VERIFY is not set -# CONFIG_JFFS2_SUMMARY is not set -# CONFIG_JFFS2_FS_XATTR is not set -# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set -CONFIG_JFFS2_ZLIB=y -CONFIG_JFFS2_RTIME=y -CONFIG_UBIFS_FS=y -CONFIG_UBIFS_FS_ADVANCED_COMPR=y -CONFIG_UBIFS_FS_LZO=y -CONFIG_UBIFS_FS_ZLIB=y -CONFIG_UBIFS_FS_ZSTD=y -# CONFIG_UBIFS_ATIME_SUPPORT is not set -CONFIG_UBIFS_FS_XATTR=y -CONFIG_UBIFS_FS_SECURITY=y -# CONFIG_UBIFS_FS_AUTHENTICATION is not set -# CONFIG_CRAMFS is not set -CONFIG_SQUASHFS=y -CONFIG_SQUASHFS_FILE_CACHE=y -# CONFIG_SQUASHFS_FILE_DIRECT is not set -CONFIG_SQUASHFS_DECOMP_SINGLE=y -# CONFIG_SQUASHFS_DECOMP_MULTI is not set -# CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU is not set -# CONFIG_SQUASHFS_XATTR is not set -CONFIG_SQUASHFS_ZLIB=y -# CONFIG_SQUASHFS_LZ4 is not set -# CONFIG_SQUASHFS_LZO is not set -# CONFIG_SQUASHFS_XZ is not set -# CONFIG_SQUASHFS_ZSTD is not set -# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set -# CONFIG_SQUASHFS_EMBEDDED is not set -CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 -# CONFIG_VXFS_FS is not set -# CONFIG_MINIX_FS is not set -# CONFIG_OMFS_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_QNX6FS_FS is not set -# CONFIG_ROMFS_FS is not set -CONFIG_PSTORE=y -CONFIG_PSTORE_DEFLATE_COMPRESS=y -# CONFIG_PSTORE_LZO_COMPRESS is not set -# CONFIG_PSTORE_LZ4_COMPRESS is not set -# CONFIG_PSTORE_LZ4HC_COMPRESS is not set -# CONFIG_PSTORE_842_COMPRESS is not set -# CONFIG_PSTORE_ZSTD_COMPRESS is not set -CONFIG_PSTORE_COMPRESS=y -CONFIG_PSTORE_DEFLATE_COMPRESS_DEFAULT=y -CONFIG_PSTORE_COMPRESS_DEFAULT="deflate" -CONFIG_PSTORE_CONSOLE=y -# CONFIG_PSTORE_PMSG is not set -# CONFIG_PSTORE_FTRACE is not set -CONFIG_PSTORE_RAM=y -# CONFIG_SYSV_FS is not set -# CONFIG_UFS_FS is not set -# CONFIG_EROFS_FS is not set -CONFIG_NETWORK_FILESYSTEMS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V2=y -CONFIG_NFS_V3=y -CONFIG_NFS_V3_ACL=y -CONFIG_NFS_V4=y -CONFIG_NFS_SWAP=y -# CONFIG_NFS_V4_1 is not set -# CONFIG_NFS_USE_LEGACY_DNS is not set -CONFIG_NFS_USE_KERNEL_DNS=y -CONFIG_NFS_DISABLE_UDP_SUPPORT=y -# CONFIG_NFSD is not set -CONFIG_GRACE_PERIOD=y -CONFIG_LOCKD=y -CONFIG_LOCKD_V4=y -CONFIG_NFS_ACL_SUPPORT=y -CONFIG_NFS_COMMON=y -CONFIG_SUNRPC=y -CONFIG_SUNRPC_GSS=y -CONFIG_SUNRPC_SWAP=y -# CONFIG_SUNRPC_DEBUG is not set -# CONFIG_CEPH_FS is not set -# CONFIG_CIFS is not set -# CONFIG_CODA_FS is not set -# CONFIG_AFS_FS is not set -CONFIG_NLS=y -CONFIG_NLS_DEFAULT="utf8" -CONFIG_NLS_CODEPAGE_437=y -# CONFIG_NLS_CODEPAGE_737 is not set -# CONFIG_NLS_CODEPAGE_775 is not set -# CONFIG_NLS_CODEPAGE_850 is not set -# CONFIG_NLS_CODEPAGE_852 is not set -# CONFIG_NLS_CODEPAGE_855 is not set -# CONFIG_NLS_CODEPAGE_857 is not set -# CONFIG_NLS_CODEPAGE_860 is not set -# CONFIG_NLS_CODEPAGE_861 is not set -# CONFIG_NLS_CODEPAGE_862 is not set -# CONFIG_NLS_CODEPAGE_863 is not set -# CONFIG_NLS_CODEPAGE_864 is not set -# CONFIG_NLS_CODEPAGE_865 is not set -# CONFIG_NLS_CODEPAGE_866 is not set -# CONFIG_NLS_CODEPAGE_869 is not set -CONFIG_NLS_CODEPAGE_936=y -# CONFIG_NLS_CODEPAGE_950 is not set -# CONFIG_NLS_CODEPAGE_932 is not set -# CONFIG_NLS_CODEPAGE_949 is not set -# CONFIG_NLS_CODEPAGE_874 is not set -# CONFIG_NLS_ISO8859_8 is not set -# CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set -CONFIG_NLS_ASCII=y -CONFIG_NLS_ISO8859_1=y -# CONFIG_NLS_ISO8859_2 is not set -# CONFIG_NLS_ISO8859_3 is not set -# CONFIG_NLS_ISO8859_4 is not set -# CONFIG_NLS_ISO8859_5 is not set -# CONFIG_NLS_ISO8859_6 is not set -# CONFIG_NLS_ISO8859_7 is not set -# CONFIG_NLS_ISO8859_9 is not set -# CONFIG_NLS_ISO8859_13 is not set -# CONFIG_NLS_ISO8859_14 is not set -# CONFIG_NLS_ISO8859_15 is not set -# CONFIG_NLS_KOI8_R is not set -# CONFIG_NLS_KOI8_U is not set -# CONFIG_NLS_MAC_ROMAN is not set -# CONFIG_NLS_MAC_CELTIC is not set -# CONFIG_NLS_MAC_CENTEURO is not set -# CONFIG_NLS_MAC_CROATIAN is not set -# CONFIG_NLS_MAC_CYRILLIC is not set -# CONFIG_NLS_MAC_GAELIC is not set -# CONFIG_NLS_MAC_GREEK is not set -# CONFIG_NLS_MAC_ICELAND is not set -# CONFIG_NLS_MAC_INUIT is not set -# CONFIG_NLS_MAC_ROMANIAN is not set -# CONFIG_NLS_MAC_TURKISH is not set -CONFIG_NLS_UTF8=y -# CONFIG_DLM is not set -CONFIG_UNICODE=y -# CONFIG_UNICODE_NORMALIZATION_SELFTEST is not set -CONFIG_IO_WQ=y -# end of File systems - -# -# Security options -# -CONFIG_KEYS=y -# CONFIG_KEYS_REQUEST_CACHE is not set -# CONFIG_PERSISTENT_KEYRINGS is not set -# CONFIG_TRUSTED_KEYS is not set -# CONFIG_ENCRYPTED_KEYS is not set -# CONFIG_KEY_DH_OPERATIONS is not set -# CONFIG_SECURITY_DMESG_RESTRICT is not set -# CONFIG_SECURITY is not set -CONFIG_SECURITYFS=y -CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y -# CONFIG_HARDENED_USERCOPY is not set -# CONFIG_FORTIFY_SOURCE is not set -# CONFIG_STATIC_USERMODEHELPER is not set -CONFIG_DEFAULT_SECURITY_DAC=y -CONFIG_LSM="lockdown,yama,loadpin,safesetid,integrity,bpf" - -# -# Kernel hardening options -# - -# -# Memory initialization -# -CONFIG_INIT_STACK_NONE=y -# CONFIG_GCC_PLUGIN_STRUCTLEAK_USER is not set -# CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF is not set -# CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL is not set -# CONFIG_GCC_PLUGIN_STACKLEAK is not set -# CONFIG_INIT_ON_ALLOC_DEFAULT_ON is not set -# CONFIG_INIT_ON_FREE_DEFAULT_ON is not set -# end of Memory initialization -# end of Kernel hardening options - -# CONFIG_SECURITY_BOOT_INIT is not set -# end of Security options - -CONFIG_CRYPTO=y - -# -# Crypto core or helper -# -CONFIG_CRYPTO_ALGAPI=y -CONFIG_CRYPTO_ALGAPI2=y -CONFIG_CRYPTO_AEAD=y -CONFIG_CRYPTO_AEAD2=y -CONFIG_CRYPTO_SKCIPHER=y -CONFIG_CRYPTO_SKCIPHER2=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_RNG=y -CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_RNG_DEFAULT=y -CONFIG_CRYPTO_AKCIPHER2=y -CONFIG_CRYPTO_AKCIPHER=y -CONFIG_CRYPTO_KPP2=y -CONFIG_CRYPTO_KPP=y -CONFIG_CRYPTO_ACOMP2=y -CONFIG_CRYPTO_MANAGER=y -CONFIG_CRYPTO_MANAGER2=y -# CONFIG_CRYPTO_USER is not set -CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y -CONFIG_CRYPTO_GF128MUL=y -CONFIG_CRYPTO_NULL=y -CONFIG_CRYPTO_NULL2=y -# CONFIG_CRYPTO_PCRYPT is not set -CONFIG_CRYPTO_CRYPTD=y -# CONFIG_CRYPTO_AUTHENC is not set -# CONFIG_CRYPTO_TEST is not set -CONFIG_CRYPTO_SIMD=y - -# -# Public-key cryptography -# -CONFIG_CRYPTO_RSA=y -# CONFIG_CRYPTO_DH is not set -CONFIG_CRYPTO_ECC=y -CONFIG_CRYPTO_ECDH=y -# CONFIG_CRYPTO_ECDSA is not set -# CONFIG_CRYPTO_ECRDSA is not set -# CONFIG_CRYPTO_SM2 is not set -# CONFIG_CRYPTO_CURVE25519 is not set - -# -# Authenticated Encryption with Associated Data -# -CONFIG_CRYPTO_CCM=y -CONFIG_CRYPTO_GCM=y -# CONFIG_CRYPTO_CHACHA20POLY1305 is not set -# CONFIG_CRYPTO_AEGIS128 is not set -# CONFIG_CRYPTO_SEQIV is not set -# CONFIG_CRYPTO_ECHAINIV is not set - -# -# Block modes -# -# CONFIG_CRYPTO_CBC is not set -# CONFIG_CRYPTO_CFB is not set -CONFIG_CRYPTO_CTR=y -# CONFIG_CRYPTO_CTS is not set -CONFIG_CRYPTO_ECB=y -# CONFIG_CRYPTO_LRW is not set -# CONFIG_CRYPTO_OFB is not set -# CONFIG_CRYPTO_PCBC is not set -# CONFIG_CRYPTO_XTS is not set -# CONFIG_CRYPTO_KEYWRAP is not set -# CONFIG_CRYPTO_ADIANTUM is not set -# CONFIG_CRYPTO_ESSIV is not set - -# -# Hash modes -# -CONFIG_CRYPTO_CMAC=y -CONFIG_CRYPTO_HMAC=y -# CONFIG_CRYPTO_XCBC is not set -# CONFIG_CRYPTO_VMAC is not set - -# -# Digest -# -CONFIG_CRYPTO_CRC32C=y -# CONFIG_CRYPTO_CRC32 is not set -# CONFIG_CRYPTO_XXHASH is not set -# CONFIG_CRYPTO_BLAKE2B is not set -# CONFIG_CRYPTO_BLAKE2S is not set -CONFIG_CRYPTO_CRCT10DIF=y -CONFIG_CRYPTO_GHASH=y -# CONFIG_CRYPTO_POLY1305 is not set -# CONFIG_CRYPTO_MD4 is not set -CONFIG_CRYPTO_MD5=y -# CONFIG_CRYPTO_MICHAEL_MIC is not set -# CONFIG_CRYPTO_RMD128 is not set -# CONFIG_CRYPTO_RMD160 is not set -# CONFIG_CRYPTO_RMD256 is not set -# CONFIG_CRYPTO_RMD320 is not set -CONFIG_CRYPTO_SHA1=y -CONFIG_CRYPTO_SHA256=y -CONFIG_CRYPTO_SHA512=y -# CONFIG_CRYPTO_SHA3 is not set -# CONFIG_CRYPTO_SM3_GENERIC is not set -# CONFIG_CRYPTO_STREEBOG is not set -# CONFIG_CRYPTO_TGR192 is not set -# CONFIG_CRYPTO_WP512 is not set - -# -# Ciphers -# -CONFIG_CRYPTO_AES=y -# CONFIG_CRYPTO_AES_TI is not set -# CONFIG_CRYPTO_ANUBIS is not set -# CONFIG_CRYPTO_ARC4 is not set -# CONFIG_CRYPTO_BLOWFISH is not set -# CONFIG_CRYPTO_CAMELLIA is not set -# CONFIG_CRYPTO_CAST5 is not set -# CONFIG_CRYPTO_CAST6 is not set -# CONFIG_CRYPTO_DES is not set -# CONFIG_CRYPTO_FCRYPT is not set -# CONFIG_CRYPTO_KHAZAD is not set -# CONFIG_CRYPTO_SALSA20 is not set -# CONFIG_CRYPTO_CHACHA20 is not set -# CONFIG_CRYPTO_SEED is not set -# CONFIG_CRYPTO_SERPENT is not set -# CONFIG_CRYPTO_SM4_GENERIC is not set -# CONFIG_CRYPTO_TEA is not set -CONFIG_CRYPTO_TWOFISH=y -CONFIG_CRYPTO_TWOFISH_COMMON=y - -# -# Compression -# -CONFIG_CRYPTO_DEFLATE=y -CONFIG_CRYPTO_LZO=y -# CONFIG_CRYPTO_842 is not set -# CONFIG_CRYPTO_LZ4 is not set -# CONFIG_CRYPTO_LZ4HC is not set -CONFIG_CRYPTO_ZSTD=y - -# -# Random Number Generation -# -CONFIG_CRYPTO_ANSI_CPRNG=y -CONFIG_CRYPTO_DRBG_MENU=y -CONFIG_CRYPTO_DRBG_HMAC=y -# CONFIG_CRYPTO_DRBG_HASH is not set -# CONFIG_CRYPTO_DRBG_CTR is not set -CONFIG_CRYPTO_DRBG=y -CONFIG_CRYPTO_JITTERENTROPY=y -CONFIG_CRYPTO_USER_API=y -CONFIG_CRYPTO_USER_API_HASH=y -CONFIG_CRYPTO_USER_API_SKCIPHER=y -# CONFIG_CRYPTO_USER_API_RNG is not set -# CONFIG_CRYPTO_USER_API_AEAD is not set -CONFIG_CRYPTO_USER_API_ENABLE_OBSOLETE=y -CONFIG_CRYPTO_HASH_INFO=y - -# -# Crypto library routines -# -CONFIG_CRYPTO_LIB_AES=y -CONFIG_CRYPTO_LIB_ARC4=y -# CONFIG_CRYPTO_LIB_BLAKE2S is not set -# CONFIG_CRYPTO_LIB_CHACHA is not set -# CONFIG_CRYPTO_LIB_CURVE25519 is not set -CONFIG_CRYPTO_LIB_DES=y -CONFIG_CRYPTO_LIB_POLY1305_RSIZE=9 -# CONFIG_CRYPTO_LIB_POLY1305 is not set -# CONFIG_CRYPTO_LIB_CHACHA20POLY1305 is not set -CONFIG_CRYPTO_LIB_SHA256=y -CONFIG_CRYPTO_HW=y -# CONFIG_CRYPTO_DEV_ATMEL_ECC is not set -# CONFIG_CRYPTO_DEV_ATMEL_SHA204A is not set -# CONFIG_CRYPTO_DEV_CCP is not set -# CONFIG_CRYPTO_DEV_NITROX_CNN55XX is not set -# CONFIG_CRYPTO_DEV_CAVIUM_ZIP is not set -CONFIG_CRYPTO_DEV_ROCKCHIP=y -# CONFIG_CRYPTO_DEV_SAFEXCEL is not set -# CONFIG_CRYPTO_DEV_CCREE is not set -# CONFIG_CRYPTO_DEV_HISI_SEC is not set -# CONFIG_CRYPTO_DEV_AMLOGIC_GXL is not set -CONFIG_ASYMMETRIC_KEY_TYPE=y -CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y -CONFIG_X509_CERTIFICATE_PARSER=y -# CONFIG_PKCS8_PRIVATE_KEY_PARSER is not set -CONFIG_PKCS7_MESSAGE_PARSER=y -# CONFIG_PKCS7_TEST_KEY is not set -# CONFIG_SIGNED_PE_FILE_VERIFICATION is not set -# CONFIG_PGP_LIBRARY is not set -# CONFIG_PGP_KEY_PARSER is not set -# CONFIG_PGP_PRELOAD is not set - -# -# Certificates for signature checking -# -CONFIG_SYSTEM_TRUSTED_KEYRING=y -CONFIG_SYSTEM_TRUSTED_KEYS="" -# CONFIG_SYSTEM_EXTRA_CERTIFICATE is not set -# CONFIG_SECONDARY_TRUSTED_KEYRING is not set -# CONFIG_SYSTEM_BLACKLIST_KEYRING is not set -# CONFIG_PGP_PRELOAD_PUBLIC_KEYS is not set -# end of Certificates for signature checking - -CONFIG_BINARY_PRINTF=y - -# -# Library routines -# -CONFIG_LINEAR_RANGES=y -# CONFIG_PACKING is not set -CONFIG_BITREVERSE=y -CONFIG_HAVE_ARCH_BITREVERSE=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -CONFIG_GENERIC_NET_UTILS=y -# CONFIG_CORDIC is not set -# CONFIG_PRIME_NUMBERS is not set -CONFIG_RATIONAL=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -CONFIG_ARCH_HAS_FAST_MULTIPLIER=y -CONFIG_ARCH_USE_SYM_ANNOTATIONS=y -# CONFIG_INDIRECT_PIO is not set -CONFIG_CRC_CCITT=y -CONFIG_CRC16=y -CONFIG_CRC_T10DIF=y -CONFIG_CRC_ITU_T=y -CONFIG_CRC32=y -# CONFIG_CRC32_SELFTEST is not set -CONFIG_CRC32_SLICEBY8=y -# CONFIG_CRC32_SLICEBY4 is not set -# CONFIG_CRC32_SARWATE is not set -# CONFIG_CRC32_BIT is not set -# CONFIG_CRC64 is not set -# CONFIG_CRC4 is not set -CONFIG_CRC7=y -CONFIG_LIBCRC32C=y -# CONFIG_CRC8 is not set -CONFIG_XXHASH=y -CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y -# CONFIG_RANDOM32_SELFTEST is not set -CONFIG_ZLIB_INFLATE=y -CONFIG_ZLIB_DEFLATE=y -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_LZ4_DECOMPRESS=y -CONFIG_ZSTD_COMPRESS=y -CONFIG_ZSTD_DECOMPRESS=y -CONFIG_XZ_DEC=y -# CONFIG_XZ_DEC_X86 is not set -# CONFIG_XZ_DEC_POWERPC is not set -# CONFIG_XZ_DEC_IA64 is not set -CONFIG_XZ_DEC_ARM=y -CONFIG_XZ_DEC_ARMTHUMB=y -# CONFIG_XZ_DEC_SPARC is not set -CONFIG_XZ_DEC_BCJ=y -# CONFIG_XZ_DEC_TEST is not set -CONFIG_DECOMPRESS_GZIP=y -CONFIG_DECOMPRESS_BZIP2=y -CONFIG_DECOMPRESS_LZMA=y -CONFIG_DECOMPRESS_XZ=y -CONFIG_DECOMPRESS_LZO=y -CONFIG_DECOMPRESS_LZ4=y -CONFIG_DECOMPRESS_ZSTD=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_REED_SOLOMON=y -CONFIG_REED_SOLOMON_ENC8=y -CONFIG_REED_SOLOMON_DEC8=y -CONFIG_ASSOCIATIVE_ARRAY=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -CONFIG_HAS_DMA=y -CONFIG_DMA_OPS=y -CONFIG_NEED_SG_DMA_LENGTH=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_ARCH_DMA_ADDR_T_64BIT=y -CONFIG_DMA_DECLARE_COHERENT=y -CONFIG_ARCH_HAS_SETUP_DMA_OPS=y -CONFIG_ARCH_HAS_TEARDOWN_DMA_OPS=y -CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE=y -CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU=y -CONFIG_ARCH_HAS_DMA_PREP_COHERENT=y -CONFIG_SWIOTLB=y -CONFIG_DMA_NONCOHERENT_MMAP=y -CONFIG_DMA_COHERENT_POOL=y -CONFIG_DMA_REMAP=y -CONFIG_DMA_DIRECT_REMAP=y -CONFIG_DMA_CMA=y -# CONFIG_DMA_PERNUMA_CMA is not set - -# -# Default contiguous memory area size: -# -CONFIG_CMA_SIZE_MBYTES=16 -CONFIG_CMA_SIZE_SEL_MBYTES=y -# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set -# CONFIG_CMA_SIZE_SEL_MIN is not set -# CONFIG_CMA_SIZE_SEL_MAX is not set -CONFIG_CMA_ALIGNMENT=8 -# CONFIG_DMA_API_DEBUG is not set -CONFIG_SGL_ALLOC=y -CONFIG_CPU_RMAP=y -CONFIG_DQL=y -CONFIG_GLOB=y -# CONFIG_GLOB_SELFTEST is not set -CONFIG_NLATTR=y -CONFIG_CLZ_TAB=y -# CONFIG_IRQ_POLL is not set -CONFIG_MPILIB=y -CONFIG_LIBFDT=y -CONFIG_OID_REGISTRY=y -CONFIG_HAVE_GENERIC_VDSO=y -CONFIG_GENERIC_GETTIMEOFDAY=y -CONFIG_GENERIC_VDSO_TIME_NS=y -CONFIG_FONT_SUPPORT=y -# CONFIG_FONTS is not set -CONFIG_FONT_8x8=y -CONFIG_FONT_8x16=y -CONFIG_SG_POOL=y -CONFIG_ARCH_STACKWALK=y -CONFIG_SBITMAP=y -# CONFIG_STRING_SELFTEST is not set -# end of Library routines - -# -# Kernel hacking -# - -# -# printk and dmesg options -# -CONFIG_PRINTK_TIME=y -# CONFIG_PRINTK_CALLER is not set -CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7 -CONFIG_CONSOLE_LOGLEVEL_QUIET=4 -CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 -# CONFIG_BOOT_PRINTK_DELAY is not set -CONFIG_DYNAMIC_DEBUG=y -CONFIG_DYNAMIC_DEBUG_CORE=y -CONFIG_SYMBOLIC_ERRNAME=y -CONFIG_DEBUG_BUGVERBOSE=y -# end of printk and dmesg options - -# -# Compile-time checks and compiler options -# -CONFIG_DEBUG_INFO=y -# CONFIG_DEBUG_INFO_REDUCED is not set -# CONFIG_DEBUG_INFO_COMPRESSED is not set -# CONFIG_DEBUG_INFO_SPLIT is not set -# CONFIG_DEBUG_INFO_DWARF4 is not set -# CONFIG_DEBUG_INFO_BTF is not set -# CONFIG_GDB_SCRIPTS is not set -CONFIG_ENABLE_MUST_CHECK=y -CONFIG_FRAME_WARN=2048 -# CONFIG_STRIP_ASM_SYMS is not set -# CONFIG_READABLE_ASM is not set -# CONFIG_HEADERS_INSTALL is not set -# CONFIG_OPTIMIZE_INLINING is not set -# CONFIG_DEBUG_SECTION_MISMATCH is not set -CONFIG_SECTION_MISMATCH_WARN_ONLY=y -# CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_32B is not set -CONFIG_ARCH_WANT_FRAME_POINTERS=y -CONFIG_FRAME_POINTER=y -# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set -# end of Compile-time checks and compiler options - -# -# Generic Kernel Debugging Instruments -# -CONFIG_MAGIC_SYSRQ=y -CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0 -CONFIG_MAGIC_SYSRQ_SERIAL=y -CONFIG_MAGIC_SYSRQ_SERIAL_SEQUENCE="" -CONFIG_DEBUG_FS=y -CONFIG_DEBUG_FS_ALLOW_ALL=y -# CONFIG_DEBUG_FS_DISALLOW_MOUNT is not set -# CONFIG_DEBUG_FS_ALLOW_NONE is not set -CONFIG_HAVE_ARCH_KGDB=y -# CONFIG_KGDB is not set -CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y -# CONFIG_UBSAN is not set -# end of Generic Kernel Debugging Instruments - -CONFIG_DEBUG_KERNEL=y -CONFIG_DEBUG_MISC=y - -# -# Memory Debugging -# -# CONFIG_PAGE_EXTENSION is not set -# CONFIG_DEBUG_PAGEALLOC is not set -# CONFIG_PAGE_OWNER is not set -# CONFIG_PAGE_TABLE_CHECK is not set -# CONFIG_PAGE_POISONING is not set -# CONFIG_DEBUG_PAGE_REF is not set -# CONFIG_DEBUG_RODATA_TEST is not set -CONFIG_ARCH_HAS_DEBUG_WX=y -# CONFIG_DEBUG_WX is not set -CONFIG_GENERIC_PTDUMP=y -# CONFIG_PTDUMP_DEBUGFS is not set -# CONFIG_DEBUG_OBJECTS is not set -# CONFIG_SLUB_DEBUG_ON is not set -# CONFIG_SLUB_STATS is not set -CONFIG_HAVE_DEBUG_KMEMLEAK=y -# CONFIG_DEBUG_KMEMLEAK is not set -# CONFIG_DEBUG_STACK_USAGE is not set -# CONFIG_SCHED_STACK_END_CHECK is not set -CONFIG_ARCH_HAS_DEBUG_VM_PGTABLE=y -# CONFIG_DEBUG_VM is not set -# CONFIG_DEBUG_VM_PGTABLE is not set -CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y -# CONFIG_DEBUG_VIRTUAL is not set -# CONFIG_DEBUG_MEMORY_INIT is not set -# CONFIG_DEBUG_PER_CPU_MAPS is not set -CONFIG_HAVE_ARCH_KASAN=y -CONFIG_HAVE_ARCH_KASAN_SW_TAGS=y -CONFIG_HAVE_ARCH_KASAN_VMALLOC=y -CONFIG_CC_HAS_KASAN_GENERIC=y -CONFIG_CC_HAS_WORKING_NOSANITIZE_ADDRESS=y -# CONFIG_KASAN is not set -CONFIG_HAVE_ARCH_KFENCE=y -# CONFIG_KFENCE is not set -# end of Memory Debugging - -# CONFIG_DEBUG_SHIRQ is not set - -# -# Debug Oops, Lockups and Hangs -# -# CONFIG_PANIC_ON_OOPS is not set -CONFIG_PANIC_ON_OOPS_VALUE=0 -CONFIG_PANIC_TIMEOUT=0 -# CONFIG_SOFTLOCKUP_DETECTOR is not set - -# -# ARM64 NMI watchdog configuration -# -# end of ARM64 NMI watchdog configuration - -# CONFIG_DETECT_HUNG_TASK is not set -# CONFIG_WQ_WATCHDOG is not set -# CONFIG_TEST_LOCKUP is not set -# end of Debug Oops, Lockups and Hangs - -# -# Scheduler Debugging -# -CONFIG_SCHED_DEBUG=y -CONFIG_SCHED_INFO=y -CONFIG_SCHEDSTATS=y -# end of Scheduler Debugging - -# CONFIG_DEBUG_TIMEKEEPING is not set - -# -# Lock Debugging (spinlocks, mutexes, etc...) -# -CONFIG_LOCK_DEBUGGING_SUPPORT=y -# CONFIG_PROVE_LOCKING is not set -# CONFIG_LOCK_STAT is not set -# CONFIG_DEBUG_RT_MUTEXES is not set -CONFIG_DEBUG_SPINLOCK=y -# CONFIG_DEBUG_MUTEXES is not set -# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set -# CONFIG_DEBUG_RWSEMS is not set -# CONFIG_DEBUG_LOCK_ALLOC is not set -# CONFIG_DEBUG_ATOMIC_SLEEP is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set -# CONFIG_LOCK_TORTURE_TEST is not set -# CONFIG_WW_MUTEX_SELFTEST is not set -# CONFIG_SCF_TORTURE_TEST is not set -# CONFIG_CSD_LOCK_WAIT_DEBUG is not set -# end of Lock Debugging (spinlocks, mutexes, etc...) - -CONFIG_STACKTRACE=y -# CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set -# CONFIG_DEBUG_KOBJECT is not set -CONFIG_HAVE_DEBUG_BUGVERBOSE=y - -# -# Debug kernel data structures -# -# CONFIG_DEBUG_LIST is not set -# CONFIG_DEBUG_PLIST is not set -# CONFIG_DEBUG_SG is not set -# CONFIG_DEBUG_NOTIFIERS is not set -# CONFIG_BUG_ON_DATA_CORRUPTION is not set -# end of Debug kernel data structures - -CONFIG_DEBUG_CREDENTIALS=y - -# -# RCU Debugging -# -# CONFIG_RCU_SCALE_TEST is not set -# CONFIG_RCU_TORTURE_TEST is not set -# CONFIG_RCU_REF_SCALE_TEST is not set -CONFIG_RCU_CPU_STALL_TIMEOUT=60 -CONFIG_RCU_TRACE=y -# CONFIG_RCU_EQS_DEBUG is not set -# end of RCU Debugging - -# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set -# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set -# CONFIG_CPU_HOTPLUG_STATE_CONTROL is not set -# CONFIG_LATENCYTOP is not set -CONFIG_NOP_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_TRACE_CLOCK=y -CONFIG_RING_BUFFER=y -CONFIG_EVENT_TRACING=y -CONFIG_CONTEXT_SWITCH_TRACER=y -CONFIG_TRACING=y -CONFIG_GENERIC_TRACER=y -CONFIG_TRACING_SUPPORT=y -CONFIG_FTRACE=y -# CONFIG_BOOTTIME_TRACING is not set -CONFIG_FUNCTION_TRACER=y -CONFIG_FUNCTION_GRAPH_TRACER=y -CONFIG_DYNAMIC_FTRACE=y -CONFIG_DYNAMIC_FTRACE_WITH_REGS=y -# CONFIG_FUNCTION_PROFILER is not set -# CONFIG_STACK_TRACER is not set -# CONFIG_IRQSOFF_TRACER is not set -# CONFIG_SCHED_TRACER is not set -# CONFIG_HWLAT_TRACER is not set -# CONFIG_OSNOISE_TRACER is not set -# CONFIG_TIMERLAT_TRACER is not set -# CONFIG_FTRACE_SYSCALLS is not set -# CONFIG_TRACER_SNAPSHOT is not set -CONFIG_BRANCH_PROFILE_NONE=y -# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set -# CONFIG_PROFILE_ALL_BRANCHES is not set -CONFIG_BLK_DEV_IO_TRACE=y -CONFIG_UPROBE_EVENTS=y -CONFIG_DYNAMIC_EVENTS=y -CONFIG_PROBE_EVENTS=y -CONFIG_FTRACE_MCOUNT_RECORD=y -# CONFIG_SYNTH_EVENTS is not set -# CONFIG_HIST_TRIGGERS is not set -# CONFIG_TRACE_EVENT_INJECT is not set -# CONFIG_TRACEPOINT_BENCHMARK is not set -# CONFIG_RING_BUFFER_BENCHMARK is not set -# CONFIG_TRACE_EVAL_MAP_FILE is not set -# CONFIG_FTRACE_STARTUP_TEST is not set -# CONFIG_RING_BUFFER_STARTUP_TEST is not set -# CONFIG_PREEMPTIRQ_DELAY_TEST is not set -# CONFIG_SAMPLES is not set -CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y -CONFIG_STRICT_DEVMEM=y -# CONFIG_IO_STRICT_DEVMEM is not set - -# -# arm64 Debugging -# -# CONFIG_PID_IN_CONTEXTIDR is not set -# CONFIG_ARM64_RELOC_TEST is not set -# CONFIG_CORESIGHT is not set -# end of arm64 Debugging - -# -# Kernel Testing and Coverage -# -# CONFIG_KUNIT is not set -# CONFIG_NOTIFIER_ERROR_INJECTION is not set -# CONFIG_FAULT_INJECTION is not set -CONFIG_ARCH_HAS_KCOV=y -CONFIG_CC_HAS_SANCOV_TRACE_PC=y -# CONFIG_KCOV is not set -CONFIG_RUNTIME_TESTING_MENU=y -CONFIG_LKDTM=y -# CONFIG_TEST_LIST_SORT is not set -# CONFIG_TEST_MIN_HEAP is not set -# CONFIG_TEST_SORT is not set -# CONFIG_BACKTRACE_SELF_TEST is not set -# CONFIG_RBTREE_TEST is not set -# CONFIG_REED_SOLOMON_TEST is not set -# CONFIG_INTERVAL_TREE_TEST is not set -# CONFIG_PERCPU_TEST is not set -# CONFIG_ATOMIC64_SELFTEST is not set -# CONFIG_TEST_HEXDUMP is not set -# CONFIG_TEST_STRING_HELPERS is not set -# CONFIG_TEST_STRSCPY is not set -# CONFIG_TEST_KSTRTOX is not set -# CONFIG_TEST_PRINTF is not set -# CONFIG_TEST_BITMAP is not set -# CONFIG_TEST_UUID is not set -# CONFIG_TEST_XARRAY is not set -# CONFIG_TEST_OVERFLOW is not set -# CONFIG_TEST_RHASHTABLE is not set -# CONFIG_TEST_HASH is not set -# CONFIG_TEST_IDA is not set -# CONFIG_TEST_LKM is not set -# CONFIG_TEST_BITOPS is not set -# CONFIG_TEST_VMALLOC is not set -# CONFIG_TEST_USER_COPY is not set -# CONFIG_TEST_BPF is not set -# CONFIG_TEST_BLACKHOLE_DEV is not set -# CONFIG_FIND_BIT_BENCHMARK is not set -# CONFIG_TEST_FIRMWARE is not set -# CONFIG_TEST_SYSCTL is not set -# CONFIG_TEST_UDELAY is not set -# CONFIG_TEST_STATIC_KEYS is not set -# CONFIG_TEST_KMOD is not set -# CONFIG_TEST_MEMCAT_P is not set -# CONFIG_TEST_STACKINIT is not set -# CONFIG_TEST_MEMINIT is not set -# CONFIG_TEST_FREE_PAGES is not set -# CONFIG_MEMTEST is not set -# end of Kernel Testing and Coverage - -# -# Rust hacking -# -# end of Rust hacking -# end of Kernel hacking diff --git a/bsp/meta-rockchip/recipes-kernel/linux/files/ext4.cfg b/bsp/meta-rockchip/recipes-kernel/linux/files/ext4.cfg new file mode 100644 index 0000000000000000000000000000000000000000..7f2f33f2758a20523109adbc67f427fd3e824f1a --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux/files/ext4.cfg @@ -0,0 +1 @@ +CONFIG_EXT4_FS=y diff --git a/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip.inc b/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip.inc index b5ff7ba2ab00492ac107169abf0acdf40358755b..74990e6b6a0704a687e176b877955f25cc28c137 100644 --- a/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip.inc +++ b/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip.inc @@ -1,45 +1,59 @@ -# add recipes-kernel path to find patch and defconfig -FILESEXTRAPATHS:append := "${THISDIR}/files/:" -# add patch prebuild tools and logo -SRC_URI:append = " \ - file://config/ \ - file://patches/0000-rk3568-kernel.patch.gz;name=rk3568-kernel-patch \ - file://tools \ - file://logo \ -" - -# patches for ryd-3568 -SRC_URI:append:ryd-3568 = " \ - file://patches/0001-rk3568-8897-dts.patch \ - file://patches/0002-ryd-gpio-control.patch \ - " -# mcs patch for ok3568 devicetree -SRC_URI:append = " \ - ${@bb.utils.contains('MCS_FEATURES', 'openamp', 'file://patches/0003-ok3568-support-mcs.patch', '', d)} \ -" - -# more support of device is comming. so we documented this patch md5sum. -SRC_URI[rk3568-kernel-patch.md5sum] = "7643792b2483b3156dbc349d6fd41ef9" - -# add patch tool to solve patch apply -PATCHTOOL = "git" - -OPENEULER_KERNEL_CONFIG = "../config/${MACHINE}/defconfig-kernel" - -# add method to do_compile task to produce bootable Image -do_compile:append:rk3568(){ - cp ../logo/* ./ - scripts/mkkrnlimg ${KERNEL_OUTPUT_DIR}/Image kernel.img - ../tools/mkimg --dtb ${RK3568_KERNEL_DTB_NAME} - sed -e "s:path_to_kernel:${WORKDIR}\/build:g" -e "s:dtb_name:${RK3568_KERNEL_DTB_NAME}:g" \ - ${WORKDIR}/tools/its_config > .tmp_its_config - ../tools/mkimage -f .tmp_its_config -E -p 0x800 boot.img - rm -rf .tmp_its_config +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +inherit python3-dir + +DEPENDS:append = " openssl-native lz4-native ${PYTHON_PN}-native" + +LINUX_VERSION_EXTENSION ?= "-rockchip-${LINUX_KERNEL_TYPE}" + +PATCHPATH = "${THISDIR}/${BPN}_${LINUX_VERSION}" +inherit auto-patch + +KCONFIG_MODE ?= "--alldefconfig" + +# Make sure we use /usr/bin/env ${PYTHON_PN} for scripts +do_patch:append() { + for s in `grep -rIl python ${S}/scripts`; do + sed -i -e '1s|^#!.*python[23]*|#!/usr/bin/env ${PYTHON_PN}|' $s + done +} + +do_compile:prepend() { + export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${STAGING_LIBDIR_NATIVE} } -# add boot.img to $D -do_install:append(){ - cp ${B}/boot.img ${D}/boot +do_compile_kernelmodules:prepend() { + export PKG_CONFIG_DIR="${STAGING_DIR_NATIVE}${libdir_native}/pkgconfig" + export PKG_CONFIG_PATH="$PKG_CONFIG_DIR:${STAGING_DATADIR_NATIVE}/pkgconfig" + export PKG_CONFIG_LIBDIR="$PKG_CONFIG_DIR" + export PKG_CONFIG_SYSROOT_DIR="" + export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${STAGING_LIBDIR_NATIVE} +} + +# Hack for rockchip style images +ROCKCHIP_KERNEL_IMAGES = "boot.img zboot.img" +KERNEL_IMAGETYPES:append = " ${ROCKCHIP_KERNEL_IMAGES}" +python () { + if not d.getVar('KERNEL_DEVICETREE'): + raise bb.parse.SkipPackage('KERNEL_DEVICETREE is not specified!') + + # Use rockchip stype target, which is '.img' + d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', ' ' + d.getVar('KERNEL_DEVICETREE').replace('rockchip/', '').replace('.dtb', '.img')); +} + +# Force regenerating defconfig +do_kernel_metadata:prepend() { + rm -f ${WORKDIR}/defconfig +} + +# Link rockchip style images +do_install:prepend() { + for image in ${ROCKCHIP_KERNEL_IMAGES};do + ln -sf ${B}/${image} ${B}/arch/${ARCH}/boot/ + done + + if [ "x${RK_USE_COMPRESSED_KERNEL}" = "x1" ]; then + ln -sf zboot.img ${B}/arch/${ARCH}/boot/boot.img + fi } -PACKAGES += "bootfile" -FILES:bootfile="/boot/boot.img" diff --git a/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_4.19.bb b/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_4.19.bb new file mode 100644 index 0000000000000000000000000000000000000000..1528574bc66369681db0e363079ffc3d7c8ecbe0 --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_4.19.bb @@ -0,0 +1,23 @@ +# Copyright (C) 2020, Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +require recipes-kernel/linux/linux-yocto.inc +require linux-rockchip.inc + +inherit freeze-rev local-git + +SRCREV = "9789c7416f009b1c7a064241a5f185b368b24732" +SRC_URI = " \ + git://github.com/JeffyCN/mirrors.git;protocol=https;nobranch=1;branch=kernel-4.19-2022_11_23; \ + file://${THISDIR}/files/cgroups.cfg \ +" + +LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814" + +KERNEL_VERSION_SANITY_SKIP = "1" +LINUX_VERSION ?= "4.19" + +SRC_URI:append = " ${@bb.utils.contains('IMAGE_FSTYPES', 'ext4', \ + 'file://${THISDIR}/files/ext4.cfg', \ + '', \ + d)}" diff --git a/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_4.19/0001-init-do_mounts.c-Retry-all-fs-after-failed-to-mount-.patch b/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_4.19/0001-init-do_mounts.c-Retry-all-fs-after-failed-to-mount-.patch new file mode 100644 index 0000000000000000000000000000000000000000..8249349b331b7ab319b255ea7e119bf1bd806193 --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_4.19/0001-init-do_mounts.c-Retry-all-fs-after-failed-to-mount-.patch @@ -0,0 +1,37 @@ +From f0e932ba0aa10ec7df49b4780c63cb94e95fed60 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 9 Nov 2018 12:14:29 +0800 +Subject: [PATCH 1/3] init/do_mounts.c: Retry all fs after failed to mount with + "rootfstype=" + +Retry all filesystems when failed to mount with specified ones. + +Change-Id: Ic1b794cc61d61f1d0715e3b32400b3e96b0dddea +Signed-off-by: Jeffy Chen +--- + init/do_mounts.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/init/do_mounts.c b/init/do_mounts.c +index e1c9afa9d8c9..3be38b2c9143 100644 +--- a/init/do_mounts.c ++++ b/init/do_mounts.c +@@ -420,6 +420,15 @@ void __init mount_block_root(char *name, int flags) + for (p = fs_names; *p; p += strlen(p)+1) + printk(" %s", p); + printk("\n"); ++ ++ /* Retry all filesystems when failed to mount with specified ones */ ++ if (root_fs_names) { ++ printk("Retrying all filesystems\n"); ++ root_fs_names = NULL; ++ get_fs_names(fs_names); ++ goto retry; ++ } ++ + #ifdef CONFIG_BLOCK + __bdevname(ROOT_DEV, b); + #endif +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_4.19/0002-HACK-drm-rockchip-Force-enable-legacy-cursor-update.patch b/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_4.19/0002-HACK-drm-rockchip-Force-enable-legacy-cursor-update.patch new file mode 100644 index 0000000000000000000000000000000000000000..f21d26557393dd5ad4a7fde86497ebb36d3fe116 --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_4.19/0002-HACK-drm-rockchip-Force-enable-legacy-cursor-update.patch @@ -0,0 +1,43 @@ +From ab13f3b1875859fd59d775d87feb42267b3b3d36 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 1 Apr 2022 21:50:28 +0800 +Subject: [PATCH 2/3] HACK: drm: rockchip: Force enable legacy-cursor-update + +For async commit. + +Change-Id: I36ea434a97cb3205441304795526ee7e028da4fd +Signed-off-by: Jeffy Chen +--- + drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 2 +- + drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +index 5eb926550f71..0f8c3d736628 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +@@ -2112,7 +2112,7 @@ rockchip_atomic_helper_update_plane(struct drm_plane *plane, + plane_state->src_w = src_w; + plane_state->src_h = src_h; + +- if (plane == crtc->cursor || vop_plane_state->async_commit) ++ if (1 || plane == crtc->cursor || vop_plane_state->async_commit) + state->legacy_cursor_update = true; + + ret = drm_atomic_commit(state); +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +index 032263858c58..919bff6b9ff0 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +@@ -3876,7 +3876,7 @@ rockchip_atomic_helper_update_plane(struct drm_plane *plane, + pstate->src_w = src_w; + pstate->src_h = src_h; + +- if (plane == crtc->cursor || vpstate->async_commit) ++ if (1 || plane == crtc->cursor || vpstate->async_commit) + state->legacy_cursor_update = true; + + ret = drm_atomic_commit(state); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_4.19/0003-HACK-drm-rockchip-Prefer-non-cluster-overlay-planes.patch b/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_4.19/0003-HACK-drm-rockchip-Prefer-non-cluster-overlay-planes.patch new file mode 100644 index 0000000000000000000000000000000000000000..600395b893dbb8a79f755b8616bebbb49cbde4c0 --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_4.19/0003-HACK-drm-rockchip-Prefer-non-cluster-overlay-planes.patch @@ -0,0 +1,52 @@ +From b4a3db1e30446eea1b2650101e410e47afc51bb6 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 1 Apr 2022 22:17:07 +0800 +Subject: [PATCH 3/3] HACK: drm: rockchip: Prefer non-cluster overlay planes + +Change-Id: I65d40b50c96921b644de4601188c0518c99c9d72 +Signed-off-by: Jeffy Chen +--- + drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +index 919bff6b9ff0..973631735fb8 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +@@ -7043,6 +7043,7 @@ static int vop2_create_crtc(struct vop2 *vop2) + bool be_used_for_primary_plane = false; + bool find_primary_plane = false; + bool bootloader_initialized = false; ++ bool use_cluster = false; + + /* all planes can attach to any crtc */ + possible_crtcs = (1 << vop2_data->nr_vps) - 1; +@@ -7234,9 +7235,13 @@ static int vop2_create_crtc(struct vop2 *vop2) + * create overlay planes of the leftover overlay win + * Create drm_planes for overlay windows with possible_crtcs restricted + */ ++add_overlay: + for (j = 0; j < vop2->registered_num_wins; j++) { + win = &vop2->win[j]; + ++ if (use_cluster != vop2_cluster_window(win)) ++ continue; ++ + if (win->type != DRM_PLANE_TYPE_OVERLAY) + continue; + /* +@@ -7265,6 +7270,11 @@ static int vop2_create_crtc(struct vop2 *vop2) + DRM_WARN("failed to init overlay plane %s, ret:%d\n", win->name, ret); + } + ++ if (!use_cluster) { ++ use_cluster = true; ++ goto add_overlay; ++ } ++ + return registered_num_crtcs; + } + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_4.4.bb b/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_4.4.bb new file mode 100644 index 0000000000000000000000000000000000000000..9c1780d55540b203e1b57d90fe937e5490702730 --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_4.4.bb @@ -0,0 +1,21 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +require recipes-kernel/linux/linux-yocto.inc +require linux-rockchip.inc + +inherit freeze-rev local-git + +SRCREV = "e7a4fc70448ca2f66b3df50cabe527916b42bdad" +SRC_URI = " \ + git://github.com/JeffyCN/mirrors.git;protocol=https;nobranch=1;branch=kernel-4.4-2022_11_23; \ + file://${THISDIR}/files/cgroups.cfg \ +" + +KERNEL_VERSION_SANITY_SKIP = "1" +LINUX_VERSION ?= "4.4" + +SRC_URI:append = " ${@bb.utils.contains('IMAGE_FSTYPES', 'ext4', \ + 'file://${THISDIR}/files/ext4.cfg', \ + '', \ + d)}" diff --git a/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_4.4/0001-init-do_mounts.c-Retry-all-fs-after-failed-to-mount-.patch b/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_4.4/0001-init-do_mounts.c-Retry-all-fs-after-failed-to-mount-.patch new file mode 100644 index 0000000000000000000000000000000000000000..9f132ed77429c3cbfccc15e60a29f4c48ac68aec --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_4.4/0001-init-do_mounts.c-Retry-all-fs-after-failed-to-mount-.patch @@ -0,0 +1,37 @@ +From fda6a6f528ba6f93b49f20217390f45b434a53e4 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 9 Nov 2018 12:14:29 +0800 +Subject: [PATCH] init/do_mounts.c: Retry all fs after failed to mount with + "rootfstype=" + +Retry all filesystems when failed to mount with specified ones. + +Change-Id: Ic1b794cc61d61f1d0715e3b32400b3e96b0dddea +Signed-off-by: Jeffy Chen +--- + init/do_mounts.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/init/do_mounts.c b/init/do_mounts.c +index 1902a1c80831..f521f6ac82c8 100644 +--- a/init/do_mounts.c ++++ b/init/do_mounts.c +@@ -431,6 +431,15 @@ retry: + for (p = fs_names; *p; p += strlen(p)+1) + printk(" %s", p); + printk("\n"); ++ ++ /* Retry all filesystems when failed to mount with specified ones */ ++ if (root_fs_names) { ++ printk("Retrying all filesystems\n"); ++ root_fs_names = NULL; ++ get_fs_names(fs_names); ++ goto retry; ++ } ++ + #ifdef CONFIG_BLOCK + __bdevname(ROOT_DEV, b); + #endif +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_5.10.bb b/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_5.10.bb new file mode 100644 index 0000000000000000000000000000000000000000..d05f4f0c62827098037bc8607e4df38d84caa131 --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_5.10.bb @@ -0,0 +1,23 @@ +# Copyright (C) 2021, Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +require recipes-kernel/linux/linux-yocto.inc +require linux-rockchip.inc + +inherit freeze-rev local-git + +SRCREV = "72de5a560a44fb81549f1da325a1b3e323a7aaf7" +SRC_URI = " \ + git://github.com/JeffyCN/mirrors.git;protocol=https;nobranch=1;branch=kernel-5.10-2022_01_10; \ + file://${THISDIR}/files/cgroups.cfg \ +" + +LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" + +KERNEL_VERSION_SANITY_SKIP = "1" +LINUX_VERSION ?= "5.10" + +SRC_URI:append = " ${@bb.utils.contains('IMAGE_FSTYPES', 'ext4', \ + 'file://${THISDIR}/files/ext4.cfg', \ + '', \ + d)}" diff --git a/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_5.10/0001-net-rkwifi-Fix-include-path-error.patch b/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_5.10/0001-net-rkwifi-Fix-include-path-error.patch new file mode 100644 index 0000000000000000000000000000000000000000..09971bd4e7bb76177b5d824f338290d08b339cc1 --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_5.10/0001-net-rkwifi-Fix-include-path-error.patch @@ -0,0 +1,27 @@ +From f943632bbaaa2eab09fd8842bb746511c05240b9 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 23 Dec 2021 15:08:52 +0800 +Subject: [PATCH 1/4] net/rkwifi: Fix include path error + +Change-Id: I3fae811b1ba46dacaa9c86dbdeabe801320e7445 +Signed-off-by: Jeffy Chen +--- + drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/Makefile b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/Makefile +index 5b147c9ff6e5..8c797086d9bb 100755 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/Makefile ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/Makefile +@@ -276,7 +276,7 @@ endif + endif + + ARCH ?= arm64 +-BCMDHD_ROOT = $(src) ++BCMDHD_ROOT = $(srctree)/$(src) + #$(warning "BCMDHD_ROOT=$(BCMDHD_ROOT)") + EXTRA_CFLAGS = $(DHDCFLAGS) + EXTRA_CFLAGS += -DDHD_COMPILED=\"$(BCMDHD_ROOT)\" +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_5.10/0002-init-do_mounts.c-Retry-all-fs-after-failed-to-mount-.patch b/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_5.10/0002-init-do_mounts.c-Retry-all-fs-after-failed-to-mount-.patch new file mode 100644 index 0000000000000000000000000000000000000000..470449481da0c01cc80af66f36c8cd174d4cd223 --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_5.10/0002-init-do_mounts.c-Retry-all-fs-after-failed-to-mount-.patch @@ -0,0 +1,52 @@ +From bf05d6b172ecce03323e86dc554b70115048a51f Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 9 Nov 2018 12:14:29 +0800 +Subject: [PATCH 2/4] init/do_mounts.c: Retry all fs after failed to mount with + "rootfstype=" + +Retry all filesystems when failed to mount with specified ones. + +Change-Id: Ic1b794cc61d61f1d0715e3b32400b3e96b0dddea +Signed-off-by: Jeffy Chen +--- + init/do_mounts.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/init/do_mounts.c b/init/do_mounts.c +index b5f9604d0c98..d85f60d79107 100644 +--- a/init/do_mounts.c ++++ b/init/do_mounts.c +@@ -423,12 +423,13 @@ static int __init do_mount_root(const char *name, const char *fs, + return ret; + } + +-void __init mount_block_root(char *name, int flags) ++void __init mount_block_root(char *name, int mountflags) + { + struct page *page = alloc_page(GFP_KERNEL); + char *fs_names = page_address(page); + char *p; + char b[BDEVNAME_SIZE]; ++ int flags = mountflags; + + scnprintf(b, BDEVNAME_SIZE, "unknown-block(%u,%u)", + MAJOR(ROOT_DEV), MINOR(ROOT_DEV)); +@@ -464,6 +465,15 @@ void __init mount_block_root(char *name, int flags) + goto retry; + } + ++ /* Retry all filesystems when failed to mount with specified ones */ ++ if (root_fs_names) { ++ printk("Retrying all filesystems\n"); ++ root_fs_names = NULL; ++ get_fs_names(fs_names); ++ flags = mountflags; ++ goto retry; ++ } ++ + printk("List of all partitions:\n"); + printk_all_partitions(); + printk("No filesystem could mount root, tried: "); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_5.10/0003-HACK-drm-rockchip-Force-enable-legacy-cursor-update.patch b/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_5.10/0003-HACK-drm-rockchip-Force-enable-legacy-cursor-update.patch new file mode 100644 index 0000000000000000000000000000000000000000..bb69caf4a897b3fecd2b0c489a28dd2fe2ae6600 --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_5.10/0003-HACK-drm-rockchip-Force-enable-legacy-cursor-update.patch @@ -0,0 +1,43 @@ +From 090375cacef9dea2116a8c4673143c1eec5c3456 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 1 Apr 2022 21:50:28 +0800 +Subject: [PATCH 3/4] HACK: drm: rockchip: Force enable legacy-cursor-update + +For async commit. + +Change-Id: I36ea434a97cb3205441304795526ee7e028da4fd +Signed-off-by: Jeffy Chen +--- + drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 2 +- + drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +index 4e679e7e61d8..f531e2e1a90f 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +@@ -2146,7 +2146,7 @@ rockchip_atomic_helper_update_plane(struct drm_plane *plane, + plane_state->src_w = src_w; + plane_state->src_h = src_h; + +- if (plane == crtc->cursor || vop_plane_state->async_commit) ++ if (1 || plane == crtc->cursor || vop_plane_state->async_commit) + state->legacy_cursor_update = true; + + ret = drm_atomic_commit(state); +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +index 91e6433870a7..9f94836ac6c1 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +@@ -4678,7 +4678,7 @@ rockchip_atomic_helper_update_plane(struct drm_plane *plane, + pstate->src_w = src_w; + pstate->src_h = src_h; + +- if (plane == crtc->cursor || vpstate->async_commit) ++ if (1 || plane == crtc->cursor || vpstate->async_commit) + state->legacy_cursor_update = true; + + ret = drm_atomic_commit(state); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_5.10/0004-HACK-drm-rockchip-Prefer-non-cluster-overlay-planes.patch b/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_5.10/0004-HACK-drm-rockchip-Prefer-non-cluster-overlay-planes.patch new file mode 100644 index 0000000000000000000000000000000000000000..824a7dc89f03c87c3f44ddc5052db8b9988c6717 --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/linux/linux-rockchip_5.10/0004-HACK-drm-rockchip-Prefer-non-cluster-overlay-planes.patch @@ -0,0 +1,52 @@ +From c756473169d054f315b6ecd81d2dabcdd074aee4 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 1 Apr 2022 22:17:07 +0800 +Subject: [PATCH 4/4] HACK: drm: rockchip: Prefer non-cluster overlay planes + +Change-Id: I65d40b50c96921b644de4601188c0518c99c9d72 +Signed-off-by: Jeffy Chen +--- + drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +index 9f94836ac6c1..a40b42cdd2b0 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +@@ -8730,6 +8730,7 @@ static int vop2_create_crtc(struct vop2 *vop2) + bool find_primary_plane = false; + bool bootloader_initialized = false; + struct rockchip_drm_private *private = drm_dev->dev_private; ++ bool use_cluster = false; + + /* all planes can attach to any crtc */ + possible_crtcs = (1 << vop2_data->nr_vps) - 1; +@@ -8932,9 +8933,13 @@ static int vop2_create_crtc(struct vop2 *vop2) + * create overlay planes of the leftover overlay win + * Create drm_planes for overlay windows with possible_crtcs restricted + */ ++add_overlay: + for (j = 0; j < vop2->registered_num_wins; j++) { + win = &vop2->win[j]; + ++ if (use_cluster != vop2_cluster_window(win)) ++ continue; ++ + if (win->type != DRM_PLANE_TYPE_OVERLAY) + continue; + /* +@@ -8961,6 +8966,11 @@ static int vop2_create_crtc(struct vop2 *vop2) + DRM_WARN("failed to init overlay plane %s\n", win->name); + } + ++ if (!use_cluster) { ++ use_cluster = true; ++ goto add_overlay; ++ } ++ + return registered_num_crtcs; + } + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-kernel/perf/perf.bbappend b/bsp/meta-rockchip/recipes-kernel/perf/perf.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..ef5f0619e1de938d0a0877be716545544b4fac0d --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/perf/perf.bbappend @@ -0,0 +1,6 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +# Override EXTRA_CFLAGSS and add -Wno-stringop-truncation for gcc 8+ +EXTRA_OEMAKE:append = ' EXTRA_CFLAGS="-ldw -Wno-stringop-truncation"' +PERF_SRC:append = " include/" diff --git a/bsp/meta-rockchip/recipes-kernel/rkwifibt-firmware/rkwifibt-firmware.bb b/bsp/meta-rockchip/recipes-kernel/rkwifibt-firmware/rkwifibt-firmware.bb new file mode 100644 index 0000000000000000000000000000000000000000..8509dbfc980acc6499fbae269ca17ee35e431ff9 --- /dev/null +++ b/bsp/meta-rockchip/recipes-kernel/rkwifibt-firmware/rkwifibt-firmware.bb @@ -0,0 +1,137 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +SUMMARY = "Rockchip WIFI/BT firmware files" +SECTION = "kernel" + +LICENSE = "LICENSE.rockchip" +LIC_FILES_CHKSUM = "file://${RKBASE}/licenses/LICENSE.rockchip;md5=d63890e209bf038f44e708bbb13e4ed9" + +inherit freeze-rev local-git + +SRCREV = "54d05e00e73a91c14c86005e86fff45fa094203e" +SRC_URI = "git://github.com/JeffyCN/mirrors.git;protocol=https;branch=rkwifibt;" + +S = "${WORKDIR}/git" + +inherit allarch deploy + +do_install() { + install -d ${D}/lib/firmware/rtlbt/ + + cp -u $(find ${S}/firmware/ -type f) ${D}/lib/firmware/ + ln -rsf ${D}/lib/firmware/*rtl*_* ${D}/lib/firmware/rtlbt/ +} + +PACKAGES =+ " \ + ${PN}-ap6181-wifi \ + ${PN}-ap6212a1-wifi \ + ${PN}-ap6212a1-bt \ + ${PN}-ap6236-wifi \ + ${PN}-ap6236-bt \ + ${PN}-ap6255-wifi \ + ${PN}-ap6255-bt \ + ${PN}-ap6275p-wifi \ + ${PN}-ap6275s-wifi \ + ${PN}-ap6275-bt \ + ${PN}-ap6354-wifi \ + ${PN}-ap6354-bt \ + ${PN}-ap6356-wifi \ + ${PN}-ap6356-bt \ + ${PN}-ap6398s-wifi \ + ${PN}-ap6398s-bt \ + ${PN}-rtl8723ds-bt \ +" + +FILES:${PN}-ap6181-wifi = " \ + lib/firmware/fw_bcm40181a2_apsta.bin \ + lib/firmware/fw_bcm40181a2.bin \ + lib/firmware/nvram_ap6181.txt \ +" + +FILES:${PN}-ap6212a1-wifi = " \ + lib/firmware/fw_bcm43438a1_apsta.bin \ + lib/firmware/fw_bcm43438a1.bin \ + lib/firmware/nvram_ap6212a.txt \ +" +FILES:${PN}-ap6212a1-bt = " \ + lib/firmware/BCM43430A1.hcd \ +" + +FILES:${PN}-ap6236-wifi = " \ + lib/firmware/fw_bcm43436b0_apsta.bin \ + lib/firmware/fw_bcm43436b0.bin \ + lib/firmware/nvram_ap6236.txt \ +" +FILES:${PN}-ap6236-bt = " \ + lib/firmware/BCM43430B0.hcd \ +" + +FILES:${PN}-ap6255-wifi = " \ + lib/firmware/fw_bcm43455c0_ag.bin \ + lib/firmware/nvram_ap6255.txt \ +" +FILES:${PN}-ap6255-bt = " \ + lib/firmware/BCM4345C0_ap.hcd \ + lib/firmware/BCM4345C0.hcd \ +" + +FILES:${PN}-ap6275p-wifi = " \ + lib/firmware/fw_bcm43752a2_pcie_ag_apsta.bin \ + lib/firmware/fw_bcm43752a2_pcie_ag_mfg.bin \ + lib/firmware/clm_bcm43752a2_pcie_ag.blob \ + lib/firmware/fw_bcm43752a2_pcie_ag.bin \ + lib/firmware/nvram_AP6275P.txt \ +" +FILES:${PN}-ap6275s-wifi = " \ + lib/firmware/fw_bcm43752a2_ag_apsta.bin \ + lib/firmware/fw_bcm43752a2_ag_mfg.bin \ + lib/firmware/clm_bcm43752a2_ag.blob \ + lib/firmware/fw_bcm43752a2_ag.bin \ + lib/firmware/nvram_ap6275s.txt \ +" +FILES:${PN}-ap6275-bt = " \ + lib/firmware/BCM4362A2.hcd \ +" + +FILES:${PN}-ap6354-wifi = " \ + lib/firmware/fw_bcm4354a1_ag.bin \ + lib/firmware/nvram_ap6354.txt \ +" +FILES:${PN}-ap6354-bt = " \ + lib/firmware/BCM4350C0.hcd \ +" + +FILES:${PN}-ap6356-wifi = " \ + lib/firmware/fw_bcm4356a2_ag.bin \ + lib/firmware/nvram_ap6356.txt \ + lib/firmware/nvram_ap6356s.txt \ +" +FILES:${PN}-ap6356-bt = " \ + lib/firmware/BCM4354A2.hcd \ +" + +FILES:${PN}-ap6398s-wifi = " \ + lib/firmware/fw_bcm4359c0_ag.bin \ + lib/firmware/fw_bcm4359c0_ag_mfg.bin \ + lib/firmware/nvram_ap6398s.txt \ +" +FILES:${PN}-ap6398s-bt = " \ + lib/firmware/BCM4359C0.hcd \ +" + +FILES:${PN}-rtl8723ds-bt = " \ + lib/firmware/rtlbt/rtl8723d_config \ + lib/firmware/rtlbt/rtl8723d_fw \ +" + +FILES:${PN} = "*" + +# Make it depend on all of the split-out packages. +python () { + pn = d.getVar('PN') + firmware_pkgs = oe.utils.packages_filter_out_system(d) + d.appendVar('RDEPENDS:' + pn, ' ' + ' '.join(firmware_pkgs)) +} + +INSANE_SKIP:${PN}:append = " arch" diff --git a/bsp/meta-rockchip/recipes-mcs/mcs-linux/mcs-linux.bbappend b/bsp/meta-rockchip/recipes-mcs/mcs-linux/mcs-linux.bbappend deleted file mode 100644 index 0e8522ee3c9bb954ca3e69f5ee5ce323a1585d1d..0000000000000000000000000000000000000000 --- a/bsp/meta-rockchip/recipes-mcs/mcs-linux/mcs-linux.bbappend +++ /dev/null @@ -1,11 +0,0 @@ -# adapted for ok3568 -EXTRA_OECMAKE = " \ - -DDEMO_TARGET=openamp_demo \ - " -do_install:append(){ - install -d ${D}/firmware - - install -D ${S}/openamp_demo/rtthread-ok3568.bin ${D}/firmware/ -} - -FILES:${PN} += "/firmware" diff --git a/bsp/meta-rockchip/recipes-multimedia/alsa/rockchip-alsa-config.bb b/bsp/meta-rockchip/recipes-multimedia/alsa/rockchip-alsa-config.bb new file mode 100644 index 0000000000000000000000000000000000000000..90912d6a3c45246c82f5800448be2e8d72195c5b --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/alsa/rockchip-alsa-config.bb @@ -0,0 +1,20 @@ +# Copyright (C) 2020, Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +DESCRIPTION = "Rockchip ALSA config files" +SECTION = "multimedia" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://NOTICE;md5=9645f39e9db895a4aa6e02cb57294595" + +inherit freeze-rev local-git + +SRC_URI = " \ + git://github.com/JeffyCN/mirrors.git;protocol=https;branch=alsa-config; \ +" +SRCREV = "1e0c4b5382b84ed629b1ca9e40c814103b92ee93" +S = "${WORKDIR}/git" + +inherit meson + +FILES:${PN} = "*" diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer-rockchip/gstreamer1.0-rockchip.bb b/bsp/meta-rockchip/recipes-multimedia/gstreamer-rockchip/gstreamer1.0-rockchip.bb new file mode 100644 index 0000000000000000000000000000000000000000..c3e22d0eaf6ee981d68e677afa5b4bb80aa42095 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer-rockchip/gstreamer1.0-rockchip.bb @@ -0,0 +1,31 @@ +# Copyright (C) 2016 - 2017 Randy Li +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the GNU GENERAL PUBLIC LICENSE Version 2 +# (see COPYING.GPLv2 for the terms) + +include recipes-multimedia/gstreamer/gst-plugins-package.inc +include recipes-multimedia/gstreamer/gstreamer1.0-plugins-packaging.inc + +DESCRIPTION = "GStreamer 1.0 plugins for Rockchip platforms" + +LICENSE = "LGPL-2.1-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" +DEPENDS:append = " gstreamer1.0-plugins-base" + +inherit freeze-rev local-git + +SRCREV = "2ed1e68b0aa77728b1d493344d8e62a04b1b64e0" +SRC_URI = "git://github.com/JeffyCN/mirrors.git;protocol=https;branch=gstreamer-rockchip;" + +S = "${WORKDIR}/git" + +PATCHPATH = "${THISDIR}/files" +inherit auto-patch + +inherit meson pkgconfig + +PACKAGECONFIG ??= "mpp ${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)} rga" + +PACKAGECONFIG[mpp] = "-Drockchipmpp=enabled,-Drockchipmpp=disabled,rockchip-mpp" +PACKAGECONFIG[x11] = "-Drkximage=enabled,-Drkximage=disabled,libx11 libdrm" +PACKAGECONFIG[rga] = "-Drga=enabled,-Drga=disabled,rockchip-librga" diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_%.bbappend b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_%.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..ae05c541c093ae03fc7688f30bae257b37d1a152 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_%.bbappend @@ -0,0 +1,7 @@ +# Copyright (c) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) +# +MAJ_VER = "${@oe.utils.trim_version("${PV}", 2)}" +PATCHPATH = "${CURDIR}/${BPN}_${MAJ_VER}" + +inherit auto-patch diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0001-fix-h265_parser-read-vui-error.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0001-fix-h265_parser-read-vui-error.patch new file mode 100644 index 0000000000000000000000000000000000000000..bfde157ccdde1961c6a3c41ba5916eb73d905fb5 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0001-fix-h265_parser-read-vui-error.patch @@ -0,0 +1,34 @@ +From dca295af34ac5f3b2f9993063acb3146d56ae2ec Mon Sep 17 00:00:00 2001 +From: "james.lin" +Date: Mon, 9 Apr 2018 15:32:21 +0800 +Subject: [PATCH 01/33] fix h265_parser read vui error + +Signed-off-by: Jeffy Chen +--- + gst-libs/gst/codecparsers/gsth265parser.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/gst-libs/gst/codecparsers/gsth265parser.c b/gst-libs/gst/codecparsers/gsth265parser.c +index 74fc25c..72db27b 100644 +--- a/gst-libs/gst/codecparsers/gsth265parser.c ++++ b/gst-libs/gst/codecparsers/gsth265parser.c +@@ -590,11 +590,11 @@ gst_h265_parse_vui_parameters (GstH265SPS * sps, NalReader * nr) + READ_UINT8 (nr, vui->tiles_fixed_structure_flag, 1); + READ_UINT8 (nr, vui->motion_vectors_over_pic_boundaries_flag, 1); + READ_UINT8 (nr, vui->restricted_ref_pic_lists_flag, 1); +- READ_UE_MAX (nr, vui->min_spatial_segmentation_idc, 4096); +- READ_UE_MAX (nr, vui->max_bytes_per_pic_denom, 16); +- READ_UE_MAX (nr, vui->max_bits_per_min_cu_denom, 16); +- READ_UE_MAX (nr, vui->log2_max_mv_length_horizontal, 16); +- READ_UE_MAX (nr, vui->log2_max_mv_length_vertical, 15); ++ READ_UE (nr, vui->min_spatial_segmentation_idc); ++ READ_UE (nr, vui->max_bytes_per_pic_denom); ++ READ_UE (nr, vui->max_bits_per_min_cu_denom); ++ READ_UE (nr, vui->log2_max_mv_length_horizontal); ++ READ_UE (nr, vui->log2_max_mv_length_vertical); + } + + return TRUE; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0002-interim-fix-vc1-stream-may-memory-leak-when-pending.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0002-interim-fix-vc1-stream-may-memory-leak-when-pending.patch new file mode 100644 index 0000000000000000000000000000000000000000..559296b0276d53b1f412f12f04fa8f69b0c842ab --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0002-interim-fix-vc1-stream-may-memory-leak-when-pending.patch @@ -0,0 +1,33 @@ +From 4482a87d25acc8eb0362492b6604a3f7163ef245 Mon Sep 17 00:00:00 2001 +From: "james.lin" +Date: Tue, 17 Apr 2018 11:14:01 +0800 +Subject: [PATCH 02/33] interim fix vc1 stream may memory leak when pending + +Signed-off-by: james.lin +Signed-off-by: Jeffy Chen +--- + gst/mpegtsdemux/tsdemux.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c +index 73e1c06..9aaa968 100644 +--- a/gst/mpegtsdemux/tsdemux.c ++++ b/gst/mpegtsdemux/tsdemux.c +@@ -3446,6 +3446,14 @@ gst_ts_demux_push_pending_data (GstTSDemux * demux, TSDemuxStream * stream, + + if (G_UNLIKELY (stream->pending_ts && !check_pending_buffers (demux))) { + if (buffer) { ++ GList *walk; ++ for (walk = demux->program->stream_list; walk; walk = g_list_next (walk)) { ++ MpegTSBaseStream *bs = (MpegTSBaseStream*)walk->data; ++ if (bs->registration_id == DRF_ID_VC1) { ++ gst_buffer_unref(buffer); ++ goto beach; ++ } ++ } + PendingBuffer *pend; + pend = g_slice_new0 (PendingBuffer); + pend->buffer = buffer; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0003-waylandsink-release-frame-callback-when-finalizing.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0003-waylandsink-release-frame-callback-when-finalizing.patch new file mode 100644 index 0000000000000000000000000000000000000000..9dc587a5a66bb2c5dc1a6f1ca02d4e1a33fc395f --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0003-waylandsink-release-frame-callback-when-finalizing.patch @@ -0,0 +1,26 @@ +From dfe0caadfa76bf089bbaf62937d1a46d47a5c311 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 26 Nov 2020 11:31:58 +0800 +Subject: [PATCH 03/33] waylandsink: release frame callback when finalizing + +Signed-off-by: Jeffy Chen +--- + ext/wayland/gstwaylandsink.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c +index 0761304..ff8a7f5 100644 +--- a/ext/wayland/gstwaylandsink.c ++++ b/ext/wayland/gstwaylandsink.c +@@ -287,6 +287,8 @@ gst_wayland_sink_finalize (GObject * object) + + GST_DEBUG_OBJECT (sink, "Finalizing the sink.."); + ++ if (sink->callback) ++ wl_callback_destroy (sink->callback); + if (sink->last_buffer) + gst_buffer_unref (sink->last_buffer); + if (sink->display) +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0004-kmssink-Support-render-rectangle-for-plane.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0004-kmssink-Support-render-rectangle-for-plane.patch new file mode 100644 index 0000000000000000000000000000000000000000..ba0819bb7680b3a3b1c3187f0be084011da9a6da --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0004-kmssink-Support-render-rectangle-for-plane.patch @@ -0,0 +1,43 @@ +From f9ad5d9c8e1a5c364c3d7bfa10c5f7723e3341da Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 20 Nov 2018 17:33:22 +0800 +Subject: [PATCH 04/33] kmssink: Support render rectangle for plane + +Signed-off-by: Jeffy Chen +--- + sys/kms/gstkmssink.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/sys/kms/gstkmssink.c b/sys/kms/gstkmssink.c +index 788cefc..53bf4a1 100644 +--- a/sys/kms/gstkmssink.c ++++ b/sys/kms/gstkmssink.c +@@ -471,6 +471,9 @@ configure_mode_setting (GstKMSSink * self, GstVideoInfo * vinfo) + if (err) + goto modesetting_failed; + ++ self->hdisplay = mode->hdisplay; ++ self->vdisplay = mode->vdisplay; ++ + g_clear_pointer (&self->tmp_kmsmem, gst_memory_unref); + self->tmp_kmsmem = (GstMemory *) kmsmem; + +@@ -1606,7 +1609,14 @@ gst_kms_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf) + GST_OBJECT_LOCK (self); + if (self->modesetting_enabled) { + self->buffer_id = fb_id; +- goto sync_frame; ++ ++ if (!self->render_rect.w || !self->render_rect.h) ++ goto sync_frame; ++ ++ if (!self->render_rect.x && !self->render_rect.y && ++ self->render_rect.w == self->hdisplay && ++ self->render_rect.h == self->vdisplay) ++ goto sync_frame; + } + + if ((crop = gst_buffer_get_video_crop_meta (buffer))) { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0005-kmssink-Request-window-handle.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0005-kmssink-Request-window-handle.patch new file mode 100644 index 0000000000000000000000000000000000000000..4fbd3933ea72c45a273a2b403b148e5acc0f72af --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0005-kmssink-Request-window-handle.patch @@ -0,0 +1,63 @@ +From 445998e2ff286e38d1113dd47fabca0b99bcc49c Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 20 Jun 2019 12:43:20 +0800 +Subject: [PATCH 05/33] kmssink: Request window handle + +Signed-off-by: Jeffy Chen +--- + sys/kms/gstkmssink.c | 13 +++++++++++++ + sys/kms/gstkmssink.h | 2 ++ + 2 files changed, 15 insertions(+) + +diff --git a/sys/kms/gstkmssink.c b/sys/kms/gstkmssink.c +index 53bf4a1..0cb2bb6 100644 +--- a/sys/kms/gstkmssink.c ++++ b/sys/kms/gstkmssink.c +@@ -165,11 +165,22 @@ gst_kms_sink_expose (GstVideoOverlay * overlay) + gst_kms_sink_show_frame (GST_VIDEO_SINK (self), NULL); + } + ++static void ++gst_kms_sink_set_window_handle (GstVideoOverlay * overlay, guintptr handle) ++{ ++ GstKMSSink *self = GST_KMS_SINK (overlay); ++ ++ g_return_if_fail (self != NULL); ++ ++ self->window_handle = handle; ++} ++ + static void + gst_kms_sink_video_overlay_init (GstVideoOverlayInterface * iface) + { + iface->expose = gst_kms_sink_expose; + iface->set_render_rectangle = gst_kms_sink_set_render_rectangle; ++ iface->set_window_handle = gst_kms_sink_set_window_handle; + } + + static int +@@ -1160,6 +1171,8 @@ gst_kms_sink_set_caps (GstBaseSink * bsink, GstCaps * caps) + } + GST_OBJECT_UNLOCK (self); + ++ gst_video_overlay_prepare_window_handle (GST_VIDEO_OVERLAY (bsink)); ++ + GST_DEBUG_OBJECT (self, "negotiated caps = %" GST_PTR_FORMAT, caps); + + return TRUE; +diff --git a/sys/kms/gstkmssink.h b/sys/kms/gstkmssink.h +index 428c057..0fccfa2 100644 +--- a/sys/kms/gstkmssink.h ++++ b/sys/kms/gstkmssink.h +@@ -93,6 +93,8 @@ struct _GstKMSSink { + /* reconfigure info if driver doesn't scale */ + GstVideoRectangle pending_rect; + gboolean reconfigure; ++ ++ guintptr window_handle; + }; + + struct _GstKMSSinkClass { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0006-waylandsink-Support-place-below-above.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0006-waylandsink-Support-place-below-above.patch new file mode 100644 index 0000000000000000000000000000000000000000..a22ece348d79df64d89c316fd241d15f1d3a9908 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0006-waylandsink-Support-place-below-above.patch @@ -0,0 +1,40 @@ +From 4c27748d13263756aaf2fb3efaab723e6ce993f8 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 15 Jun 2020 10:01:54 +0800 +Subject: [PATCH 06/33] waylandsink: Support place below/above + +Set environment WAYLANDSINK_PLACE_ABOVE=1 to place it above parent. + +Signed-off-by: Jeffy Chen +--- + ext/wayland/wlwindow.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/ext/wayland/wlwindow.c b/ext/wayland/wlwindow.c +index 66df0fc..57b5491 100644 +--- a/ext/wayland/wlwindow.c ++++ b/ext/wayland/wlwindow.c +@@ -24,6 +24,8 @@ + #include + #endif + ++#include ++ + #include "wlwindow.h" + #include "wlshmallocator.h" + #include "wlbuffer.h" +@@ -357,6 +359,11 @@ gst_wl_window_new_in_surface (GstWlDisplay * display, + window->area_surface, parent); + wl_subsurface_set_desync (window->area_subsurface); + ++ if (g_getenv ("WAYLANDSINK_PLACE_ABOVE")) ++ wl_subsurface_place_above (window->area_subsurface, parent); ++ else ++ wl_subsurface_place_below (window->area_subsurface, parent); ++ + wl_surface_commit (parent); + + return window; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0007-waylandsink-Enable-changing-window-handle.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0007-waylandsink-Enable-changing-window-handle.patch new file mode 100644 index 0000000000000000000000000000000000000000..7210f3916ab2835cf8a79d1b86388d524d351709 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0007-waylandsink-Enable-changing-window-handle.patch @@ -0,0 +1,93 @@ +From 8a6691696ff6d98cfe31f47122b1da9addb9f73c Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 25 Dec 2018 16:20:35 +0800 +Subject: [PATCH 07/33] waylandsink: Enable changing window handle + +Changing window handle is dangerous, but we need this feature for: +https://redmine.rockchip.com.cn/issues/184629 + +Signed-off-by: Jeffy Chen +--- + ext/wayland/gstwaylandsink.c | 22 ++++++++++++++++------ + ext/wayland/gstwaylandsink.h | 2 ++ + 2 files changed, 18 insertions(+), 6 deletions(-) + +diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c +index ff8a7f5..9e55e4f 100644 +--- a/ext/wayland/gstwaylandsink.c ++++ b/ext/wayland/gstwaylandsink.c +@@ -675,9 +675,10 @@ render_last_buffer (GstWaylandSink * sink, gboolean redraw) + sink->callback = callback; + wl_callback_add_listener (callback, &frame_callback_listener, sink); + +- if (G_UNLIKELY (sink->video_info_changed && !redraw)) { ++ if (G_UNLIKELY ((sink->video_info_changed && !redraw) || sink->resend_info)) { + info = &sink->video_info; + sink->video_info_changed = FALSE; ++ sink->resend_info = FALSE; + } + gst_wl_window_render (sink->window, wlbuffer, info); + } +@@ -941,18 +942,21 @@ gst_wayland_sink_set_window_handle (GstVideoOverlay * overlay, guintptr handle) + + g_return_if_fail (sink != NULL); + +- if (sink->window != NULL) { +- GST_WARNING_OBJECT (sink, "changing window handle is not supported"); ++ if (sink->window_handle == handle) + return; +- } ++ ++ sink->window_handle = handle; + + g_mutex_lock (&sink->render_lock); + ++ if (sink->window != NULL) { ++ GST_WARNING_OBJECT (sink, "changing window handle is dangerous"); ++ g_clear_object (&sink->window); ++ } ++ + GST_DEBUG_OBJECT (sink, "Setting window handle %" GST_PTR_FORMAT, + (void *) handle); + +- g_clear_object (&sink->window); +- + if (handle) { + if (G_LIKELY (gst_wayland_sink_find_display (sink))) { + /* we cannot use our own display with an external window handle */ +@@ -965,6 +969,12 @@ gst_wayland_sink_set_window_handle (GstVideoOverlay * overlay, guintptr handle) + } else { + sink->window = gst_wl_window_new_in_surface (sink->display, surface, + &sink->render_lock); ++ ++ if (sink->last_buffer) { ++ /* Resend video info to force resize video surface */ ++ sink->resend_info = TRUE; ++ sink->redraw_pending = FALSE; ++ } + } + } else { + GST_ERROR_OBJECT (sink, "Failed to find display handle, " +diff --git a/ext/wayland/gstwaylandsink.h b/ext/wayland/gstwaylandsink.h +index 7aabb6f..1c5fb07 100644 +--- a/ext/wayland/gstwaylandsink.h ++++ b/ext/wayland/gstwaylandsink.h +@@ -57,6 +57,7 @@ struct _GstWaylandSink + GstWlWindow *window; + GstBufferPool *pool; + gboolean use_dmabuf; ++ guintptr window_handle; + + gboolean video_info_changed; + GstVideoInfo video_info; +@@ -64,6 +65,7 @@ struct _GstWaylandSink + + gchar *display_name; + ++ gboolean resend_info; + gboolean redraw_pending; + GMutex render_lock; + GstBuffer *last_buffer; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0008-kmssink-Support-setting-plane-zpos.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0008-kmssink-Support-setting-plane-zpos.patch new file mode 100644 index 0000000000000000000000000000000000000000..1dd548d2bdcfe3a4ceef2c96b9a0b029c75f620e --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0008-kmssink-Support-setting-plane-zpos.patch @@ -0,0 +1,142 @@ +From d0308f183afba93079dc3fc09ee498aee36581c1 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 15 Jun 2020 10:03:01 +0800 +Subject: [PATCH 08/33] kmssink: Support setting plane zpos + +Set env KMSSINK_PLANE_ZPOS to specify plane zpos. +Set env KMSSINK_PLANE_ON_TOP to set max zpos. +Set env KMSSINK_PLANE_ON_BOTTOM to set min zpos. + +Default zpos is max. + +Signed-off-by: Jeffy Chen +--- + sys/kms/gstkmssink.c | 78 ++++++++++++++++++++++++++++++++++++++++++++ + sys/kms/gstkmssink.h | 1 + + 2 files changed, 79 insertions(+) + +diff --git a/sys/kms/gstkmssink.c b/sys/kms/gstkmssink.c +index 0cb2bb6..b84657c 100644 +--- a/sys/kms/gstkmssink.c ++++ b/sys/kms/gstkmssink.c +@@ -722,6 +722,76 @@ gst_kms_sink_update_plane_properties (GstKMSSink * self) + gst_kms_sink_update_properties (&iter, self->plane_props); + } + ++static void ++gst_kms_sink_configure_plane_zpos (GstKMSSink * self, gboolean restore) ++{ ++ drmModeObjectPropertiesPtr props = NULL; ++ drmModePropertyPtr prop = NULL; ++ drmModeResPtr res = NULL; ++ guint64 min, max, zpos; ++ const gchar *buf; ++ gint i; ++ ++ if (self->plane_id <= 0) ++ return; ++ ++ if (drmSetClientCap (self->fd, DRM_CLIENT_CAP_ATOMIC, 1)) ++ return; ++ ++ res = drmModeGetResources (self->fd); ++ if (!res) ++ return; ++ ++ props = drmModeObjectGetProperties (self->fd, self->plane_id, ++ DRM_MODE_OBJECT_PLANE); ++ if (!props) ++ goto out; ++ ++ for (i = 0; i < props->count_props; i++) { ++ prop = drmModeGetProperty (self->fd, props->props[i]); ++ if (prop && !strcmp (prop->name, "ZPOS")) ++ break; ++ drmModeFreeProperty (prop); ++ prop = NULL; ++ } ++ ++ if (!prop) ++ goto out; ++ ++ min = prop->values[0]; ++ max = prop->values[1]; ++ ++ if (restore) { ++ if (self->saved_zpos < 0) ++ goto out; ++ ++ zpos = self->saved_zpos; ++ } else { ++ zpos = min + 1; ++ ++ buf = g_getenv ("KMSSINK_PLANE_ZPOS"); ++ if (buf) ++ zpos = atoi (buf); ++ else if (g_getenv ("KMSSINK_PLANE_ON_TOP")) ++ zpos = max; ++ else if (g_getenv ("KMSSINK_PLANE_ON_BOTTOM")) ++ zpos = min; ++ } ++ ++ GST_INFO_OBJECT (self, "set plane zpos = %lu (%lu~%lu)", zpos, min, max); ++ ++ if (self->saved_zpos < 0) ++ self->saved_zpos = props->prop_values[i]; ++ ++ drmModeObjectSetProperty (self->fd, self->plane_id, ++ DRM_MODE_OBJECT_PLANE, props->props[i], zpos); ++ ++out: ++ drmModeFreeProperty (prop); ++ drmModeFreeObjectProperties (props); ++ drmModeFreeResources (res); ++} ++ + static gboolean + gst_kms_sink_start (GstBaseSink * bsink) + { +@@ -802,6 +872,8 @@ retry_find_plane: + self->crtc_id = crtc->crtc_id; + self->plane_id = plane->plane_id; + ++ gst_kms_sink_configure_plane_zpos (self, FALSE); ++ + GST_INFO_OBJECT (self, "connector id = %d / crtc id = %d / plane id = %d", + self->conn_id, self->crtc_id, self->plane_id); + +@@ -936,6 +1008,11 @@ gst_kms_sink_stop (GstBaseSink * bsink) + if (self->allocator) + gst_kms_allocator_clear_cache (self->allocator); + ++ if (self->saved_zpos >= 0) { ++ gst_kms_sink_configure_plane_zpos (self, TRUE); ++ self->saved_zpos = -1; ++ } ++ + gst_buffer_replace (&self->last_buffer, NULL); + gst_caps_replace (&self->allowed_caps, NULL); + gst_object_replace ((GstObject **) & self->pool, NULL); +@@ -1931,6 +2008,7 @@ gst_kms_sink_init (GstKMSSink * sink) + sink->fd = -1; + sink->conn_id = -1; + sink->plane_id = -1; ++ sink->saved_zpos = -1; + sink->can_scale = TRUE; + gst_poll_fd_init (&sink->pollfd); + sink->poll = gst_poll_new (TRUE); +diff --git a/sys/kms/gstkmssink.h b/sys/kms/gstkmssink.h +index 0fccfa2..45a9c08 100644 +--- a/sys/kms/gstkmssink.h ++++ b/sys/kms/gstkmssink.h +@@ -53,6 +53,7 @@ struct _GstKMSSink { + gint crtc_id; + gint plane_id; + guint pipe; ++ guint saved_zpos; + + /* crtc data */ + guint16 hdisplay, vdisplay; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0009-waylandsink-Support-setting-toplevel-window-position.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0009-waylandsink-Support-setting-toplevel-window-position.patch new file mode 100644 index 0000000000000000000000000000000000000000..2b64d41d79a8f04a6bb84797bf37eec0854be240 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0009-waylandsink-Support-setting-toplevel-window-position.patch @@ -0,0 +1,204 @@ +From 26f367d760afdf598f62d205da5c825ee48a727d Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 15 Jun 2020 10:11:42 +0800 +Subject: [PATCH 09/33] waylandsink: Support setting toplevel window position + +Needs hacked wayland server, tested with: + waylandsink render-rectangle="<100,200,300,400>" + +Signed-off-by: Jeffy Chen +--- + ext/wayland/gstwaylandsink.c | 32 ++++++++++++++++++++------------ + ext/wayland/gstwaylandsink.h | 1 + + ext/wayland/wlwindow.c | 29 ++++++++++++++++++++++------- + ext/wayland/wlwindow.h | 5 +++-- + 4 files changed, 46 insertions(+), 21 deletions(-) + +diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c +index 9e55e4f..6647123 100644 +--- a/ext/wayland/gstwaylandsink.c ++++ b/ext/wayland/gstwaylandsink.c +@@ -63,7 +63,8 @@ enum + { + PROP_0, + PROP_DISPLAY, +- PROP_FULLSCREEN ++ PROP_FULLSCREEN, ++ PROP_LAST + }; + + GST_DEBUG_CATEGORY (gstwayland_debug); +@@ -212,6 +213,8 @@ gst_wayland_sink_class_init (GstWaylandSinkClass * klass) + "Whether the surface should be made fullscreen ", FALSE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + ++ gst_video_overlay_install_properties (gobject_class, PROP_LAST); ++ + gst_type_mark_as_plugin_api (GST_TYPE_WAYLAND_VIDEO, 0); + } + +@@ -275,7 +278,8 @@ gst_wayland_sink_set_property (GObject * object, + GST_OBJECT_UNLOCK (sink); + break; + default: +- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); ++ if (!gst_video_overlay_set_property (object, PROP_LAST, prop_id, value)) ++ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } + } +@@ -721,7 +725,8 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer) + if (!sink->window) { + /* if we were not provided a window, create one ourselves */ + sink->window = gst_wl_window_new_toplevel (sink->display, +- &sink->video_info, sink->fullscreen, &sink->render_lock); ++ &sink->video_info, sink->fullscreen, &sink->render_lock, ++ &sink->render_rectangle); + g_signal_connect_object (sink->window, "closed", + G_CALLBACK (on_window_closed), sink, 0); + } +@@ -994,16 +999,19 @@ gst_wayland_sink_set_render_rectangle (GstVideoOverlay * overlay, + g_return_if_fail (sink != NULL); + + g_mutex_lock (&sink->render_lock); +- if (!sink->window) { +- g_mutex_unlock (&sink->render_lock); +- GST_WARNING_OBJECT (sink, +- "set_render_rectangle called without window, ignoring"); +- return; +- } + +- GST_DEBUG_OBJECT (sink, "window geometry changed to (%d, %d) %d x %d", +- x, y, w, h); +- gst_wl_window_set_render_rectangle (sink->window, x, y, w, h); ++ if (sink->window) { ++ GST_DEBUG_OBJECT (sink, "window geometry changed to (%d, %d) %d x %d", ++ x, y, w, h); ++ gst_wl_window_set_render_rectangle (sink->window, x, y, w, h, TRUE); ++ } else { ++ GST_DEBUG_OBJECT (sink, "caching window geometry (%d, %d) %d x %d", ++ x, y, w, h); ++ sink->render_rectangle.x = x; ++ sink->render_rectangle.y = y; ++ sink->render_rectangle.w = w; ++ sink->render_rectangle.h = h; ++ } + + g_mutex_unlock (&sink->render_lock); + } +diff --git a/ext/wayland/gstwaylandsink.h b/ext/wayland/gstwaylandsink.h +index 1c5fb07..9872c29 100644 +--- a/ext/wayland/gstwaylandsink.h ++++ b/ext/wayland/gstwaylandsink.h +@@ -69,6 +69,7 @@ struct _GstWaylandSink + gboolean redraw_pending; + GMutex render_lock; + GstBuffer *last_buffer; ++ GstVideoRectangle render_rectangle; + + struct wl_callback *callback; + }; +diff --git a/ext/wayland/wlwindow.c b/ext/wayland/wlwindow.c +index 57b5491..7814cb8 100644 +--- a/ext/wayland/wlwindow.c ++++ b/ext/wayland/wlwindow.c +@@ -79,7 +79,7 @@ handle_xdg_toplevel_configure (void *data, struct xdg_toplevel *xdg_toplevel, + if (width <= 0 || height <= 0) + return; + +- gst_wl_window_set_render_rectangle (window, 0, 0, width, height); ++ gst_wl_window_set_render_rectangle (window, 0, 0, width, height, FALSE); + } + + static const struct xdg_toplevel_listener xdg_toplevel_listener = { +@@ -123,7 +123,7 @@ handle_configure (void *data, struct wl_shell_surface *wl_shell_surface, + if (width == 0 || height == 0) + return; + +- gst_wl_window_set_render_rectangle (window, 0, 0, width, height); ++ gst_wl_window_set_render_rectangle (window, 0, 0, width, height, FALSE); + } + + static void +@@ -256,7 +256,8 @@ gst_wl_window_ensure_fullscreen (GstWlWindow * window, gboolean fullscreen) + + GstWlWindow * + gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info, +- gboolean fullscreen, GMutex * render_lock) ++ gboolean fullscreen, GMutex * render_lock, ++ GstVideoRectangle * render_rectangle) + { + GstWlWindow *window; + +@@ -325,12 +326,22 @@ gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info, + } + + /* render_rectangle is already set via toplevel_configure in +- * xdg_shell fullscreen mode */ +- if (!(display->xdg_wm_base && fullscreen)) { ++ * fullscreen mode */ ++ if (fullscreen) ++ return window; ++ ++ if (render_rectangle->w || render_rectangle->h) { ++ /* apply cached position and size */ ++ GST_DEBUG ("Applying window position (%d, %d)", ++ render_rectangle->x, render_rectangle->y); ++ gst_wl_window_set_render_rectangle (window, render_rectangle->x, ++ render_rectangle->y, render_rectangle->w, render_rectangle->h, TRUE); ++ } else { + /* set the initial size to be the same as the reported video size */ + gint width = + gst_util_uint64_scale_int_round (info->width, info->par_n, info->par_d); +- gst_wl_window_set_render_rectangle (window, 0, 0, width, info->height); ++ gst_wl_window_set_render_rectangle (window, 0, 0, ++ width, info->height, FALSE); + } + + return window; +@@ -546,7 +557,7 @@ gst_wl_window_update_borders (GstWlWindow * window) + + void + gst_wl_window_set_render_rectangle (GstWlWindow * window, gint x, gint y, +- gint w, gint h) ++ gint w, gint h, gboolean with_position) + { + g_return_if_fail (window != NULL); + +@@ -559,6 +570,10 @@ gst_wl_window_set_render_rectangle (GstWlWindow * window, gint x, gint y, + window->render_rectangle.w = w; + window->render_rectangle.h = h; + ++ /* try to position the xdg surface with hacked wayland server API */ ++ if (with_position && window->xdg_surface) ++ xdg_surface_set_window_geometry (window->xdg_surface, x, y, 0, 0); ++ + /* position the area inside the parent - needs a parent commit to apply */ + if (window->area_subsurface) + wl_subsurface_set_position (window->area_subsurface, x, y); +diff --git a/ext/wayland/wlwindow.h b/ext/wayland/wlwindow.h +index 303c336..ba61d7a 100644 +--- a/ext/wayland/wlwindow.h ++++ b/ext/wayland/wlwindow.h +@@ -83,7 +83,8 @@ GType gst_wl_window_get_type (void); + void gst_wl_window_ensure_fullscreen (GstWlWindow * window, + gboolean fullscreen); + GstWlWindow *gst_wl_window_new_toplevel (GstWlDisplay * display, +- const GstVideoInfo * info, gboolean fullscreen, GMutex * render_lock); ++ const GstVideoInfo * info, gboolean fullscreen, GMutex * render_lock, ++ GstVideoRectangle * render_rectangle); + GstWlWindow *gst_wl_window_new_in_surface (GstWlDisplay * display, + struct wl_surface * parent, GMutex * render_lock); + +@@ -94,7 +95,7 @@ gboolean gst_wl_window_is_toplevel (GstWlWindow *window); + void gst_wl_window_render (GstWlWindow * window, GstWlBuffer * buffer, + const GstVideoInfo * info); + void gst_wl_window_set_render_rectangle (GstWlWindow * window, gint x, gint y, +- gint w, gint h); ++ gint w, gint h, gboolean with_position); + + G_END_DECLS + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0010-HACK-gstmpegvideoparse-Split-every-picture.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0010-HACK-gstmpegvideoparse-Split-every-picture.patch new file mode 100644 index 0000000000000000000000000000000000000000..d2e8b43f692a919954064603bd69f632e20e3f29 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0010-HACK-gstmpegvideoparse-Split-every-picture.patch @@ -0,0 +1,35 @@ +From bfc431b371a0184d107b41f9e4c811465bc66a92 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 19 Jun 2020 15:16:42 +0800 +Subject: [PATCH 10/33] HACK: gstmpegvideoparse: Split every picture + +Some decoders(e.g. Rockchip MPP) need it. + +Signed-off-by: Jeffy Chen +--- + gst/videoparsers/gstmpegvideoparse.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/gst/videoparsers/gstmpegvideoparse.c b/gst/videoparsers/gstmpegvideoparse.c +index f8ef31a..2a70f7d 100644 +--- a/gst/videoparsers/gstmpegvideoparse.c ++++ b/gst/videoparsers/gstmpegvideoparse.c +@@ -583,6 +583,7 @@ gst_mpegv_parse_process_sc (GstMpegvParse * mpvparse, + GST_LOG_OBJECT (mpvparse, "Couldn't parse picture at offset %d", + mpvparse->pic_offset); + ++#if 0 + /* if terminating packet is a picture, we need to check if it has same TSN as the picture that is being + terminated. If it does, we need to keep those together, as these packets are two fields of the same + frame */ +@@ -600,6 +601,7 @@ gst_mpegv_parse_process_sc (GstMpegvParse * mpvparse, + ret = FALSE; + } + } ++#endif + } + + return ret; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0011-mpegtsdemux-Create-new-PCR-group-for-big-gap.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0011-mpegtsdemux-Create-new-PCR-group-for-big-gap.patch new file mode 100644 index 0000000000000000000000000000000000000000..1b693535b9e7bfa4d632c2b9ddb8070f40254606 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0011-mpegtsdemux-Create-new-PCR-group-for-big-gap.patch @@ -0,0 +1,52 @@ +From bc5d9e1d9e1b352b2a9c4b56ce055229010be8c1 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 23 Oct 2020 11:11:11 +0800 +Subject: [PATCH 11/33] mpegtsdemux: Create new PCR group for big gap + +Currently it would try to reuse the current group and handle the gap by +just adding 500ms to pcroffset. + +Signed-off-by: Jeffy Chen +--- + gst/mpegtsdemux/mpegtspacketizer.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/gst/mpegtsdemux/mpegtspacketizer.c b/gst/mpegtsdemux/mpegtspacketizer.c +index de8b571..6747fc6 100644 +--- a/gst/mpegtsdemux/mpegtspacketizer.c ++++ b/gst/mpegtsdemux/mpegtspacketizer.c +@@ -1997,6 +1997,7 @@ record_pcr (MpegTSPacketizer2 * packetizer, MpegTSPCR * pcrtable, + * Initialize current to that group + */ + GST_DEBUG ("No current window estimator, Checking for group to use"); ++create_new_group: + for (tmp = pcrtable->groups; tmp; tmp = tmp->next) { + PCROffsetGroup *group = (PCROffsetGroup *) tmp->data; + +@@ -2069,6 +2070,15 @@ record_pcr (MpegTSPacketizer2 * packetizer, MpegTSPCR * pcrtable, + if (G_UNLIKELY (corpcr - current->pending[current->last].pcr > + 500 * PCR_MSECOND)) { + GST_DEBUG ("New PCR more than 500ms away, handling discont"); ++ ++#if 1 ++ /** ++ * Create new discont group instead of reusing the current, otherwise ++ * it will try to handle the gap by just adding 500ms to pcroffset. ++ */ ++ _close_current_group (pcrtable); ++ goto create_new_group; ++#else + /* Take values from current and put them in the current group (closing it) */ + /* Create new group with pcr/offset just after the current group + * and mark it as a discont */ +@@ -2076,6 +2086,7 @@ record_pcr (MpegTSPacketizer2 * packetizer, MpegTSPCR * pcrtable, + _append_group_values (current->group, current->pending[current->last]); + _set_current_group (pcrtable, current->group, pcr, offset, TRUE); + return; ++#endif + } + + if (G_UNLIKELY (corpcr == current->last_value.pcr)) { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0012-gstjpegparse-Allow-parsebin-to-use-it-for-autopluggi.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0012-gstjpegparse-Allow-parsebin-to-use-it-for-autopluggi.patch new file mode 100644 index 0000000000000000000000000000000000000000..86eedf35e4635f46b8e1c1c0f16e3e0e38eeba63 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0012-gstjpegparse-Allow-parsebin-to-use-it-for-autopluggi.patch @@ -0,0 +1,37 @@ +From f6311d10340cab177b268db3070f139f26d26da5 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 17 Nov 2020 11:51:40 +0800 +Subject: [PATCH 12/33] gstjpegparse: Allow parsebin to use it for autoplugging + +Add "Codec" to Klass and increase rank. + +Signed-off-by: Jeffy Chen +--- + gst/jpegformat/gstjpegparse.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/gst/jpegformat/gstjpegparse.c b/gst/jpegformat/gstjpegparse.c +index 5231879..7587c2b 100644 +--- a/gst/jpegformat/gstjpegparse.c ++++ b/gst/jpegformat/gstjpegparse.c +@@ -89,7 +89,7 @@ static GstFlowReturn gst_jpeg_parse_pre_push_frame (GstBaseParse * bparse, + + #define gst_jpeg_parse_parent_class parent_class + G_DEFINE_TYPE (GstJpegParse, gst_jpeg_parse, GST_TYPE_BASE_PARSE); +-GST_ELEMENT_REGISTER_DEFINE (jpegparse, "jpegparse", GST_RANK_NONE, ++GST_ELEMENT_REGISTER_DEFINE (jpegparse, "jpegparse", GST_RANK_SECONDARY, + GST_TYPE_JPEG_PARSE); + + static void +@@ -115,7 +115,7 @@ gst_jpeg_parse_class_init (GstJpegParseClass * klass) + + gst_element_class_set_static_metadata (gstelement_class, + "JPEG stream parser", +- "Video/Parser", ++ "Codec/Parser/Video/Image", + "Parse JPEG images into single-frame buffers", + "Arnout Vandecappelle (Essensium/Mind) "); + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0013-waylandsink-Drop-frame-when-window-not-ready.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0013-waylandsink-Drop-frame-when-window-not-ready.patch new file mode 100644 index 0000000000000000000000000000000000000000..1564ad6e9da988f0309ea701f2c5a84c758f4000 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0013-waylandsink-Drop-frame-when-window-not-ready.patch @@ -0,0 +1,33 @@ +From 7b0b6cf8730cb8345df62fea67a235c1e03ca913 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 25 Nov 2020 10:51:12 +0800 +Subject: [PATCH 13/33] waylandsink: Drop frame when window not ready + +Signed-off-by: Jeffy Chen +--- + ext/wayland/gstwaylandsink.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c +index 6647123..25694cf 100644 +--- a/ext/wayland/gstwaylandsink.c ++++ b/ext/wayland/gstwaylandsink.c +@@ -881,10 +881,15 @@ render: + + no_window_size: + { ++ /* HACK: Drop frame when window not ready */ ++#if 0 + GST_ELEMENT_ERROR (sink, RESOURCE, WRITE, + ("Window has no size set"), + ("Make sure you set the size after calling set_window_handle")); + ret = GST_FLOW_ERROR; ++#else ++ GST_WARNING_OBJECT (sink, "Window has no size set"); ++#endif + goto done; + } + no_buffer: +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0014-waylandsink-Fix-random-crash.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0014-waylandsink-Fix-random-crash.patch new file mode 100644 index 0000000000000000000000000000000000000000..a911b6d4843c3ba522e3d487351bfdb51a5ee1ed --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0014-waylandsink-Fix-random-crash.patch @@ -0,0 +1,28 @@ +From a86e1852632a23e152ac2741dcafc003004a0389 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 26 Nov 2020 12:19:54 +0800 +Subject: [PATCH 14/33] waylandsink: Fix random crash + +By adding a sanity check for wl window when exposing. + +Signed-off-by: Jeffy Chen +--- + ext/wayland/gstwaylandsink.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c +index 25694cf..56140c4 100644 +--- a/ext/wayland/gstwaylandsink.c ++++ b/ext/wayland/gstwaylandsink.c +@@ -1031,7 +1031,7 @@ gst_wayland_sink_expose (GstVideoOverlay * overlay) + GST_DEBUG_OBJECT (sink, "expose"); + + g_mutex_lock (&sink->render_lock); +- if (sink->last_buffer && !sink->redraw_pending) { ++ if (sink->window && sink->last_buffer && !sink->redraw_pending) { + GST_DEBUG_OBJECT (sink, "redrawing last buffer"); + render_last_buffer (sink, TRUE); + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0015-camerabin2-Support-setting-default-filters.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0015-camerabin2-Support-setting-default-filters.patch new file mode 100644 index 0000000000000000000000000000000000000000..5bad2f87f274c59c568057616557f383d4a9e5a3 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0015-camerabin2-Support-setting-default-filters.patch @@ -0,0 +1,53 @@ +From 0df11e8a9c16aaf38bcf8a330c89cf32822befb5 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 24 Dec 2020 10:16:44 +0800 +Subject: [PATCH 15/33] camerabin2: Support setting default filters + +Use env "CAMERABIN2_PREVIEW_FILTER", "CAMERABIN2_IMAGE_FILTER", +"CAMERABIN2_VIDEO_FILTER", "CAMERABIN2_VIEWFINDER_FILTER" to set default +filters. + +Tested with: +export CAMERABIN2_VIEWFINDER_FILTER="videoflip method=clockwise" +gst-launch-1.0 camerabin + +Signed-off-by: Jeffy Chen +--- + gst/camerabin2/gstcamerabin2.c | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/gst/camerabin2/gstcamerabin2.c b/gst/camerabin2/gstcamerabin2.c +index 6ac5ce4..1d3784f 100644 +--- a/gst/camerabin2/gstcamerabin2.c ++++ b/gst/camerabin2/gstcamerabin2.c +@@ -1507,6 +1507,19 @@ gst_camera_bin_create_elements (GstCameraBin2 * camera) + gboolean profile_switched = FALSE; + const gchar *missing_element_name; + gint encbin_flags = 0; ++ const char *env; ++ ++ if ((env = g_getenv ("CAMERABIN2_PREVIEW_FILTER"))) ++ camera->preview_filter = gst_parse_launch (env, NULL); ++ ++ if ((env = g_getenv ("CAMERABIN2_IMAGE_FILTER"))) ++ camera->user_image_filter = gst_parse_launch (env, NULL); ++ ++ if ((env = g_getenv ("CAMERABIN2_VIDEO_FILTER"))) ++ camera->user_video_filter = gst_parse_launch (env, NULL); ++ ++ if ((env = g_getenv ("CAMERABIN2_VIEWFINDER_FILTER"))) ++ camera->user_viewfinder_filter = gst_parse_launch (env, NULL); + + if (!camera->elements_created) { + /* Check that elements created in _init were really created */ +@@ -1885,7 +1898,6 @@ gst_camera_bin_change_state (GstElement * element, GstStateChange trans) + GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; + GstCameraBin2 *camera = GST_CAMERA_BIN2_CAST (element); + +- + switch (trans) { + case GST_STATE_CHANGE_NULL_TO_READY: + if (!gst_camera_bin_create_elements (camera)) { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0016-waylandsink-Defer-prepare-window-when-getting-zero-w.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0016-waylandsink-Defer-prepare-window-when-getting-zero-w.patch new file mode 100644 index 0000000000000000000000000000000000000000..1c225651b94d5b4bd3738bb92e523e8c5e07664e --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0016-waylandsink-Defer-prepare-window-when-getting-zero-w.patch @@ -0,0 +1,42 @@ +From aaad3daa6439625f9b71e5874a8638264a23f5ed Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 19 Jan 2021 11:16:36 +0800 +Subject: [PATCH 16/33] waylandsink: Defer prepare window when getting zero + window handle + +The window might not ready when we requesting it. + +Signed-off-by: Jeffy Chen +--- + ext/wayland/gstwaylandsink.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c +index 56140c4..4577e6c 100644 +--- a/ext/wayland/gstwaylandsink.c ++++ b/ext/wayland/gstwaylandsink.c +@@ -223,6 +223,8 @@ gst_wayland_sink_init (GstWaylandSink * sink) + { + g_mutex_init (&sink->display_lock); + g_mutex_init (&sink->render_lock); ++ ++ sink->window_handle = 1; + } + + static void +@@ -722,6 +724,12 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer) + gst_video_overlay_prepare_window_handle (GST_VIDEO_OVERLAY (sink)); + g_mutex_lock (&sink->render_lock); + ++ /* HACK: Defer window prepare when getting zero window handle */ ++ if (!sink->window_handle) { ++ GST_LOG_OBJECT (sink, "buffer %p dropped (window not ready)", buffer); ++ goto done; ++ } ++ + if (!sink->window) { + /* if we were not provided a window, create one ourselves */ + sink->window = gst_wl_window_new_toplevel (sink->display, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0017-mpegts-Support-ignoring-broken-PCR-streams-by-defaul.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0017-mpegts-Support-ignoring-broken-PCR-streams-by-defaul.patch new file mode 100644 index 0000000000000000000000000000000000000000..a91df4a43545619bcffcd9aaeae57a1991c4b864 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0017-mpegts-Support-ignoring-broken-PCR-streams-by-defaul.patch @@ -0,0 +1,38 @@ +From c752804cb57181cb531b79e6ebb001821ce5604b Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 28 Dec 2021 12:45:04 +0800 +Subject: [PATCH 17/33] mpegts: Support ignoring broken PCR streams by default + +By setting env 'GST_TSDEMUX_IGNORE_PCR'. + +Signed-off-by: Jeffy Chen +--- + gst/mpegtsdemux/mpegtsbase.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/gst/mpegtsdemux/mpegtsbase.c b/gst/mpegtsdemux/mpegtsbase.c +index 4675dc8..e7b986e 100644 +--- a/gst/mpegtsdemux/mpegtsbase.c ++++ b/gst/mpegtsdemux/mpegtsbase.c +@@ -59,7 +59,7 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", + GST_STATIC_CAPS ("video/mpegts, " "systemstream = (boolean) true ") + ); + +-#define DEFAULT_IGNORE_PCR FALSE ++static int DEFAULT_IGNORE_PCR = FALSE; + + enum + { +@@ -156,6 +156,9 @@ mpegts_base_class_init (MpegTSBaseClass * klass) + * + * Since: 1.18 + */ ++ if (g_getenv ("GST_TSDEMUX_IGNORE_PCR")) ++ DEFAULT_IGNORE_PCR = TRUE; ++ + g_object_class_install_property (gobject_class, PROP_IGNORE_PCR, + g_param_spec_boolean ("ignore-pcr", "Ignore PCR stream for timing", + "Ignore PCR stream for timing", DEFAULT_IGNORE_PCR, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0018-waylandsink-Support-window-layer-property.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0018-waylandsink-Support-window-layer-property.patch new file mode 100644 index 0000000000000000000000000000000000000000..5747755de119e1c572e11a08cd7f6203b8891028 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0018-waylandsink-Support-window-layer-property.patch @@ -0,0 +1,236 @@ +From c31eb56a5a9ee52efacf0589c3fcfcde92375422 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 5 Mar 2021 10:15:51 +0800 +Subject: [PATCH 18/33] waylandsink: Support window layer property + +Support setting top|normal|bottom window layer. + +Tested with: +gst-launch-1.0 videotestsrc ! waylandsink layer=top + +Signed-off-by: Jeffy Chen +--- + ext/wayland/gstwaylandsink.c | 52 ++++++++++++++++++++++++++++++++++-- + ext/wayland/gstwaylandsink.h | 1 + + ext/wayland/wlwindow.c | 39 ++++++++++++++++++++++++++- + ext/wayland/wlwindow.h | 13 +++++++-- + 4 files changed, 100 insertions(+), 5 deletions(-) + +diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c +index 4577e6c..1bf4511 100644 +--- a/ext/wayland/gstwaylandsink.c ++++ b/ext/wayland/gstwaylandsink.c +@@ -64,6 +64,7 @@ enum + PROP_0, + PROP_DISPLAY, + PROP_FULLSCREEN, ++ PROP_LAYER, + PROP_LAST + }; + +@@ -165,6 +166,24 @@ gst_wayland_pool_init (GstWaylandPool * pool) + { + } + ++#define GST_TYPE_WL_WINDOW_LAYER (gst_wl_window_layer_get_type ()) ++static GType ++gst_wl_window_layer_get_type (void) ++{ ++ static GType layer = 0; ++ ++ if (!layer) { ++ static const GEnumValue layers[] = { ++ {GST_WL_WINDOW_LAYER_TOP, "Top", "top"}, ++ {GST_WL_WINDOW_LAYER_NORMAL, "Normal", "normal"}, ++ {GST_WL_WINDOW_LAYER_BOTTOM, "Bottom", "bottom"}, ++ {0, NULL, NULL} ++ }; ++ layer = g_enum_register_static ("GstWlWindowLayer", layers); ++ } ++ return layer; ++} ++ + static void + gst_wayland_sink_class_init (GstWaylandSinkClass * klass) + { +@@ -213,6 +232,12 @@ gst_wayland_sink_class_init (GstWaylandSinkClass * klass) + "Whether the surface should be made fullscreen ", FALSE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + ++ g_object_class_install_property (gobject_class, PROP_LAYER, ++ g_param_spec_enum ("layer", "Window layer", ++ "Wayland window layer", ++ GST_TYPE_WL_WINDOW_LAYER, GST_WL_WINDOW_LAYER_NORMAL, ++ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); ++ + gst_video_overlay_install_properties (gobject_class, PROP_LAST); + + gst_type_mark_as_plugin_api (GST_TYPE_WAYLAND_VIDEO, 0); +@@ -225,6 +250,7 @@ gst_wayland_sink_init (GstWaylandSink * sink) + g_mutex_init (&sink->render_lock); + + sink->window_handle = 1; ++ sink->layer = GST_WL_WINDOW_LAYER_NORMAL; + } + + static void +@@ -239,6 +265,18 @@ gst_wayland_sink_set_fullscreen (GstWaylandSink * sink, gboolean fullscreen) + g_mutex_unlock (&sink->render_lock); + } + ++static void ++gst_wayland_sink_set_layer (GstWaylandSink * sink, GstWlWindowLayer layer) ++{ ++ if (layer == sink->layer) ++ return; ++ ++ g_mutex_lock (&sink->render_lock); ++ sink->layer = layer; ++ gst_wl_window_ensure_layer (sink->window, layer); ++ g_mutex_unlock (&sink->render_lock); ++} ++ + static void + gst_wayland_sink_get_property (GObject * object, + guint prop_id, GValue * value, GParamSpec * pspec) +@@ -256,6 +294,11 @@ gst_wayland_sink_get_property (GObject * object, + g_value_set_boolean (value, sink->fullscreen); + GST_OBJECT_UNLOCK (sink); + break; ++ case PROP_LAYER: ++ GST_OBJECT_LOCK (sink); ++ g_value_set_enum (value, sink->layer); ++ GST_OBJECT_UNLOCK (sink); ++ break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; +@@ -279,6 +322,11 @@ gst_wayland_sink_set_property (GObject * object, + gst_wayland_sink_set_fullscreen (sink, g_value_get_boolean (value)); + GST_OBJECT_UNLOCK (sink); + break; ++ case PROP_LAYER: ++ GST_OBJECT_LOCK (sink); ++ gst_wayland_sink_set_layer (sink, g_value_get_enum (value)); ++ GST_OBJECT_UNLOCK (sink); ++ break; + default: + if (!gst_video_overlay_set_property (object, PROP_LAST, prop_id, value)) + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); +@@ -733,8 +781,8 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer) + if (!sink->window) { + /* if we were not provided a window, create one ourselves */ + sink->window = gst_wl_window_new_toplevel (sink->display, +- &sink->video_info, sink->fullscreen, &sink->render_lock, +- &sink->render_rectangle); ++ &sink->video_info, sink->fullscreen, sink->layer, ++ &sink->render_lock, &sink->render_rectangle); + g_signal_connect_object (sink->window, "closed", + G_CALLBACK (on_window_closed), sink, 0); + } +diff --git a/ext/wayland/gstwaylandsink.h b/ext/wayland/gstwaylandsink.h +index 9872c29..3adddf2 100644 +--- a/ext/wayland/gstwaylandsink.h ++++ b/ext/wayland/gstwaylandsink.h +@@ -62,6 +62,7 @@ struct _GstWaylandSink + gboolean video_info_changed; + GstVideoInfo video_info; + gboolean fullscreen; ++ GstWlWindowLayer layer; + + gchar *display_name; + +diff --git a/ext/wayland/wlwindow.c b/ext/wayland/wlwindow.c +index 7814cb8..7f7f3b6 100644 +--- a/ext/wayland/wlwindow.c ++++ b/ext/wayland/wlwindow.c +@@ -234,6 +234,42 @@ gst_wl_window_new_internal (GstWlDisplay * display, GMutex * render_lock) + return window; + } + ++static void ++gst_wl_window_set_flags (GstWlWindow * window, const char *flags) ++{ ++ /* HACK: set window flags through title */ ++ char s[128] = "flags="; ++ strcat (s, flags); ++ ++ if (!window) ++ return; ++ ++ if (window->xdg_toplevel) ++ xdg_toplevel_set_title (window->xdg_toplevel, s); ++ else if (window->wl_shell_surface) ++ wl_shell_surface_set_title (window->wl_shell_surface, s); ++} ++ ++void ++gst_wl_window_ensure_layer (GstWlWindow * window, GstWlWindowLayer layer) ++{ ++ char s[128] = "flags="; ++ ++ switch (layer) { ++ case GST_WL_WINDOW_LAYER_TOP: ++ strcat (s, "stay-on-top|-stay-on-bottom"); ++ break; ++ case GST_WL_WINDOW_LAYER_NORMAL: ++ strcat (s, "-stay-on-top|-stay-on-bottom"); ++ break; ++ case GST_WL_WINDOW_LAYER_BOTTOM: ++ strcat (s, "-stay-on-top|stay-on-bottom"); ++ break; ++ default: ++ return; ++ } ++} ++ + void + gst_wl_window_ensure_fullscreen (GstWlWindow * window, gboolean fullscreen) + { +@@ -256,7 +292,7 @@ gst_wl_window_ensure_fullscreen (GstWlWindow * window, gboolean fullscreen) + + GstWlWindow * + gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info, +- gboolean fullscreen, GMutex * render_lock, ++ gboolean fullscreen, GstWlWindowLayer layer, GMutex * render_lock, + GstVideoRectangle * render_rectangle) + { + GstWlWindow *window; +@@ -287,6 +323,7 @@ gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info, + &xdg_toplevel_listener, window); + + gst_wl_window_ensure_fullscreen (window, fullscreen); ++ gst_wl_window_ensure_layer (window, layer); + + /* Finally, commit the xdg_surface state as toplevel */ + window->configured = FALSE; +diff --git a/ext/wayland/wlwindow.h b/ext/wayland/wlwindow.h +index ba61d7a..97ea79e 100644 +--- a/ext/wayland/wlwindow.h ++++ b/ext/wayland/wlwindow.h +@@ -80,11 +80,20 @@ struct _GstWlWindowClass + + GType gst_wl_window_get_type (void); + ++typedef enum ++{ ++ GST_WL_WINDOW_LAYER_TOP = 0, ++ GST_WL_WINDOW_LAYER_NORMAL = 1, ++ GST_WL_WINDOW_LAYER_BOTTOM = 2, ++} GstWlWindowLayer; ++ ++void gst_wl_window_ensure_layer (GstWlWindow * window, ++ GstWlWindowLayer layer); + void gst_wl_window_ensure_fullscreen (GstWlWindow * window, + gboolean fullscreen); + GstWlWindow *gst_wl_window_new_toplevel (GstWlDisplay * display, +- const GstVideoInfo * info, gboolean fullscreen, GMutex * render_lock, +- GstVideoRectangle * render_rectangle); ++ const GstVideoInfo * info, gboolean fullscreen, GstWlWindowLayer layer, ++ GMutex * render_lock, GstVideoRectangle * render_rectangle); + GstWlWindow *gst_wl_window_new_in_surface (GstWlDisplay * display, + struct wl_surface * parent, GMutex * render_lock); + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0019-waylandsink-Support-window-alpha-property.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0019-waylandsink-Support-window-alpha-property.patch new file mode 100644 index 0000000000000000000000000000000000000000..7647c649a0c8da47e606261c6f4a53fc1e18b989 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0019-waylandsink-Support-window-alpha-property.patch @@ -0,0 +1,189 @@ +From 2319581d4848e5763abe25059ad43148baa95aaf Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 28 Dec 2021 14:06:19 +0800 +Subject: [PATCH 19/33] waylandsink: Support window alpha property + +Tested with: +gst-launch-1.0 videotestsrc ! waylandsink alpha=0.5 + +Signed-off-by: Jeffy Chen +--- + ext/wayland/gstwaylandsink.c | 32 ++++++++++++++++++++++++++++++++ + ext/wayland/gstwaylandsink.h | 1 + + ext/wayland/wlwindow.c | 23 ++++++++++++++++------- + ext/wayland/wlwindow.h | 1 + + 4 files changed, 50 insertions(+), 7 deletions(-) + +diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c +index 1bf4511..ff79ddf 100644 +--- a/ext/wayland/gstwaylandsink.c ++++ b/ext/wayland/gstwaylandsink.c +@@ -65,6 +65,7 @@ enum + PROP_DISPLAY, + PROP_FULLSCREEN, + PROP_LAYER, ++ PROP_ALPHA, + PROP_LAST + }; + +@@ -238,6 +239,11 @@ gst_wayland_sink_class_init (GstWaylandSinkClass * klass) + GST_TYPE_WL_WINDOW_LAYER, GST_WL_WINDOW_LAYER_NORMAL, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + ++ g_object_class_install_property (gobject_class, PROP_ALPHA, ++ g_param_spec_double ("alpha", "Window alpha", ++ "Wayland window alpha", 0.0, 1.0, 1.0, ++ G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS)); ++ + gst_video_overlay_install_properties (gobject_class, PROP_LAST); + + gst_type_mark_as_plugin_api (GST_TYPE_WAYLAND_VIDEO, 0); +@@ -251,6 +257,7 @@ gst_wayland_sink_init (GstWaylandSink * sink) + + sink->window_handle = 1; + sink->layer = GST_WL_WINDOW_LAYER_NORMAL; ++ sink->alpha = 1.0; + } + + static void +@@ -277,6 +284,18 @@ gst_wayland_sink_set_layer (GstWaylandSink * sink, GstWlWindowLayer layer) + g_mutex_unlock (&sink->render_lock); + } + ++static void ++gst_wayland_sink_set_alpha (GstWaylandSink * sink, gdouble alpha) ++{ ++ if (alpha == sink->alpha) ++ return; ++ ++ g_mutex_lock (&sink->render_lock); ++ sink->alpha = alpha; ++ gst_wl_window_ensure_alpha (sink->window, alpha); ++ g_mutex_unlock (&sink->render_lock); ++} ++ + static void + gst_wayland_sink_get_property (GObject * object, + guint prop_id, GValue * value, GParamSpec * pspec) +@@ -299,6 +318,11 @@ gst_wayland_sink_get_property (GObject * object, + g_value_set_enum (value, sink->layer); + GST_OBJECT_UNLOCK (sink); + break; ++ case PROP_ALPHA: ++ GST_OBJECT_LOCK (sink); ++ g_value_set_double (value, sink->alpha); ++ GST_OBJECT_UNLOCK (sink); ++ break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; +@@ -327,6 +351,11 @@ gst_wayland_sink_set_property (GObject * object, + gst_wayland_sink_set_layer (sink, g_value_get_enum (value)); + GST_OBJECT_UNLOCK (sink); + break; ++ case PROP_ALPHA: ++ GST_OBJECT_LOCK (sink); ++ gst_wayland_sink_set_alpha (sink, g_value_get_double (value)); ++ GST_OBJECT_UNLOCK (sink); ++ break; + default: + if (!gst_video_overlay_set_property (object, PROP_LAST, prop_id, value)) + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); +@@ -783,6 +812,8 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer) + sink->window = gst_wl_window_new_toplevel (sink->display, + &sink->video_info, sink->fullscreen, sink->layer, + &sink->render_lock, &sink->render_rectangle); ++ gst_wl_window_ensure_alpha (sink->window, sink->alpha); ++ + g_signal_connect_object (sink->window, "closed", + G_CALLBACK (on_window_closed), sink, 0); + } +@@ -1035,6 +1066,7 @@ gst_wayland_sink_set_window_handle (GstVideoOverlay * overlay, guintptr handle) + } else { + sink->window = gst_wl_window_new_in_surface (sink->display, surface, + &sink->render_lock); ++ gst_wl_window_ensure_alpha (sink->window, sink->alpha); + + if (sink->last_buffer) { + /* Resend video info to force resize video surface */ +diff --git a/ext/wayland/gstwaylandsink.h b/ext/wayland/gstwaylandsink.h +index 3adddf2..f798969 100644 +--- a/ext/wayland/gstwaylandsink.h ++++ b/ext/wayland/gstwaylandsink.h +@@ -63,6 +63,7 @@ struct _GstWaylandSink + GstVideoInfo video_info; + gboolean fullscreen; + GstWlWindowLayer layer; ++ gdouble alpha; + + gchar *display_name; + +diff --git a/ext/wayland/wlwindow.c b/ext/wayland/wlwindow.c +index 7f7f3b6..58e65dd 100644 +--- a/ext/wayland/wlwindow.c ++++ b/ext/wayland/wlwindow.c +@@ -24,6 +24,7 @@ + #include + #endif + ++#include + #include + + #include "wlwindow.h" +@@ -235,19 +236,25 @@ gst_wl_window_new_internal (GstWlDisplay * display, GMutex * render_lock) + } + + static void +-gst_wl_window_set_flags (GstWlWindow * window, const char *flags) ++gst_wl_window_set_config (GstWlWindow * window, const char *config) + { +- /* HACK: set window flags through title */ +- char s[128] = "flags="; +- strcat (s, flags); +- ++ /* HACK: set window config through title */ + if (!window) + return; + + if (window->xdg_toplevel) +- xdg_toplevel_set_title (window->xdg_toplevel, s); ++ xdg_toplevel_set_title (window->xdg_toplevel, config); + else if (window->wl_shell_surface) +- wl_shell_surface_set_title (window->wl_shell_surface, s); ++ wl_shell_surface_set_title (window->wl_shell_surface, config); ++} ++ ++void ++gst_wl_window_ensure_alpha (GstWlWindow * window, gdouble alpha) ++{ ++ char s[128]; ++ ++ snprintf (s, sizeof (s), "attrs=alpha:%f;", alpha); ++ gst_wl_window_set_config (window, s); + } + + void +@@ -268,6 +275,8 @@ gst_wl_window_ensure_layer (GstWlWindow * window, GstWlWindowLayer layer) + default: + return; + } ++ ++ gst_wl_window_set_config (window, s); + } + + void +diff --git a/ext/wayland/wlwindow.h b/ext/wayland/wlwindow.h +index 97ea79e..6fb8285 100644 +--- a/ext/wayland/wlwindow.h ++++ b/ext/wayland/wlwindow.h +@@ -87,6 +87,7 @@ typedef enum + GST_WL_WINDOW_LAYER_BOTTOM = 2, + } GstWlWindowLayer; + ++void gst_wl_window_ensure_alpha (GstWlWindow * window, gdouble alpha); + void gst_wl_window_ensure_layer (GstWlWindow * window, + GstWlWindowLayer layer); + void gst_wl_window_ensure_fullscreen (GstWlWindow * window, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0020-waylandsink-Support-window-fill-mode-property.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0020-waylandsink-Support-window-fill-mode-property.patch new file mode 100644 index 0000000000000000000000000000000000000000..58b6232685e2dde672d7886be1f8bf6e5748cbd6 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0020-waylandsink-Support-window-fill-mode-property.patch @@ -0,0 +1,215 @@ +From 3241f7b42c92410f9d667ed26e5f65dbcb8b2c92 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 30 Mar 2021 07:08:06 +0800 +Subject: [PATCH 20/33] waylandsink: Support window fill-mode property + +Tested with: +gst-launch-1.0 videotestsrc ! waylandsink fullscreen=1 fill-mode=crop + +Signed-off-by: Jeffy Chen +--- + ext/wayland/gstwaylandsink.c | 55 ++++++++++++++++++++++++++++++++++++ + ext/wayland/gstwaylandsink.h | 1 + + ext/wayland/wlwindow.c | 28 +++++++++++++++++- + ext/wayland/wlwindow.h | 9 ++++++ + 4 files changed, 92 insertions(+), 1 deletion(-) + +diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c +index ff79ddf..24fd7bd 100644 +--- a/ext/wayland/gstwaylandsink.c ++++ b/ext/wayland/gstwaylandsink.c +@@ -66,9 +66,12 @@ enum + PROP_FULLSCREEN, + PROP_LAYER, + PROP_ALPHA, ++ PROP_FILL_MODE, + PROP_LAST + }; + ++static GstWlWindowFillMode DEFAULT_FILL_MODE = GST_WL_WINDOW_FIT; ++ + GST_DEBUG_CATEGORY (gstwayland_debug); + #define GST_CAT_DEFAULT gstwayland_debug + +@@ -185,6 +188,24 @@ gst_wl_window_layer_get_type (void) + return layer; + } + ++#define GST_TYPE_WL_WINDOW_FILL_MODE (gst_wl_window_fill_mode_get_type ()) ++static GType ++gst_wl_window_fill_mode_get_type (void) ++{ ++ static GType mode = 0; ++ ++ if (!mode) { ++ static const GEnumValue modes[] = { ++ {GST_WL_WINDOW_STRETCH, "Ignore aspect ratio", "stretch"}, ++ {GST_WL_WINDOW_FIT, "Keep aspect ratio", "fit"}, ++ {GST_WL_WINDOW_CROP, "Keep aspect ratio by expanding", "crop"}, ++ {0, NULL, NULL} ++ }; ++ mode = g_enum_register_static ("GstWlWindowFillMode", modes); ++ } ++ return mode; ++} ++ + static void + gst_wayland_sink_class_init (GstWaylandSinkClass * klass) + { +@@ -244,6 +265,15 @@ gst_wayland_sink_class_init (GstWaylandSinkClass * klass) + "Wayland window alpha", 0.0, 1.0, 1.0, + G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS)); + ++ if (g_getenv ("WAYLANDSINK_STRETCH")) ++ DEFAULT_FILL_MODE = GST_WL_WINDOW_STRETCH; ++ ++ g_object_class_install_property (gobject_class, PROP_FILL_MODE, ++ g_param_spec_enum ("fill-mode", "Window fill mode", ++ "Wayland window fill mode", ++ GST_TYPE_WL_WINDOW_FILL_MODE, DEFAULT_FILL_MODE, ++ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); ++ + gst_video_overlay_install_properties (gobject_class, PROP_LAST); + + gst_type_mark_as_plugin_api (GST_TYPE_WAYLAND_VIDEO, 0); +@@ -258,6 +288,7 @@ gst_wayland_sink_init (GstWaylandSink * sink) + sink->window_handle = 1; + sink->layer = GST_WL_WINDOW_LAYER_NORMAL; + sink->alpha = 1.0; ++ sink->fill_mode = DEFAULT_FILL_MODE; + } + + static void +@@ -296,6 +327,19 @@ gst_wayland_sink_set_alpha (GstWaylandSink * sink, gdouble alpha) + g_mutex_unlock (&sink->render_lock); + } + ++static void ++gst_wayland_sink_set_fill_mode (GstWaylandSink * sink, ++ GstWlWindowFillMode fill_mode) ++{ ++ if (fill_mode == sink->fill_mode) ++ return; ++ ++ g_mutex_lock (&sink->render_lock); ++ sink->fill_mode = fill_mode; ++ sink->resend_info = FALSE; ++ g_mutex_unlock (&sink->render_lock); ++} ++ + static void + gst_wayland_sink_get_property (GObject * object, + guint prop_id, GValue * value, GParamSpec * pspec) +@@ -323,6 +367,11 @@ gst_wayland_sink_get_property (GObject * object, + g_value_set_double (value, sink->alpha); + GST_OBJECT_UNLOCK (sink); + break; ++ case PROP_FILL_MODE: ++ GST_OBJECT_LOCK (sink); ++ g_value_set_enum (value, sink->fill_mode); ++ GST_OBJECT_UNLOCK (sink); ++ break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; +@@ -356,6 +405,11 @@ gst_wayland_sink_set_property (GObject * object, + gst_wayland_sink_set_alpha (sink, g_value_get_double (value)); + GST_OBJECT_UNLOCK (sink); + break; ++ case PROP_FILL_MODE: ++ GST_OBJECT_LOCK (sink); ++ gst_wayland_sink_set_fill_mode (sink, g_value_get_enum (value)); ++ GST_OBJECT_UNLOCK (sink); ++ break; + default: + if (!gst_video_overlay_set_property (object, PROP_LAST, prop_id, value)) + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); +@@ -763,6 +817,7 @@ render_last_buffer (GstWaylandSink * sink, gboolean redraw) + sink->video_info_changed = FALSE; + sink->resend_info = FALSE; + } ++ sink->window->fill_mode = sink->fill_mode; + gst_wl_window_render (sink->window, wlbuffer, info); + } + +diff --git a/ext/wayland/gstwaylandsink.h b/ext/wayland/gstwaylandsink.h +index f798969..6fd77e8 100644 +--- a/ext/wayland/gstwaylandsink.h ++++ b/ext/wayland/gstwaylandsink.h +@@ -64,6 +64,7 @@ struct _GstWaylandSink + gboolean fullscreen; + GstWlWindowLayer layer; + gdouble alpha; ++ GstWlWindowFillMode fill_mode; + + gchar *display_name; + +diff --git a/ext/wayland/wlwindow.c b/ext/wayland/wlwindow.c +index 58e65dd..f4e7ca9 100644 +--- a/ext/wayland/wlwindow.c ++++ b/ext/wayland/wlwindow.c +@@ -467,7 +467,33 @@ gst_wl_window_resize_video_surface (GstWlWindow * window, gboolean commit) + dst.h = window->render_rectangle.h; + + if (window->video_viewport) { +- gst_video_sink_center_rect (src, dst, &res, TRUE); ++ if (window->fill_mode == GST_WL_WINDOW_STRETCH) { ++ res = dst; ++ } else if (window->fill_mode == GST_WL_WINDOW_FIT) { ++ gst_video_sink_center_rect (src, dst, &res, TRUE); ++ } else if (window->fill_mode == GST_WL_WINDOW_CROP) { ++ gdouble src_ratio, dst_ratio; ++ ++ src_ratio = (gdouble) src.w / src.h; ++ dst_ratio = (gdouble) dst.w / dst.h; ++ ++ if (src_ratio < dst_ratio) { ++ int h = src.w / dst_ratio; ++ src.y = (src.h - h) / 2; ++ src.h = h; ++ } else if (src_ratio > dst_ratio) { ++ int w = src.h * dst_ratio; ++ src.x = (src.w - w) / 2; ++ src.w = w; ++ } ++ ++ wp_viewport_set_source (window->video_viewport, ++ wl_fixed_from_int (src.x), wl_fixed_from_int (src.y), ++ wl_fixed_from_int (src.w), wl_fixed_from_int (src.h)); ++ ++ res = dst; ++ } ++ + wp_viewport_set_destination (window->video_viewport, res.w, res.h); + } else { + gst_video_sink_center_rect (src, dst, &res, FALSE); +diff --git a/ext/wayland/wlwindow.h b/ext/wayland/wlwindow.h +index 6fb8285..35d9d3c 100644 +--- a/ext/wayland/wlwindow.h ++++ b/ext/wayland/wlwindow.h +@@ -37,6 +37,13 @@ G_BEGIN_DECLS + typedef struct _GstWlWindow GstWlWindow; + typedef struct _GstWlWindowClass GstWlWindowClass; + ++typedef enum ++{ ++ GST_WL_WINDOW_STRETCH = 0, ++ GST_WL_WINDOW_FIT = 1, ++ GST_WL_WINDOW_CROP = 2, ++} GstWlWindowFillMode; ++ + struct _GstWlWindow + { + GObject parent_instance; +@@ -71,6 +78,8 @@ struct _GstWlWindow + /* when this is not set both the area_surface and the video_surface are not + * visible and certain steps should be skipped */ + gboolean is_area_surface_mapped; ++ ++ GstWlWindowFillMode fill_mode; + }; + + struct _GstWlWindowClass +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0021-HACK-kmssink-Open-drm-devnode-directly.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0021-HACK-kmssink-Open-drm-devnode-directly.patch new file mode 100644 index 0000000000000000000000000000000000000000..3fb5c0c1c6e7f780d3e55d31dad1146cecce398e --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0021-HACK-kmssink-Open-drm-devnode-directly.patch @@ -0,0 +1,36 @@ +From 9a8b8e9569aaa279cbc404eff8634ecf0bef6068 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 26 Mar 2019 17:33:37 +0800 +Subject: [PATCH 21/33] HACK: kmssink: Open drm devnode directly + +Signed-off-by: Jeffy Chen +--- + sys/kms/gstkmssink.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/sys/kms/gstkmssink.c b/sys/kms/gstkmssink.c +index b84657c..5aca024 100644 +--- a/sys/kms/gstkmssink.c ++++ b/sys/kms/gstkmssink.c +@@ -56,6 +56,7 @@ + #include + #include + #include ++#include + + #include "gstkmssink.h" + #include "gstkmsutils.h" +@@ -817,6 +818,10 @@ gst_kms_sink_start (GstBaseSink * bsink) + self->fd = drmOpen (self->devname, self->bus_id); + else + self->fd = kms_open (&self->devname); ++ ++ if (self->fd < 0) ++ self->fd = open ("/dev/dri/card0", O_RDWR); ++ + if (self->fd < 0) + goto open_failed; + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0022-waylandsink-Use-create_immed-to-create-dmabuf.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0022-waylandsink-Use-create_immed-to-create-dmabuf.patch new file mode 100644 index 0000000000000000000000000000000000000000..99b4fedeaf3f71ac3b4cd6841f50fce654539924 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0022-waylandsink-Use-create_immed-to-create-dmabuf.patch @@ -0,0 +1,130 @@ +From 8ae2e525a02c4e50bd960080681b2b0d4595f8fc Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 8 Jun 2021 09:09:38 +0800 +Subject: [PATCH 22/33] waylandsink: Use create_immed to create dmabuf + +The async creation has lots of issues when the device overloaded. + +Signed-off-by: Jeffy Chen +--- + ext/wayland/wldisplay.c | 2 +- + ext/wayland/wllinuxdmabuf.c | 60 +++---------------------------------- + 2 files changed, 5 insertions(+), 57 deletions(-) + +diff --git a/ext/wayland/wldisplay.c b/ext/wayland/wldisplay.c +index f326091..e582506 100644 +--- a/ext/wayland/wldisplay.c ++++ b/ext/wayland/wldisplay.c +@@ -235,7 +235,7 @@ registry_handle_global (void *data, struct wl_registry *registry, + wl_registry_bind (registry, id, &wp_viewporter_interface, 1); + } else if (g_strcmp0 (interface, "zwp_linux_dmabuf_v1") == 0) { + self->dmabuf = +- wl_registry_bind (registry, id, &zwp_linux_dmabuf_v1_interface, 1); ++ wl_registry_bind (registry, id, &zwp_linux_dmabuf_v1_interface, 2); + zwp_linux_dmabuf_v1_add_listener (self->dmabuf, &dmabuf_listener, self); + } + } +diff --git a/ext/wayland/wllinuxdmabuf.c b/ext/wayland/wllinuxdmabuf.c +index 96487d1..bc1742c 100644 +--- a/ext/wayland/wllinuxdmabuf.c ++++ b/ext/wayland/wllinuxdmabuf.c +@@ -33,41 +33,9 @@ GST_DEBUG_CATEGORY_EXTERN (gstwayland_debug); + + typedef struct + { +- GMutex lock; +- GCond cond; + struct wl_buffer *wbuf; + } ConstructBufferData; + +-static void +-create_succeeded (void *data, struct zwp_linux_buffer_params_v1 *params, +- struct wl_buffer *new_buffer) +-{ +- ConstructBufferData *d = data; +- +- g_mutex_lock (&d->lock); +- d->wbuf = new_buffer; +- zwp_linux_buffer_params_v1_destroy (params); +- g_cond_signal (&d->cond); +- g_mutex_unlock (&d->lock); +-} +- +-static void +-create_failed (void *data, struct zwp_linux_buffer_params_v1 *params) +-{ +- ConstructBufferData *d = data; +- +- g_mutex_lock (&d->lock); +- d->wbuf = NULL; +- zwp_linux_buffer_params_v1_destroy (params); +- g_cond_signal (&d->cond); +- g_mutex_unlock (&d->lock); +-} +- +-static const struct zwp_linux_buffer_params_v1_listener params_listener = { +- create_succeeded, +- create_failed +-}; +- + struct wl_buffer * + gst_wl_linux_dmabuf_construct_wl_buffer (GstBuffer * buf, + GstWlDisplay * display, const GstVideoInfo * info) +@@ -77,7 +45,6 @@ gst_wl_linux_dmabuf_construct_wl_buffer (GstBuffer * buf, + guint i, width, height; + guint nplanes, flags = 0; + struct zwp_linux_buffer_params_v1 *params; +- gint64 timeout; + ConstructBufferData data; + + g_return_val_if_fail (gst_wl_display_check_format_for_dmabuf (display, +@@ -86,10 +53,6 @@ gst_wl_linux_dmabuf_construct_wl_buffer (GstBuffer * buf, + mem = gst_buffer_peek_memory (buf, 0); + format = gst_video_format_to_wl_dmabuf_format (GST_VIDEO_INFO_FORMAT (info)); + +- g_cond_init (&data.cond); +- g_mutex_init (&data.lock); +- g_mutex_lock (&data.lock); +- + width = GST_VIDEO_INFO_WIDTH (info); + height = GST_VIDEO_INFO_HEIGHT (info); + nplanes = GST_VIDEO_INFO_N_PLANES (info); +@@ -131,21 +94,10 @@ gst_wl_linux_dmabuf_construct_wl_buffer (GstBuffer * buf, + } + } + +- /* Request buffer creation */ +- zwp_linux_buffer_params_v1_add_listener (params, ¶ms_listener, &data); +- zwp_linux_buffer_params_v1_create (params, width, height, format, flags); +- +- /* Wait for the request answer */ +- wl_display_flush (display->display); +- data.wbuf = (gpointer) 0x1; +- timeout = g_get_monotonic_time () + G_TIME_SPAN_SECOND; +- while (data.wbuf == (gpointer) 0x1) { +- if (!g_cond_wait_until (&data.cond, &data.lock, timeout)) { +- GST_ERROR_OBJECT (mem->allocator, "zwp_linux_buffer_params_v1 time out"); +- zwp_linux_buffer_params_v1_destroy (params); +- data.wbuf = NULL; +- } +- } ++ data.wbuf = ++ zwp_linux_buffer_params_v1_create_immed (params, width, height, format, ++ flags); ++ zwp_linux_buffer_params_v1_destroy (params); + + out: + if (!data.wbuf) { +@@ -156,9 +108,5 @@ out: + data.wbuf, width, height, (char *) &format, nplanes); + } + +- g_mutex_unlock (&data.lock); +- g_mutex_clear (&data.lock); +- g_cond_clear (&data.cond); +- + return data.wbuf; + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0023-waylandsink-Support-frame-sync-mode.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0023-waylandsink-Support-frame-sync-mode.patch new file mode 100644 index 0000000000000000000000000000000000000000..e10beb35c137d4beafc3e7a49675d7d4416809fb --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0023-waylandsink-Support-frame-sync-mode.patch @@ -0,0 +1,76 @@ +From 4e8110b82110e56818337b000bcebe10f88f6eb6 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 8 Nov 2021 18:45:00 +0800 +Subject: [PATCH 23/33] waylandsink: Support frame-sync mode + +Set env "WAYLANDSINK_SYNC_FRAME" to enable frame syncing. + +Signed-off-by: Jeffy Chen +--- + ext/wayland/gstwaylandsink.c | 9 +++++++++ + ext/wayland/gstwaylandsink.h | 1 + + 2 files changed, 10 insertions(+) + +diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c +index 24fd7bd..07bfec0 100644 +--- a/ext/wayland/gstwaylandsink.c ++++ b/ext/wayland/gstwaylandsink.c +@@ -284,6 +284,7 @@ gst_wayland_sink_init (GstWaylandSink * sink) + { + g_mutex_init (&sink->display_lock); + g_mutex_init (&sink->render_lock); ++ g_cond_init (&sink->redraw_cond); + + sink->window_handle = 1; + sink->layer = GST_WL_WINDOW_LAYER_NORMAL; +@@ -439,6 +440,7 @@ gst_wayland_sink_finalize (GObject * object) + + g_mutex_clear (&sink->display_lock); + g_mutex_clear (&sink->render_lock); ++ g_cond_clear (&sink->redraw_cond); + + G_OBJECT_CLASS (parent_class)->finalize (object); + } +@@ -783,6 +785,7 @@ frame_redraw_callback (void *data, struct wl_callback *callback, uint32_t time) + + g_mutex_lock (&sink->render_lock); + sink->redraw_pending = FALSE; ++ g_cond_signal (&sink->redraw_cond); + + if (sink->callback) { + wl_callback_destroy (callback); +@@ -819,6 +822,11 @@ render_last_buffer (GstWaylandSink * sink, gboolean redraw) + } + sink->window->fill_mode = sink->fill_mode; + gst_wl_window_render (sink->window, wlbuffer, info); ++ ++ if (g_getenv ("WAYLANDSINK_SYNC_FRAME")) { ++ while (sink->redraw_pending) ++ g_cond_wait (&sink->redraw_cond, &sink->render_lock); ++ } + } + + static void +@@ -1019,6 +1027,7 @@ render: + + if (buffer != to_render) + gst_buffer_unref (to_render); ++ + goto done; + + no_window_size: +diff --git a/ext/wayland/gstwaylandsink.h b/ext/wayland/gstwaylandsink.h +index 6fd77e8..1f70f76 100644 +--- a/ext/wayland/gstwaylandsink.h ++++ b/ext/wayland/gstwaylandsink.h +@@ -71,6 +71,7 @@ struct _GstWaylandSink + gboolean resend_info; + gboolean redraw_pending; + GMutex render_lock; ++ GCond redraw_cond; + GstBuffer *last_buffer; + GstVideoRectangle render_rectangle; + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0024-kmssink-Support-NV12_10LE40-and-NV12-NV12_10LE40-NV1.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0024-kmssink-Support-NV12_10LE40-and-NV12-NV12_10LE40-NV1.patch new file mode 100644 index 0000000000000000000000000000000000000000..19be39ac5c13d8261b8a4c602ac7579b623dd6e4 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0024-kmssink-Support-NV12_10LE40-and-NV12-NV12_10LE40-NV1.patch @@ -0,0 +1,409 @@ +From 9ec23e4d5911e02e537156d17b28d8a21f6a8564 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 21 Apr 2021 04:44:38 +0800 +Subject: [PATCH 24/33] kmssink: Support NV12_10LE40 and NV12|NV12_10LE40|NV16 + (AFBC) + +Support using NV12_10LE40 and ARM AFBC compressed format. + +NOTE: +Those formats only supported on a few planes of a few chips. + +Signed-off-by: Jeffy Chen +--- + sys/kms/gstkmsallocator.c | 50 +++++++++++++- + sys/kms/gstkmssink.c | 137 +++++++++++++++++++++++++++++++++++++- + sys/kms/gstkmsutils.c | 6 ++ + sys/kms/gstkmsutils.h | 46 +++++++++++++ + 4 files changed, 235 insertions(+), 4 deletions(-) + +diff --git a/sys/kms/gstkmsallocator.c b/sys/kms/gstkmsallocator.c +index 2ae22fc..6fe6a07 100644 +--- a/sys/kms/gstkmsallocator.c ++++ b/sys/kms/gstkmsallocator.c +@@ -36,6 +36,7 @@ + + /* it needs to be below because is internal to libdrm */ + #include ++#include + + #include + +@@ -147,6 +148,7 @@ extrapolate_stride (const GstVideoFormatInfo * finfo, gint plane, gint stride) + switch (finfo->format) { + case GST_VIDEO_FORMAT_NV12: + case GST_VIDEO_FORMAT_NV12_64Z32: ++ case GST_VIDEO_FORMAT_NV12_10LE40: + case GST_VIDEO_FORMAT_NV21: + case GST_VIDEO_FORMAT_NV16: + case GST_VIDEO_FORMAT_NV61: +@@ -443,7 +445,7 @@ static gboolean + gst_kms_allocator_add_fb (GstKMSAllocator * alloc, GstKMSMemory * kmsmem, + gsize in_offsets[GST_VIDEO_MAX_PLANES], GstVideoInfo * vinfo) + { +- gint i, ret; ++ gint i, ret = -1; + gint num_planes = GST_VIDEO_INFO_N_PLANES (vinfo); + guint32 w, h, fmt, bo_handles[4] = { 0, }; + guint32 pitches[4] = { 0, }; +@@ -469,8 +471,50 @@ gst_kms_allocator_add_fb (GstKMSAllocator * alloc, GstKMSMemory * kmsmem, + GST_DEBUG_OBJECT (alloc, "bo handles: %d, %d, %d, %d", bo_handles[0], + bo_handles[1], bo_handles[2], bo_handles[3]); + +- ret = drmModeAddFB2 (alloc->priv->fd, w, h, fmt, bo_handles, pitches, +- offsets, &kmsmem->fb_id, 0); ++ if (GST_VIDEO_INFO_IS_AFBC (vinfo)) { ++ guint64 modifiers[4] = { 0 }; ++ ++ for (i = 0; i < num_planes; i++) ++ modifiers[i] = DRM_AFBC_MODIFIER; ++ ++ if (fmt == DRM_FORMAT_NV12 || fmt == DRM_FORMAT_NV12_10 || ++ fmt == DRM_FORMAT_NV16) { ++ /* The newer kernel might use new formats instead */ ++ guint32 _handles[4] = { bo_handles[0], 0, }; ++ guint32 _pitches[4] = { pitches[0], 0, }; ++ guint32 _offsets[4] = { offsets[0], 0, }; ++ guint64 _modifiers[4] = { modifiers[0], 0, }; ++ guint32 _fmt; ++ ++ if (fmt == DRM_FORMAT_NV12) { ++ _fmt = DRM_FORMAT_YUV420_8BIT; ++ /* The bpp of YUV420_8BIT is 12 */ ++ _pitches[0] *= 1.5; ++ } else if (fmt == DRM_FORMAT_NV12_10) { ++ _fmt = DRM_FORMAT_YUV420_10BIT; ++ /* The bpp of YUV420_10BIT is 15 */ ++ _pitches[0] *= 1.5; ++ } else { ++ _fmt = DRM_FORMAT_YUYV; ++ /* The bpp of YUYV (AFBC) is 16 */ ++ _pitches[0] *= 2; ++ } ++ ++ ret = drmModeAddFB2WithModifiers (alloc->priv->fd, w, h, _fmt, _handles, ++ _pitches, _offsets, _modifiers, &kmsmem->fb_id, ++ DRM_MODE_FB_MODIFIERS); ++ } ++ ++ if (ret) ++ ret = drmModeAddFB2WithModifiers (alloc->priv->fd, w, h, fmt, bo_handles, ++ pitches, offsets, modifiers, &kmsmem->fb_id, DRM_MODE_FB_MODIFIERS); ++ } else { ++ ret = drmModeAddFB2 (alloc->priv->fd, w, h, fmt, bo_handles, pitches, ++ offsets, &kmsmem->fb_id, 0); ++ if (ret && fmt == DRM_FORMAT_NV12_10) ++ ret = drmModeAddFB2 (alloc->priv->fd, w, h, DRM_FORMAT_NV15, bo_handles, ++ pitches, offsets, &kmsmem->fb_id, 0); ++ } + if (ret) { + GST_ERROR_OBJECT (alloc, "Failed to bind to framebuffer: %s (%d)", + g_strerror (errno), errno); +diff --git a/sys/kms/gstkmssink.c b/sys/kms/gstkmssink.c +index 5aca024..b472f3b 100644 +--- a/sys/kms/gstkmssink.c ++++ b/sys/kms/gstkmssink.c +@@ -521,6 +521,84 @@ modesetting_failed: + } + } + ++static void ++check_afbc (GstKMSSink * self, drmModePlane * plane, guint32 drmfmt, ++ gboolean * linear, gboolean * afbc) ++{ ++ drmModeObjectPropertiesPtr props; ++ drmModePropertyBlobPtr blob; ++ drmModePropertyPtr prop; ++ drmModeResPtr res; ++ struct drm_format_modifier_blob *header; ++ struct drm_format_modifier *modifiers; ++ guint32 *formats; ++ guint64 value = 0; ++ gint i, j; ++ ++ *linear = *afbc = FALSE; ++ ++ res = drmModeGetResources (self->fd); ++ if (!res) ++ return; ++ ++ props = drmModeObjectGetProperties (self->fd, plane->plane_id, ++ DRM_MODE_OBJECT_PLANE); ++ if (!props) { ++ drmModeFreeResources (res); ++ return; ++ } ++ ++ for (i = 0; i < props->count_props && !value; i++) { ++ prop = drmModeGetProperty (self->fd, props->props[i]); ++ if (!prop) ++ continue; ++ ++ if (!strcmp (prop->name, "IN_FORMATS")) ++ value = props->prop_values[i]; ++ ++ drmModeFreeProperty (prop); ++ } ++ ++ drmModeFreeObjectProperties (props); ++ drmModeFreeResources (res); ++ ++ /* No modifiers */ ++ if (!value) { ++ *linear = TRUE; ++ return; ++ } ++ ++ blob = drmModeGetPropertyBlob (self->fd, value); ++ if (!blob) ++ return; ++ ++ header = blob->data; ++ modifiers = (struct drm_format_modifier *) ++ ((gchar *) header + header->modifiers_offset); ++ formats = (guint32 *) ((gchar *) header + header->formats_offset); ++ ++ for (i = 0; i < header->count_formats; i++) { ++ if (formats[i] != drmfmt) ++ continue; ++ ++ for (j = 0; j < header->count_modifiers; j++) { ++ struct drm_format_modifier *mod = &modifiers[j]; ++ ++ if ((i < mod->offset) || (i > mod->offset + 63)) ++ continue; ++ if (!(mod->formats & (1 << (i - mod->offset)))) ++ continue; ++ ++ if (mod->modifier == DRM_AFBC_MODIFIER) ++ *afbc = TRUE; ++ else if (mod->modifier == DRM_FORMAT_MOD_LINEAR) ++ *linear = TRUE; ++ } ++ } ++ ++ drmModeFreePropertyBlob (blob); ++} ++ + static gboolean + ensure_allowed_caps (GstKMSSink * self, drmModeConnector * conn, + drmModePlane * plane, drmModeRes * res) +@@ -554,7 +632,19 @@ ensure_allowed_caps (GstKMSSink * self, drmModeConnector * conn, + mode = &conn->modes[i]; + + for (j = 0; j < plane->count_formats; j++) { +- fmt = gst_video_format_from_drm (plane->formats[j]); ++ gboolean linear = FALSE, afbc = FALSE; ++ ++ check_afbc (self, plane, plane->formats[j], &linear, &afbc); ++ ++ if (plane->formats[j] == DRM_FORMAT_YUV420_8BIT) ++ fmt = GST_VIDEO_FORMAT_NV12; ++ else if (plane->formats[j] == DRM_FORMAT_YUV420_10BIT) ++ fmt = GST_VIDEO_FORMAT_NV12_10LE40; ++ else if (afbc && plane->formats[j] == DRM_FORMAT_YUYV) ++ fmt = GST_VIDEO_FORMAT_NV16; ++ else ++ fmt = gst_video_format_from_drm (plane->formats[j]); ++ + if (fmt == GST_VIDEO_FORMAT_UNKNOWN) { + GST_INFO_OBJECT (self, "ignoring format %" GST_FOURCC_FORMAT, + GST_FOURCC_ARGS (plane->formats[j])); +@@ -579,6 +669,16 @@ ensure_allowed_caps (GstKMSSink * self, drmModeConnector * conn, + if (!caps) + continue; + ++ if (afbc) { ++ GstCaps *afbc_caps = gst_caps_copy (caps); ++ gst_caps_set_simple (afbc_caps, "arm-afbc", G_TYPE_INT, 1, NULL); ++ ++ if (linear) ++ gst_caps_append (caps, afbc_caps); ++ else ++ gst_caps_replace (&caps, afbc_caps); ++ } ++ + tmp_caps = gst_caps_merge (tmp_caps, caps); + } + +@@ -1222,11 +1322,23 @@ gst_kms_sink_set_caps (GstBaseSink * bsink, GstCaps * caps) + { + GstKMSSink *self; + GstVideoInfo vinfo; ++ GstStructure *s; ++ gint value; + + self = GST_KMS_SINK (bsink); + + if (!gst_video_info_from_caps (&vinfo, caps)) + goto invalid_format; ++ ++ /* parse AFBC from caps */ ++ s = gst_caps_get_structure (caps, 0); ++ if (gst_structure_get_int (s, "arm-afbc", &value)) { ++ if (value) ++ GST_VIDEO_INFO_SET_AFBC (&vinfo); ++ else ++ GST_VIDEO_INFO_UNSET_AFBC (&vinfo); ++ } ++ + self->vinfo = vinfo; + + if (!gst_kms_sink_calculate_display_ratio (self, &vinfo, +@@ -1297,7 +1409,9 @@ gst_kms_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query) + gboolean need_pool; + GstVideoInfo vinfo; + GstBufferPool *pool; ++ GstStructure *s; + gsize size; ++ gint value; + + self = GST_KMS_SINK (bsink); + +@@ -1309,6 +1423,10 @@ gst_kms_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query) + if (!gst_video_info_from_caps (&vinfo, caps)) + goto invalid_caps; + ++ s = gst_caps_get_structure (caps, 0); ++ if (gst_structure_get_int (s, "arm-afbc", &value) && value) ++ goto afbc_caps; ++ + size = GST_VIDEO_INFO_SIZE (&vinfo); + + pool = NULL; +@@ -1347,6 +1465,11 @@ invalid_caps: + GST_DEBUG_OBJECT (bsink, "invalid caps specified"); + return FALSE; + } ++afbc_caps: ++ { ++ GST_DEBUG_OBJECT (bsink, "no allocation for AFBC"); ++ return FALSE; ++ } + no_pool: + { + /* Already warned in create_pool */ +@@ -1579,6 +1702,11 @@ gst_kms_sink_copy_to_dumb_buffer (GstKMSSink * self, GstVideoInfo * vinfo, + gboolean success; + GstBuffer *buf = NULL; + ++ if (GST_VIDEO_INFO_IS_AFBC (vinfo)) { ++ GST_ERROR_OBJECT (self, "unable to copy AFBC"); ++ return NULL; ++ } ++ + if (!ensure_internal_pool (self, vinfo, inbuf)) + goto bail; + +@@ -1763,6 +1891,10 @@ retry_set_plane: + src.h = result.h; + } + ++ if (GST_VIDEO_INFO_IS_AFBC (vinfo)) ++ /* The AFBC's width should align to 4 */ ++ src.w &= ~3; ++ + GST_TRACE_OBJECT (self, + "drmModeSetPlane at (%i,%i) %ix%i sourcing at (%i,%i) %ix%i", + result.x, result.y, result.w, result.h, src.x, src.y, src.w, src.h); +@@ -1852,6 +1984,9 @@ gst_kms_sink_drain (GstKMSSink * self) + + dumb_buf = gst_kms_sink_copy_to_dumb_buffer (self, &self->last_vinfo, + parent_meta->buffer); ++ if (!dumb_buf) ++ dumb_buf = gst_buffer_ref (self->last_buffer); ++ + last_buf = self->last_buffer; + self->last_buffer = dumb_buf; + +diff --git a/sys/kms/gstkmsutils.c b/sys/kms/gstkmsutils.c +index cc719fc..23f04da 100644 +--- a/sys/kms/gstkmsutils.c ++++ b/sys/kms/gstkmsutils.c +@@ -68,6 +68,8 @@ static const struct + DEF_FMT (YUV422, Y42B), + DEF_FMT (NV61, NV61), + DEF_FMT (NV16, NV16), ++ DEF_FMT (NV12_10, NV12_10LE40), ++ DEF_FMT (NV15, NV12_10LE40), + DEF_FMT (UYVY, UYVY), + DEF_FMT (YVYU, YVYU), + DEF_FMT (YUYV, YUY2), +@@ -129,6 +131,8 @@ gst_drm_bpp_from_drm (guint32 drmfmt) + bpp = 8; + break; + case DRM_FORMAT_P010: ++ case DRM_FORMAT_NV12_10: ++ case DRM_FORMAT_NV15: + bpp = 10; + break; + case DRM_FORMAT_UYVY: +@@ -161,6 +165,8 @@ gst_drm_height_from_drm (guint32 drmfmt, guint32 height) + case DRM_FORMAT_YVU420: + case DRM_FORMAT_YUV422: + case DRM_FORMAT_NV12: ++ case DRM_FORMAT_NV12_10: ++ case DRM_FORMAT_NV15: + case DRM_FORMAT_NV21: + case DRM_FORMAT_P010: + case DRM_FORMAT_P016: +diff --git a/sys/kms/gstkmsutils.h b/sys/kms/gstkmsutils.h +index 6570070..742372a 100644 +--- a/sys/kms/gstkmsutils.h ++++ b/sys/kms/gstkmsutils.h +@@ -30,6 +30,52 @@ + + G_BEGIN_DECLS + ++#ifndef DRM_FORMAT_NV12_10 ++#define DRM_FORMAT_NV12_10 fourcc_code('N', 'A', '1', '2') ++#endif ++ ++#ifndef DRM_FORMAT_NV15 ++#define DRM_FORMAT_NV15 fourcc_code('N', 'V', '1', '5') ++#endif ++ ++#ifndef DRM_FORMAT_YUV420_8BIT ++#define DRM_FORMAT_YUV420_8BIT fourcc_code('Y', 'U', '0', '8') ++#endif ++ ++#ifndef DRM_FORMAT_YUV420_10BIT ++#define DRM_FORMAT_YUV420_10BIT fourcc_code('Y', 'U', '1', '0') ++#endif ++ ++#ifndef DRM_FORMAT_MOD_VENDOR_ARM ++#define DRM_FORMAT_MOD_VENDOR_ARM 0x08 ++#endif ++ ++#ifndef DRM_FORMAT_MOD_ARM_AFBC ++#define DRM_FORMAT_MOD_ARM_AFBC(__afbc_mode) fourcc_mod_code(ARM, __afbc_mode) ++#endif ++ ++#ifndef AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 ++#define AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 (1ULL) ++#endif ++ ++#ifndef AFBC_FORMAT_MOD_SPARSE ++#define AFBC_FORMAT_MOD_SPARSE (((__u64)1) << 6) ++#endif ++ ++#define DRM_AFBC_MODIFIER \ ++ (DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_SPARSE) | \ ++ DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16)) ++ ++#ifndef GST_VIDEO_FLAG_ARM_AFBC ++#define GST_VIDEO_FLAG_ARM_AFBC (1UL << 31) ++#define GST_VIDEO_INFO_SET_AFBC(i) \ ++ GST_VIDEO_INFO_FLAG_SET (i, GST_VIDEO_FLAG_ARM_AFBC) ++#define GST_VIDEO_INFO_UNSET_AFBC(i) \ ++ GST_VIDEO_INFO_FLAG_UNSET (i, GST_VIDEO_FLAG_ARM_AFBC) ++#define GST_VIDEO_INFO_IS_AFBC(i) \ ++ GST_VIDEO_INFO_FLAG_IS_SET (i, GST_VIDEO_FLAG_ARM_AFBC) ++#endif ++ + GstVideoFormat gst_video_format_from_drm (guint32 drmfmt); + guint32 gst_drm_format_from_video (GstVideoFormat fmt); + guint32 gst_drm_bpp_from_drm (guint32 drmfmt); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0025-waylandsink-Support-NV12_10LE40-and-NV12-NV12_10LE40.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0025-waylandsink-Support-NV12_10LE40-and-NV12-NV12_10LE40.patch new file mode 100644 index 0000000000000000000000000000000000000000..401f00ce5c6f29c96895cfbece3fff756c3b1d6e --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0025-waylandsink-Support-NV12_10LE40-and-NV12-NV12_10LE40.patch @@ -0,0 +1,460 @@ +From ca86cad12b37bffb01ed425fc1796f6e4838ce38 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 12 Nov 2021 11:14:37 +0800 +Subject: [PATCH 25/33] waylandsink: Support NV12_10LE40 and + NV12|NV12_10LE40|NV16 (AFBC) + +Tested on RK356x with: +export GST_MPP_VIDEODEC_DEFAULT_ARM_AFBC=1 +gst-play-1.0 video.mp4 --videosink=waylandsink + +Signed-off-by: Jeffy Chen +--- + ext/wayland/gstwaylandsink.c | 98 +++++++++++++++++++++++++++++++++++- + ext/wayland/wldisplay.c | 19 ++++++- + ext/wayland/wldisplay.h | 2 + + ext/wayland/wllinuxdmabuf.c | 26 +++++++++- + ext/wayland/wlvideoformat.c | 1 + + ext/wayland/wlvideoformat.h | 42 ++++++++++++++++ + ext/wayland/wlwindow.c | 25 +++++---- + ext/wayland/wlwindow.h | 2 + + 8 files changed, 203 insertions(+), 12 deletions(-) + +diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c +index 07bfec0..fe7e0e3 100644 +--- a/ext/wayland/gstwaylandsink.c ++++ b/ext/wayland/gstwaylandsink.c +@@ -78,7 +78,7 @@ GST_DEBUG_CATEGORY (gstwayland_debug); + #define WL_VIDEO_FORMATS \ + "{ BGRx, BGRA, RGBx, xBGR, xRGB, RGBA, ABGR, ARGB, RGB, BGR, " \ + "RGB16, BGR16, YUY2, YVYU, UYVY, AYUV, NV12, NV21, NV16, NV61, " \ +- "YUV9, YVU9, Y41B, I420, YV12, Y42B, v308 }" ++ "YUV9, YVU9, Y41B, I420, YV12, Y42B, v308, NV12_10LE40 }" + + static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, +@@ -603,6 +603,53 @@ gst_wayland_sink_set_context (GstElement * element, GstContext * context) + GST_ELEMENT_CLASS (parent_class)->set_context (element, context); + } + ++static GstCaps * ++gst_wayland_sink_fixup_caps (GstWaylandSink * sink, GstCaps * caps) ++{ ++ GstCaps *tmp_caps = NULL; ++ ++ /* HACK: Allow nv12-10le40 and arm-afbc in main caps */ ++ ++ if (sink->display->support_nv12_10le40) { ++ tmp_caps = gst_caps_from_string ( ++ GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_DMABUF, ++ "NV12_10LE40")); ++ ++ /* NV15(AFBC) */ ++ if (sink->display->support_afbc) { ++ gst_caps_ref (tmp_caps); ++ gst_caps_append (caps, tmp_caps); ++ ++ gst_caps_set_simple (tmp_caps, "arm-afbc", G_TYPE_INT, 1, NULL); ++ } ++ ++ gst_caps_append (caps, tmp_caps); ++ } ++ ++ /* NV12|NV16 (AFBC) */ ++ if (sink->display->support_afbc) { ++ if (gst_wl_display_check_format_for_dmabuf (sink->display, ++ GST_VIDEO_FORMAT_NV12)) { ++ tmp_caps = gst_caps_from_string ( ++ GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_DMABUF, ++ "NV12")); ++ gst_caps_set_simple (tmp_caps, "arm-afbc", G_TYPE_INT, 1, NULL); ++ gst_caps_append (caps, tmp_caps); ++ } ++ ++ if (gst_wl_display_check_format_for_dmabuf (sink->display, ++ GST_VIDEO_FORMAT_NV16)) { ++ tmp_caps = gst_caps_from_string ( ++ GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_DMABUF, ++ "NV16")); ++ gst_caps_set_simple (tmp_caps, "arm-afbc", G_TYPE_INT, 1, NULL); ++ gst_caps_append (caps, tmp_caps); ++ } ++ } ++ ++ return caps; ++} ++ + static GstCaps * + gst_wayland_sink_get_caps (GstBaseSink * bsink, GstCaps * filter) + { +@@ -657,6 +704,8 @@ gst_wayland_sink_get_caps (GstBaseSink * bsink, GstCaps * filter) + gst_structure_take_value (gst_caps_get_structure (caps, 1), "format", + &dmabuf_list); + ++ caps = gst_wayland_sink_fixup_caps (sink, caps); ++ + GST_DEBUG_OBJECT (sink, "display caps: %" GST_PTR_FORMAT, caps); + } + +@@ -704,6 +753,8 @@ gst_wayland_sink_set_caps (GstBaseSink * bsink, GstCaps * caps) + GstWaylandSink *sink; + gboolean use_dmabuf; + GstVideoFormat format; ++ GstStructure *s; ++ gint value; + + sink = GST_WAYLAND_SINK (bsink); + +@@ -713,6 +764,15 @@ gst_wayland_sink_set_caps (GstBaseSink * bsink, GstCaps * caps) + if (!gst_video_info_from_caps (&sink->video_info, caps)) + goto invalid_format; + ++ /* parse AFBC from caps */ ++ s = gst_caps_get_structure (caps, 0); ++ if (gst_structure_get_int (s, "arm-afbc", &value)) { ++ if (value) ++ GST_VIDEO_INFO_SET_AFBC (&sink->video_info); ++ else ++ GST_VIDEO_INFO_UNSET_AFBC (&sink->video_info); ++ } ++ + format = GST_VIDEO_INFO_FORMAT (&sink->video_info); + sink->video_info_changed = TRUE; + +@@ -758,9 +818,17 @@ gst_wayland_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query) + GstBufferPool *pool = NULL; + gboolean need_pool; + GstAllocator *alloc; ++ GstStructure *s; ++ gint value; + + gst_query_parse_allocation (query, &caps, &need_pool); + ++ s = gst_caps_get_structure (caps, 0); ++ if (gst_structure_get_int (s, "arm-afbc", &value) && value) { ++ GST_DEBUG_OBJECT (sink, "no allocation for AFBC"); ++ return FALSE; ++ } ++ + if (need_pool) + pool = gst_wayland_create_pool (sink, caps); + +@@ -771,6 +839,7 @@ gst_wayland_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query) + alloc = gst_wl_shm_allocator_get (); + gst_query_add_allocation_param (query, alloc, NULL); + gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL); ++ gst_query_add_allocation_meta (query, GST_VIDEO_CROP_META_API_TYPE, NULL); + g_object_unref (alloc); + + return TRUE; +@@ -845,6 +914,7 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer) + GstWaylandSink *sink = GST_WAYLAND_SINK (vsink); + GstBuffer *to_render; + GstWlBuffer *wlbuffer; ++ GstVideoCropMeta *crop; + GstVideoMeta *vmeta; + GstVideoFormat format; + GstVideoInfo old_vinfo; +@@ -882,6 +952,23 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer) + } + } + ++ crop = gst_buffer_get_video_crop_meta (buffer); ++ if (crop) { ++ GstWlWindow *window = sink->window; ++ ++ if (window->crop_x != crop->x || window->crop_y != crop->y || ++ window->crop_w != crop->width || window->crop_h != crop->height) { ++ window->crop_x = crop->x; ++ window->crop_y = crop->y; ++ window->crop_w = crop->width; ++ window->crop_h = crop->height; ++ window->crop_dirty = TRUE; ++ ++ GST_LOG_OBJECT (sink, ++ "crop %dx%d-%dx%d", crop->x, crop->y, crop->width, crop->height); ++ } ++ } ++ + /* drop buffers until we get a frame callback */ + if (sink->redraw_pending) { + GST_LOG_OBJECT (sink, "buffer %p dropped (redraw pending)", buffer); +@@ -932,6 +1019,9 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer) + &sink->video_info); + } + ++ if (!wbuf && GST_VIDEO_INFO_IS_AFBC (&sink->video_info)) ++ goto no_afbc; ++ + if (!wbuf && gst_wl_display_check_format_for_shm (sink->display, format)) { + if (gst_buffer_n_memory (buffer) == 1 && gst_is_fd_memory (mem)) + wbuf = gst_wl_shm_memory_construct_wl_buffer (mem, sink->display, +@@ -1060,6 +1150,12 @@ no_wl_buffer: + ret = GST_FLOW_ERROR; + goto done; + } ++no_afbc: ++ { ++ GST_ERROR_OBJECT (sink, "could not import AFBC"); ++ ret = GST_FLOW_ERROR; ++ goto done; ++ } + activate_failed: + { + GST_ERROR_OBJECT (sink, "failed to activate bufferpool."); +diff --git a/ext/wayland/wldisplay.c b/ext/wayland/wldisplay.c +index e582506..fcf2853 100644 +--- a/ext/wayland/wldisplay.c ++++ b/ext/wayland/wldisplay.c +@@ -145,10 +145,27 @@ dmabuf_format (void *data, struct zwp_linux_dmabuf_v1 *zwp_linux_dmabuf, + + if (gst_wl_dmabuf_format_to_video_format (format) != GST_VIDEO_FORMAT_UNKNOWN) + g_array_append_val (self->dmabuf_formats, format); ++ ++ if (format == DRM_FORMAT_NV15) ++ self->support_nv12_10le40 = TRUE; ++} ++ ++static void ++dmabuf_modifier (void *data, struct zwp_linux_dmabuf_v1 *zwp_linux_dmabuf, ++ uint32_t format, uint32_t modifier_hi, uint32_t modifier_lo) ++{ ++ GstWlDisplay *self = data; ++ uint64_t modifier = ((uint64_t) modifier_hi << 32) | modifier_lo; ++ ++ if (modifier == DRM_AFBC_MODIFIER) ++ self->support_afbc = TRUE; ++ ++ dmabuf_format (data, zwp_linux_dmabuf, format); + } + + static const struct zwp_linux_dmabuf_v1_listener dmabuf_listener = { + dmabuf_format, ++ dmabuf_modifier, + }; + + gboolean +@@ -235,7 +252,7 @@ registry_handle_global (void *data, struct wl_registry *registry, + wl_registry_bind (registry, id, &wp_viewporter_interface, 1); + } else if (g_strcmp0 (interface, "zwp_linux_dmabuf_v1") == 0) { + self->dmabuf = +- wl_registry_bind (registry, id, &zwp_linux_dmabuf_v1_interface, 2); ++ wl_registry_bind (registry, id, &zwp_linux_dmabuf_v1_interface, 3); + zwp_linux_dmabuf_v1_add_listener (self->dmabuf, &dmabuf_listener, self); + } + } +diff --git a/ext/wayland/wldisplay.h b/ext/wayland/wldisplay.h +index f2025a6..29c15f6 100644 +--- a/ext/wayland/wldisplay.h ++++ b/ext/wayland/wldisplay.h +@@ -62,6 +62,8 @@ struct _GstWlDisplay + struct zwp_linux_dmabuf_v1 *dmabuf; + GArray *shm_formats; + GArray *dmabuf_formats; ++ gboolean support_afbc; ++ gboolean support_nv12_10le40; + + /* private */ + gboolean own_display; +diff --git a/ext/wayland/wllinuxdmabuf.c b/ext/wayland/wllinuxdmabuf.c +index bc1742c..de3660a 100644 +--- a/ext/wayland/wllinuxdmabuf.c ++++ b/ext/wayland/wllinuxdmabuf.c +@@ -44,8 +44,10 @@ gst_wl_linux_dmabuf_construct_wl_buffer (GstBuffer * buf, + int format; + guint i, width, height; + guint nplanes, flags = 0; ++ gfloat stride_scale = 1.0f; + struct zwp_linux_buffer_params_v1 *params; + ConstructBufferData data; ++ guint64 modifier = GST_VIDEO_INFO_IS_AFBC (info) ? DRM_AFBC_MODIFIER : 0; + + g_return_val_if_fail (gst_wl_display_check_format_for_dmabuf (display, + GST_VIDEO_INFO_FORMAT (info)), NULL); +@@ -61,6 +63,27 @@ gst_wl_linux_dmabuf_construct_wl_buffer (GstBuffer * buf, + G_GSSIZE_FORMAT " (%d x %d), format %s", info->size, width, height, + gst_wl_dmabuf_format_to_string (format)); + ++ if (GST_VIDEO_INFO_IS_AFBC (info)) { ++ /* Mali uses these formats instead */ ++ if (format == DRM_FORMAT_NV12) { ++ format = DRM_FORMAT_YUV420_8BIT; ++ nplanes = 1; ++ stride_scale = 1.5; ++ } else if (format == DRM_FORMAT_NV15) { ++ format = DRM_FORMAT_YUV420_10BIT; ++ nplanes = 1; ++ stride_scale = 1.5; ++ } else if (format == DRM_FORMAT_NV16) { ++ format = DRM_FORMAT_YUYV; ++ nplanes = 1; ++ stride_scale = 2; ++ } else { ++ GST_ERROR_OBJECT (mem->allocator, "unsupported format for AFBC"); ++ data.wbuf = NULL; ++ goto out; ++ } ++ } ++ + /* Creation and configuration of planes */ + params = zwp_linux_dmabuf_v1_create_params (display->dmabuf); + +@@ -70,11 +93,12 @@ gst_wl_linux_dmabuf_construct_wl_buffer (GstBuffer * buf, + + offset = GST_VIDEO_INFO_PLANE_OFFSET (info, i); + stride = GST_VIDEO_INFO_PLANE_STRIDE (info, i); ++ stride *= stride_scale; + if (gst_buffer_find_memory (buf, offset, 1, &mem_idx, &length, &skip)) { + GstMemory *m = gst_buffer_peek_memory (buf, mem_idx); + gint fd = gst_dmabuf_memory_get_fd (m); + zwp_linux_buffer_params_v1_add (params, fd, i, m->offset + skip, +- stride, 0, 0); ++ stride, modifier >> 32, modifier & 0xFFFFFFFF); + } else { + GST_ERROR_OBJECT (mem->allocator, "memory does not seem to contain " + "enough data for the specified format"); +diff --git a/ext/wayland/wlvideoformat.c b/ext/wayland/wlvideoformat.c +index 68cec50..11ca051 100644 +--- a/ext/wayland/wlvideoformat.c ++++ b/ext/wayland/wlvideoformat.c +@@ -56,6 +56,7 @@ static const wl_VideoFormat wl_formats[] = { + {WL_SHM_FORMAT_UYVY, DRM_FORMAT_UYVY, GST_VIDEO_FORMAT_UYVY}, + {WL_SHM_FORMAT_AYUV, DRM_FORMAT_AYUV, GST_VIDEO_FORMAT_AYUV}, + {WL_SHM_FORMAT_NV12, DRM_FORMAT_NV12, GST_VIDEO_FORMAT_NV12}, ++ {-1, DRM_FORMAT_NV15, GST_VIDEO_FORMAT_NV12_10LE40}, + {WL_SHM_FORMAT_NV21, DRM_FORMAT_NV21, GST_VIDEO_FORMAT_NV21}, + {WL_SHM_FORMAT_NV16, DRM_FORMAT_NV16, GST_VIDEO_FORMAT_NV16}, + {WL_SHM_FORMAT_NV61, DRM_FORMAT_NV61, GST_VIDEO_FORMAT_NV61}, +diff --git a/ext/wayland/wlvideoformat.h b/ext/wayland/wlvideoformat.h +index 331f582..ddfb1e0 100644 +--- a/ext/wayland/wlvideoformat.h ++++ b/ext/wayland/wlvideoformat.h +@@ -30,6 +30,48 @@ + + G_BEGIN_DECLS + ++#ifndef DRM_FORMAT_NV15 ++#define DRM_FORMAT_NV15 fourcc_code('N', 'V', '1', '5') ++#endif ++ ++#ifndef DRM_FORMAT_YUV420_8BIT ++#define DRM_FORMAT_YUV420_8BIT fourcc_code('Y', 'U', '0', '8') ++#endif ++ ++#ifndef DRM_FORMAT_YUV420_10BIT ++#define DRM_FORMAT_YUV420_10BIT fourcc_code('Y', 'U', '1', '0') ++#endif ++ ++#ifndef DRM_FORMAT_MOD_VENDOR_ARM ++#define DRM_FORMAT_MOD_VENDOR_ARM 0x08 ++#endif ++ ++#ifndef DRM_FORMAT_MOD_ARM_AFBC ++#define DRM_FORMAT_MOD_ARM_AFBC(__afbc_mode) fourcc_mod_code(ARM, __afbc_mode) ++#endif ++ ++#ifndef AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 ++#define AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 (1ULL) ++#endif ++ ++#ifndef AFBC_FORMAT_MOD_SPARSE ++#define AFBC_FORMAT_MOD_SPARSE (((__u64)1) << 6) ++#endif ++ ++#define DRM_AFBC_MODIFIER \ ++ (DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_SPARSE) | \ ++ DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16)) ++ ++#ifndef GST_VIDEO_FLAG_ARM_AFBC ++#define GST_VIDEO_FLAG_ARM_AFBC (1UL << 31) ++#define GST_VIDEO_INFO_SET_AFBC(i) \ ++ GST_VIDEO_INFO_FLAG_SET (i, GST_VIDEO_FLAG_ARM_AFBC) ++#define GST_VIDEO_INFO_UNSET_AFBC(i) \ ++ GST_VIDEO_INFO_FLAG_UNSET (i, GST_VIDEO_FLAG_ARM_AFBC) ++#define GST_VIDEO_INFO_IS_AFBC(i) \ ++ GST_VIDEO_INFO_FLAG_IS_SET (i, GST_VIDEO_FLAG_ARM_AFBC) ++#endif ++ + enum wl_shm_format gst_video_format_to_wl_shm_format (GstVideoFormat format); + gint gst_video_format_to_wl_dmabuf_format (GstVideoFormat format); + GstVideoFormat gst_wl_shm_format_to_video_format (enum wl_shm_format wl_format); +diff --git a/ext/wayland/wlwindow.c b/ext/wayland/wlwindow.c +index f4e7ca9..2ba0eee 100644 +--- a/ext/wayland/wlwindow.c ++++ b/ext/wayland/wlwindow.c +@@ -466,6 +466,14 @@ gst_wl_window_resize_video_surface (GstWlWindow * window, gboolean commit) + dst.w = window->render_rectangle.w; + dst.h = window->render_rectangle.h; + ++ if (window->crop_w && window->crop_h) { ++ src.x = window->crop_x; ++ src.y = window->crop_y; ++ src.w = window->crop_w; ++ src.h = window->crop_h; ++ } ++ window->crop_dirty = FALSE; ++ + if (window->video_viewport) { + if (window->fill_mode == GST_WL_WINDOW_STRETCH) { + res = dst; +@@ -479,22 +487,20 @@ gst_wl_window_resize_video_surface (GstWlWindow * window, gboolean commit) + + if (src_ratio < dst_ratio) { + int h = src.w / dst_ratio; +- src.y = (src.h - h) / 2; ++ src.y += (src.h - h) / 2; + src.h = h; + } else if (src_ratio > dst_ratio) { + int w = src.h * dst_ratio; +- src.x = (src.w - w) / 2; ++ src.x += (src.w - w) / 2; + src.w = w; + } +- +- wp_viewport_set_source (window->video_viewport, +- wl_fixed_from_int (src.x), wl_fixed_from_int (src.y), +- wl_fixed_from_int (src.w), wl_fixed_from_int (src.h)); +- + res = dst; + } + + wp_viewport_set_destination (window->video_viewport, res.w, res.h); ++ wp_viewport_set_source (window->video_viewport, ++ wl_fixed_from_int (src.x), wl_fixed_from_int (src.y), ++ wl_fixed_from_int (src.w), wl_fixed_from_int (src.h)); + } else { + gst_video_sink_center_rect (src, dst, &res, FALSE); + } +@@ -532,13 +538,14 @@ gst_wl_window_render (GstWlWindow * window, GstWlBuffer * buffer, + const GstVideoInfo * info) + { + if (G_UNLIKELY (info)) { +- window->video_width = +- gst_util_uint64_scale_int_round (info->width, info->par_n, info->par_d); ++ window->video_width = info->width; + window->video_height = info->height; + + wl_subsurface_set_sync (window->video_subsurface); + gst_wl_window_resize_video_surface (window, FALSE); + gst_wl_window_set_opaque (window, info); ++ } else if (window->crop_dirty) { ++ gst_wl_window_resize_video_surface (window, FALSE); + } + + if (G_LIKELY (buffer)) { +diff --git a/ext/wayland/wlwindow.h b/ext/wayland/wlwindow.h +index 35d9d3c..672e15a 100644 +--- a/ext/wayland/wlwindow.h ++++ b/ext/wayland/wlwindow.h +@@ -74,6 +74,8 @@ struct _GstWlWindow + + /* the size of the video in the buffers */ + gint video_width, video_height; ++ gint crop_x, crop_y, crop_w, crop_h; ++ gboolean crop_dirty; + + /* when this is not set both the area_surface and the video_surface are not + * visible and certain steps should be skipped */ +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0026-waylandsink-Use-the-correct-video-info-to-access-all.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0026-waylandsink-Use-the-correct-video-info-to-access-all.patch new file mode 100644 index 0000000000000000000000000000000000000000..650abae8d6b6558231acc2e69bcdd8902d46fa79 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0026-waylandsink-Use-the-correct-video-info-to-access-all.patch @@ -0,0 +1,73 @@ +From 35d33587722cf44478632827bfb7049c003c4fef Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 22 Dec 2021 16:04:46 +0800 +Subject: [PATCH 26/33] waylandsink: Use the correct video info to access + allocated buffer + +The video info might changed after pool activated. + +Signed-off-by: Jeffy Chen +--- + ext/wayland/gstwaylandsink.c | 10 +++++----- + ext/wayland/gstwaylandsink.h | 1 + + 2 files changed, 6 insertions(+), 5 deletions(-) + +diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c +index fe7e0e3..934464c 100644 +--- a/ext/wayland/gstwaylandsink.c ++++ b/ext/wayland/gstwaylandsink.c +@@ -917,7 +917,6 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer) + GstVideoCropMeta *crop; + GstVideoMeta *vmeta; + GstVideoFormat format; +- GstVideoInfo old_vinfo; + GstMemory *mem; + struct wl_buffer *wbuf = NULL; + +@@ -991,7 +990,6 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer) + /* update video info from video meta */ + mem = gst_buffer_peek_memory (buffer, 0); + +- old_vinfo = sink->video_info; + vmeta = gst_buffer_get_video_meta (buffer); + if (vmeta) { + gint i; +@@ -1032,9 +1030,6 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer) + GstVideoFrame src, dst; + GstVideoInfo src_info = sink->video_info; + +- /* rollback video info changes */ +- sink->video_info = old_vinfo; +- + /* we don't know how to create a wl_buffer directly from the provided + * memory, so we have to copy the data to shm memory that we know how + * to handle... */ +@@ -1060,8 +1055,13 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer) + if (!gst_buffer_pool_set_config (sink->pool, config) || + !gst_buffer_pool_set_active (sink->pool, TRUE)) + goto activate_failed; ++ ++ sink->pool_vinfo = sink->video_info; + } + ++ /* rollback video info changes */ ++ sink->video_info = sink->pool_vinfo; ++ + ret = gst_buffer_pool_acquire_buffer (sink->pool, &to_render, NULL); + if (ret != GST_FLOW_OK) + goto no_buffer; +diff --git a/ext/wayland/gstwaylandsink.h b/ext/wayland/gstwaylandsink.h +index 1f70f76..4f517f8 100644 +--- a/ext/wayland/gstwaylandsink.h ++++ b/ext/wayland/gstwaylandsink.h +@@ -61,6 +61,7 @@ struct _GstWaylandSink + + gboolean video_info_changed; + GstVideoInfo video_info; ++ GstVideoInfo pool_vinfo; + gboolean fullscreen; + GstWlWindowLayer layer; + gdouble alpha; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0027-waylandsink-Prefer-to-use-waylandsink.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0027-waylandsink-Prefer-to-use-waylandsink.patch new file mode 100644 index 0000000000000000000000000000000000000000..0b34fc00625e8658eacb346963c5eff16b7fced4 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0027-waylandsink-Prefer-to-use-waylandsink.patch @@ -0,0 +1,28 @@ +From aa742905fef335c2ae74b97216c0a2d7f340e24c Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 27 Dec 2021 21:37:06 +0800 +Subject: [PATCH 27/33] waylandsink: Prefer to use waylandsink + +Increase rank to primary. + +Signed-off-by: Jeffy Chen +--- + ext/wayland/gstwaylandsink.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c +index 934464c..04f1e2a 100644 +--- a/ext/wayland/gstwaylandsink.c ++++ b/ext/wayland/gstwaylandsink.c +@@ -128,7 +128,7 @@ G_DEFINE_TYPE_WITH_CODE (GstWaylandSink, gst_wayland_sink, GST_TYPE_VIDEO_SINK, + gst_wayland_sink_videooverlay_init) + G_IMPLEMENT_INTERFACE (GST_TYPE_WAYLAND_VIDEO, + gst_wayland_sink_waylandvideo_init)); +-GST_ELEMENT_REGISTER_DEFINE (waylandsink, "waylandsink", GST_RANK_MARGINAL, ++GST_ELEMENT_REGISTER_DEFINE (waylandsink, "waylandsink", GST_RANK_PRIMARY, + GST_TYPE_WAYLAND_SINK); + + /* A tiny GstVideoBufferPool subclass that modify the options to remove +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0028-kmssink-Avoid-double-closing-shared-gem-handle.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0028-kmssink-Avoid-double-closing-shared-gem-handle.patch new file mode 100644 index 0000000000000000000000000000000000000000..d8f71fa1d0c870279371f9fcd1bb0a0e17f0ff7c --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0028-kmssink-Avoid-double-closing-shared-gem-handle.patch @@ -0,0 +1,39 @@ +From f602b645bbb212dfcabf34410af09b9cf6597d82 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 18 Jan 2022 12:20:10 +0800 +Subject: [PATCH 28/33] kmssink: Avoid double-closing shared gem handle + +The gem handle could be shared between multiple planes. + +Signed-off-by: Jeffy Chen +--- + sys/kms/gstkmsallocator.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/sys/kms/gstkmsallocator.c b/sys/kms/gstkmsallocator.c +index 6fe6a07..5d81643 100644 +--- a/sys/kms/gstkmsallocator.c ++++ b/sys/kms/gstkmsallocator.c +@@ -566,6 +566,7 @@ gst_kms_allocator_dmabuf_import (GstAllocator * allocator, gint * prime_fds, + GstKMSMemory *kmsmem; + GstMemory *mem; + gint i, ret; ++ guint32 handle = 0; + + g_return_val_if_fail (n_planes <= GST_VIDEO_MAX_PLANES, FALSE); + +@@ -592,6 +593,11 @@ gst_kms_allocator_dmabuf_import (GstAllocator * allocator, gint * prime_fds, + struct drm_gem_close arg = { kmsmem->gem_handle[i], }; + gint err; + ++ if (handle == arg.handle) ++ break; ++ ++ handle = arg.handle; ++ + err = drmIoctl (alloc->priv->fd, DRM_IOCTL_GEM_CLOSE, &arg); + if (err) + GST_WARNING_OBJECT (allocator, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0029-kmssink-Support-ignoring-aspect-ratio.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0029-kmssink-Support-ignoring-aspect-ratio.patch new file mode 100644 index 0000000000000000000000000000000000000000..0c9fdb338c51857d818ac178578dcfd7b61a222f --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0029-kmssink-Support-ignoring-aspect-ratio.patch @@ -0,0 +1,100 @@ +From 61e879015a5848fb5e62fcbe6caed85cdb072d2d Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 19 Jan 2022 16:37:40 +0800 +Subject: [PATCH 29/33] kmssink: Support ignoring aspect ratio + +Set "force-aspect-ratio" property to false to ignore aspect ratio. + +Signed-off-by: Jeffy Chen +--- + sys/kms/gstkmssink.c | 18 +++++++++++++++++- + sys/kms/gstkmssink.h | 2 ++ + 2 files changed, 19 insertions(+), 1 deletion(-) + +diff --git a/sys/kms/gstkmssink.c b/sys/kms/gstkmssink.c +index b472f3b..af80c8e 100644 +--- a/sys/kms/gstkmssink.c ++++ b/sys/kms/gstkmssink.c +@@ -98,6 +98,7 @@ enum + PROP_DISPLAY_HEIGHT, + PROP_CONNECTOR_PROPS, + PROP_PLANE_PROPS, ++ PROP_FORCE_ASPECT_RATIO, + PROP_N, + }; + +@@ -1272,7 +1273,7 @@ gst_kms_sink_calculate_display_ratio (GstKMSSink * self, GstVideoInfo * vinfo, + video_par_n = GST_VIDEO_INFO_PAR_N (vinfo); + video_par_d = GST_VIDEO_INFO_PAR_D (vinfo); + +- if (self->can_scale) { ++ if (self->can_scale && self->keep_aspect) { + gst_video_calculate_device_ratio (self->hdisplay, self->vdisplay, + self->mm_width, self->mm_height, &dpy_par_n, &dpy_par_d); + } else { +@@ -1865,6 +1866,9 @@ retry_set_plane: + result.x += self->render_rect.x; + result.y += self->render_rect.y; + ++ if (self->can_scale && !self->keep_aspect) ++ result = self->render_rect; ++ + if (crop) { + src.w = crop->width; + src.h = crop->height; +@@ -2067,6 +2071,9 @@ gst_kms_sink_set_property (GObject * object, guint prop_id, + + break; + } ++ case PROP_FORCE_ASPECT_RATIO: ++ sink->keep_aspect = g_value_get_boolean (value); ++ break; + default: + if (!gst_video_overlay_set_property (object, PROP_N, prop_id, value)) + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); +@@ -2120,6 +2127,9 @@ gst_kms_sink_get_property (GObject * object, guint prop_id, + case PROP_PLANE_PROPS: + gst_value_set_structure (value, sink->plane_props); + break; ++ case PROP_FORCE_ASPECT_RATIO: ++ g_value_set_boolean (value, sink->keep_aspect); ++ break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; +@@ -2150,6 +2160,7 @@ gst_kms_sink_init (GstKMSSink * sink) + sink->plane_id = -1; + sink->saved_zpos = -1; + sink->can_scale = TRUE; ++ sink->keep_aspect = TRUE; + gst_poll_fd_init (&sink->pollfd); + sink->poll = gst_poll_new (TRUE); + gst_video_info_init (&sink->vinfo); +@@ -2319,6 +2330,11 @@ gst_kms_sink_class_init (GstKMSSinkClass * klass) + "Additional properties for the plane", + GST_TYPE_STRUCTURE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + ++ g_properties[PROP_FORCE_ASPECT_RATIO] = ++ g_param_spec_boolean ("force-aspect-ratio", "Force aspect ratio", ++ "When enabled, scaling will respect original aspect ratio", TRUE, ++ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); ++ + g_object_class_install_properties (gobject_class, PROP_N, g_properties); + + gst_video_overlay_install_properties (gobject_class, PROP_N); +diff --git a/sys/kms/gstkmssink.h b/sys/kms/gstkmssink.h +index 45a9c08..ab70ec4 100644 +--- a/sys/kms/gstkmssink.h ++++ b/sys/kms/gstkmssink.h +@@ -96,6 +96,8 @@ struct _GstKMSSink { + gboolean reconfigure; + + guintptr window_handle; ++ ++ gboolean keep_aspect; + }; + + struct _GstKMSSinkClass { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0030-kmssink-Support-setting-prefered-frame-syncing-mode.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0030-kmssink-Support-setting-prefered-frame-syncing-mode.patch new file mode 100644 index 0000000000000000000000000000000000000000..987601e629905d98ab1d9db2445fad0ed6c82183 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0030-kmssink-Support-setting-prefered-frame-syncing-mode.patch @@ -0,0 +1,179 @@ +From cf89234a530bd85e575b7386b30f1425e2305411 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 25 Feb 2022 17:48:58 +0800 +Subject: [PATCH 30/33] kmssink: Support setting prefered frame syncing mode + +Tested with: +gst-launch-1.0 videotestsrc ! kmssink sync-mode=vblank +gst-launch-1.0 videotestsrc ! kmssink sync-mode=none + +Signed-off-by: Jeffy Chen +--- + sys/kms/gstkmssink.c | 62 +++++++++++++++++++++++++++++++++++++++----- + sys/kms/gstkmssink.h | 10 +++++++ + 2 files changed, 66 insertions(+), 6 deletions(-) + +diff --git a/sys/kms/gstkmssink.c b/sys/kms/gstkmssink.c +index af80c8e..bfca332 100644 +--- a/sys/kms/gstkmssink.c ++++ b/sys/kms/gstkmssink.c +@@ -99,11 +99,14 @@ enum + PROP_CONNECTOR_PROPS, + PROP_PLANE_PROPS, + PROP_FORCE_ASPECT_RATIO, ++ PROP_SYNC_MODE, + PROP_N, + }; + + static GParamSpec *g_properties[PROP_N] = { NULL, }; + ++static GstKMSSyncMode DEFAULT_SYNC_MODE = GST_KMS_SYNC_AUTO; ++ + static void + gst_kms_sink_set_render_rectangle (GstVideoOverlay * overlay, + gint x, gint y, gint width, gint height) +@@ -1491,7 +1494,7 @@ static gboolean + gst_kms_sink_sync (GstKMSSink * self) + { + gint ret; +- gboolean waiting; ++ gboolean waiting, pageflip; + drmEventContext evctxt = { + .version = DRM_EVENT_CONTEXT_VERSION, + .page_flip_handler = sync_handler, +@@ -1510,8 +1513,18 @@ gst_kms_sink_sync (GstKMSSink * self) + else if (self->pipe > 1) + vbl.request.type |= self->pipe << DRM_VBLANK_HIGH_CRTC_SHIFT; + ++ if (self->sync_mode == GST_KMS_SYNC_FLIP) { ++ pageflip = TRUE; ++ } else if (self->sync_mode == GST_KMS_SYNC_VBLANK) { ++ pageflip = FALSE; ++ } else if (self->sync_mode == GST_KMS_SYNC_AUTO) { ++ pageflip = self->modesetting_enabled; ++ } else { ++ return TRUE; ++ } ++ + waiting = TRUE; +- if (!self->has_async_page_flip && !self->modesetting_enabled) { ++ if (!pageflip) { + ret = drmWaitVBlank (self->fd, &vbl); + if (ret) + goto vblank_failed; +@@ -1916,10 +1929,12 @@ retry_set_plane: + } + + sync_frame: +- /* Wait for the previous frame to complete redraw */ +- if (!gst_kms_sink_sync (self)) { +- GST_OBJECT_UNLOCK (self); +- goto bail; ++ if (self->sync_mode != GST_KMS_SYNC_NONE) { ++ /* Wait for the previous frame to complete redraw */ ++ if (!gst_kms_sink_sync (self)) { ++ GST_OBJECT_UNLOCK (self); ++ goto bail; ++ } + } + + /* Save the rendered buffer and its metadata in case a redraw is needed */ +@@ -2074,6 +2089,9 @@ gst_kms_sink_set_property (GObject * object, guint prop_id, + case PROP_FORCE_ASPECT_RATIO: + sink->keep_aspect = g_value_get_boolean (value); + break; ++ case PROP_SYNC_MODE: ++ sink->sync_mode = g_value_get_enum (value); ++ break; + default: + if (!gst_video_overlay_set_property (object, PROP_N, prop_id, value)) + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); +@@ -2130,6 +2148,9 @@ gst_kms_sink_get_property (GObject * object, guint prop_id, + case PROP_FORCE_ASPECT_RATIO: + g_value_set_boolean (value, sink->keep_aspect); + break; ++ case PROP_SYNC_MODE: ++ g_value_set_enum (value, sink->sync_mode); ++ break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; +@@ -2161,11 +2182,31 @@ gst_kms_sink_init (GstKMSSink * sink) + sink->saved_zpos = -1; + sink->can_scale = TRUE; + sink->keep_aspect = TRUE; ++ sink->sync_mode = DEFAULT_SYNC_MODE; + gst_poll_fd_init (&sink->pollfd); + sink->poll = gst_poll_new (TRUE); + gst_video_info_init (&sink->vinfo); + } + ++#define GST_TYPE_KMS_SYNC_MODE (gst_kms_sync_mode_get_type ()) ++static GType ++gst_kms_sync_mode_get_type (void) ++{ ++ static GType mode = 0; ++ ++ if (!mode) { ++ static const GEnumValue modes[] = { ++ {GST_KMS_SYNC_AUTO, "Sync with page flip or vblank event", "auto"}, ++ {GST_KMS_SYNC_FLIP, "Sync with page flip event", "flip"}, ++ {GST_KMS_SYNC_VBLANK, "Sync with vblank event", "vblank"}, ++ {GST_KMS_SYNC_NONE, "Ignore syncing", "none"}, ++ {0, NULL, NULL} ++ }; ++ mode = g_enum_register_static ("GstKMSSyncMode", modes); ++ } ++ return mode; ++} ++ + static void + gst_kms_sink_class_init (GstKMSSinkClass * klass) + { +@@ -2335,6 +2376,15 @@ gst_kms_sink_class_init (GstKMSSinkClass * klass) + "When enabled, scaling will respect original aspect ratio", TRUE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + ++ if (g_getenv ("KMSSINK_DISABLE_VSYNC")) ++ DEFAULT_SYNC_MODE = GST_KMS_SYNC_NONE; ++ ++ g_properties[PROP_SYNC_MODE] = ++ g_param_spec_enum ("sync-mode", "Sync mode", ++ "Prefered frame syncing mode", ++ GST_TYPE_KMS_SYNC_MODE, DEFAULT_SYNC_MODE, ++ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); ++ + g_object_class_install_properties (gobject_class, PROP_N, g_properties); + + gst_video_overlay_install_properties (gobject_class, PROP_N); +diff --git a/sys/kms/gstkmssink.h b/sys/kms/gstkmssink.h +index ab70ec4..274351e 100644 +--- a/sys/kms/gstkmssink.h ++++ b/sys/kms/gstkmssink.h +@@ -44,6 +44,14 @@ G_BEGIN_DECLS + typedef struct _GstKMSSink GstKMSSink; + typedef struct _GstKMSSinkClass GstKMSSinkClass; + ++typedef enum ++{ ++ GST_KMS_SYNC_AUTO = 0, ++ GST_KMS_SYNC_FLIP = 1, ++ GST_KMS_SYNC_VBLANK = 2, ++ GST_KMS_SYNC_NONE = 3, ++} GstKMSSyncMode; ++ + struct _GstKMSSink { + GstVideoSink videosink; + +@@ -98,6 +106,8 @@ struct _GstKMSSink { + guintptr window_handle; + + gboolean keep_aspect; ++ ++ GstKMSSyncMode sync_mode; + }; + + struct _GstKMSSinkClass { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0031-waylandsink-Support-pointer-and-touch.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0031-waylandsink-Support-pointer-and-touch.patch new file mode 100644 index 0000000000000000000000000000000000000000..1ea48bb1a092f7ab39732d67a454d60eefbf6c69 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0031-waylandsink-Support-pointer-and-touch.patch @@ -0,0 +1,419 @@ +From aba56acd328d0843eaa69401e951f95fc6e56eaf Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 5 May 2022 17:56:46 +0800 +Subject: [PATCH 31/35] waylandsink: Support pointer and touch + +Based on weston's client window and simple-egl. + +Signed-off-by: Jeffy Chen +--- + ext/wayland/meson.build | 3 +- + ext/wayland/wldisplay.c | 278 ++++++++++++++++++++++++++++++++++++++++ + ext/wayland/wldisplay.h | 8 ++ + ext/wayland/wlwindow.c | 4 + + 4 files changed, 292 insertions(+), 1 deletion(-) + +diff --git a/ext/wayland/meson.build b/ext/wayland/meson.build +index a3ffb70..c8a32da 100644 +--- a/ext/wayland/meson.build ++++ b/ext/wayland/meson.build +@@ -37,12 +37,13 @@ if use_wayland + command : [wl_scanner, 'client-header', '@INPUT@', '@OUTPUT@'])] + endforeach + ++ wl_cursor_dep = dependency('wayland-cursor') + gstwaylandsink = library('gstwaylandsink', + wl_sources + protocols_files, + c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'], + include_directories : [configinc], + dependencies : [gst_dep, gstvideo_dep, gstwayland_dep, gstallocators_dep, +- wl_client_dep, wl_protocol_dep, libdrm_dep], ++ wl_client_dep, wl_protocol_dep, wl_cursor_dep, libdrm_dep], + install : true, + install_dir : plugins_install_dir, + ) +diff --git a/ext/wayland/wldisplay.c b/ext/wayland/wldisplay.c +index fcf2853..701ee5e 100644 +--- a/ext/wayland/wldisplay.c ++++ b/ext/wayland/wldisplay.c +@@ -24,9 +24,11 @@ + + #include "wldisplay.h" + #include "wlbuffer.h" ++#include "wlwindow.h" + #include "wlvideoformat.h" + + #include ++#include + + GST_DEBUG_CATEGORY_EXTERN (gstwayland_debug); + #define GST_CAT_DEFAULT gstwayland_debug +@@ -35,6 +37,18 @@ G_DEFINE_TYPE (GstWlDisplay, gst_wl_display, G_TYPE_OBJECT); + + static void gst_wl_display_finalize (GObject * gobject); + ++struct input ++{ ++ GstWlDisplay *display; ++ struct wl_seat *seat; ++ struct wl_pointer *pointer; ++ struct wl_touch *touch; ++ ++ void *pointer_focus; ++ ++ struct wl_list link; ++}; ++ + static void + gst_wl_display_class_init (GstWlDisplayClass * klass) + { +@@ -58,6 +72,29 @@ gst_wl_ref_wl_buffer (gpointer key, gpointer value, gpointer user_data) + g_object_ref (value); + } + ++static void ++input_destroy (struct input *input) ++{ ++ if (input->touch) ++ wl_touch_destroy (input->touch); ++ if (input->pointer) ++ wl_pointer_destroy (input->pointer); ++ ++ wl_list_remove (&input->link); ++ wl_seat_destroy (input->seat); ++ free (input); ++} ++ ++static void ++display_destroy_inputs (GstWlDisplay * self) ++{ ++ struct input *tmp; ++ struct input *input; ++ ++ wl_list_for_each_safe (input, tmp, &self->input_list, link) ++ input_destroy (input); ++} ++ + static void + gst_wl_display_finalize (GObject * gobject) + { +@@ -67,6 +104,14 @@ gst_wl_display_finalize (GObject * gobject) + if (self->thread) + g_thread_join (self->thread); + ++ display_destroy_inputs (self); ++ ++ if (self->cursor_surface) ++ wl_surface_destroy (self->cursor_surface); ++ ++ if (self->cursor_theme) ++ wl_cursor_theme_destroy (self->cursor_theme); ++ + /* to avoid buffers being unregistered from another thread + * at the same time, take their ownership */ + g_mutex_lock (&self->buffers_mutex); +@@ -223,6 +268,225 @@ static const struct xdg_wm_base_listener xdg_wm_base_listener = { + handle_xdg_wm_base_ping + }; + ++static void ++display_set_cursor (GstWlDisplay *self, struct wl_pointer *pointer, ++ uint32_t serial) ++{ ++ struct wl_buffer *buffer; ++ struct wl_cursor_image *image; ++ ++ if (!self->default_cursor) ++ return; ++ ++ if (!self->cursor_surface) { ++ self->cursor_surface = ++ wl_compositor_create_surface (self->compositor); ++ if (!self->cursor_surface) ++ return; ++ } ++ ++ image = self->default_cursor->images[0]; ++ buffer = wl_cursor_image_get_buffer (image); ++ if (!buffer) ++ return; ++ ++ wl_pointer_set_cursor (pointer, serial, ++ self->cursor_surface, image->hotspot_x, image->hotspot_y); ++ wl_surface_attach (self->cursor_surface, buffer, 0, 0); ++ wl_surface_damage (self->cursor_surface, 0, 0, ++ image->width, image->height); ++ wl_surface_commit (self->cursor_surface); ++} ++ ++static void ++pointer_handle_enter (void *data, struct wl_pointer *pointer, ++ uint32_t serial, struct wl_surface *surface, ++ wl_fixed_t sx_w, wl_fixed_t sy_w) ++{ ++ struct input *input = data; ++ GstWlDisplay *display = input->display; ++ GstWlWindow *window; ++ ++ if (!surface) { ++ /* enter event for a window we've just destroyed */ ++ return; ++ } ++ ++ if (surface != display->touch_surface) { ++ /* Ignoring input event from other surfaces */ ++ return; ++ } ++ ++ window = wl_surface_get_user_data (surface); ++ if (!window || !gst_wl_window_is_toplevel (window)) { ++ /* Ignoring input event from subsurface */ ++ return; ++ } ++ ++ input->pointer_focus = window; ++ display_set_cursor (window->display, pointer, serial); ++} ++ ++static void ++pointer_handle_leave (void *data, struct wl_pointer *pointer, ++ uint32_t serial, struct wl_surface *surface) ++{ ++ struct input *input = data; ++ ++ if (input->pointer_focus) { ++ input->pointer_focus = NULL; ++ wl_pointer_set_cursor (pointer, serial, NULL, 0, 0); ++ } ++} ++ ++static void ++pointer_handle_motion (void *data, struct wl_pointer *pointer, ++ uint32_t time, wl_fixed_t sx, wl_fixed_t sy) ++{ ++} ++ ++static void ++pointer_handle_button (void *data, struct wl_pointer *pointer, uint32_t serial, ++ uint32_t time, uint32_t button, uint32_t state) ++{ ++ struct input *input = data; ++ GstWlWindow *window; ++ ++ window = input->pointer_focus; ++ if (!window) ++ return; ++ ++ if (button == BTN_LEFT && state == WL_POINTER_BUTTON_STATE_PRESSED) { ++ if (window->display->xdg_wm_base) ++ xdg_toplevel_move (window->xdg_toplevel, input->seat, serial); ++ else ++ wl_shell_surface_move (window->wl_shell_surface, input->seat, serial); ++ } ++} ++ ++static void ++pointer_handle_axis(void *data, struct wl_pointer *wl_pointer, ++ uint32_t time, uint32_t axis, wl_fixed_t value) ++{ ++} ++ ++static const struct wl_pointer_listener pointer_listener = { ++ pointer_handle_enter, ++ pointer_handle_leave, ++ pointer_handle_motion, ++ pointer_handle_button, ++ pointer_handle_axis, ++}; ++ ++static void ++touch_handle_down (void *data, struct wl_touch *wl_touch, ++ uint32_t serial, uint32_t time, struct wl_surface *surface, ++ int32_t id, wl_fixed_t x_w, wl_fixed_t y_w) ++{ ++ struct input *input = data; ++ GstWlDisplay *display = input->display; ++ GstWlWindow *window; ++ ++ if (!surface) { ++ /* enter event for a window we've just destroyed */ ++ return; ++ } ++ ++ if (surface != display->touch_surface) { ++ /* Ignoring input event from other surfaces */ ++ return; ++ } ++ ++ window = wl_surface_get_user_data (surface); ++ if (!window || !gst_wl_window_is_toplevel (window)) { ++ /* Ignoring input event from subsurface */ ++ return; ++ } ++ ++ if (window->display->xdg_wm_base) ++ xdg_toplevel_move (window->xdg_toplevel, input->seat, serial); ++ else ++ wl_shell_surface_move (window->wl_shell_surface, input->seat, serial); ++} ++ ++static void ++touch_handle_up (void *data, struct wl_touch *wl_touch, ++ uint32_t serial, uint32_t time, int32_t id) ++{ ++} ++ ++static void ++touch_handle_motion (void *data, struct wl_touch *wl_touch, ++ uint32_t time, int32_t id, wl_fixed_t x_w, wl_fixed_t y_w) ++{ ++} ++ ++static void ++touch_handle_frame (void *data, struct wl_touch *wl_touch) ++{ ++} ++ ++static void ++touch_handle_cancel (void *data, struct wl_touch *wl_touch) ++{ ++} ++ ++static const struct wl_touch_listener touch_listener = { ++ touch_handle_down, ++ touch_handle_up, ++ touch_handle_motion, ++ touch_handle_frame, ++ touch_handle_cancel, ++}; ++ ++static void ++seat_handle_capabilities (void *data, struct wl_seat *seat, ++ enum wl_seat_capability caps) ++{ ++ struct input *input = data; ++ ++ if ((caps & WL_SEAT_CAPABILITY_POINTER) && !input->pointer) { ++ input->pointer = wl_seat_get_pointer (seat); ++ wl_pointer_add_listener (input->pointer, &pointer_listener, input); ++ } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && input->pointer) { ++ wl_pointer_destroy (input->pointer); ++ input->pointer = NULL; ++ } ++ ++ if ((caps & WL_SEAT_CAPABILITY_TOUCH) && !input->touch) { ++ input->touch = wl_seat_get_touch (seat); ++ wl_touch_add_listener (input->touch, &touch_listener, input); ++ } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && input->touch) { ++ wl_touch_destroy (input->touch); ++ input->touch = NULL; ++ } ++} ++ ++static const struct wl_seat_listener seat_listener = { ++ seat_handle_capabilities, ++}; ++ ++static void ++display_add_input (GstWlDisplay *self, uint32_t id) ++{ ++ struct input *input; ++ ++ input = calloc (1, sizeof (*input)); ++ if (input == NULL) { ++ GST_ERROR ("Error out of memory"); ++ return; ++ } ++ ++ input->display = self; ++ ++ input->seat = wl_registry_bind (self->registry, id, &wl_seat_interface, 1); ++ ++ wl_seat_add_listener (input->seat, &seat_listener, input); ++ wl_seat_set_user_data (input->seat, input); ++ ++ wl_list_insert(self->input_list.prev, &input->link); ++} ++ + static void + registry_handle_global (void *data, struct wl_registry *registry, + uint32_t id, const char *interface, uint32_t version) +@@ -247,6 +511,18 @@ registry_handle_global (void *data, struct wl_registry *registry, + } else if (g_strcmp0 (interface, "wl_shm") == 0) { + self->shm = wl_registry_bind (registry, id, &wl_shm_interface, 1); + wl_shm_add_listener (self->shm, &shm_listener, self); ++ ++ self->cursor_theme = wl_cursor_theme_load (NULL, 32, self->shm); ++ if (!self->cursor_theme) { ++ GST_ERROR ("Error loading default cursor theme"); ++ } else { ++ self->default_cursor = ++ wl_cursor_theme_get_cursor (self->cursor_theme, "left_ptr"); ++ if (!self->default_cursor) ++ GST_ERROR ("Error loading default left cursor pointer"); ++ } ++ } else if (g_strcmp0 (interface, "wl_seat") == 0) { ++ display_add_input (self, id); + } else if (g_strcmp0 (interface, "wp_viewporter") == 0) { + self->viewporter = + wl_registry_bind (registry, id, &wp_viewporter_interface, 1); +@@ -337,6 +613,8 @@ gst_wl_display_new_existing (struct wl_display * display, + self->display_wrapper = wl_proxy_create_wrapper (display); + self->own_display = take_ownership; + ++ wl_list_init (&self->input_list); ++ + self->queue = wl_display_create_queue (self->display); + wl_proxy_set_queue ((struct wl_proxy *) self->display_wrapper, self->queue); + self->registry = wl_display_get_registry (self->display_wrapper); +diff --git a/ext/wayland/wldisplay.h b/ext/wayland/wldisplay.h +index 29c15f6..8914d31 100644 +--- a/ext/wayland/wldisplay.h ++++ b/ext/wayland/wldisplay.h +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + #include "xdg-shell-client-protocol.h" + #include "viewporter-client-protocol.h" + #include "linux-dmabuf-unstable-v1-client-protocol.h" +@@ -50,6 +51,13 @@ struct _GstWlDisplay + struct wl_display *display_wrapper; + struct wl_event_queue *queue; + ++ struct wl_list input_list; ++ ++ struct wl_cursor_theme *cursor_theme; ++ struct wl_cursor *default_cursor; ++ struct wl_surface *cursor_surface; ++ struct wl_surface *touch_surface; ++ + /* globals */ + struct wl_registry *registry; + struct wl_compositor *compositor; +diff --git a/ext/wayland/wlwindow.c b/ext/wayland/wlwindow.c +index 2ba0eee..9917beb 100644 +--- a/ext/wayland/wlwindow.c ++++ b/ext/wayland/wlwindow.c +@@ -205,6 +205,8 @@ gst_wl_window_new_internal (GstWlDisplay * display, GMutex * render_lock) + window->area_surface = wl_compositor_create_surface (display->compositor); + window->video_surface = wl_compositor_create_surface (display->compositor); + ++ display->touch_surface = window->area_surface; ++ + window->area_surface_wrapper = wl_proxy_create_wrapper (window->area_surface); + window->video_surface_wrapper = + wl_proxy_create_wrapper (window->video_surface); +@@ -308,6 +310,8 @@ gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info, + + window = gst_wl_window_new_internal (display, render_lock); + ++ wl_surface_set_user_data (window->area_surface, window); ++ + /* Check which protocol we will use (in order of preference) */ + if (display->xdg_wm_base) { + gint64 timeout; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0032-waylandsink-Parse-video-size-in-propose_allocation.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0032-waylandsink-Parse-video-size-in-propose_allocation.patch new file mode 100644 index 0000000000000000000000000000000000000000..cc1cb027802b811a31f4db406ec11ff90a03772f --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0032-waylandsink-Parse-video-size-in-propose_allocation.patch @@ -0,0 +1,86 @@ +From 1a6c470c54b3bbe31a4103994d2d4e1738ac58e1 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 11 May 2022 18:12:39 +0800 +Subject: [PATCH 32/33] waylandsink: Parse video size in propose_allocation() + +In some cases it would be called before set_caps(). + +Signed-off-by: Jeffy Chen +--- + ext/wayland/gstwaylandsink.c | 24 +++++++++++++++++++----- + 1 file changed, 19 insertions(+), 5 deletions(-) + +diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c +index 04f1e2a..8ba2e06 100644 +--- a/ext/wayland/gstwaylandsink.c ++++ b/ext/wayland/gstwaylandsink.c +@@ -724,11 +724,10 @@ gst_wayland_sink_get_caps (GstBaseSink * bsink, GstCaps * filter) + } + + static GstBufferPool * +-gst_wayland_create_pool (GstWaylandSink * sink, GstCaps * caps) ++gst_wayland_create_pool (GstWaylandSink * sink, GstCaps * caps, gsize size) + { + GstBufferPool *pool = NULL; + GstStructure *structure; +- gsize size = sink->video_info.size; + GstAllocator *alloc; + + pool = g_object_new (gst_wayland_pool_get_type (), NULL); +@@ -779,7 +778,7 @@ gst_wayland_sink_set_caps (GstBaseSink * bsink, GstCaps * caps) + /* create a new pool for the new caps */ + if (sink->pool) + gst_object_unref (sink->pool); +- sink->pool = gst_wayland_create_pool (sink, caps); ++ sink->pool = gst_wayland_create_pool (sink, caps, sink->video_info.size); + + use_dmabuf = gst_caps_features_contains (gst_caps_get_features (caps, 0), + GST_CAPS_FEATURE_MEMORY_DMABUF); +@@ -818,10 +817,15 @@ gst_wayland_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query) + GstBufferPool *pool = NULL; + gboolean need_pool; + GstAllocator *alloc; ++ GstVideoInfo info; + GstStructure *s; + gint value; + + gst_query_parse_allocation (query, &caps, &need_pool); ++ if (!caps) ++ goto no_caps; ++ if (!gst_video_info_from_caps (&info, caps)) ++ goto invalid_caps; + + s = gst_caps_get_structure (caps, 0); + if (gst_structure_get_int (s, "arm-afbc", &value) && value) { +@@ -830,9 +834,9 @@ gst_wayland_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query) + } + + if (need_pool) +- pool = gst_wayland_create_pool (sink, caps); ++ pool = gst_wayland_create_pool (sink, caps, info.size); + +- gst_query_add_allocation_pool (query, pool, sink->video_info.size, 2, 0); ++ gst_query_add_allocation_pool (query, pool, info.size, 2, 0); + if (pool) + g_object_unref (pool); + +@@ -843,6 +847,16 @@ gst_wayland_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query) + g_object_unref (alloc); + + return TRUE; ++no_caps: ++ { ++ GST_DEBUG_OBJECT (bsink, "no caps specified"); ++ return FALSE; ++ } ++invalid_caps: ++ { ++ GST_DEBUG_OBJECT (bsink, "invalid caps specified"); ++ return FALSE; ++ } + } + + static void +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0033-waylandsink-Wait-10s-for-toplevel-window-s-configure.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0033-waylandsink-Wait-10s-for-toplevel-window-s-configure.patch new file mode 100644 index 0000000000000000000000000000000000000000..8742b16bfab604562582657f5c7c8a7e9b2d1d46 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0033-waylandsink-Wait-10s-for-toplevel-window-s-configure.patch @@ -0,0 +1,29 @@ +From 97176cd834bcc6d90101f280b57058e8ced17032 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 7 Jul 2022 14:43:31 +0800 +Subject: [PATCH 33/33] waylandsink: Wait 10s for toplevel window's configure + event + +The original 100ms is racy when system is under heavy load. + +Signed-off-by: Jeffy Chen +--- + ext/wayland/wlwindow.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ext/wayland/wlwindow.c b/ext/wayland/wlwindow.c +index 9917beb..27fdda4 100644 +--- a/ext/wayland/wlwindow.c ++++ b/ext/wayland/wlwindow.c +@@ -344,7 +344,7 @@ gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info, + wl_display_flush (display->display); + + g_mutex_lock (&window->configure_mutex); +- timeout = g_get_monotonic_time () + 100 * G_TIME_SPAN_MILLISECOND; ++ timeout = g_get_monotonic_time () + 10 * G_TIME_SPAN_SECOND; + while (!window->configured) { + if (!g_cond_wait_until (&window->configure_cond, &window->configure_mutex, + timeout)) { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0034-waylandsink-Fix-buffer-size-error-when-video-cropped.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0034-waylandsink-Fix-buffer-size-error-when-video-cropped.patch new file mode 100644 index 0000000000000000000000000000000000000000..669b84815ab2e8f5f15eaf235f2936e4d1834a34 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0034-waylandsink-Fix-buffer-size-error-when-video-cropped.patch @@ -0,0 +1,33 @@ +From 65a0f97b159ce17b5fcfd9fc67cfe6dc46400319 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 15 Jul 2022 12:14:44 +0800 +Subject: [PATCH 34/34] waylandsink: Fix buffer size error when video cropped + +Prefer video meta's size instead of the cropped size from caps. + +Tested with: +gst-launch-1.0 videotestsrc ! videocrop left=100 ! waylandsink + +Signed-off-by: Jeffy Chen +--- + ext/wayland/gstwaylandsink.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c +index 8ba2e06..1e925b9 100644 +--- a/ext/wayland/gstwaylandsink.c ++++ b/ext/wayland/gstwaylandsink.c +@@ -1008,6 +1008,10 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer) + if (vmeta) { + gint i; + ++ /* prefer the padded width/height from vmeta */ ++ sink->video_info.width = vmeta->width; ++ sink->video_info.height = vmeta->height; ++ + for (i = 0; i < vmeta->n_planes; i++) { + sink->video_info.offset[i] = vmeta->offset[i]; + sink->video_info.stride[i] = vmeta->stride[i]; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0035-HACK-waylandsink-Set-size-in-wl_subsurface_set_posit.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0035-HACK-waylandsink-Set-size-in-wl_subsurface_set_posit.patch new file mode 100644 index 0000000000000000000000000000000000000000..a0d846869afd059939369f877a6fdae2a7f83f14 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0035-HACK-waylandsink-Set-size-in-wl_subsurface_set_posit.patch @@ -0,0 +1,39 @@ +From 81b700ae6cc20d9dd8cd652c3833dfba039b350d Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 21 Jul 2022 12:29:27 +0800 +Subject: [PATCH 35/39] HACK: waylandsink: Set size in + wl_subsurface_set_position() when no viewport + +Tested with hacked enlightenment. + +Signed-off-by: Jeffy Chen +--- + ext/wayland/wlwindow.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/ext/wayland/wlwindow.c b/ext/wayland/wlwindow.c +index 27fdda4..ba1046a 100644 +--- a/ext/wayland/wlwindow.c ++++ b/ext/wayland/wlwindow.c +@@ -506,7 +506,17 @@ gst_wl_window_resize_video_surface (GstWlWindow * window, gboolean commit) + wl_fixed_from_int (src.x), wl_fixed_from_int (src.y), + wl_fixed_from_int (src.w), wl_fixed_from_int (src.h)); + } else { +- gst_video_sink_center_rect (src, dst, &res, FALSE); ++ if (window->fill_mode == GST_WL_WINDOW_STRETCH) { ++ res = dst; ++ } else { ++ if (window->fill_mode == GST_WL_WINDOW_CROP) ++ GST_WARNING ("The compositor doesn't support crop mode (no viewport)!"); ++ ++ gst_video_sink_center_rect (src, dst, &res, TRUE); ++ } ++ ++ wl_subsurface_set_position (window->video_subsurface, ++ res.w << 16 | res.x, res.h << 16 | res.y); + } + + wl_subsurface_set_position (window->video_subsurface, res.x, res.y); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0036-waylandsink-Support-transparent-video.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0036-waylandsink-Support-transparent-video.patch new file mode 100644 index 0000000000000000000000000000000000000000..194198a4572b6ae8db714b9916efb895a5bae236 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0036-waylandsink-Support-transparent-video.patch @@ -0,0 +1,94 @@ +From 499e9f7b9caa1e47194f8043d607f71eef2248bb Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 5 Aug 2022 11:39:00 +0800 +Subject: [PATCH 36/36] waylandsink: Support transparent video + +Tested with transparent png picture. + +Signed-off-by: Jeffy Chen +--- + ext/wayland/wlwindow.c | 32 ++++++++++++++++++++++---------- + ext/wayland/wlwindow.h | 3 +++ + 2 files changed, 25 insertions(+), 10 deletions(-) + +diff --git a/ext/wayland/wlwindow.c b/ext/wayland/wlwindow.c +index ba1046a..330579f 100644 +--- a/ext/wayland/wlwindow.c ++++ b/ext/wayland/wlwindow.c +@@ -528,17 +528,19 @@ gst_wl_window_resize_video_surface (GstWlWindow * window, gboolean commit) + } + + static void +-gst_wl_window_set_opaque (GstWlWindow * window, const GstVideoInfo * info) ++gst_wl_window_set_opaque (GstWlWindow * window) + { + struct wl_region *region; + +- /* Set area opaque */ +- region = wl_compositor_create_region (window->display->compositor); +- wl_region_add (region, 0, 0, G_MAXINT32, G_MAXINT32); +- wl_surface_set_opaque_region (window->area_surface, region); +- wl_region_destroy (region); ++ if (window->area_opaque) { ++ /* Set area opaque */ ++ region = wl_compositor_create_region (window->display->compositor); ++ wl_region_add (region, 0, 0, G_MAXINT32, G_MAXINT32); ++ wl_surface_set_opaque_region (window->area_surface, region); ++ wl_region_destroy (region); ++ } + +- if (!GST_VIDEO_INFO_HAS_ALPHA (info)) { ++ if (window->video_opaque) { + /* Set video opaque */ + region = wl_compositor_create_region (window->display->compositor); + wl_region_add (region, 0, 0, G_MAXINT32, G_MAXINT32); +@@ -554,10 +556,15 @@ gst_wl_window_render (GstWlWindow * window, GstWlBuffer * buffer, + if (G_UNLIKELY (info)) { + window->video_width = info->width; + window->video_height = info->height; ++ window->video_opaque = !GST_VIDEO_INFO_HAS_ALPHA (info); ++ window->area_opaque = window->video_opaque; ++ ++ if (g_getenv ("WAYLANDSINK_FORCE_OPAQUE")) ++ window->area_opaque = window->video_opaque = TRUE; + + wl_subsurface_set_sync (window->video_subsurface); + gst_wl_window_resize_video_surface (window, FALSE); +- gst_wl_window_set_opaque (window, info); ++ gst_wl_window_set_opaque (window); + } else if (window->crop_dirty) { + gst_wl_window_resize_video_surface (window, FALSE); + } +@@ -624,8 +631,13 @@ gst_wl_window_update_borders (GstWlWindow * window) + height = window->render_rectangle.h; + } + +- /* we want WL_SHM_FORMAT_XRGB8888 */ +- format = GST_VIDEO_FORMAT_BGRx; ++ if (window->area_opaque) { ++ /* we want WL_SHM_FORMAT_XRGB8888 */ ++ format = GST_VIDEO_FORMAT_BGRx; ++ } else { ++ /* we want WL_SHM_FORMAT_ARGB8888 */ ++ format = GST_VIDEO_FORMAT_BGRA; ++ } + + /* draw the area_subsurface */ + gst_video_info_set_format (&info, format, width, height); +diff --git a/ext/wayland/wlwindow.h b/ext/wayland/wlwindow.h +index 672e15a..66b69f4 100644 +--- a/ext/wayland/wlwindow.h ++++ b/ext/wayland/wlwindow.h +@@ -77,6 +77,9 @@ struct _GstWlWindow + gint crop_x, crop_y, crop_w, crop_h; + gboolean crop_dirty; + ++ gboolean video_opaque; ++ gboolean area_opaque; ++ + /* when this is not set both the area_surface and the video_surface are not + * visible and certain steps should be skipped */ + gboolean is_area_surface_mapped; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0037-kmssink-Improve-monitor-and-plane-selection.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0037-kmssink-Improve-monitor-and-plane-selection.patch new file mode 100644 index 0000000000000000000000000000000000000000..3add6512eba7c645a4840a95ae421d02c4dc6b3c --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0037-kmssink-Improve-monitor-and-plane-selection.patch @@ -0,0 +1,142 @@ +From 2153ebe11725de26614aff3b5512a185ba87a19c Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 15 Sep 2022 17:56:40 +0800 +Subject: [PATCH 37/39] kmssink: Improve monitor and plane selection + +Major changes: +1/ Filter out disconnected monitors. +2/ Filter out inused planes. +3/ Prefer Nth primary plane for Nth CRTC. +4/ Fallback to the first usable overlay plane. + +Signed-off-by: Jeffy Chen +--- + sys/kms/gstkmssink.c | 74 ++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 71 insertions(+), 3 deletions(-) + +diff --git a/sys/kms/gstkmssink.c b/sys/kms/gstkmssink.c +index bfca332..78f58e3 100644 +--- a/sys/kms/gstkmssink.c ++++ b/sys/kms/gstkmssink.c +@@ -210,13 +210,38 @@ kms_open (gchar ** driver) + return fd; + } + ++static int ++drm_plane_get_type (int fd, drmModePlane * plane) ++{ ++ drmModeObjectPropertiesPtr props; ++ drmModePropertyPtr prop; ++ int i, type = -1; ++ ++ props = drmModeObjectGetProperties (fd, plane->plane_id, ++ DRM_MODE_OBJECT_PLANE); ++ if (!props) ++ return -1; ++ ++ for (i = 0; i < props->count_props; i++) { ++ prop = drmModeGetProperty (fd, props->props[i]); ++ if (prop && !strcmp (prop->name, "type")) ++ type = props->prop_values[i]; ++ drmModeFreeProperty (prop); ++ } ++ ++ drmModeFreeObjectProperties (props); ++ return type; ++} ++ + static drmModePlane * + find_plane_for_crtc (int fd, drmModeRes * res, drmModePlaneRes * pres, + int crtc_id) + { + drmModePlane *plane; +- int i, pipe; ++ int i, pipe, plane_type, num_primary, fallback; + ++ num_primary = 0; ++ fallback = 0; + plane = NULL; + pipe = -1; + for (i = 0; i < res->count_crtcs; i++) { +@@ -231,11 +256,26 @@ find_plane_for_crtc (int fd, drmModeRes * res, drmModePlaneRes * pres, + + for (i = 0; i < pres->count_planes; i++) { + plane = drmModeGetPlane (fd, pres->planes[i]); +- if (plane->possible_crtcs & (1 << pipe)) +- return plane; ++ plane_type = drm_plane_get_type (fd, plane); ++ num_primary += plane_type == DRM_PLANE_TYPE_PRIMARY; ++ ++ /* Check unused possible planes */ ++ if (plane->possible_crtcs & (1 << pipe) && !plane->fb_id) { ++ if (pipe == num_primary - 1 && plane_type == DRM_PLANE_TYPE_PRIMARY) { ++ /* Prefer the Nth primary plane */ ++ return plane; ++ } else if (!fallback && plane_type == DRM_PLANE_TYPE_OVERLAY) { ++ /* Use first overlay plane as fallback */ ++ fallback = plane->plane_id; ++ } ++ } + drmModeFreePlane (plane); + } + ++ /* Fallback to the first overlay plane */ ++ if (fallback) ++ return drmModeGetPlane (fd, fallback); ++ + return NULL; + } + +@@ -346,6 +386,25 @@ find_first_used_connector (int fd, drmModeRes * res) + return NULL; + } + ++static drmModeConnector * ++find_first_available_connector (int fd, drmModeRes * res) ++{ ++ int i; ++ drmModeConnector *conn; ++ ++ conn = NULL; ++ for (i = 0; i < res->count_connectors; i++) { ++ conn = drmModeGetConnector (fd, res->connectors[i]); ++ if (conn) { ++ if (conn->connection == DRM_MODE_CONNECTED) ++ return conn; ++ drmModeFreeConnector (conn); ++ } ++ } ++ ++ return NULL; ++} ++ + static drmModeConnector * + find_main_monitor (int fd, drmModeRes * res) + { +@@ -364,6 +423,10 @@ find_main_monitor (int fd, drmModeRes * res) + if (!conn) + conn = find_first_used_connector (fd, res); + ++ /* if no connector is used, grab the first available one */ ++ if (!conn) ++ conn = find_first_available_connector (fd, res); ++ + /* if no connector is used, grab the first one */ + if (!conn) + conn = drmModeGetConnector (fd, res->connectors[0]); +@@ -910,7 +973,12 @@ gst_kms_sink_start (GstBaseSink * bsink) + gboolean ret; + + self = GST_KMS_SINK (bsink); ++#if 0 + universal_planes = FALSE; ++#else ++ /* Force checking every planes */ ++ universal_planes = TRUE; ++#endif + ret = FALSE; + res = NULL; + conn = NULL; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0038-kmssink-Support-scaling-in-modesetting.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0038-kmssink-Support-scaling-in-modesetting.patch new file mode 100644 index 0000000000000000000000000000000000000000..8fa5d698913b963177aa00eb9781a05cce6d7fda --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0038-kmssink-Support-scaling-in-modesetting.patch @@ -0,0 +1,134 @@ +From bdae7d7d57718cabde193c6a20b059fb4c35ac46 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 15 Sep 2022 18:01:12 +0800 +Subject: [PATCH 38/39] kmssink: Support scaling in modesetting + +Signed-off-by: Jeffy Chen +--- + sys/kms/gstkmssink.c | 52 +++++++++++++++++++++++++++++--------------- + 1 file changed, 34 insertions(+), 18 deletions(-) + +diff --git a/sys/kms/gstkmssink.c b/sys/kms/gstkmssink.c +index 78f58e3..a27f569 100644 +--- a/sys/kms/gstkmssink.c ++++ b/sys/kms/gstkmssink.c +@@ -234,11 +234,12 @@ drm_plane_get_type (int fd, drmModePlane * plane) + } + + static drmModePlane * +-find_plane_for_crtc (int fd, drmModeRes * res, drmModePlaneRes * pres, ++find_plane_for_crtc (GstKMSSink * self, drmModeRes * res, drmModePlaneRes * pres, + int crtc_id) + { + drmModePlane *plane; + int i, pipe, plane_type, num_primary, fallback; ++ int fd = self->fd; + + num_primary = 0; + fallback = 0; +@@ -260,7 +261,8 @@ find_plane_for_crtc (int fd, drmModeRes * res, drmModePlaneRes * pres, + num_primary += plane_type == DRM_PLANE_TYPE_PRIMARY; + + /* Check unused possible planes */ +- if (plane->possible_crtcs & (1 << pipe) && !plane->fb_id) { ++ if (plane->possible_crtcs & (1 << pipe) && ++ (!plane->fb_id || self->modesetting_enabled)) { + if (pipe == num_primary - 1 && plane_type == DRM_PLANE_TYPE_PRIMARY) { + /* Prefer the Nth primary plane */ + return plane; +@@ -525,12 +527,6 @@ configure_mode_setting (GstKMSSink * self, GstVideoInfo * vinfo) + + GST_INFO_OBJECT (self, "configuring mode setting"); + +- ensure_kms_allocator (self); +- kmsmem = (GstKMSMemory *) gst_kms_allocator_bo_alloc (self->allocator, vinfo); +- if (!kmsmem) +- goto bo_failed; +- fb_id = kmsmem->fb_id; +- + conn = drmModeGetConnector (self->fd, self->conn_id); + if (!conn) + goto connector_failed; +@@ -542,9 +538,25 @@ configure_mode_setting (GstKMSSink * self, GstVideoInfo * vinfo) + break; + } + } ++ ++ /* Fallback to the last mode (using scale) */ ++ if (!mode && self->can_scale && conn->count_modes) { ++ mode = &conn->modes[conn->count_modes - 1]; ++ ++ /* Hack this temp video info */ ++ gst_video_info_set_format (vinfo, GST_VIDEO_INFO_FORMAT (vinfo), ++ mode->hdisplay, mode->vdisplay); ++ } ++ + if (!mode) + goto mode_failed; + ++ ensure_kms_allocator (self); ++ kmsmem = (GstKMSMemory *) gst_kms_allocator_bo_alloc (self->allocator, vinfo); ++ if (!kmsmem) ++ goto bo_failed; ++ fb_id = kmsmem->fb_id; ++ + err = drmModeSetCrtc (self->fd, self->crtc_id, fb_id, 0, 0, + (uint32_t *) & self->conn_id, 1, mode); + if (err) +@@ -720,7 +732,7 @@ ensure_allowed_caps (GstKMSSink * self, drmModeConnector * conn, + + format = gst_video_format_to_string (fmt); + +- if (mode) { ++ if (mode && !self->can_scale) { + caps = gst_caps_new_simple ("video/x-raw", + "format", G_TYPE_STRING, format, + "width", G_TYPE_INT, mode->hdisplay, +@@ -1036,7 +1048,7 @@ retry_find_plane: + goto plane_resources_failed; + + if (self->plane_id == -1) +- plane = find_plane_for_crtc (self->fd, res, pres, crtc->crtc_id); ++ plane = find_plane_for_crtc (self, res, pres, crtc->crtc_id); + else + plane = drmModeGetPlane (self->fd, self->plane_id); + if (!plane) +@@ -1586,7 +1598,7 @@ gst_kms_sink_sync (GstKMSSink * self) + } else if (self->sync_mode == GST_KMS_SYNC_VBLANK) { + pageflip = FALSE; + } else if (self->sync_mode == GST_KMS_SYNC_AUTO) { +- pageflip = self->modesetting_enabled; ++ pageflip = self->modesetting_enabled && self->buffer_id; + } else { + return TRUE; + } +@@ -1913,15 +1925,19 @@ gst_kms_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf) + + GST_OBJECT_LOCK (self); + if (self->modesetting_enabled) { +- self->buffer_id = fb_id; ++ if (video_width == self->hdisplay && video_height == self->vdisplay) { ++ self->buffer_id = fb_id; + +- if (!self->render_rect.w || !self->render_rect.h) +- goto sync_frame; ++ if (!self->render_rect.w || !self->render_rect.h) ++ goto sync_frame; + +- if (!self->render_rect.x && !self->render_rect.y && +- self->render_rect.w == self->hdisplay && +- self->render_rect.h == self->vdisplay) +- goto sync_frame; ++ if (!self->render_rect.x && !self->render_rect.y && ++ self->render_rect.w == self->hdisplay && ++ self->render_rect.h == self->vdisplay) ++ goto sync_frame; ++ } else { ++ self->buffer_id = 0; ++ } + } + + if ((crop = gst_buffer_get_video_crop_meta (buffer))) { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0039-kmssink-Support-fullscreen-prop.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0039-kmssink-Support-fullscreen-prop.patch new file mode 100644 index 0000000000000000000000000000000000000000..d970fd0399ea537df0473dd5e115d2a664b6c754 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20/0039-kmssink-Support-fullscreen-prop.patch @@ -0,0 +1,86 @@ +From 1a0b32f5264b96e42cb6b05782c24451551bb80f Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 15 Sep 2022 18:18:07 +0800 +Subject: [PATCH 39/39] kmssink: Support fullscreen prop + +Signed-off-by: Jeffy Chen +--- + sys/kms/gstkmssink.c | 21 +++++++++++++++++++++ + sys/kms/gstkmssink.h | 1 + + 2 files changed, 22 insertions(+) + +diff --git a/sys/kms/gstkmssink.c b/sys/kms/gstkmssink.c +index a27f569..f07ab6f 100644 +--- a/sys/kms/gstkmssink.c ++++ b/sys/kms/gstkmssink.c +@@ -100,6 +100,7 @@ enum + PROP_PLANE_PROPS, + PROP_FORCE_ASPECT_RATIO, + PROP_SYNC_MODE, ++ PROP_FULLSCREEN, + PROP_N, + }; + +@@ -1974,6 +1975,15 @@ retry_set_plane: + src.h = video_height; + } + ++ if (self->fullscreen) { ++ if (self->can_scale || ++ (src.w == self->hdisplay && src.h == self->vdisplay)) { ++ result.x = result.y = 0; ++ result.w = self->hdisplay; ++ result.h = self->vdisplay; ++ } ++ } ++ + /* handle out of screen case */ + if ((result.x + result.w) > self->hdisplay) + result.w = self->hdisplay - result.x; +@@ -2176,6 +2186,9 @@ gst_kms_sink_set_property (GObject * object, guint prop_id, + case PROP_SYNC_MODE: + sink->sync_mode = g_value_get_enum (value); + break; ++ case PROP_FULLSCREEN: ++ sink->fullscreen = g_value_get_boolean (value); ++ break; + default: + if (!gst_video_overlay_set_property (object, PROP_N, prop_id, value)) + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); +@@ -2235,6 +2248,9 @@ gst_kms_sink_get_property (GObject * object, guint prop_id, + case PROP_SYNC_MODE: + g_value_set_enum (value, sink->sync_mode); + break; ++ case PROP_FULLSCREEN: ++ g_value_set_boolean (value, sink->fullscreen); ++ break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; +@@ -2469,6 +2485,11 @@ gst_kms_sink_class_init (GstKMSSinkClass * klass) + GST_TYPE_KMS_SYNC_MODE, DEFAULT_SYNC_MODE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + ++ g_properties[PROP_FULLSCREEN] = ++ g_param_spec_boolean ("fullscreen", "Fullscreen", ++ "Force showing fullscreen", FALSE, ++ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); ++ + g_object_class_install_properties (gobject_class, PROP_N, g_properties); + + gst_video_overlay_install_properties (gobject_class, PROP_N); +diff --git a/sys/kms/gstkmssink.h b/sys/kms/gstkmssink.h +index 274351e..1981036 100644 +--- a/sys/kms/gstkmssink.h ++++ b/sys/kms/gstkmssink.h +@@ -106,6 +106,7 @@ struct _GstKMSSink { + guintptr window_handle; + + gboolean keep_aspect; ++ gboolean fullscreen; + + GstKMSSyncMode sync_mode; + }; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_%.bbappend b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_%.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..4ebe8c642dc96a97ff17b76cc56fc0c06b951a46 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_%.bbappend @@ -0,0 +1,9 @@ +# Copyright (c) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +MAJ_VER = "${@oe.utils.trim_version("${PV}", 2)}" +PATCHPATH = "${CURDIR}/${BPN}_${MAJ_VER}" + +inherit auto-patch + +DEPENDS:append = " rockchip-librga" diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0001-Revert-decodebin-only-emit-drained-signal-when-top-c.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0001-Revert-decodebin-only-emit-drained-signal-when-top-c.patch new file mode 100644 index 0000000000000000000000000000000000000000..cc4dde0dd628cd5e4875906320c04257bcfb091c --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0001-Revert-decodebin-only-emit-drained-signal-when-top-c.patch @@ -0,0 +1,32 @@ +From 2a2e0188902049870dec98896a2269fc7859ae74 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 28 Apr 2022 17:31:28 +0800 +Subject: [PATCH 01/11] Revert "decodebin: only emit 'drained' signal when top + chain is drained" + +This reverts commit e945b3706c86aa13d05d195a1170e6277a247548. + +See: +https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/976 + +Signed-off-by: Jeffy Chen +--- + gst/playback/gstdecodebin2.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c +index f4be478..1a37434 100644 +--- a/gst/playback/gstdecodebin2.c ++++ b/gst/playback/gstdecodebin2.c +@@ -4239,7 +4239,7 @@ beach: + + *drained = chain->drained; + +- if (*drained && !chain->parent) /* only emit signal from top chain */ ++ if (*drained) + g_signal_emit (dbin, gst_decode_bin_signals[SIGNAL_DRAINED], 0, NULL); + + return handled; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0002-playbin2-send-one-about-to-finish-per-group.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0002-playbin2-send-one-about-to-finish-per-group.patch new file mode 100644 index 0000000000000000000000000000000000000000..dfb3a61c1c9726dac1eb71f7af2af06cd47d4300 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0002-playbin2-send-one-about-to-finish-per-group.patch @@ -0,0 +1,61 @@ +From 77af65033203b49b23640f856df964e7a6b5868b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= +Date: Mon, 9 Aug 2021 15:38:08 +0200 +Subject: [PATCH 02/11] playbin2: send one about-to-finish per group + +To avoid multiple about-to-finish signal, +driving the app to drop uris, a group should +signal "about-to-finish" and setup a next uri +only one time. + +Fixes #930 +--- + gst/playback/gstplaybin2.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c +index bcbfc20..3a441af 100644 +--- a/gst/playback/gstplaybin2.c ++++ b/gst/playback/gstplaybin2.c +@@ -319,6 +319,9 @@ struct _GstSourceGroup + GstElement *video_sink; + GstElement *text_sink; + ++ /* Avoid multiple about to finish handling */ ++ gboolean pending_about_to_finish; ++ + /* uridecodebins for uri and subtitle uri */ + GstElement *uridecodebin; + GstElement *suburidecodebin; +@@ -3933,6 +3936,12 @@ drained_cb (GstElement * decodebin, GstSourceGroup * group) + + GST_DEBUG_OBJECT (playbin, "about to finish in group %p", group); + ++ if (group->pending_about_to_finish) { ++ GST_DEBUG_OBJECT (playbin, ++ "Pending about to finish for group uri %s, do not handle.", group->uri); ++ return; ++ } ++ + /* after this call, we should have a next group to activate or we EOS */ + g_signal_emit (G_OBJECT (playbin), + gst_play_bin_signals[SIGNAL_ABOUT_TO_FINISH], 0, NULL); +@@ -3940,6 +3949,7 @@ drained_cb (GstElement * decodebin, GstSourceGroup * group) + /* now activate the next group. If the app did not set a uri, this will + * fail and we can do EOS */ + setup_next_source (playbin, GST_STATE_PAUSED); ++ group->pending_about_to_finish = TRUE; + } + + /* Like gst_element_factory_can_sink_any_caps() but doesn't +@@ -5515,6 +5525,7 @@ activate_group (GstPlayBin * playbin, GstSourceGroup * group, GstState target) + /* allow state changes of the playbin affect the group elements now */ + group_set_locked_state_unlocked (playbin, group, FALSE); + group->active = TRUE; ++ group->pending_about_to_finish = FALSE; + GST_SOURCE_GROUP_UNLOCK (group); + + return state_ret; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0003-playbin-do-not-drain-on-first-EOS.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0003-playbin-do-not-drain-on-first-EOS.patch new file mode 100644 index 0000000000000000000000000000000000000000..dbbc84f3bd2675eba1f45b2911907c71e4509923 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0003-playbin-do-not-drain-on-first-EOS.patch @@ -0,0 +1,264 @@ +From cf13568dda953e870332f8a6996940cbc2d36059 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= +Date: Mon, 9 Aug 2021 18:02:57 +0200 +Subject: [PATCH 03/11] playbin: do not drain on first EOS + +In a case of audio/video media, the decodebin +should wait for each branch to be on EOS before +draining the others. + +A new signal "wait-on-eos" has been implemented +for (uri)decodebin to tell that an EOS has been +received on a branch. + +In the case of playbin2, it will compare +the nb of active pads with the nb of EOS received +and decodebin will start to drain all the active pads when the nb +of EOS is equal to active pads (active combiners). +--- + gst/playback/gstdecodebin2.c | 37 ++++++++++++++++++++++++++++++++++ + gst/playback/gstplaybin2.c | 31 ++++++++++++++++++++++++++++ + gst/playback/gsturidecodebin.c | 32 +++++++++++++++++++++++++++++ + 3 files changed, 100 insertions(+) + +diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c +index 1a37434..e0b2a5d 100644 +--- a/gst/playback/gstdecodebin2.c ++++ b/gst/playback/gstdecodebin2.c +@@ -163,6 +163,9 @@ struct _GstDecodeBin + GMutex expose_lock; /* Protects exposal and removal of groups */ + GstDecodeChain *decode_chain; /* Top level decode chain */ + guint nbpads; /* unique identifier for source pads */ ++ guint nbpads_eos; /* number of pads in EOS */ ++ gboolean wait_on_eos; /* wait EOS on other pads */ ++ GCond eos_cond; /* condition to block the pad in EOS */ + + GMutex factories_lock; + guint32 factories_cookie; /* Cookie from last time when factories was updated */ +@@ -224,6 +227,8 @@ struct _GstDecodeBinClass + + /* fired when the last group is drained */ + void (*drained) (GstElement * element); ++ /* emitted when an EOS is received */ ++ gboolean (*wait_on_eos) (GstElement * element, guint eos_received); + }; + + /* signals */ +@@ -236,6 +241,7 @@ enum + SIGNAL_AUTOPLUG_SORT, + SIGNAL_AUTOPLUG_QUERY, + SIGNAL_DRAINED, ++ SIGNAL_WAIT_ON_EOS, + LAST_SIGNAL + }; + +@@ -870,6 +876,20 @@ gst_decode_bin_class_init (GstDecodeBinClass * klass) + G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstDecodeBinClass, drained), + NULL, NULL, NULL, G_TYPE_NONE, 0, G_TYPE_NONE); + ++ /** ++ * GstDecodeBin::wait-on-eos ++ * @bin: The decodebin ++ * @nb_eos: the number of EOS received ++ * ++ * This signal is emitted once decodebin has received an EOS. ++ * ++ * Since: 1.20 ++ */ ++ gst_decode_bin_signals[SIGNAL_WAIT_ON_EOS] = ++ g_signal_new ("wait-on-eos", G_TYPE_FROM_CLASS (klass), ++ G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstDecodeBinClass, wait_on_eos), ++ NULL, NULL, NULL, G_TYPE_BOOLEAN, 1, G_TYPE_UINT); ++ + g_object_class_install_property (gobject_klass, PROP_CAPS, + g_param_spec_boxed ("caps", "Caps", "The caps on which to stop decoding.", + GST_TYPE_CAPS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +@@ -1111,6 +1131,7 @@ gst_decode_bin_init (GstDecodeBin * decode_bin) + gst_object_unref (pad); + } + ++ g_cond_init (&decode_bin->eos_cond); + g_mutex_init (&decode_bin->expose_lock); + decode_bin->decode_chain = NULL; + +@@ -1177,6 +1198,7 @@ gst_decode_bin_finalize (GObject * object) + + decode_bin = GST_DECODE_BIN (object); + ++ g_cond_clear (&decode_bin->eos_cond); + g_mutex_clear (&decode_bin->expose_lock); + g_mutex_clear (&decode_bin->dyn_lock); + g_mutex_clear (&decode_bin->subtitle_lock); +@@ -4282,6 +4304,17 @@ gst_decode_pad_handle_eos (GstDecodePad * pad) + } + + EXPOSE_LOCK (dbin); ++ dbin->nbpads_eos++; ++ g_signal_emit (G_OBJECT (dbin), ++ gst_decode_bin_signals[SIGNAL_WAIT_ON_EOS], 0, dbin->nbpads_eos, ++ &dbin->wait_on_eos); ++ g_cond_broadcast (&dbin->eos_cond); ++ GST_DEBUG_OBJECT (dbin, "dbin->nbpads_eos %u wait_on_eos %u", ++ dbin->nbpads_eos, dbin->wait_on_eos); ++ ++ while (dbin->wait_on_eos) ++ g_cond_wait (&dbin->eos_cond, &dbin->expose_lock); ++ + if (dbin->decode_chain) { + drain_and_switch_chains (dbin->decode_chain, pad, &last_group, &drained, + &switched); +@@ -5323,6 +5356,10 @@ unblock_pads (GstDecodeBin * dbin) + GST_DEBUG_OBJECT (dpad, "unblocked"); + gst_object_unref (dpad); + } ++ dbin->nbpads = 0; ++ dbin->nbpads_eos = 0; ++ dbin->wait_on_eos = FALSE; ++ g_cond_broadcast (&dbin->eos_cond); + } + + static void +diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c +index 3a441af..a6679a2 100644 +--- a/gst/playback/gstplaybin2.c ++++ b/gst/playback/gstplaybin2.c +@@ -337,6 +337,7 @@ struct _GstSourceGroup + gulong notify_source_id; + gulong source_setup_id; + gulong drained_id; ++ gulong wait_on_eos_id; + gulong autoplug_factories_id; + gulong autoplug_select_id; + gulong autoplug_continue_id; +@@ -3952,6 +3953,30 @@ drained_cb (GstElement * decodebin, GstSourceGroup * group) + group->pending_about_to_finish = TRUE; + } + ++static gboolean ++wait_on_eos_cb (GstElement * decodebin, guint eos_received, ++ GstSourceGroup * group) ++{ ++ GstPlayBin *playbin = group->playbin; ++ int i; ++ guint active_pads = 0; ++ ++ for (i = 0; i < PLAYBIN_STREAM_LAST; i++) { ++ GstSourceCombine *combine = &group->combiner[i]; ++ if (combine->has_active_pad) ++ active_pads++; ++ } ++ ++ GST_DEBUG_OBJECT (playbin, ++ "%d eos received in group with uri %s, active pads %d", eos_received, ++ group->uri, active_pads); ++ ++ if (eos_received < active_pads) ++ return TRUE; ++ ++ return FALSE; ++} ++ + /* Like gst_element_factory_can_sink_any_caps() but doesn't + * allow ANY caps on the sinkpad template */ + static gboolean +@@ -5421,6 +5446,10 @@ activate_group (GstPlayBin * playbin, GstSourceGroup * group, GstState target) + group->drained_id = + g_signal_connect (uridecodebin, "drained", G_CALLBACK (drained_cb), + group); ++ /* is called when the uridecodebin received an EOS */ ++ group->wait_on_eos_id = ++ g_signal_connect (uridecodebin, "wait-on-eos", ++ G_CALLBACK (wait_on_eos_cb), group); + + /* will be called when a new media type is found. We return a list of decoders + * including sinks for decodebin to try */ +@@ -5594,6 +5623,7 @@ error_cleanup: + REMOVE_SIGNAL (group->uridecodebin, group->notify_source_id); + REMOVE_SIGNAL (group->uridecodebin, group->source_setup_id); + REMOVE_SIGNAL (group->uridecodebin, group->drained_id); ++ REMOVE_SIGNAL (group->uridecodebin, group->wait_on_eos_id); + REMOVE_SIGNAL (group->uridecodebin, group->autoplug_factories_id); + REMOVE_SIGNAL (group->uridecodebin, group->autoplug_select_id); + REMOVE_SIGNAL (group->uridecodebin, group->autoplug_continue_id); +@@ -5683,6 +5713,7 @@ deactivate_group (GstPlayBin * playbin, GstSourceGroup * group) + REMOVE_SIGNAL (group->uridecodebin, group->notify_source_id); + REMOVE_SIGNAL (group->uridecodebin, group->source_setup_id); + REMOVE_SIGNAL (group->uridecodebin, group->drained_id); ++ REMOVE_SIGNAL (group->uridecodebin, group->wait_on_eos_id); + REMOVE_SIGNAL (group->uridecodebin, group->autoplug_factories_id); + REMOVE_SIGNAL (group->uridecodebin, group->autoplug_select_id); + REMOVE_SIGNAL (group->uridecodebin, group->autoplug_continue_id); +diff --git a/gst/playback/gsturidecodebin.c b/gst/playback/gsturidecodebin.c +index d2ef658..07b6892 100644 +--- a/gst/playback/gsturidecodebin.c ++++ b/gst/playback/gsturidecodebin.c +@@ -147,6 +147,8 @@ struct _GstURIDecodeBinClass + + /* emitted when all data is decoded */ + void (*drained) (GstElement * element); ++ /* emitted when an EOS is received */ ++ gboolean (*wait_on_eos) (GstElement * element, guint eos_received); + }; + + static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src_%u", +@@ -170,6 +172,7 @@ enum + SIGNAL_AUTOPLUG_QUERY, + SIGNAL_DRAINED, + SIGNAL_SOURCE_SETUP, ++ SIGNAL_WAIT_ON_EOS, + LAST_SIGNAL + }; + +@@ -697,6 +700,19 @@ gst_uri_decode_bin_class_init (GstURIDecodeBinClass * klass) + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstURIDecodeBinClass, drained), NULL, NULL, NULL, + G_TYPE_NONE, 0, G_TYPE_NONE); ++ /** ++ * GstURIDecodeBin::wait-on-eos ++ * @bin: The decodebin ++ * @nb_eos: the number of EOS received ++ * ++ * This signal is emitted once decodebin has received an EOS. ++ * ++ * Since: 1.20 ++ */ ++ gst_uri_decode_bin_signals[SIGNAL_WAIT_ON_EOS] = ++ g_signal_new ("wait-on-eos", G_TYPE_FROM_CLASS (klass), ++ G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstURIDecodeBinClass, wait_on_eos), ++ NULL, NULL, NULL, G_TYPE_BOOLEAN, 1, G_TYPE_UINT); + + /** + * GstURIDecodeBin::source-setup: +@@ -1820,6 +1836,20 @@ proxy_drained_signal (GstElement * decodebin, GstURIDecodeBin * dec) + g_signal_emit (dec, gst_uri_decode_bin_signals[SIGNAL_DRAINED], 0, NULL); + } + ++ ++static gboolean ++proxy_wait_on_eos_signal (GstElement * decodebin, guint eos_received, ++ GstURIDecodeBin * dec) ++{ ++ gboolean result; ++ ++ g_signal_emit (dec, gst_uri_decode_bin_signals[SIGNAL_WAIT_ON_EOS], 0, ++ eos_received, &result); ++ GST_DEBUG_OBJECT (dec, "wait-on-eos returned %d", result); ++ ++ return result; ++} ++ + /* make a decodebin and connect to all the signals */ + static GstElement * + make_decoder (GstURIDecodeBin * decoder) +@@ -1863,6 +1893,8 @@ make_decoder (GstURIDecodeBin * decoder) + G_CALLBACK (proxy_autoplug_query_signal), decoder); + g_signal_connect (decodebin, "drained", + G_CALLBACK (proxy_drained_signal), decoder); ++ g_signal_connect (decodebin, "wait-on-eos", ++ G_CALLBACK (proxy_wait_on_eos_signal), decoder); + + /* set up callbacks to create the links between decoded data + * and video/audio/subtitle rendering/output. */ +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0004-playbin2-Fix-deadlock-when-hooking-about-to-finish-s.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0004-playbin2-Fix-deadlock-when-hooking-about-to-finish-s.patch new file mode 100644 index 0000000000000000000000000000000000000000..5a2cef8ffc1da8bf1f71cb711145a229e5e2a526 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0004-playbin2-Fix-deadlock-when-hooking-about-to-finish-s.patch @@ -0,0 +1,87 @@ +From bf3bd95ab0e9ce0c5df8aaa42783c8844c1ef4ef Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 26 Nov 2021 17:41:47 +0800 +Subject: [PATCH 04/11] playbin2: Fix deadlock when hooking about-to-finish + signal + +The playbin2 will deactivate old group in drain_cb() for that, which +would cause deadlock when other thread tries to notify pad-change at +the same time. + +Signed-off-by: Jeffy Chen +--- + gst/playback/gstplaybin2.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c +index a6679a2..f71b977 100644 +--- a/gst/playback/gstplaybin2.c ++++ b/gst/playback/gstplaybin2.c +@@ -389,6 +389,11 @@ G_STMT_START { \ + #define GST_PLAY_BIN_SHUTDOWN_UNLOCK(bin) \ + GST_PLAY_BIN_DYN_UNLOCK (bin); \ + ++/* lock to protect drain callbacks */ ++#define GST_PLAY_BIN_DRAIN_LOCK(bin) g_mutex_lock (&(bin)->drain_lock) ++#define GST_PLAY_BIN_DRAIN_TRYLOCK(bin) g_mutex_trylock (&(bin)->drain_lock) ++#define GST_PLAY_BIN_DRAIN_UNLOCK(bin) g_mutex_unlock (&(bin)->drain_lock) ++ + /** + * GstPlayBin: + * +@@ -431,6 +436,9 @@ struct _GstPlayBin + gint shutdown; + gboolean async_pending; /* async-start has been emitted */ + ++ /* lock protecting draining */ ++ GMutex drain_lock; ++ + GMutex elements_lock; + guint32 elements_cookie; + GList *elements; /* factories we can use for selecting elements */ +@@ -1537,6 +1545,7 @@ gst_play_bin_init (GstPlayBin * playbin) + { + g_rec_mutex_init (&playbin->lock); + g_mutex_init (&playbin->dyn_lock); ++ g_mutex_init (&playbin->drain_lock); + + /* assume we can create an input-selector */ + playbin->have_selector = TRUE; +@@ -1633,6 +1642,7 @@ gst_play_bin_finalize (GObject * object) + g_list_free_full (playbin->contexts, (GDestroyNotify) gst_context_unref); + + g_rec_mutex_clear (&playbin->lock); ++ g_mutex_clear (&playbin->drain_lock); + g_mutex_clear (&playbin->dyn_lock); + g_mutex_clear (&playbin->elements_lock); + +@@ -3132,7 +3142,14 @@ combiner_active_pad_changed (GObject * combiner, GParamSpec * pspec, + GstSourceCombine *combine = NULL; + int i; + ++ /* We got a pad-change after draining; no need to notify */ ++ if (!GST_PLAY_BIN_DRAIN_TRYLOCK (playbin)) ++ return; ++ + GST_PLAY_BIN_LOCK (playbin); ++ ++ GST_PLAY_BIN_DRAIN_UNLOCK (playbin); ++ + group = get_group (playbin); + + for (i = 0; i < PLAYBIN_STREAM_LAST; i++) { +@@ -3949,7 +3966,11 @@ drained_cb (GstElement * decodebin, GstSourceGroup * group) + + /* now activate the next group. If the app did not set a uri, this will + * fail and we can do EOS */ ++ ++ GST_PLAY_BIN_DRAIN_LOCK (playbin); + setup_next_source (playbin, GST_STATE_PAUSED); ++ GST_PLAY_BIN_DRAIN_UNLOCK (playbin); ++ + group->pending_about_to_finish = TRUE; + } + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0005-playbin3-Fix-qt-videoplayer-cannot-change-video-stat.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0005-playbin3-Fix-qt-videoplayer-cannot-change-video-stat.patch new file mode 100644 index 0000000000000000000000000000000000000000..371cfbef5a609d9c74f547084951effd340f4cfb --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0005-playbin3-Fix-qt-videoplayer-cannot-change-video-stat.patch @@ -0,0 +1,373 @@ +From 14aeb6ae37c0f137d7f3038efc51d25f8f371751 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 20 Nov 2018 14:51:36 +0800 +Subject: [PATCH 05/11] playbin3: Fix qt videoplayer cannot change video state + +Change-Id: I765bbe0caebe333855bd16fdd0843e0257491246 +Signed-off-by: shine.liu +Signed-off-by: Jeffy Chen +--- + gst/playback/gstplaybin3.c | 256 ++++++++++++++++++++++++++++++++++++- + 1 file changed, 252 insertions(+), 4 deletions(-) + +diff --git a/gst/playback/gstplaybin3.c b/gst/playback/gstplaybin3.c +index a732160..c22d9db 100644 +--- a/gst/playback/gstplaybin3.c ++++ b/gst/playback/gstplaybin3.c +@@ -532,6 +532,16 @@ struct _GstPlayBin3Class + + /* get the last video sample and convert it to the given caps */ + GstSample *(*convert_sample) (GstPlayBin3 * playbin, GstCaps * caps); ++ ++ /* notify app that number of audio/video/text streams changed */ ++ void (*video_changed) (GstPlayBin3 * playbin); ++ void (*audio_changed) (GstPlayBin3 * playbin); ++ void (*text_changed) (GstPlayBin3 * playbin); ++ ++ /* get audio/video/text tags for a stream */ ++ GstTagList *(*get_video_tags) (GstPlayBin3 * playbin, gint stream); ++ GstTagList *(*get_audio_tags) (GstPlayBin3 * playbin, gint stream); ++ GstTagList *(*get_text_tags) (GstPlayBin3 * playbin, gint stream); + }; + + /* props */ +@@ -565,6 +575,12 @@ enum + PROP_SUBURI, + PROP_CURRENT_SUBURI, + PROP_FLAGS, ++ PROP_N_VIDEO, ++ PROP_CURRENT_VIDEO, ++ PROP_N_AUDIO, ++ PROP_CURRENT_AUDIO, ++ PROP_N_TEXT, ++ PROP_CURRENT_TEXT, + PROP_SUBTITLE_ENCODING, + PROP_AUDIO_SINK, + PROP_VIDEO_SINK, +@@ -597,6 +613,12 @@ enum + SIGNAL_CONVERT_SAMPLE, + SIGNAL_SOURCE_SETUP, + SIGNAL_ELEMENT_SETUP, ++ SIGNAL_VIDEO_CHANGED, ++ SIGNAL_AUDIO_CHANGED, ++ SIGNAL_TEXT_CHANGED, ++ SIGNAL_GET_VIDEO_TAGS, ++ SIGNAL_GET_AUDIO_TAGS, ++ SIGNAL_GET_TEXT_TAGS, + LAST_SIGNAL + }; + +@@ -621,6 +643,13 @@ static void gst_play_bin3_deep_element_added (GstBin * playbin, + static gboolean gst_play_bin3_send_event (GstElement * element, + GstEvent * event); + ++static GstTagList *gst_play_bin3_get_video_tags (GstPlayBin3 * playbin, ++ gint stream); ++static GstTagList *gst_play_bin3_get_audio_tags (GstPlayBin3 * playbin, ++ gint stream); ++static GstTagList *gst_play_bin3_get_text_tags (GstPlayBin3 * playbin, ++ gint stream); ++ + static GstSample *gst_play_bin3_convert_sample (GstPlayBin3 * playbin, + GstCaps * caps); + +@@ -755,6 +784,36 @@ gst_play_bin3_class_init (GstPlayBin3Class * klass) + GST_TYPE_PLAY_FLAGS, DEFAULT_FLAGS, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + ++ g_object_class_install_property (gobject_klass, PROP_N_VIDEO, ++ g_param_spec_int ("n-video", "Number Video", ++ "Total number of video streams", 0, G_MAXINT, 0, ++ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); ++ ++ g_object_class_install_property (gobject_klass, PROP_CURRENT_VIDEO, ++ g_param_spec_int ("current-video", "Current Video", ++ "Currently playing video stream (-1 = auto)", ++ -1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); ++ ++ g_object_class_install_property (gobject_klass, PROP_N_AUDIO, ++ g_param_spec_int ("n-audio", "Number Audio", ++ "Total number of audio streams", 0, G_MAXINT, 0, ++ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); ++ ++ g_object_class_install_property (gobject_klass, PROP_CURRENT_AUDIO, ++ g_param_spec_int ("current-audio", "Current audio", ++ "Currently playing audio stream (-1 = auto)", ++ -1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); ++ ++ g_object_class_install_property (gobject_klass, PROP_N_TEXT, ++ g_param_spec_int ("n-text", "Number Text", ++ "Total number of text streams", 0, G_MAXINT, 0, ++ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); ++ ++ g_object_class_install_property (gobject_klass, PROP_CURRENT_TEXT, ++ g_param_spec_int ("current-text", "Current Text", ++ "Currently playing text stream (-1 = auto)", ++ -1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); ++ + g_object_class_install_property (gobject_klass, PROP_SUBTITLE_ENCODING, + g_param_spec_string ("subtitle-encoding", "subtitle encoding", + "Encoding to assume if input subtitles are not in UTF-8 encoding. " +@@ -1024,6 +1083,41 @@ gst_play_bin3_class_init (GstPlayBin3Class * klass) + g_signal_new ("element-setup", G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 1, GST_TYPE_ELEMENT); + ++ gst_play_bin3_signals[SIGNAL_VIDEO_CHANGED] = ++ g_signal_new ("video-changed", G_TYPE_FROM_CLASS (klass), ++ G_SIGNAL_RUN_LAST, ++ G_STRUCT_OFFSET (GstPlayBin3Class, video_changed), NULL, NULL, ++ g_cclosure_marshal_generic, G_TYPE_NONE, 0, G_TYPE_NONE); ++ ++ gst_play_bin3_signals[SIGNAL_AUDIO_CHANGED] = ++ g_signal_new ("audio-changed", G_TYPE_FROM_CLASS (klass), ++ G_SIGNAL_RUN_LAST, ++ G_STRUCT_OFFSET (GstPlayBin3Class, audio_changed), NULL, NULL, ++ g_cclosure_marshal_generic, G_TYPE_NONE, 0, G_TYPE_NONE); ++ ++ gst_play_bin3_signals[SIGNAL_TEXT_CHANGED] = ++ g_signal_new ("text-changed", G_TYPE_FROM_CLASS (klass), ++ G_SIGNAL_RUN_LAST, ++ G_STRUCT_OFFSET (GstPlayBin3Class, text_changed), NULL, NULL, ++ g_cclosure_marshal_generic, G_TYPE_NONE, 0, G_TYPE_NONE); ++ ++ gst_play_bin3_signals[SIGNAL_GET_VIDEO_TAGS] = ++ g_signal_new ("get-video-tags", G_TYPE_FROM_CLASS (klass), ++ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, ++ G_STRUCT_OFFSET (GstPlayBin3Class, get_video_tags), NULL, NULL, ++ g_cclosure_marshal_generic, GST_TYPE_TAG_LIST, 1, G_TYPE_INT); ++ ++ gst_play_bin3_signals[SIGNAL_GET_AUDIO_TAGS] = ++ g_signal_new ("get-audio-tags", G_TYPE_FROM_CLASS (klass), ++ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, ++ G_STRUCT_OFFSET (GstPlayBin3Class, get_audio_tags), NULL, NULL, ++ g_cclosure_marshal_generic, GST_TYPE_TAG_LIST, 1, G_TYPE_INT); ++ ++ gst_play_bin3_signals[SIGNAL_GET_TEXT_TAGS] = ++ g_signal_new ("get-text-tags", G_TYPE_FROM_CLASS (klass), ++ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, ++ G_STRUCT_OFFSET (GstPlayBin3Class, get_text_tags), NULL, NULL, ++ g_cclosure_marshal_generic, GST_TYPE_TAG_LIST, 1, G_TYPE_INT); + /** + * GstPlayBin3::convert-sample + * @playbin: a #GstPlayBin3 +@@ -1045,6 +1139,10 @@ gst_play_bin3_class_init (GstPlayBin3Class * klass) + G_STRUCT_OFFSET (GstPlayBin3Class, convert_sample), NULL, NULL, + NULL, GST_TYPE_SAMPLE, 1, GST_TYPE_CAPS); + ++ klass->get_video_tags = gst_play_bin3_get_video_tags; ++ klass->get_audio_tags = gst_play_bin3_get_audio_tags; ++ klass->get_text_tags = gst_play_bin3_get_text_tags; ++ + klass->convert_sample = gst_play_bin3_convert_sample; + + gst_element_class_set_static_metadata (gstelement_klass, +@@ -1559,6 +1657,72 @@ get_group (GstPlayBin3 * playbin) + return result; + } + ++static GstTagList * ++get_tags (GstPlayBin3 * playbin, gint type, gint stream) ++{ ++ GstTagList *result; ++ GPtrArray *channels; ++ GstPad *sinkpad; ++ ++ switch (type) { ++ case PLAYBIN_STREAM_AUDIO: ++ channels = playbin->combiner[PLAYBIN_STREAM_AUDIO].streams; ++ break; ++ case PLAYBIN_STREAM_VIDEO: ++ channels = playbin->combiner[PLAYBIN_STREAM_VIDEO].streams; ++ break; ++ case PLAYBIN_STREAM_TEXT: ++ channels = playbin->combiner[PLAYBIN_STREAM_TEXT].streams; ++ break; ++ default: ++ channels = NULL; ++ break; ++ } ++ ++ if (!channels || stream >= channels->len) ++ return NULL; ++ ++ sinkpad = g_ptr_array_index (channels, stream); ++ g_object_get (sinkpad, "tags", &result, NULL); ++ ++ return result; ++} ++ ++static GstTagList * ++gst_play_bin3_get_video_tags (GstPlayBin3 * playbin, gint stream) ++{ ++ GstTagList *result; ++ ++ GST_PLAY_BIN3_LOCK (playbin); ++ result = get_tags (playbin, PLAYBIN_STREAM_VIDEO, stream); ++ GST_PLAY_BIN3_UNLOCK (playbin); ++ ++ return result; ++} ++ ++static GstTagList * ++gst_play_bin3_get_audio_tags (GstPlayBin3 * playbin, gint stream) ++{ ++ GstTagList *result; ++ ++ GST_PLAY_BIN3_LOCK (playbin); ++ result = get_tags (playbin, PLAYBIN_STREAM_AUDIO, stream); ++ GST_PLAY_BIN3_UNLOCK (playbin); ++ ++ return result; ++} ++ ++static GstTagList * ++gst_play_bin3_get_text_tags (GstPlayBin3 * playbin, gint stream) ++{ ++ GstTagList *result; ++ ++ GST_PLAY_BIN3_LOCK (playbin); ++ result = get_tags (playbin, PLAYBIN_STREAM_TEXT, stream); ++ GST_PLAY_BIN3_UNLOCK (playbin); ++ ++ return result; ++} + + static GstSample * + gst_play_bin3_convert_sample (GstPlayBin3 * playbin, GstCaps * caps) +@@ -1772,6 +1936,15 @@ gst_play_bin3_set_property (GObject * object, guint prop_id, + GST_SOURCE_GROUP_UNLOCK (playbin->curr_group); + } + break; ++ case PROP_CURRENT_VIDEO: ++ gst_play_bin3_set_current_video_stream (playbin, g_value_get_int (value)); ++ break; ++ case PROP_CURRENT_AUDIO: ++ gst_play_bin3_set_current_audio_stream (playbin, g_value_get_int (value)); ++ break; ++ case PROP_CURRENT_TEXT: ++ gst_play_bin3_set_current_text_stream (playbin, g_value_get_int (value)); ++ break; + case PROP_SUBTITLE_ENCODING: + gst_play_bin3_set_encoding (playbin, g_value_get_string (value)); + break; +@@ -1960,6 +2133,57 @@ gst_play_bin3_get_property (GObject * object, guint prop_id, GValue * value, + case PROP_FLAGS: + g_value_set_flags (value, gst_play_bin3_get_flags (playbin)); + break; ++ case PROP_N_VIDEO: ++ { ++ gint n_video; ++ ++ GST_PLAY_BIN3_LOCK (playbin); ++ n_video = ++ (playbin->combiner[PLAYBIN_STREAM_VIDEO].streams ? playbin-> ++ combiner[PLAYBIN_STREAM_VIDEO].streams->len : 0); ++ g_value_set_int (value, n_video); ++ GST_PLAY_BIN3_UNLOCK (playbin); ++ break; ++ } ++ case PROP_CURRENT_VIDEO: ++ GST_PLAY_BIN3_LOCK (playbin); ++ g_value_set_int (value, playbin->current_video); ++ GST_PLAY_BIN3_UNLOCK (playbin); ++ break; ++ case PROP_N_AUDIO: ++ { ++ gint n_audio; ++ ++ GST_PLAY_BIN3_LOCK (playbin); ++ n_audio = ++ (playbin->combiner[PLAYBIN_STREAM_AUDIO].streams ? playbin-> ++ combiner[PLAYBIN_STREAM_AUDIO].streams->len : 0); ++ g_value_set_int (value, n_audio); ++ GST_PLAY_BIN3_UNLOCK (playbin); ++ break; ++ } ++ case PROP_CURRENT_AUDIO: ++ GST_PLAY_BIN3_LOCK (playbin); ++ g_value_set_int (value, playbin->current_audio); ++ GST_PLAY_BIN3_UNLOCK (playbin); ++ break; ++ case PROP_N_TEXT: ++ { ++ gint n_text; ++ ++ GST_PLAY_BIN3_LOCK (playbin); ++ n_text = ++ (playbin->combiner[PLAYBIN_STREAM_TEXT].streams ? playbin-> ++ combiner[PLAYBIN_STREAM_TEXT].streams->len : 0); ++ g_value_set_int (value, n_text); ++ GST_PLAY_BIN3_UNLOCK (playbin); ++ break; ++ } ++ case PROP_CURRENT_TEXT: ++ GST_PLAY_BIN3_LOCK (playbin); ++ g_value_set_int (value, playbin->current_text); ++ GST_PLAY_BIN3_UNLOCK (playbin); ++ break; + case PROP_SUBTITLE_ENCODING: + GST_PLAY_BIN3_LOCK (playbin); + g_value_take_string (value, +@@ -2569,9 +2793,7 @@ gst_play_bin3_handle_message (GstBin * bin, GstMessage * msg) + if (target_group) + gst_object_replace ((GstObject **) & target_group->collection, + (GstObject *) collection); +- /* FIXME: Only do the following if it's the current group? */ +- if (target_group == playbin->curr_group) +- update_combiner_info (playbin, target_group->collection); ++ update_combiner_info (playbin, target_group->collection); + if (pstate) + playbin->do_stream_selections = FALSE; + do_stream_selection (playbin, target_group); +@@ -3068,6 +3290,8 @@ pad_added_cb (GstElement * uridecodebin, GstPad * pad, GstSourceGroup * group) + gchar *pad_name; + GstPlayBin3 *playbin = group->playbin; + ++ gboolean changed = FALSE; ++ + GST_PLAY_BIN3_SHUTDOWN_LOCK (playbin, shutdown); + + pad_name = gst_object_get_name (GST_OBJECT (pad)); +@@ -3096,7 +3320,8 @@ pad_added_cb (GstElement * uridecodebin, GstPad * pad, GstSourceGroup * group) + + combine = &playbin->combiner[pb_stream_type]; + +- combiner_control_pad (playbin, combine, pad); ++ if (combiner_control_pad (playbin, combine, pad)) ++ changed = combine->combiner ? TRUE : FALSE; + + control_source_pad (group, pad, combine->stream_type); + +@@ -3111,6 +3336,29 @@ pad_added_cb (GstElement * uridecodebin, GstPad * pad, GstSourceGroup * group) + + GST_PLAY_BIN3_SHUTDOWN_UNLOCK (playbin); + ++ if (changed) { ++ int signal; ++ ++ switch (combine->type) { ++ case GST_PLAY_SINK_TYPE_VIDEO: ++ signal = SIGNAL_VIDEO_CHANGED; ++ break; ++ case GST_PLAY_SINK_TYPE_AUDIO: ++ signal = SIGNAL_AUDIO_CHANGED; ++ break; ++ case GST_PLAY_SINK_TYPE_TEXT: ++ signal = SIGNAL_TEXT_CHANGED; ++ break; ++ default: ++ signal = -1; ++ } ++ ++ if (signal >= 0) { ++ g_signal_emit (G_OBJECT (playbin), gst_play_bin3_signals[signal], 0, ++ NULL); ++ } ++ } ++ + return; + + /* ERRORS */ +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0006-playbin2-Add-preferred-audio-video-sink.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0006-playbin2-Add-preferred-audio-video-sink.patch new file mode 100644 index 0000000000000000000000000000000000000000..93a302c9d2bb650be9a2bc4dae01a6613a7a5563 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0006-playbin2-Add-preferred-audio-video-sink.patch @@ -0,0 +1,86 @@ +From 0372b83dc2679de0e1a6ad5ede372ca85e6e1793 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 14 Jun 2019 12:02:05 +0800 +Subject: [PATCH 06/11] playbin2: Add preferred audio/video sink + +Using env "PLAYBIN2_PREFERRED_VIDEOSINK" and +"PLAYBIN2_PREFERRED_AUDIOSINK". + +Signed-off-by: Jeffy Chen +--- + gst/playback/gstplaybin2.c | 31 +++++++++++++++++++++++++++++++ + 1 file changed, 31 insertions(+) + +diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c +index f71b977..b0879db 100644 +--- a/gst/playback/gstplaybin2.c ++++ b/gst/playback/gstplaybin2.c +@@ -204,6 +204,7 @@ + #include "config.h" + #endif + ++#include + #include + #include + +@@ -480,6 +481,9 @@ struct _GstPlayBin + GList *contexts; + + gboolean is_live; ++ ++ const gchar *apreferred; ++ const gchar *vpreferred; + }; + + struct _GstPlayBinClass +@@ -1585,6 +1589,9 @@ gst_play_bin_init (GstPlayBin * playbin) + + playbin->multiview_mode = GST_VIDEO_MULTIVIEW_FRAME_PACKING_NONE; + playbin->multiview_flags = GST_VIDEO_MULTIVIEW_FLAGS_NONE; ++ ++ playbin->apreferred = g_getenv ("PLAYBIN2_PREFERRED_AUDIOSINK"); ++ playbin->vpreferred = g_getenv ("PLAYBIN2_PREFERRED_VIDEOSINK"); + } + + static void +@@ -4722,6 +4729,7 @@ autoplug_select_cb (GstElement * decodebin, GstPad * pad, + GSequence *ave_seq = NULL; + GSequenceIter *seq_iter; + gboolean created_sink = FALSE; ++ const gchar *preferred = NULL; + + playbin = group->playbin; + +@@ -4784,6 +4792,29 @@ autoplug_select_cb (GstElement * decodebin, GstPad * pad, + ave_list = g_list_prepend (ave_list, NULL); + } + ++ if (isaudiodec) ++ preferred = playbin->apreferred; ++ else if (isvideodec) ++ preferred = playbin->vpreferred; ++ ++ if (preferred) { ++ for (l = ave_list; l; l = l->next) { ++ ave = (GstAVElement *) l->data; ++ ++ if (ave && ave->sink && ++ !strcmp (preferred, GST_OBJECT_NAME (ave->sink))) { ++ GST_DEBUG_OBJECT (playbin, ++ "Preferred sink '%s' for decoder '%s'", ++ gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (ave->sink)), ++ gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (factory))); ++ ++ ave_list = g_list_delete_link (ave_list, l); ++ ave_list = g_list_prepend (ave_list, ave); ++ break; ++ } ++ } ++ } ++ + /* if it is a decoder and we don't have a fixed sink, then find out + * the matching audio/video sink from GstAVElements list */ + for (l = ave_list; l; l = l->next) { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0007-HACK-xvimagesink-Support-dma-buffer-rendering.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0007-HACK-xvimagesink-Support-dma-buffer-rendering.patch new file mode 100644 index 0000000000000000000000000000000000000000..d2ddb10d5d002456b3d32eb96d2df32fd5cbab39 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0007-HACK-xvimagesink-Support-dma-buffer-rendering.patch @@ -0,0 +1,580 @@ +From 094fec0f3717ec330426a1c004d6350239926f2d Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 3 Jul 2019 19:54:36 +0800 +Subject: [PATCH 07/13] HACK: xvimagesink: Support dma buffer rendering + +Send dma buffer to xv port when it supports dma port attributes. + +Change-Id: I69d94ffb700eb95af83799cdd5cde476d2930f92 +Signed-off-by: Jeffy Chen +--- + sys/xvimage/meson.build | 4 +- + sys/xvimage/xvcontext.c | 71 +++++++++- + sys/xvimage/xvcontext.h | 20 +++ + sys/xvimage/xvimagesink.c | 270 ++++++++++++++++++++++++++++++++++++-- + sys/xvimage/xvimagesink.h | 10 ++ + 5 files changed, 361 insertions(+), 14 deletions(-) + +diff --git a/sys/xvimage/meson.build b/sys/xvimage/meson.build +index f1aaecf1a..9b21c6046 100644 +--- a/sys/xvimage/meson.build ++++ b/sys/xvimage/meson.build +@@ -12,6 +12,8 @@ if cc.has_argument ('-Wno-deprecated-declarations') + no_warn_args += '-Wno-deprecated-declarations' + endif + ++libdrm_dep = dependency('libdrm') ++ + xvideo_dep = dependency('xv', required : get_option('xvideo')) + + if xvideo_dep.found() +@@ -19,7 +21,7 @@ if xvideo_dep.found() + xvimage_sources, + c_args : gst_plugins_base_args + no_warn_args, + include_directories: [configinc, libsinc], +- dependencies : glib_deps + [video_dep, gst_base_dep, gst_dep, x11_dep, xshm_dep, xvideo_dep, libm], ++ dependencies : glib_deps + [video_dep, gst_base_dep, gst_dep, x11_dep, xshm_dep, xvideo_dep, libdrm_dep, libm, allocators_dep], + install : true, + install_dir : plugins_install_dir, + ) +diff --git a/sys/xvimage/xvcontext.c b/sys/xvimage/xvcontext.c +index 56dee97e0..839fb71aa 100644 +--- a/sys/xvimage/xvcontext.c ++++ b/sys/xvimage/xvcontext.c +@@ -97,7 +97,7 @@ gst_lookup_xv_port_from_adaptor (GstXvContext * context, + the port via XvGrabPort */ + static GstCaps * + gst_xvcontext_get_xv_support (GstXvContext * context, +- const GstXvContextConfig * config, GError ** error) ++ GstXvContextConfig * config, GError ** error) + { + gint i; + XvAdaptorInfo *adaptors; +@@ -150,9 +150,11 @@ gst_xvcontext_get_xv_support (GstXvContext * context, + if (!context->xv_port_id) + goto no_ports; + ++ config->dma_client_id = context->xv_port_id; ++ + /* Set XV_AUTOPAINT_COLORKEY and XV_DOUBLE_BUFFER and XV_COLORKEY */ + { +- int count, todo = 4; ++ int count, todo = 7; + XvAttribute *const attr = XvQueryPortAttributes (context->disp, + context->xv_port_id, &count); + static const char autopaint[] = "XV_AUTOPAINT_COLORKEY"; +@@ -160,6 +162,9 @@ gst_xvcontext_get_xv_support (GstXvContext * context, + static const char colorkey[] = "XV_COLORKEY"; + static const char iturbt709[] = "XV_ITURBT_709"; + static const char *xv_colorspace = "XV_COLORSPACE"; ++ static const char dma_client_id[] = XV_DMA_CLIENT_PROP; ++ static const char dma_drm_fourcc[] = XV_DMA_DRM_FOURCC_PROP; ++ static const char dma_drm_afbc[] = XV_DMA_DRM_AFBC_PROP; + + GST_DEBUG ("Checking %d Xv port attributes", count); + +@@ -168,6 +173,7 @@ gst_xvcontext_get_xv_support (GstXvContext * context, + context->have_colorkey = FALSE; + context->have_iturbt709 = FALSE; + context->have_xvcolorspace = FALSE; ++ context->have_dma_client = FALSE; + + for (i = 0; ((i < count) && todo); i++) { + GST_DEBUG ("Got attribute %s", attr[i].name); +@@ -239,6 +245,19 @@ gst_xvcontext_get_xv_support (GstXvContext * context, + } else if (!strcmp (attr[i].name, xv_colorspace)) { + context->have_xvcolorspace = TRUE; + todo--; ++ } else if (!strcmp (attr[i].name, dma_client_id)) { ++ const Atom atom = XInternAtom (context->disp, dma_client_id, False); ++ ++ XvSetPortAttribute (context->disp, context->xv_port_id, atom, ++ config->dma_client_id); ++ todo--; ++ context->have_dma_client = TRUE; ++ } else if (!strcmp (attr[i].name, dma_drm_fourcc)) { ++ todo--; ++ context->have_dma_drm_fourcc = TRUE; ++ } else if (!strcmp (attr[i].name, dma_drm_afbc)) { ++ todo--; ++ context->have_dma_drm_afbc = TRUE; + } + } + +@@ -353,6 +372,50 @@ gst_xvcontext_get_xv_support (GstXvContext * context, + if (gst_caps_is_empty (caps)) + goto no_caps; + ++ if (context->have_dma_drm_afbc) { ++ GstCaps *format_caps; ++ ++ format_caps = gst_caps_new_simple ("video/x-raw", ++ "format", G_TYPE_STRING, "NV12", ++ "width", GST_TYPE_INT_RANGE, 1, max_w, ++ "height", GST_TYPE_INT_RANGE, 1, max_h, ++ "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); ++ gst_caps_set_simple (format_caps, "arm-afbc", G_TYPE_INT, 1, NULL); ++ gst_caps_append (caps, format_caps); ++ } ++ ++ if (context->have_dma_drm_fourcc) { ++ GstCaps *format_caps; ++ ++ format_caps = gst_caps_new_simple ("video/x-raw", ++ "format", G_TYPE_STRING, "NV16", ++ "width", GST_TYPE_INT_RANGE, 1, max_w, ++ "height", GST_TYPE_INT_RANGE, 1, max_h, ++ "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); ++ if (context->have_dma_drm_afbc) { ++ gst_caps_ref (format_caps); ++ gst_caps_append (caps, format_caps); ++ ++ gst_caps_set_simple (format_caps, "arm-afbc", G_TYPE_INT, 1, NULL); ++ } ++ gst_caps_append (caps, format_caps); ++ ++ format_caps = gst_caps_new_simple ("video/x-raw", ++ "format", G_TYPE_STRING, "NV12_10LE40", ++ "width", GST_TYPE_INT_RANGE, 1, max_w, ++ "height", GST_TYPE_INT_RANGE, 1, max_h, ++ "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); ++ if (context->have_dma_drm_afbc) { ++ gst_caps_ref (format_caps); ++ gst_caps_append (caps, format_caps); ++ ++ gst_caps_set_simple (format_caps, "arm-afbc", G_TYPE_INT, 1, NULL); ++ } ++ gst_caps_append (caps, format_caps); ++ } ++ ++ GST_DEBUG ("Final caps caps: %" GST_PTR_FORMAT, caps); ++ + return caps; + + /* ERRORS */ +@@ -891,6 +954,10 @@ gst_xvcontext_get_format_from_info (GstXvContext * context, + { + GList *list = NULL; + ++ /* HACK: Use NV12 format for fake formats */ ++ if (context->drm_fourcc != -1) ++ return DRM_FORMAT_NV12; ++ + list = context->formats_list; + + while (list) { +diff --git a/sys/xvimage/xvcontext.h b/sys/xvimage/xvcontext.h +index 701b527fa..607f6f934 100644 +--- a/sys/xvimage/xvcontext.h ++++ b/sys/xvimage/xvcontext.h +@@ -42,6 +42,19 @@ + + #include + ++#include ++ ++#define XV_DMA_CLIENT_PROP "XV_DMA_CLIENT_ID" ++#define XV_DMA_VER_STRIDE_PROP "XV_DMA_VER_STRIDE" ++#define XV_DMA_HOR_STRIDE_PROP "XV_DMA_HOR_STRIDE" ++#define XV_DMA_DRM_FOURCC_PROP "XV_DMA_DRM_FOURCC" ++#define XV_DMA_DRM_AFBC_PROP "XV_DMA_DRM_AFBC" ++#define XV_DMA_CLIENT_PATH "/tmp/.xv_dma_client" ++ ++#ifndef DRM_FORMAT_NV12_10 ++#define DRM_FORMAT_NV12_10 fourcc_code('N', 'A', '1', '2') ++#endif ++ + G_BEGIN_DECLS + + typedef struct _GstXvContextConfig GstXvContextConfig; +@@ -69,6 +82,8 @@ struct _GstXvContextConfig + gint hue; + gint saturation; + gboolean cb_changed; ++ ++ guint dma_client_id; + }; + + /** +@@ -161,6 +176,11 @@ struct _GstXvContext + gboolean have_double_buffer; + gboolean have_iturbt709; + gboolean have_xvcolorspace; ++ gboolean have_dma_client; ++ gboolean have_dma_drm_fourcc; ++ gboolean have_dma_drm_afbc; ++ ++ guint32 drm_fourcc; + + GList *formats_list; + +diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c +index 993d3f773..00f995a8e 100644 +--- a/sys/xvimage/xvimagesink.c ++++ b/sys/xvimage/xvimagesink.c +@@ -121,6 +121,7 @@ + #include + /* Helper functions */ + #include ++#include + + /* Object header */ + #include "xvimagesink.h" +@@ -132,6 +133,11 @@ + /* for XkbKeycodeToKeysym */ + #include + ++#include ++#include ++#include ++#include ++ + GST_DEBUG_CATEGORY_EXTERN (gst_debug_xv_context); + GST_DEBUG_CATEGORY_EXTERN (gst_debug_xv_image_pool); + GST_DEBUG_CATEGORY (gst_debug_xv_image_sink); +@@ -230,6 +236,173 @@ GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (xvimagesink, "xvimagesink", + /* */ + /* ============================================================= */ + ++static void ++gst_xv_image_sink_check_dma_client (GstXvImageSink * xvimagesink) ++{ ++ GstXvContext *context = xvimagesink->context; ++ Atom prop_atom; ++ int xv_value = 0; ++ ++ if (!context->have_dma_client) ++ return; ++ ++ g_mutex_lock (&context->lock); ++ prop_atom = XInternAtom (context->disp, XV_DMA_CLIENT_PROP, True); ++ if (prop_atom != None) { ++ XvGetPortAttribute (context->disp, context->xv_port_id, ++ prop_atom, &xv_value); ++ } ++ g_mutex_unlock (&context->lock); ++ ++ context->have_dma_client = xv_value > 0; ++} ++ ++static void ++gst_xv_image_sink_flush_dma_client (GstXvImageSink * xvimagesink) ++{ ++ GstXvContext *context = xvimagesink->context; ++ Atom prop_atom; ++ int xv_value; ++ ++ if (!context->have_dma_client) ++ return; ++ ++ g_mutex_lock (&context->lock); ++ prop_atom = XInternAtom (context->disp, XV_DMA_CLIENT_PROP, True); ++ if (prop_atom != None) { ++ XvSetPortAttribute (context->disp, context->xv_port_id, ++ prop_atom, xvimagesink->config.dma_client_id); ++ XvGetPortAttribute (context->disp, context->xv_port_id, ++ prop_atom, &xv_value); ++ } ++ g_mutex_unlock (&context->lock); ++} ++ ++static void ++gst_xv_image_sink_disable_dma_client (GstXvImageSink * xvimagesink) ++{ ++ GstXvContext *context = xvimagesink->context; ++ Atom prop_atom; ++ ++ if (!context->have_dma_client) ++ return; ++ ++ g_mutex_lock (&context->lock); ++ prop_atom = XInternAtom (context->disp, XV_DMA_CLIENT_PROP, True); ++ if (prop_atom != None) { ++ XvSetPortAttribute (context->disp, context->xv_port_id, prop_atom, 0); ++ } ++ g_mutex_unlock (&context->lock); ++ ++ context->have_dma_client = FALSE; ++} ++ ++static gboolean ++gst_xv_image_sink_send_dma_params (GstXvImageSink * xvimagesink, ++ gint hor_stride, gint ver_stride, gboolean afbc) ++{ ++ GstXvContext *context = xvimagesink->context; ++ Atom prop_atom; ++ gboolean error = FALSE; ++ ++ if (!context->have_dma_client) ++ return FALSE; ++ ++ g_mutex_lock (&context->lock); ++ prop_atom = XInternAtom (context->disp, XV_DMA_HOR_STRIDE_PROP, True); ++ if (prop_atom != None) { ++ XvSetPortAttribute (context->disp, context->xv_port_id, ++ prop_atom, hor_stride); ++ } else { ++ error = TRUE; ++ } ++ prop_atom = XInternAtom (context->disp, XV_DMA_VER_STRIDE_PROP, True); ++ if (prop_atom != None) { ++ XvSetPortAttribute (context->disp, context->xv_port_id, ++ prop_atom, ver_stride); ++ } else { ++ error = TRUE; ++ } ++ prop_atom = XInternAtom (context->disp, XV_DMA_DRM_FOURCC_PROP, True); ++ if (prop_atom != None) { ++ XvSetPortAttribute (context->disp, context->xv_port_id, ++ prop_atom, context->drm_fourcc); ++ } ++ prop_atom = XInternAtom (context->disp, XV_DMA_DRM_AFBC_PROP, True); ++ if (prop_atom != None) { ++ XvSetPortAttribute (context->disp, context->xv_port_id, prop_atom, afbc); ++ } ++ g_mutex_unlock (&context->lock); ++ ++ if (error == TRUE) { ++ gst_xv_image_sink_disable_dma_client (xvimagesink); ++ return FALSE; ++ } ++ ++ return TRUE; ++} ++ ++static gboolean ++gst_xv_image_sink_send_dma_fd (GstXvImageSink * xvimagesink, gint dma_fd) ++{ ++ GstXvContext *context = xvimagesink->context; ++ struct sockaddr_un addr; ++ struct iovec iov; ++ struct msghdr msg; ++ struct cmsghdr *header; ++ gchar buf[CMSG_SPACE (sizeof (int))]; ++ gint socket_fd; ++ ++ if (!context->have_dma_client) ++ return FALSE; ++ ++ gst_xv_image_sink_flush_dma_client (xvimagesink); ++ ++ socket_fd = socket (PF_UNIX, SOCK_DGRAM, 0); ++ if (socket_fd < 0) ++ goto failed; ++ ++ addr.sun_family = AF_LOCAL; ++ snprintf (addr.sun_path, sizeof (addr.sun_path), ++ XV_DMA_CLIENT_PATH ".%d", xvimagesink->config.dma_client_id); ++ addr.sun_path[sizeof (addr.sun_path) - 1] = '\0'; ++ ++ if (connect (socket_fd, (struct sockaddr *) &addr, sizeof (addr)) < 0) ++ goto failed; ++ ++ iov.iov_base = buf; ++ iov.iov_len = 1; ++ ++ msg.msg_iov = &iov; ++ msg.msg_iovlen = 1; ++ msg.msg_control = buf; ++ msg.msg_controllen = sizeof (buf); ++ msg.msg_name = NULL; ++ msg.msg_namelen = 0; ++ ++ header = CMSG_FIRSTHDR (&msg); ++ header->cmsg_level = SOL_SOCKET; ++ header->cmsg_type = SCM_RIGHTS; ++ ++ header->cmsg_len = CMSG_LEN (sizeof (int)); ++ *((int *) CMSG_DATA (header)) = dma_fd; ++ sendmsg (socket_fd, &msg, 0); ++ ++ /* Send am empty msg at the end */ ++ header->cmsg_len = CMSG_LEN (0); ++ sendmsg (socket_fd, &msg, 0); ++ ++ close (socket_fd); ++ return TRUE; ++ ++failed: ++ gst_xv_image_sink_disable_dma_client (xvimagesink); ++ ++ if (socket_fd >= 0) ++ close (socket_fd); ++ ++ return FALSE; ++} + + /* This function puts a GstXvImage on a GstXvImageSink's window. Returns FALSE + * if no window was available */ +@@ -317,6 +490,13 @@ gst_xv_image_sink_xvimage_put (GstXvImageSink * xvimagesink, + memcpy (&result, &xwindow->render_rect, sizeof (GstVideoRectangle)); + } + ++ if (gst_buffer_n_memory (xvimage) > 1) { ++ GstMemory *dma_mem = gst_buffer_peek_memory (xvimage, 1); ++ gint dma_fd = gst_dmabuf_memory_get_fd (dma_mem); ++ if (dma_fd >= 0) ++ gst_xv_image_sink_send_dma_fd (xvimagesink, dma_fd); ++ } ++ + gst_xvimage_memory_render (mem, &src, xwindow, &result, draw_border); + + g_mutex_unlock (&xvimagesink->flow_lock); +@@ -699,6 +879,27 @@ config_failed: + } + } + ++static gboolean ++gst_xv_video_info_from_caps (GstVideoInfo * info, const GstCaps * caps) ++{ ++ GstStructure *s; ++ gint value; ++ ++ if (!gst_video_info_from_caps (info, caps)) ++ return FALSE; ++ ++ /* parse AFBC from caps */ ++ s = gst_caps_get_structure (caps, 0); ++ if (gst_structure_get_int (s, "arm-afbc", &value)) { ++ if (value) ++ GST_VIDEO_INFO_SET_AFBC (info); ++ else ++ GST_VIDEO_INFO_UNSET_AFBC (info); ++ } ++ ++ return TRUE; ++} ++ + static gboolean + gst_xv_image_sink_setcaps (GstBaseSink * bsink, GstCaps * caps) + { +@@ -721,7 +922,7 @@ gst_xv_image_sink_setcaps (GstBaseSink * bsink, GstCaps * caps) + if (!gst_caps_can_intersect (context->caps, caps)) + goto incompatible_caps; + +- if (!gst_video_info_from_caps (&info, caps)) ++ if (!gst_xv_video_info_from_caps (&info, caps)) + goto invalid_format; + + xvimagesink->fps_n = info.fps_n; +@@ -831,6 +1032,20 @@ gst_xv_image_sink_setcaps (GstBaseSink * bsink, GstCaps * caps) + gst_object_unref (oldpool); + } + ++ context->drm_fourcc = -1; ++ ++ if (GST_VIDEO_INFO_FORMAT (&info) == GST_VIDEO_FORMAT_NV12_10LE40) { ++ if (!context->have_dma_drm_fourcc) ++ return FALSE; ++ ++ context->drm_fourcc = DRM_FORMAT_NV12_10; ++ } else if (GST_VIDEO_INFO_FORMAT (&info) == GST_VIDEO_FORMAT_NV16) { ++ if (!context->have_dma_drm_fourcc) ++ return FALSE; ++ ++ context->drm_fourcc = DRM_FORMAT_NV16; ++ } ++ + return TRUE; + + /* ERRORS */ +@@ -983,6 +1198,47 @@ gst_xv_image_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf) + if (res != GST_FLOW_OK) + goto no_buffer; + ++ if ((crop_meta = gst_buffer_get_video_crop_meta (buf))) { ++ GstVideoCropMeta *dmeta = gst_buffer_add_video_crop_meta (to_put); ++ ++ dmeta->x = crop_meta->x; ++ dmeta->y = crop_meta->y; ++ dmeta->width = crop_meta->width; ++ dmeta->height = crop_meta->height; ++ } ++ ++ mem = gst_buffer_peek_memory (buf, 0); ++ gst_xv_image_sink_check_dma_client (xvimagesink); ++ if (gst_is_dmabuf_memory (mem) && xvimagesink->context->have_dma_client) { ++ GstVideoMeta *vmeta = gst_buffer_get_video_meta (buf); ++ gint hor_stride, ver_stride; ++ ++ /* If this buffer is dmabuf and the xserver supports dma_client, we will ++ send the dmabuf fd directly */ ++ GST_LOG_OBJECT (xvimagesink, "buffer %p is dmabuf, will send dmabuf fd", ++ buf); ++ ++ /* Stash the dmabuf in index 1 */ ++ gst_buffer_insert_memory (to_put, 1, gst_buffer_get_memory (buf, 0)); ++ ++ /* Try to send dmabuf params */ ++ if (vmeta) { ++ hor_stride = vmeta->stride[0]; ++ ver_stride = vmeta->height; ++ ++ if (vmeta->n_planes > 1) ++ ver_stride = vmeta->offset[1] / hor_stride; ++ } else { ++ hor_stride = xvimagesink->info.width; ++ ver_stride = xvimagesink->info.height; ++ } ++ ++ if (gst_xv_image_sink_send_dma_params (xvimagesink, ++ hor_stride, ver_stride, ++ GST_VIDEO_INFO_IS_AFBC (&xvimagesink->info))) ++ goto put_image; ++ } ++ + GST_CAT_LOG_OBJECT (GST_CAT_PERFORMANCE, xvimagesink, + "slow copy buffer %p into bufferpool buffer %p", buf, to_put); + +@@ -998,17 +1254,9 @@ gst_xv_image_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf) + + gst_video_frame_unmap (&dest); + gst_video_frame_unmap (&src); +- +- if ((crop_meta = gst_buffer_get_video_crop_meta (buf))) { +- GstVideoCropMeta *dmeta = gst_buffer_add_video_crop_meta (to_put); +- +- dmeta->x = crop_meta->x; +- dmeta->y = crop_meta->y; +- dmeta->width = crop_meta->width; +- dmeta->height = crop_meta->height; +- } + } + ++put_image: + if (!gst_xv_image_sink_xvimage_put (xvimagesink, to_put)) + goto no_window; + +@@ -1097,7 +1345,7 @@ gst_xv_image_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query) + if (caps == NULL) + goto no_caps; + +- if (!gst_video_info_from_caps (&info, caps)) ++ if (!gst_xv_video_info_from_caps (&info, caps)) + goto invalid_caps; + + /* the normal size of a frame */ +diff --git a/sys/xvimage/xvimagesink.h b/sys/xvimage/xvimagesink.h +index 6f5ffa156..35a3081e9 100644 +--- a/sys/xvimage/xvimagesink.h ++++ b/sys/xvimage/xvimagesink.h +@@ -25,6 +25,16 @@ + /* Helper functions */ + #include + ++#ifndef GST_VIDEO_FLAG_ARM_AFBC ++#define GST_VIDEO_FLAG_ARM_AFBC (1UL << 31) ++#define GST_VIDEO_INFO_SET_AFBC(i) \ ++ GST_VIDEO_INFO_FLAG_SET (i, GST_VIDEO_FLAG_ARM_AFBC) ++#define GST_VIDEO_INFO_UNSET_AFBC(i) \ ++ GST_VIDEO_INFO_FLAG_UNSET (i, GST_VIDEO_FLAG_ARM_AFBC) ++#define GST_VIDEO_INFO_IS_AFBC(i) \ ++ GST_VIDEO_INFO_FLAG_IS_SET (i, GST_VIDEO_FLAG_ARM_AFBC) ++#endif ++ + G_BEGIN_DECLS + #define GST_TYPE_XV_IMAGE_SINK \ + (gst_xv_image_sink_get_type()) +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0008-video-converter-Support-rockchip-RGA-2D-accel.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0008-video-converter-Support-rockchip-RGA-2D-accel.patch new file mode 100644 index 0000000000000000000000000000000000000000..19ee216563b176e70c1bfbea6fd7acc8c55000dc --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0008-video-converter-Support-rockchip-RGA-2D-accel.patch @@ -0,0 +1,256 @@ +From c91768dd2ab61594ea316a519b9bf9fe67f8cdb0 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 31 Oct 2019 18:45:19 +0800 +Subject: [PATCH 08/11] video-converter: Support rockchip RGA 2D accel + +Disabled by default, set env GST_VIDEO_CONVERT_USE_RGA=1 to enable. + +Signed-off-by: Jeffy Chen +--- + gst-libs/gst/video/meson.build | 2 +- + gst-libs/gst/video/video-converter.c | 180 +++++++++++++++++++++++++++ + meson.build | 3 + + 3 files changed, 184 insertions(+), 1 deletion(-) + +diff --git a/gst-libs/gst/video/meson.build b/gst-libs/gst/video/meson.build +index c0abb22..3999a98 100644 +--- a/gst-libs/gst/video/meson.build ++++ b/gst-libs/gst/video/meson.build +@@ -111,7 +111,7 @@ gstvideo_h = video_enums[1] + video_gen_sources = [gstvideo_h] + + orcsrc = 'video-orc' +-gstvideo_deps = [gst_base_dep, libm] ++gstvideo_deps = [gst_base_dep, libm, rga_dep] + if have_orcc + gstvideo_deps += [orc_dep] + orc_h = custom_target(orcsrc + '.h', +diff --git a/gst-libs/gst/video/video-converter.c b/gst-libs/gst/video/video-converter.c +index 50bb7d6..a40a5e3 100644 +--- a/gst-libs/gst/video/video-converter.c ++++ b/gst-libs/gst/video/video-converter.c +@@ -38,6 +38,11 @@ + + #include "video-orc.h" + ++#ifdef HAVE_RGA ++#include ++#include ++#endif ++ + /** + * SECTION:videoconverter + * @title: GstVideoConverter +@@ -2742,6 +2747,169 @@ gst_video_converter_get_config (GstVideoConverter * convert) + return convert->config; + } + ++#ifdef HAVE_RGA ++static RgaSURF_FORMAT ++get_rga_format (GstVideoFormat format) ++{ ++ switch (format) { ++ case GST_VIDEO_FORMAT_BGRA: ++ case GST_VIDEO_FORMAT_BGRx: ++ return RK_FORMAT_BGRA_8888; ++ case GST_VIDEO_FORMAT_RGBA: ++ return RK_FORMAT_RGBA_8888; ++ case GST_VIDEO_FORMAT_RGBx: ++ return RK_FORMAT_RGBX_8888; ++ case GST_VIDEO_FORMAT_BGR: ++ return RK_FORMAT_BGR_888; ++ case GST_VIDEO_FORMAT_RGB: ++ return RK_FORMAT_RGB_888; ++ case GST_VIDEO_FORMAT_BGR16: ++ return RK_FORMAT_RGB_565; ++ case GST_VIDEO_FORMAT_NV12: ++ return RK_FORMAT_YCbCr_420_SP; ++ case GST_VIDEO_FORMAT_NV21: ++ return RK_FORMAT_YCrCb_420_SP; ++ case GST_VIDEO_FORMAT_I420: ++ return RK_FORMAT_YCbCr_420_P; ++ case GST_VIDEO_FORMAT_YV12: ++ return RK_FORMAT_YCrCb_420_P; ++ case GST_VIDEO_FORMAT_NV16: ++ return RK_FORMAT_YCbCr_422_SP; ++ case GST_VIDEO_FORMAT_NV61: ++ return RK_FORMAT_YCrCb_422_SP; ++ case GST_VIDEO_FORMAT_Y42B: ++ return RK_FORMAT_YCbCr_422_P; ++ case GST_VIDEO_FORMAT_NV12_10LE40: ++ return RK_FORMAT_YCbCr_420_SP_10B; ++ default: ++ return RK_FORMAT_UNKNOWN; ++ } ++} ++ ++static gboolean ++get_rga_info (const GstVideoFrame * frame, rga_info_t * info, ++ int x, int y, int w, int h) ++{ ++ GstVideoMeta *meta = gst_buffer_get_video_meta (frame->buffer); ++ const GstVideoInfo *vinfo = &frame->info; ++ RgaSURF_FORMAT format; ++ gint hstride, vstride0, i; ++ guint8 *ptr; ++ ++ memset (info, 0, sizeof (rga_info_t)); ++ ++ if (!meta) ++ return FALSE; ++ ++ hstride = meta->stride[0]; ++ vstride0 = meta->n_planes == 1 ? meta->height : meta->offset[1] / hstride; ++ ++ /* RGA requires contig buffer */ ++ ptr = GST_VIDEO_FRAME_PLANE_DATA (frame, 0); ++ for (i = 1; i < GST_VIDEO_FRAME_N_PLANES (frame); i++) { ++ gint size = GST_VIDEO_FRAME_PLANE_OFFSET (frame, i) - ++ GST_VIDEO_FRAME_PLANE_OFFSET (frame, i - 1); ++ gint vstride = size / meta->stride[i - 1]; ++ ++ ptr += size; ++ if (ptr != GST_VIDEO_FRAME_PLANE_DATA (frame, i)) ++ return FALSE; ++ ++ if ((meta->stride[i] != hstride && meta->stride[i] != hstride / 2) || ++ (vstride != vstride0 && vstride != vstride0 / 2)) ++ return FALSE; ++ } ++ ++ format = get_rga_format (GST_VIDEO_INFO_FORMAT (vinfo)); ++ switch (format) { ++ case RK_FORMAT_RGBX_8888: ++ case RK_FORMAT_RGBA_8888: ++ case RK_FORMAT_BGRA_8888: ++ hstride /= 4; ++ break; ++ case RK_FORMAT_RGB_888: ++ case RK_FORMAT_BGR_888: ++ hstride /= 3; ++ break; ++ case RK_FORMAT_RGB_565: ++ hstride /= 2; ++ break; ++ case RK_FORMAT_YCbCr_420_SP_10B: ++ case RK_FORMAT_YCbCr_422_SP: ++ case RK_FORMAT_YCrCb_422_SP: ++ case RK_FORMAT_YCbCr_422_P: ++ case RK_FORMAT_YCrCb_422_P: ++ case RK_FORMAT_YCbCr_420_SP: ++ case RK_FORMAT_YCrCb_420_SP: ++ case RK_FORMAT_YCbCr_420_P: ++ case RK_FORMAT_YCrCb_420_P: ++ /* RGA requires yuv image rect align to 2 */ ++ x = (x + 1) & ~1; ++ y = (y + 1) & ~1; ++ w &= ~1; ++ h &= ~1; ++ ++ if (vstride0 % 2) ++ return FALSE; ++ break; ++ default: ++ return FALSE; ++ } ++ ++ info->virAddr = GST_VIDEO_FRAME_PLANE_DATA (frame, 0); ++ info->mmuFlag = 1; ++ ++ rga_set_rect (&info->rect, x, y, w, h, hstride, vstride0, format); ++ return TRUE; ++} ++ ++static gboolean ++video_converter_try_rga (GstVideoConverter * convert, ++ const GstVideoFrame * src, GstVideoFrame * dest) ++{ ++ rga_info_t src_info = { 0 }; ++ rga_info_t dst_info = { 0 }; ++ static int rga_supported = 1; ++ static int rga_inited = 0; ++ const char *buf; ++ ++ buf = g_getenv ("GST_VIDEO_CONVERT_USE_RGA"); ++ if (!buf || strcmp (buf, "1")) ++ return FALSE; ++ ++ if (!rga_supported) ++ return FALSE; ++ ++ if (!rga_inited) { ++ if (c_RkRgaInit () < 0) { ++ rga_supported = 0; ++ return FALSE; ++ } ++ rga_inited = 1; ++ } ++ ++ if (!get_rga_info (src, &src_info, convert->in_x, convert->in_y, ++ convert->in_width, convert->in_height)) { ++ GST_DEBUG ("unsupported src info for RGA"); ++ return FALSE; ++ } ++ ++ if (!get_rga_info (dest, &dst_info, convert->out_x, convert->out_y, ++ convert->out_width, convert->out_height)) { ++ GST_DEBUG ("unsupported dst info for RGA"); ++ return FALSE; ++ } ++ ++ if (c_RkRgaBlit (&src_info, &dst_info, NULL) < 0) { ++ GST_DEBUG ("failed to blit with RGA"); ++ return FALSE; ++ } ++ ++ GST_DEBUG ("converted with RGA"); ++ return TRUE; ++} ++#endif ++ + /** + * gst_video_converter_frame: + * @convert: a #GstVideoConverter +@@ -2789,6 +2957,12 @@ gst_video_converter_frame (GstVideoConverter * convert, + convert->out_width == 0 || convert->out_height == 0)) + return; + ++#ifdef HAVE_RGA ++ /* Accel convert with rockchip RGA */ ++ if (video_converter_try_rga (convert, src, dest)) ++ return; ++#endif ++ + convert->convert (convert, src, dest); + } + +@@ -7218,6 +7392,12 @@ convert_scale_planes (GstVideoConverter * convert, + { + int i, n_planes; + ++#ifdef HAVE_RGA ++ /* Accel convert with rockchip RGA */ ++ if (video_converter_try_rga (convert, src, dest)) ++ return; ++#endif ++ + n_planes = GST_VIDEO_FRAME_N_PLANES (dest); + for (i = 0; i < n_planes; i++) { + if (convert->fconvert[i]) +diff --git a/meson.build b/meson.build +index d279db8..3aae21a 100644 +--- a/meson.build ++++ b/meson.build +@@ -292,6 +292,9 @@ if get_option('default_library') == 'static' + gst_plugins_base_args += ['-DGST_STATIC_COMPILATION'] + endif + ++rga_dep = dependency('librga', required: false) ++core_conf.set('HAVE_RGA', rga_dep.found()) ++ + # X11 checks are for sys/ and tests/ + x11_dep = dependency('x11', required : get_option('x11')) + # GLib checks are for the entire project +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0009-HACK-gl-egl-allow-direct-dmabuf-import-when-unable-t.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0009-HACK-gl-egl-allow-direct-dmabuf-import-when-unable-t.patch new file mode 100644 index 0000000000000000000000000000000000000000..bc425b37c05da7283a98de33d4f1c7edb81fe27c --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0009-HACK-gl-egl-allow-direct-dmabuf-import-when-unable-t.patch @@ -0,0 +1,39 @@ +From 0cb50b00037663ff4ac7d8aa060b8c46554cbeea Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 18 Mar 2020 10:09:49 +0800 +Subject: [PATCH 09/11] HACK: gl/egl: allow direct dmabuf import when unable to + query formats + +Signed-off-by: Jeffy Chen +--- + gst-libs/gst/gl/egl/gsteglimage.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/gst-libs/gst/gl/egl/gsteglimage.c b/gst-libs/gst/gl/egl/gsteglimage.c +index 906f56e..90cc32d 100644 +--- a/gst-libs/gst/gl/egl/gsteglimage.c ++++ b/gst-libs/gst/gl/egl/gsteglimage.c +@@ -759,8 +759,8 @@ gst_egl_image_check_dmabuf_direct (GstGLContext * context, + gst_eglQueryDmaBufModifiersEXT = + gst_gl_context_get_proc_address (context, "eglQueryDmaBufModifiersEXT"); + +- if (!gst_eglQueryDmaBufFormatsEXT || !gst_eglQueryDmaBufModifiersEXT) +- return FALSE; ++ if (!gst_eglQueryDmaBufFormatsEXT) ++ return TRUE; + + display_egl = gst_gl_display_egl_from_gl_display (context->display); + if (!display_egl) { +@@ -797,6 +797,9 @@ gst_egl_image_check_dmabuf_direct (GstGLContext * context, + return FALSE; + } + ++ if (!gst_eglQueryDmaBufModifiersEXT) ++ return TRUE; ++ + ret = gst_eglQueryDmaBufModifiersEXT (egl_display, fourcc, 0, NULL, NULL, + &num_modifiers); + if (!ret || num_modifiers == 0) { +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0010-glupload-dmabuf-prefer-DirectDmabufExternal-uploader.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0010-glupload-dmabuf-prefer-DirectDmabufExternal-uploader.patch new file mode 100644 index 0000000000000000000000000000000000000000..fd85a20dafda970555e9fa6cd7c0013092ac3fc5 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0010-glupload-dmabuf-prefer-DirectDmabufExternal-uploader.patch @@ -0,0 +1,27 @@ +From ae8c2694dbf072361bf02da114f6a601f9159460 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 18 Mar 2020 10:12:31 +0800 +Subject: [PATCH 10/11] glupload: dmabuf: prefer DirectDmabufExternal uploader + +Signed-off-by: Jeffy Chen +--- + gst-libs/gst/gl/gstglupload.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c +index 4e55ebc..998a5ef 100644 +--- a/gst-libs/gst/gl/gstglupload.c ++++ b/gst-libs/gst/gl/gstglupload.c +@@ -2233,8 +2233,8 @@ static const UploadMethod _nvmm_upload = { + + static const UploadMethod *upload_methods[] = { &_gl_memory_upload, + #if GST_GL_HAVE_DMABUF +- &_direct_dma_buf_upload, + &_direct_dma_buf_external_upload, ++ &_direct_dma_buf_upload, + &_dma_buf_upload, + #endif + #if GST_GL_HAVE_VIV_DIRECTVIV +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0011-videoconvert-Support-preferred-formats.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0011-videoconvert-Support-preferred-formats.patch new file mode 100644 index 0000000000000000000000000000000000000000..a65cf8af42e415f373f531b8207234a953a60aa9 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0011-videoconvert-Support-preferred-formats.patch @@ -0,0 +1,50 @@ +From c2a42551d026a7d5145612d8645fb21ed551882b Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 17 Sep 2021 13:20:24 +0800 +Subject: [PATCH 11/11] videoconvert: Support preferred formats + +Set env "GST_VIDEO_CONVERT_PREFERRED_FORMAT" to specify preferred +formats, for example: +export GST_VIDEO_CONVERT_PREFERRED_FORMAT=NV12:NV16 + +Signed-off-by: Jeffy Chen +--- + gst/videoconvert/gstvideoconvert.c | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +diff --git a/gst/videoconvert/gstvideoconvert.c b/gst/videoconvert/gstvideoconvert.c +index 0f65ee2..0aab69e 100644 +--- a/gst/videoconvert/gstvideoconvert.c ++++ b/gst/videoconvert/gstvideoconvert.c +@@ -268,6 +268,28 @@ score_value (GstBaseTransform * base, const GstVideoFormatInfo * in_info, + loss += SCORE_DEPTH_LOSS; + } + ++ { ++ const char *buf = g_getenv ("GST_VIDEO_CONVERT_PREFERRED_FORMAT"); ++ if (buf) { ++ const char *name = GST_VIDEO_FORMAT_INFO_NAME (t_info); ++ int preferred_loss = 1; ++ ++ /* lower other formats */ ++ loss += 1024; ++ ++ while (buf) { ++ if (buf[0] == ':') ++ buf++; ++ ++ if (!strncmp (buf, name, strlen (name))) ++ loss = preferred_loss; ++ ++ buf = strchr (buf, ':'); ++ preferred_loss++; ++ } ++ } ++ } ++ + GST_DEBUG_OBJECT (base, "score %s -> %s = %d", + GST_VIDEO_FORMAT_INFO_NAME (in_info), + GST_VIDEO_FORMAT_INFO_NAME (t_info), loss); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0012-glupload-Support-NV12_10LE40-and-NV12-NV12_10LE40-NV.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0012-glupload-Support-NV12_10LE40-and-NV12-NV12_10LE40-NV.patch new file mode 100644 index 0000000000000000000000000000000000000000..f75b920949e5ecf8502c679830c0222070ffc528 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0012-glupload-Support-NV12_10LE40-and-NV12-NV12_10LE40-NV.patch @@ -0,0 +1,273 @@ +From 595efb2c8be13f30e454eeb849ef43a855d337c5 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 24 May 2022 16:16:33 +0800 +Subject: [PATCH 12/13] glupload: Support NV12_10LE40 and NV12|NV12_10LE40|NV16 + (AFBC) + +Tested on RK356x with: +export GST_MPP_VIDEODEC_DEFAULT_ARM_AFBC=1 +gst-play-1.0 video.mp4 --videosink=glimagesink + +Signed-off-by: Jeffy Chen +--- + gst-libs/gst/gl/egl/gsteglimage.c | 49 ++++++++++++++++++++++++++----- + gst-libs/gst/gl/egl/gsteglimage.h | 44 +++++++++++++++++++++++++++ + gst-libs/gst/gl/gstglmemory.h | 2 +- + gst-libs/gst/gl/gstglupload.c | 15 +++++++++- + gst-libs/gst/gl/meson.build | 5 +++- + 5 files changed, 105 insertions(+), 10 deletions(-) + +diff --git a/gst-libs/gst/gl/egl/gsteglimage.c b/gst-libs/gst/gl/egl/gsteglimage.c +index 90cc32dd3..1704e0b77 100644 +--- a/gst-libs/gst/gl/egl/gsteglimage.c ++++ b/gst-libs/gst/gl/egl/gsteglimage.c +@@ -629,6 +629,19 @@ _drm_direct_fourcc_from_info (const GstVideoInfo * info) + + GST_DEBUG ("Getting DRM fourcc for %s", gst_video_format_to_string (format)); + ++ if (GST_VIDEO_INFO_IS_AFBC (info)) { ++ /* Mali uses these formats instead */ ++ if (format == GST_VIDEO_FORMAT_NV12) ++ return DRM_FORMAT_YUV420_8BIT; ++ else if (format == GST_VIDEO_FORMAT_NV12_10LE40) ++ return DRM_FORMAT_YUV420_10BIT; ++ else if (format == GST_VIDEO_FORMAT_NV16) ++ return DRM_FORMAT_YUYV; ++ ++ GST_INFO ("unsupported format for AFBC"); ++ return -1; ++ } ++ + switch (format) { + case GST_VIDEO_FORMAT_YUY2: + return DRM_FORMAT_YUYV; +@@ -712,6 +725,9 @@ _drm_direct_fourcc_from_info (const GstVideoInfo * info) + case GST_VIDEO_FORMAT_xBGR: + return DRM_FORMAT_RGBX8888; + ++ case GST_VIDEO_FORMAT_NV12_10LE40: ++ return DRM_FORMAT_NV15; ++ + default: + GST_INFO ("Unsupported format for direct DMABuf."); + return -1; +@@ -867,10 +883,12 @@ gst_egl_image_from_dmabuf_direct_target (GstGLContext * context, + { + + EGLImageKHR img; ++ GstVideoFormat format = GST_VIDEO_INFO_FORMAT (in_info); + guint n_planes = GST_VIDEO_INFO_N_PLANES (in_info); + gint fourcc; + gint i; + gboolean with_modifiers; ++ guint64 modifier = DRM_FORMAT_MOD_LINEAR; + + /* Explanation of array length: + * - 6 plane independent values are at the start (width, height, format FourCC) +@@ -880,6 +898,7 @@ gst_egl_image_from_dmabuf_direct_target (GstGLContext * context, + */ + guintptr attribs[41]; /* 6 + 10 * 3 + 4 + 1 */ + gint atti = 0; ++ gfloat stride_scale = 1.0f; + + if (!gst_egl_image_check_dmabuf_direct (context, in_info, target)) + return NULL; +@@ -888,6 +907,22 @@ gst_egl_image_from_dmabuf_direct_target (GstGLContext * context, + with_modifiers = gst_gl_context_check_feature (context, + "EGL_EXT_image_dma_buf_import_modifiers"); + ++ if (GST_VIDEO_INFO_IS_AFBC (in_info)) { ++ if (!with_modifiers) ++ return NULL; ++ ++ /* Mali uses these formats instead */ ++ if (format == GST_VIDEO_FORMAT_NV12) ++ stride_scale = 1.5; ++ else if (format == GST_VIDEO_FORMAT_NV12_10LE40) ++ stride_scale = 1.5; ++ else if (format == GST_VIDEO_FORMAT_NV16) ++ stride_scale = 2; ++ ++ modifier = DRM_AFBC_MODIFIER; ++ n_planes = 1; ++ } ++ + /* EGL DMABuf importation supports a maximum of 3 planes */ + if (G_UNLIKELY (n_planes > 3)) + return NULL; +@@ -906,12 +941,12 @@ gst_egl_image_from_dmabuf_direct_target (GstGLContext * context, + attribs[atti++] = EGL_DMA_BUF_PLANE0_OFFSET_EXT; + attribs[atti++] = offset[0]; + attribs[atti++] = EGL_DMA_BUF_PLANE0_PITCH_EXT; +- attribs[atti++] = in_info->stride[0]; ++ attribs[atti++] = in_info->stride[0] * stride_scale; + if (with_modifiers) { + attribs[atti++] = EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT; +- attribs[atti++] = DRM_FORMAT_MOD_LINEAR & 0xffffffff; ++ attribs[atti++] = modifier & 0xffffffff; + attribs[atti++] = EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT; +- attribs[atti++] = (DRM_FORMAT_MOD_LINEAR >> 32) & 0xffffffff; ++ attribs[atti++] = (modifier >> 32) & 0xffffffff; + } + } + +@@ -925,9 +960,9 @@ gst_egl_image_from_dmabuf_direct_target (GstGLContext * context, + attribs[atti++] = in_info->stride[1]; + if (with_modifiers) { + attribs[atti++] = EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT; +- attribs[atti++] = DRM_FORMAT_MOD_LINEAR & 0xffffffff; ++ attribs[atti++] = modifier & 0xffffffff; + attribs[atti++] = EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT; +- attribs[atti++] = (DRM_FORMAT_MOD_LINEAR >> 32) & 0xffffffff; ++ attribs[atti++] = (modifier >> 32) & 0xffffffff; + } + } + +@@ -941,9 +976,9 @@ gst_egl_image_from_dmabuf_direct_target (GstGLContext * context, + attribs[atti++] = in_info->stride[2]; + if (with_modifiers) { + attribs[atti++] = EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT; +- attribs[atti++] = DRM_FORMAT_MOD_LINEAR & 0xffffffff; ++ attribs[atti++] = modifier & 0xffffffff; + attribs[atti++] = EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT; +- attribs[atti++] = (DRM_FORMAT_MOD_LINEAR >> 32) & 0xffffffff; ++ attribs[atti++] = (modifier >> 32) & 0xffffffff; + } + } + +diff --git a/gst-libs/gst/gl/egl/gsteglimage.h b/gst-libs/gst/gl/egl/gsteglimage.h +index f90fa82a3..e6fc1df4f 100644 +--- a/gst-libs/gst/gl/egl/gsteglimage.h ++++ b/gst-libs/gst/gl/egl/gsteglimage.h +@@ -26,8 +26,52 @@ + #include + #include + ++#include ++ + G_BEGIN_DECLS + ++#ifndef DRM_FORMAT_NV15 ++#define DRM_FORMAT_NV15 fourcc_code('N', 'V', '1', '5') ++#endif ++ ++#ifndef DRM_FORMAT_YUV420_8BIT ++#define DRM_FORMAT_YUV420_8BIT fourcc_code('Y', 'U', '0', '8') ++#endif ++ ++#ifndef DRM_FORMAT_YUV420_10BIT ++#define DRM_FORMAT_YUV420_10BIT fourcc_code('Y', 'U', '1', '0') ++#endif ++ ++#ifndef DRM_FORMAT_MOD_VENDOR_ARM ++#define DRM_FORMAT_MOD_VENDOR_ARM 0x08 ++#endif ++ ++#ifndef DRM_FORMAT_MOD_ARM_AFBC ++#define DRM_FORMAT_MOD_ARM_AFBC(__afbc_mode) fourcc_mod_code(ARM, __afbc_mode) ++#endif ++ ++#ifndef AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 ++#define AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 (1ULL) ++#endif ++ ++#ifndef AFBC_FORMAT_MOD_SPARSE ++#define AFBC_FORMAT_MOD_SPARSE (((__u64)1) << 6) ++#endif ++ ++#define DRM_AFBC_MODIFIER \ ++ (DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_SPARSE) | \ ++ DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16)) ++ ++#ifndef GST_VIDEO_FLAG_ARM_AFBC ++#define GST_VIDEO_FLAG_ARM_AFBC (1UL << 31) ++#define GST_VIDEO_INFO_SET_AFBC(i) \ ++ GST_VIDEO_INFO_FLAG_SET (i, GST_VIDEO_FLAG_ARM_AFBC) ++#define GST_VIDEO_INFO_UNSET_AFBC(i) \ ++ GST_VIDEO_INFO_FLAG_UNSET (i, GST_VIDEO_FLAG_ARM_AFBC) ++#define GST_VIDEO_INFO_IS_AFBC(i) \ ++ GST_VIDEO_INFO_FLAG_IS_SET (i, GST_VIDEO_FLAG_ARM_AFBC) ++#endif ++ + GST_GL_API GType gst_egl_image_get_type (void); + + #define GST_TYPE_EGL_IMAGE (gst_egl_image_get_type()) +diff --git a/gst-libs/gst/gl/gstglmemory.h b/gst-libs/gst/gl/gstglmemory.h +index daea4d12a..8d8b36f81 100644 +--- a/gst-libs/gst/gl/gstglmemory.h ++++ b/gst-libs/gst/gl/gstglmemory.h +@@ -64,7 +64,7 @@ GType gst_gl_memory_allocator_get_type(void); + #define GST_GL_MEMORY_VIDEO_FORMATS_STR \ + "{ RGBA, BGRA, RGBx, BGRx, ARGB, ABGR, xRGB, xBGR, GBRA, GBR, RGBP, BGRP, RGB, BGR, RGB16, BGR16, " \ + "AYUV, VUYA, Y410, I420, YV12, NV12, NV21, NV16, NV61, YUY2, UYVY, Y210, Y41B, " \ +- "Y42B, Y444, GRAY8, GRAY16_LE, GRAY16_BE, ARGB64, A420, AV12" \ ++ "Y42B, Y444, GRAY8, GRAY16_LE, GRAY16_BE, ARGB64, A420, AV12, NV12_10LE40" \ + GST_GL_MEMORY_VIDEO_EXT_FORMATS "}" + + /** +diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c +index 998a5ef4d..6afc2812f 100644 +--- a/gst-libs/gst/gl/gstglupload.c ++++ b/gst-libs/gst/gl/gstglupload.c +@@ -506,7 +506,8 @@ static GstStaticCaps _dma_buf_upload_caps = + GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES + (GST_CAPS_FEATURE_MEMORY_DMABUF, + GST_GL_MEMORY_VIDEO_FORMATS_STR) ";" +- GST_VIDEO_CAPS_MAKE (GST_GL_MEMORY_VIDEO_FORMATS_STR)); ++ GST_VIDEO_CAPS_MAKE (GST_GL_MEMORY_VIDEO_FORMATS_STR) ";" ++ GST_VIDEO_CAPS_MAKE ("{NV12, NV12_10LE40}") ", arm-afbc = (int) 1"); + + static gpointer + _dma_buf_upload_new (GstGLUpload * upload) +@@ -2427,6 +2428,9 @@ static gboolean + _gst_gl_upload_set_caps_unlocked (GstGLUpload * upload, GstCaps * in_caps, + GstCaps * out_caps) + { ++ GstStructure *s; ++ gint value; ++ + g_return_val_if_fail (upload != NULL, FALSE); + g_return_val_if_fail (gst_caps_is_fixed (in_caps), FALSE); + +@@ -2441,6 +2445,15 @@ _gst_gl_upload_set_caps_unlocked (GstGLUpload * upload, GstCaps * in_caps, + gst_video_info_from_caps (&upload->priv->in_info, in_caps); + gst_video_info_from_caps (&upload->priv->out_info, out_caps); + ++ /* parse AFBC from caps */ ++ s = gst_caps_get_structure (in_caps, 0); ++ if (gst_structure_get_int (s, "arm-afbc", &value)) { ++ if (value) ++ GST_VIDEO_INFO_SET_AFBC (&upload->priv->in_info); ++ else ++ GST_VIDEO_INFO_UNSET_AFBC (&upload->priv->in_info); ++ } ++ + upload->priv->method = NULL; + upload->priv->method_impl = NULL; + upload->priv->method_i = 0; +diff --git a/gst-libs/gst/gl/meson.build b/gst-libs/gst/gl/meson.build +index b88e18cf3..6970607ea 100644 +--- a/gst-libs/gst/gl/meson.build ++++ b/gst-libs/gst/gl/meson.build +@@ -1039,6 +1039,8 @@ if build_gstgl + # case-insensitive FS would include gst-libs/gl/egl/egl.h as EGL/egl.h. + common_args += '-I@0@'.format(meson.current_build_dir()) + ++ libdrm_dep = dependency('libdrm') ++ + gstgl = library('gstgl-' + api_version, + gl_sources, gl_egl_sources, gl_x11_sources, gl_wayland_sources, gl_priv_sources, gl_enumtypes_c, gl_enumtypes_h, + c_args : common_args, +@@ -1050,7 +1052,8 @@ if build_gstgl + darwin_versions : osxversion, + install : true, + dependencies : [gst_base_dep, video_dep, allocators_dep, gmodule_dep, +- gl_lib_deps, gl_platform_deps, gl_winsys_deps, gl_misc_deps], ++ gl_lib_deps, gl_platform_deps, gl_winsys_deps, gl_misc_deps, ++ libdrm_dep], + # don't confuse EGL/egl.h with gst-libs/gl/egl/egl.h on case-insensitive file systems + implicit_include_directories : false) + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0013-xvimagesink-Defer-prepare-window-when-getting-zero-w.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0013-xvimagesink-Defer-prepare-window-when-getting-zero-w.patch new file mode 100644 index 0000000000000000000000000000000000000000..c034de22c4c355ac94476e034a8152110d851704 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0013-xvimagesink-Defer-prepare-window-when-getting-zero-w.patch @@ -0,0 +1,99 @@ +From d1a0122061c50b8445b599240734025c9fc9cd6f Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 9 Jun 2022 12:01:28 +0800 +Subject: [PATCH 13/13] xvimagesink: Defer prepare window when getting zero + window handle + +The window might not ready when we requesting it. + +Signed-off-by: Jeffy Chen +--- + sys/xvimage/xvimagesink.c | 30 +++++++++++++++++------------- + sys/xvimage/xvimagesink.h | 2 ++ + 2 files changed, 19 insertions(+), 13 deletions(-) + +diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c +index 00f995a8e..eb6392342 100644 +--- a/sys/xvimage/xvimagesink.c ++++ b/sys/xvimage/xvimagesink.c +@@ -419,6 +419,10 @@ gst_xv_image_sink_xvimage_put (GstXvImageSink * xvimagesink, + GstVideoRectangle mem_crop; + GstXWindow *xwindow; + ++ /* Ask for window handle */ ++ if (G_UNLIKELY (!xvimagesink->xwindow)) ++ gst_video_overlay_prepare_window_handle (GST_VIDEO_OVERLAY (xvimagesink)); ++ + /* We take the flow_lock. If expose is in there we don't want to run + concurrently from the data flow thread */ + g_mutex_lock (&xvimagesink->flow_lock); +@@ -1002,7 +1006,9 @@ gst_xv_image_sink_setcaps (GstBaseSink * bsink, GstCaps * caps) + goto no_display_size; + + g_mutex_lock (&xvimagesink->flow_lock); +- if (!xvimagesink->xwindow) { ++ if (!xvimagesink->xwindow_id) { ++ GST_WARNING_OBJECT (xvimagesink, "overlay window not ready"); ++ } else if (!xvimagesink->xwindow) { + xvimagesink->xwindow = gst_xv_image_sink_xwindow_new (xvimagesink, + GST_VIDEO_SINK_WIDTH (xvimagesink), + GST_VIDEO_SINK_HEIGHT (xvimagesink)); +@@ -1289,6 +1295,12 @@ invalid_buffer: + } + no_window: + { ++ /* HACK: Defer window prepare when getting zero window handle */ ++ if (!xvimagesink->xwindow_id) { ++ GST_WARNING_OBJECT (xvimagesink, "buffer dropped (window not ready)"); ++ goto done; ++ } ++ + /* No Window available to put our image into */ + GST_WARNING_OBJECT (xvimagesink, "could not output image - no window"); + res = GST_FLOW_ERROR; +@@ -1508,18 +1520,7 @@ gst_xv_image_sink_set_window_handle (GstVideoOverlay * overlay, guintptr id) + xvimagesink->xwindow = NULL; + } + +- /* If the xid is 0 we go back to an internal window */ +- if (xwindow_id == 0) { +- /* If no width/height caps nego did not happen window will be created +- during caps nego then */ +- if (GST_VIDEO_SINK_WIDTH (xvimagesink) +- && GST_VIDEO_SINK_HEIGHT (xvimagesink)) { +- xwindow = +- gst_xv_image_sink_xwindow_new (xvimagesink, +- GST_VIDEO_SINK_WIDTH (xvimagesink), +- GST_VIDEO_SINK_HEIGHT (xvimagesink)); +- } +- } else { ++ if ((xvimagesink->xwindow_id = xwindow_id)) { + xwindow = gst_xvcontext_create_xwindow_from_xid (context, xwindow_id); + gst_xwindow_set_event_handling (xwindow, xvimagesink->handle_events); + } +@@ -2168,6 +2169,9 @@ gst_xv_image_sink_init (GstXvImageSink * xvimagesink) + xvimagesink->handle_expose = TRUE; + + xvimagesink->draw_borders = TRUE; ++ ++ /* HACK: Use a non-zero initial ID to detect overlay mode */ ++ xvimagesink->xwindow_id = -1; + } + + static void +diff --git a/sys/xvimage/xvimagesink.h b/sys/xvimage/xvimagesink.h +index 35a3081e9..c84eeea9e 100644 +--- a/sys/xvimage/xvimagesink.h ++++ b/sys/xvimage/xvimagesink.h +@@ -134,6 +134,8 @@ struct _GstXvImageSink + /* saved render rectangle until we have a window */ + gboolean pending_render_rect; + GstVideoRectangle render_rect; ++ ++ guintptr xwindow_id; + }; + + struct _GstXvImageSinkClass +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0014-riff-Fix-bps-caculation-error-for-ADPCM.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0014-riff-Fix-bps-caculation-error-for-ADPCM.patch new file mode 100644 index 0000000000000000000000000000000000000000..4f03d6e7a30e5ba0d3832ba0ab499db838fbf25b --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20/0014-riff-Fix-bps-caculation-error-for-ADPCM.patch @@ -0,0 +1,41 @@ +From dbbb71cf2b859901f3ed5b1e8b4dfec92651af35 Mon Sep 17 00:00:00 2001 +From: Jiajian Wu +Date: Tue, 11 Oct 2022 09:21:10 +0800 +Subject: [PATCH] riff: Fix bps caculation error for ADPCM + +The bps shall be caculated according to: +ADPCM: rate * blockalign / ((blockalign - ch * 7) * 2) +DVI ADPCM: rate * blockalign / ((blockalign - ch * 4) * 2) +cus the sample size is 4bit in ADPCM witch is half +of raw pcm. + +Signed-off-by: Jiajian Wu +--- + gst-libs/gst/riff/riff-media.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/gst-libs/gst/riff/riff-media.c b/gst-libs/gst/riff/riff-media.c +index 21200a1..deb8e65 100644 +--- a/gst-libs/gst/riff/riff-media.c ++++ b/gst-libs/gst/riff/riff-media.c +@@ -1298,7 +1298,7 @@ gst_riff_create_audio_caps (guint16 codec_id, + * would probably confuse timing */ + strf->av_bps = 0; + if (strf->channels != 0 && strf->rate != 0 && strf->blockalign != 0) { +- int spb = ((strf->blockalign - strf->channels * 7) / 2) * 2; ++ int spb = (strf->blockalign - strf->channels * 7) * 2; + strf->av_bps = + gst_util_uint64_scale_int (strf->rate, strf->blockalign, spb); + GST_DEBUG ("fixing av_bps to calculated value %d of MS ADPCM", +@@ -1420,7 +1420,7 @@ gst_riff_create_audio_caps (guint16 codec_id, + * as this would probably confuse timing */ + strf->av_bps = 0; + if (strf->channels != 0 && strf->rate != 0 && strf->blockalign != 0) { +- int spb = ((strf->blockalign - strf->channels * 4) / 2) * 2; ++ int spb = (strf->blockalign - strf->channels * 4) * 2; + strf->av_bps = + gst_util_uint64_scale_int (strf->rate, strf->blockalign, spb); + GST_DEBUG ("fixing av_bps to calculated value %d of IMA DVI ADPCM", +-- +2.25.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_%.bbappend b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_%.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..4ebe8c642dc96a97ff17b76cc56fc0c06b951a46 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_%.bbappend @@ -0,0 +1,9 @@ +# Copyright (c) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +MAJ_VER = "${@oe.utils.trim_version("${PV}", 2)}" +PATCHPATH = "${CURDIR}/${BPN}_${MAJ_VER}" + +inherit auto-patch + +DEPENDS:append = " rockchip-librga" diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0001-qtdemux-don-t-skip-the-stream-duration-longer-than-3.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0001-qtdemux-don-t-skip-the-stream-duration-longer-than-3.patch new file mode 100644 index 0000000000000000000000000000000000000000..fed64d98eda1efa39d6656740be9c4d2aeb19aad --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0001-qtdemux-don-t-skip-the-stream-duration-longer-than-3.patch @@ -0,0 +1,30 @@ +From 0e0212b5b42a55c0a4426bae4dea26fc890d959a Mon Sep 17 00:00:00 2001 +From: Randy Li +Date: Fri, 21 Jul 2017 10:24:01 +0800 +Subject: [PATCH 1/5] qtdemux: don't skip the stream duration longer than 30s + +Some video files have a wrong total duration, I decide to regard +the stream inside it longer than 30s as a valid stream. + +Signed-off-by: Randy Li +--- + gst/isomp4/qtdemux.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c +index b74f4ef..e320af8 100644 +--- a/gst/isomp4/qtdemux.c ++++ b/gst/isomp4/qtdemux.c +@@ -10949,7 +10949,8 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak) + * some of those trailers, nowadays, have prologue images that are + * themselves video tracks as well. I haven't really found a way to + * identify those yet, except for just looking at their duration. */ +- if (tdur1 != 0 && (tdur2 * 10 / tdur1) < 2) { ++ if (tdur1 != 0 && (tdur2 * 10 / tdur1) < 2 ++ && (stream->duration / stream->timescale) < 30) { + GST_WARNING_OBJECT (qtdemux, + "Track shorter than 20%% (%" G_GUINT64_FORMAT "/%" G_GUINT32_FORMAT + " vs. %" G_GUINT64_FORMAT "/%" G_GUINT32_FORMAT ") of the stream " +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0002-HACK-flacparse-Handle-metadata-127.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0002-HACK-flacparse-Handle-metadata-127.patch new file mode 100644 index 0000000000000000000000000000000000000000..9ae3a052f063e735ecde8d37758b6832c8b900df --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0002-HACK-flacparse-Handle-metadata-127.patch @@ -0,0 +1,33 @@ +From 221ca620d9e017e1a32b53560d701c8d3809b74c Mon Sep 17 00:00:00 2001 +From: "james.lin" +Date: Tue, 23 Jan 2018 19:19:36 +0800 +Subject: [PATCH 2/5] HACK: flacparse: Handle metadata 127 + +Signed-off-by: james.lin +Signed-off-by: Jeffy Chen +--- + gst/audioparsers/gstflacparse.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/gst/audioparsers/gstflacparse.c b/gst/audioparsers/gstflacparse.c +index 8fca410..aa680f6 100644 +--- a/gst/audioparsers/gstflacparse.c ++++ b/gst/audioparsers/gstflacparse.c +@@ -1567,11 +1567,14 @@ gst_flac_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame, + gboolean is_last = map.data[0] >> 7; + guint type = (map.data[0] & 0x7F); + ++ /* HACK: Handle metadata 127 */ ++#if 0 + if (type == 127) { + GST_WARNING_OBJECT (flacparse, "Invalid metadata block type 127"); + res = GST_BASE_PARSE_FLOW_DROPPED; + goto cleanup; + } ++#endif + + GST_DEBUG_OBJECT (flacparse, "Handling metadata block of type %u", type); + +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0003-autodetect-Add-preferred-for-autovideosink-autoaudio.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0003-autodetect-Add-preferred-for-autovideosink-autoaudio.patch new file mode 100644 index 0000000000000000000000000000000000000000..214bbc5c2b35ddfd89c579c7ca9102f6e8d8eb43 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0003-autodetect-Add-preferred-for-autovideosink-autoaudio.patch @@ -0,0 +1,95 @@ +From 0ccc3d3bd930877c8e7bfd4133afa4b56bae46d9 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 11 Jun 2019 10:19:22 +0800 +Subject: [PATCH 3/5] autodetect: Add preferred for autovideosink/autoaudiosink + +Signed-off-by: Jeffy Chen +--- + gst/autodetect/gstautoaudiosink.c | 3 +++ + gst/autodetect/gstautodetect.c | 14 ++++++++++++++ + gst/autodetect/gstautodetect.h | 1 + + gst/autodetect/gstautovideosink.c | 3 +++ + 4 files changed, 21 insertions(+) + +diff --git a/gst/autodetect/gstautoaudiosink.c b/gst/autodetect/gstautoaudiosink.c +index 5c18972..088c83e 100644 +--- a/gst/autodetect/gstautoaudiosink.c ++++ b/gst/autodetect/gstautoaudiosink.c +@@ -39,6 +39,8 @@ + #include "config.h" + #endif + ++#include ++ + #include "gstautodetectelements.h" + #include "gstautodetect.h" + #include "gstautoaudiosink.h" +@@ -99,6 +101,7 @@ gst_auto_audio_sink_init (GstAutoAudioSink * sink) + + autodetect->media_klass = "Audio"; + autodetect->flag = GST_ELEMENT_FLAG_SINK; ++ autodetect->preferred = g_getenv ("AUTOAUDIOSINK_PREFERRED"); + + sink->ts_offset = DEFAULT_TS_OFFSET; + } +diff --git a/gst/autodetect/gstautodetect.c b/gst/autodetect/gstautodetect.c +index 864d465..56ce69d 100644 +--- a/gst/autodetect/gstautodetect.c ++++ b/gst/autodetect/gstautodetect.c +@@ -273,6 +273,20 @@ gst_auto_detect_find_best (GstAutoDetect * self) + GST_LOG_OBJECT (self, "Trying to find usable %s elements ...", + self->media_klass_lc); + ++ if (self->preferred) { ++ for (item = list; item != NULL; item = item->next) { ++ GstElementFactory *f = GST_ELEMENT_FACTORY (item->data); ++ ++ if (!strcmp (self->preferred, GST_OBJECT_NAME (f))) { ++ GST_DEBUG_OBJECT (self, "Preferred %s", GST_OBJECT_NAME (f)); ++ ++ list = g_list_delete_link (list, item); ++ list = g_list_prepend (list, f); ++ break; ++ } ++ } ++ } ++ + for (item = list; item != NULL; item = item->next) { + GstElementFactory *f = GST_ELEMENT_FACTORY (item->data); + GstElement *el; +diff --git a/gst/autodetect/gstautodetect.h b/gst/autodetect/gstautodetect.h +index 3f54c14..85731c0 100644 +--- a/gst/autodetect/gstautodetect.h ++++ b/gst/autodetect/gstautodetect.h +@@ -41,6 +41,7 @@ typedef struct _GstAutoDetect { + GstBin parent; + + /* configuration for subclasses */ ++ const gchar *preferred; + const gchar *media_klass; /* Audio/Video/... */ + GstElementFlags flag; /* GST_ELEMENT_FLAG_{SINK/SOURCE} */ + +diff --git a/gst/autodetect/gstautovideosink.c b/gst/autodetect/gstautovideosink.c +index b3eaf1f..545e21c 100644 +--- a/gst/autodetect/gstautovideosink.c ++++ b/gst/autodetect/gstautovideosink.c +@@ -39,6 +39,8 @@ + #include "config.h" + #endif + ++#include ++ + #include "gstautodetectelements.h" + #include "gstautodetect.h" + #include "gstautovideosink.h" +@@ -99,6 +101,7 @@ gst_auto_video_sink_init (GstAutoVideoSink * sink) + + autodetect->media_klass = "Video"; + autodetect->flag = GST_ELEMENT_FLAG_SINK; ++ autodetect->preferred = g_getenv ("AUTOVIDEOSINK_PREFERRED"); + + sink->ts_offset = DEFAULT_TS_OFFSET; + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0004-v4l2-Support-preferred-formats.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0004-v4l2-Support-preferred-formats.patch new file mode 100644 index 0000000000000000000000000000000000000000..76cd13666c850d56bf7df1b6eb11128a59f195f0 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0004-v4l2-Support-preferred-formats.patch @@ -0,0 +1,108 @@ +From b707439a1f49d13420a6b8aab94738b7f37348fd Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 6 Nov 2019 15:07:44 +0800 +Subject: [PATCH 4/9] v4l2: Support preferred formats + +Set env "GST_V4L2_PREFERRED_FOURCC" to specify preferred formats, for +example: +export GST_V4L2SRC_PREFERRED_FOURCC=YU12:NV12 + +Signed-off-by: Jeffy Chen +--- + sys/v4l2/gstv4l2object.c | 17 +++++++++++++++++ + sys/v4l2/gstv4l2src.c | 37 +++++++++++++++++++++++++++++++++++++ + 2 files changed, 54 insertions(+) + +diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c +index 9eb3b8e..a7b7ea7 100644 +--- a/sys/v4l2/gstv4l2object.c ++++ b/sys/v4l2/gstv4l2object.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -1137,6 +1138,22 @@ gst_v4l2_object_format_get_rank (const struct v4l2_fmtdesc *fmt) + break; + } + ++ { ++ const char *buf = g_getenv ("GST_V4L2_PREFERRED_FOURCC"); ++ int max_rank = YUV_BASE_RANK * 2; ++ ++ while (buf) { ++ if (buf[0] == ':') ++ buf++; ++ ++ if (!strncmp (buf, (char *) &fourcc, 4)) ++ rank = max_rank; ++ ++ buf = strchr (buf, ':'); ++ max_rank--; ++ } ++ } ++ + /* All ranks are below 1<<15 so a shift by 15 + * will a) make all non-emulated formats larger + * than emulated and b) will not overflow +diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c +index d00f7a8..1b2c1a6 100644 +--- a/sys/v4l2/gstv4l2src.c ++++ b/sys/v4l2/gstv4l2src.c +@@ -308,6 +308,38 @@ gst_v4l2_src_parse_fixed_struct (GstStructure * s, + gst_structure_get_fraction (s, "framerate", fps_n, fps_d); + } + ++static gint ++gst_v4l2src_get_format_loss (GstStructure * s) ++{ ++ GstVideoFormat format; ++ const gchar *buf = g_getenv ("GST_V4L2_PREFERRED_FOURCC"); ++ guint32 fourcc, loss; ++ ++ if (!buf) ++ return 0; ++ ++ format = ++ gst_video_format_from_string (gst_structure_get_string (s, "format")); ++ if (format == GST_VIDEO_FORMAT_UNKNOWN) ++ return 0; ++ ++ fourcc = gst_video_format_to_fourcc (format); ++ ++ loss = 0; ++ while (buf) { ++ if (buf[0] == ':') ++ buf++; ++ ++ if (!strncmp (buf, (char *) &fourcc, 4)) ++ return loss; ++ ++ buf = strchr (buf, ':'); ++ loss++; ++ } ++ ++ return loss; ++} ++ + /* TODO Consider framerate */ + static gint + gst_v4l2src_fixed_caps_compare (GstCaps * caps_a, GstCaps * caps_b, +@@ -360,6 +392,11 @@ gst_v4l2src_fixed_caps_compare (GstCaps * caps_a, GstCaps * caps_b, + if (bh == pref->height) + bd -= 1; + ++ if (ad == bd) { ++ ad = gst_v4l2src_get_format_loss (a); ++ bd = gst_v4l2src_get_format_loss (b); ++ } ++ + /* If the choices are equivalent, maintain the order */ + if (ad == bd) + ret = 1; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0005-video-flip-Support-rockchip-RGA-2D-accel.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0005-video-flip-Support-rockchip-RGA-2D-accel.patch new file mode 100644 index 0000000000000000000000000000000000000000..4abd23e6e2c01377718139a7b22c41ea0d01604e --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0005-video-flip-Support-rockchip-RGA-2D-accel.patch @@ -0,0 +1,306 @@ +From 717538c26f18372e91a8aacc7fde6ec8a35ed9f7 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 8 Nov 2019 17:36:20 +0800 +Subject: [PATCH 5/5] video-flip: Support rockchip RGA 2D accel + +Disabled by default, set env GST_VIDEO_FLIP_USE_RGA=1 to enable. + +Signed-off-by: Jeffy Chen +--- + gst/videofilter/gstvideoflip.c | 216 ++++++++++++++++++++++++++++++++- + gst/videofilter/meson.build | 2 +- + meson.build | 3 + + 3 files changed, 218 insertions(+), 3 deletions(-) + +diff --git a/gst/videofilter/gstvideoflip.c b/gst/videofilter/gstvideoflip.c +index 371f291..2831689 100644 +--- a/gst/videofilter/gstvideoflip.c ++++ b/gst/videofilter/gstvideoflip.c +@@ -48,6 +48,11 @@ + #include + #include + ++#ifdef HAVE_RGA ++#include ++#include ++#endif ++ + /* GstVideoFlip properties */ + enum + { +@@ -69,7 +74,7 @@ GST_STATIC_PAD_TEMPLATE ("src", + GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ AYUV, " + "ARGB, BGRA, ABGR, RGBA, Y444, xRGB, RGBx, xBGR, BGRx, " + "RGB, BGR, I420, YV12, IYUV, YUY2, UYVY, YVYU, NV12, NV21, " +- "GRAY8, GRAY16_BE, GRAY16_LE }")) ++ "NV12_10LE40, " "GRAY8, GRAY16_BE, GRAY16_LE }")) + ); + + static GstStaticPadTemplate gst_video_flip_sink_template = +@@ -79,7 +84,7 @@ GST_STATIC_PAD_TEMPLATE ("sink", + GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ AYUV, " + "ARGB, BGRA, ABGR, RGBA, Y444, xRGB, RGBx, xBGR, BGRx, " + "RGB, BGR, I420, YV12, IYUV, YUY2, UYVY, YVYU, NV12, NV21, " +- "GRAY8, GRAY16_BE, GRAY16_LE }")) ++ "NV12_10LE40, " "GRAY8, GRAY16_BE, GRAY16_LE }")) + ); + + #define GST_TYPE_VIDEO_FLIP_METHOD (gst_video_flip_method_get_type()) +@@ -982,6 +987,193 @@ gst_video_flip_y422 (GstVideoFlip * videoflip, GstVideoFrame * dest, + } + } + ++#ifdef HAVE_RGA ++static RgaSURF_FORMAT ++get_rga_format (GstVideoFormat format) ++{ ++ switch (format) { ++ case GST_VIDEO_FORMAT_BGRA: ++ case GST_VIDEO_FORMAT_BGRx: ++ return RK_FORMAT_BGRA_8888; ++ case GST_VIDEO_FORMAT_RGBA: ++ return RK_FORMAT_RGBA_8888; ++ case GST_VIDEO_FORMAT_RGBx: ++ return RK_FORMAT_RGBX_8888; ++ case GST_VIDEO_FORMAT_BGR: ++ return RK_FORMAT_BGR_888; ++ case GST_VIDEO_FORMAT_RGB: ++ return RK_FORMAT_RGB_888; ++ case GST_VIDEO_FORMAT_RGB16: ++ return RK_FORMAT_RGB_565; ++ case GST_VIDEO_FORMAT_NV12: ++ return RK_FORMAT_YCbCr_420_SP; ++ case GST_VIDEO_FORMAT_NV21: ++ return RK_FORMAT_YCrCb_420_SP; ++ case GST_VIDEO_FORMAT_I420: ++ return RK_FORMAT_YCbCr_420_P; ++ case GST_VIDEO_FORMAT_YV12: ++ return RK_FORMAT_YCrCb_420_P; ++ case GST_VIDEO_FORMAT_NV16: ++ return RK_FORMAT_YCbCr_422_SP; ++ case GST_VIDEO_FORMAT_NV61: ++ return RK_FORMAT_YCrCb_422_SP; ++ case GST_VIDEO_FORMAT_Y42B: ++ return RK_FORMAT_YCbCr_422_P; ++ case GST_VIDEO_FORMAT_NV12_10LE40: ++ return RK_FORMAT_YCbCr_420_SP_10B; ++ default: ++ return RK_FORMAT_UNKNOWN; ++ } ++} ++ ++static gboolean ++get_rga_info (const GstVideoFrame * frame, rga_info_t * info, ++ int x, int y, int w, int h) ++{ ++ GstVideoMeta *meta = gst_buffer_get_video_meta (frame->buffer); ++ const GstVideoInfo *vinfo = &frame->info; ++ RgaSURF_FORMAT format; ++ gint hstride, vstride0, i; ++ guint8 *ptr; ++ ++ memset (info, 0, sizeof (rga_info_t)); ++ ++ if (!meta) ++ return FALSE; ++ ++ hstride = meta->stride[0]; ++ vstride0 = meta->n_planes == 1 ? meta->height : meta->offset[1] / hstride; ++ ++ /* RGA requires contig buffer */ ++ ptr = GST_VIDEO_FRAME_PLANE_DATA (frame, 0); ++ for (i = 1; i < GST_VIDEO_FRAME_N_PLANES (frame); i++) { ++ gint size = GST_VIDEO_FRAME_PLANE_OFFSET (frame, i) - ++ GST_VIDEO_FRAME_PLANE_OFFSET (frame, i - 1); ++ gint vstride = size / meta->stride[i - 1]; ++ ++ ptr += size; ++ if (ptr != GST_VIDEO_FRAME_PLANE_DATA (frame, i)) ++ return FALSE; ++ ++ if ((meta->stride[i] != hstride && meta->stride[i] != hstride / 2) || ++ (vstride != vstride0 && vstride != vstride0 / 2)) ++ return FALSE; ++ } ++ ++ format = get_rga_format (GST_VIDEO_INFO_FORMAT (vinfo)); ++ switch (format) { ++ case RK_FORMAT_RGBX_8888: ++ case RK_FORMAT_RGBA_8888: ++ case RK_FORMAT_BGRA_8888: ++ hstride /= 4; ++ break; ++ case RK_FORMAT_RGB_888: ++ case RK_FORMAT_BGR_888: ++ hstride /= 3; ++ break; ++ case RK_FORMAT_RGB_565: ++ hstride /= 2; ++ break; ++ case RK_FORMAT_YCbCr_420_SP_10B: ++ case RK_FORMAT_YCbCr_422_SP: ++ case RK_FORMAT_YCrCb_422_SP: ++ case RK_FORMAT_YCbCr_422_P: ++ case RK_FORMAT_YCrCb_422_P: ++ case RK_FORMAT_YCbCr_420_SP: ++ case RK_FORMAT_YCrCb_420_SP: ++ case RK_FORMAT_YCbCr_420_P: ++ case RK_FORMAT_YCrCb_420_P: ++ /* RGA requires yuv image rect align to 2 */ ++ x = (x + 1) & ~1; ++ y = (y + 1) & ~1; ++ w &= ~1; ++ h &= ~1; ++ ++ if (vstride0 % 2) ++ return FALSE; ++ break; ++ default: ++ return FALSE; ++ } ++ ++ info->virAddr = GST_VIDEO_FRAME_PLANE_DATA (frame, 0); ++ info->mmuFlag = 1; ++ ++ rga_set_rect (&info->rect, x, y, w, h, hstride, vstride0, format); ++ return TRUE; ++} ++ ++static gboolean ++video_flip_try_rga (GstVideoFlip * videoflip, ++ GstVideoFrame * out_frame, GstVideoFrame * in_frame) ++{ ++ gint sw = GST_VIDEO_FRAME_WIDTH (in_frame); ++ gint sh = GST_VIDEO_FRAME_HEIGHT (in_frame); ++ gint dw = GST_VIDEO_FRAME_WIDTH (out_frame); ++ gint dh = GST_VIDEO_FRAME_HEIGHT (out_frame); ++ ++ rga_info_t src_info = { 0 }; ++ rga_info_t dst_info = { 0 }; ++ static int rga_supported = 1; ++ static int rga_inited = 0; ++ const char *buf; ++ ++ buf = g_getenv ("GST_VIDEO_FLIP_USE_RGA"); ++ if (!buf || strcmp (buf, "1")) ++ return FALSE; ++ ++ if (!rga_supported) ++ return FALSE; ++ ++ if (!rga_inited) { ++ if (c_RkRgaInit () < 0) { ++ rga_supported = 0; ++ return FALSE; ++ } ++ rga_inited = 1; ++ } ++ ++ if (!get_rga_info (in_frame, &src_info, 0, 0, sw, sh)) { ++ GST_DEBUG ("unsupported src info for RGA"); ++ return FALSE; ++ } ++ ++ if (!get_rga_info (out_frame, &dst_info, 0, 0, dw, dh)) { ++ GST_DEBUG ("unsupported dst info for RGA"); ++ return FALSE; ++ } ++ ++ switch (videoflip->active_method) { ++ case GST_VIDEO_ORIENTATION_90R: ++ src_info.rotation = HAL_TRANSFORM_ROT_90; ++ break; ++ case GST_VIDEO_ORIENTATION_180: ++ src_info.rotation = HAL_TRANSFORM_ROT_180; ++ break; ++ case GST_VIDEO_ORIENTATION_90L: ++ src_info.rotation = HAL_TRANSFORM_ROT_270; ++ break; ++ case GST_VIDEO_ORIENTATION_HORIZ: ++ src_info.rotation = HAL_TRANSFORM_FLIP_H; ++ break; ++ case GST_VIDEO_ORIENTATION_VERT: ++ src_info.rotation = HAL_TRANSFORM_FLIP_V; ++ break; ++ default: ++ GST_DEBUG ("unsupported rotation for RGA"); ++ return FALSE; ++ } ++ ++ if (c_RkRgaBlit (&src_info, &dst_info, NULL) < 0) { ++ GST_DEBUG ("failed to blit with RGA"); ++ return FALSE; ++ } ++ ++ GST_DEBUG ("flipped with RGA"); ++ return TRUE; ++} ++#endif ++ + static void + gst_video_flip_configure_process (GstVideoFlip * vf) + { +@@ -1016,6 +1208,12 @@ gst_video_flip_configure_process (GstVideoFlip * vf) + case GST_VIDEO_FORMAT_NV21: + vf->process = gst_video_flip_semi_planar_yuv; + break; ++#ifdef HAVE_RGA ++ case GST_VIDEO_FORMAT_NV12_10LE40: ++ /* Not supported by the official videoflip */ ++ vf->process = video_flip_try_rga; ++ break; ++#endif + default: + break; + } +@@ -1195,6 +1393,20 @@ gst_video_flip_transform_frame (GstVideoFilter * vfilter, + GST_VIDEO_FRAME_WIDTH (out_frame), GST_VIDEO_FRAME_HEIGHT (out_frame)); + g_type_class_unref (enum_class); + ++#ifdef HAVE_RGA ++ /* Accel flip with rockchip RGA */ ++ if (video_flip_try_rga (videoflip, out_frame, in_frame)) { ++ GST_OBJECT_UNLOCK (videoflip); ++ return GST_FLOW_OK; ++ } ++ ++ /* Not supported by the official videoflip */ ++ if (G_UNLIKELY (videoflip->process == video_flip_try_rga)) { ++ GST_OBJECT_UNLOCK (videoflip); ++ goto not_negotiated; ++ } ++#endif ++ + videoflip->process (videoflip, out_frame, in_frame); + + proposed = videoflip->proposed_method; +diff --git a/gst/videofilter/meson.build b/gst/videofilter/meson.build +index acb5191..41e674f 100644 +--- a/gst/videofilter/meson.build ++++ b/gst/videofilter/meson.build +@@ -10,7 +10,7 @@ gstvideofilter = library('gstvideofilter', + vfilter_sources, + c_args : gst_plugins_good_args, + include_directories : [configinc], +- dependencies : [gstbase_dep, gstvideo_dep, libm], ++ dependencies : [gstbase_dep, gstvideo_dep, libm, rga_dep], + install : true, + install_dir : plugins_install_dir, + ) +diff --git a/meson.build b/meson.build +index 517bde4..9949d1c 100644 +--- a/meson.build ++++ b/meson.build +@@ -362,6 +362,9 @@ gst_plugins_good_args = ['-DHAVE_CONFIG_H'] + configinc = include_directories('.') + libsinc = include_directories('gst-libs') + ++rga_dep = dependency('librga', required: false) ++cdata.set('HAVE_RGA', rga_dep.found()) ++ + have_orcc = false + orcc_args = [] + orc_targets = [] +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0006-v4l2src-Support-setting-default-device.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0006-v4l2src-Support-setting-default-device.patch new file mode 100644 index 0000000000000000000000000000000000000000..39fc044e948245c0d5d32a504ece6debf6c825b3 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0006-v4l2src-Support-setting-default-device.patch @@ -0,0 +1,39 @@ +From 6edcca45240b58384a291a87754d51cca063c5f1 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 11 May 2022 15:21:44 +0800 +Subject: [PATCH 6/9] v4l2src: Support setting default device + +Use env "GST_V4L2SRC_DEFAULT_DEVICE" to specify default device. + +Signed-off-by: Jeffy Chen +--- + sys/v4l2/gstv4l2src.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c +index 1b2c1a6..f4408f7 100644 +--- a/sys/v4l2/gstv4l2src.c ++++ b/sys/v4l2/gstv4l2src.c +@@ -66,7 +66,7 @@ + GST_DEBUG_CATEGORY (v4l2src_debug); + #define GST_CAT_DEFAULT v4l2src_debug + +-#define DEFAULT_PROP_DEVICE "/dev/video0" ++static const gchar *DEFAULT_PROP_DEVICE = NULL; + + enum + { +@@ -143,6 +143,10 @@ gst_v4l2src_class_init (GstV4l2SrcClass * klass) + GstBaseSrcClass *basesrc_class; + GstPushSrcClass *pushsrc_class; + ++ DEFAULT_PROP_DEVICE = g_getenv ("GST_V4L2SRC_DEFAULT_DEVICE"); ++ if (!DEFAULT_PROP_DEVICE) ++ DEFAULT_PROP_DEVICE = "/dev/video0"; ++ + gobject_class = G_OBJECT_CLASS (klass); + element_class = GST_ELEMENT_CLASS (klass); + basesrc_class = GST_BASE_SRC_CLASS (klass); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0007-v4l2src-Filter-out-unavailable-RK-sources.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0007-v4l2src-Filter-out-unavailable-RK-sources.patch new file mode 100644 index 0000000000000000000000000000000000000000..7d7191e75ab5ec9ccaa6f1b5dd53d4f60fd1db17 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0007-v4l2src-Filter-out-unavailable-RK-sources.patch @@ -0,0 +1,66 @@ +From 55a8e772698a36c176ad7c5b02559594be19458d Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 11 May 2022 17:06:25 +0800 +Subject: [PATCH 07/12] v4l2src: Filter out unavailable RK sources + +Use env "GST_V4L2SRC_RK_DEVICES" to specify available RK sources. + +Default is "_mainpath:_selfpath:_bypass:_scale". + +Signed-off-by: Jeffy Chen +--- + sys/v4l2/gstv4l2deviceprovider.c | 38 ++++++++++++++++++++++++++++++++ + 1 file changed, 38 insertions(+) + +diff --git a/sys/v4l2/gstv4l2deviceprovider.c b/sys/v4l2/gstv4l2deviceprovider.c +index 7c2c87fea..291495506 100644 +--- a/sys/v4l2/gstv4l2deviceprovider.c ++++ b/sys/v4l2/gstv4l2deviceprovider.c +@@ -146,6 +146,44 @@ gst_v4l2_device_provider_probe_device (GstV4l2DeviceProvider * provider, + + type = GST_V4L2_DEVICE_TYPE_SOURCE; + v4l2obj->skip_try_fmt_probes = TRUE; ++ ++ if (!strncmp ((char *) v4l2obj->vcap.driver, "rk", strlen("rk"))) { ++ /* Filter out unavailable RK source devices */ ++ const gchar *devices, *ptr; ++ gchar pattern[64]; ++ gboolean found = FALSE; ++ ++ devices = g_getenv ("GST_V4L2SRC_RK_DEVICES"); ++ if (!devices) ++ devices = g_getenv ("GST_V4L2SRC_DEVICES"); ++ if (!devices) ++ devices = "_mainpath:_selfpath:_bypass:_scale"; ++ ++ while (devices && devices[0]) { ++ while (devices[0] == ':') ++ devices ++; ++ ++ if (!sscanf (devices, "%32[^:]", pattern)) ++ break; ++ ++ devices += strlen (pattern); ++ ++ if (!(ptr = strstr (device_name, pattern))) ++ continue; ++ ++ /* Name ends with pattern[0-9] */ ++ ptr += strlen (pattern); ++ if (ptr[0] == '\0' || (ptr[0] >= '0' && ptr[0] <= '9')) { ++ found = TRUE; ++ break; ++ } ++ } ++ ++ if (!found) { ++ GST_WARNING ("%s(%s) been ignored", device_path, device_name); ++ goto destroy; ++ } ++ } + } + + if (v4l2obj->device_caps & +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0008-v4l2src-Support-setting-max-resolution.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0008-v4l2src-Support-setting-max-resolution.patch new file mode 100644 index 0000000000000000000000000000000000000000..180e77255d82d9110df0c1a0bcff48f766b9ca18 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0008-v4l2src-Support-setting-max-resolution.patch @@ -0,0 +1,74 @@ +From b46b19345082bed48af8b4466e4636bad4b6e282 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Wed, 11 May 2022 17:24:49 +0800 +Subject: [PATCH 8/9] v4l2src: Support setting max resolution + +Set env "GST_V4L2SRC_MAX_RESOLUTION" to limit resolution, for example: +export GST_V4L2SRC_MAX_RESOLUTION=1920x1080 + +Signed-off-by: Jeffy Chen +--- + sys/v4l2/gstv4l2object.c | 19 +++++++++++++------ + 1 file changed, 13 insertions(+), 6 deletions(-) + +diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c +index a7b7ea7..fd1909d 100644 +--- a/sys/v4l2/gstv4l2object.c ++++ b/sys/v4l2/gstv4l2object.c +@@ -2770,6 +2770,7 @@ gst_v4l2_object_probe_caps_for_format (GstV4l2Object * v4l2object, + gint fd = v4l2object->video_fd; + struct v4l2_frmsizeenum size; + GList *results = NULL; ++ guint32 max_width = G_MAXINT, max_height = G_MAXINT; + guint32 w, h; + + if (pixelformat == GST_MAKE_FOURCC ('M', 'P', 'E', 'G')) { +@@ -2777,6 +2778,12 @@ gst_v4l2_object_probe_caps_for_format (GstV4l2Object * v4l2object, + return ret; + } + ++ if (!V4L2_TYPE_IS_OUTPUT (v4l2object->type)) { ++ const gchar *buf = g_getenv ("GST_V4L2SRC_MAX_RESOLUTION"); ++ if (buf) ++ sscanf (buf, "%ux%u", &max_width, &max_height); ++ } ++ + memset (&size, 0, sizeof (struct v4l2_frmsizeenum)); + size.index = 0; + size.pixel_format = pixelformat; +@@ -2793,8 +2800,8 @@ gst_v4l2_object_probe_caps_for_format (GstV4l2Object * v4l2object, + GST_LOG_OBJECT (v4l2object->dbg_obj, "got discrete frame size %dx%d", + size.discrete.width, size.discrete.height); + +- w = MIN (size.discrete.width, G_MAXINT); +- h = MIN (size.discrete.height, G_MAXINT); ++ w = MIN (size.discrete.width, max_width); ++ h = MIN (size.discrete.height, max_height); + + if (w && h) { + tmp = +@@ -2828,8 +2835,8 @@ gst_v4l2_object_probe_caps_for_format (GstV4l2Object * v4l2object, + + w = MAX (size.stepwise.min_width, 1); + h = MAX (size.stepwise.min_height, 1); +- maxw = MIN (size.stepwise.max_width, G_MAXINT); +- maxh = MIN (size.stepwise.max_height, G_MAXINT); ++ maxw = MIN (size.stepwise.max_width, max_width); ++ maxh = MIN (size.stepwise.max_height, max_height); + + step_w = MAX (size.stepwise.step_width, 1); + step_h = MAX (size.stepwise.step_height, 1); +@@ -2869,8 +2876,8 @@ gst_v4l2_object_probe_caps_for_format (GstV4l2Object * v4l2object, + + w = MAX (size.stepwise.min_width, 1); + h = MAX (size.stepwise.min_height, 1); +- maxw = MIN (size.stepwise.max_width, G_MAXINT); +- maxh = MIN (size.stepwise.max_height, G_MAXINT); ++ maxw = MIN (size.stepwise.max_width, max_width); ++ maxh = MIN (size.stepwise.max_height, max_height); + + tmp = + gst_v4l2_object_probe_caps_for_format_and_size (v4l2object, pixelformat, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0009-matroska-demux-parse-Disable-QoS-lace-skipping-by-de.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0009-matroska-demux-parse-Disable-QoS-lace-skipping-by-de.patch new file mode 100644 index 0000000000000000000000000000000000000000..d3dc30e16ec02097e3ceeddebfadbd6882a75aa2 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0009-matroska-demux-parse-Disable-QoS-lace-skipping-by-de.patch @@ -0,0 +1,73 @@ +From c60daeec651c5c71bc4460c6cc85996002019949 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 24 May 2022 12:40:03 +0800 +Subject: [PATCH 9/9] matroska-{demux,parse}: Disable QoS lace skipping by + default + +The QoS's timestamp would not reset in some cases, using it to skip late +laces rather dangerous. + +Tested with: +gst-play-1.0 --gapless 1.webm 1.webm + +Signed-off-by: Jeffy Chen +--- + gst/matroska/matroska-demux.c | 1 + + gst/matroska/matroska-parse.c | 1 + + gst/matroska/matroska-read-common.c | 2 ++ + gst/matroska/matroska-read-common.h | 2 ++ + 4 files changed, 6 insertions(+) + +diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c +index f4da496..3dae3e0 100644 +--- a/gst/matroska/matroska-demux.c ++++ b/gst/matroska/matroska-demux.c +@@ -4744,6 +4744,7 @@ gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux, + index entries point to keyframes, but if that is not true we + will instead skip until the next keyframe. */ + if (GST_CLOCK_TIME_IS_VALID (lace_time) && ++ demux->common.allow_skipping && + stream->type == GST_MATROSKA_TRACK_TYPE_VIDEO && + stream->index_table && demux->common.segment.rate > 0.0) { + GstMatroskaTrackVideoContext *videocontext = +diff --git a/gst/matroska/matroska-parse.c b/gst/matroska/matroska-parse.c +index 3fcb5c5..ff22ec2 100644 +--- a/gst/matroska/matroska-parse.c ++++ b/gst/matroska/matroska-parse.c +@@ -1878,6 +1878,7 @@ gst_matroska_parse_parse_blockgroup_or_simpleblock (GstMatroskaParse * parse, + index entries point to keyframes, but if that is not true we + will instead skip until the next keyframe. */ + if (GST_CLOCK_TIME_IS_VALID (lace_time) && ++ parse->common.allow_skipping && + stream->type == GST_MATROSKA_TRACK_TYPE_VIDEO && + stream->index_table && parse->common.segment.rate > 0.0) { + GstMatroskaTrackVideoContext *videocontext = +diff --git a/gst/matroska/matroska-read-common.c b/gst/matroska/matroska-read-common.c +index eb31764..334872a 100644 +--- a/gst/matroska/matroska-read-common.c ++++ b/gst/matroska/matroska-read-common.c +@@ -3371,6 +3371,8 @@ gst_matroska_read_common_reset (GstElement * element, + ctx->internal_toc = NULL; + } + ctx->toc_updated = FALSE; ++ ++ ctx->allow_skipping = !!g_getenv ("GST_MATROSKA_ALLOW_SKIP"); + } + + /* call with object lock held */ +diff --git a/gst/matroska/matroska-read-common.h b/gst/matroska/matroska-read-common.h +index 98cfc24..40ea641 100644 +--- a/gst/matroska/matroska-read-common.h ++++ b/gst/matroska/matroska-read-common.h +@@ -115,6 +115,8 @@ typedef struct _GstMatroskaReadCommon { + /* cache for track tags that forward-reference their tracks */ + GHashTable *cached_track_taglists ; + ++ /* allow QoS lace skipping */ ++ gboolean allow_skipping; + } GstMatroskaReadCommon; + + GstFlowReturn gst_matroska_decode_content_encodings (GArray * encodings); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0010-v4l2-Increase-VIDEO_MAX_FRAME-to-64.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0010-v4l2-Increase-VIDEO_MAX_FRAME-to-64.patch new file mode 100644 index 0000000000000000000000000000000000000000..2f1e023fa9119961a5c7314a784c696db27e0ded --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0010-v4l2-Increase-VIDEO_MAX_FRAME-to-64.patch @@ -0,0 +1,29 @@ +From 0770dcf737f050ed57077917dd3a436af76ae473 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 23 Jun 2022 16:01:56 +0800 +Subject: [PATCH 10/12] v4l2: Increase VIDEO_MAX_FRAME to 64 + +This is done in the kernel side for android: +e81694723af1 ANDROID: media: increase video max frame number + +Signed-off-by: Jeffy Chen +--- + sys/v4l2/ext/videodev2.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sys/v4l2/ext/videodev2.h b/sys/v4l2/ext/videodev2.h +index 24832ee6f..8dbe50fdf 100644 +--- a/sys/v4l2/ext/videodev2.h ++++ b/sys/v4l2/ext/videodev2.h +@@ -68,7 +68,7 @@ + * Common stuff for both V4L1 and V4L2 + * Moved from videodev.h + */ +-#define VIDEO_MAX_FRAME 32 ++#define VIDEO_MAX_FRAME 64 + #define VIDEO_MAX_PLANES 8 + + /* +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0011-v4l2-Support-setting-v4l2-min-buffers.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0011-v4l2-Support-setting-v4l2-min-buffers.patch new file mode 100644 index 0000000000000000000000000000000000000000..4798f2801e8155cc682552d88e686f2c7a8b25d0 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0011-v4l2-Support-setting-v4l2-min-buffers.patch @@ -0,0 +1,108 @@ +From 7debb47e84900b1d56e629b295f16e5030fd2b3a Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 23 Jun 2022 16:04:18 +0800 +Subject: [PATCH 11/12] v4l2: Support setting v4l2 min buffers + +Tested with: +gst-launch-1.0 v4l2src min-buffers=32 ! waylandsink ts-offset=1000000000 + +Signed-off-by: Jeffy Chen +--- + sys/v4l2/gstv4l2object.c | 24 ++++++++++++++++++++++++ + sys/v4l2/gstv4l2object.h | 3 ++- + 2 files changed, 26 insertions(+), 1 deletion(-) + +diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c +index fd1909d01..c210b357a 100644 +--- a/sys/v4l2/gstv4l2object.c ++++ b/sys/v4l2/gstv4l2object.c +@@ -56,6 +56,8 @@ GST_DEBUG_CATEGORY_EXTERN (v4l2_debug); + + #define ENCODED_BUFFER_SIZE (2 * 1024 * 1024) + ++static guint DEFAULT_PROP_MIN_BUFFERS = 0; ++ + enum + { + PROP_0, +@@ -307,6 +309,11 @@ void + gst_v4l2_object_install_properties_helper (GObjectClass * gobject_class, + const char *default_device) + { ++ const gchar *buf = g_getenv ("GST_V4L2_MIN_BUFS"); ++ ++ if (buf) ++ DEFAULT_PROP_MIN_BUFFERS = atoi (buf); ++ + g_object_class_install_property (gobject_class, PROP_DEVICE, + g_param_spec_string ("device", "Device", "Device location", + default_device, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +@@ -426,6 +433,12 @@ gst_v4l2_object_install_properties_helper (GObjectClass * gobject_class, + "When enabled, the pixel aspect ratio will be enforced", TRUE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + ++ g_object_class_install_property (gobject_class, PROP_MIN_BUFFERS, ++ g_param_spec_uint ("min-buffers", "Min buffers", ++ "Override the driver's min buffers (0 means auto)", ++ 0, VIDEO_MAX_FRAME, DEFAULT_PROP_MIN_BUFFERS, ++ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); ++ + gst_type_mark_as_plugin_api (GST_TYPE_V4L2_DEVICE_FLAGS, 0); + gst_type_mark_as_plugin_api (GST_TYPE_V4L2_TV_NORM, 0); + gst_type_mark_as_plugin_api (GST_TYPE_V4L2_IO_MODE, 0); +@@ -543,6 +556,8 @@ gst_v4l2_object_new (GstElement * element, + v4l2object->munmap = munmap; + } + ++ v4l2object->min_buffers = DEFAULT_PROP_MIN_BUFFERS; ++ + return v4l2object; + } + +@@ -713,6 +728,9 @@ gst_v4l2_object_set_property_helper (GstV4l2Object * v4l2object, + case PROP_FORCE_ASPECT_RATIO: + v4l2object->keep_aspect = g_value_get_boolean (value); + break; ++ case PROP_MIN_BUFFERS: ++ v4l2object->min_buffers = g_value_get_uint (value); ++ break; + default: + return FALSE; + break; +@@ -810,6 +828,9 @@ gst_v4l2_object_get_property_helper (GstV4l2Object * v4l2object, + case PROP_FORCE_ASPECT_RATIO: + g_value_set_boolean (value, v4l2object->keep_aspect); + break; ++ case PROP_MIN_BUFFERS: ++ g_value_set_uint (value, v4l2object->min_buffers); ++ break; + default: + return FALSE; + break; +@@ -822,6 +843,9 @@ gst_v4l2_get_driver_min_buffers (GstV4l2Object * v4l2object) + { + struct v4l2_control control = { 0, }; + ++ if (v4l2object->min_buffers) ++ return; ++ + g_return_if_fail (GST_V4L2_IS_OPEN (v4l2object)); + + if (V4L2_TYPE_IS_OUTPUT (v4l2object->type)) +diff --git a/sys/v4l2/gstv4l2object.h b/sys/v4l2/gstv4l2object.h +index e5ed0acab..cac92f18c 100644 +--- a/sys/v4l2/gstv4l2object.h ++++ b/sys/v4l2/gstv4l2object.h +@@ -246,7 +246,8 @@ GType gst_v4l2_object_get_type (void); + PROP_CAPTURE_IO_MODE, \ + PROP_EXTRA_CONTROLS, \ + PROP_PIXEL_ASPECT_RATIO, \ +- PROP_FORCE_ASPECT_RATIO ++ PROP_FORCE_ASPECT_RATIO, \ ++ PROP_MIN_BUFFERS + + /* create/destroy */ + GstV4l2Object* gst_v4l2_object_new (GstElement * element, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0012-v4l2-Support-disabling-buffer-sharing.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0012-v4l2-Support-disabling-buffer-sharing.patch new file mode 100644 index 0000000000000000000000000000000000000000..c1fa6af035f042f9219680be3d0208f017e8a027 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20/0012-v4l2-Support-disabling-buffer-sharing.patch @@ -0,0 +1,114 @@ +From 7c46d52b213e21c2ed9223dcc8dd6fbc324b37ec Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 27 Jun 2022 17:48:30 +0800 +Subject: [PATCH 12/12] v4l2: Support disabling buffer sharing + +Tested with: +export GST_DEBUG=v4l2bufferpool:5 +gst-launch-1.0 v4l2src no-buffer-sharing=true ! waylandsink + +Signed-off-by: Jeffy Chen +--- + sys/v4l2/gstv4l2object.c | 20 ++++++++++++++++++++ + sys/v4l2/gstv4l2object.h | 5 ++++- + 2 files changed, 24 insertions(+), 1 deletion(-) + +diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c +index c210b357a..e7863a4c3 100644 +--- a/sys/v4l2/gstv4l2object.c ++++ b/sys/v4l2/gstv4l2object.c +@@ -57,6 +57,7 @@ GST_DEBUG_CATEGORY_EXTERN (v4l2_debug); + #define ENCODED_BUFFER_SIZE (2 * 1024 * 1024) + + static guint DEFAULT_PROP_MIN_BUFFERS = 0; ++static gboolean DEFAULT_PROP_NO_BUFFER_SHARING = FALSE; + + enum + { +@@ -314,6 +315,9 @@ gst_v4l2_object_install_properties_helper (GObjectClass * gobject_class, + if (buf) + DEFAULT_PROP_MIN_BUFFERS = atoi (buf); + ++ if ((buf = g_getenv ("GST_V4L2_NO_BUF_SHARING"))) ++ DEFAULT_PROP_NO_BUFFER_SHARING = buf[0] == '1'; ++ + g_object_class_install_property (gobject_class, PROP_DEVICE, + g_param_spec_string ("device", "Device", "Device location", + default_device, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +@@ -439,6 +443,12 @@ gst_v4l2_object_install_properties_helper (GObjectClass * gobject_class, + 0, VIDEO_MAX_FRAME, DEFAULT_PROP_MIN_BUFFERS, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + ++ g_object_class_install_property (gobject_class, PROP_NO_BUFFER_SHARING, ++ g_param_spec_boolean ("no-buffer-sharing", "No buffer sharing", ++ "When enabled, disable buffer sharing", ++ DEFAULT_PROP_NO_BUFFER_SHARING, ++ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); ++ + gst_type_mark_as_plugin_api (GST_TYPE_V4L2_DEVICE_FLAGS, 0); + gst_type_mark_as_plugin_api (GST_TYPE_V4L2_TV_NORM, 0); + gst_type_mark_as_plugin_api (GST_TYPE_V4L2_IO_MODE, 0); +@@ -557,6 +567,7 @@ gst_v4l2_object_new (GstElement * element, + } + + v4l2object->min_buffers = DEFAULT_PROP_MIN_BUFFERS; ++ v4l2object->no_buffer_sharing = DEFAULT_PROP_NO_BUFFER_SHARING; + + return v4l2object; + } +@@ -731,6 +742,9 @@ gst_v4l2_object_set_property_helper (GstV4l2Object * v4l2object, + case PROP_MIN_BUFFERS: + v4l2object->min_buffers = g_value_get_uint (value); + break; ++ case PROP_NO_BUFFER_SHARING: ++ v4l2object->no_buffer_sharing = g_value_get_boolean (value); ++ break; + default: + return FALSE; + break; +@@ -831,6 +845,9 @@ gst_v4l2_object_get_property_helper (GstV4l2Object * v4l2object, + case PROP_MIN_BUFFERS: + g_value_set_uint (value, v4l2object->min_buffers); + break; ++ case PROP_NO_BUFFER_SHARING: ++ g_value_set_boolean (value, v4l2object->no_buffer_sharing); ++ break; + default: + return FALSE; + break; +@@ -4899,6 +4916,9 @@ gst_v4l2_object_decide_allocation (GstV4l2Object * obj, GstQuery * query) + if (min + obj->min_buffers + 1 > VIDEO_MAX_FRAME) + can_share_own_pool = FALSE; + ++ if (obj->no_buffer_sharing) ++ can_share_own_pool = FALSE; ++ + /* select a pool */ + switch (obj->mode) { + case GST_V4L2_IO_RW: +diff --git a/sys/v4l2/gstv4l2object.h b/sys/v4l2/gstv4l2object.h +index cac92f18c..577feb788 100644 +--- a/sys/v4l2/gstv4l2object.h ++++ b/sys/v4l2/gstv4l2object.h +@@ -222,6 +222,8 @@ struct _GstV4l2Object { + * on slow USB firmwares. When this is set, gst_v4l2_set_format() will modify + * the caps to reflect what was negotiated during fixation */ + gboolean skip_try_fmt_probes; ++ ++ gboolean no_buffer_sharing; + }; + + struct _GstV4l2ObjectClassHelper { +@@ -247,7 +249,8 @@ GType gst_v4l2_object_get_type (void); + PROP_EXTRA_CONTROLS, \ + PROP_PIXEL_ASPECT_RATIO, \ + PROP_FORCE_ASPECT_RATIO, \ +- PROP_MIN_BUFFERS ++ PROP_MIN_BUFFERS, \ ++ PROP_NO_BUFFER_SHARING + + /* create/destroy */ + GstV4l2Object* gst_v4l2_object_new (GstElement * element, +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0_%.bbappend b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0_%.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..7a8a0458e75b75cca1457bcff05254b7d8529e46 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0_%.bbappend @@ -0,0 +1,7 @@ +# Copyright (c) 2022, Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +MAJ_VER = "${@oe.utils.trim_version("${PV}", 2)}" +PATCHPATH = "${CURDIR}/${BPN}_${MAJ_VER}" + +inherit auto-patch diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0_1.20/0001-filesrc-Fix-stopping-race-in-pull-mode.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0_1.20/0001-filesrc-Fix-stopping-race-in-pull-mode.patch new file mode 100644 index 0000000000000000000000000000000000000000..37b0dfbf9e960e26d24291ac8c0136eaf11ead73 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0_1.20/0001-filesrc-Fix-stopping-race-in-pull-mode.patch @@ -0,0 +1,41 @@ +From 25140cf5b4e20cd6ddd3a1eef5adca46bda7cce5 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 6 Apr 2021 10:51:35 +0800 +Subject: [PATCH 1/2] filesrc: Fix stopping race in pull-mode + +When using qtmultimedia + playbin3, there's a chance that stop() been +called before fill(). + +Setting uninitialized src fd to -1 instead of 0 to avoid reading the +stdin in that case. + +Signed-off-by: Jeffy Chen +--- + plugins/elements/gstfilesrc.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c +index 62ffb20..2270c8d 100644 +--- a/plugins/elements/gstfilesrc.c ++++ b/plugins/elements/gstfilesrc.c +@@ -188,7 +188,7 @@ static void + gst_file_src_init (GstFileSrc * src) + { + src->filename = NULL; +- src->fd = 0; ++ src->fd = -1; + src->uri = NULL; + + src->is_regular = FALSE; +@@ -604,7 +604,7 @@ gst_file_src_stop (GstBaseSrc * basesrc) + g_close (src->fd, NULL); + + /* zero out a lot of our state */ +- src->fd = 0; ++ src->fd = -1; + src->is_regular = FALSE; + + return TRUE; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0_1.20/0002-HACK-gstpad-Add-1-sec-timeout-for-activation.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0_1.20/0002-HACK-gstpad-Add-1-sec-timeout-for-activation.patch new file mode 100644 index 0000000000000000000000000000000000000000..3bb5d3dc0ff10558d0ca3fef4e114c5a70a17878 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0_1.20/0002-HACK-gstpad-Add-1-sec-timeout-for-activation.patch @@ -0,0 +1,70 @@ +From 98f949385c555b72e68db867969bf7bd3e642355 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 29 Nov 2021 14:49:25 +0800 +Subject: [PATCH 2/2] HACK: gstpad: Add 1 sec timeout for activation + +When using ghost pad, changing the activation mode might cause +recursive waiting and hang the pipeline. + +It's hard to fix it without bring in new issues, let's just add a +timeout as a workaround. + +Signed-off-by: Jeffy Chen +--- + gst/gstpad.c | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +diff --git a/gst/gstpad.c b/gst/gstpad.c +index bccba4e..1c43e1e 100644 +--- a/gst/gstpad.c ++++ b/gst/gstpad.c +@@ -964,6 +964,18 @@ gst_pad_mode_get_name (GstPadMode mode) + return "unknown"; + } + ++static inline void ++wait_activation_locked (GstPad * pad) ++{ ++ /* HACK: 1 sec timeout for activation */ ++ for (gint i = 0; i < 1000; i++) { ++ if (G_LIKELY (!pad->priv->in_activation)) ++ break; ++ ++ g_usleep(1000); ++ } ++} ++ + /* Returns TRUE if pad wasn't already in the new_mode */ + static gboolean + pre_activate (GstPad * pad, GstPadMode new_mode) +@@ -971,8 +983,13 @@ pre_activate (GstPad * pad, GstPadMode new_mode) + switch (new_mode) { + case GST_PAD_MODE_NONE: + GST_OBJECT_LOCK (pad); ++#if 0 + while (G_UNLIKELY (pad->priv->in_activation)) + g_cond_wait (&pad->priv->activation_cond, GST_OBJECT_GET_LOCK (pad)); ++#else ++ if (G_UNLIKELY (pad->priv->in_activation)) ++ wait_activation_locked (pad); ++#endif + if (new_mode == GST_PAD_MODE (pad)) { + GST_WARNING_OBJECT (pad, + "Pad is already in the process of being deactivated"); +@@ -991,8 +1008,13 @@ pre_activate (GstPad * pad, GstPadMode new_mode) + case GST_PAD_MODE_PUSH: + case GST_PAD_MODE_PULL: + GST_OBJECT_LOCK (pad); ++#if 0 + while (G_UNLIKELY (pad->priv->in_activation)) + g_cond_wait (&pad->priv->activation_cond, GST_OBJECT_GET_LOCK (pad)); ++#else ++ if (G_UNLIKELY (pad->priv->in_activation)) ++ wait_activation_locked (pad); ++#endif + if (new_mode == GST_PAD_MODE (pad)) { + GST_WARNING_OBJECT (pad, + "Pad is already in the process of being activated"); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0_1.20/0003-HACK-caps-Consider-dmabuf-subset-of-system-memory.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0_1.20/0003-HACK-caps-Consider-dmabuf-subset-of-system-memory.patch new file mode 100644 index 0000000000000000000000000000000000000000..aae9a83adbf33fbb9c92d39058a44c6fc9dddaf0 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0_1.20/0003-HACK-caps-Consider-dmabuf-subset-of-system-memory.patch @@ -0,0 +1,202 @@ +From c703437f71ac74a184c3730b8f6ca1cc54c07374 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 19 Jul 2022 18:19:48 +0800 +Subject: [PATCH 3/4] HACK: caps: Consider dmabuf subset of system memory + +Note, this is only true when the dmabuf is mmapable. + +Signed-off-by: Jeffy Chen +--- + gst/gstcaps.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 87 insertions(+) + +diff --git a/gst/gstcaps.c b/gst/gstcaps.c +index bbb9211..5e726fe 100644 +--- a/gst/gstcaps.c ++++ b/gst/gstcaps.c +@@ -125,6 +125,23 @@ typedef struct _GstCapsImpl + /* lock to protect multiple invocations of static caps to caps conversion */ + G_LOCK_DEFINE_STATIC (static_caps_lock); + ++#ifndef GST_CAPS_FEATURE_MEMORY_DMABUF ++#define GST_CAPS_FEATURE_MEMORY_DMABUF "memory:DMABuf" ++#endif ++ ++/* HACK: dma memory would likely provide system memory through mmap */ ++static gboolean ++gst_caps_features_drop_dma (GstCapsFeatures * features) ++{ ++ if (gst_caps_features_is_any (features) || ++ !gst_caps_features_contains (features, GST_CAPS_FEATURE_MEMORY_DMABUF)) ++ return FALSE; ++ ++ gst_caps_features_remove (features, GST_CAPS_FEATURE_MEMORY_DMABUF); ++ gst_caps_features_add (features, GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY); ++ return TRUE; ++} ++ + static void gst_caps_transform_to_string (const GValue * src_value, + GValue * dest_value); + static gboolean gst_caps_from_string_inplace (GstCaps * caps, +@@ -1330,6 +1347,8 @@ gst_caps_is_subset (const GstCaps * subset, const GstCaps * superset) + if (!f1) + f1 = GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY; + ++ f1 = gst_caps_features_copy (f1); ++retry: + for (j = GST_CAPS_LEN (superset) - 1; j >= 0; j--) { + s2 = gst_caps_get_structure_unchecked (superset, j); + f2 = gst_caps_get_features_unchecked (superset, j); +@@ -1344,6 +1363,11 @@ gst_caps_is_subset (const GstCaps * subset, const GstCaps * superset) + } + } + ++ if (j == -1 && gst_caps_features_drop_dma (f1)) ++ goto retry; ++ ++ gst_caps_features_free (f1); ++ + /* If we found no superset for this subset structure + * we return FALSE immediately */ + if (j == -1) { +@@ -1586,10 +1610,26 @@ gst_caps_can_intersect (const GstCaps * caps1, const GstCaps * caps2) + features2 = gst_caps_get_features_unchecked (caps2, k); + if (!features2) + features2 = GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY; ++ ++ features1 = gst_caps_features_copy (features1); ++ features2 = gst_caps_features_copy (features2); ++retry: + if (gst_caps_features_is_equal (features1, features2) && + gst_structure_can_intersect (struct1, struct2)) { ++ gst_caps_features_free (features1); ++ gst_caps_features_free (features2); + return TRUE; ++ } else { ++ if (gst_caps_features_drop_dma (features1)) ++ goto retry; ++ ++ if (gst_caps_features_drop_dma (features2)) ++ goto retry; + } ++ ++ gst_caps_features_free (features1); ++ gst_caps_features_free (features2); ++ + /* move down left */ + k++; + if (G_UNLIKELY (j == 0)) +@@ -1612,6 +1652,7 @@ gst_caps_intersect_zig_zag (GstCaps * caps1, GstCaps * caps2) + GstCapsFeatures *features2; + GstCaps *dest; + GstStructure *istruct; ++ gboolean drop_dma = FALSE; + + dest = gst_caps_new_empty (); + /* run zigzag on top line then right line, this preserves the caps order +@@ -1632,6 +1673,8 @@ gst_caps_intersect_zig_zag (GstCaps * caps1, GstCaps * caps2) + */ + len1 = GST_CAPS_LEN (caps1); + len2 = GST_CAPS_LEN (caps2); ++ ++retry: + for (i = 0; i < len1 + len2 - 1; i++) { + /* caps1 index goes from 0 to GST_CAPS_LEN (caps1)-1 */ + j = MIN (i, len1 - 1); +@@ -1649,6 +1692,15 @@ gst_caps_intersect_zig_zag (GstCaps * caps1, GstCaps * caps2) + features2 = gst_caps_get_features_unchecked (caps2, k); + if (!features2) + features2 = GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY; ++ ++ features1 = gst_caps_features_copy (features1); ++ features2 = gst_caps_features_copy (features2); ++ ++ if (drop_dma) { ++ gst_caps_features_drop_dma (features1); ++ gst_caps_features_drop_dma (features2); ++ } ++ + if (gst_caps_features_is_equal (features1, features2)) { + istruct = gst_structure_intersect (struct1, struct2); + if (istruct) { +@@ -1662,6 +1714,10 @@ gst_caps_intersect_zig_zag (GstCaps * caps1, GstCaps * caps2) + gst_caps_features_copy_conditional (features1)); + } + } ++ ++ gst_caps_features_free (features1); ++ gst_caps_features_free (features2); ++ + /* move down left */ + k++; + if (G_UNLIKELY (j == 0)) +@@ -1669,6 +1725,13 @@ gst_caps_intersect_zig_zag (GstCaps * caps1, GstCaps * caps2) + j--; + } + } ++ ++ /* try without DMA */ ++ if (CAPS_IS_EMPTY (dest) && !drop_dma) { ++ drop_dma = TRUE; ++ goto retry; ++ } ++ + return dest; + } + +@@ -1696,20 +1759,34 @@ gst_caps_intersect_first (GstCaps * caps1, GstCaps * caps2) + GstCapsFeatures *features2; + GstCaps *dest; + GstStructure *istruct; ++ gboolean drop_dma = FALSE; + + dest = gst_caps_new_empty (); + len1 = GST_CAPS_LEN (caps1); + len2 = GST_CAPS_LEN (caps2); ++ ++retry: + for (i = 0; i < len1; i++) { + struct1 = gst_caps_get_structure_unchecked (caps1, i); + features1 = gst_caps_get_features_unchecked (caps1, i); + if (!features1) + features1 = GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY; ++ ++ features1 = gst_caps_features_copy (features1); ++ + for (j = 0; j < len2; j++) { + struct2 = gst_caps_get_structure_unchecked (caps2, j); + features2 = gst_caps_get_features_unchecked (caps2, j); + if (!features2) + features2 = GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY; ++ ++ features2 = gst_caps_features_copy (features2); ++ ++ if (drop_dma) { ++ gst_caps_features_drop_dma (features1); ++ gst_caps_features_drop_dma (features2); ++ } ++ + if (gst_caps_features_is_equal (features1, features2)) { + istruct = gst_structure_intersect (struct1, struct2); + if (istruct) { +@@ -1723,7 +1800,17 @@ gst_caps_intersect_first (GstCaps * caps1, GstCaps * caps2) + gst_caps_features_copy_conditional (features1)); + } + } ++ ++ gst_caps_features_free (features2); + } ++ ++ gst_caps_features_free (features1); ++ } ++ ++ /* try without DMA */ ++ if (CAPS_IS_EMPTY (dest) && !drop_dma) { ++ drop_dma = TRUE; ++ goto retry; + } + + return dest; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0_1.20/0004-gst-launch-Fix-random-hang-when-EOS.patch b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0_1.20/0004-gst-launch-Fix-random-hang-when-EOS.patch new file mode 100644 index 0000000000000000000000000000000000000000..e258e8d147f788273c8351054474f4c2f3f7e93b --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/gstreamer/gstreamer1.0_1.20/0004-gst-launch-Fix-random-hang-when-EOS.patch @@ -0,0 +1,61 @@ +From 8486605464354e70f30626c1e12649128197e983 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Mon, 3 Oct 2022 15:07:33 +0800 +Subject: [PATCH 4/4] gst-launch: Fix random hang when EOS + +There's a race between the async initial pause and initial play. + +When the async pausing message arrives later than the playing one, the +gstbin's state machine would be confused. + +Signed-off-by: Jeffy Chen +--- + tools/gst-launch.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/tools/gst-launch.c b/tools/gst-launch.c +index 5733152..fdaf579 100644 +--- a/tools/gst-launch.c ++++ b/tools/gst-launch.c +@@ -78,6 +78,7 @@ static gboolean eos_on_shutdown = FALSE; + static gchar **exclude_args = NULL; + + /* pipeline status */ ++static gboolean pending_async_done = FALSE; + static gboolean is_live = FALSE; + static gboolean buffering = FALSE; + static LaunchExitCode last_launch_code = LEC_NO_ERROR; +@@ -737,12 +738,22 @@ bus_handler (GstBus * bus, GstMessage * message, gpointer data) + PRINT (_("Prerolled, waiting for progress to finish...\n")); + break; + } ++ if (pending_async_done) { ++ PRINT (_("Prerolled, waiting for async message to finish...\n")); ++ break; ++ } + + do_initial_play (pipeline); + } + /* else not an interesting message */ + break; + } ++ case GST_MESSAGE_ASYNC_DONE: ++ { ++ if (target_state == GST_STATE_PAUSED) ++ do_initial_play (pipeline); ++ break; ++ } + case GST_MESSAGE_BUFFERING:{ + gint percent; + +@@ -1274,6 +1285,7 @@ main (int argc, char *argv[]) + break; + case GST_STATE_CHANGE_ASYNC: + PRINT (_("Pipeline is PREROLLING ...\n")); ++ pending_async_done = TRUE; + break; + default: + break; +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/rockchip-mpp/rockchip-mpp.bb b/bsp/meta-rockchip/recipes-multimedia/rockchip-mpp/rockchip-mpp.bb new file mode 100644 index 0000000000000000000000000000000000000000..9024f4af3862f6b40c86b30a9b66def0dc5f9c84 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/rockchip-mpp/rockchip-mpp.bb @@ -0,0 +1,32 @@ +# Copyright (C) 2016 - 2017 Randy Li +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the GNU GENERAL PUBLIC LICENSE Version 2 +# (see COPYING.GPLv2 for the terms) + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://inc/rk_mpi.h;beginline=4;endline=14;md5=acbba394ae5639b0c786f60c1f48e3d6" + +inherit freeze-rev local-git + +SRCREV = "c145c846324c41ff867c04c1d85893163375db6a" +SRC_URI = "git://github.com/JeffyCN/mirrors.git;protocol=https;nobranch=1;branch=mpp-dev-2023_02_14;" + +S = "${WORKDIR}/git" + +inherit pkgconfig cmake + +EXTRA_OECMAKE = " \ + -DRKPLATFORM=ON \ + -DHAVE_DRM=ON \ +" + +CFLAGS:append = " -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" + +PACKAGES = "${PN}-demos ${PN}-dbg ${PN}-staticdev ${PN}-dev ${PN} ${PN}-vpu" +FILES:${PN}-vpu = "${libdir}/lib*vpu${SOLIBS}" +FILES:${PN} = "${libdir}/lib*mpp${SOLIBS}" +FILES:${PN}-dev = "${libdir}/lib*${SOLIBSDEV} ${includedir} ${libdir}/pkgconfig" +FILES:${PN}-demos = "${bindir}/*" +SECTION:${PN}-dev = "devel" +FILES:${PN}-staticdev = "${libdir}/*.a" +SECTION:${PN}-staticdev = "devel" diff --git a/bsp/meta-rockchip/recipes-multimedia/rockchip-rkaiq/files/rkaiq_daemons.sh b/bsp/meta-rockchip/recipes-multimedia/rockchip-rkaiq/files/rkaiq_daemons.sh new file mode 100755 index 0000000000000000000000000000000000000000..a62ab162bfeea20669e902b297c919e698389533 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/rockchip-rkaiq/files/rkaiq_daemons.sh @@ -0,0 +1,49 @@ +#!/bin/sh -e +### BEGIN INIT INFO +# Provides: rockchip-rkaiq +# Required-Start: mountvirtfs +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: 3A daemons for rkaiq media devices +### END INIT INFO + +PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" + +start_rkaiq_daemons() +{ + for dev in /dev/media[0-9];do + echo "Creating rkaiq daemon for ${dev}..." + start-stop-daemon --start --background --oknodo \ + -m --pidfile "/var/run/rkaiq_${dev##*/}.pid" \ + --startas /usr/bin/rkaiq_3A_server + done +} + +stop_rkaiq_daemons() +{ + for dev in /dev/media[0-9];do + start-stop-daemon --stop --quiet --oknodo \ + --pidfile "/var/run/rkaiq_${dev##*/}.pid" + done +} + +case "$1" in + start) + start_rkaiq_daemons + ;; + stop) + stop_rkaiq_daemons + ;; + restart|reload) + stop_rkaiq_daemons + start_rkaiq_daemons + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit 0 diff --git a/bsp/meta-rockchip/recipes-multimedia/rockchip-rkaiq/rockchip-rkaiq.bb b/bsp/meta-rockchip/recipes-multimedia/rockchip-rkaiq/rockchip-rkaiq.bb new file mode 100644 index 0000000000000000000000000000000000000000..bfba4d5ca0121f4b18365286594290373ae837ee --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/rockchip-rkaiq/rockchip-rkaiq.bb @@ -0,0 +1,72 @@ +# Copyright (C) 2022, Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://NOTICE;md5=9645f39e9db895a4aa6e02cb57294595" + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +PACKAGES:append = " ${PN}-server ${PN}-iqfiles" + +DEPENDS = "coreutils-native xxd-native rockchip-librga" +RDEPENDS:${PN}-server = "${PN}" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +inherit freeze-rev local-git + +SRCREV = "${@oe.utils.version_less_or_equal('RK_ISP_VERSION', '1', '0123456789012345678901234567890123456789', '${AUTOREV}', d)}" +SRC_URI = " \ + git://github.com/JeffyCN/mirrors.git;protocol=https;nobranch=1;branch=rkaiq-2022_09_22; \ + file://rkaiq_daemons.sh \ +" + +S = "${WORKDIR}/git" + +inherit pkgconfig cmake + +EXTRA_OECMAKE = " \ + -DARCH=${@bb.utils.contains('TUNE_FEATURES', 'aarch64', 'aarch64', 'arm', d)} \ + -DISP_HW_VERSION=-DISP_HW_V${@d.getVar('RK_ISP_VERSION').replace('.','')} \ + -DRKAIQ_TARGET_SOC=${@d.getVar('SOC_FAMILY').replace('rk3568','rk356x')} \ +" + +do_generate_toolchain_file:append () { + echo "set( CMAKE_SYSROOT ${STAGING_DIR_HOST} )" >> \ + ${WORKDIR}/toolchain.cmake + echo "set( CMAKE_SYSROOT_COMPILE ${STAGING_DIR_HOST} )" >> \ + ${WORKDIR}/toolchain.cmake + + sed -i "s/\(\${CMAKE_C_COMPILER}\)/\1 -I\${CMAKE_SYSROOT}\/usr\/include/" \ + ${S}/iq_parser_v2/CMakeLists.txt + + sed -i 's/if ( !pattr )/if ( pattr )/' ${S}/iq_parser/xmltags.cpp + sed -i '/\/d' ${S}/rkaiq_3A_server/CMakeLists.txt + sed -i 's/\(add_library(.* STATIC IMPORTED\))/\1 GLOBAL)/' ${S}/algos/CMakeLists.txt +} + +do_install:append () { + # rkaiq installed 3A server to the wrong dir. + [ -d ${D}/usr/usr ] && mv ${D}/usr/usr/* ${D}/usr/ + rm -rf ${D}/usr/etc ${D}/usr/usr ${D}/usr/bin/*demo + + install -d ${D}${sysconfdir}/iqfiles + install -m 0644 ${S}/iqfiles/*/*.json ${D}${sysconfdir}/iqfiles/ + + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/rkaiq_daemons.sh ${D}${sysconfdir}/init.d/ +} + +inherit update-rc.d + +INITSCRIPT_PACKAGES = "${PN}-server" +INITSCRIPT_NAME:${PN}-server = "rkaiq_daemons.sh" +INITSCRIPT_PARAMS:${PN}-server = "start 70 5 4 3 2 . stop 30 0 1 6 ." + +FILES:${PN}-dev = "${includedir}" +FILES:${PN}-server = " \ + ${bindir}/rkaiq_3A_server \ + ${sysconfdir}/init.d/ \ +" +FILES:${PN}-iqfiles = "${sysconfdir}/iqfiles/" +FILES:${PN} = "${libdir}" diff --git a/bsp/meta-rockchip/recipes-multimedia/rockchip-rkisp/files/rkisp_daemons.sh b/bsp/meta-rockchip/recipes-multimedia/rockchip-rkisp/files/rkisp_daemons.sh new file mode 100755 index 0000000000000000000000000000000000000000..c18b139807c443eeab0faf2380dbd9ddf757349b --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/rockchip-rkisp/files/rkisp_daemons.sh @@ -0,0 +1,49 @@ +#!/bin/sh -e +### BEGIN INIT INFO +# Provides: rockchip-rkisp +# Required-Start: mountvirtfs +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: 3A daemons for rkisp media devices +### END INIT INFO + +PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" + +start_rkisp_daemons() +{ + for dev in /dev/media[0-9];do + echo "Creating rkisp daemon for ${dev}..." + start-stop-daemon --start --background --oknodo \ + -m --pidfile "/var/run/rkisp_${dev##*/}.pid" \ + --startas /usr/bin/rkisp_3A_server -- --mmedia=${dev} + done +} + +stop_rkisp_daemons() +{ + for dev in /dev/media[0-9];do + start-stop-daemon --stop --quiet --oknodo \ + --pidfile "/var/run/rkisp_${dev##*/}.pid" + done +} + +case "$1" in + start) + start_rkisp_daemons + ;; + stop) + stop_rkisp_daemons + ;; + restart|reload) + stop_rkisp_daemons + start_rkisp_daemons + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit 0 diff --git a/bsp/meta-rockchip/recipes-multimedia/rockchip-rkisp/rockchip-rkisp.bb b/bsp/meta-rockchip/recipes-multimedia/rockchip-rkisp/rockchip-rkisp.bb new file mode 100644 index 0000000000000000000000000000000000000000..2050b4ea066b24b7eb3b9809945b8bc828d086b7 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/rockchip-rkisp/rockchip-rkisp.bb @@ -0,0 +1,108 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://NOTICE;md5=9645f39e9db895a4aa6e02cb57294595" + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +PACKAGES:append = " ${PN}-tests ${PN}-server ${PN}-iqfiles" + +DEPENDS = "coreutils-native chrpath-replacement-native libdrm" +RDEPENDS:${PN}-tests = "${PN}" +RDEPENDS:${PN}-server = "${PN}" + +inherit freeze-rev local-git + +SRCREV = "fafcd69874d20a7737425cc16a70619b220f8a2e" +SRC_URI = " \ + git://github.com/JeffyCN/mirrors.git;protocol=https;branch=camera_engine_rkisp; \ + file://rkisp_daemons.sh \ +" + +S = "${WORKDIR}/git" + +do_configure() { + if echo ${TUNE_FEATURES} | grep -wq arm; then + ln -sf glib-2.0-32 ext/rkisp/usr/include/glib-2.0 + ln -sf lib32 ext/rkisp/usr/lib + ln -sf lib32 plugins/3a/rkiq/aec/lib + ln -sf lib32 plugins/3a/rkiq/af/lib + ln -sf lib32 plugins/3a/rkiq/awb/lib + else + ln -sf glib-2.0-64 ext/rkisp/usr/include/glib-2.0 + ln -sf lib64 ext/rkisp/usr/lib + ln -sf lib64 plugins/3a/rkiq/aec/lib + ln -sf lib64 plugins/3a/rkiq/af/lib + ln -sf lib64 plugins/3a/rkiq/awb/lib + fi +} + +do_compile() { + if echo ${TUNE_FEATURES} | grep -wq arm; then + ARCH=arm + else + ARCH=aarch64 + fi + + sed -i 's/(cmd)/((unsigned long)cmd)/' ${S}/xcore/fake_v4l2_device.h + + oe_runmake ARCH="${ARCH}" \ + TARGET_GCC="${CC} ${CFLAGS} ${LDFLAGS}" \ + TARGET_GPP="${CXX} ${CPPFLAGS} ${LDFLAGS} -Wno-error=cpp" \ + TARGET_LD="${LD} ${LDFLAGS}" TARGET_AR="${AR}" +} + +do_install() { + chrpath -d build/bin/* + + install -d ${D}${bindir} + install -m 0755 build/bin/rkisp_demo ${D}${bindir} + install -m 0755 build/bin/rkisp_3A_server ${D}${bindir} + + install -d ${D}${sysconfdir}/iqfiles + install -m 0644 iqfiles/*.xml ${D}${sysconfdir}/iqfiles/ + + install -d ${D}${libdir} + install -m 0644 build/lib/librkisp.so ${D}${libdir} + + chrpath -d ${D}${libdir}/librkisp.so + + install -d ${D}${libdir}/rkisp/ae + install -m 0644 plugins/3a/rkiq/aec/lib/librkisp_aec.so \ + ${D}${libdir}/rkisp/ae/ + + install -d ${D}${libdir}/rkisp/af + install -m 0644 plugins/3a/rkiq/af/lib/librkisp_af.so \ + ${D}${libdir}/rkisp/af/ + + install -d ${D}${libdir}/rkisp/awb + install -m 0644 plugins/3a/rkiq/awb/lib/librkisp_awb.so \ + ${D}${libdir}/rkisp/awb/ + + chrpath -d ${D}${libdir}/rkisp/*/*.so + + install -d ${D}${includedir}/camera_engine_rkisp/interface + install -m 0644 interface/*.h \ + ${D}${includedir}/camera_engine_rkisp/interface/ + + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/rkisp_daemons.sh ${D}${sysconfdir}/init.d/ +} + +inherit update-rc.d + +INITSCRIPT_PACKAGES = "${PN}-server" +INITSCRIPT_NAME:${PN}-server = "rkisp_daemons.sh" +INITSCRIPT_PARAMS:${PN}-server = "start 70 5 4 3 2 . stop 30 0 1 6 ." + +INSANE_SKIP:${PN} = "already-stripped ldflags" + +FILES:${PN}-dev = "${includedir}" +FILES:${PN}-tests = "${bindir}/rkisp_demo" +FILES:${PN}-server = " \ + ${bindir}/rkisp_3A_server \ + ${sysconfdir}/init.d/ \ +" +FILES:${PN}-iqfiles = "${sysconfdir}/iqfiles/" +FILES:${PN} = "${libdir}" diff --git a/bsp/meta-rockchip/recipes-multimedia/v4l2apps/v4l-rkmpp.bb b/bsp/meta-rockchip/recipes-multimedia/v4l2apps/v4l-rkmpp.bb new file mode 100644 index 0000000000000000000000000000000000000000..9cb9891c1e567ce379cd77b0075ce56c269ff1ba --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/v4l2apps/v4l-rkmpp.bb @@ -0,0 +1,22 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +DESCRIPTION = "A V4L2 plugin that wraps rockchip-mpp for the chromium's V4L2 VDA/VEA" + +SECTION = "libs" + +LICENSE = "LGPL-2.1-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=d749e86a105281d7a44c2328acebc4b0" + +inherit freeze-rev + +SRCREV = "b004755ccd5410f80efe31716abccd105308e226" +SRC_URI = "git://github.com/JeffyCN/libv4l-rkmpp.git;protocol=https;branch=master" + +S = "${WORKDIR}/git" + +DEPENDS = "rockchip-mpp rockchip-librga libv4l" + +inherit meson pkgconfig + +FILES:${PN} = "${libdir}/libv4l/plugins/*.so" diff --git a/bsp/meta-rockchip/recipes-multimedia/v4l2apps/v4l-utils/0001-libv4l2-Support-mmap-to-libv4l-plugin.patch b/bsp/meta-rockchip/recipes-multimedia/v4l2apps/v4l-utils/0001-libv4l2-Support-mmap-to-libv4l-plugin.patch new file mode 100644 index 0000000000000000000000000000000000000000..026ce2740109ce74476aeec1628b4e0f7fac1a9d --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/v4l2apps/v4l-utils/0001-libv4l2-Support-mmap-to-libv4l-plugin.patch @@ -0,0 +1,48 @@ +From 713aa60e33b8ec3ae241b07a76a0db435c6ffe54 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Sun, 28 Apr 2019 15:31:53 +0800 +Subject: [PATCH 1/6] libv4l2: Support mmap() to libv4l-plugin + +Signed-off-by: Jeffy Chen +--- + lib/include/libv4l-plugin.h | 2 ++ + lib/libv4l2/libv4l2.c | 10 ++++++++++ + 2 files changed, 12 insertions(+) + +diff --git a/lib/include/libv4l-plugin.h b/lib/include/libv4l-plugin.h +index 23b2dfb..acb0a54 100644 +--- a/lib/include/libv4l-plugin.h ++++ b/lib/include/libv4l-plugin.h +@@ -32,6 +32,8 @@ struct libv4l_dev_ops { + int (*ioctl)(void *dev_ops_priv, int fd, unsigned long int request, void *arg); + ssize_t (*read)(void *dev_ops_priv, int fd, void *buffer, size_t n); + ssize_t (*write)(void *dev_ops_priv, int fd, const void *buffer, size_t n); ++ void * (*mmap)(void *dev_ops_priv, void *start, size_t length, int prot, ++ int flags, int fd, int64_t offset); + /* For future plugin API extension, plugins implementing the current API + must set these all to NULL, as future versions may check for these */ + void (*reserved1)(void); +diff --git a/lib/libv4l2/libv4l2.c b/lib/libv4l2/libv4l2.c +index 9ebf8c1..0c02bec 100644 +--- a/lib/libv4l2/libv4l2.c ++++ b/lib/libv4l2/libv4l2.c +@@ -1627,6 +1627,16 @@ void *v4l2_mmap(void *start, size_t length, int prot, int flags, int fd, + void *result; + + index = v4l2_get_index(fd); ++ if (index != -1 && devices[index].dev_ops->mmap) { ++ pthread_mutex_lock(&devices[index].stream_lock); ++ result = devices[index].dev_ops->mmap( ++ devices[index].dev_ops_priv, start, ++ length, prot, flags, fd, offset); ++ ++ pthread_mutex_unlock(&devices[index].stream_lock); ++ return result; ++ } ++ + if (index == -1 || + /* Check if the mmap data matches our answer to QUERY_BUF. If it doesn't, + let the kernel handle it (to allow for mmap-based non capture use) */ +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/v4l2apps/v4l-utils/0002-libv4l-mplane-Filter-out-multiplane-formats.patch b/bsp/meta-rockchip/recipes-multimedia/v4l2apps/v4l-utils/0002-libv4l-mplane-Filter-out-multiplane-formats.patch new file mode 100644 index 0000000000000000000000000000000000000000..6950df12b05acf25fc18a4d7188d255284fe472c --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/v4l2apps/v4l-utils/0002-libv4l-mplane-Filter-out-multiplane-formats.patch @@ -0,0 +1,284 @@ +From f024f5bcee3531942c1d0cc306736dff865f4baf Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Fri, 27 Sep 2019 18:52:24 +0800 +Subject: [PATCH 2/6] libv4l: mplane: Filter out multiplane formats + +The multiplane formats are not supported here, reporting them to the +userspace might cause unexpected results. + +Signed-off-by: Jeffy Chen +--- + lib/libv4l-mplane/libv4l-mplane.c | 149 ++++++++++++++++++++++++++++-- + 1 file changed, 141 insertions(+), 8 deletions(-) + +diff --git a/lib/libv4l-mplane/libv4l-mplane.c b/lib/libv4l-mplane/libv4l-mplane.c +index 2f685a7..b30840a 100644 +--- a/lib/libv4l-mplane/libv4l-mplane.c ++++ b/lib/libv4l-mplane/libv4l-mplane.c +@@ -49,6 +49,15 @@ + #define PLUGIN_PUBLIC + #endif + ++#define MPLANE_MAX_FORMATS 32 ++ ++struct mplane_formats { ++ struct v4l2_format formats[MPLANE_MAX_FORMATS]; ++ int index_map[MPLANE_MAX_FORMATS]; ++ unsigned int num_formats; ++ int def_format; ++}; ++ + struct mplane_plugin { + union { + struct { +@@ -57,6 +66,9 @@ struct mplane_plugin { + }; + unsigned int mplane; + }; ++ ++ struct mplane_formats capture_formats; ++ struct mplane_formats output_formats; + }; + + #define SIMPLE_CONVERT_IOCTL(fd, cmd, arg, __struc) ({ \ +@@ -75,6 +87,55 @@ struct mplane_plugin { + __ret; \ + }) + ++/* Setup supported(single plane) formats */ ++static void mplane_setup_formats(int fd, struct mplane_formats *formats, ++ enum v4l2_buf_type type) ++{ ++ int ret, n; ++ ++ formats->num_formats = 0; ++ formats->def_format = -1; ++ ++ for (n = 0; formats->num_formats < MPLANE_MAX_FORMATS; n++) { ++ struct v4l2_fmtdesc fmtdesc = { 0 }; ++ struct v4l2_format format = { 0 }; ++ ++ fmtdesc.type = type; ++ fmtdesc.index = n; ++ ++ ret = SYS_IOCTL(fd, VIDIOC_ENUM_FMT, &fmtdesc); ++ if (ret < 0) ++ break; ++ ++ //TODO: Is there any better way to detect it? ++ ++ format.type = type; ++ format.fmt.pix.pixelformat = fmtdesc.pixelformat; ++ ++ /* Allow error since not all the drivers support try_fmt */ ++ SYS_IOCTL(fd, VIDIOC_TRY_FMT, &format); ++ ++ switch (format.fmt.pix_mp.num_planes) { ++ case 1: ++ if (formats->def_format < 0) ++ formats->def_format = formats->num_formats; ++ ++ /* fall-through */ ++ case 0: ++ /** ++ * Allow 0 planes since not all the drivers would set ++ * num_planes in try_fmt. ++ */ ++ formats->formats[formats->num_formats] = format; ++ formats->index_map[formats->num_formats] = n; ++ formats->num_formats++; ++ break; ++ default: ++ break; ++ } ++ } ++} ++ + static void *plugin_init(int fd) + { + struct v4l2_capability cap; +@@ -92,13 +153,21 @@ static void *plugin_init(int fd) + } + + if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) && +- (cap.capabilities & V4L2_CAP_VIDEO_CAPTURE_MPLANE)) ++ (cap.capabilities & V4L2_CAP_VIDEO_CAPTURE_MPLANE)) { + plugin.mplane_capture = 1; + ++ mplane_setup_formats(fd, &plugin.capture_formats, ++ V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); ++ } ++ + if (!(cap.capabilities & V4L2_CAP_VIDEO_OUTPUT) && +- (cap.capabilities & V4L2_CAP_VIDEO_OUTPUT_MPLANE)) ++ (cap.capabilities & V4L2_CAP_VIDEO_OUTPUT_MPLANE)) { + plugin.mplane_output = 1; + ++ mplane_setup_formats(fd, &plugin.output_formats, ++ V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); ++ } ++ + /* Device doesn't need it. return NULL to disable the plugin */ + if (!plugin.mplane) + return NULL; +@@ -175,6 +244,39 @@ static int convert_type(int type) + } + } + ++static int enum_fmt_ioctl(struct mplane_plugin *plugin, int fd, ++ unsigned long int cmd, ++ struct v4l2_fmtdesc *arg) ++{ ++ struct mplane_formats *formats; ++ int ret, index; ++ ++ switch (arg->type) { ++ case V4L2_BUF_TYPE_VIDEO_CAPTURE: ++ formats = &plugin->capture_formats; ++ break; ++ case V4L2_BUF_TYPE_VIDEO_OUTPUT: ++ formats = &plugin->output_formats; ++ break; ++ case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: ++ case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: ++ errno = EINVAL; ++ return -1; ++ default: ++ return SYS_IOCTL(fd, cmd, arg); ++ } ++ ++ if (arg->index >= formats->num_formats) ++ return -EINVAL; ++ ++ index = arg->index; ++ arg->index = formats->index_map[index]; ++ ret = SIMPLE_CONVERT_IOCTL(fd, cmd, arg, v4l2_fmtdesc); ++ arg->index = index; ++ ++ return ret; ++} ++ + static void sanitize_format(struct v4l2_format *fmt) + { + unsigned int offset; +@@ -201,19 +303,23 @@ static void sanitize_format(struct v4l2_format *fmt) + sizeof(fmt->fmt.pix) - offset); + } + +-static int try_set_fmt_ioctl(int fd, unsigned long int cmd, ++static int try_set_fmt_ioctl(struct mplane_plugin *plugin, int fd, ++ unsigned long int cmd, + struct v4l2_format *arg) + { ++ struct mplane_formats *formats; + struct v4l2_format fmt = { 0 }; + struct v4l2_format *org = arg; +- int ret; ++ int ret, i; + + switch (arg->type) { + case V4L2_BUF_TYPE_VIDEO_CAPTURE: + fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; ++ formats = &plugin->capture_formats; + break; + case V4L2_BUF_TYPE_VIDEO_OUTPUT: + fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; ++ formats = &plugin->output_formats; + break; + case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: + case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: +@@ -223,6 +329,15 @@ static int try_set_fmt_ioctl(int fd, unsigned long int cmd, + return SYS_IOCTL(fd, cmd, arg); + } + ++ /* Filter out unsupported formats */ ++ for (i = 0; i < formats->num_formats; i++) { ++ if (formats->formats[i].fmt.pix_mp.pixelformat == ++ arg->fmt.pix.pixelformat) ++ break; ++ } ++ if (i == formats->num_formats) ++ return -EINVAL; ++ + sanitize_format(org); + + fmt.fmt.pix_mp.width = org->fmt.pix.width; +@@ -254,6 +369,10 @@ static int try_set_fmt_ioctl(int fd, unsigned long int cmd, + org->fmt.pix.sizeimage = fmt.fmt.pix_mp.plane_fmt[0].sizeimage; + org->fmt.pix.flags = fmt.fmt.pix_mp.flags; + ++ /* Now we can use the driver's default format */ ++ if (cmd == VIDIOC_S_FMT) ++ formats->def_format = -1; ++ + return 0; + } + +@@ -316,8 +435,10 @@ static int create_bufs_ioctl(int fd, unsigned long int cmd, + return ret; + } + +-static int get_fmt_ioctl(int fd, unsigned long int cmd, struct v4l2_format *arg) ++static int get_fmt_ioctl(struct mplane_plugin *plugin, int fd, ++ unsigned long int cmd, struct v4l2_format *arg) + { ++ struct mplane_formats *formats; + struct v4l2_format fmt = { 0 }; + struct v4l2_format *org = arg; + int ret; +@@ -325,9 +446,11 @@ static int get_fmt_ioctl(int fd, unsigned long int cmd, struct v4l2_format *arg) + switch (arg->type) { + case V4L2_BUF_TYPE_VIDEO_CAPTURE: + fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; ++ formats = &plugin->capture_formats; + break; + case V4L2_BUF_TYPE_VIDEO_OUTPUT: + fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; ++ formats = &plugin->output_formats; + break; + case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: + case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: +@@ -337,10 +460,18 @@ static int get_fmt_ioctl(int fd, unsigned long int cmd, struct v4l2_format *arg) + return SYS_IOCTL(fd, cmd, arg); + } + ++ /* Use default format */ ++ if (formats->def_format >= 0 && ++ formats->def_format < formats->num_formats) { ++ fmt = formats->formats[formats->def_format]; ++ goto out; ++ } ++ + ret = SYS_IOCTL(fd, cmd, &fmt); + if (ret) + return ret; + ++out: + memset(&org->fmt.pix, 0, sizeof(org->fmt.pix)); + org->fmt.pix.width = fmt.fmt.pix_mp.width; + org->fmt.pix.height = fmt.fmt.pix_mp.height; +@@ -411,16 +542,18 @@ static int buf_ioctl(int fd, unsigned long int cmd, struct v4l2_buffer *arg) + static int plugin_ioctl(void *dev_ops_priv, int fd, + unsigned long int cmd, void *arg) + { ++ struct mplane_plugin *plugin = dev_ops_priv; ++ + switch (cmd) { + case VIDIOC_QUERYCAP: + return querycap_ioctl(fd, cmd, arg); + case VIDIOC_TRY_FMT: + case VIDIOC_S_FMT: +- return try_set_fmt_ioctl(fd, cmd, arg); ++ return try_set_fmt_ioctl(plugin, fd, cmd, arg); + case VIDIOC_G_FMT: +- return get_fmt_ioctl(fd, cmd, arg); ++ return get_fmt_ioctl(plugin, fd, cmd, arg); + case VIDIOC_ENUM_FMT: +- return SIMPLE_CONVERT_IOCTL(fd, cmd, arg, v4l2_fmtdesc); ++ return enum_fmt_ioctl(plugin, fd, cmd, arg); + case VIDIOC_S_PARM: + case VIDIOC_G_PARM: + return SIMPLE_CONVERT_IOCTL(fd, cmd, arg, v4l2_streamparm); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/v4l2apps/v4l-utils/0003-libv4l-Support-V4L2_MEMORY_DMABUF.patch b/bsp/meta-rockchip/recipes-multimedia/v4l2apps/v4l-utils/0003-libv4l-Support-V4L2_MEMORY_DMABUF.patch new file mode 100644 index 0000000000000000000000000000000000000000..13bfadcf9307da0c5b4567d0479670b77b4cb3c6 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/v4l2apps/v4l-utils/0003-libv4l-Support-V4L2_MEMORY_DMABUF.patch @@ -0,0 +1,94 @@ +From 57fb6af4ea3ed3b21511dca0c443721ee7a67ba3 Mon Sep 17 00:00:00 2001 +From: "vicent.chi" +Date: Thu, 31 Oct 2019 11:46:12 +0800 +Subject: [PATCH 3/6] libv4l: Support V4L2_MEMORY_DMABUF + +Signed-off-by: vicent.chi +Signed-off-by: Jeffy Chen +--- + lib/libv4l2/libv4l2-priv.h | 1 + + lib/libv4l2/libv4l2.c | 23 +++++++++++++++++++++-- + 2 files changed, 22 insertions(+), 2 deletions(-) + +diff --git a/lib/libv4l2/libv4l2-priv.h b/lib/libv4l2/libv4l2-priv.h +index 1924c91..30dd1bc 100644 +--- a/lib/libv4l2/libv4l2-priv.h ++++ b/lib/libv4l2/libv4l2-priv.h +@@ -104,6 +104,7 @@ struct v4l2_dev_info { + void *plugin_library; + void *dev_ops_priv; + const struct libv4l_dev_ops *dev_ops; ++ int has_dmabuf_memory; + }; + + /* From v4l2-plugin.c */ +diff --git a/lib/libv4l2/libv4l2.c b/lib/libv4l2/libv4l2.c +index 0c02bec..efc9465 100644 +--- a/lib/libv4l2/libv4l2.c ++++ b/lib/libv4l2/libv4l2.c +@@ -543,7 +543,7 @@ static int v4l2_deactivate_read_stream(int index) + + static int v4l2_needs_conversion(int index) + { +- if (devices[index].convert == NULL) ++ if (devices[index].convert == NULL || devices[index].has_dmabuf_memory) + return 0; + + return v4lconvert_needs_conversion(devices[index].convert, +@@ -1305,12 +1305,18 @@ no_capture_request: + struct v4l2_requestbuffers *req = arg; + + /* IMPROVEME (maybe?) add support for userptr's? */ +- if (req->memory != V4L2_MEMORY_MMAP) { ++ if (req->memory != V4L2_MEMORY_MMAP && req->memory != V4L2_MEMORY_DMABUF) { + errno = EINVAL; + result = -1; + break; + } + ++ if (req->memory == V4L2_MEMORY_DMABUF) { ++ devices[index].has_dmabuf_memory = 1; ++ V4L2_LOG("memory type is V4L2_MEMORY_DMABUF, " ++ "buf conversion and mmap emulation are disabled\n"); ++ } ++ + result = v4l2_check_buffer_change_ok(index); + if (result) + break; +@@ -1563,6 +1569,14 @@ ssize_t v4l2_read(int fd, void *dest, size_t n) + goto leave; + } + ++ if (!(devices[index].flags & V4L2_USE_READ_FOR_READ) && ++ devices[index].has_dmabuf_memory) { ++ V4L2_PERROR("memory type is V4L2_MEMORY_DMABUF, " ++ "no support v4l2 read\n"); ++ errno = EINVAL; ++ return -1; ++ } ++ + /* Since we need to do conversion try to use mmap (streaming) mode under + the hood as that safes a memcpy for each frame read. + +@@ -1627,6 +1641,7 @@ void *v4l2_mmap(void *start, size_t length, int prot, int flags, int fd, + void *result; + + index = v4l2_get_index(fd); ++ + if (index != -1 && devices[index].dev_ops->mmap) { + pthread_mutex_lock(&devices[index].stream_lock); + result = devices[index].dev_ops->mmap( +@@ -1637,6 +1652,10 @@ void *v4l2_mmap(void *start, size_t length, int prot, int flags, int fd, + return result; + } + ++ if (index != -1 && devices[index].has_dmabuf_memory) { ++ return (void *)SYS_MMAP(start, length, prot, flags, fd, offset); ++ } ++ + if (index == -1 || + /* Check if the mmap data matches our answer to QUERY_BUF. If it doesn't, + let the kernel handle it (to allow for mmap-based non capture use) */ +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/v4l2apps/v4l-utils/0004-libv4l-mplane-Support-VIDIOC_EXPBUF-for-dmabuf.patch b/bsp/meta-rockchip/recipes-multimedia/v4l2apps/v4l-utils/0004-libv4l-mplane-Support-VIDIOC_EXPBUF-for-dmabuf.patch new file mode 100644 index 0000000000000000000000000000000000000000..db1c01c5e2ead912e04c70d2713050256bd3f50f --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/v4l2apps/v4l-utils/0004-libv4l-mplane-Support-VIDIOC_EXPBUF-for-dmabuf.patch @@ -0,0 +1,46 @@ +From bd05429590bddfdea0f079c2990e0df30cbc5e46 Mon Sep 17 00:00:00 2001 +From: "vicent.chi" +Date: Sat, 28 Mar 2020 18:03:57 +0800 +Subject: [PATCH 4/6] libv4l: mplane: Support VIDIOC_EXPBUF for dmabuf + +Signed-off-by: vicent.chi +Signed-off-by: Jeffy Chen +--- + lib/libv4l-mplane/libv4l-mplane.c | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/lib/libv4l-mplane/libv4l-mplane.c b/lib/libv4l-mplane/libv4l-mplane.c +index b30840a..db22b0b 100644 +--- a/lib/libv4l-mplane/libv4l-mplane.c ++++ b/lib/libv4l-mplane/libv4l-mplane.c +@@ -539,6 +539,17 @@ static int buf_ioctl(int fd, unsigned long int cmd, struct v4l2_buffer *arg) + return ret; + } + ++static int exbuf_ioctl(int fd, unsigned long int cmd, struct v4l2_exportbuffer *arg) ++{ ++ if (arg->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE || ++ arg->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { ++ errno = EINVAL; ++ return -1; ++ } ++ arg->type = convert_type(arg->type); ++ return SYS_IOCTL(fd, cmd, arg); ++} ++ + static int plugin_ioctl(void *dev_ops_priv, int fd, + unsigned long int cmd, void *arg) + { +@@ -580,7 +591,8 @@ static int plugin_ioctl(void *dev_ops_priv, int fd, + + return SYS_IOCTL(fd, cmd, &type); + } +- /* CASE VIDIOC_EXPBUF: */ ++ case VIDIOC_EXPBUF: ++ return exbuf_ioctl(fd, cmd, arg); + default: + return SYS_IOCTL(fd, cmd, arg); + } +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/v4l2apps/v4l-utils/0005-Support-builtin-v4l-plugins.patch b/bsp/meta-rockchip/recipes-multimedia/v4l2apps/v4l-utils/0005-Support-builtin-v4l-plugins.patch new file mode 100644 index 0000000000000000000000000000000000000000..b2dc9518dc3a0eb5eeb9cb2be99f3ec53a2a9750 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/v4l2apps/v4l-utils/0005-Support-builtin-v4l-plugins.patch @@ -0,0 +1,286 @@ +From 920f7b2d59d74f946439d2dc9955557c051d3bff Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Tue, 14 Dec 2021 17:09:52 +0800 +Subject: [PATCH 5/6] Support builtin v4l plugins + +Use --enable-builtin-plugins to enable it. + +Only support mplane plugin for now. + +Signed-off-by: Jeffy Chen +--- + configure.ac | 13 ++++++ + lib/Makefile.am | 4 +- + lib/libv4l-mplane/Makefile.am | 9 ++++ + lib/libv4l-mplane/libv4l-mplane.c | 4 ++ + lib/libv4l2/Makefile.am | 3 ++ + lib/libv4l2/libv4l2-priv.h | 16 +++---- + lib/libv4l2/libv4l2.c | 73 +++++++++++++++++++++++++++++++ + lib/libv4l2/v4l2-plugin.c | 8 ++-- + 8 files changed, 116 insertions(+), 14 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 98bbbeb..7bfc393 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -539,6 +539,14 @@ AC_ARG_ENABLE(bpf, + esac] + ) + ++AC_ARG_ENABLE(builtin-plugins, ++ AS_HELP_STRING([--enable-builtin-plugins], [enable builtin libv4l plugins]), ++ [case "${enableval}" in ++ yes | no ) ;; ++ *) AC_MSG_ERROR(bad value ${enableval} for --enable-builtin-plugins) ;; ++ esac] ++) ++ + PKG_CHECK_MODULES([SDL2], [sdl2 SDL2_image], [sdl_pc=yes], [sdl_pc=no]) + AM_CONDITIONAL([HAVE_SDL], [test x$sdl_pc = xyes]) + +@@ -555,6 +563,7 @@ AM_CONDITIONAL([WITH_V4LUTILS], [test x$enable_v4l_utils != xno -a x$linux_o + AM_CONDITIONAL([WITH_QV4L2], [test x${qt_pkgconfig} = xtrue -a x$enable_qv4l2 != xno]) + AM_CONDITIONAL([WITH_QVIDCAP], [test x${qt_desktop_opengl} = xyes -a x$enable_qvidcap != xno]) + AM_CONDITIONAL([WITH_V4L_PLUGINS], [test x$enable_dyn_libv4l != xno -a x$enable_shared != xno]) ++AM_CONDITIONAL([WITH_V4L_BUILTIN_PLUGINS], [test x$enable_builtin_plugins = xyes]) + AM_CONDITIONAL([WITH_V4L_WRAPPERS], [test x$enable_dyn_libv4l != xno -a x$enable_shared != xno]) + AM_CONDITIONAL([WITH_QTGL], [test x${qt_desktop_opengl} = xyes]) + AM_CONDITIONAL([WITH_GCONV], [test x$enable_gconv = xyes -a x$enable_shared = xyes -a x$with_gconvdir != x -a -f $with_gconvdir/gconv-modules]) +@@ -607,6 +616,9 @@ AM_COND_IF([WITH_QVIDCAP], [USE_QVIDCAP="yes"], [USE_QVIDCAP="no"]) + AM_COND_IF([WITH_V4L_PLUGINS], [USE_V4L_PLUGINS="yes" + AC_DEFINE([HAVE_V4L_PLUGINS], [1], [V4L plugin support enabled])], + [USE_V4L_PLUGINS="no"]) ++AM_COND_IF([WITH_V4L_BUILTIN_PLUGINS], [USE_V4L_BUILTIN_PLUGINS="yes" ++ AC_DEFINE([HAVE_V4L_BUILTIN_PLUGINS], [1], [V4L builtin plugin support enabled])], ++ [USE_V4L_BUILTIN_PLUGINS="no"]) + AM_COND_IF([WITH_V4L_WRAPPERS], [USE_V4L_WRAPPERS="yes"], [USE_V4L_WRAPPERS="no"]) + AM_COND_IF([WITH_GCONV], [USE_GCONV="yes"], [USE_GCONV="no"]) + AM_COND_IF([WITH_V4L2_CTL_LIBV4L], [USE_V4L2_CTL_LIBV4L="yes"], [USE_V4L2_CTL_LIBV4L="no"]) +@@ -653,6 +665,7 @@ compile time options summary + + dynamic libv4l : $USE_DYN_LIBV4L + v4l_plugins : $USE_V4L_PLUGINS ++ v4l_builtin_plugins : $USE_V4L_BUILTIN_PLUGINS + v4l_wrappers : $USE_V4L_WRAPPERS + libdvbv5 : $USE_LIBDVBV5 + dvbv5-daemon : $USE_DVBV5_REMOTE +diff --git a/lib/Makefile.am b/lib/Makefile.am +index a105c95..4952d6d 100644 +--- a/lib/Makefile.am ++++ b/lib/Makefile.am +@@ -1,9 +1,9 @@ + SUBDIRS = \ ++ libv4l-mplane \ + libv4lconvert \ + libv4l2 \ + libv4l1 \ +- libv4l2rds \ +- libv4l-mplane ++ libv4l2rds + + if WITH_LIBDVBV5 + SUBDIRS += \ +diff --git a/lib/libv4l-mplane/Makefile.am b/lib/libv4l-mplane/Makefile.am +index 5264ecf..4c0ba0a 100644 +--- a/lib/libv4l-mplane/Makefile.am ++++ b/lib/libv4l-mplane/Makefile.am +@@ -1,7 +1,16 @@ ++if WITH_V4L_BUILTIN_PLUGINS ++noinst_LTLIBRARIES = libv4l-mplane.la ++else + if WITH_V4L_PLUGINS + libv4l2plugin_LTLIBRARIES = libv4l-mplane.la + endif ++endif + + libv4l_mplane_la_SOURCES = libv4l-mplane.c ++if WITH_V4L_BUILTIN_PLUGINS ++libv4l_mplane_la_CPPFLAGS = -static ++libv4l_mplane_la_LDFLAGS = -static ++else + libv4l_mplane_la_CPPFLAGS = $(CFLAG_VISIBILITY) + libv4l_mplane_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -lpthread ++endif +diff --git a/lib/libv4l-mplane/libv4l-mplane.c b/lib/libv4l-mplane/libv4l-mplane.c +index db22b0b..fcd522e 100644 +--- a/lib/libv4l-mplane/libv4l-mplane.c ++++ b/lib/libv4l-mplane/libv4l-mplane.c +@@ -609,7 +609,11 @@ static ssize_t plugin_write(void *dev_ops_priv, int fd, const void *buf, + return SYS_WRITE(fd, buf, len); + } + ++#ifdef HAVE_V4L_BUILTIN_PLUGINS ++const struct libv4l_dev_ops libv4l2_plugin_mplane = { ++#else + PLUGIN_PUBLIC const struct libv4l_dev_ops libv4l2_plugin = { ++#endif + .init = &plugin_init, + .close = &plugin_close, + .ioctl = &plugin_ioctl, +diff --git a/lib/libv4l2/Makefile.am b/lib/libv4l2/Makefile.am +index 3a1bb90..1250d84 100644 +--- a/lib/libv4l2/Makefile.am ++++ b/lib/libv4l2/Makefile.am +@@ -23,6 +23,9 @@ endif + libv4l2_la_CPPFLAGS = $(CFLAG_VISIBILITY) $(ENFORCE_LIBV4L_STATIC) + libv4l2_la_LDFLAGS = $(LIBV4L2_VERSION) -lpthread $(DLOPEN_LIBS) $(ENFORCE_LIBV4L_STATIC) + libv4l2_la_LIBADD = ../libv4lconvert/libv4lconvert.la ++if WITH_V4L_BUILTIN_PLUGINS ++libv4l2_la_LIBADD += ../libv4l-mplane/libv4l-mplane.la ++endif + + v4l2convert_la_SOURCES = v4l2convert.c + v4l2convert_la_LIBADD = libv4l2.la +diff --git a/lib/libv4l2/libv4l2-priv.h b/lib/libv4l2/libv4l2-priv.h +index 30dd1bc..3bdb8fd 100644 +--- a/lib/libv4l2/libv4l2-priv.h ++++ b/lib/libv4l2/libv4l2-priv.h +@@ -109,20 +109,20 @@ struct v4l2_dev_info { + + /* From v4l2-plugin.c */ + #if defined(HAVE_V4L_PLUGINS) +-void v4l2_plugin_init(int fd, void **plugin_lib_ret, void **plugin_priv_ret, +- const struct libv4l_dev_ops **dev_ops_ret); +-void v4l2_plugin_cleanup(void *plugin_lib, void *plugin_priv, +- const struct libv4l_dev_ops *dev_ops); ++void v4l2_dyn_plugin_init(int fd, void **plugin_lib_ret, void **plugin_priv_ret, ++ const struct libv4l_dev_ops **dev_ops_ret); ++void v4l2_dyn_plugin_cleanup(void *plugin_lib, void *plugin_priv, ++ const struct libv4l_dev_ops *dev_ops); + #else +-static inline void v4l2_plugin_init(int fd, void **plugin_lib_ret, void **plugin_priv_ret, +- const struct libv4l_dev_ops **dev_ops_ret) ++static inline void v4l2_dyn_plugin_init(int fd, void **plugin_lib_ret, void **plugin_priv_ret, ++ const struct libv4l_dev_ops **dev_ops_ret) + { + *dev_ops_ret = v4lconvert_get_default_dev_ops(); + *plugin_lib_ret = NULL; + *plugin_priv_ret = NULL; + } +-static inline void v4l2_plugin_cleanup(void *plugin_lib, void *plugin_priv, +- const struct libv4l_dev_ops *dev_ops) ++static inline void v4l2_dyn_plugin_cleanup(void *plugin_lib, void *plugin_priv, ++ const struct libv4l_dev_ops *dev_ops) + { + } + #endif /* WITH_V4L_PLUGINS */ +diff --git a/lib/libv4l2/libv4l2.c b/lib/libv4l2/libv4l2.c +index efc9465..11d2ae1 100644 +--- a/lib/libv4l2/libv4l2.c ++++ b/lib/libv4l2/libv4l2.c +@@ -74,6 +74,8 @@ + #include "libv4l2-priv.h" + #include "libv4l-plugin.h" + ++#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) ++ + /* Note these flags are stored together with the flags passed to v4l2_fd_open() + in v4l2_dev_info's flags member, so care should be taken that the do not + use the same bits! */ +@@ -618,6 +620,77 @@ static void v4l2_update_fps(int index, struct v4l2_streamparm *parm) + devices[index].fps = 0; + } + ++#ifdef HAVE_V4L_BUILTIN_PLUGINS ++extern const struct libv4l_dev_ops libv4l2_plugin_mplane; ++ ++void v4l2_builtin_plugin_init(int fd, void **plugin_priv_ret, ++ const struct libv4l_dev_ops **dev_ops_ret) ++{ ++ const struct libv4l_dev_ops *builtin_plugins[] = { ++ &libv4l2_plugin_mplane, ++ }; ++ const struct libv4l_dev_ops *libv4l2_plugin = NULL; ++ int i; ++ ++ *dev_ops_ret = NULL; ++ *plugin_priv_ret = NULL; ++ ++ for (i = 0; i < ARRAY_SIZE(builtin_plugins); i++) { ++ V4L2_LOG("PLUGIN: try builtin(%d);\n", i); ++ ++ libv4l2_plugin = builtin_plugins[i]; ++ ++ if (!libv4l2_plugin->init || ++ !libv4l2_plugin->close || ++ !libv4l2_plugin->ioctl) { ++ V4L2_LOG("PLUGIN: does not have all mandatory ops\n"); ++ continue; ++ } ++ ++ *plugin_priv_ret = libv4l2_plugin->init(fd); ++ if (!*plugin_priv_ret) { ++ V4L2_LOG("PLUGIN: plugin init() returned NULL\n"); ++ continue; ++ } ++ ++ *dev_ops_ret = libv4l2_plugin; ++ break; ++ } ++} ++ ++void v4l2_builtin_plugin_cleanup(void *plugin_priv, ++ const struct libv4l_dev_ops *dev_ops) ++{ ++ dev_ops->close(plugin_priv); ++} ++#endif /* HAVE_V4L_PLUGINS */ ++ ++void v4l2_plugin_init(int fd, void **plugin_lib_ret, void **plugin_priv_ret, ++ const struct libv4l_dev_ops **dev_ops_ret) ++{ ++#ifdef HAVE_V4L_BUILTIN_PLUGINS ++ *plugin_lib_ret = NULL; ++ v4l2_builtin_plugin_init(fd, plugin_priv_ret, dev_ops_ret); ++ if (*dev_ops_ret) ++ return; ++#endif ++ ++ v4l2_dyn_plugin_init(fd, plugin_lib_ret, plugin_priv_ret, dev_ops_ret); ++} ++ ++void v4l2_plugin_cleanup(void *plugin_lib, void *plugin_priv, ++ const struct libv4l_dev_ops *dev_ops) ++{ ++#ifdef HAVE_V4L_BUILTIN_PLUGINS ++ if (!plugin_lib) { ++ v4l2_builtin_plugin_cleanup(plugin_priv, dev_ops); ++ return; ++ } ++#endif ++ ++ v4l2_dyn_plugin_cleanup(plugin_lib, plugin_priv, dev_ops); ++} ++ + int v4l2_open(const char *file, int oflag, ...) + { + int fd; +diff --git a/lib/libv4l2/v4l2-plugin.c b/lib/libv4l2/v4l2-plugin.c +index ff42eed..f65baaa 100644 +--- a/lib/libv4l2/v4l2-plugin.c ++++ b/lib/libv4l2/v4l2-plugin.c +@@ -48,8 +48,8 @@ + + #define PLUGINS_PATTERN LIBV4L2_PLUGIN_DIR "/*.so" + +-void v4l2_plugin_init(int fd, void **plugin_lib_ret, void **plugin_priv_ret, +- const struct libv4l_dev_ops **dev_ops_ret) ++void v4l2_dyn_plugin_init(int fd, void **plugin_lib_ret, void **plugin_priv_ret, ++ const struct libv4l_dev_ops **dev_ops_ret) + { + char *error; + int glob_ret, i; +@@ -110,8 +110,8 @@ leave: + globfree(&globbuf); + } + +-void v4l2_plugin_cleanup(void *plugin_lib, void *plugin_priv, +- const struct libv4l_dev_ops *dev_ops) ++void v4l2_dyn_plugin_cleanup(void *plugin_lib, void *plugin_priv, ++ const struct libv4l_dev_ops *dev_ops) + { + if (plugin_lib) { + dev_ops->close(plugin_priv); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/v4l2apps/v4l-utils/0006-libv4l-Disallow-conversion-by-default.patch b/bsp/meta-rockchip/recipes-multimedia/v4l2apps/v4l-utils/0006-libv4l-Disallow-conversion-by-default.patch new file mode 100644 index 0000000000000000000000000000000000000000..5680dfb90d1e12f4891dbf6e852ff54ccda3d796 --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/v4l2apps/v4l-utils/0006-libv4l-Disallow-conversion-by-default.patch @@ -0,0 +1,31 @@ +From bf1b82deb438e386808e1cde3ee6f3da0a304402 Mon Sep 17 00:00:00 2001 +From: Jeffy Chen +Date: Thu, 12 May 2022 15:54:25 +0800 +Subject: [PATCH 6/6] libv4l: Disallow conversion by default + +The conversion is slow, let's disable it by default. + +Set env "V4L2_DISABLE_CONVERSION" to enable it. + +Signed-off-by: Jeffy Chen +--- + lib/libv4l2/libv4l2.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/lib/libv4l2/libv4l2.c b/lib/libv4l2/libv4l2.c +index 11d2ae1..d9edec1 100644 +--- a/lib/libv4l2/libv4l2.c ++++ b/lib/libv4l2/libv4l2.c +@@ -789,6 +789,9 @@ int v4l2_fd_open(int fd, int v4l2_flags) + if (dev_ops->ioctl(dev_ops_priv, fd, VIDIOC_G_PARM, &parm)) + parm.type = 0; + ++ if (!getenv("LIBV4L2_ALLOW_CONVERSION")) ++ v4l2_flags |= V4L2_DISABLE_CONVERSION; ++ + /* init libv4lconvert */ + if (!(v4l2_flags & V4L2_DISABLE_CONVERSION)) { + convert = v4lconvert_create_with_dev_ops(fd, dev_ops_priv, dev_ops); +-- +2.20.1 + diff --git a/bsp/meta-rockchip/recipes-multimedia/v4l2apps/v4l-utils_%.bbappend b/bsp/meta-rockchip/recipes-multimedia/v4l2apps/v4l-utils_%.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..c95f52faaff3e4df1d62cf9e5e4c80460acb761c --- /dev/null +++ b/bsp/meta-rockchip/recipes-multimedia/v4l2apps/v4l-utils_%.bbappend @@ -0,0 +1,11 @@ +# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) + +PATCHPATH = "${CURDIR}/${BPN}" + +inherit auto-patch + +INSANE_SKIP:libv4l:append = " dev-so" + +# The chromium will dlopen it +FILES:libv4l:append = " ${libdir}/libv4l2.so" diff --git a/bsp/meta-rockchip/wic/generic-gptdisk.wks.in b/bsp/meta-rockchip/wic/generic-gptdisk.wks.in new file mode 100644 index 0000000000000000000000000000000000000000..7278ac443f9a727cb3af5ea5503d4930b6125e2b --- /dev/null +++ b/bsp/meta-rockchip/wic/generic-gptdisk.wks.in @@ -0,0 +1,12 @@ +# Copyright (c) 2019, Fuzhou Rockchip Electronics Co., Ltd +# Released under the MIT license (see COPYING.MIT for the terms) +# +# long-description: Creates a GPT disk image for Rockchip boards + +# 0~32K: gpt +bootloader --ptable gpt +part --source rawcopy --sourceparams="file=idblock.img" --align 32 --no-table +part --source rawcopy --sourceparams="file=uboot.img" --part-name uboot --align 8192 +part --source rawcopy --sourceparams="file=trust.img" --part-name trust +part --source rawcopy --sourceparams="file=boot.img" --part-name boot +part / --source rootfs --fstype ${RK_ROOTFS_TYPE} --part-name rootfs --uuid ${RK_ROOTDEV_UUID} --align 8192