├── .gitignore ├── LICENSE ├── README.md ├── aosptree └── vendor │ └── devices-community │ └── gd_rpi4 │ ├── AndroidProducts.mk │ ├── BoardConfig.mk │ ├── boot │ └── config.txt │ ├── codecs │ └── request_api_headers_v4 │ │ ├── libdrm │ │ └── drm_fourcc.h │ │ └── linux │ │ ├── media.h │ │ ├── v4l2-common.h │ │ ├── v4l2-controls.h │ │ └── videodev2.h │ ├── device.mk │ ├── etc │ ├── audio.rpi4.xml │ ├── audio.rpi400.xml │ ├── modules.blocklist │ ├── other.rpi4.rc │ ├── power.rpi4.rc │ ├── snd.rpi4.rc │ └── uevent.device.rc │ ├── firmware │ ├── BCM4345C0.hcd │ ├── BCM4345C5.hcd │ ├── LICENCE.broadcom_bcm43xx │ ├── brcmfmac43455-sdio.bin │ ├── brcmfmac43455-sdio.clm_blob │ ├── brcmfmac43455-sdio.txt │ ├── brcmfmac43456-sdio.bin │ ├── brcmfmac43456-sdio.clm_blob │ └── brcmfmac43456-sdio.txt │ ├── gd_rpi4.mk │ └── kernel.config ├── build.sh ├── device ├── glodroid ├── manifests ├── default_aosp.xml ├── default_lineage.xml ├── glodroid.xml ├── lineage-static.xml └── update_lineage_manifest.sh ├── out ├── patches-aosp ├── external │ ├── libcxx │ │ └── 0001-Update-include-chrono-to-fix-LLVM-bug-41430.patch │ ├── lzma │ │ └── 0001-Remove-Android.bp-march-hacks.patch │ ├── tinycompress │ │ └── 0001-WIP-Don-t-include-kernel-headers.patch │ ├── v4l2_codec2 │ │ ├── 0001-v4l2_codec2-Remove-multilib-support.patch │ │ ├── 0002-v4l2_codec2-Make-the-project-directory-independent.patch │ │ ├── 0003-plugin_store-Mark-libc2plugin_store-library-as-vendo.patch │ │ ├── 0004-GLODROID-Disable-seccomp.patch │ │ ├── 0005-Rename-HAL-instance-from-default-to-v4l2.patch │ │ ├── 0006-EncoderInterface-Set-both-input-and-output-usage-to-.patch │ │ ├── 0007-v4l2_codec2-Increase-maximum-frame-rate-to-60FPS.patch │ │ ├── 0008-HACK-v4l2_codec2-Allow-format-converter-initializati.patch │ │ ├── 0009-v4l2_codec2-encoder-Don-t-advertise-BITRATE_CONST.patch │ │ ├── 0010-RPI4-v4l2_codec2-encoder-Set-input-format-after-1st-.patch │ │ ├── 0011-RPI4-v4l2_codec2-decoder-Enable-zero-copy-AVC-decodi.patch │ │ └── 0012-Explicitly-specify-base.patch │ └── wpa_supplicant_8 │ │ ├── 0001-Add-netlink-public-header-library.patch │ │ ├── 0002-Decalre-a-soong-module-for-hostapd-manifest.patch │ │ ├── 0003-Remove-a-host-of-incorrect-OPENSSL_IS_BORINGSSL-ifde.patch │ │ ├── 0004-Convert-wpa_supplicant-to-soong-for-cuttlefish.patch │ │ └── 0005-Convert-hostapd-to-soong.patch ├── glodroid │ ├── bootloader │ │ └── u-boot │ │ │ ├── 0001-GLODROID-Reduce-boot-delay-countdown-timer-from-1S-t.patch │ │ │ ├── 0002-abootcmd-Add-load-subcommand.patch │ │ │ ├── 0003-avb-Implement-get_preloaded_partition-callback.patch │ │ │ ├── 0004-abootimg-Implement-smart-image-load-feature.patch │ │ │ └── 0005-Revert-boot-android-Provide-vendor_bootimg_addr-in-b.patch │ ├── configuration │ │ ├── 0001-RPI4-High-performance-screen-capture.patch │ │ ├── 0002-Disable-AVB.patch │ │ ├── 0003-bootscript-Disable-uart-logging.patch │ │ ├── 0004-bootscript-Add-a-hack-to-prevent-the-crash.patch │ │ ├── 0005-kernel-Fix-compilation-errors-on-some-Linux-distribu.patch │ │ ├── 0006-graphics-drm_hwcomposer-Transition-from-HWC2-to-HWC3.patch │ │ ├── 0007-common-Change-fstab-target-name.patch │ │ ├── 0008-common-init-Remove-duplicate-vold-start-command.patch │ │ ├── 0009-common-kconfig-Enable-CONFIG_FUSE_BPF.patch │ │ ├── 0010-common-graphics-Add-dri_gbm-shared-library.patch │ │ ├── 0011-bootscript-Account-for-ab_select-command-u-boot-chan.patch │ │ ├── 0012-common-Remove-libdav1d.patch │ │ ├── 0013-Revert-base-Set-TARGET_FLATTEN_APEX-to-true.patch │ │ ├── 0014-Revert-base-Don-t-use-updatable-apexes.patch │ │ ├── 0015-common-Set-BUILD_BROKEN_INCORRECT_PARTITION_IMAGES.patch │ │ ├── 0016-common-Add-bootcrtl-apex.patch │ │ ├── 0017-common-Switch-Bluetooth-HAL-to-AIDL-default.patch │ │ ├── 0018-kconfig-Set-localversion-config-to-android15-0.patch │ │ ├── 0019-common-graphics-Remove-legacy-mapper4-in-a-favour-of.patch │ │ ├── 0020-Move-v4l2_codec2-back-to-external-directory.patch │ │ └── 0021-kernel-Avoid-cleaning-the-modules.blocklist-file.patch │ └── vendor │ │ ├── drm_hwcomposer │ │ └── 0001-Exclude-Android.bps-by-adding-the-underscore-suffix.patch │ │ ├── ffmpeg │ │ ├── 0001-Add-pi-configs-and-scripts.patch │ │ ├── 0002-Add-sand-pix-fmts-conversion-fns.patch │ │ ├── 0003-Add-aarch64-asm-sand-conv-functions.patch │ │ ├── 0004-Deal-with-the-lack-of-trivial-sand-cropping.patch │ │ ├── 0005-Add-an-unsand-filter.patch │ │ ├── 0006-checkasm-Add-tests-for-rpi_sand-sand30-fns.patch │ │ ├── 0007-Reduce-mmal-compile-warnings.patch │ │ ├── 0008-Add-chroma-location-to-hevc-parse.patch │ │ ├── 0009-hwaccel-Add-.abort_frame-use-in-hevcdec.patch │ │ ├── 0010-Weak-link-utils.patch │ │ ├── 0011-Add-v4l2_req-V4L2-request-H265-drm_prime-decode.patch │ │ ├── 0012-Add-no_cvt_hw-option-to-ffmpeg.patch │ │ ├── 0013-Add-vout_drm.patch │ │ ├── 0014-Add-vout_egl.patch │ │ ├── 0015-V4L2-stateful-rework.patch │ │ ├── 0016-Add-V4L2-M2M-deinterlace-scale-filters.patch │ │ ├── 0017-Fix-crash-in-hw_device_default_name-if-type-not-foun.patch │ │ ├── 0018-Fix-raw-video-s.t.-it-respects-any-remaining-croppin.patch │ │ ├── 0019-hwcontext_drm-Add-sand-conversions.patch │ │ ├── 0020-matroskaenc-Allow-H264-SPS-PPS-headers-in-packet-sid.patch │ │ ├── 0021-hevcdec-Avoid-allocating-or-using-s-w-only-arrays-if.patch │ │ ├── 0022-movenc-Allow-H264-SPS-PPS-headers-in-packet-sidedata.patch │ │ ├── 0023-rtpenc-Allow-H264-SPS-PPS-headers-in-packet-sidedata.patch │ │ ├── 0024-Initial-buffersink-alloc-callback-code.patch │ │ ├── 0025-vulkan-Add-missing-decode-extension-defines.patch │ │ ├── 0026-swcale-Add-explicit-bgr24-yv12-conversions.patch │ │ ├── 0027-tests-swscale-Add-options-for-width-and-height-on-th.patch │ │ ├── 0028-tests-swscale-Add-a-timing-option.patch │ │ ├── 0029-vf_bwdif-Add-ability-to-deinterlace-NV12.patch │ │ ├── 0030-fate-Fix-tests-broken-by-addition-of-sand-formats.patch │ │ ├── 0031-checkasm-Allow-rpi_sand-test-to-build-and-pass-on-no.patch │ │ ├── 0032-pi-util-ffconf-Rework-to-have-clearer-h-w-or-s-w-tes.patch │ │ ├── 0033-rpi_sand-Fix-includes-copyright-for-fate.patch │ │ ├── 0034-weak_link-Fix-includes-copyright-for-fate.patch │ │ ├── 0035-v4l2_req-Fix-includes-copyright-for-fate.patch │ │ ├── 0036-fate-source-Add-old-hevc-headers-to-copyright-inclus.patch │ │ ├── 0037-swcale-Add-explicit-bgr24-yv12-conversions.patch │ │ ├── 0038-fate-filter-fps-Disable-test-due-to-Pi-other-mismatc.patch │ │ ├── 0039-vf_deinterlace_v4l2m2m-Only-enable-if-drm-v4l2m2m-en.patch │ │ ├── 0040-v4l2_m2m-Fix-compile-if-we-have-V4L2-but-not-DRM.patch │ │ ├── 0041-v4l2_m2m_enc-Fix-compile-if-we-have-V4L2-but-not-DRM.patch │ │ └── README.md │ │ ├── libcamera │ │ ├── 0001-HACK-Use-minigbm-handle-structure-to-obtain-strides-.patch │ │ ├── 0002-GLODROID-Don-t-add-ljpeg-argument-when-building-liby.patch │ │ └── 0003-HACK-Support-for-RaspberryPI.patch │ │ ├── mesa3d │ │ └── 0001-HACK-utils-Set-cache-type-back-to-DISK_CACHE_MULTI_F.patch │ │ ├── minigbm │ │ ├── 0001-minigbm-Use-dmabuf-inode-as-unique-buffer-id-instead.patch │ │ ├── 0002-minigbm-Add-external-driver-support.patch │ │ ├── 0003-minigbm-Add-bo_get_plane_fd-backend-hook.patch │ │ ├── 0004-minigbm-Add-const-to-the-backend-name.patch │ │ ├── 0005-minigbm-Add-drv_bo_get_pixel_stride-function.patch │ │ ├── 0006-minigbm-make-dumb-drivers-optional.patch │ │ ├── 0007-minigbm-Allow-using-single-path-for-testing-and-allo.patch │ │ ├── 0008-cros_gralloc-Add-name-to-reserved-buffer.patch │ │ ├── 0009-helpers-Add-helpers-to-convert-use_flags-to-string.patch │ │ ├── 0010-minigbm-Add-gbm_mesa-backend.patch │ │ ├── 0011-minigbm-Add-dmabuf_heap-based-backend.patch │ │ ├── 0012-cros_gralloc-Use-property-to-select-custom-backends.patch │ │ ├── 0013-Add-meson.build.patch │ │ ├── 0014-WIP-Add-build_deploy.sh-script.patch │ │ ├── 0015-RPI4-Add-HW-codecs-support-and-constraints.patch │ │ ├── 0016-README.patch │ │ └── 0017-Fixup-gbm_mesa.patch │ │ └── tinyhal │ │ └── 0001-GLODROID-config-Distinguish-between-rpi4b-and-rpi400.patch ├── hardware │ └── interfaces │ │ ├── 0002-HCI-Fix-improper-rfkill-handling.patch │ │ └── usb │ │ └── aidl │ │ └── default │ │ └── 0001-GLODROID-Report-fake-port-if-no-one-was-detected.patch └── system │ └── core │ └── 0001-RFC-Fix-boot-from-one-mmc-dev-while-android-present-.patch ├── unfold_aosp.sh └── unfold_lineageos.sh /.gitignore: -------------------------------------------------------------------------------- 1 | aosptree/** 2 | !aosptree/vendor 3 | !aosptree/vendor/devices-community 4 | !aosptree/vendor/devices-community/** 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Android 15 for the Raspberry PI 4 series based on the GloDroid project 2 | 3 | [![GloDroid](https://img.shields.io/badge/GLODROID-PROJECT-blue)](https://github.com/GloDroid/glodroid_manifest) 4 | [![ProjectStatus](https://img.shields.io/badge/PROJECT-STATUS-yellowgreen)](https://github.com/GloDroidCommunity/raspberry-pi/issues/1) 5 | [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) 6 | [![Discord](https://img.shields.io/discord/753603904406683670.svg?label=Discord&logo=discord&colorB=7289DA&style=flat-square)](https://discord.gg/5H8cW5xA) 7 | 8 | ## Warning! 9 | 10 | This project is a free and open-source initiative maintained by a group of volunteers. It is provided "as is" without any warranties or guarantees. 11 | The user is fully responsible for any issues arising from using the project. 12 | 13 | ## Flashing images 14 | 15 | Find the sdcard image or archive with fastboot images [here](https://github.com/GloDroidCommunity/raspberry-pi/releases) 16 | 17 | Use the SDCard raw image to flash the Android into SDCard. 18 | 19 | Or use the fastboot images archive to download Android on SDCard using fastboot mode: 20 | 21 | ### Step 1 22 | Extract the content of the archive. 23 | Using any available iso-to-usb utility, prepare recovery SDCARD. 24 | To flash Android on a sdcard, use *deploy-sd.img* 25 | 26 | ### Step 2 27 | Ensure you have installed the adb package: ```$ sudo apt install adb``` (required to set up udev rules) 28 | Insert recovery sdcard into the phone. 29 | Connect the phone and your PC using a typec cable. 30 | Power up the phone. Blue LED indicates that the phone is in bootloader mode, and you can proceed with flashing. 31 | 32 | ### Step 3 33 | Run .*/flash-sd.sh* utility for flashing Android to sdcard 34 | 35 | *After several minutes flashing should complete, and Android should boot* 36 | 37 | ## Building from sources 38 | 39 | Before building, ensure your system has at least 32GB of RAM, a swap file is at least 8GB, and 300GB of free disk space available. 40 | We recommend using the latest laptops to get good performance. E.g., the HP ENVY x360 model15-ds1083cl takes about 5 hours to build the project. 41 | 42 | ### Install system packages 43 | (Ubuntu 22.04 LTS is only supported. Building on other distributions can be done using docker) 44 |
45 | 46 | - [Install AOSP required packages](https://source.android.com/setup/build/initializing). 47 | ```bash 48 | sudo apt-get install -y git-core gnupg flex bison build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig 49 | ``` 50 | 51 |
52 | 53 | - Install additional packages 54 | ```bash 55 | sudo apt-get install -y swig libssl-dev flex bison device-tree-compiler mtools git gettext libncurses5 libgmp-dev libmpc-dev cpio rsync dosfstools kmod gdisk lz4 cmake libglib2.0-dev git-lfs libgnutls28-dev 56 | ``` 57 | 58 |
59 | 60 | - Install additional packages (for building mesa3d, libcamera, and other meson-based components) 61 | ```bash 62 | sudo apt-get install -y python3-pip pkg-config python3-dev ninja-build 63 | sudo pip3 install mako jinja2 ply pyyaml pyelftools meson 64 | ``` 65 | 66 | - Install the `repo` tool 67 | ```bash 68 | sudo apt-get install -y python-is-python3 wget 69 | wget -P ~/bin http://commondatastorage.googleapis.com/git-repo-downloads/repo 70 | chmod a+x ~/bin/repo 71 | ``` 72 | 73 | **NOTE: After this step, you may need to log out and log in to the system to make $HOME/bin added to the PATH environment variable.** 74 | 75 | ### Fetching the sources and building the project 76 | 77 | ```bash 78 | git clone https://github.com/GloDroidCommunity/raspberry-pi.git 79 | cd raspberry-pi 80 | ``` 81 | 82 | ### Building AOSP 83 | 84 | ```bash 85 | ./unfold_aosp.sh && ./build.sh 86 | ``` 87 | 88 | **NOTE: If you're using `git` for the first time, it may ask you to configure the user name and email address and confirm the colored terminal. 89 | Please follow the suggestion you see on the screen in this case.** 90 | 91 | ### Building LineageOS 92 | 93 | To enable GMS (microg), set the environment variable `export WITH_GMS=true`. 94 | 95 | ```bash 96 | ./unfold_lineageos.sh && ./build.sh 97 | ``` 98 | 99 | ### Notes 100 | 101 | - Depending on your hardware and internet connection, downloading and building may take 8h or more. 102 | - After the successful build, find the fastboot images at `./out/images.tar.gz` or sdcard image at `./out/sdcard.img`. 103 | - To disable GloDroid's prebuild apps (like skytube, Firefox, etc.), set the environment variable before building `export GD_NO_DEFAULT_APPS=true`. 104 | -------------------------------------------------------------------------------- /aosptree/vendor/devices-community/gd_rpi4/AndroidProducts.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: Apache-2.0 2 | # 3 | # Copyright (C) 2019 The Android Open-Source Project 4 | # Copyright (C) 2020-2023 Roman Stratiienko (r.stratiienko@gmail.com) 5 | 6 | PRODUCT_MAKEFILES := \ 7 | $(LOCAL_DIR)/gd_rpi4.mk 8 | 9 | COMMON_LUNCH_CHOICES := \ 10 | gd_rpi4-trunk_staging-userdebug 11 | -------------------------------------------------------------------------------- /aosptree/vendor/devices-community/gd_rpi4/BoardConfig.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: Apache-2.0 2 | # 3 | # Copyright (C) 2019 The Android Open-Source Project 4 | 5 | BC_PATH := $(patsubst $(CURDIR)/%,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST))))) 6 | 7 | include glodroid/configuration/common/board-common.mk 8 | 9 | BOARD_MESA3D_GALLIUM_DRIVERS := vc4 v3d 10 | BOARD_MESA3D_VULKAN_DRIVERS := broadcom 11 | 12 | BOARD_KERNEL_CMDLINE += coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_headphones=1 \ 13 | vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 console=ttyS0,115200 14 | 15 | BOARD_LIBCAMERA_IPAS := rpi/vc4 16 | BOARD_LIBCAMERA_PIPELINES := simple rpi/vc4 17 | 18 | BOARD_LIBCAMERA_EXTRA_TARGETS += \ 19 | libetc:libcamera/ipa_rpi_vc4.so:libcamera:ipa_rpi_vc4.so: \ 20 | libetc:libcamera/ipa_rpi_vc4.so.sign:libcamera:ipa_rpi_vc4.so.sign: \ 21 | 22 | BOARD_FFMPEG_ENABLE_REQUEST_API := true 23 | BOARD_FFMPEG_KERNEL_HEADERS_DIR := $(BC_PATH)/codecs/request_api_headers_v4 24 | BOARD_FFMPEG_EXTRA_CONFIGURE_OPTIONS := --enable-sand 25 | -------------------------------------------------------------------------------- /aosptree/vendor/devices-community/gd_rpi4/boot/config.txt: -------------------------------------------------------------------------------- 1 | dtparam=audio=on 2 | dtparam=krnbt=on 3 | dtparam=uart1=on 4 | 5 | # CPU 6 | arm_boost=1 7 | 8 | [all] 9 | start_x=1 10 | enable_uart=1 11 | uart_2ndstage=1 12 | arm_64bit=1 13 | enable_gic=1 14 | kernel=u-boot.bin 15 | armstub=bl31.bin 16 | camera_auto_detect=1 17 | 18 | dtoverlay=dwc2 19 | dtoverlay=vc4-kms-v3d 20 | 21 | max_framebuffers=2 22 | 23 | # Automatically load overlays for detected DSI displays 24 | display_auto_detect=1 25 | 26 | dtoverlay=cma,cma-512 27 | dtoverlay=rpivid-v4l2 28 | -------------------------------------------------------------------------------- /aosptree/vendor/devices-community/gd_rpi4/codecs/request_api_headers_v4/linux/v4l2-common.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */ 2 | /* 3 | * include/linux/v4l2-common.h 4 | * 5 | * Common V4L2 and V4L2 subdev definitions. 6 | * 7 | * Users are advised to #include this file either through videodev2.h 8 | * (V4L2) or through v4l2-subdev.h (V4L2 subdev) rather than to refer 9 | * to this file directly. 10 | * 11 | * Copyright (C) 2012 Nokia Corporation 12 | * Contact: Sakari Ailus 13 | * 14 | * This program is free software; you can redistribute it and/or modify 15 | * it under the terms of the GNU General Public License as published by 16 | * the Free Software Foundation; either version 2 of the License, or 17 | * (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * Alternatively you can redistribute this file under the terms of the 25 | * BSD license as stated below: 26 | * 27 | * Redistribution and use in source and binary forms, with or without 28 | * modification, are permitted provided that the following conditions 29 | * are met: 30 | * 1. Redistributions of source code must retain the above copyright 31 | * notice, this list of conditions and the following disclaimer. 32 | * 2. Redistributions in binary form must reproduce the above copyright 33 | * notice, this list of conditions and the following disclaimer in 34 | * the documentation and/or other materials provided with the 35 | * distribution. 36 | * 3. The names of its contributors may not be used to endorse or promote 37 | * products derived from this software without specific prior written 38 | * permission. 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 41 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 42 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 43 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 44 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 46 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 47 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 48 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 49 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 50 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 51 | * 52 | */ 53 | 54 | #ifndef __V4L2_COMMON__ 55 | #define __V4L2_COMMON__ 56 | 57 | #include 58 | 59 | /* 60 | * 61 | * Selection interface definitions 62 | * 63 | */ 64 | 65 | /* Current cropping area */ 66 | #define V4L2_SEL_TGT_CROP 0x0000 67 | /* Default cropping area */ 68 | #define V4L2_SEL_TGT_CROP_DEFAULT 0x0001 69 | /* Cropping bounds */ 70 | #define V4L2_SEL_TGT_CROP_BOUNDS 0x0002 71 | /* Native frame size */ 72 | #define V4L2_SEL_TGT_NATIVE_SIZE 0x0003 73 | /* Current composing area */ 74 | #define V4L2_SEL_TGT_COMPOSE 0x0100 75 | /* Default composing area */ 76 | #define V4L2_SEL_TGT_COMPOSE_DEFAULT 0x0101 77 | /* Composing bounds */ 78 | #define V4L2_SEL_TGT_COMPOSE_BOUNDS 0x0102 79 | /* Current composing area plus all padding pixels */ 80 | #define V4L2_SEL_TGT_COMPOSE_PADDED 0x0103 81 | 82 | /* Selection flags */ 83 | #define V4L2_SEL_FLAG_GE (1 << 0) 84 | #define V4L2_SEL_FLAG_LE (1 << 1) 85 | #define V4L2_SEL_FLAG_KEEP_CONFIG (1 << 2) 86 | 87 | struct v4l2_edid { 88 | __u32 pad; 89 | __u32 start_block; 90 | __u32 blocks; 91 | __u32 reserved[5]; 92 | __u8 *edid; 93 | }; 94 | 95 | /* Backward compatibility target definitions --- to be removed. */ 96 | #define V4L2_SEL_TGT_CROP_ACTIVE V4L2_SEL_TGT_CROP 97 | #define V4L2_SEL_TGT_COMPOSE_ACTIVE V4L2_SEL_TGT_COMPOSE 98 | #define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL V4L2_SEL_TGT_CROP 99 | #define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL V4L2_SEL_TGT_COMPOSE 100 | #define V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS V4L2_SEL_TGT_CROP_BOUNDS 101 | #define V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS V4L2_SEL_TGT_COMPOSE_BOUNDS 102 | 103 | /* Backward compatibility flag definitions --- to be removed. */ 104 | #define V4L2_SUBDEV_SEL_FLAG_SIZE_GE V4L2_SEL_FLAG_GE 105 | #define V4L2_SUBDEV_SEL_FLAG_SIZE_LE V4L2_SEL_FLAG_LE 106 | #define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG V4L2_SEL_FLAG_KEEP_CONFIG 107 | 108 | #endif /* __V4L2_COMMON__ */ 109 | -------------------------------------------------------------------------------- /aosptree/vendor/devices-community/gd_rpi4/device.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: Apache-2.0 2 | # 3 | # Copyright (C) 2020-2023 Roman Stratiienko (r.stratiienko@gmail.com) 4 | 5 | $(call inherit-product, glodroid/configuration/common/device-common.mk) 6 | 7 | # Firmware 8 | PRODUCT_COPY_FILES += \ 9 | $(LOCAL_PATH)/firmware/brcmfmac43455-sdio.clm_blob:$(TARGET_COPY_OUT_VENDOR)/etc/firmware/brcm/brcmfmac43455-sdio.clm_blob \ 10 | $(LOCAL_PATH)/firmware/brcmfmac43455-sdio.bin:$(TARGET_COPY_OUT_VENDOR)/etc/firmware/brcm/brcmfmac43455-sdio.bin \ 11 | $(LOCAL_PATH)/firmware/brcmfmac43455-sdio.txt:$(TARGET_COPY_OUT_VENDOR)/etc/firmware/brcm/brcmfmac43455-sdio.txt \ 12 | $(LOCAL_PATH)/firmware/brcmfmac43456-sdio.clm_blob:$(TARGET_COPY_OUT_VENDOR)/etc/firmware/brcm/brcmfmac43456-sdio.clm_blob \ 13 | $(LOCAL_PATH)/firmware/brcmfmac43456-sdio.bin:$(TARGET_COPY_OUT_VENDOR)/etc/firmware/brcm/brcmfmac43456-sdio.bin \ 14 | $(LOCAL_PATH)/firmware/brcmfmac43456-sdio.txt:$(TARGET_COPY_OUT_VENDOR)/etc/firmware/brcm/brcmfmac43456-sdio.txt \ 15 | $(LOCAL_PATH)/firmware/LICENCE.broadcom_bcm43xx:$(TARGET_COPY_OUT_VENDOR)/etc/firmware/brcm/LICENCE.broadcom_bcm43xx \ 16 | $(LOCAL_PATH)/firmware/BCM4345C0.hcd:$(TARGET_COPY_OUT_VENDOR)/etc/firmware/brcm/BCM4345C0.hcd \ 17 | $(LOCAL_PATH)/firmware/BCM4345C5.hcd:$(TARGET_COPY_OUT_VENDOR)/etc/firmware/brcm/BCM4345C5.hcd \ 18 | 19 | PRODUCT_COPY_FILES += \ 20 | $(LOCAL_PATH)/etc/audio.rpi4.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio.rpi4.xml \ 21 | $(LOCAL_PATH)/etc/audio.rpi400.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio.rpi400.xml \ 22 | 23 | # Disable suspend. During running some VTS device suspends, which sometimes causes kernel to crash in WIFI driver and reboot. 24 | PRODUCT_COPY_FILES += \ 25 | glodroid/configuration/common/no_suspend.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/no_suspend.rpi4.rc \ 26 | 27 | PRODUCT_COPY_FILES += \ 28 | $(LOCAL_PATH)/etc/power.rpi4.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/power.rpi4.rc \ 29 | $(LOCAL_PATH)/etc/snd.rpi4.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/snd.rpi4.rc \ 30 | $(LOCAL_PATH)/etc/other.rpi4.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/other.rpi4.rc \ 31 | $(LOCAL_PATH)/etc/uevent.device.rc:$(TARGET_COPY_OUT_VENDOR)/etc/uevent.device.rc \ 32 | $(LOCAL_PATH)/etc/modules.blocklist:$(TARGET_COPY_OUT_VENDOR_DLKM)/lib/modules/modules.blocklist \ 33 | 34 | # drm_hwcomposer 35 | # RPI4's hardware doesn't have hardware CTM support, while GPU is slow 36 | # to handle the whole composition. Ignore CTM instead. 37 | PRODUCT_VENDOR_PROPERTIES += vendor.hwc.drm.ctm=DRM_OR_IGNORE 38 | 39 | # Checked by android.opengl.cts.OpenGlEsVersionTest#testOpenGlEsVersion. Required to run correct set of dEQP tests. 40 | # 196609 == 0x00030001 == GLES v3.1 41 | PRODUCT_VENDOR_PROPERTIES += \ 42 | ro.opengles.version=196609 43 | 44 | # Camera 45 | PRODUCT_PACKAGES += ipa_rpi_vc4.so ipa_rpi_vc4.so.sign 46 | 47 | LIBCAMERA_CFGS := $(wildcard glodroid/vendor/libcamera/src/ipa/rpi/vc4/data/*json) 48 | PRODUCT_COPY_FILES += $(foreach cfg,$(LIBCAMERA_CFGS),$(cfg):$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/$(notdir $(cfg))$(space)) 49 | 50 | # Codecs 51 | PRODUCT_VENDOR_PROPERTIES += \ 52 | persist.ffmpeg_codec2.v4l2.h264=true \ 53 | persist.ffmpeg_codec2.v4l2.h265=true \ 54 | persist.ffmpeg_codec2.rank.audio=16 \ 55 | persist.ffmpeg_codec2.rank.video=128 \ 56 | 57 | # Vulkan 58 | PRODUCT_PACKAGES += \ 59 | vulkan.broadcom 60 | 61 | PRODUCT_COPY_FILES += \ 62 | frameworks/native/data/etc/android.hardware.vulkan.level-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.level.xml \ 63 | frameworks/native/data/etc/android.hardware.vulkan.version-1_0_3.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \ 64 | frameworks/native/data/etc/android.software.vulkan.deqp.level-2023-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml \ 65 | 66 | PRODUCT_VENDOR_PROPERTIES += \ 67 | ro.hardware.vulkan=broadcom \ 68 | 69 | # Enable Vulkan backend for SKIA/HWUI 70 | #TARGET_USES_VULKAN = true 71 | 72 | # Bluetooth 73 | PRODUCT_VENDOR_PROPERTIES += \ 74 | bluetooth.device.class_of_device=90,2,12 \ 75 | bluetooth.profile.asha.central.enabled=true \ 76 | bluetooth.profile.a2dp.source.enabled=true \ 77 | bluetooth.profile.avrcp.target.enabled=true \ 78 | bluetooth.profile.bap.broadcast.assist.enabled=true \ 79 | bluetooth.profile.bap.unicast.client.enabled=true \ 80 | bluetooth.profile.bas.client.enabled=true \ 81 | bluetooth.profile.csip.set_coordinator.enabled=true \ 82 | bluetooth.profile.gatt.enabled=true \ 83 | bluetooth.profile.hap.client.enabled=true \ 84 | bluetooth.profile.hfp.ag.enabled=true \ 85 | bluetooth.profile.hid.device.enabled=true \ 86 | bluetooth.profile.hid.host.enabled=true \ 87 | bluetooth.profile.map.server.enabled=true \ 88 | bluetooth.profile.mcp.server.enabled=true \ 89 | bluetooth.profile.opp.enabled=true \ 90 | bluetooth.profile.pan.nap.enabled=true \ 91 | bluetooth.profile.pan.panu.enabled=true \ 92 | bluetooth.profile.pbap.server.enabled=true \ 93 | bluetooth.profile.sap.server.enabled=true \ 94 | bluetooth.profile.ccp.server.enabled=true \ 95 | bluetooth.profile.vcp.controller.enabled=true \ 96 | persist.bluetooth.a2dp_aac.vbr_supported=true -------------------------------------------------------------------------------- /aosptree/vendor/devices-community/gd_rpi4/etc/audio.rpi4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /aosptree/vendor/devices-community/gd_rpi4/etc/audio.rpi400.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /aosptree/vendor/devices-community/gd_rpi4/etc/modules.blocklist: -------------------------------------------------------------------------------- 1 | # List of sub-device specific modules to not load automatically 2 | blocklist brcmfmac 3 | -------------------------------------------------------------------------------- /aosptree/vendor/devices-community/gd_rpi4/etc/other.rpi4.rc: -------------------------------------------------------------------------------- 1 | on early-init 2 | exec u:r:vendor_modprobe:s0 -- /vendor/bin/modprobe -d /vendor/lib/modules -a brcmfmac-wcc 3 | -------------------------------------------------------------------------------- /aosptree/vendor/devices-community/gd_rpi4/etc/power.rpi4.rc: -------------------------------------------------------------------------------- 1 | on early-init 2 | # Value was found experimentally using bouncing ball test 3 | write /sys/devices/system/cpu/cpufreq/schedutil/rate_limit_us 2000 4 | -------------------------------------------------------------------------------- /aosptree/vendor/devices-community/gd_rpi4/etc/snd.rpi4.rc: -------------------------------------------------------------------------------- 1 | on early-init 2 | exec u:r:vendor_modprobe:s0 -- /vendor/bin/modprobe -d /vendor/lib/modules -a snd-dummy 3 | -------------------------------------------------------------------------------- /aosptree/vendor/devices-community/gd_rpi4/etc/uevent.device.rc: -------------------------------------------------------------------------------- 1 | # Bluetooth 2 | /dev/rfkill 0660 bluetooth bluetooth 3 | 4 | # Camera 5 | /dev/media* 0660 system camera 6 | /dev/v4l-subdev* 0660 system camera 7 | /dev/video* 0660 system camera 8 | 9 | # V4L2 10 | /dev/media0 0660 media media 11 | /dev/media3 0660 media media 12 | /dev/video10 0660 media media 13 | /dev/video11 0660 media media 14 | /dev/video12 0660 media media 15 | /dev/video18 0660 media media 16 | /dev/video19 0660 media media 17 | /dev/video31 0660 media media 18 | -------------------------------------------------------------------------------- /aosptree/vendor/devices-community/gd_rpi4/firmware/BCM4345C0.hcd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GloDroidCommunity/raspberry-pi/1ec18f35d1fc8494da1b126ec3607854ae3787fa/aosptree/vendor/devices-community/gd_rpi4/firmware/BCM4345C0.hcd -------------------------------------------------------------------------------- /aosptree/vendor/devices-community/gd_rpi4/firmware/BCM4345C5.hcd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GloDroidCommunity/raspberry-pi/1ec18f35d1fc8494da1b126ec3607854ae3787fa/aosptree/vendor/devices-community/gd_rpi4/firmware/BCM4345C5.hcd -------------------------------------------------------------------------------- /aosptree/vendor/devices-community/gd_rpi4/firmware/LICENCE.broadcom_bcm43xx: -------------------------------------------------------------------------------- 1 | SOFTWARE LICENSE AGREEMENT 2 | 3 | The accompanying software in binary code form (“Software”), is licensed to you, 4 | or, if you are accepting on behalf of an entity, the entity and its affiliates 5 | exercising rights hereunder (“Licensee”) subject to the terms of this software 6 | license agreement (“Agreement”), unless Licensee and Broadcom Corporation 7 | (“Broadcom”) execute a separate written software license agreement governing 8 | use of the Software. ANY USE, REPRODUCTION, OR DISTRIBUTION OF THE SOFTWARE 9 | CONSTITUTES LICENSEE’S ACCEPTANCE OF THIS AGREEMENT. 10 | 11 | 1. License. Subject to the terms and conditions of this Agreement, 12 | Broadcom hereby grants to Licensee a limited, non-exclusive, non-transferable, 13 | royalty-free license: (i) to use and integrate the Software with any other 14 | software; and (ii) to reproduce and distribute the Software complete, 15 | unmodified, and as provided by Broadcom, solely for use with Broadcom 16 | proprietary integrated circuit product(s) sold by Broadcom with which the 17 | Software was designed to be used, or their successors. 18 | 19 | 2. Restrictions. Licensee shall distribute Software with a copy of this 20 | Agreement. Licensee shall not remove, efface or obscure any copyright or 21 | trademark notices from the Software. Reproductions of the Broadcom copyright 22 | notice shall be included with each copy of the Software, except where such 23 | Software is embedded in a manner not readily accessible to the end user. 24 | Licensee shall not: (i) use, license, sell or otherwise distribute the Software 25 | except as provided in this Agreement; (ii) attempt to modify in any way, 26 | reverse engineer, decompile or disassemble any portion of the Software; or 27 | (iii) use the Software or other material in violation of any applicable law or 28 | regulation, including but not limited to any regulatory agency. This Agreement 29 | shall automatically terminate upon Licensee’s failure to comply with any of the 30 | terms of this Agreement. In such event, Licensee will destroy all copies of the 31 | Software and its component parts. 32 | 33 | 3. Ownership. The Software is licensed and not sold. Title to and 34 | ownership of the Software, including all intellectual property rights thereto, 35 | and any portion thereof remain with Broadcom or its licensors. Licensee hereby 36 | covenants that it will not assert any claim that the Software created by or for 37 | Broadcom infringe any intellectual property right owned or controlled by 38 | Licensee. 39 | 40 | 4. Disclaimer. THE SOFTWARE IS OFFERED “AS IS,” AND BROADCOM PROVIDES AND 41 | GRANTS AND LICENSEE RECEIVES NO SUPPORT AND NO WARRANTIES OF ANY KIND, EXPRESS 42 | OR IMPLIED, BY STATUTE, COMMUNICATION OR CONDUCT WITH LICENSEE, OR OTHERWISE. 43 | BROADCOM SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, 44 | FITNESS FOR A SPECIFIC PURPOSE, OR NONINFRINGEMENT CONCERNING THE SOFTWARE OR 45 | ANY UPGRADES TO OR DOCUMENTATION FOR THE SOFTWARE. WITHOUT LIMITATION OF THE 46 | ABOVE, BROADCOM GRANTS NO WARRANTY THAT THE SOFTWARE IS ERROR-FREE OR WILL 47 | OPERATE WITHOUT INTERRUPTION, AND GRANTS NO WARRANTY REGARDING ITS USE OR THE 48 | RESULTS THEREFROM INCLUDING, WITHOUT LIMITATION, ITS CORRECTNESS, ACCURACY, OR 49 | RELIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM 50 | OR ANY OF ITS LICENSORS HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, 51 | INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, HOWEVER CAUSED AND ON ANY THEORY 52 | OF LIABILITY, WHETHER FOR BREACH OF CONTRACT, TORT (INCLUDING NEGLIGENCE) OR 53 | OTHERWISE, ARISING OUT OF THIS AGREEMENT OR USE, REPRODUCTION, OR DISTRIBUTION 54 | OF THE SOFTWARE, INCLUDING BUT NOT LIMITED TO LOSS OF DATA AND LOSS OF PROFITS, 55 | EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. THESE 56 | LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF ANY 57 | LIMITED REMEDY. 58 | 59 | 5. Export Laws. LICENSEE UNDERSTANDS AND AGREES THAT THE SOFTWARE IS 60 | SUBJECT TO UNITED STATES AND OTHER APPLICABLE EXPORT-RELATED LAWS AND 61 | REGULATIONS AND THAT LICENSEE MAY NOT EXPORT, RE-EXPORT OR TRANSFER THE 62 | SOFTWARE OR ANY DIRECT PRODUCT OF THE SOFTWARE EXCEPT AS PERMITTED UNDER THOSE 63 | LAWS. WITHOUT LIMITING THE FOREGOING, EXPORT, RE-EXPORT, OR TRANSFER OF THE 64 | SOFTWARE TO CUBA, IRAN, NORTH KOREA, SUDAN, AND SYRIA IS PROHIBITED. 65 | 66 | -------------------------------------------------------------------------------- /aosptree/vendor/devices-community/gd_rpi4/firmware/brcmfmac43455-sdio.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GloDroidCommunity/raspberry-pi/1ec18f35d1fc8494da1b126ec3607854ae3787fa/aosptree/vendor/devices-community/gd_rpi4/firmware/brcmfmac43455-sdio.bin -------------------------------------------------------------------------------- /aosptree/vendor/devices-community/gd_rpi4/firmware/brcmfmac43455-sdio.clm_blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GloDroidCommunity/raspberry-pi/1ec18f35d1fc8494da1b126ec3607854ae3787fa/aosptree/vendor/devices-community/gd_rpi4/firmware/brcmfmac43455-sdio.clm_blob -------------------------------------------------------------------------------- /aosptree/vendor/devices-community/gd_rpi4/firmware/brcmfmac43455-sdio.txt: -------------------------------------------------------------------------------- 1 | # Cloned from bcm94345wlpagb_p2xx.txt 2 | NVRAMRev=$Rev: 498373 $ 3 | sromrev=11 4 | vendid=0x14e4 5 | devid=0x43ab 6 | manfid=0x2d0 7 | prodid=0x06e4 8 | #macaddr=00:90:4c:c5:12:38 9 | macaddr=b8:27:eb:74:f2:6c 10 | nocrc=1 11 | boardtype=0x6e4 12 | boardrev=0x1304 13 | 14 | #XTAL 37.4MHz 15 | xtalfreq=37400 16 | 17 | btc_mode=1 18 | #------------------------------------------------------ 19 | #boardflags: 5GHz eTR switch by default 20 | # 2.4GHz eTR switch by default 21 | # bit1 for btcoex 22 | boardflags=0x00480201 23 | boardflags2=0x40800000 24 | boardflags3=0x44200100 25 | phycal_tempdelta=15 26 | rxchain=1 27 | txchain=1 28 | aa2g=1 29 | aa5g=1 30 | tssipos5g=1 31 | tssipos2g=1 32 | femctrl=0 33 | AvVmid_c0=1,165,2,100,2,100,2,100,2,100 34 | pa2ga0=-129,6525,-718 35 | pa2ga1=-149,4408,-601 36 | pa5ga0=-185,6836,-815,-186,6838,-815,-184,6859,-815,-184,6882,-818 37 | pa5ga1=-202,4285,-574,-201,4312,-578,-196,4391,-586,-201,4294,-575 38 | itrsw=1 39 | pdoffsetcckma0=2 40 | pdoffset2gperchan=0,-2,1,0,1,0,1,1,1,0,0,-1,-1,0 41 | pdoffset2g40ma0=16 42 | pdoffset40ma0=0x8888 43 | pdoffset80ma0=0x8888 44 | extpagain5g=2 45 | extpagain2g=2 46 | tworangetssi2g=1 47 | tworangetssi5g=1 48 | # LTECX flags 49 | # WCI2 50 | ltecxmux=0 51 | ltecxpadnum=0x0504 52 | ltecxfnsel=0x22 53 | ltecxgcigpio=0x32 54 | 55 | maxp2ga0=80 56 | ofdmlrbw202gpo=0x0022 57 | dot11agofdmhrbw202gpo=0x4442 58 | mcsbw202gpo=0x98444422 59 | mcsbw402gpo=0x98444422 60 | maxp5ga0=82,82,82,82 61 | mcsbw205glpo=0xb9555000 62 | mcsbw205gmpo=0xb9555000 63 | mcsbw205ghpo=0xb9555000 64 | mcsbw405glpo=0xb9555000 65 | mcsbw405gmpo=0xb9555000 66 | mcsbw405ghpo=0xb9555000 67 | mcsbw805glpo=0xb9555000 68 | mcsbw805gmpo=0xb9555000 69 | mcsbw805ghpo=0xb9555000 70 | 71 | swctrlmap_2g=0x00000000,0x00000000,0x00000000,0x010000,0x3ff 72 | swctrlmap_5g=0x00100010,0x00200020,0x00200020,0x010000,0x3fe 73 | swctrlmapext_5g=0x00000000,0x00000000,0x00000000,0x000000,0x3 74 | swctrlmapext_2g=0x00000000,0x00000000,0x00000000,0x000000,0x3 75 | 76 | vcodivmode=1 77 | deadman_to=481500000 78 | 79 | ed_thresh2g=-54 80 | ed_thresh5g=-54 81 | eu_edthresh2g=-54 82 | eu_edthresh5g=-54 83 | ldo1=4 84 | rawtempsense=0x1ff 85 | cckPwrIdxCorr=3 86 | cckTssiDelay=150 87 | ofdmTssiDelay=150 88 | txpwr2gAdcScale=1 89 | txpwr5gAdcScale=1 90 | dot11b_opts=0x3aa85 91 | cbfilttype=1 92 | fdsslevel_ch11=6 93 | 94 | # Improved Bluetooth coexistence parameters from Cypress 95 | btc_mode=1 96 | btc_params8=0x4e20 97 | btc_params1=0x7530 98 | btc_params50=0x972c 99 | -------------------------------------------------------------------------------- /aosptree/vendor/devices-community/gd_rpi4/firmware/brcmfmac43456-sdio.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GloDroidCommunity/raspberry-pi/1ec18f35d1fc8494da1b126ec3607854ae3787fa/aosptree/vendor/devices-community/gd_rpi4/firmware/brcmfmac43456-sdio.bin -------------------------------------------------------------------------------- /aosptree/vendor/devices-community/gd_rpi4/firmware/brcmfmac43456-sdio.clm_blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GloDroidCommunity/raspberry-pi/1ec18f35d1fc8494da1b126ec3607854ae3787fa/aosptree/vendor/devices-community/gd_rpi4/firmware/brcmfmac43456-sdio.clm_blob -------------------------------------------------------------------------------- /aosptree/vendor/devices-community/gd_rpi4/firmware/brcmfmac43456-sdio.txt: -------------------------------------------------------------------------------- 1 | # Cloned from bcm94345wlpagb_p2xx.txt 2 | NVRAMRev=$Rev: 498373 $ 3 | sromrev=11 4 | vendid=0x14e4 5 | devid=0x43ab 6 | manfid=0x2d0 7 | prodid=0x06e4 8 | #macaddr=00:90:4c:c5:12:38 9 | macaddr=b8:27:eb:74:f2:6c 10 | nocrc=1 11 | boardtype=0x6e4 12 | boardrev=0x1304 13 | 14 | #XTAL 37.4MHz 15 | xtalfreq=37400 16 | 17 | btc_mode=1 18 | #------------------------------------------------------ 19 | #boardflags: 5GHz eTR switch by default 20 | # 2.4GHz eTR switch by default 21 | # bit1 for btcoex 22 | boardflags=0x00480201 23 | boardflags2=0x40800000 24 | boardflags3=0x44200100 25 | phycal_tempdelta=15 26 | rxchain=1 27 | txchain=1 28 | aa2g=1 29 | aa5g=1 30 | tssipos5g=1 31 | tssipos2g=1 32 | femctrl=0 33 | AvVmid_c0=0,157,1,126,1,126,1,126,1,126 34 | pa2ga0=-170,5896,-680 35 | pa2ga1=-156,4032,-547 36 | pa5ga0=-150,5547,-628,-150,5583,-640,-158,5608,-649,-160,5757,-673 37 | pa5ga1=-109,3831,-519,-88,3821,-512,-125,3731,-528,-103,3829,-516 38 | itrsw=1 39 | pdoffsetcckma0=2 40 | pdoffset2gperchan=0,-2,1,0,1,0,1,1,1,0,0,-1,-1,0 41 | pdoffset2g40ma0=16 42 | pdoffset40ma0=0x8888 43 | pdoffset80ma0=0x8888 44 | extpagain5g=2 45 | extpagain2g=2 46 | tworangetssi2g=1 47 | tworangetssi5g=1 48 | # LTECX flags 49 | # WCI2 50 | ltecxmux=0 51 | ltecxpadnum=0x0504 52 | ltecxfnsel=0x22 53 | ltecxgcigpio=0x32 54 | 55 | maxp2ga0=80 56 | ofdmlrbw202gpo=0x0022 57 | dot11agofdmhrbw202gpo=0x4442 58 | mcsbw202gpo=0x98444422 59 | mcsbw402gpo=0x98444422 60 | maxp5ga0=82,82,82,82 61 | mcsbw205glpo=0xb9555000 62 | mcsbw205gmpo=0xb9555000 63 | mcsbw205ghpo=0xb9555000 64 | mcsbw405glpo=0xb9555000 65 | mcsbw405gmpo=0xb9555000 66 | mcsbw405ghpo=0xb9555000 67 | mcsbw805glpo=0xb9555000 68 | mcsbw805gmpo=0xb9555000 69 | mcsbw805ghpo=0xb9555000 70 | 71 | swctrlmap_2g=0x00000000,0x00000000,0x00000000,0x010000,0x3ff 72 | swctrlmap_5g=0x00100010,0x00200020,0x00200020,0x010000,0x3fe 73 | swctrlmapext_5g=0x00000000,0x00000000,0x00000000,0x000000,0x3 74 | swctrlmapext_2g=0x00000000,0x00000000,0x00000000,0x000000,0x3 75 | 76 | vcodivmode=1 77 | deadman_to=481500000 78 | 79 | ed_thresh2g=-54 80 | ed_thresh5g=-54 81 | eu_edthresh2g=-54 82 | eu_edthresh5g=-54 83 | ldo1=4 84 | rawtempsense=0x1ff 85 | cckPwrIdxCorr=3 86 | cckTssiDelay=150 87 | ofdmTssiDelay=150 88 | txpwr2gAdcScale=1 89 | txpwr5gAdcScale=1 90 | dot11b_opts=0x3aa85 91 | cbfilttype=1 92 | fdsslevel_ch11=6 93 | 94 | # Improved Bluetooth coexistence parameters from Cypress 95 | btc_mode=1 96 | btc_params8=0x4e20 97 | btc_params1=0x7530 98 | -------------------------------------------------------------------------------- /aosptree/vendor/devices-community/gd_rpi4/gd_rpi4.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: Apache-2.0 2 | # 3 | # Copyright (C) 2020 Roman Stratiienko (r.stratiienko@gmail.com) 4 | 5 | # Architecture 6 | TARGET_ARCH := arm64 7 | TARGET_ARCH_VARIANT := armv8-a 8 | TARGET_CPU_ABI := arm64-v8a 9 | TARGET_CPU_ABI2 := 10 | TARGET_CPU_VARIANT := generic 11 | 12 | TARGET_2ND_ARCH := arm 13 | TARGET_2ND_ARCH_VARIANT := armv7-a-neon 14 | TARGET_2ND_CPU_ABI := armeabi-v7a 15 | TARGET_2ND_CPU_ABI2 := armeabi 16 | TARGET_2ND_CPU_VARIANT := generic 17 | 18 | PRODUCT_BOARD_PLATFORM := broadcom 19 | PRODUCT_NAME := gd_rpi4 20 | PRODUCT_DEVICE := gd_rpi4 21 | PRODUCT_BRAND := RaspberryPI 22 | PRODUCT_MODEL := rpi4 23 | PRODUCT_MANUFACTURER := RaspberryPiFoundation 24 | 25 | UBOOT_DEFCONFIG := rpi_4_defconfig 26 | ATF_PLAT := rpi4 27 | 28 | KERNEL_SRC := glodroid/kernel/broadcom 29 | KERNEL_DEFCONFIG := $(KERNEL_SRC)/arch/arm64/configs/android_rpi4_defconfig 30 | 31 | KERNEL_FRAGMENTS := \ 32 | $(LOCAL_PATH)/kernel.config \ 33 | 34 | KERNEL_DTB_FILE := broadcom/bcm2711-rpi-4-b.dtb 35 | 36 | SYSFS_MMC0_PATH := emmc2bus/fe340000.mmc 37 | 38 | RPI_CONFIG := $(LOCAL_PATH)/boot/config.txt 39 | 40 | GD_NO_DEFAULT_MODEM := true 41 | 42 | $(call inherit-product, $(LOCAL_PATH)/device.mk) 43 | -------------------------------------------------------------------------------- /aosptree/vendor/devices-community/gd_rpi4/kernel.config: -------------------------------------------------------------------------------- 1 | # CONFIG_CMDLINE is not set 2 | 3 | # Enable OTG in recovery/fastbootd mode 4 | CONFIG_USB_DWC2=y 5 | 6 | # RPI4 board has no RTC, add this option to make VTS 'com.android.tests.sysfs.KernelApiSysfsTest#testRtcHctosys' happy. 7 | CONFIG_RTC_DRV_TEST=y 8 | 9 | # This option is enabled in rpi4 defconfig. It will implicitly turn on CONFIG_CRYPTO_MD4 which Android VTS is checking to be disabled. 10 | # CONFIG_CIFS is not set 11 | 12 | # To avoid kernel build error due to some dependencies issue 13 | CONFIG_VIDEO_DEV=y 14 | 15 | # Adjust Konsta's defconfig to work within GloDroid 16 | # CONFIG_EXTRA_FIRMWARE is not set 17 | # CONFIG_EXTRA_FIRMWARE_DIR is not set 18 | 19 | # Used by tinyhal to stub missing microphone input on rpi4 and audio as a whole on rpi400 20 | CONFIG_SND_DUMMY=y 21 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | trap 'echo -e "\nbuild.sh interrupted"; exit 1' SIGINT 4 | 5 | echo Building the Android 6 | pushd aosptree 7 | . build/envsetup.sh 8 | lunch gd_rpi4-trunk_staging-userdebug 9 | make images -k || make images -j1 10 | make sdcard 11 | popd 12 | -------------------------------------------------------------------------------- /device: -------------------------------------------------------------------------------- 1 | aosptree/vendor/devices-community/gd_rpi4 -------------------------------------------------------------------------------- /glodroid: -------------------------------------------------------------------------------- 1 | aosptree/glodroid -------------------------------------------------------------------------------- /manifests/default_aosp.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /manifests/default_lineage.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /manifests/glodroid.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 55 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /manifests/update_lineage_manifest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script is used to update the LineageOS manifest file 4 | 5 | echo "You are going to update the LineageOS manifest file." 6 | echo "During the update, the current AOSP work directory (aosptree/) will be updated." 7 | echo "If you have any local changes, they will be lost." 8 | echo "Do you want to continue? [y/N]" 9 | read -r answer 10 | if [[ ! $answer =~ ^[Yy]$ ]] 11 | then 12 | echo "Aborting" 13 | exit 1 14 | fi 15 | 16 | echo Init repo tree using LineageOS manifest 17 | pushd ../aosptree 18 | repo init -u https://github.com/LineageOS/android.git -b refs/heads/lineage-20.0 19 | repo sync -c 20 | repo manifest -r -o ../manifests/lineage-static.xml 21 | popd 22 | 23 | # Add the warning line at the beginning of the manifest 24 | sed -i '2i\\n\n' lineage-static.xml 25 | 26 | echo -e "\n\033[32m Done \033[0m" 27 | -------------------------------------------------------------------------------- /out: -------------------------------------------------------------------------------- 1 | aosptree/out/target/product/gd_rpi4 -------------------------------------------------------------------------------- /patches-aosp/external/libcxx/0001-Update-include-chrono-to-fix-LLVM-bug-41430.patch: -------------------------------------------------------------------------------- 1 | From 5c73e39898788a341a7fc198ba8aa9ed8e1e98d2 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Sun, 13 Nov 2022 15:43:39 +0200 4 | Subject: [PATCH] Update include/chrono to fix LLVM bug 41430 5 | 6 | https://bugs.llvm.org/show_bug.cgi?id=41130 7 | 8 | Change-Id: I174b0f42d5fdb70e0a4426de8ee980cb5cd5e618 9 | Signed-off-by: Roman Stratiienko 10 | --- 11 | include/chrono | 7 ++++++- 12 | 1 file changed, 6 insertions(+), 1 deletion(-) 13 | 14 | diff --git a/include/chrono b/include/chrono 15 | index 96759f9860ee..f18dffb5255e 100644 16 | --- a/include/chrono 17 | +++ b/include/chrono 18 | @@ -1290,7 +1290,12 @@ struct __duration_divide_result, _Rep2, false> 19 | template 20 | inline _LIBCPP_INLINE_VISIBILITY 21 | _LIBCPP_CONSTEXPR 22 | -typename __duration_divide_result, _Rep2>::type 23 | +typename enable_if 24 | +< 25 | + !__is_duration<_Rep2>::value && 26 | + is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value, 27 | + duration::type, _Period> 28 | +>::type 29 | operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s) 30 | { 31 | typedef typename common_type<_Rep1, _Rep2>::type _Cr; 32 | -- 33 | 2.34.1 34 | 35 | -------------------------------------------------------------------------------- /patches-aosp/external/lzma/0001-Remove-Android.bp-march-hacks.patch: -------------------------------------------------------------------------------- 1 | From 2cf2a6c076670aa5a6846109706fc309f2ffc91f Mon Sep 17 00:00:00 2001 2 | From: Elliott Hughes 3 | Date: Thu, 5 Sep 2024 15:52:58 +0000 4 | Subject: [PATCH] Remove Android.bp -march hacks. 5 | 6 | It looks like clang changed so that the __attribute__((__target__())) 7 | stuff is working again, and that's a lot safer than hard-coding -march. 8 | In particular, it turns out that we're still shipping ART mainline 9 | module updates to armv7 devices... 10 | 11 | Bug: http://b/364822746 12 | Test: objdump 13 | Change-Id: If409deff5d08559a7466b6ebcd0aa95ea63a1665 14 | --- 15 | Android.bp | 9 --------- 16 | 1 file changed, 9 deletions(-) 17 | 18 | diff --git a/Android.bp b/Android.bp 19 | index 752a8f9..828650c 100644 20 | --- a/Android.bp 21 | +++ b/Android.bp 22 | @@ -81,15 +81,6 @@ cc_library { 23 | "C/XzIn.c", 24 | ], 25 | 26 | - arch: { 27 | - arm: { 28 | - cflags: ["-march=armv8-a+crypto"], 29 | - }, 30 | - arm64: { 31 | - cflags: ["-march=armv8-a+crypto"], 32 | - }, 33 | - }, 34 | - 35 | target: { 36 | linux_bionic: { 37 | enabled: true, 38 | -- 39 | 2.43.0 40 | 41 | -------------------------------------------------------------------------------- /patches-aosp/external/tinycompress/0001-WIP-Don-t-include-kernel-headers.patch: -------------------------------------------------------------------------------- 1 | From 02e87d93f41f897a8b683f4d6e57e0ce85b14be9 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Mon, 20 Mar 2023 19:39:45 +0200 4 | Subject: [PATCH] LineageOS: Don't include kernel headers 5 | 6 | Some issue in kernel headers makes compile error. 7 | 8 | This change is relevant for LineageOS only but shouldn't make any 9 | issues with AOSP, so use it in both for consistency. 10 | 11 | Change-Id: I559090f1a893f4b7bc13ccebda633020f34a8ff1 12 | Signed-off-by: Roman Stratiienko 13 | --- 14 | Android.bp | 3 --- 15 | 1 file changed, 3 deletions(-) 16 | 17 | diff --git a/Android.bp b/Android.bp 18 | index 98fbd16..26c9c55 100644 19 | --- a/Android.bp 20 | +++ b/Android.bp 21 | @@ -42,9 +42,6 @@ cc_library_shared { 22 | "libcutils", 23 | "libutils", 24 | ], 25 | - header_libs: [ 26 | - "device_kernel_headers", 27 | - ], 28 | } 29 | 30 | cc_binary { 31 | -- 32 | 2.34.1 33 | 34 | -------------------------------------------------------------------------------- /patches-aosp/external/v4l2_codec2/0001-v4l2_codec2-Remove-multilib-support.patch: -------------------------------------------------------------------------------- 1 | From 92c8351dfb247422ba84e8cc9012094bbd12f11a Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Thu, 12 Oct 2023 03:19:20 +0300 4 | Subject: [PATCH 01/11] v4l2_codec2: Remove multilib support 5 | 6 | For the bindarized HAL, multilib doesn't make any sense. 7 | Also, it confuses the init sometimes if both 64 and 32 8 | variants are available on the board. 9 | 10 | Change-Id: I33854241f2976ac54cdb7731cdcc93e94021d30c 11 | Signed-off-by: Roman Stratiienko 12 | --- 13 | service/Android.bp | 13 ++----------- 14 | ...android.hardware.media.c2@1.0-service-v4l2-64.rc | 7 ------- 15 | ...> android.hardware.media.c2@1.0-service-v4l2.rc} | 2 +- 16 | 3 files changed, 3 insertions(+), 19 deletions(-) 17 | delete mode 100644 service/android.hardware.media.c2@1.0-service-v4l2-64.rc 18 | rename service/{android.hardware.media.c2@1.0-service-v4l2-32.rc => android.hardware.media.c2@1.0-service-v4l2.rc} (82%) 19 | 20 | diff --git a/service/Android.bp b/service/Android.bp 21 | index eaf5d3f..1cc3808 100644 22 | --- a/service/Android.bp 23 | +++ b/service/Android.bp 24 | @@ -33,16 +33,7 @@ cc_binary { 25 | 26 | required: ["android.hardware.media.c2-default-seccomp_policy"], 27 | 28 | - compile_multilib: "both", 29 | - multilib: { 30 | - lib32: { 31 | - suffix: "-32", 32 | - init_rc: ["android.hardware.media.c2@1.0-service-v4l2-32.rc"], 33 | - }, 34 | - lib64: { 35 | - suffix: "-64", 36 | - init_rc: ["android.hardware.media.c2@1.0-service-v4l2-64.rc"], 37 | - }, 38 | - }, 39 | + compile_multilib: "first", 40 | + init_rc: ["android.hardware.media.c2@1.0-service-v4l2.rc"], 41 | vintf_fragments: ["android.hardware.media.c2@1.2-service-v4l2.xml"], 42 | } 43 | diff --git a/service/android.hardware.media.c2@1.0-service-v4l2-64.rc b/service/android.hardware.media.c2@1.0-service-v4l2-64.rc 44 | deleted file mode 100644 45 | index 454953b..0000000 46 | --- a/service/android.hardware.media.c2@1.0-service-v4l2-64.rc 47 | +++ /dev/null 48 | @@ -1,7 +0,0 @@ 49 | -service android-hardware-media-c2-v4l2-hal-1-0 /vendor/bin/hw/android.hardware.media.c2@1.0-service-v4l2-64 50 | - class hal 51 | - user media 52 | - group mediadrm drmrpc 53 | - ioprio rt 4 54 | - task_profiles ProcessCapacityHigh 55 | - setenv MESA_GLSL_CACHE_DISABLE 1 56 | diff --git a/service/android.hardware.media.c2@1.0-service-v4l2-32.rc b/service/android.hardware.media.c2@1.0-service-v4l2.rc 57 | similarity index 82% 58 | rename from service/android.hardware.media.c2@1.0-service-v4l2-32.rc 59 | rename to service/android.hardware.media.c2@1.0-service-v4l2.rc 60 | index e4ddbc3..8d1a45b 100644 61 | --- a/service/android.hardware.media.c2@1.0-service-v4l2-32.rc 62 | +++ b/service/android.hardware.media.c2@1.0-service-v4l2.rc 63 | @@ -1,4 +1,4 @@ 64 | -service android-hardware-media-c2-v4l2-hal-1-0 /vendor/bin/hw/android.hardware.media.c2@1.0-service-v4l2-32 65 | +service android-hardware-media-c2-v4l2-hal-1-0 /vendor/bin/hw/android.hardware.media.c2@1.0-service-v4l2 66 | class hal 67 | user media 68 | group mediadrm drmrpc 69 | -- 70 | 2.39.2 71 | 72 | -------------------------------------------------------------------------------- /patches-aosp/external/v4l2_codec2/0002-v4l2_codec2-Make-the-project-directory-independent.patch: -------------------------------------------------------------------------------- 1 | From f20359e78c894dd389337a74bcd4af36432823df Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Wed, 11 Oct 2023 11:32:05 +0300 4 | Subject: [PATCH 02/11] v4l2_codec2: Make the project directory-independent 5 | 6 | Some users want to group all vendor code in a separate directory. 7 | Replace hardcoded 'external/v4l2_codec2' paths with cc_library_headers. 8 | 9 | Change-Id: I29b3c15df199a225ce0acccbafe4f935de250a2c 10 | Signed-off-by: Roman Stratiienko 11 | --- 12 | common/Android.bp | 6 ++++++ 13 | components/Android.bp | 6 ++++++ 14 | tests/c2_comp_intf/Android.bp | 6 ++---- 15 | 3 files changed, 14 insertions(+), 4 deletions(-) 16 | 17 | diff --git a/common/Android.bp b/common/Android.bp 18 | index e9c5fe3..a92bca5 100644 19 | --- a/common/Android.bp 20 | +++ b/common/Android.bp 21 | @@ -50,3 +50,9 @@ cc_library { 22 | "-Wall", 23 | ], 24 | } 25 | + 26 | +cc_library_headers { 27 | + name: "v4l2_codec2_common_headers", 28 | + vendor: true, 29 | + export_include_dirs: ["include"], 30 | +} 31 | diff --git a/components/Android.bp b/components/Android.bp 32 | index 5bee73b..742b9eb 100644 33 | --- a/components/Android.bp 34 | +++ b/components/Android.bp 35 | @@ -57,3 +57,9 @@ cc_library { 36 | "-Wthread-safety", 37 | ], 38 | } 39 | + 40 | +cc_library_headers { 41 | + name: "v4l2_codec2_components_headers", 42 | + vendor: true, 43 | + export_include_dirs: ["include"], 44 | +} 45 | diff --git a/tests/c2_comp_intf/Android.bp b/tests/c2_comp_intf/Android.bp 46 | index 5c91ef4..35380f3 100644 47 | --- a/tests/c2_comp_intf/Android.bp 48 | +++ b/tests/c2_comp_intf/Android.bp 49 | @@ -26,11 +26,9 @@ cc_test { 50 | "libutils", 51 | "libv4l2_codec2_components", 52 | ], 53 | - include_dirs: [ 54 | - "external/v4l2_codec2/common/include", 55 | - "external/v4l2_codec2/components/include", 56 | - ], 57 | header_libs: [ 58 | + "v4l2_codec2_common_headers", 59 | + "v4l2_codec2_components_headers", 60 | "libcodec2_soft_common_headers", 61 | "libcodec2_headers", 62 | "libcodec2_vndk_headers", 63 | -- 64 | 2.39.2 65 | 66 | -------------------------------------------------------------------------------- /patches-aosp/external/v4l2_codec2/0003-plugin_store-Mark-libc2plugin_store-library-as-vendo.patch: -------------------------------------------------------------------------------- 1 | From 4d61b0f94def056351f18f0223e6863e4ff822bf Mon Sep 17 00:00:00 2001 2 | From: Andrew Gazizov 3 | Date: Tue, 27 Sep 2022 09:53:59 +0200 4 | Subject: [PATCH 03/11] plugin_store: Mark libc2plugin_store library as 5 | vendor_available. 6 | 7 | Set property vendor_available:true for libc2plugin_store library 8 | to install it for platform (/system/lib directory). [1] 9 | Otherwise libc2plugin_store will be not visible and accessible 10 | for C2PlatformStorePluginLoader. 11 | 12 | REF: 13 | [1] https://source.android.com/docs/core/architecture/vndk/enabling 14 | 15 | Bug: 249120082 16 | Test: Build and run 17 | 18 | Change-Id: I465266ef2a3b0d7ea9fa5cd904f345574ff7f275 19 | --- 20 | plugin_store/Android.bp | 2 +- 21 | 1 file changed, 1 insertion(+), 1 deletion(-) 22 | 23 | diff --git a/plugin_store/Android.bp b/plugin_store/Android.bp 24 | index 621cbfc..ec44f13 100644 25 | --- a/plugin_store/Android.bp 26 | +++ b/plugin_store/Android.bp 27 | @@ -9,7 +9,7 @@ package { 28 | 29 | cc_library_shared { 30 | name: "libc2plugin_store", 31 | - vendor: true, 32 | + vendor_available: true, 33 | 34 | defaults: [ 35 | "libcodec2-impl-defaults", 36 | -- 37 | 2.39.2 38 | 39 | -------------------------------------------------------------------------------- /patches-aosp/external/v4l2_codec2/0004-GLODROID-Disable-seccomp.patch: -------------------------------------------------------------------------------- 1 | From b8227baca2bb8df1a57e155cac7de3e6b4daecc9 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Sun, 17 Sep 2023 12:14:08 +0300 4 | Subject: [PATCH 04/11] GLODROID: Disable seccomp 5 | 6 | From my understanding, the seccomp only makes sense when using 7 | proprietary codec libraries to ensure they are not doing anything 8 | unexpected. 9 | 10 | Change-Id: I90caac273ea51666f2ec51eb4ecaa02f76743f52 11 | Signed-off-by: Roman Stratiienko 12 | --- 13 | service/Android.bp | 2 -- 14 | service/service.cpp | 13 ------------- 15 | 2 files changed, 15 deletions(-) 16 | 17 | diff --git a/service/Android.bp b/service/Android.bp 18 | index 1cc3808..180dff3 100644 19 | --- a/service/Android.bp 20 | +++ b/service/Android.bp 21 | @@ -31,8 +31,6 @@ cc_binary { 22 | "libutils", 23 | ], 24 | 25 | - required: ["android.hardware.media.c2-default-seccomp_policy"], 26 | - 27 | compile_multilib: "first", 28 | init_rc: ["android.hardware.media.c2@1.0-service-v4l2.rc"], 29 | vintf_fragments: ["android.hardware.media.c2@1.2-service-v4l2.xml"], 30 | diff --git a/service/service.cpp b/service/service.cpp 31 | index 1fa9aae..25a612a 100644 32 | --- a/service/service.cpp 33 | +++ b/service/service.cpp 34 | @@ -14,23 +14,10 @@ 35 | 36 | #include 37 | 38 | -// This is the absolute on-device path of the prebuild_etc module 39 | -// "android.hardware.media.c2-default-seccomp_policy" in Android.bp. 40 | -static constexpr char kBaseSeccompPolicyPath[] = 41 | - "/vendor/etc/seccomp_policy/" 42 | - "android.hardware.media.c2-default-seccomp_policy"; 43 | - 44 | -// Additional seccomp permissions can be added in this file. 45 | -// This file does not exist by default. 46 | -static constexpr char kExtSeccompPolicyPath[] = 47 | - "/vendor/etc/seccomp_policy/" 48 | - "android.hardware.media.c2-extended-seccomp_policy"; 49 | - 50 | int main(int /* argc */, char** /* argv */) { 51 | ALOGD("Service starting..."); 52 | 53 | signal(SIGPIPE, SIG_IGN); 54 | - android::SetUpMinijail(kBaseSeccompPolicyPath, kExtSeccompPolicyPath); 55 | 56 | // Extra threads may be needed to handle a stacked IPC sequence that 57 | // contains alternating binder and hwbinder calls. (See b/35283480.) 58 | -- 59 | 2.39.2 60 | 61 | -------------------------------------------------------------------------------- /patches-aosp/external/v4l2_codec2/0005-Rename-HAL-instance-from-default-to-v4l2.patch: -------------------------------------------------------------------------------- 1 | From a8b9f1030b9f850c0ded14e00231f944e66cc4ee Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Sun, 17 Sep 2023 12:21:07 +0300 4 | Subject: [PATCH 05/11] Rename HAL instance from default to v4l2 5 | 6 | Change-Id: I361fbfc536db21f99b4a72b30bdb1ea482f70528 7 | Signed-off-by: Roman Stratiienko 8 | --- 9 | service/android.hardware.media.c2@1.2-service-v4l2.xml | 2 +- 10 | service/service.cpp | 2 +- 11 | 2 files changed, 2 insertions(+), 2 deletions(-) 12 | 13 | diff --git a/service/android.hardware.media.c2@1.2-service-v4l2.xml b/service/android.hardware.media.c2@1.2-service-v4l2.xml 14 | index 7976a59..df88113 100644 15 | --- a/service/android.hardware.media.c2@1.2-service-v4l2.xml 16 | +++ b/service/android.hardware.media.c2@1.2-service-v4l2.xml 17 | @@ -5,7 +5,7 @@ 18 | 1.2 19 | 20 | IComponentStore 21 | - default 22 | + v4l2 23 | 24 | 25 | 26 | diff --git a/service/service.cpp b/service/service.cpp 27 | index 25a612a..2909bb2 100644 28 | --- a/service/service.cpp 29 | +++ b/service/service.cpp 30 | @@ -37,7 +37,7 @@ int main(int /* argc */, char** /* argv */) { 31 | new utils::ComponentStore(android::V4L2ComponentStore::Create())); 32 | if (store == nullptr) { 33 | ALOGE("Cannot create Codec2's V4L2 IComponentStore service."); 34 | - } else if (store->registerAsService("default") != android::OK) { 35 | + } else if (store->registerAsService("v4l2") != android::OK) { 36 | ALOGE("Cannot register Codec2's IComponentStore service."); 37 | } else { 38 | ALOGI("Codec2's IComponentStore service created."); 39 | -- 40 | 2.39.2 41 | 42 | -------------------------------------------------------------------------------- /patches-aosp/external/v4l2_codec2/0006-EncoderInterface-Set-both-input-and-output-usage-to-.patch: -------------------------------------------------------------------------------- 1 | From 2379c1166cc0deeec129614bb8a0769450153a5e Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Mon, 2 Oct 2023 01:55:53 +0300 4 | Subject: [PATCH 06/11] EncoderInterface: Set both input and output usage to 5 | VIDEO_ENCODER 6 | 7 | ... so that gralloc can allocate the buffer with the appropriate memory type. 8 | 9 | Change-Id: Ifc7d507c9bb9c8193217b74d860760689f993d6c 10 | Signed-off-by: Roman Stratiienko 11 | --- 12 | components/V4L2EncodeInterface.cpp | 20 +++++++++----------- 13 | 1 file changed, 9 insertions(+), 11 deletions(-) 14 | 15 | diff --git a/components/V4L2EncodeInterface.cpp b/components/V4L2EncodeInterface.cpp 16 | index 03d8c37..2e65cb8 100644 17 | --- a/components/V4L2EncodeInterface.cpp 18 | +++ b/components/V4L2EncodeInterface.cpp 19 | @@ -382,17 +382,15 @@ void V4L2EncodeInterface::Initialize(const C2String& name) { 20 | .withConstValue(new C2StreamBufferTypeSetting::input(0u, C2BufferData::GRAPHIC)) 21 | .build()); 22 | 23 | - // TODO(b/167640667) Add VIDEO_ENCODER flag once input convertor is not enabled by default. 24 | - // When using the format convertor (which is currently always enabled) it's not useful to add 25 | - // the VIDEO_ENCODER buffer flag for input buffers here. Currently zero-copy is not supported 26 | - // yet, so when using this flag an additional buffer will be allocated on host side and a copy 27 | - // will be performed between the guest and host buffer to keep them in sync. This is wasteful as 28 | - // the buffer is only used on guest side by the format convertor which converts and copies the 29 | - // buffer into another buffer. 30 | - //addParameter(DefineParam(mInputMemoryUsage, C2_PARAMKEY_INPUT_STREAM_USAGE) 31 | - // .withConstValue(new C2StreamUsageTuning::input( 32 | - // 0u, static_cast(BufferUsage::VIDEO_ENCODER))) 33 | - // .build()); 34 | + addParameter(DefineParam(mInputMemoryUsage, C2_PARAMKEY_INPUT_STREAM_USAGE) 35 | + .withConstValue(new C2StreamUsageTuning::input( 36 | + 0u, static_cast(BufferUsage::VIDEO_ENCODER))) 37 | + .build()); 38 | + 39 | + addParameter(DefineParam(mInputMemoryUsage, C2_PARAMKEY_OUTPUT_STREAM_USAGE) 40 | + .withConstValue(new C2StreamUsageTuning::input( 41 | + 0u, static_cast(BufferUsage::VIDEO_ENCODER))) 42 | + .build()); 43 | 44 | addParameter( 45 | DefineParam(mOutputFormat, C2_PARAMKEY_OUTPUT_STREAM_BUFFER_TYPE) 46 | -- 47 | 2.39.2 48 | 49 | -------------------------------------------------------------------------------- /patches-aosp/external/v4l2_codec2/0007-v4l2_codec2-Increase-maximum-frame-rate-to-60FPS.patch: -------------------------------------------------------------------------------- 1 | From 16c04660aaee31877ca5e87eb706758e59b7fd8b Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Mon, 2 Oct 2023 01:58:46 +0300 4 | Subject: [PATCH 07/11] v4l2_codec2: Increase maximum frame rate to 60FPS 5 | 6 | We want screen capture to have more than 30FPS. 7 | 8 | Change-Id: I169a40be12bd4fb69285df79dca8b55db0fb07f2 9 | Signed-off-by: Roman Stratiienko 10 | --- 11 | common/V4L2Device.cpp | 2 +- 12 | 1 file changed, 1 insertion(+), 1 deletion(-) 13 | 14 | diff --git a/common/V4L2Device.cpp b/common/V4L2Device.cpp 15 | index 68a9dca..b3d3679 100644 16 | --- a/common/V4L2Device.cpp 17 | +++ b/common/V4L2Device.cpp 18 | @@ -1850,7 +1850,7 @@ V4L2Device::SupportedEncodeProfiles V4L2Device::enumerateSupportedEncodeProfiles 19 | 20 | for (const auto& pixelformat : supportedPixelformats) { 21 | SupportedEncodeProfile profile; 22 | - profile.max_framerate_numerator = 30; 23 | + profile.max_framerate_numerator = 60; 24 | profile.max_framerate_denominator = 1; 25 | ui::Size minResolution; 26 | getSupportedResolution(pixelformat, &minResolution, &profile.max_resolution); 27 | -- 28 | 2.39.2 29 | 30 | -------------------------------------------------------------------------------- /patches-aosp/external/v4l2_codec2/0008-HACK-v4l2_codec2-Allow-format-converter-initializati.patch: -------------------------------------------------------------------------------- 1 | From 3972306731a17a468a89afbc6829b0b92907b7b1 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Mon, 2 Oct 2023 02:15:11 +0300 4 | Subject: [PATCH 08/11] HACK: v4l2_codec2: Allow format converter 5 | initialization to fail 6 | 7 | We do not need any format converters. 8 | We want zero-copy - to display the buffer as is. 9 | 10 | Change-Id: Ibb4e6b9df370dcba53b15b24fb9f503f6e1608b4 11 | Signed-off-by: Roman Stratiienko 12 | --- 13 | components/V4L2EncodeComponent.cpp | 2 +- 14 | 1 file changed, 1 insertion(+), 1 deletion(-) 15 | 16 | diff --git a/components/V4L2EncodeComponent.cpp b/components/V4L2EncodeComponent.cpp 17 | index c2a2679..b17488b 100644 18 | --- a/components/V4L2EncodeComponent.cpp 19 | +++ b/components/V4L2EncodeComponent.cpp 20 | @@ -677,7 +677,7 @@ bool V4L2EncodeComponent::initializeEncoder() { 21 | V4L2Encoder::kInputBufferCount, mEncoder->codedSize()); 22 | if (!mInputFormatConverter) { 23 | ALOGE("Failed to created input format convertor"); 24 | - return false; 25 | + //return false; 26 | } 27 | 28 | return true; 29 | -- 30 | 2.39.2 31 | 32 | -------------------------------------------------------------------------------- /patches-aosp/external/v4l2_codec2/0009-v4l2_codec2-encoder-Don-t-advertise-BITRATE_CONST.patch: -------------------------------------------------------------------------------- 1 | From fb3644c873f60638f614eba8e8dc7109c08032c9 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Mon, 2 Oct 2023 02:44:44 +0300 4 | Subject: [PATCH 09/11] v4l2_codec2/encoder: Don't advertise BITRATE_CONST 5 | 6 | BITRATE_CONST doesn't work properly on RPI4. 7 | 8 | Change-Id: I2e90b2dd9604e8390d16abc336b73a5b8dfdcee4 9 | Signed-off-by: Roman Stratiienko 10 | --- 11 | components/V4L2EncodeInterface.cpp | 4 ++-- 12 | 1 file changed, 2 insertions(+), 2 deletions(-) 13 | 14 | diff --git a/components/V4L2EncodeInterface.cpp b/components/V4L2EncodeInterface.cpp 15 | index 2e65cb8..76bf868 100644 16 | --- a/components/V4L2EncodeInterface.cpp 17 | +++ b/components/V4L2EncodeInterface.cpp 18 | @@ -312,10 +312,10 @@ void V4L2EncodeInterface::Initialize(const C2String& name) { 19 | 20 | addParameter( 21 | DefineParam(mBitrateMode, C2_PARAMKEY_BITRATE_MODE) 22 | - .withDefault(new C2StreamBitrateModeTuning::output(0u, C2Config::BITRATE_CONST)) 23 | + .withDefault(new C2StreamBitrateModeTuning::output(0u, C2Config::BITRATE_VARIABLE)) 24 | .withFields( 25 | {C2F(mBitrateMode, value) 26 | - .oneOf({C2Config::BITRATE_CONST, C2Config::BITRATE_VARIABLE})}) 27 | + .oneOf({C2Config::BITRATE_VARIABLE})}) 28 | .withSetter(Setter::StrictValueWithNoDeps) 29 | .build()); 30 | 31 | -- 32 | 2.39.2 33 | 34 | -------------------------------------------------------------------------------- /patches-aosp/external/v4l2_codec2/0011-RPI4-v4l2_codec2-decoder-Enable-zero-copy-AVC-decodi.patch: -------------------------------------------------------------------------------- 1 | From 0bed1ed5c32a03654362d4c9510878cc3a6c9ede Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Thu, 12 Oct 2023 01:33:39 +0300 4 | Subject: [PATCH 11/11] RPI4: v4l2_codec2/decoder: Enable zero-copy AVC 5 | decoding 6 | 7 | 1. Lower the rank, to override the ffmpeg_codec2. 8 | 2. Keep only NV12. We do not want other formats. 9 | 10 | Change-Id: I091b96dc1286409bb8077866f1d58afd98214721 11 | Signed-off-by: Roman Stratiienko 12 | --- 13 | components/V4L2ComponentStore.cpp | 2 +- 14 | components/V4L2Decoder.cpp | 3 +-- 15 | 2 files changed, 2 insertions(+), 3 deletions(-) 16 | 17 | diff --git a/components/V4L2ComponentStore.cpp b/components/V4L2ComponentStore.cpp 18 | index 4004ce5..7bffff2 100644 19 | --- a/components/V4L2ComponentStore.cpp 20 | +++ b/components/V4L2ComponentStore.cpp 21 | @@ -22,7 +22,7 @@ 22 | 23 | namespace android { 24 | namespace { 25 | -const uint32_t kComponentRank = 0x80; 26 | +const uint32_t kComponentRank = 0x20; 27 | 28 | std::string getMediaTypeFromComponentName(const std::string& name) { 29 | if (name == V4L2ComponentName::kH264Decoder || name == V4L2ComponentName::kH264SecureDecoder || 30 | diff --git a/components/V4L2Decoder.cpp b/components/V4L2Decoder.cpp 31 | index aa59e91..88a6f55 100644 32 | --- a/components/V4L2Decoder.cpp 33 | +++ b/components/V4L2Decoder.cpp 34 | @@ -30,8 +30,7 @@ constexpr size_t kNumExtraOutputBuffers = 4; 35 | // Currently we only support flexible pixel 420 format YCBCR_420_888 in Android. 36 | // Here is the list of flexible 420 format. 37 | constexpr std::initializer_list kSupportedOutputFourccs = { 38 | - Fourcc::YU12, Fourcc::YV12, Fourcc::YM12, Fourcc::YM21, 39 | - Fourcc::NV12, Fourcc::NV21, Fourcc::NM12, Fourcc::NM21, 40 | + Fourcc::NV12, 41 | }; 42 | 43 | uint32_t VideoCodecToV4L2PixFmt(VideoCodec codec) { 44 | -- 45 | 2.39.2 46 | 47 | -------------------------------------------------------------------------------- /patches-aosp/external/wpa_supplicant_8/0001-Add-netlink-public-header-library.patch: -------------------------------------------------------------------------------- 1 | From 13fed80854c281cc7eaf78e5848b10f5becb947a Mon Sep 17 00:00:00 2001 2 | From: Jooyung Han 3 | Date: Tue, 26 Jul 2022 12:56:00 +0900 4 | Subject: [PATCH 1/3] Add netlink public header library 5 | 6 | libwifi-hal-bcm has been using the header via LOCAL_C_INCLUDES. To 7 | convert libwifi-hal-bcm into a Soong module, the header is exposed as a 8 | header lib. 9 | 10 | Bug: 239984067 11 | Test: m libwifi-hal-bcm 12 | Merged-In: I92e044565b291c003cff9ac580dd36299fab9851 13 | Change-Id: I92e044565b291c003cff9ac580dd36299fab9851 14 | (cherry picked from commit eb043d58c236676a019ff8579d46b06f83a6daa1) 15 | --- 16 | Android.bp | 8 ++++++++ 17 | 1 file changed, 8 insertions(+) 18 | 19 | diff --git a/Android.bp b/Android.bp 20 | index cbb1a90f..35cdb4f5 100644 21 | --- a/Android.bp 22 | +++ b/Android.bp 23 | @@ -26,3 +26,11 @@ license { 24 | ], 25 | license_text: ["LICENSE"], 26 | } 27 | + 28 | +cc_library_headers { 29 | + name: "libnetlink_iface_headers", 30 | + vendor_available: true, 31 | + export_include_dirs: [ 32 | + "src/drivers", 33 | + ], 34 | +} 35 | -- 36 | 2.39.2 37 | 38 | -------------------------------------------------------------------------------- /patches-aosp/external/wpa_supplicant_8/0002-Decalre-a-soong-module-for-hostapd-manifest.patch: -------------------------------------------------------------------------------- 1 | From c5ccabd03d222c26b8a255f3e4c9b5ec3a002270 Mon Sep 17 00:00:00 2001 2 | From: Jeongik Cha 3 | Date: Fri, 18 Nov 2022 15:09:34 +0900 4 | Subject: [PATCH 2/3] Decalre a soong module for hostapd manifest 5 | 6 | Bug: 202992812 7 | Bug: 259516259 8 | Test: build 9 | Change-Id: Ibc2b7a0d66f6c07660dee96a6a3f7976687ce18e 10 | --- 11 | hostapd/Android.bp | 6 ++++++ 12 | 1 file changed, 6 insertions(+) 13 | 14 | diff --git a/hostapd/Android.bp b/hostapd/Android.bp 15 | index 2a252080..3194d369 100644 16 | --- a/hostapd/Android.bp 17 | +++ b/hostapd/Android.bp 18 | @@ -318,3 +318,9 @@ filegroup { 19 | ], 20 | 21 | } 22 | + 23 | +// This manifest can used by a vendor apex module for hostapd as well. 24 | +filegroup { 25 | + name: "android.hardware.wifi.hostapd.xml", 26 | + srcs: ["android.hardware.wifi.hostapd.xml"], 27 | +} 28 | -- 29 | 2.39.2 30 | 31 | -------------------------------------------------------------------------------- /patches-aosp/external/wpa_supplicant_8/0005-Convert-hostapd-to-soong.patch: -------------------------------------------------------------------------------- 1 | From 69b3b3981b106b5d54d33a75bbf37008dbe7a24e Mon Sep 17 00:00:00 2001 2 | From: Deyao Ren 3 | Date: Tue, 21 May 2024 04:31:18 +0000 4 | Subject: [PATCH 5/5] Convert hostapd to soong 5 | 6 | Cuttlefish uses wpa_supplicant apex 7 | 8 | Bug: 295805441 9 | Test: CtsWifiTestCases 10 | Change-Id: Ic89e4a74e9c76b80146b614d740e381b9438b25b 11 | --- 12 | wpa_supplicant/wpa_supplicant/Android.bp | 12 ++++++++++-- 13 | 1 file changed, 10 insertions(+), 2 deletions(-) 14 | 15 | diff --git a/wpa_supplicant/wpa_supplicant/Android.bp b/wpa_supplicant/wpa_supplicant/Android.bp 16 | index b70e5b92..3f76ae85 100644 17 | --- a/wpa_supplicant/wpa_supplicant/Android.bp 18 | +++ b/wpa_supplicant/wpa_supplicant/Android.bp 19 | @@ -39,8 +39,8 @@ wifi_cc_defaults { 20 | conditions_default: { 21 | static_libs: ["lib_driver_cmd_fallback"], 22 | }, 23 | - } 24 | - } 25 | + }, 26 | + }, 27 | } 28 | 29 | cc_binary { 30 | @@ -50,3 +50,11 @@ cc_binary { 31 | "lib_vendor_wpa_supplicant", 32 | ], 33 | } 34 | + 35 | +cc_binary { 36 | + name: "hostapd", 37 | + defaults: [ 38 | + "hostapd_defaults", 39 | + "lib_vendor_wpa_supplicant", 40 | + ], 41 | +} 42 | -- 43 | 2.43.0 44 | 45 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/bootloader/u-boot/0001-GLODROID-Reduce-boot-delay-countdown-timer-from-1S-t.patch: -------------------------------------------------------------------------------- 1 | From d8087e12e3f4cab3287c5e64686ab2509721368e Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Sat, 25 Nov 2023 08:25:11 +0200 4 | Subject: [PATCH 1/5] GLODROID: Reduce boot delay countdown timer from 1S to 5 | 100uS 6 | 7 | Signed-off-by: Roman Stratiienko 8 | --- 9 | common/autoboot.c | 4 ++-- 10 | 1 file changed, 2 insertions(+), 2 deletions(-) 11 | 12 | diff --git a/common/autoboot.c b/common/autoboot.c 13 | index 898a57bc92..85ea59ac85 100644 14 | --- a/common/autoboot.c 15 | +++ b/common/autoboot.c 16 | @@ -389,7 +389,7 @@ static int abortboot_single_key(int bootdelay) 17 | 18 | while ((bootdelay > 0) && (!abort)) { 19 | --bootdelay; 20 | - /* delay 1000 ms */ 21 | + /* delay 100 ms */ 22 | ts = get_timer(0); 23 | do { 24 | if (tstc()) { /* we got a key press */ 25 | @@ -403,7 +403,7 @@ static int abortboot_single_key(int bootdelay) 26 | break; 27 | } 28 | udelay(10000); 29 | - } while (!abort && get_timer(ts) < 1000); 30 | + } while (!abort && get_timer(ts) < 100); 31 | 32 | printf("\b\b\b%2d ", bootdelay); 33 | } 34 | -- 35 | 2.43.0 36 | 37 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/bootloader/u-boot/0002-abootcmd-Add-load-subcommand.patch: -------------------------------------------------------------------------------- 1 | From 03b408e5e58e39bd70fafd96642bfdf1fc8c6f11 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Wed, 22 Nov 2023 17:42:31 +0200 4 | Subject: [PATCH 2/5] abootcmd: Add load subcommand 5 | 6 | What it does: 7 | 1. Allocates the memory in HEAP to fit the partition 8 | 2. Loads partition into memory. In the following patch of this series, 9 | loading will be optimized to avoid loading an empty space. 10 | 3. Sets buffer start and buffer size value into environment variables 11 | abootimg__ptr and abootimg__size, respectively. 12 | and duplicate them as 13 | abootimg___ptr and abootimg___size. 14 | The latter two are needed to access by the AVB get_preloaded_partition. 15 | (see the next patch). 16 | 17 | Before this command, the boot script developer was responsible for 18 | allocating the memory manually by choosing the start and the end, 19 | which is far from good. 20 | 21 | Usage example: 22 | 23 | abootcmd load mmc 0 boot a 24 | 25 | Signed-off-by: Roman Stratiienko 26 | --- 27 | cmd/abootimg.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++- 28 | 1 file changed, 83 insertions(+), 1 deletion(-) 29 | 30 | diff --git a/cmd/abootimg.c b/cmd/abootimg.c 31 | index ae7a1a7c83..923c66d2a7 100644 32 | --- a/cmd/abootimg.c 33 | +++ b/cmd/abootimg.c 34 | @@ -7,7 +7,9 @@ 35 | #include 36 | #include 37 | #include 38 | +#include 39 | #include 40 | +#include 41 | 42 | #define abootimg_addr() \ 43 | (_abootimg_addr == -1 ? image_load_addr : _abootimg_addr) 44 | @@ -268,10 +270,81 @@ static int do_abootimg_dump(struct cmd_tbl *cmdtp, int flag, int argc, 45 | return CMD_RET_SUCCESS; 46 | } 47 | 48 | +static int do_abootimg_load(struct cmd_tbl *cmdtp, int flag, int argc, 49 | + char *const argv[]) 50 | +{ 51 | + int time_start = get_timer(0); 52 | + struct blk_desc *desc; 53 | + struct disk_partition info; 54 | + char buf[512] = { 0 }; 55 | + void *addr; 56 | + int ret; 57 | + 58 | + if (argc < 4) 59 | + return CMD_RET_USAGE; 60 | + if (argc > 5) 61 | + return CMD_RET_USAGE; 62 | + 63 | + ret = blk_get_device_by_str(argv[1], argv[2], &desc); 64 | + if (ret < 0) { 65 | + printf("Error: Failed to get device %s %s\n", argv[1], argv[2]); 66 | + return CMD_RET_FAILURE; 67 | + } 68 | + 69 | + if (argc == 5) 70 | + sprintf(buf, "%s_%s", argv[3], argv[4]); 71 | + else 72 | + sprintf(buf, "%s", argv[3]); 73 | + 74 | + ret = part_get_info_by_name(desc, buf, &info); 75 | + if (ret < 0) { 76 | + printf("Error: Failed to get partition %s\n", buf); 77 | + return CMD_RET_FAILURE; 78 | + } 79 | + 80 | + addr = (void *)memalign(4096, info.size * info.blksz); 81 | + if (!addr) { 82 | + printf("Error: Failed to allocate memory\n"); 83 | + return CMD_RET_FAILURE; 84 | + } 85 | + 86 | + ret = blk_dread(desc, info.start, info.size, addr); 87 | + if (ret < 0) { 88 | + printf("Error: Failed to read partition %s\n", buf); 89 | + goto fail; 90 | + } 91 | + 92 | + sprintf(buf, "abootimg_%s_ptr", argv[3]); 93 | + env_set_hex(buf, (ulong)addr); 94 | + 95 | + sprintf(buf, "abootimg_%s_size", argv[3]); 96 | + env_set_hex(buf, info.size * info.blksz); 97 | + 98 | + if (argc == 5) { 99 | + sprintf(buf, "abootimg_%s_%s_ptr", argv[3], argv[4]); 100 | + env_set_hex(buf, (ulong)addr); 101 | + 102 | + sprintf(buf, "abootimg_%s_%s_size", argv[3], argv[4]); 103 | + env_set_hex(buf, info.size * info.blksz); 104 | + } 105 | + 106 | + int time_end = get_timer(0); 107 | + 108 | + printf("Loaded '%s' partition to address 0x%p (size: 0x%x) in %lu ms\n", 109 | + argv[3], addr, info.size * info.blksz, time_end - time_start); 110 | + 111 | + return CMD_RET_SUCCESS; 112 | + 113 | +fail: 114 | + free(addr); 115 | + return CMD_RET_FAILURE; 116 | +} 117 | + 118 | static struct cmd_tbl cmd_abootimg_sub[] = { 119 | U_BOOT_CMD_MKENT(addr, 4, 1, do_abootimg_addr, "", ""), 120 | U_BOOT_CMD_MKENT(dump, 2, 1, do_abootimg_dump, "", ""), 121 | U_BOOT_CMD_MKENT(get, 5, 1, do_abootimg_get, "", ""), 122 | + U_BOOT_CMD_MKENT(load, 5, 1, do_abootimg_load, "", ""), 123 | }; 124 | 125 | static int do_abootimg(struct cmd_tbl *cmdtp, int flag, int argc, 126 | @@ -314,5 +387,14 @@ U_BOOT_CMD( 127 | " - get address and size (hex) of DT blob in the image by index\n" 128 | " : index number of desired DT blob in DTB area\n" 129 | " [addr_var]: variable name to contain DT blob address\n" 130 | - " [size_var]: variable name to contain DT blob size" 131 | + " [size_var]: variable name to contain DT blob size\n" 132 | + "abootimg load interface dev partition [slot_name]\n" 133 | + " - load boot image from device partition\n" 134 | + " memory is allocated in heap\n" 135 | + " address is stored in $abootimg__ptr\n" 136 | + " size is stored in $abootimg__size\n" 137 | + " interface: interface type (e.g. mmc, usb)\n" 138 | + " dev: device number (e.g. 0, 1)\n" 139 | + " partition: partition number (e.g. boot, dtb)\n" 140 | + " slot_suffix: slot name (e.g. a, b)" 141 | ); 142 | -- 143 | 2.43.0 144 | 145 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/bootloader/u-boot/0003-avb-Implement-get_preloaded_partition-callback.patch: -------------------------------------------------------------------------------- 1 | From 5a03526bee926dcfac959e4ddcc5f2b9c02a68cf Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Thu, 23 Nov 2023 03:47:48 +0200 4 | Subject: [PATCH 3/5] avb: Implement get_preloaded_partition callback 5 | 6 | AVB can reuse already loaded images instead of loading them 7 | from the disk. 8 | 9 | The get_preloaded_partition now looks for the env. variables 10 | set by the 'abootimg load' to find the correct partition in RAM. 11 | 12 | Signed-off-by: Roman Stratiienko 13 | --- 14 | common/avb_verify.c | 53 +++++++++++++++++++++++++++++++++++++++++++++ 15 | 1 file changed, 53 insertions(+) 16 | 17 | diff --git a/common/avb_verify.c b/common/avb_verify.c 18 | index cff9117d92..d2626e8844 100644 19 | --- a/common/avb_verify.c 20 | +++ b/common/avb_verify.c 21 | @@ -6,6 +6,7 @@ 22 | #include 23 | #include 24 | #include 25 | +#include 26 | #include 27 | #include 28 | #include 29 | @@ -595,6 +596,55 @@ static AvbIOResult read_from_partition(AvbOps *ops, 30 | num_bytes, buffer, out_num_read, IO_READ); 31 | } 32 | 33 | +#ifdef CONFIG_ANDROID_BOOT_IMAGE 34 | +/** 35 | + * get_preloaded_partition() - Gets the starting pointer of a partition that 36 | + * is pre-loaded in memory, and save it to |out_pointer|. 37 | + * 38 | + * If the partition is not pre-loaded in memory, the out_pointer shall not be 39 | + * modified. 40 | + * 41 | + * @ops: contains AVB ops handlers 42 | + * @partition: partition name, NUL-terminated UTF-8 string 43 | + * @num_bytes: amount of bytes to read 44 | + * @out_pointer: pointer to the starting address of the partition 45 | + * @out_num_bytes_preloaded: amount of bytes pre-loaded in memory 46 | + * 47 | + * @return: 48 | + * AVB_IO_RESULT_OK, if partition was found or was not found 49 | + * 50 | + */ 51 | +static AvbIOResult get_preloaded_partition(AvbOps *ops, const char *partition, size_t num_bytes, 52 | + uint8_t **out_pointer, size_t *out_num_bytes_preloaded) 53 | +{ 54 | + size_t partition_start = 0; 55 | + size_t partition_size = 0; 56 | + char env_name[64]; 57 | + 58 | + sprintf(env_name, "abootimg_%s_ptr", partition); 59 | + partition_start = env_get_hex(env_name, 0); 60 | + 61 | + sprintf(env_name, "abootimg_%s_size", partition); 62 | + partition_size = env_get_hex(env_name, 0); 63 | + 64 | + if (partition_start == 0 || partition_size == 0) 65 | + return AVB_IO_RESULT_OK; 66 | + 67 | + if (partition_size < num_bytes) { 68 | + printf("AVB: Preloaded partition %s size %zu is smaller than requested %zu\n", 69 | + partition, partition_size, num_bytes); 70 | + return AVB_IO_RESULT_ERROR_IO; 71 | + } 72 | + 73 | + *out_pointer = (uint8_t *)partition_start; 74 | + *out_num_bytes_preloaded = partition_size; 75 | + 76 | + printf("AVB: Using preloaded partition %s at %p\n", partition, *out_pointer); 77 | + 78 | + return AVB_IO_RESULT_OK; 79 | +} 80 | +#endif 81 | + 82 | /** 83 | * write_to_partition() - writes N bytes to a partition identified by a string 84 | * name 85 | @@ -1043,6 +1093,9 @@ AvbOps *avb_ops_alloc(int boot_device) 86 | ops_data->ops.user_data = ops_data; 87 | 88 | ops_data->ops.read_from_partition = read_from_partition; 89 | +#ifdef CONFIG_ANDROID_BOOT_IMAGE 90 | + ops_data->ops.get_preloaded_partition = get_preloaded_partition; 91 | +#endif 92 | ops_data->ops.write_to_partition = write_to_partition; 93 | ops_data->ops.validate_vbmeta_public_key = validate_vbmeta_public_key; 94 | ops_data->ops.read_rollback_index = read_rollback_index; 95 | -- 96 | 2.43.0 97 | 98 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/bootloader/u-boot/0005-Revert-boot-android-Provide-vendor_bootimg_addr-in-b.patch: -------------------------------------------------------------------------------- 1 | From cb97edef9ed9cbebc35f5ac8b296cd2a04f409da Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Mon, 9 Dec 2024 23:50:19 +0200 4 | Subject: [PATCH 5/5] Revert "boot: android: Provide vendor_bootimg_addr in 5 | boot_get_fdt()" 6 | 7 | This conflicts with GloDroid bootscript boot logic. 8 | 9 | This reverts commit 58fed99f46115fe8547e7978fa361bbbbb3f3b50. 10 | --- 11 | boot/image-android.c | 5 ----- 12 | boot/image-fdt.c | 2 +- 13 | 2 files changed, 1 insertion(+), 6 deletions(-) 14 | 15 | diff --git a/boot/image-android.c b/boot/image-android.c 16 | index e1b73fc5bb..ae958fd97b 100644 17 | --- a/boot/image-android.c 18 | +++ b/boot/image-android.c 19 | @@ -57,11 +57,6 @@ static ulong add_trailer(ulong bootconfig_start_addr, ulong bootconfig_size) 20 | return BOOTCONFIG_TRAILER_SIZE; 21 | } 22 | 23 | -__weak ulong get_avendor_bootimg_addr(void) 24 | -{ 25 | - return -1; 26 | -} 27 | - 28 | static void android_boot_image_v3_v4_parse_hdr(const struct andr_boot_img_hdr_v3 *hdr, 29 | struct andr_image_data *data) 30 | { 31 | diff --git a/boot/image-fdt.c b/boot/image-fdt.c 32 | index 3d5b6f9e2d..bb1ac0052c 100644 33 | --- a/boot/image-fdt.c 34 | +++ b/boot/image-fdt.c 35 | @@ -498,7 +498,7 @@ int boot_get_fdt(void *buf, const char *select, uint arch, 36 | * Firstly check if this android boot image has dtb field. 37 | */ 38 | dtb_idx = (u32)env_get_ulong("adtb_idx", 10, 0); 39 | - if (android_image_get_dtb_by_index((ulong)hdr, get_avendor_bootimg_addr(), 40 | + if (android_image_get_dtb_by_index((ulong)hdr, 0, 41 | dtb_idx, &fdt_addr, &fdt_size)) { 42 | fdt_blob = (char *)map_sysmem(fdt_addr, 0); 43 | if (fdt_check_header(fdt_blob)) 44 | -- 45 | 2.43.0 46 | 47 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/configuration/0002-Disable-AVB.patch: -------------------------------------------------------------------------------- 1 | From c98966803edd89928396db3e633a729f7e512158 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Tue, 4 Apr 2023 22:07:21 +0300 4 | Subject: [PATCH 2/5] Disable AVB 5 | 6 | Reduces boot time. 7 | 8 | Signed-off-by: Roman Stratiienko 9 | --- 10 | platform/fstab/fstab.cpp | 10 +++++----- 11 | platform/uboot/bootscript.cpp | 8 +------- 12 | 2 files changed, 6 insertions(+), 12 deletions(-) 13 | 14 | diff --git a/platform/fstab/fstab.cpp b/platform/fstab/fstab.cpp 15 | index a514344..722b70f 100644 16 | --- a/platform/fstab/fstab.cpp 17 | +++ b/platform/fstab/fstab.cpp 18 | @@ -11,11 +11,11 @@ 19 | #define __FILE_ENCRYPT__ fileencryption=aes-256-xts:aes-256-cts 20 | #endif 21 | 22 | -system /system ext4 ro,barrier=1 wait,first_stage_mount,logical,slotselect,avb=vbmeta_system,avb_keys=/avb 23 | -system_ext /system_ext ext4 ro,barrier=1 wait,first_stage_mount,logical,slotselect,avb=vbmeta_system 24 | -product /product ext4 ro,barrier=1 wait,first_stage_mount,logical,slotselect,avb=vbmeta_system 25 | -vendor /vendor ext4 ro,barrier=1 wait,first_stage_mount,logical,slotselect,avb=vbmeta 26 | -vendor_dlkm /vendor_dlkm ext4 ro,noatime,errors=panic wait,first_stage_mount,logical,slotselect,avb=vbmeta 27 | +system /system ext4 ro,barrier=1 wait,first_stage_mount,logical,slotselect 28 | +system_ext /system_ext ext4 ro,barrier=1 wait,first_stage_mount,logical,slotselect 29 | +product /product ext4 ro,barrier=1 wait,first_stage_mount,logical,slotselect 30 | +vendor /vendor ext4 ro,barrier=1 wait,first_stage_mount,logical,slotselect 31 | +vendor_dlkm /vendor_dlkm ext4 ro,noatime,errors=panic wait,first_stage_mount,logical,slotselect 32 | 33 | /dev/block/by-name/misc /misc emmc defaults defaults 34 | 35 | diff --git a/platform/uboot/bootscript.cpp b/platform/uboot/bootscript.cpp 36 | index a1e2537..79001b1 100644 37 | --- a/platform/uboot/bootscript.cpp 38 | +++ b/platform/uboot/bootscript.cpp 39 | @@ -148,13 +148,7 @@ FUNC_BEGIN(bootcmd_block) 40 | abootimg load mmc \$mmc_bootdev init_boot \${slot_name} 41 | abootimg load mmc \$mmc_bootdev vendor_boot \${slot_name} 42 | 43 | - if test STRESC(\$androidrecovery) = STRESC("true"); 44 | - then 45 | - /* Always unlock device for fastbootd and recovery modes, otherwise fastbootd flashing won't work. TODO: Support conditional lock/unlock */ 46 | - EXTENV(bootargs, " androidboot.verifiedbootstate=orange "); 47 | - else 48 | - run bootcmd_avb; 49 | - fi; 50 | + EXTENV(bootargs, " androidboot.verifiedbootstate=orange "); 51 | FUNC_END() 52 | 53 | FUNC_BEGIN(rename_and_expand_userdata_placeholder) 54 | -- 55 | 2.39.2 56 | 57 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/configuration/0003-bootscript-Disable-uart-logging.patch: -------------------------------------------------------------------------------- 1 | From d9c3b3101d1dd48437d790c8624d2153d432c844 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Tue, 4 Apr 2023 22:06:44 +0300 4 | Subject: [PATCH 3/5] bootscript: Disable uart logging 5 | 6 | Improves boot time significantly. 7 | 8 | Signed-off-by: Roman Stratiienko 9 | --- 10 | platform/uboot/bootscript.cpp | 2 +- 11 | 1 file changed, 1 insertion(+), 1 deletion(-) 12 | 13 | diff --git a/platform/uboot/bootscript.cpp b/platform/uboot/bootscript.cpp 14 | index 79001b1..e9fa198 100644 15 | --- a/platform/uboot/bootscript.cpp 16 | +++ b/platform/uboot/bootscript.cpp 17 | @@ -46,7 +46,7 @@ EXTENV(partitions, ";name=userdata,size=-,uuid=\${uuid_gpt_userdata}") 18 | setenv bootargs " init=/init rootwait ro androidboot.boottime=223.708 androidboot.selinux=permissive" 19 | EXTENV(bootargs, " androidboot.revision=1.0 androidboot.board_id=0x1234567 androidboot.serialno=${serial#}") 20 | EXTENV(bootargs, " firmware_class.path=/vendor/etc/firmware") 21 | -EXTENV(bootargs, " ${debug_bootargs} printk.devkmsg=on") 22 | +EXTENV(bootargs, " ${debug_bootargs} printk.devkmsg=on quiet") 23 | 24 | FUNC_BEGIN(enter_fastboot) 25 | #ifdef PRE_ENTER_FASTBOOT 26 | -- 27 | 2.39.2 28 | 29 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/configuration/0004-bootscript-Add-a-hack-to-prevent-the-crash.patch: -------------------------------------------------------------------------------- 1 | From cf2e1ec62e291b049feb107e300ad8a8372e6563 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Sun, 3 Dec 2023 18:05:09 +0200 4 | Subject: [PATCH 4/5] bootscript: Add a hack to prevent the crash 5 | 6 | The kernel crashes during boot. But if you try to investigate it and add an 7 | UART logging, it appears that any change of cmdline size fixes the issue. 8 | 9 | No time for digging into it, so fix it by extending the kcmdline. 10 | 11 | HERE IS THE FAIL: 12 | 13 | Working FDT set to 2eff2700 14 | Uncompressing Kernel Image 15 | Using Device Tree in place at 000000002eff2700, end 000000002f002fe3 16 | Working FDT set to 2eff2700 17 | 18 | Starting kernel ... 19 | 20 | "Synchronous Abort" handler, esr 0x96000044, far 0x692f3d74696e6938 21 | elr: 00000000000a8778 lr : 00000000000b30b8 (reloc) 22 | elr: 000000003b356778 lr : 000000003b3610b8 23 | x0 : 0000000000000000 x1 : 00000000000002a0 24 | x2 : 000000003b3cd000 x3 : 692f3d74696e6920 25 | x4 : 0000000032339790 x5 : 746f6f722074696e 26 | x6 : 000000003b3cdba8 x7 : 000000003b3cdbb8 27 | x8 : 0000000032339a30 x9 : 0000000000000007 28 | x10: 0000000000000004 x11: 000000003ebdac20 29 | x12: 0000000000000001 x13: 000000003ebdac20 30 | x14: 0000000000000000 x15: 0000000000000004 31 | x16: 0000000000000000 x17: 0000000000000000 32 | x18: 0000000032329d60 x19: 0000000032339be0 33 | x20: 0000000000000000 x21: 00000000323357c0 34 | x22: 0000000000000000 x23: 0000000000004600 35 | x24: 00000000ffffff7f x25: 00000000323381d8 36 | x26: 000000003b3d1550 x27: 0000000000000005 37 | x28: 00000000323f2000 x29: 000000003231b1e0 38 | 39 | Signed-off-by: Roman Stratiienko 40 | --- 41 | platform/uboot/bootscript.cpp | 2 +- 42 | 1 file changed, 1 insertion(+), 1 deletion(-) 43 | 44 | diff --git a/platform/uboot/bootscript.cpp b/platform/uboot/bootscript.cpp 45 | index e9fa198..1e78b18 100644 46 | --- a/platform/uboot/bootscript.cpp 47 | +++ b/platform/uboot/bootscript.cpp 48 | @@ -46,7 +46,7 @@ EXTENV(partitions, ";name=userdata,size=-,uuid=\${uuid_gpt_userdata}") 49 | setenv bootargs " init=/init rootwait ro androidboot.boottime=223.708 androidboot.selinux=permissive" 50 | EXTENV(bootargs, " androidboot.revision=1.0 androidboot.board_id=0x1234567 androidboot.serialno=${serial#}") 51 | EXTENV(bootargs, " firmware_class.path=/vendor/etc/firmware") 52 | -EXTENV(bootargs, " ${debug_bootargs} printk.devkmsg=on quiet") 53 | +EXTENV(bootargs, " ${debug_bootargs} printk.devkmsg=on quiet androidboot.workaround=is_here") 54 | 55 | FUNC_BEGIN(enter_fastboot) 56 | #ifdef PRE_ENTER_FASTBOOT 57 | -- 58 | 2.39.2 59 | 60 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/configuration/0005-kernel-Fix-compilation-errors-on-some-Linux-distribu.patch: -------------------------------------------------------------------------------- 1 | From 4a0b118a1b8e4bbeb9e0395954c0e1ede58bfd90 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Fri, 18 Oct 2024 23:34:39 +0300 4 | Subject: [PATCH 5/9] kernel: Fix compilation errors on some Linux 5 | distributions 6 | 7 | Using the /etc/environment to obtain the path works on Ubuntu, but it 8 | does not work for some Linux distros. Use out/.path_interposer_origpath 9 | instead. 10 | 11 | Signed-off-by: Roman Stratiienko 12 | --- 13 | platform/kernel/kernel.mk | 2 +- 14 | 1 file changed, 1 insertion(+), 1 deletion(-) 15 | 16 | diff --git a/platform/kernel/kernel.mk b/platform/kernel/kernel.mk 17 | index bc68a59..72f22f8 100644 18 | --- a/platform/kernel/kernel.mk 19 | +++ b/platform/kernel/kernel.mk 20 | @@ -57,7 +57,7 @@ $(KERNEL_TARGET): $(KERNEL_DEFCONFIG) $(KERNEL_FRAGMENTS) $(KERNEL_SRC_FILES) $( 21 | $(KERNEL_OUT)/project_specific.mk 22 | 23 | # Disable interposer and use LLVM compiler toolchain from AOSP tree 24 | - export ETC$$(cat /etc/environment) && export PATH=$(AOSP_ABSOLUTE_PATH)/$(LLVM_PREBUILTS_PATH):$(RUST_BIN_DIR_ABS):$$ETCPATH:$$PATH && make -C $(KERNEL_OUT) install 25 | + export PATH=$(RUST_BIN_DIR_ABS):$(AOSP_ABSOLUTE_PATH)/$(LLVM_PREBUILTS_PATH):$$(cat $(OUT_DIR)/.path_interposer_origpath) && make -C $(KERNEL_OUT) install 26 | 27 | # Post processing: 28 | 29 | -- 30 | 2.43.0 31 | 32 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/configuration/0007-common-Change-fstab-target-name.patch: -------------------------------------------------------------------------------- 1 | From 6398302f51342d2e389dcf7bd56b3db4b0ad5aa2 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Fri, 25 Oct 2024 12:53:24 +0300 4 | Subject: [PATCH 7/9] common: Change fstab target name 5 | 6 | Otherwise the fstab. won't appear on the partition 7 | due to Android15 new restrictions. 8 | 9 | Signed-off-by: Roman Stratiienko 10 | --- 11 | common/base/device.mk | 2 +- 12 | platform/fstab/fstab.mk | 4 ++-- 13 | 2 files changed, 3 insertions(+), 3 deletions(-) 14 | 15 | diff --git a/common/base/device.mk b/common/base/device.mk 16 | index df473b6..b3a39ec 100644 17 | --- a/common/base/device.mk 18 | +++ b/common/base/device.mk 19 | @@ -50,7 +50,7 @@ PRODUCT_COPY_FILES += \ 20 | $(LOCAL_PATH)/ueventd.common.rc:$(TARGET_COPY_OUT_VENDOR)/etc/ueventd.rc \ 21 | $(LOCAL_PATH)/fstab.zram:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.zram \ 22 | 23 | -PRODUCT_PACKAGES += fstab 24 | +PRODUCT_PACKAGES += fstab.$(TARGET_PRODUCT) 25 | 26 | PRODUCT_COPY_FILES += \ 27 | frameworks/native/data/etc/android.software.opengles.deqp.level-2021-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml 28 | diff --git a/platform/fstab/fstab.mk b/platform/fstab/fstab.mk 29 | index 554b121..f26f08a 100644 30 | --- a/platform/fstab/fstab.mk 31 | +++ b/platform/fstab/fstab.mk 32 | @@ -6,7 +6,7 @@ LOCAL_PATH := $(call my-dir) 33 | 34 | FSTAB_RAW := $(LOCAL_PATH)/fstab.cpp 35 | RECOVERY_FSTAB := $(TARGET_VENDOR_RAMDISK_OUT)/first_stage_ramdisk/fstab.$(TARGET_PRODUCT) 36 | -VENDOR_FSTAB := $(TARGET_OUT_VENDOR)/etc/fstab.$(TARGET_PRODUCT) 37 | +VENDOR_FSTAB := $(TARGET_OUT_VENDOR)/etc/fstab 38 | 39 | TARGET_RECOVERY_FSTAB := $(RECOVERY_FSTAB) 40 | 41 | @@ -21,7 +21,7 @@ include $(CLEAR_VARS) 42 | 43 | # --------------------------------------------------------------------------- 44 | 45 | -LOCAL_MODULE := fstab 46 | +LOCAL_MODULE := fstab.$(TARGET_PRODUCT) 47 | 48 | LOCAL_PROPRIETARY_MODULE := true 49 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/ 50 | -- 51 | 2.43.0 52 | 53 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/configuration/0008-common-init-Remove-duplicate-vold-start-command.patch: -------------------------------------------------------------------------------- 1 | From 00f6277a526f758685dd431f38b4caec15dd11dc Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Fri, 25 Oct 2024 12:55:24 +0300 4 | Subject: [PATCH 8/9] common: init: Remove duplicate vold start command 5 | 6 | Framework's common init.rc already has it. 7 | 8 | Signed-off-by: Roman Stratiienko 9 | --- 10 | common/base/init.common.rc | 3 --- 11 | 1 file changed, 3 deletions(-) 12 | 13 | diff --git a/common/base/init.common.rc b/common/base/init.common.rc 14 | index edced2c..500ff01 100644 15 | --- a/common/base/init.common.rc 16 | +++ b/common/base/init.common.rc 17 | @@ -12,9 +12,6 @@ 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | 21 | -on early-fs 22 | - start vold 23 | - 24 | on fs 25 | mount_all /vendor/etc/fstab.${ro.hardware} --early 26 | 27 | -- 28 | 2.43.0 29 | 30 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/configuration/0009-common-kconfig-Enable-CONFIG_FUSE_BPF.patch: -------------------------------------------------------------------------------- 1 | From 333fa9ba79bd59a9f7f531396110fba294e31087 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Fri, 25 Oct 2024 13:08:33 +0300 4 | Subject: [PATCH 9/9] common: kconfig: Enable CONFIG_FUSE_BPF 5 | 6 | During boot, fuse BPF is loaded. Without the config below, it fails to load. 7 | 8 | Signed-off-by: Roman Stratiienko 9 | --- 10 | platform/kernel/android-extra.config | 3 +++ 11 | 1 file changed, 3 insertions(+) 12 | 13 | diff --git a/platform/kernel/android-extra.config b/platform/kernel/android-extra.config 14 | index 0456463..ee9d502 100644 15 | --- a/platform/kernel/android-extra.config 16 | +++ b/platform/kernel/android-extra.config 17 | @@ -83,3 +83,6 @@ CONFIG_LEDS_CLASS_MULTICOLOR=y 18 | CONFIG_INIT_STACK_ALL_ZERO=y 19 | CONFIG_NFT_FWD_NETDEV=y 20 | CONFIG_NET_ACT_MIRRED=y 21 | + 22 | +# During boot, fuse BPF is loaded. Without the config below, it fails to load. 23 | +CONFIG_FUSE_BPF=y 24 | -- 25 | 2.43.0 26 | 27 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/configuration/0010-common-graphics-Add-dri_gbm-shared-library.patch: -------------------------------------------------------------------------------- 1 | From 5722471b732b3b7f70410eb1f50efa967b57a760 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Mon, 9 Dec 2024 12:59:18 +0200 4 | Subject: [PATCH 10/10] common/graphics: Add dri_gbm shared library 5 | 6 | Required by libgbm on the latest mesa3d. 7 | 8 | Signed-off-by: Roman Stratiienko 9 | --- 10 | common/graphics/device.mk | 1 + 11 | 1 file changed, 1 insertion(+) 12 | 13 | diff --git a/common/graphics/device.mk b/common/graphics/device.mk 14 | index bb01de3..2c83415 100644 15 | --- a/common/graphics/device.mk 16 | +++ b/common/graphics/device.mk 17 | @@ -39,6 +39,7 @@ PRODUCT_PACKAGES += \ 18 | mapper.minigbm_gd.xml \ 19 | libminigbm_gralloc_gd \ 20 | libgbm_mesa_wrapper \ 21 | + dri_gbm \ 22 | 23 | ## 24 | 25 | -- 26 | 2.43.0 27 | 28 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/configuration/0011-bootscript-Account-for-ab_select-command-u-boot-chan.patch: -------------------------------------------------------------------------------- 1 | From 2d8bdcbe358e29aebadfca52fc5659d06710e7e3 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Tue, 10 Dec 2024 00:19:58 +0200 4 | Subject: [PATCH 11/11] bootscript: Account for ab_select command u-boot 5 | changes 6 | 7 | In recent u-boot (2024.10+) ab_select migrated under the bcb umbrella. 8 | 9 | Signed-off-by: Roman Stratiienko 10 | --- 11 | platform/uboot/bootscript.cpp | 4 ++-- 12 | 1 file changed, 2 insertions(+), 2 deletions(-) 13 | 14 | diff --git a/platform/uboot/bootscript.cpp b/platform/uboot/bootscript.cpp 15 | index 1e78b18..acbbdf2 100644 16 | --- a/platform/uboot/bootscript.cpp 17 | +++ b/platform/uboot/bootscript.cpp 18 | @@ -69,7 +69,7 @@ FUNC_BEGIN(enter_fastboot) 19 | FUNC_END() 20 | 21 | FUNC_BEGIN(bootcmd_bcb) 22 | - ab_select slot_name mmc \${mmc_bootdev}#misc --no-dec || run enter_fastboot ; 23 | + bcb ab_select slot_name mmc \${mmc_bootdev}#misc --no-dec || run enter_fastboot ; 24 | 25 | bcb load $mmc_bootdev misc ; 26 | /* Handle $ adb reboot bootloader */ 27 | @@ -82,7 +82,7 @@ FUNC_BEGIN(bootcmd_bcb) 28 | if test STRESC(\${androidrecovery}) != STRESC(true); 29 | then 30 | /* ab_select is used as counter of failed boot attempts. After 14 failed boot attempt fallback to fastboot. */ 31 | - ab_select slot_name mmc \${mmc_bootdev}#misc || run enter_fastboot ; 32 | + bcb ab_select slot_name mmc \${mmc_bootdev}#misc || run enter_fastboot ; 33 | fi; 34 | 35 | FEXTENV(bootargs, " androidboot.slot_suffix=_\$slot_name") ; 36 | -- 37 | 2.43.0 38 | 39 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/configuration/0012-common-Remove-libdav1d.patch: -------------------------------------------------------------------------------- 1 | From 2b5835f56084267bb8addcd7d771f77029a62230 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Mon, 21 Oct 2024 01:41:03 +0300 4 | Subject: [PATCH 3/3] common: Remove libdav1d 5 | 6 | Android-15 (And LOS21) has it embedded into the framework code already. 7 | 8 | Signed-off-by: Roman Stratiienko 9 | --- 10 | common/codecs/board.mk | 3 --- 11 | 1 file changed, 3 deletions(-) 12 | 13 | diff --git a/common/codecs/board.mk b/common/codecs/board.mk 14 | index fed5d9b..7881392 100644 15 | --- a/common/codecs/board.mk 16 | +++ b/common/codecs/board.mk 17 | @@ -6,9 +6,6 @@ 18 | 19 | BCDC_PATH := $(patsubst $(CURDIR)/%,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST))))) 20 | 21 | -BOARD_BUILD_AOSPEXT_DAV1D := true 22 | -BOARD_DAV1D_SRC_DIR := glodroid/vendor/dav1d 23 | - 24 | BOARD_BUILD_AOSPEXT_FFMPEG := true 25 | BOARD_FFMPEG_SRC_DIR := glodroid/vendor/ffmpeg 26 | 27 | -- 28 | 2.43.0 29 | 30 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/configuration/0013-Revert-base-Set-TARGET_FLATTEN_APEX-to-true.patch: -------------------------------------------------------------------------------- 1 | From 1003616f2cfa678f150eb9db3b367d0edebfade0 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Tue, 22 Oct 2024 22:10:37 +0300 4 | Subject: [PATCH 13/19] Revert "base: Set TARGET_FLATTEN_APEX to true" 5 | 6 | This reverts commit 694b6a06734a22e74cb29f9e69e7dc1832c0dcab. 7 | --- 8 | common/base/device.mk | 2 -- 9 | 1 file changed, 2 deletions(-) 10 | 11 | diff --git a/common/base/device.mk b/common/base/device.mk 12 | index b3a39ec..2e78d23 100644 13 | --- a/common/base/device.mk 14 | +++ b/common/base/device.mk 15 | @@ -75,7 +75,5 @@ PRODUCT_PACKAGES += \ 16 | update_verifier \ 17 | update_engine_sideload \ 18 | 19 | -TARGET_FLATTEN_APEX := true 20 | - 21 | # ro.frp.pst points to a partition that contains factory reset protection information. 22 | PRODUCT_VENDOR_PROPERTIES += ro.frp.pst=/dev/block/by-name/frp 23 | -- 24 | 2.43.0 25 | 26 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/configuration/0014-Revert-base-Don-t-use-updatable-apexes.patch: -------------------------------------------------------------------------------- 1 | From f207badcf48dc620c32f406783b13603a496ce4d Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Tue, 22 Oct 2024 22:39:04 +0300 4 | Subject: [PATCH 14/19] Revert "base: Don't use updatable apexes" 5 | 6 | Starting from Android-15 updatable apexes are mandatory. 7 | 8 | This reverts commit 82691324c2c4199a51e866815e18ad223aada7b2. 9 | --- 10 | common/base/device.mk | 3 +++ 11 | 1 file changed, 3 insertions(+) 12 | 13 | diff --git a/common/base/device.mk b/common/base/device.mk 14 | index 2e78d23..45f3137 100644 15 | --- a/common/base/device.mk 16 | +++ b/common/base/device.mk 17 | @@ -18,6 +18,9 @@ ifneq ($(filter $(TARGET_ARCH),arm64 x86_64),) 18 | $(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk) 19 | endif 20 | 21 | +# Enable updating of APEXes 22 | +$(call inherit-product, $(SRC_TARGET_DIR)/product/updatable_apex.mk) 23 | + 24 | # Enable userspace reboot 25 | $(call inherit-product, $(SRC_TARGET_DIR)/product/userspace_reboot.mk) 26 | 27 | -- 28 | 2.43.0 29 | 30 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/configuration/0015-common-Set-BUILD_BROKEN_INCORRECT_PARTITION_IMAGES.patch: -------------------------------------------------------------------------------- 1 | From 87155112b9311c764dca402907a636ef05a30d76 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Fri, 25 Oct 2024 12:51:52 +0300 4 | Subject: [PATCH 15/19] common: Set BUILD_BROKEN_INCORRECT_PARTITION_IMAGES 5 | 6 | Android-15 requires a make target for every file on the partition. 7 | We're not ready for this change yet. 8 | 9 | Signed-off-by: Roman Stratiienko 10 | --- 11 | common/base/board.mk | 3 +++ 12 | 1 file changed, 3 insertions(+) 13 | 14 | diff --git a/common/base/board.mk b/common/base/board.mk 15 | index 9cc11e8..bd7c63e 100644 16 | --- a/common/base/board.mk 17 | +++ b/common/base/board.mk 18 | @@ -178,3 +178,6 @@ BOARD_USES_GLODROID_MAKE_TARGETS := true 19 | BOARD_BUILD_GLODROID_KERNEL := true 20 | 21 | RUST_BIN_DIR := prebuilts/rust/linux-x86/1.68.0/bin 22 | + 23 | +# vendor_dlkm is not yet ready for files filtering 24 | +BUILD_BROKEN_INCORRECT_PARTITION_IMAGES := true 25 | -- 26 | 2.43.0 27 | 28 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/configuration/0016-common-Add-bootcrtl-apex.patch: -------------------------------------------------------------------------------- 1 | From f2b52322ff2e124c97c3a508e706eb99e60bd1fb Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Fri, 25 Oct 2024 12:54:42 +0300 4 | Subject: [PATCH 16/19] common: Add bootcrtl apex 5 | 6 | If missing, the update_verifier triggers a boot loop. 7 | 8 | Signed-off-by: Roman Stratiienko 9 | --- 10 | common/base/device.mk | 1 + 11 | 1 file changed, 1 insertion(+) 12 | 13 | diff --git a/common/base/device.mk b/common/base/device.mk 14 | index 45f3137..e3e6200 100644 15 | --- a/common/base/device.mk 16 | +++ b/common/base/device.mk 17 | @@ -77,6 +77,7 @@ PRODUCT_PACKAGES += \ 18 | update_engine_client \ 19 | update_verifier \ 20 | update_engine_sideload \ 21 | + com.android.hardware.boot \ 22 | 23 | # ro.frp.pst points to a partition that contains factory reset protection information. 24 | PRODUCT_VENDOR_PROPERTIES += ro.frp.pst=/dev/block/by-name/frp 25 | -- 26 | 2.43.0 27 | 28 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/configuration/0017-common-Switch-Bluetooth-HAL-to-AIDL-default.patch: -------------------------------------------------------------------------------- 1 | From dbf690be82df89b5e29eadc32ff5c2e562a7073e Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Fri, 25 Oct 2024 12:56:49 +0300 4 | Subject: [PATCH 17/19] common: Switch Bluetooth HAL to AIDL default 5 | 6 | Android-15 does not include a legacy one. 7 | 8 | Not tested. 9 | 10 | Signed-off-by: Roman Stratiienko 11 | --- 12 | common/bluetooth/android.hardware.bluetooth@1.1.xml | 11 ----------- 13 | common/bluetooth/board.mk | 5 ----- 14 | common/bluetooth/device.mk | 2 +- 15 | 3 files changed, 1 insertion(+), 17 deletions(-) 16 | delete mode 100644 common/bluetooth/android.hardware.bluetooth@1.1.xml 17 | 18 | diff --git a/common/bluetooth/android.hardware.bluetooth@1.1.xml b/common/bluetooth/android.hardware.bluetooth@1.1.xml 19 | deleted file mode 100644 20 | index 6372bf5..0000000 21 | --- a/common/bluetooth/android.hardware.bluetooth@1.1.xml 22 | +++ /dev/null 23 | @@ -1,11 +0,0 @@ 24 | - 25 | - 26 | - android.hardware.bluetooth 27 | - hwbinder 28 | - 1.1 29 | - 30 | - IBluetoothHci 31 | - default 32 | - 33 | - 34 | - 35 | diff --git a/common/bluetooth/board.mk b/common/bluetooth/board.mk 36 | index e9d8385..bb3a945 100644 37 | --- a/common/bluetooth/board.mk 38 | +++ b/common/bluetooth/board.mk 39 | @@ -1,8 +1,3 @@ 40 | # SPDX-License-Identifier: Apache-2.0 41 | 42 | -# Some framework code requires this to enable BT 43 | - 44 | BCB_PATH := $(patsubst $(CURDIR)/%,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST))))) 45 | - 46 | -BOARD_HAVE_BLUETOOTH := true 47 | -DEVICE_MANIFEST_FILE += $(BCB_PATH)/android.hardware.bluetooth@1.1.xml 48 | diff --git a/common/bluetooth/device.mk b/common/bluetooth/device.mk 49 | index f3bd3f7..462207b 100644 50 | --- a/common/bluetooth/device.mk 51 | +++ b/common/bluetooth/device.mk 52 | @@ -1,6 +1,6 @@ 53 | # SPDX-License-Identifier: Apache-2.0 54 | 55 | -PRODUCT_PACKAGES += android.hardware.bluetooth@1.1-service.btlinux 56 | +PRODUCT_PACKAGES += android.hardware.bluetooth-service.default 57 | PRODUCT_COPY_FILES += \ 58 | frameworks/native/data/etc/android.hardware.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \ 59 | frameworks/native/data/etc/android.hardware.bluetooth_le.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth_le.xml \ 60 | -- 61 | 2.43.0 62 | 63 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/configuration/0018-kconfig-Set-localversion-config-to-android15-0.patch: -------------------------------------------------------------------------------- 1 | From a7b4317336d8d09c68d6a9b782904ab5c6008baf Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Fri, 25 Oct 2024 21:40:48 +0300 4 | Subject: [PATCH 18/19] kconfig: Set localversion config to -android15-0 5 | 6 | Signed-off-by: Roman Stratiienko 7 | --- 8 | platform/kernel/android-extra.config | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/platform/kernel/android-extra.config b/platform/kernel/android-extra.config 12 | index ee9d502..db2e116 100644 13 | --- a/platform/kernel/android-extra.config 14 | +++ b/platform/kernel/android-extra.config 15 | @@ -40,7 +40,7 @@ CONFIG_DMABUF_HEAPS_PAGE_POOL=y 16 | CONFIG_DMABUF_HEAPS_SYSTEM=y 17 | 18 | # Requred by GenericBootImageTest#KernelReleaseFormat 19 | -CONFIG_LOCALVERSION="-android14-0-GloDroid" 20 | +CONFIG_LOCALVERSION="-android15-0-GloDroid" 21 | 22 | # Set to y, otherwise a set of essential kernel configs will be force-disabled. (like CONFIG_TRACE_GPU_MEM) 23 | CONFIG_GKI_HACKS_TO_FIX=y 24 | -- 25 | 2.43.0 26 | 27 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/configuration/0019-common-graphics-Remove-legacy-mapper4-in-a-favour-of.patch: -------------------------------------------------------------------------------- 1 | From d239508fcfe7569e0ba179e3fae293595aecd32d Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Tue, 29 Oct 2024 22:33:20 +0200 4 | Subject: [PATCH 19/19] common: graphics: Remove legacy mapper4 in a favour of 5 | mapper5 6 | 7 | Signed-off-by: Roman Stratiienko 8 | --- 9 | .../graphics/android.hardware.graphics.mapper@4.0.xml | 11 ----------- 10 | common/graphics/board.mk | 3 --- 11 | common/graphics/device.mk | 1 - 12 | 3 files changed, 15 deletions(-) 13 | delete mode 100644 common/graphics/android.hardware.graphics.mapper@4.0.xml 14 | 15 | diff --git a/common/graphics/android.hardware.graphics.mapper@4.0.xml b/common/graphics/android.hardware.graphics.mapper@4.0.xml 16 | deleted file mode 100644 17 | index 3160c77..0000000 18 | --- a/common/graphics/android.hardware.graphics.mapper@4.0.xml 19 | +++ /dev/null 20 | @@ -1,11 +0,0 @@ 21 | - 22 | - 23 | - android.hardware.graphics.mapper 24 | - passthrough 25 | - 4.0 26 | - 27 | - IMapper 28 | - default 29 | - 30 | - 31 | - 32 | diff --git a/common/graphics/board.mk b/common/graphics/board.mk 33 | index d351ef2..e102d57 100644 34 | --- a/common/graphics/board.mk 35 | +++ b/common/graphics/board.mk 36 | @@ -24,7 +24,4 @@ BOARD_BUILD_AOSPEXT_MINIGBM := true 37 | BOARD_MINIGBM_SRC_DIR := glodroid/vendor/minigbm 38 | BOARD_MINIGBM_PATCHES_DIRS += $(BCG_PATH)/patches-minigbm 39 | 40 | -DEVICE_MANIFEST_FILE += \ 41 | - $(BCG_PATH)/android.hardware.graphics.mapper@4.0.xml \ 42 | - 43 | BOARD_VENDOR_SEPOLICY_DIRS += $(BCG_PATH)/sepolicy/vendor 44 | diff --git a/common/graphics/device.mk b/common/graphics/device.mk 45 | index 2c83415..3850c8d 100644 46 | --- a/common/graphics/device.mk 47 | +++ b/common/graphics/device.mk 48 | @@ -34,7 +34,6 @@ PRODUCT_PACKAGES += \ 49 | android.hardware.graphics.allocator-service.minigbm_gd \ 50 | android.hardware.graphics.allocator_gd.rc \ 51 | android.hardware.graphics.allocator_gd.xml \ 52 | - android.hardware.graphics.mapper@4.0-impl.minigbm_gd \ 53 | mapper.minigbm_gd \ 54 | mapper.minigbm_gd.xml \ 55 | libminigbm_gralloc_gd \ 56 | -- 57 | 2.43.0 58 | 59 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/configuration/0020-Move-v4l2_codec2-back-to-external-directory.patch: -------------------------------------------------------------------------------- 1 | From bf11f9fffea6c727762f4eca061444ef5409bfe3 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Tue, 10 Dec 2024 15:42:52 +0200 4 | Subject: [PATCH 20/20] Move v4l2_codec2 back to external/ directory 5 | 6 | Signed-off-by: Roman Stratiienko 7 | --- 8 | common/codecs/device.mk | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/common/codecs/device.mk b/common/codecs/device.mk 12 | index c9a607e..53769a7 100644 13 | --- a/common/codecs/device.mk 14 | +++ b/common/codecs/device.mk 15 | @@ -4,7 +4,7 @@ 16 | # 17 | # Copyright (C) 2022 Roman Stratiienko (r.stratiienko@gmail.com) 18 | 19 | -PRODUCT_SOONG_NAMESPACES += glodroid/vendor/v4l2_codec2 20 | +PRODUCT_SOONG_NAMESPACES += external/v4l2_codec2 21 | 22 | PRODUCT_PACKAGES += \ 23 | android.hardware.media.c2@1.0-service \ 24 | -- 25 | 2.43.0 26 | 27 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/configuration/0021-kernel-Avoid-cleaning-the-modules.blocklist-file.patch: -------------------------------------------------------------------------------- 1 | From 6f361fca2596aee0781488d38d16159315811346 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Thu, 12 Dec 2024 03:22:31 +0200 4 | Subject: [PATCH 21/21] kernel: Avoid cleaning the modules.blocklist file 5 | 6 | The modules.blocklist file is provided by the AOSP build system, 7 | so we don't want it to disappear suddenly. 8 | 9 | Signed-off-by: Roman Stratiienko 10 | --- 11 | platform/kernel/kernel.mk | 2 +- 12 | 1 file changed, 1 insertion(+), 1 deletion(-) 13 | 14 | diff --git a/platform/kernel/kernel.mk b/platform/kernel/kernel.mk 15 | index 72f22f8..3f027ad 100644 16 | --- a/platform/kernel/kernel.mk 17 | +++ b/platform/kernel/kernel.mk 18 | @@ -68,7 +68,7 @@ DTB_OUTPUT := $(PRODUCT_OUT)/dtb.img 19 | 20 | $(TARGET_VENDOR_MODULES)/modules.dep: $(KERNEL_TARGET) 21 | rm -rf $(TARGET_VENDOR_MODULES)/kernel 22 | - rm -f $(TARGET_VENDOR_MODULES)/modules.* 23 | + ls $(TARGET_VENDOR_MODULES)/modules.* | grep -v modules.blocklist | xargs rm -f 24 | mkdir -p $(TARGET_VENDOR_MODULES)/kernel 25 | cp -r $(KERNEL_OUT)/install/modules/lib/modules/GloDroid/kernel/* $(TARGET_VENDOR_MODULES)/kernel/ 26 | cp -r $(KERNEL_OUT)/install/modules/lib/modules/GloDroid/modules.* $(TARGET_VENDOR_MODULES)/ 27 | -- 28 | 2.43.0 29 | 30 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/drm_hwcomposer/0001-Exclude-Android.bps-by-adding-the-underscore-suffix.patch: -------------------------------------------------------------------------------- 1 | From 80b2dcfbc427e36eae768ebd2cc98cd58d6cc5c4 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Thu, 17 Oct 2024 12:28:01 +0300 4 | Subject: [PATCH] Exclude Android.bps by adding the underscore suffix 5 | 6 | We're building it using AOSPEXT and don't want both 7 | to interfare with each other. 8 | 9 | Signed-off-by: Roman Stratiienko 10 | --- 11 | Android.bp => Android.bp_ | 0 12 | tests/{Android.bp => Android.bp_} | 0 13 | 2 files changed, 0 insertions(+), 0 deletions(-) 14 | rename Android.bp => Android.bp_ (100%) 15 | rename tests/{Android.bp => Android.bp_} (100%) 16 | 17 | diff --git a/Android.bp b/Android.bp_ 18 | similarity index 100% 19 | rename from Android.bp 20 | rename to Android.bp_ 21 | diff --git a/tests/Android.bp b/tests/Android.bp_ 22 | similarity index 100% 23 | rename from tests/Android.bp 24 | rename to tests/Android.bp_ 25 | -- 26 | 2.43.0 27 | 28 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0004-Deal-with-the-lack-of-trivial-sand-cropping.patch: -------------------------------------------------------------------------------- 1 | From 0ff0969041c6563bf872b3bfcfa38838e537249a Mon Sep 17 00:00:00 2001 2 | From: John Cox 3 | Date: Tue, 27 Apr 2021 12:02:09 +0100 4 | Subject: [PATCH 04/41] Deal with the lack of trivial sand cropping 5 | 6 | --- 7 | fftools/ffmpeg_filter.c | 4 ++-- 8 | libavutil/frame.c | 11 +++++++++++ 9 | libavutil/frame.h | 10 ++++++++++ 10 | 3 files changed, 23 insertions(+), 2 deletions(-) 11 | 12 | diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c 13 | index 7ec328e04e..ad76510e05 100644 14 | --- a/fftools/ffmpeg_filter.c 15 | +++ b/fftools/ffmpeg_filter.c 16 | @@ -2782,8 +2782,8 @@ static int send_frame(FilterGraph *fg, FilterGraphThread *fgt, 17 | break; 18 | case AVMEDIA_TYPE_VIDEO: 19 | if (ifp->format != frame->format || 20 | - ifp->width != frame->width || 21 | - ifp->height != frame->height || 22 | + ifp->width != av_frame_cropped_width(frame) || 23 | + ifp->height != av_frame_cropped_height(frame) || 24 | ifp->color_space != frame->colorspace || 25 | ifp->color_range != frame->color_range) 26 | need_reinit |= VIDEO_CHANGED; 27 | diff --git a/libavutil/frame.c b/libavutil/frame.c 28 | index f0a0dba018..38458696c6 100644 29 | --- a/libavutil/frame.c 30 | +++ b/libavutil/frame.c 31 | @@ -16,6 +16,8 @@ 32 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 33 | */ 34 | 35 | +#include "config.h" 36 | + 37 | #include "channel_layout.h" 38 | #include "avassert.h" 39 | #include "buffer.h" 40 | @@ -27,6 +29,9 @@ 41 | #include "mem.h" 42 | #include "samplefmt.h" 43 | #include "hwcontext.h" 44 | +#if CONFIG_SAND 45 | +#include "rpi_sand_fns.h" 46 | +#endif 47 | 48 | static const AVSideDataDescriptor sd_props[] = { 49 | [AV_FRAME_DATA_PANSCAN] = { "AVPanScan" }, 50 | @@ -1077,6 +1082,12 @@ int av_frame_apply_cropping(AVFrame *frame, int flags) 51 | (frame->crop_top + frame->crop_bottom) >= frame->height) 52 | return AVERROR(ERANGE); 53 | 54 | +#if CONFIG_SAND 55 | + // Sand cannot be cropped - do not try 56 | + if (av_rpi_is_sand_format(frame->format)) 57 | + return 0; 58 | +#endif 59 | + 60 | desc = av_pix_fmt_desc_get(frame->format); 61 | if (!desc) 62 | return AVERROR_BUG; 63 | diff --git a/libavutil/frame.h b/libavutil/frame.h 64 | index f7806566d5..00c5c925e3 100644 65 | --- a/libavutil/frame.h 66 | +++ b/libavutil/frame.h 67 | @@ -1037,6 +1037,16 @@ int av_frame_apply_cropping(AVFrame *frame, int flags); 68 | */ 69 | const char *av_frame_side_data_name(enum AVFrameSideDataType type); 70 | 71 | + 72 | +static inline int av_frame_cropped_width(const AVFrame * const frame) 73 | +{ 74 | + return frame->width - (frame->crop_left + frame->crop_right); 75 | +} 76 | +static inline int av_frame_cropped_height(const AVFrame * const frame) 77 | +{ 78 | + return frame->height - (frame->crop_top + frame->crop_bottom); 79 | +} 80 | + 81 | /** 82 | * @return side data descriptor corresponding to a given side data type, NULL 83 | * when not available. 84 | -- 85 | 2.43.0 86 | 87 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0007-Reduce-mmal-compile-warnings.patch: -------------------------------------------------------------------------------- 1 | From a55c318cbce6745c4cfbb898be5ddaa5241d365c Mon Sep 17 00:00:00 2001 2 | From: John Cox 3 | Date: Tue, 27 Apr 2021 12:37:07 +0100 4 | Subject: [PATCH 07/41] Reduce mmal compile warnings 5 | 6 | --- 7 | libavcodec/mmaldec.c | 4 ++++ 8 | 1 file changed, 4 insertions(+) 9 | 10 | diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c 11 | index e42591110f..70cc0ecabc 100644 12 | --- a/libavcodec/mmaldec.c 13 | +++ b/libavcodec/mmaldec.c 14 | @@ -24,6 +24,9 @@ 15 | * MMAL Video Decoder 16 | */ 17 | 18 | +#pragma GCC diagnostic push 19 | +// Many many redundant decls in the header files 20 | +#pragma GCC diagnostic ignored "-Wredundant-decls" 21 | #include 22 | #include 23 | #include 24 | @@ -31,6 +34,7 @@ 25 | #include 26 | #include 27 | #include 28 | +#pragma GCC diagnostic pop 29 | #include 30 | 31 | #include "avcodec.h" 32 | -- 33 | 2.43.0 34 | 35 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0008-Add-chroma-location-to-hevc-parse.patch: -------------------------------------------------------------------------------- 1 | From d7e69aac2b91e1331e19cd6c6bb81ed1be85f944 Mon Sep 17 00:00:00 2001 2 | From: John Cox 3 | Date: Tue, 27 Apr 2021 17:56:16 +0100 4 | Subject: [PATCH 08/41] Add chroma location to hevc parse 5 | 6 | --- 7 | libavcodec/hevc/hevcdec.c | 13 +++++++++++++ 8 | libavcodec/hevc/parser.c | 13 +++++++++++++ 9 | 2 files changed, 26 insertions(+) 10 | 11 | diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c 12 | index 0dc24f82f8..31323557fa 100644 13 | --- a/libavcodec/hevc/hevcdec.c 14 | +++ b/libavcodec/hevc/hevcdec.c 15 | @@ -366,6 +366,19 @@ static void export_stream_params(HEVCContext *s, const HEVCSPS *sps) 16 | else 17 | avctx->color_range = AVCOL_RANGE_MPEG; 18 | 19 | + if (sps->chroma_format_idc == 1) { 20 | + avctx->chroma_sample_location = sps->vui.common.chroma_loc_info_present_flag ? 21 | + sps->vui.common.chroma_sample_loc_type_top_field + 1 : 22 | + AVCHROMA_LOC_LEFT; 23 | + } 24 | + else if (sps->chroma_format_idc == 2 || 25 | + sps->chroma_format_idc == 3) { 26 | + avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT;; 27 | + } 28 | + else { 29 | + avctx->chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED; 30 | + } 31 | + 32 | if (sps->vui.common.colour_description_present_flag) { 33 | avctx->color_primaries = sps->vui.common.colour_primaries; 34 | avctx->color_trc = sps->vui.common.transfer_characteristics; 35 | diff --git a/libavcodec/hevc/parser.c b/libavcodec/hevc/parser.c 36 | index 16b40e2b10..cf9830648a 100644 37 | --- a/libavcodec/hevc/parser.c 38 | +++ b/libavcodec/hevc/parser.c 39 | @@ -93,6 +93,19 @@ static int hevc_parse_slice_header(AVCodecParserContext *s, H2645NAL *nal, 40 | avctx->profile = sps->ptl.general_ptl.profile_idc; 41 | avctx->level = sps->ptl.general_ptl.level_idc; 42 | 43 | + if (sps->chroma_format_idc == 1) { 44 | + avctx->chroma_sample_location = sps->vui.common.chroma_loc_info_present_flag ? 45 | + sps->vui.common.chroma_sample_loc_type_top_field + 1 : 46 | + AVCHROMA_LOC_LEFT; 47 | + } 48 | + else if (sps->chroma_format_idc == 2 || 49 | + sps->chroma_format_idc == 3) { 50 | + avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT;; 51 | + } 52 | + else { 53 | + avctx->chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED; 54 | + } 55 | + 56 | if (sps->vps->vps_timing_info_present_flag) { 57 | num = sps->vps->vps_num_units_in_tick; 58 | den = sps->vps->vps_time_scale; 59 | -- 60 | 2.43.0 61 | 62 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0009-hwaccel-Add-.abort_frame-use-in-hevcdec.patch: -------------------------------------------------------------------------------- 1 | From 5877376f164fc31e6bc0393a17fa80161d56933c Mon Sep 17 00:00:00 2001 2 | From: John Cox 3 | Date: Mon, 26 Sep 2022 18:20:50 +0100 4 | Subject: [PATCH 09/41] hwaccel: Add .abort_frame & use in hevcdec 5 | 6 | --- 7 | libavcodec/hevc/hevcdec.c | 7 ++++++- 8 | libavcodec/hwaccel_internal.h | 11 +++++++++++ 9 | 2 files changed, 17 insertions(+), 1 deletion(-) 10 | 11 | diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c 12 | index 31323557fa..ef43b230d3 100644 13 | --- a/libavcodec/hevc/hevcdec.c 14 | +++ b/libavcodec/hevc/hevcdec.c 15 | @@ -3763,8 +3763,13 @@ static int hevc_receive_frame(AVCodecContext *avctx, AVFrame *frame) 16 | } 17 | 18 | ret = decode_nal_units(s, avpkt->data, avpkt->size); 19 | - if (ret < 0) 20 | + if (ret < 0) { 21 | + // Ensure that hwaccel knows this frame is over 22 | + if (FF_HW_HAS_CB(avctx, abort_frame)) 23 | + FF_HW_SIMPLE_CALL(avctx, abort_frame); 24 | + 25 | return ret; 26 | + } 27 | 28 | do_output: 29 | if (ff_container_fifo_read(s->output_fifo, frame) >= 0) { 30 | diff --git a/libavcodec/hwaccel_internal.h b/libavcodec/hwaccel_internal.h 31 | index b0cc22bb68..d319f2abe1 100644 32 | --- a/libavcodec/hwaccel_internal.h 33 | +++ b/libavcodec/hwaccel_internal.h 34 | @@ -161,6 +161,17 @@ typedef struct FFHWAccel { 35 | * Callback to flush the hwaccel state. 36 | */ 37 | void (*flush)(AVCodecContext *avctx); 38 | + 39 | + /** 40 | + * Called if parsing fails 41 | + * 42 | + * An error has occured, end_frame will not be called 43 | + * start_frame & decode_slice may or may not have been called 44 | + * Optional 45 | + * 46 | + * @param avctx the codec context 47 | + */ 48 | + void (*abort_frame)(AVCodecContext *avctx); 49 | } FFHWAccel; 50 | 51 | static inline const FFHWAccel *ffhwaccel(const AVHWAccel *codec) 52 | -- 53 | 2.43.0 54 | 55 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0010-Weak-link-utils.patch: -------------------------------------------------------------------------------- 1 | From abe93d144d9243f0dad899afd5e4885df1bd594d Mon Sep 17 00:00:00 2001 2 | From: John Cox 3 | Date: Tue, 27 Apr 2021 17:59:08 +0100 4 | Subject: [PATCH 10/41] Weak link utils 5 | 6 | --- 7 | libavcodec/weak_link.c | 103 +++++++++++++++++++++++++++++++++++++++++ 8 | libavcodec/weak_link.h | 23 +++++++++ 9 | 2 files changed, 126 insertions(+) 10 | create mode 100644 libavcodec/weak_link.c 11 | create mode 100644 libavcodec/weak_link.h 12 | 13 | diff --git a/libavcodec/weak_link.c b/libavcodec/weak_link.c 14 | new file mode 100644 15 | index 0000000000..5a79e89ed7 16 | --- /dev/null 17 | +++ b/libavcodec/weak_link.c 18 | @@ -0,0 +1,103 @@ 19 | +#include 20 | +#include 21 | +#include 22 | +#include "weak_link.h" 23 | + 24 | +struct ff_weak_link_master { 25 | + atomic_int ref_count; /* 0 is single ref for easier atomics */ 26 | + pthread_rwlock_t lock; 27 | + void * ptr; 28 | +}; 29 | + 30 | +static inline struct ff_weak_link_master * weak_link_x(struct ff_weak_link_client * c) 31 | +{ 32 | + return (struct ff_weak_link_master *)c; 33 | +} 34 | + 35 | +struct ff_weak_link_master * ff_weak_link_new(void * p) 36 | +{ 37 | + struct ff_weak_link_master * w = malloc(sizeof(*w)); 38 | + if (!w) 39 | + return NULL; 40 | + atomic_init(&w->ref_count, 0); 41 | + w->ptr = p; 42 | + if (pthread_rwlock_init(&w->lock, NULL)) { 43 | + free(w); 44 | + return NULL; 45 | + } 46 | + return w; 47 | +} 48 | + 49 | +static void weak_link_do_unref(struct ff_weak_link_master * const w) 50 | +{ 51 | + int n = atomic_fetch_sub(&w->ref_count, 1); 52 | + if (n) 53 | + return; 54 | + 55 | + pthread_rwlock_destroy(&w->lock); 56 | + free(w); 57 | +} 58 | + 59 | +// Unref & break link 60 | +void ff_weak_link_break(struct ff_weak_link_master ** ppLink) 61 | +{ 62 | + struct ff_weak_link_master * const w = *ppLink; 63 | + if (!w) 64 | + return; 65 | + 66 | + *ppLink = NULL; 67 | + pthread_rwlock_wrlock(&w->lock); 68 | + w->ptr = NULL; 69 | + pthread_rwlock_unlock(&w->lock); 70 | + 71 | + weak_link_do_unref(w); 72 | +} 73 | + 74 | +struct ff_weak_link_client* ff_weak_link_ref(struct ff_weak_link_master * w) 75 | +{ 76 | + if (!w) 77 | + return NULL; 78 | + atomic_fetch_add(&w->ref_count, 1); 79 | + return (struct ff_weak_link_client*)w; 80 | +} 81 | + 82 | +void ff_weak_link_unref(struct ff_weak_link_client ** ppLink) 83 | +{ 84 | + struct ff_weak_link_master * const w = weak_link_x(*ppLink); 85 | + if (!w) 86 | + return; 87 | + 88 | + *ppLink = NULL; 89 | + weak_link_do_unref(w); 90 | +} 91 | + 92 | +void * ff_weak_link_lock(struct ff_weak_link_client ** ppLink) 93 | +{ 94 | + struct ff_weak_link_master * const w = weak_link_x(*ppLink); 95 | + 96 | + if (!w) 97 | + return NULL; 98 | + 99 | + if (pthread_rwlock_rdlock(&w->lock)) 100 | + goto broken; 101 | + 102 | + if (w->ptr) 103 | + return w->ptr; 104 | + 105 | + pthread_rwlock_unlock(&w->lock); 106 | + 107 | +broken: 108 | + *ppLink = NULL; 109 | + weak_link_do_unref(w); 110 | + return NULL; 111 | +} 112 | + 113 | +// Ignores a NULL c (so can be on the return path of both broken & live links) 114 | +void ff_weak_link_unlock(struct ff_weak_link_client * c) 115 | +{ 116 | + struct ff_weak_link_master * const w = weak_link_x(c); 117 | + if (w) 118 | + pthread_rwlock_unlock(&w->lock); 119 | +} 120 | + 121 | + 122 | diff --git a/libavcodec/weak_link.h b/libavcodec/weak_link.h 123 | new file mode 100644 124 | index 0000000000..415b6a27a0 125 | --- /dev/null 126 | +++ b/libavcodec/weak_link.h 127 | @@ -0,0 +1,23 @@ 128 | +struct ff_weak_link_master; 129 | +struct ff_weak_link_client; 130 | + 131 | +struct ff_weak_link_master * ff_weak_link_new(void * p); 132 | +void ff_weak_link_break(struct ff_weak_link_master ** ppLink); 133 | + 134 | +struct ff_weak_link_client* ff_weak_link_ref(struct ff_weak_link_master * w); 135 | +void ff_weak_link_unref(struct ff_weak_link_client ** ppLink); 136 | + 137 | +// Returns NULL if link broken - in this case it will also zap 138 | +// *ppLink and unref the weak_link. 139 | +// Returns NULL if *ppLink is NULL (so a link once broken stays broken) 140 | +// 141 | +// The above does mean that there is a race if this is called simultainiously 142 | +// by two threads using the same weak_link_client (so don't do that) 143 | +void * ff_weak_link_lock(struct ff_weak_link_client ** ppLink); 144 | +void ff_weak_link_unlock(struct ff_weak_link_client * c); 145 | + 146 | + 147 | + 148 | + 149 | + 150 | + 151 | -- 152 | 2.43.0 153 | 154 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0012-Add-no_cvt_hw-option-to-ffmpeg.patch: -------------------------------------------------------------------------------- 1 | From a49d9edb98c989d52d860582e113ec2c3abbab7a Mon Sep 17 00:00:00 2001 2 | From: John Cox 3 | Date: Tue, 27 Apr 2021 19:30:36 +0100 4 | Subject: [PATCH 12/41] Add no_cvt_hw option to ffmpeg 5 | 6 | --- 7 | fftools/ffmpeg.h | 2 ++ 8 | fftools/ffmpeg_dec.c | 9 ++++++--- 9 | fftools/ffmpeg_filter.c | 3 +++ 10 | fftools/ffmpeg_opt.c | 8 ++++++-- 11 | 4 files changed, 17 insertions(+), 5 deletions(-) 12 | 13 | diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h 14 | index 733d551fa4..b3a3b00580 100644 15 | --- a/fftools/ffmpeg.h 16 | +++ b/fftools/ffmpeg.h 17 | @@ -715,6 +715,8 @@ extern enum VideoSyncMethod video_sync_method; 18 | extern float frame_drop_threshold; 19 | extern int do_benchmark; 20 | extern int do_benchmark_all; 21 | +extern int no_cvt_hw; 22 | +extern int do_deinterlace; 23 | extern int do_hex_dump; 24 | extern int do_pkt_dump; 25 | extern int copy_ts; 26 | diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c 27 | index 2723a0312e..aee41267fb 100644 28 | --- a/fftools/ffmpeg_dec.c 29 | +++ b/fftools/ffmpeg_dec.c 30 | @@ -392,7 +392,7 @@ static int video_frame_process(DecoderPriv *dp, AVFrame *frame, 31 | } 32 | #endif 33 | 34 | - if (frame->format == dp->hwaccel_pix_fmt) { 35 | + if (!no_cvt_hw && frame->format == dp->hwaccel_pix_fmt) { 36 | int err = hwaccel_retrieve_data(dp->dec_ctx, frame); 37 | if (err < 0) 38 | return err; 39 | @@ -1333,12 +1333,15 @@ static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat 40 | break; 41 | 42 | if (dp->hwaccel_id == HWACCEL_GENERIC || 43 | - dp->hwaccel_id == HWACCEL_AUTO) { 44 | + dp->hwaccel_id == HWACCEL_AUTO || 45 | + no_cvt_hw) { 46 | for (int i = 0;; i++) { 47 | config = avcodec_get_hw_config(s->codec, i); 48 | if (!config) 49 | break; 50 | - if (!(config->methods & 51 | + if (no_cvt_hw && (config->methods & AV_CODEC_HW_CONFIG_METHOD_INTERNAL)) 52 | + av_log(s, AV_LOG_DEBUG, "no_cvt_hw so trying pix_fmt %d with codec internal hwaccel\n", *p); 53 | + else if (!(config->methods & 54 | AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX)) 55 | continue; 56 | if (config->pix_fmt == *p) 57 | diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c 58 | index ad76510e05..de87373295 100644 59 | --- a/fftools/ffmpeg_filter.c 60 | +++ b/fftools/ffmpeg_filter.c 61 | @@ -2804,6 +2804,9 @@ static int send_frame(FilterGraph *fg, FilterGraphThread *fgt, 62 | (ifp->hw_frames_ctx && ifp->hw_frames_ctx->data != frame->hw_frames_ctx->data)) 63 | need_reinit |= HWACCEL_CHANGED; 64 | 65 | + if (no_cvt_hw && fgt->graph) 66 | + need_reinit = 0; 67 | + 68 | if (need_reinit) { 69 | ret = ifilter_parameters_from_frame(ifilter, frame); 70 | if (ret < 0) 71 | diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c 72 | index f639a1cf0a..9670585821 100644 73 | --- a/fftools/ffmpeg_opt.c 74 | +++ b/fftools/ffmpeg_opt.c 75 | @@ -62,6 +62,7 @@ enum VideoSyncMethod video_sync_method = VSYNC_AUTO; 76 | float frame_drop_threshold = 0; 77 | int do_benchmark = 0; 78 | int do_benchmark_all = 0; 79 | +int no_cvt_hw = 0; 80 | int do_hex_dump = 0; 81 | int do_pkt_dump = 0; 82 | int copy_ts = 0; 83 | @@ -1574,8 +1575,11 @@ const OptionDef options[] = { 84 | { "benchmark_all", OPT_TYPE_BOOL, OPT_EXPERT, 85 | { &do_benchmark_all }, 86 | "add timings for each task" }, 87 | - { "progress", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, 88 | - { .func_arg = opt_progress }, 89 | + { "no_cvt_hw", OPT_TYPE_BOOL, OPT_EXPERT, 90 | + { &no_cvt_hw }, 91 | + "do not auto-convert hw frames to sw" }, 92 | + { "progress", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, 93 | + { .func_arg = opt_progress }, 94 | "write program-readable progress information", "url" }, 95 | { "stdin", OPT_TYPE_BOOL, OPT_EXPERT, 96 | { &stdin_interaction }, 97 | -- 98 | 2.43.0 99 | 100 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0017-Fix-crash-in-hw_device_default_name-if-type-not-foun.patch: -------------------------------------------------------------------------------- 1 | From 0b6cd744ae07630753883c7dbdde3292074acc1c Mon Sep 17 00:00:00 2001 2 | From: John Cox 3 | Date: Thu, 10 Jun 2021 18:46:21 +0100 4 | Subject: [PATCH 17/41] Fix crash in hw_device_default_name if type not found 5 | (NONE) 6 | 7 | --- 8 | fftools/ffmpeg_hw.c | 2 ++ 9 | 1 file changed, 2 insertions(+) 10 | 11 | diff --git a/fftools/ffmpeg_hw.c b/fftools/ffmpeg_hw.c 12 | index 5d4c06c28e..f39bd29b6e 100644 13 | --- a/fftools/ffmpeg_hw.c 14 | +++ b/fftools/ffmpeg_hw.c 15 | @@ -73,6 +73,8 @@ static char *hw_device_default_name(enum AVHWDeviceType type) 16 | char *name; 17 | size_t index_pos; 18 | int index, index_limit = 1000; 19 | + if (!type_name) 20 | + return NULL; 21 | index_pos = strlen(type_name); 22 | name = av_malloc(index_pos + 4); 23 | if (!name) 24 | -- 25 | 2.43.0 26 | 27 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0018-Fix-raw-video-s.t.-it-respects-any-remaining-croppin.patch: -------------------------------------------------------------------------------- 1 | From 77a7b3f85585637c66f9ba2e43d9eaf09fc322a6 Mon Sep 17 00:00:00 2001 2 | From: John Cox 3 | Date: Wed, 22 May 2024 17:44:34 +0100 4 | Subject: [PATCH 18/41] Fix raw video s.t. it respects any remaining cropping 5 | 6 | --- 7 | libavcodec/rawenc.c | 32 ++++++++++++++++++++++++-------- 8 | 1 file changed, 24 insertions(+), 8 deletions(-) 9 | 10 | diff --git a/libavcodec/rawenc.c b/libavcodec/rawenc.c 11 | index 594a77c42a..8ca0379e12 100644 12 | --- a/libavcodec/rawenc.c 13 | +++ b/libavcodec/rawenc.c 14 | @@ -124,32 +124,41 @@ static int raw_sand30_as_yuv420(AVCodecContext *avctx, AVPacket *pkt, 15 | 16 | 17 | static int raw_encode(AVCodecContext *avctx, AVPacket *pkt, 18 | - const AVFrame *frame, int *got_packet) 19 | + const AVFrame *src_frame, int *got_packet) 20 | { 21 | int ret; 22 | + AVFrame * frame = NULL; 23 | 24 | #if CONFIG_SAND 25 | - if (av_rpi_is_sand_frame(frame)) { 26 | - ret = av_rpi_is_sand8_frame(frame) ? raw_sand8_as_yuv420(avctx, pkt, frame) : 27 | - av_rpi_is_sand16_frame(frame) ? raw_sand16_as_yuv420(avctx, pkt, frame) : 28 | - av_rpi_is_sand30_frame(frame) ? raw_sand30_as_yuv420(avctx, pkt, frame) : -1; 29 | + if (av_rpi_is_sand_frame(src_frame)) { 30 | + ret = av_rpi_is_sand8_frame(src_frame) ? raw_sand8_as_yuv420(avctx, pkt, src_frame) : 31 | + av_rpi_is_sand16_frame(src_frame) ? raw_sand16_as_yuv420(avctx, pkt, src_frame) : 32 | + av_rpi_is_sand30_frame(src_frame) ? raw_sand30_as_yuv420(avctx, pkt, src_frame) : -1; 33 | *got_packet = (ret == 0); 34 | return ret; 35 | } 36 | #endif 37 | 38 | + if ((frame = av_frame_clone(src_frame)) == NULL) { 39 | + ret = AVERROR(ENOMEM); 40 | + goto fail; 41 | + } 42 | + 43 | + if ((ret = av_frame_apply_cropping(frame, AV_FRAME_CROP_UNALIGNED)) < 0) 44 | + goto fail; 45 | + 46 | ret = av_image_get_buffer_size(frame->format, 47 | frame->width, frame->height, 1); 48 | if (ret < 0) 49 | - return ret; 50 | + goto fail; 51 | 52 | if ((ret = ff_get_encode_buffer(avctx, pkt, ret, 0)) < 0) 53 | - return ret; 54 | + goto fail; 55 | if ((ret = av_image_copy_to_buffer(pkt->data, pkt->size, 56 | (const uint8_t **)frame->data, frame->linesize, 57 | frame->format, 58 | frame->width, frame->height, 1)) < 0) 59 | - return ret; 60 | + goto fail; 61 | 62 | if(avctx->codec_tag == AV_RL32("yuv2") && ret > 0 && 63 | frame->format == AV_PIX_FMT_YUYV422) { 64 | @@ -165,8 +174,15 @@ static int raw_encode(AVCodecContext *avctx, AVPacket *pkt, 65 | AV_WB64(&pkt->data[8 * x], v << 48 | v >> 16); 66 | } 67 | } 68 | + pkt->flags |= AV_PKT_FLAG_KEY; 69 | + av_frame_free(&frame); 70 | *got_packet = 1; 71 | return 0; 72 | + 73 | +fail: 74 | + av_frame_free(&frame); 75 | + *got_packet = 0; 76 | + return ret; 77 | } 78 | 79 | const FFCodec ff_rawvideo_encoder = { 80 | -- 81 | 2.43.0 82 | 83 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0020-matroskaenc-Allow-H264-SPS-PPS-headers-in-packet-sid.patch: -------------------------------------------------------------------------------- 1 | From 8facfdde8a86a51d9f2eafbbf14da0ae69124b78 Mon Sep 17 00:00:00 2001 2 | From: John Cox 3 | Date: Wed, 14 Sep 2022 15:44:10 +0000 4 | Subject: [PATCH 20/41] matroskaenc: Allow H264 SPS/PPS headers in packet 5 | sidedata 6 | 7 | --- 8 | libavformat/matroskaenc.c | 36 ++++++++++++++++++++++++++++++------ 9 | 1 file changed, 30 insertions(+), 6 deletions(-) 10 | 11 | diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c 12 | index 60c896e964..3967be997e 100644 13 | --- a/libavformat/matroskaenc.c 14 | +++ b/libavformat/matroskaenc.c 15 | @@ -84,6 +84,10 @@ 16 | 17 | #define IS_WEBM(mkv) (CONFIG_WEBM_MUXER && CONFIG_MATROSKA_MUXER ? \ 18 | ((mkv)->mode == MODE_WEBM) : CONFIG_WEBM_MUXER) 19 | + 20 | +/* Reserved size for H264 headers if not extant at init time */ 21 | +#define MAX_H264_HEADER_SIZE 1024 22 | + 23 | #define IS_SEEKABLE(pb, mkv) (((pb)->seekable & AVIO_SEEKABLE_NORMAL) && \ 24 | !(mkv)->is_live) 25 | 26 | @@ -1136,8 +1140,12 @@ static int mkv_assemble_native_codecprivate(AVFormatContext *s, AVIOContext *dyn 27 | case AV_CODEC_ID_WAVPACK: 28 | return put_wv_codecpriv(dyn_cp, extradata, extradata_size); 29 | case AV_CODEC_ID_H264: 30 | - return ff_isom_write_avcc(dyn_cp, extradata, 31 | - extradata_size); 32 | + if (extradata_size) 33 | + return ff_isom_write_avcc(dyn_cp, extradata, 34 | + extradata_size); 35 | + else 36 | + *size_to_reserve = MAX_H264_HEADER_SIZE; 37 | + break; 38 | case AV_CODEC_ID_HEVC: 39 | return ff_isom_write_hvcc(dyn_cp, extradata, 40 | extradata_size, 0); 41 | @@ -2966,8 +2974,8 @@ static int mkv_check_new_extra_data(AVFormatContext *s, const AVPacket *pkt) 42 | } 43 | break; 44 | #endif 45 | - // FIXME: Remove the following once libaom starts propagating proper extradata during init() 46 | - // See https://bugs.chromium.org/p/aomedia/issues/detail?id=2208 47 | + // FIXME: Remove the following once libaom starts propagating extradata during init() 48 | + // See https://bugs.chromium.org/p/aomedia/issues/detail?id=2012 49 | case AV_CODEC_ID_AV1: 50 | if (side_data_size && mkv->track.bc && !par->extradata_size) { 51 | // If the reserved space doesn't suffice, only write 52 | @@ -2979,6 +2987,16 @@ static int mkv_check_new_extra_data(AVFormatContext *s, const AVPacket *pkt) 53 | } else if (!par->extradata_size) 54 | return AVERROR_INVALIDDATA; 55 | break; 56 | + // H264 V4L2 has a similar issue 57 | + case AV_CODEC_ID_H264: 58 | + if (side_data_size && mkv->track.bc && !par->extradata_size) { 59 | + ret = mkv_update_codecprivate(s, mkv, side_data, side_data_size, 60 | + par, mkv->track.bc, track, 0); 61 | + if (ret < 0) 62 | + return ret; 63 | + } else if (!par->extradata_size) 64 | + return AVERROR_INVALIDDATA; 65 | + break; 66 | default: 67 | if (side_data_size) 68 | av_log(s, AV_LOG_DEBUG, "Ignoring new extradata in a packet for stream %d.\n", pkt->stream_index); 69 | @@ -3440,9 +3458,15 @@ static int mkv_init(struct AVFormatContext *s) 70 | track->reformat = mkv_reformat_wavpack; 71 | break; 72 | case AV_CODEC_ID_H264: 73 | + // Default to reformat if no extradata as the only current 74 | + // encoder which does this is v4l2m2m which needs reformat 75 | + if (par->extradata_size == 0 || 76 | + (par->extradata_size > 3 && 77 | + (AV_RB24(par->extradata) == 1 || AV_RB32(par->extradata) == 1))) 78 | + track->reformat = mkv_reformat_h2645; 79 | + break; 80 | case AV_CODEC_ID_HEVC: 81 | - if ((par->codec_id == AV_CODEC_ID_H264 && par->extradata_size > 0 || 82 | - par->codec_id == AV_CODEC_ID_HEVC && par->extradata_size > 6) && 83 | + if (par->extradata_size > 6 && 84 | (AV_RB24(par->extradata) == 1 || AV_RB32(par->extradata) == 1)) 85 | track->reformat = mkv_reformat_h2645; 86 | break; 87 | -- 88 | 2.43.0 89 | 90 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0022-movenc-Allow-H264-SPS-PPS-headers-in-packet-sidedata.patch: -------------------------------------------------------------------------------- 1 | From 78d5800eae1127550d332515510b0dacc8203ee5 Mon Sep 17 00:00:00 2001 2 | From: John Cox 3 | Date: Wed, 14 Sep 2022 15:55:15 +0000 4 | Subject: [PATCH 22/41] movenc: Allow H264 SPS/PPS headers in packet sidedata 5 | 6 | --- 7 | libavformat/movenc.c | 1 + 8 | 1 file changed, 1 insertion(+) 9 | 10 | diff --git a/libavformat/movenc.c b/libavformat/movenc.c 11 | index d20e45cf81..079015da9a 100644 12 | --- a/libavformat/movenc.c 13 | +++ b/libavformat/movenc.c 14 | @@ -6902,6 +6902,7 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt) 15 | if (trk->par->codec_id == AV_CODEC_ID_MP4ALS || 16 | trk->par->codec_id == AV_CODEC_ID_AAC || 17 | trk->par->codec_id == AV_CODEC_ID_AV1 || 18 | + trk->par->codec_id == AV_CODEC_ID_H264 || 19 | trk->par->codec_id == AV_CODEC_ID_FLAC) { 20 | size_t side_size; 21 | uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size); 22 | -- 23 | 2.43.0 24 | 25 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0023-rtpenc-Allow-H264-SPS-PPS-headers-in-packet-sidedata.patch: -------------------------------------------------------------------------------- 1 | From 1ffa78742db5b2971224b4ba57e80d59cbaf230d Mon Sep 17 00:00:00 2001 2 | From: John Cox 3 | Date: Tue, 21 May 2024 17:02:22 +0100 4 | Subject: [PATCH 23/41] rtpenc: Allow H264 SPS/PPS headers in packet sidedata 5 | 6 | --- 7 | libavformat/rtpenc.c | 18 ++++++++++++++++++ 8 | 1 file changed, 18 insertions(+) 9 | 10 | diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c 11 | index 7b4ae37d13..b026ed5bed 100644 12 | --- a/libavformat/rtpenc.c 13 | +++ b/libavformat/rtpenc.c 14 | @@ -19,6 +19,7 @@ 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 16 | */ 17 | 18 | +#include "avc.h" 19 | #include "avformat.h" 20 | #include "mpegts.h" 21 | #include "internal.h" 22 | @@ -586,8 +587,25 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt) 23 | ff_rtp_send_vc2hq(s1, pkt->data, size, st->codecpar->field_order != AV_FIELD_PROGRESSIVE ? 1 : 0); 24 | break; 25 | case AV_CODEC_ID_H264: 26 | + { 27 | + uint8_t *side_data; 28 | + size_t side_data_size = 0; 29 | + 30 | + side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, 31 | + &side_data_size); 32 | + 33 | + if (side_data_size != 0) { 34 | + int ps_size = side_data_size; 35 | + uint8_t * ps_buf = NULL; 36 | + 37 | + ff_avc_write_annexb_extradata(side_data, &ps_buf, &ps_size); 38 | + av_log(s1, AV_LOG_TRACE, "H264: write side data=%d\n", ps_size); 39 | + ff_rtp_send_h264_hevc(s1, ps_buf ? ps_buf : side_data, ps_size); 40 | + av_free(ps_buf); 41 | + } 42 | ff_rtp_send_h264_hevc(s1, pkt->data, size); 43 | break; 44 | + } 45 | case AV_CODEC_ID_H261: 46 | ff_rtp_send_h261(s1, pkt->data, size); 47 | break; 48 | -- 49 | 2.43.0 50 | 51 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0024-Initial-buffersink-alloc-callback-code.patch: -------------------------------------------------------------------------------- 1 | From 34b947cca06e0f9322c529a909d4bfc334d41f52 Mon Sep 17 00:00:00 2001 2 | From: John Cox 3 | Date: Mon, 6 Feb 2023 19:23:16 +0000 4 | Subject: [PATCH 24/41] Initial buffersink alloc callback code 5 | 6 | (cherry picked from commit dde8d3c8f3cc279b9b92ed4f10a2e3990f4aadeb) 7 | --- 8 | libavfilter/buffersink.c | 31 ++++++++++++++++++++++++++++++- 9 | libavfilter/buffersink.h | 3 +++ 10 | 2 files changed, 33 insertions(+), 1 deletion(-) 11 | 12 | diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c 13 | index 5811720c61..13e1f34465 100644 14 | --- a/libavfilter/buffersink.c 15 | +++ b/libavfilter/buffersink.c 16 | @@ -60,6 +60,11 @@ typedef struct BufferSinkContext { 17 | int sample_rates_size; 18 | 19 | AVFrame *peeked_frame; 20 | + 21 | + union { 22 | + av_buffersink_alloc_video_frame * video; 23 | + } alloc_cb; 24 | + void * alloc_v; 25 | } BufferSinkContext; 26 | 27 | #define NB_ITEMS(list) (list ## _size / sizeof(*list)) 28 | @@ -129,6 +134,22 @@ int attribute_align_arg av_buffersink_get_samples(AVFilterContext *ctx, 29 | return get_frame_internal(ctx, frame, 0, nb_samples); 30 | } 31 | 32 | +static AVFrame * alloc_video_buffer(AVFilterLink *link, int w, int h) 33 | +{ 34 | + AVFilterContext * const ctx = link->dst; 35 | + BufferSinkContext * const bs = ctx->priv; 36 | + return bs->alloc_cb.video ? bs->alloc_cb.video(ctx, bs->alloc_v, w, h) : 37 | + ff_default_get_video_buffer(link, w, h); 38 | +} 39 | + 40 | +int av_buffersink_set_alloc_video_frame(AVFilterContext *ctx, av_buffersink_alloc_video_frame * cb, void * v) 41 | +{ 42 | + BufferSinkContext * const bs = ctx->priv; 43 | + bs->alloc_cb.video = cb; 44 | + bs->alloc_v = v; 45 | + return 0; 46 | +} 47 | + 48 | static av_cold int common_init(AVFilterContext *ctx) 49 | { 50 | BufferSinkContext *buf = ctx->priv; 51 | @@ -355,6 +376,14 @@ static const AVOption abuffersink_options[] = { 52 | AVFILTER_DEFINE_CLASS(buffersink); 53 | AVFILTER_DEFINE_CLASS(abuffersink); 54 | 55 | +static const AVFilterPad avfilter_vsink_buffer_inputs[] = { 56 | + { 57 | + .name = "default", 58 | + .type = AVMEDIA_TYPE_VIDEO, 59 | + .get_buffer = {.video = alloc_video_buffer}, 60 | + }, 61 | +}; 62 | + 63 | const AVFilter ff_vsink_buffer = { 64 | .name = "buffersink", 65 | .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."), 66 | @@ -363,7 +392,7 @@ const AVFilter ff_vsink_buffer = { 67 | .init = common_init, 68 | .uninit = uninit, 69 | .activate = activate, 70 | - FILTER_INPUTS(ff_video_default_filterpad), 71 | + FILTER_INPUTS(avfilter_vsink_buffer_inputs), 72 | .outputs = NULL, 73 | FILTER_QUERY_FUNC(vsink_query_formats), 74 | }; 75 | diff --git a/libavfilter/buffersink.h b/libavfilter/buffersink.h 76 | index 361d603679..47a296cf5e 100644 77 | --- a/libavfilter/buffersink.h 78 | +++ b/libavfilter/buffersink.h 79 | @@ -166,6 +166,9 @@ int av_buffersink_get_frame(AVFilterContext *ctx, AVFrame *frame); 80 | */ 81 | int av_buffersink_get_samples(AVFilterContext *ctx, AVFrame *frame, int nb_samples); 82 | 83 | +typedef AVFrame * av_buffersink_alloc_video_frame(AVFilterContext * ctx, void * v, int w, int h); 84 | +int av_buffersink_set_alloc_video_frame(AVFilterContext *ctx, av_buffersink_alloc_video_frame * cb, void * v); 85 | + 86 | /** 87 | * @} 88 | */ 89 | -- 90 | 2.43.0 91 | 92 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0025-vulkan-Add-missing-decode-extension-defines.patch: -------------------------------------------------------------------------------- 1 | From 43215fe4b60390f6d102ce9e8a9b148d78b14aea Mon Sep 17 00:00:00 2001 2 | From: John Cox 3 | Date: Mon, 20 Mar 2023 18:15:08 +0000 4 | Subject: [PATCH 25/41] vulkan: Add missing decode extension defines 5 | 6 | When building on bookworm the video decode extension names 7 | were missing. This adds them. I expect this patch will be 8 | obsolete shortly but it solves a current problem. 9 | --- 10 | libavutil/hwcontext_vulkan.c | 8 ++++++++ 11 | 1 file changed, 8 insertions(+) 12 | 13 | diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c 14 | index 6317ab7d0e..7632ba7fa2 100644 15 | --- a/libavutil/hwcontext_vulkan.c 16 | +++ b/libavutil/hwcontext_vulkan.c 17 | @@ -72,6 +72,14 @@ 18 | #define CHECK_CU(x) FF_CUDA_CHECK_DL(cuda_cu, cu, x) 19 | #endif 20 | 21 | +// Sometimes missing definitions 22 | +#ifndef VK_EXT_VIDEO_DECODE_H264_EXTENSION_NAME 23 | +#define VK_EXT_VIDEO_DECODE_H264_EXTENSION_NAME "VK_EXT_video_decode_h264" 24 | +#endif 25 | +#ifndef VK_EXT_VIDEO_DECODE_H265_EXTENSION_NAME 26 | +#define VK_EXT_VIDEO_DECODE_H265_EXTENSION_NAME "VK_EXT_video_decode_h265" 27 | +#endif 28 | + 29 | typedef struct VulkanDevicePriv { 30 | /** 31 | * The public AVVulkanDeviceContext. See hwcontext_vulkan.h for it. 32 | -- 33 | 2.43.0 34 | 35 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0028-tests-swscale-Add-a-timing-option.patch: -------------------------------------------------------------------------------- 1 | From 0f80e797ebe7b36ff34f93388b4ea4b571d0a131 Mon Sep 17 00:00:00 2001 2 | From: John Cox 3 | Date: Wed, 26 Apr 2023 16:31:23 +0000 4 | Subject: [PATCH 28/41] tests/swscale: Add a timing option 5 | 6 | -t Where n is the number of time to loop the scale op. 7 | Often useful to do it 10 times or so for better resolution 8 | 9 | (cherry picked from commit 50cd60a23a66254f911376602d07b30fcafbde96) 10 | --- 11 | libswscale/tests/swscale.c | 32 ++++++++++++++++++++++++++++++-- 12 | 1 file changed, 30 insertions(+), 2 deletions(-) 13 | 14 | diff --git a/libswscale/tests/swscale.c b/libswscale/tests/swscale.c 15 | index 3b89b72ce0..97d5a4bd2e 100644 16 | --- a/libswscale/tests/swscale.c 17 | +++ b/libswscale/tests/swscale.c 18 | @@ -23,6 +23,7 @@ 19 | #include 20 | #include 21 | #include 22 | +#include 23 | 24 | #undef HAVE_AV_CONFIG_H 25 | #include "libavutil/cpu.h" 26 | @@ -98,6 +99,15 @@ struct Results { 27 | uint32_t crc; 28 | }; 29 | 30 | +static int time_rep = 0; 31 | + 32 | +static uint64_t utime(void) 33 | +{ 34 | + struct timespec ts; 35 | + clock_gettime(CLOCK_MONOTONIC, &ts); 36 | + return ts.tv_nsec / 1000 + (uint64_t)ts.tv_sec * 1000000; 37 | +} 38 | + 39 | // test by ref -> src -> dst -> out & compare out against ref 40 | // ref & out are YV12 41 | static int doTest(const uint8_t * const ref[4], int refStride[4], int w, int h, 42 | @@ -213,7 +223,7 @@ static int doTest(const uint8_t * const ref[4], int refStride[4], int w, int h, 43 | goto end; 44 | } 45 | 46 | - printf(" %s %dx%d -> %s %3dx%3d flags=%2d", 47 | + printf(" %s %4dx%4d -> %s %4dx%4d flags=%2d", 48 | desc_src->name, srcW, srcH, 49 | desc_dst->name, dstW, dstH, 50 | flags); 51 | @@ -221,6 +231,17 @@ static int doTest(const uint8_t * const ref[4], int refStride[4], int w, int h, 52 | 53 | sws_scale(dstContext, (const uint8_t * const*)src, srcStride, 0, srcH, dst, dstStride); 54 | 55 | + if (time_rep != 0) 56 | + { 57 | + const uint64_t now = utime(); 58 | + uint64_t done; 59 | + for (i = 1; i != time_rep; ++i) { 60 | + sws_scale(dstContext, (const uint8_t * const*)src, srcStride, 0, srcH, dst, dstStride); 61 | + } 62 | + done = utime(); 63 | + printf(" T=%7"PRId64"us ", done-now); 64 | + } 65 | + 66 | for (i = 0; i < 4 && dstStride[i]; i++) 67 | crc = av_crc(av_crc_get_table(AV_CRC_32_IEEE), crc, dst[i], 68 | dstStride[i] * dstH); 69 | @@ -496,7 +517,14 @@ int main(int argc, char **argv) 70 | char * p = NULL; 71 | H = strtoul(arg2, &p, 0); 72 | if (!H || *p) { 73 | - fprintf(stderr, "bad height '%s' (H=%d, *p=%d)\n", arg2, H, *p); 74 | + fprintf(stderr, "bad height '%s'\n", arg2); 75 | + return -1; 76 | + } 77 | + } else if (!strcmp(argv[i], "-t")) { 78 | + char * p = NULL; 79 | + time_rep = (int)strtol(arg2, &p, 0); 80 | + if (*p) { 81 | + fprintf(stderr, "bad time repetitions '%s'\n", arg2); 82 | return -1; 83 | } 84 | } else if (!strcmp(argv[i], "-p")) { 85 | -- 86 | 2.43.0 87 | 88 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0029-vf_bwdif-Add-ability-to-deinterlace-NV12.patch: -------------------------------------------------------------------------------- 1 | From 7c32cac8896d80dcc91566873fd61fe3b5b3b29f Mon Sep 17 00:00:00 2001 2 | From: John Cox 3 | Date: Tue, 21 May 2024 17:06:29 +0100 4 | Subject: [PATCH 29/41] vf_bwdif: Add ability to deinterlace NV12 5 | 6 | --- 7 | libavfilter/vf_bwdif.c | 16 +++++++++++++--- 8 | 1 file changed, 13 insertions(+), 3 deletions(-) 9 | 10 | diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c 11 | index d41a25f8ea..233b17a21b 100644 12 | --- a/libavfilter/vf_bwdif.c 13 | +++ b/libavfilter/vf_bwdif.c 14 | @@ -115,19 +115,28 @@ static void filter(AVFilterContext *ctx, AVFrame *dstpic, 15 | YADIFContext *yadif = &bwdif->yadif; 16 | ThreadData td = { .frame = dstpic, .parity = parity, .tff = tff }; 17 | int i; 18 | + int last_plane = -1; 19 | 20 | for (i = 0; i < yadif->csp->nb_components; i++) { 21 | int w = dstpic->width; 22 | int h = dstpic->height; 23 | + const AVComponentDescriptor * const comp = yadif->csp->comp + i; 24 | + 25 | + // If the last plane was the same as this plane assume we've dealt 26 | + // with all the pels already 27 | + if (last_plane == comp->plane) 28 | + continue; 29 | + last_plane = comp->plane; 30 | 31 | if (i == 1 || i == 2) { 32 | w = AV_CEIL_RSHIFT(w, yadif->csp->log2_chroma_w); 33 | h = AV_CEIL_RSHIFT(h, yadif->csp->log2_chroma_h); 34 | } 35 | 36 | - td.w = w; 37 | - td.h = h; 38 | - td.plane = i; 39 | + // comp step is in bytes but td.w is in pels 40 | + td.w = w * comp->step / ((comp->depth + 7) / 8); 41 | + td.h = h; 42 | + td.plane = comp->plane; 43 | 44 | ff_filter_execute(ctx, filter_slice, &td, NULL, 45 | FFMIN((h+3)/4, ff_filter_get_nb_threads(ctx))); 46 | @@ -151,6 +160,7 @@ static const enum AVPixelFormat pix_fmts[] = { 47 | AV_PIX_FMT_YUVA420P9, AV_PIX_FMT_YUVA422P9, AV_PIX_FMT_YUVA444P9, 48 | AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA422P10, AV_PIX_FMT_YUVA444P10, 49 | AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16, 50 | + AV_PIX_FMT_NV12, 51 | AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10, 52 | AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16, 53 | AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP16, 54 | -- 55 | 2.43.0 56 | 57 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0030-fate-Fix-tests-broken-by-addition-of-sand-formats.patch: -------------------------------------------------------------------------------- 1 | From 2b589e80edb18a8d40083d2f4015ea5698501b6d Mon Sep 17 00:00:00 2001 2 | From: James Le Cuirot 3 | Date: Tue, 20 Feb 2024 22:52:59 +0000 4 | Subject: [PATCH 30/41] fate: Fix tests broken by addition of sand formats 5 | 6 | --- 7 | tests/ref/fate/imgutils | 6 ++++++ 8 | tests/ref/fate/sws-pixdesc-query | 8 ++++++++ 9 | 2 files changed, 14 insertions(+) 10 | 11 | diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils 12 | index fb2ed6d158..61fd261b60 100644 13 | --- a/tests/ref/fate/imgutils 14 | +++ b/tests/ref/fate/imgutils 15 | @@ -235,6 +235,9 @@ nv24 planes: 2, linesizes: 64 128 0 0, plane_sizes: 3072 6144 16 | nv42 planes: 2, linesizes: 64 128 0 0, plane_sizes: 3072 6144 0 0, plane_offsets: 3072 0 0, total_size: 9216 17 | y210be planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 18 | y210le planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 19 | +sand128 planes: 2, linesizes: 64 64 0 0, plane_sizes: 3072 1536 0 0, plane_offsets: 3072 0 0, total_size: 4608 20 | +sand64_10 planes: 2, linesizes: 128 128 0 0, plane_sizes: 6144 3072 0 0, plane_offsets: 6144 0 0, total_size: 9216 21 | +sand64_16 planes: 2, linesizes: 128 128 0 0, plane_sizes: 6144 3072 0 0, plane_offsets: 6144 0 0, total_size: 9216 22 | x2rgb10le planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 23 | x2rgb10be planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 24 | x2bgr10le planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 25 | @@ -451,6 +454,9 @@ nv24 total_size: 9216, black_unknown_crc: 0x1c302b58, black_tv_cr 26 | nv42 total_size: 9216, black_unknown_crc: 0x1c302b58, black_tv_crc: 0x1c302b58, black_pc_crc: 0xdf792ea7 27 | y210be total_size: 12288, black_unknown_crc: 0x5483d935, black_tv_crc: 0x5483d935, black_pc_crc: 0x06397bf3 28 | y210le total_size: 12288, black_unknown_crc: 0x5d8e1cf6, black_tv_crc: 0x5d8e1cf6, black_pc_crc: 0x8fceec45 29 | +sand128 total_size: 4608, black_unknown_crc: 0xd00f6cc6, black_tv_crc: 0xd00f6cc6, black_pc_crc: 0x234969af 30 | +sand64_10 total_size: 9216, black_unknown_crc: 0xee47624d, black_tv_crc: 0xee47624d, black_pc_crc: 0x7c6afe45 31 | +sand64_16 total_size: 9216, black_unknown_crc: 0xfff85b60, black_tv_crc: 0xfff85b60, black_pc_crc: 0xc03cff93 32 | x2rgb10le total_size: 12288, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 33 | x2rgb10be total_size: 12288, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 34 | x2bgr10le total_size: 12288, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 35 | diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query 36 | index fff93bbf0e..96fefd5b8a 100644 37 | --- a/tests/ref/fate/sws-pixdesc-query 38 | +++ b/tests/ref/fate/sws-pixdesc-query 39 | @@ -23,6 +23,7 @@ is16BPS: 40 | rgba64le 41 | rgbaf16be 42 | rgbaf16le 43 | + sand64_16 44 | ya16be 45 | ya16le 46 | yuv420p16be 47 | @@ -75,6 +76,7 @@ isNBPS: 48 | p410le 49 | p412be 50 | p412le 51 | + sand64_10 52 | x2bgr10be 53 | x2bgr10le 54 | x2rgb10be 55 | @@ -245,6 +247,9 @@ isYUV: 56 | p412le 57 | p416be 58 | p416le 59 | + sand128 60 | + sand64_10 61 | + sand64_16 62 | uyvy422 63 | uyyvyy411 64 | vuya 65 | @@ -818,6 +823,9 @@ Packed: 66 | rgbaf32le 67 | rgbf32be 68 | rgbf32le 69 | + sand128 70 | + sand64_10 71 | + sand64_16 72 | uyvy422 73 | uyyvyy411 74 | vuya 75 | -- 76 | 2.43.0 77 | 78 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0031-checkasm-Allow-rpi_sand-test-to-build-and-pass-on-no.patch: -------------------------------------------------------------------------------- 1 | From a8cc644aca0211d806d722bb1dbcd0b39158c149 Mon Sep 17 00:00:00 2001 2 | From: James Le Cuirot 3 | Date: Tue, 20 Feb 2024 22:54:04 +0000 4 | Subject: [PATCH 31/41] checkasm: Allow rpi_sand test to build and pass on 5 | non-ARM architectures 6 | 7 | --- 8 | tests/checkasm/rpi_sand.c | 4 ++++ 9 | 1 file changed, 4 insertions(+) 10 | 11 | diff --git a/tests/checkasm/rpi_sand.c b/tests/checkasm/rpi_sand.c 12 | index 0888714c4c..dd9c1350bc 100644 13 | --- a/tests/checkasm/rpi_sand.c 14 | +++ b/tests/checkasm/rpi_sand.c 15 | @@ -29,6 +29,10 @@ 16 | #elif ARCH_AARCH64 17 | #include "libavutil/aarch64/cpu.h" 18 | #include "libavutil/aarch64/rpi_sand_neon.h" 19 | +#else 20 | +#define have_neon(flags) 0 21 | +#define ff_rpi_sand30_lines_to_planar_y16 NULL 22 | +#define ff_rpi_sand30_lines_to_planar_c16 NULL 23 | #endif 24 | 25 | static inline uint32_t pack30(unsigned int a, unsigned int b, unsigned int c) 26 | -- 27 | 2.43.0 28 | 29 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0032-pi-util-ffconf-Rework-to-have-clearer-h-w-or-s-w-tes.patch: -------------------------------------------------------------------------------- 1 | From 066faed54f529d1f4bfa1afd99568d2b15ab3144 Mon Sep 17 00:00:00 2001 2 | From: John Cox 3 | Date: Thu, 28 Nov 2024 15:15:58 +0000 4 | Subject: [PATCH 32/41] pi-util/ffconf: Rework to have clearer h/w or s/w test 5 | 6 | --- 7 | pi-util/ffconf.py | 49 ++++++++++++++++++++++++++++------------------- 8 | 1 file changed, 29 insertions(+), 20 deletions(-) 9 | 10 | diff --git a/pi-util/ffconf.py b/pi-util/ffconf.py 11 | index 26091f3c07..573f1e03c0 100755 12 | --- a/pi-util/ffconf.py 13 | +++ b/pi-util/ffconf.py 14 | @@ -9,10 +9,15 @@ import sys 15 | import csv 16 | from stat import * 17 | 18 | -CODEC_HEVC_RPI = 1 19 | -HWACCEL_RPI = 2 20 | -HWACCEL_DRM = 3 21 | -HWACCEL_VAAPI = 4 22 | +class DecodeType: 23 | + def __init__(self, textname, hwaccel): 24 | + self.textname = textname 25 | + self.hwaccel = hwaccel 26 | + 27 | +hwaccel_rpi = DecodeType("RPI Test/Legacy", "rpi") 28 | +hwaccel_sw = DecodeType("Software", None) 29 | +hwaccel_drm = DecodeType("DRM Prime", "drm") 30 | +hwaccel_vaapi = DecodeType("VAAPI", "vaapi") 31 | 32 | def testone(fileroot, srcname, es_file, md5_file, pix, dectype, vcodec, args): 33 | ffmpeg_exec = args.ffmpeg 34 | @@ -20,14 +25,6 @@ def testone(fileroot, srcname, es_file, md5_file, pix, dectype, vcodec, args): 35 | valgrind = args.valgrind 36 | rv = 0 37 | 38 | - hwaccel = "" 39 | - if dectype == HWACCEL_RPI: 40 | - hwaccel = "rpi" 41 | - elif dectype == HWACCEL_DRM: 42 | - hwaccel = "drm" 43 | - elif dectype == HWACCEL_VAAPI: 44 | - hwaccel = "vaapi" 45 | - 46 | pix_fmt = [] 47 | if pix == "8": 48 | pix_fmt = ["-pix_fmt", "yuv420p"] 49 | @@ -62,7 +59,7 @@ def testone(fileroot, srcname, es_file, md5_file, pix, dectype, vcodec, args): 50 | flog = open(os.path.join(tmp_root, name + ".log"), "w+t") 51 | 52 | ffargs = [ffmpeg_exec, "-flags", "unaligned"] +\ 53 | - (["-hwaccel", hwaccel] if hwaccel else []) +\ 54 | + (["-hwaccel", dectype.hwaccel] if dectype.hwaccel else []) +\ 55 | ["-vcodec", "hevc", "-i", os.path.join(fileroot, es_file)] +\ 56 | pix_fmt +\ 57 | ([yuv_file] if gen_yuv else ["-f", "md5", dec_file]) 58 | @@ -192,6 +189,8 @@ def doconf(csva, tests, test_root, vcodec, dectype, args): 59 | else : 60 | print(": * BANG *") 61 | 62 | + print() 63 | + print("Tested using decode type:", dectype.textname) 64 | if unx_failures or unx_success: 65 | print("Unexpected Failures:", unx_failures) 66 | print("Unexpected Success: ", unx_success) 67 | @@ -210,12 +209,15 @@ class ConfCSVDialect(csv.Dialect): 68 | skipinitialspace = True 69 | strict = True 70 | 71 | + 72 | + 73 | if __name__ == '__main__': 74 | 75 | argp = argparse.ArgumentParser(description="FFmpeg h265 conformance tester") 76 | argp.add_argument("tests", nargs='*') 77 | argp.add_argument("--pi4", action='store_true', help="Force pi4 cmd line") 78 | argp.add_argument("--drm", action='store_true', help="Force v4l2 drm cmd line") 79 | + argp.add_argument("--sw", action='store_true', help="Use software decode") 80 | argp.add_argument("--vaapi", action='store_true', help="Force vaapi cmd line") 81 | argp.add_argument("--test_root", default="/opt/conform/h265.2016", help="Root dir for test") 82 | argp.add_argument("--csvgen", action='store_true', help="Generate CSV file for dir") 83 | @@ -238,18 +240,20 @@ if __name__ == '__main__': 84 | with open(args.csv, 'rt') as csvfile: 85 | csva = [a for a in csv.reader(csvfile, ConfCSVDialect())] 86 | 87 | - dectype = CODEC_HEVC_RPI 88 | + dectype = None 89 | if os.path.exists("/dev/rpivid-hevcmem"): 90 | - dectype = HWACCEL_RPI 91 | - if args.drm or os.path.exists("/sys/module/rpivid_hevc"): 92 | - dectype = HWACCEL_DRM 93 | + dectype = hwaccel_rpi 94 | + if os.path.exists("/sys/module/rpivid_hevc"): 95 | + dectype = hwaccel_drm 96 | 97 | if args.pi4: 98 | - dectype = HWACCEL_RPI 99 | + dectype = hwaccel_rpi 100 | elif args.drm: 101 | - dectype = HWACCEL_DRM 102 | + dectype = hwaccel_drm 103 | elif args.vaapi: 104 | - dectype = HWACCEL_VAAPI 105 | + dectype = hwaccel_vaapi 106 | + elif args.sw: 107 | + dectype = hwaccel_sw 108 | 109 | if os.path.isdir(args.ffmpeg): 110 | args.ffmpeg = os.path.join(args.ffmpeg, "ffmpeg") 111 | @@ -257,6 +261,11 @@ if __name__ == '__main__': 112 | print("FFmpeg file '%s' not found" % args.ffmpeg) 113 | exit(1) 114 | 115 | + if not dectype: 116 | + print("No decode type selected and no h/w detected") 117 | + exit(1) 118 | + print("Running test using decode:", dectype.textname) 119 | + 120 | i = 0 121 | while True: 122 | i = i + 1 123 | -- 124 | 2.43.0 125 | 126 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0033-rpi_sand-Fix-includes-copyright-for-fate.patch: -------------------------------------------------------------------------------- 1 | From 89dfeb9c139dab093075f25fe1abf488fa250168 Mon Sep 17 00:00:00 2001 2 | From: John Cox 3 | Date: Thu, 28 Nov 2024 18:35:07 +0000 4 | Subject: [PATCH 33/41] rpi_sand: Fix includes & copyright for fate 5 | 6 | --- 7 | libavutil/aarch64/rpi_sand_neon.h | 4 +++- 8 | libavutil/arm/rpi_sand_neon.h | 4 ++-- 9 | libavutil/{rpi_sand_fn_pw.h => rpi_sand_fn_pw.c} | 0 10 | libavutil/rpi_sand_fns.c | 4 ++-- 11 | libavutil/rpi_sand_fns.h | 4 ++-- 12 | 5 files changed, 9 insertions(+), 7 deletions(-) 13 | rename libavutil/{rpi_sand_fn_pw.h => rpi_sand_fn_pw.c} (100%) 14 | 15 | diff --git a/libavutil/aarch64/rpi_sand_neon.h b/libavutil/aarch64/rpi_sand_neon.h 16 | index 2a56135bc3..e0e94f6aa1 100644 17 | --- a/libavutil/aarch64/rpi_sand_neon.h 18 | +++ b/libavutil/aarch64/rpi_sand_neon.h 19 | @@ -26,7 +26,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 20 | Authors: Michael Eiler 21 | */ 22 | 23 | -#pragma once 24 | +#ifndef AVUTIL_AARCH64_RPI_SAND_NEON_H 25 | +#define AVUTIL_AARCH64_RPI_SAND_NEON_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | @@ -57,3 +58,4 @@ void ff_rpi_sand30_lines_to_planar_y8(uint8_t * dest, unsigned int dst_stride, 30 | } 31 | #endif 32 | 33 | +#endif /* AVCODEC_SAND_NEON_H */ 34 | diff --git a/libavutil/arm/rpi_sand_neon.h b/libavutil/arm/rpi_sand_neon.h 35 | index d457c10870..d8126676ee 100644 36 | --- a/libavutil/arm/rpi_sand_neon.h 37 | +++ b/libavutil/arm/rpi_sand_neon.h 38 | @@ -27,8 +27,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | Authors: John Cox 40 | */ 41 | 42 | -#ifndef AVUTIL_ARM_SAND_NEON_H 43 | -#define AVUTIL_ARM_SAND_NEON_H 44 | +#ifndef AVUTIL_ARM_RPI_SAND_NEON_H 45 | +#define AVUTIL_ARM_RPI_SAND_NEON_H 46 | 47 | void ff_rpi_sand128b_stripe_to_8_10( 48 | uint8_t * dest, // [r0] 49 | diff --git a/libavutil/rpi_sand_fn_pw.h b/libavutil/rpi_sand_fn_pw.c 50 | similarity index 100% 51 | rename from libavutil/rpi_sand_fn_pw.h 52 | rename to libavutil/rpi_sand_fn_pw.c 53 | diff --git a/libavutil/rpi_sand_fns.c b/libavutil/rpi_sand_fns.c 54 | index 0626bb06cb..2e19dd3a7b 100644 55 | --- a/libavutil/rpi_sand_fns.c 56 | +++ b/libavutil/rpi_sand_fns.c 57 | @@ -47,11 +47,11 @@ Authors: John Cox 58 | #endif 59 | 60 | #define PW 1 61 | -#include "rpi_sand_fn_pw.h" 62 | +#include "rpi_sand_fn_pw.c" 63 | #undef PW 64 | 65 | #define PW 2 66 | -#include "rpi_sand_fn_pw.h" 67 | +#include "rpi_sand_fn_pw.c" 68 | #undef PW 69 | 70 | #if 1 71 | diff --git a/libavutil/rpi_sand_fns.h b/libavutil/rpi_sand_fns.h 72 | index 462ccb8abd..f7ba62ff73 100644 73 | --- a/libavutil/rpi_sand_fns.h 74 | +++ b/libavutil/rpi_sand_fns.h 75 | @@ -27,8 +27,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 76 | Authors: John Cox 77 | */ 78 | 79 | -#ifndef AVUTIL_RPI_SAND_FNS 80 | -#define AVUTIL_RPI_SAND_FNS 81 | +#ifndef AVUTIL_RPI_SAND_FNS_H 82 | +#define AVUTIL_RPI_SAND_FNS_H 83 | 84 | #include "libavutil/frame.h" 85 | 86 | -- 87 | 2.43.0 88 | 89 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0034-weak_link-Fix-includes-copyright-for-fate.patch: -------------------------------------------------------------------------------- 1 | From c17a897d7bbb47f88ef99e01ea3fada4b65dc212 Mon Sep 17 00:00:00 2001 2 | From: John Cox 3 | Date: Thu, 28 Nov 2024 18:36:10 +0000 4 | Subject: [PATCH 34/41] weak_link: Fix includes & copyright for fate 5 | 6 | --- 7 | libavcodec/weak_link.c | 24 ++++++++++++++++++++++++ 8 | libavcodec/weak_link.h | 33 ++++++++++++++++++++++++++++----- 9 | 2 files changed, 52 insertions(+), 5 deletions(-) 10 | 11 | diff --git a/libavcodec/weak_link.c b/libavcodec/weak_link.c 12 | index 5a79e89ed7..71f6cc3567 100644 13 | --- a/libavcodec/weak_link.c 14 | +++ b/libavcodec/weak_link.c 15 | @@ -1,3 +1,27 @@ 16 | +/* 17 | + Copyright (C) 2024 John Cox john.cox@raspberrypi.com 18 | + 19 | + Permission is hereby granted, free of charge, to any person 20 | + obtaining a copy of this software and associated documentation 21 | + files (the "Software"), to deal in the Software without 22 | + restriction, including without limitation the rights to use, copy, 23 | + modify, merge, publish, distribute, sublicense, and/or sell copies 24 | + of the Software, and to permit persons to whom the Software is 25 | + furnished to do so, subject to the following conditions: 26 | + 27 | + The above copyright notice and this permission notice shall be 28 | + included in all copies or substantial portions of the Software. 29 | + 30 | + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 31 | + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 32 | + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 33 | + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 34 | + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 35 | + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 37 | + DEALINGS IN THE SOFTWARE. 38 | + */ 39 | + 40 | #include 41 | #include 42 | #include 43 | diff --git a/libavcodec/weak_link.h b/libavcodec/weak_link.h 44 | index 415b6a27a0..5c66b29f9b 100644 45 | --- a/libavcodec/weak_link.h 46 | +++ b/libavcodec/weak_link.h 47 | @@ -1,3 +1,30 @@ 48 | +/* 49 | + Copyright (C) 2024 John Cox john.cox@raspberrypi.com 50 | + 51 | + Permission is hereby granted, free of charge, to any person 52 | + obtaining a copy of this software and associated documentation 53 | + files (the "Software"), to deal in the Software without 54 | + restriction, including without limitation the rights to use, copy, 55 | + modify, merge, publish, distribute, sublicense, and/or sell copies 56 | + of the Software, and to permit persons to whom the Software is 57 | + furnished to do so, subject to the following conditions: 58 | + 59 | + The above copyright notice and this permission notice shall be 60 | + included in all copies or substantial portions of the Software. 61 | + 62 | + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 63 | + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 64 | + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 65 | + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 66 | + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 67 | + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 68 | + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 69 | + DEALINGS IN THE SOFTWARE. 70 | + */ 71 | + 72 | +#ifndef AVCODEC_WEAK_LINK_H 73 | +#define AVCODEC_WEAK_LINK_H 74 | + 75 | struct ff_weak_link_master; 76 | struct ff_weak_link_client; 77 | 78 | @@ -16,8 +43,4 @@ void ff_weak_link_unref(struct ff_weak_link_client ** ppLink); 79 | void * ff_weak_link_lock(struct ff_weak_link_client ** ppLink); 80 | void ff_weak_link_unlock(struct ff_weak_link_client * c); 81 | 82 | - 83 | - 84 | - 85 | - 86 | - 87 | +#endif 88 | -- 89 | 2.43.0 90 | 91 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0036-fate-source-Add-old-hevc-headers-to-copyright-inclus.patch: -------------------------------------------------------------------------------- 1 | From a5c9017c49bacf3edf71818150f1310de529a6da Mon Sep 17 00:00:00 2001 2 | From: John Cox 3 | Date: Thu, 28 Nov 2024 18:59:39 +0000 4 | Subject: [PATCH 36/41] fate/source: Add old hevc headers to copyright & 5 | inclusion lists 6 | 7 | Add old hevc header to exclusion lists rather than fixing them as 8 | they are simple copies of system headers. Remove this patch once 9 | we remove the old variation from the decoder. 10 | --- 11 | tests/ref/fate/source | 6 ++++++ 12 | 1 file changed, 6 insertions(+) 13 | 14 | diff --git a/tests/ref/fate/source b/tests/ref/fate/source 15 | index 78d3a2e0fa..a0ab585585 100644 16 | --- a/tests/ref/fate/source 17 | +++ b/tests/ref/fate/source 18 | @@ -1,5 +1,8 @@ 19 | Files without standard license headers: 20 | libavcodec/file_open.c 21 | +libavcodec/hevc-ctrls-v1.h 22 | +libavcodec/hevc-ctrls-v2.h 23 | +libavcodec/hevc-ctrls-v3.h 24 | libavcodec/interplayacm.c 25 | libavcodec/log2_tab.c 26 | libavcodec/reverse.c 27 | @@ -26,6 +29,9 @@ compat/float/float.h 28 | compat/float/limits.h 29 | compat/stdbit/stdbit.h 30 | libavcodec/bitstream_template.h 31 | +libavcodec/hevc-ctrls-v1.h 32 | +libavcodec/hevc-ctrls-v2.h 33 | +libavcodec/hevc-ctrls-v3.h 34 | tools/decode_simple.h 35 | Use of av_clip() where av_clip_uintp2() could be used: 36 | Use of av_clip() where av_clip_intp2() could be used: 37 | -- 38 | 2.43.0 39 | 40 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0038-fate-filter-fps-Disable-test-due-to-Pi-other-mismatc.patch: -------------------------------------------------------------------------------- 1 | From 3feaf937efd5c0c7b98631f3cf8d8e13889033cc Mon Sep 17 00:00:00 2001 2 | From: John Cox 3 | Date: Mon, 2 Dec 2024 13:20:54 +0000 4 | Subject: [PATCH 38/41] fate/filter-fps: Disable test due to Pi/other mismatch 5 | 6 | This test has an implicit RGB->YUV conversion that uses the quick asm 7 | code pn Pi and the better code on other platforms. This gives a 8 | different result. Disable to avoid confusion. Better flags might allow 9 | for something that works on both, but that hasn't been done yet. 10 | --- 11 | tests/fate/filter-video.mak | 6 +++--- 12 | 1 file changed, 3 insertions(+), 3 deletions(-) 13 | 14 | diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak 15 | index 5b8a294afd..2d67ca68fc 100644 16 | --- a/tests/fate/filter-video.mak 17 | +++ b/tests/fate/filter-video.mak 18 | @@ -391,9 +391,9 @@ fate-filter-fps-down-eof-pass: CMD = framecrc -lavfi testsrc2=r=7:d=3.5,fps=3:eo 19 | fate-filter-fps-start-drop: CMD = framecrc -lavfi testsrc2=r=7:d=3.5,fps=3:start_time=1.5 20 | fate-filter-fps-start-fill: CMD = framecrc -lavfi testsrc2=r=7:d=1.5,setpts=PTS+14,fps=3:start_time=1.5 21 | 22 | -FATE_FILTER_SAMPLES-$(call FILTERDEMDEC, FPS SCALE, MOV, QTRLE) += fate-filter-fps-cfr fate-filter-fps 23 | -fate-filter-fps-cfr: CMD = framecrc -auto_conversion_filters -i $(TARGET_SAMPLES)/qtrle/apple-animation-variable-fps-bug.mov -r 30 -fps_mode cfr -pix_fmt yuv420p 24 | -fate-filter-fps: CMD = framecrc -auto_conversion_filters -i $(TARGET_SAMPLES)/qtrle/apple-animation-variable-fps-bug.mov -vf fps=30 -pix_fmt yuv420p 25 | +#FATE_FILTER_SAMPLES-$(call FILTERDEMDEC, FPS SCALE, MOV, QTRLE) += fate-filter-fps-cfr fate-filter-fps 26 | +#fate-filter-fps-cfr: CMD = framecrc -auto_conversion_filters -i $(TARGET_SAMPLES)/qtrle/apple-animation-variable-fps-bug.mov -r 30 -fps_mode cfr -pix_fmt yuv420p 27 | +#fate-filter-fps: CMD = framecrc -auto_conversion_filters -i $(TARGET_SAMPLES)/qtrle/apple-animation-variable-fps-bug.mov -vf fps=30 -pix_fmt yuv420p 28 | 29 | FATE_FILTER_SAMPLES-$(call FILTERFRAMECRC, TESTSRC2 FSYNC, FILE_PROTOCOL) += fate-filter-fsync-up fate-filter-fsync-down 30 | fate-filter-fsync-up: tests/data/maps/fsync-up 31 | -- 32 | 2.43.0 33 | 34 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0039-vf_deinterlace_v4l2m2m-Only-enable-if-drm-v4l2m2m-en.patch: -------------------------------------------------------------------------------- 1 | From eb1a070df0e5c287d1db6c8c44cd5bbf7a6e6b24 Mon Sep 17 00:00:00 2001 2 | From: John Cox 3 | Date: Mon, 2 Dec 2024 12:22:07 +0000 4 | Subject: [PATCH 39/41] vf_deinterlace_v4l2m2m: Only enable if drm & v4l2m2m 5 | enabled 6 | 7 | Fix compiles where drm is disabled. Applies to v4l2_scale_m2m too. 8 | --- 9 | configure | 2 ++ 10 | 1 file changed, 2 insertions(+) 11 | 12 | diff --git a/configure b/configure 13 | index 9fd1c02efd..5c0854f627 100755 14 | --- a/configure 15 | +++ b/configure 16 | @@ -3875,6 +3875,7 @@ cropdetect_filter_deps="gpl" 17 | deinterlace_qsv_filter_deps="libmfx" 18 | deinterlace_qsv_filter_select="qsvvpp" 19 | deinterlace_vaapi_filter_deps="vaapi" 20 | +deinterlace_v4l2m2m_filter_deps="libdrm v4l2_m2m" 21 | delogo_filter_deps="gpl" 22 | denoise_vaapi_filter_deps="vaapi" 23 | derain_filter_select="dnn" 24 | @@ -3995,6 +3996,7 @@ libvmaf_cuda_filter_deps="libvmaf libvmaf_cuda ffnvcodec" 25 | zmq_filter_deps="libzmq" 26 | zoompan_filter_deps="swscale" 27 | zscale_filter_deps="libzimg const_nan" 28 | +scale_v4l2m2m_filter_deps="libdrm v4l2_m2m" 29 | scale_vaapi_filter_deps="vaapi" 30 | scale_vt_filter_deps="videotoolbox VTPixelTransferSessionCreate" 31 | scale_vulkan_filter_deps="vulkan spirv_compiler" 32 | -- 33 | 2.43.0 34 | 35 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0040-v4l2_m2m-Fix-compile-if-we-have-V4L2-but-not-DRM.patch: -------------------------------------------------------------------------------- 1 | From ddb0e8f68ceca270cd6d607cf80bb717f992f1ab Mon Sep 17 00:00:00 2001 2 | From: John Cox 3 | Date: Mon, 2 Dec 2024 13:25:26 +0000 4 | Subject: [PATCH 40/41] v4l2_m2m: Fix compile if we have V4L2 but not DRM 5 | 6 | --- 7 | libavcodec/v4l2_buffers.c | 16 +++++++++++++++- 8 | 1 file changed, 15 insertions(+), 1 deletion(-) 9 | 10 | diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c 11 | index 97ceb7aa2d..5920463d0a 100644 12 | --- a/libavcodec/v4l2_buffers.c 13 | +++ b/libavcodec/v4l2_buffers.c 14 | @@ -21,7 +21,7 @@ 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 16 | */ 17 | 18 | -#include 19 | +#include "config.h" 20 | #include 21 | #include 22 | #include 23 | @@ -40,6 +40,10 @@ 24 | #include "v4l2_req_dmabufs.h" 25 | #include "weak_link.h" 26 | 27 | +#if CONFIG_LIBDRM 28 | +#include 29 | +#endif 30 | + 31 | #define USEC_PER_SEC 1000000 32 | static const AVRational v4l2_timebase = { 1, USEC_PER_SEC }; 33 | 34 | @@ -442,6 +446,7 @@ FF_ENABLE_DEPRECATION_WARNINGS 35 | frame->flags & ~AV_FRAME_FLAG_KEY; 36 | } 37 | 38 | +#if CONFIG_LIBDRM 39 | static uint8_t * v4l2_get_drm_frame(V4L2Buffer *avbuf) 40 | { 41 | AVDRMFrameDescriptor *drm_desc = &avbuf->drm_frame; 42 | @@ -546,6 +551,7 @@ static uint8_t * v4l2_get_drm_frame(V4L2Buffer *avbuf) 43 | 44 | return (uint8_t *) drm_desc; 45 | } 46 | +#endif 47 | 48 | static void v4l2_free_bufref(void *opaque, uint8_t *data) 49 | { 50 | @@ -628,7 +634,11 @@ static int v4l2_buffer_export_drm(V4L2Buffer* avbuf) 51 | 52 | avbuf->drm_frame.objects[i].size = blen; 53 | avbuf->drm_frame.objects[i].fd = dma_fd; 54 | +#if !CONFIG_LIBDRM 55 | + avbuf->drm_frame.objects[i].format_modifier = 0; 56 | +#else 57 | avbuf->drm_frame.objects[i].format_modifier = DRM_FORMAT_MOD_LINEAR; 58 | +#endif 59 | } 60 | 61 | return 0; 62 | @@ -684,6 +694,9 @@ static int v4l2_buffer_buf_to_swframe(AVFrame *frame, V4L2Buffer *avbuf) 63 | return AVERROR(ENOMEM); 64 | 65 | if (buf_to_m2mctx(avbuf)->output_drm) { 66 | +#if !CONFIG_LIBDRM 67 | + return AVERROR_OPTION_NOT_FOUND; 68 | +#else 69 | /* 1. get references to the actual data */ 70 | const int rv = ff_v4l2_context_frames_set(avbuf->context); 71 | if (rv != 0) 72 | @@ -693,6 +706,7 @@ static int v4l2_buffer_buf_to_swframe(AVFrame *frame, V4L2Buffer *avbuf) 73 | frame->format = AV_PIX_FMT_DRM_PRIME; 74 | frame->hw_frames_ctx = av_buffer_ref(avbuf->context->frames_ref); 75 | return 0; 76 | +#endif 77 | } 78 | 79 | 80 | -- 81 | 2.43.0 82 | 83 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/0041-v4l2_m2m_enc-Fix-compile-if-we-have-V4L2-but-not-DRM.patch: -------------------------------------------------------------------------------- 1 | From 5f39f6c33638de22605b16ec8dc1898135b09bb0 Mon Sep 17 00:00:00 2001 2 | From: John Cox 3 | Date: Mon, 2 Dec 2024 13:26:04 +0000 4 | Subject: [PATCH 41/41] v4l2_m2m_enc: Fix compile if we have V4L2 but not DRM 5 | 6 | --- 7 | libavcodec/v4l2_m2m_enc.c | 12 +++++++++++- 8 | 1 file changed, 11 insertions(+), 1 deletion(-) 9 | 10 | diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c 11 | index b377554e54..6b00e113fa 100644 12 | --- a/libavcodec/v4l2_m2m_enc.c 13 | +++ b/libavcodec/v4l2_m2m_enc.c 14 | @@ -21,10 +21,11 @@ 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 16 | */ 17 | 18 | +#include "config.h" 19 | + 20 | #include 21 | #include 22 | #include 23 | -#include 24 | 25 | #include "encode.h" 26 | #include "libavcodec/avcodec.h" 27 | @@ -41,6 +42,9 @@ 28 | #define MPEG_CID(x) V4L2_CID_MPEG_VIDEO_##x 29 | #define MPEG_VIDEO(x) V4L2_MPEG_VIDEO_##x 30 | 31 | +#if CONFIG_LIBDRM 32 | +#include 33 | + 34 | // P030 should be defined in drm_fourcc.h and hopefully will be sometime 35 | // in the future but until then... 36 | #ifndef DRM_FORMAT_P030 37 | @@ -55,6 +59,8 @@ 38 | #define DRM_FORMAT_NV20 fourcc_code('N', 'V', '2', '0') 39 | #endif 40 | 41 | +#endif 42 | + 43 | #ifndef V4L2_CID_CODEC_BASE 44 | #define V4L2_CID_CODEC_BASE V4L2_CID_MPEG_BASE 45 | #endif 46 | @@ -303,6 +309,9 @@ static int v4l2_prepare_encoder(V4L2m2mContext *s) 47 | 48 | static int avdrm_to_v4l2(struct v4l2_format * const format, const AVFrame * const frame) 49 | { 50 | +#if !CONFIG_LIBDRM 51 | + return AVERROR_OPTION_NOT_FOUND; 52 | +#else 53 | const AVDRMFrameDescriptor *const src = (const AVDRMFrameDescriptor *)frame->data[0]; 54 | 55 | const uint32_t drm_fmt = src->layers[0].format; 56 | @@ -386,6 +395,7 @@ static int avdrm_to_v4l2(struct v4l2_format * const format, const AVFrame * cons 57 | } 58 | 59 | return 0; 60 | +#endif 61 | } 62 | 63 | // Do we have similar enough formats to be usable? 64 | -- 65 | 2.43.0 66 | 67 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/ffmpeg/README.md: -------------------------------------------------------------------------------- 1 | Origin of the patches: https://github.com/jc-kynesim/rpi-ffmpeg/tree/dev/7.1/rpi_import_2 2 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/libcamera/0002-GLODROID-Don-t-add-ljpeg-argument-when-building-liby.patch: -------------------------------------------------------------------------------- 1 | From f1d641c3c2c3273df0ce784cda29f3a0de8e4aa0 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Sat, 3 Dec 2022 13:02:08 +0200 4 | Subject: [PATCH 2/3] GLODROID: Don't add -ljpeg argument when building libyuv 5 | as subproject 6 | 7 | We don't have sysroot with libdir when building within AOSP. 8 | Instead all dependencies are linked directly as path/lib.so link argument. 9 | 10 | Signed-off-by: Roman Stratiienko 11 | --- 12 | src/android/meson.build | 1 - 13 | 1 file changed, 1 deletion(-) 14 | 15 | diff --git a/src/android/meson.build b/src/android/meson.build 16 | index 68646120..9b83acaa 100644 17 | --- a/src/android/meson.build 18 | +++ b/src/android/meson.build 19 | @@ -29,7 +29,6 @@ if not libyuv_dep.found() 20 | '-Wno-sign-compare', 21 | '-Wno-unused-variable', 22 | '-Wno-unused-parameter') 23 | - libyuv_vars.append_link_args('-ljpeg') 24 | libyuv = cmake.subproject('libyuv', options : libyuv_vars) 25 | libyuv_dep = libyuv.dependency('yuv') 26 | endif 27 | -- 28 | 2.40.1 29 | 30 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/libcamera/0003-HACK-Support-for-RaspberryPI.patch: -------------------------------------------------------------------------------- 1 | From c91a61462c4a1c7a017975997c0816d6866bcea0 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Mon, 7 Aug 2023 16:13:56 +0300 4 | Subject: [PATCH 3/3] HACK: Support for RaspberryPI 5 | 6 | Signed-off-by: Roman Stratiienko 7 | --- 8 | src/android/camera_stream.cpp | 3 +++ 9 | src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 2 +- 10 | 2 files changed, 4 insertions(+), 1 deletion(-) 11 | 12 | diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp 13 | index 045e6006..3600ec56 100644 14 | --- a/src/android/camera_stream.cpp 15 | +++ b/src/android/camera_stream.cpp 16 | @@ -132,6 +132,9 @@ int CameraStream::configure() 17 | mutex_ = std::make_unique(); 18 | 19 | camera3Stream_->max_buffers = configuration().bufferCount; 20 | + // Android requires at least one buffer 21 | + if (camera3Stream_->max_buffers == 0) 22 | + camera3Stream_->max_buffers = 1; 23 | 24 | return 0; 25 | } 26 | diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp 27 | index e0bedcd8..e0458a42 100644 28 | --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp 29 | +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp 30 | @@ -297,7 +297,7 @@ CameraConfiguration::Status RPiCameraConfiguration::validate() 31 | return Invalid; 32 | 33 | if (RPi::PipelineHandlerBase::updateStreamConfig(out.cfg, out.format)) 34 | - status = Adjusted; 35 | + status = status;// Adjusted; 36 | } 37 | 38 | return status; 39 | -- 40 | 2.40.1 41 | 42 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/mesa3d/0001-HACK-utils-Set-cache-type-back-to-DISK_CACHE_MULTI_F.patch: -------------------------------------------------------------------------------- 1 | From 711bdf59ceab2f5c4453646f18b4ef880f59a387 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Thu, 12 Dec 2024 00:42:12 +0200 4 | Subject: [PATCH] HACK: utils: Set cache type back to DISK_CACHE_MULTI_FILE 5 | 6 | This avoids minijail issue that can be observerd when audiocodecs allocate 7 | the memory via gbm. 8 | 9 | Change-Id: I6a966eab3f0db092fd5d3f3cfa3a94f1595a0e60 10 | Signed-off-by: Roman Stratiienko 11 | --- 12 | src/util/disk_cache.c | 6 +++--- 13 | 1 file changed, 3 insertions(+), 3 deletions(-) 14 | 15 | diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c 16 | index 940b0a04145..a9ee3d49cd3 100644 17 | --- a/src/util/disk_cache.c 18 | +++ b/src/util/disk_cache.c 19 | @@ -274,12 +274,12 @@ disk_cache_create(const char *gpu_name, const char *driver_id, 20 | else if (debug_get_bool_option("MESA_DISK_CACHE_MULTI_FILE", false)) 21 | cache_type = DISK_CACHE_MULTI_FILE; 22 | else { 23 | - cache_type = DISK_CACHE_DATABASE; 24 | + cache_type = DISK_CACHE_MULTI_FILE; 25 | /* Since switching the default cache to , remove the 26 | * old cache folder if it hasn't been modified for more than 7 days. 27 | */ 28 | - if (!getenv("MESA_SHADER_CACHE_DIR") && !getenv("MESA_GLSL_CACHE_DIR")) 29 | - disk_cache_delete_old_cache(); 30 | + //if (!getenv("MESA_SHADER_CACHE_DIR") && !getenv("MESA_GLSL_CACHE_DIR")) 31 | + //disk_cache_delete_old_cache(); 32 | } 33 | 34 | /* Create main writable cache. */ 35 | -- 36 | 2.43.0 37 | 38 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/minigbm/0002-minigbm-Add-external-driver-support.patch: -------------------------------------------------------------------------------- 1 | From fd6644892eb163476230a1ec792539682690056b Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Wed, 23 Jun 2021 17:10:34 +0300 4 | Subject: [PATCH 02/16] minigbm: Add external driver support 5 | 6 | Allow backends with custom DRM probing logic or 7 | backends that does not rely on DRM (dma-heap, ION). 8 | 9 | Signed-off-by: Roman Stratiienko 10 | Change-Id: I7bcaf10205ca051eb109d6e220b8a2af38267442 11 | --- 12 | cros_gralloc/cros_gralloc_driver.cc | 13 ++++++++++++- 13 | drv.c | 10 ++++++++++ 14 | 2 files changed, 22 insertions(+), 1 deletion(-) 15 | 16 | diff --git a/cros_gralloc/cros_gralloc_driver.cc b/cros_gralloc/cros_gralloc_driver.cc 17 | index 550f75a..86c345e 100644 18 | --- a/cros_gralloc/cros_gralloc_driver.cc 19 | +++ b/cros_gralloc/cros_gralloc_driver.cc 20 | @@ -91,6 +91,7 @@ std::shared_ptr cros_gralloc_driver::get_instance() 21 | return s_instance; 22 | } 23 | 24 | +#ifndef DRV_EXTERNAL 25 | static struct driver *init_try_node(int idx, char const *str) 26 | { 27 | int fd; 28 | @@ -148,11 +149,21 @@ static struct driver *init_try_nodes() 29 | return nullptr; 30 | } 31 | 32 | +#else 33 | + 34 | +static struct driver *init_try_nodes() 35 | +{ 36 | + return drv_create(-1); 37 | +} 38 | + 39 | +#endif 40 | + 41 | static void drv_destroy_and_close(struct driver *drv) 42 | { 43 | int fd = drv_get_fd(drv); 44 | drv_destroy(drv); 45 | - close(fd); 46 | + if (fd != -1) 47 | + close(fd); 48 | } 49 | 50 | cros_gralloc_driver::cros_gralloc_driver() : drv_(init_try_nodes(), drv_destroy_and_close) 51 | diff --git a/drv.c b/drv.c 52 | index cf3b78b..d656599 100644 53 | --- a/drv.c 54 | +++ b/drv.c 55 | @@ -28,6 +28,15 @@ 56 | #include "drv_priv.h" 57 | #include "util.h" 58 | 59 | +#ifdef DRV_EXTERNAL 60 | +extern struct backend *init_external_backend(); 61 | + 62 | +static const struct backend *drv_get_backend(int fd) 63 | +{ 64 | + return init_external_backend(); 65 | +} 66 | +#else 67 | + 68 | #ifdef DRV_AMDGPU 69 | extern const struct backend backend_amdgpu; 70 | #endif 71 | @@ -108,6 +117,7 @@ static const struct backend *drv_get_backend(int fd) 72 | drmFreeVersion(drm_version); 73 | return NULL; 74 | } 75 | +#endif 76 | 77 | struct driver *drv_create(int fd) 78 | { 79 | -- 80 | 2.43.0 81 | 82 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/minigbm/0003-minigbm-Add-bo_get_plane_fd-backend-hook.patch: -------------------------------------------------------------------------------- 1 | From 86979f7035f6bc1e3559608746fe30fe6b967e3d Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Wed, 23 Jun 2021 17:11:10 +0300 4 | Subject: [PATCH 03/16] minigbm: Add bo_get_plane_fd backend hook 5 | 6 | Non-DRM drivers shouldn't rely on handles and DRM API. 7 | Add hook to allow drivers create custom implementation. 8 | 9 | Signed-off-by: Roman Stratiienko 10 | Change-Id: I458dae38f80697184070019606b125992a9aa01d 11 | --- 12 | drv.c | 5 +++++ 13 | drv_priv.h | 1 + 14 | 2 files changed, 6 insertions(+) 15 | 16 | diff --git a/drv.c b/drv.c 17 | index d656599..1b8e27f 100644 18 | --- a/drv.c 19 | +++ b/drv.c 20 | @@ -691,6 +691,11 @@ int drv_bo_get_plane_fd(struct bo *bo, size_t plane) 21 | if (bo->is_test_buffer) 22 | return -EINVAL; 23 | 24 | + if (bo->drv->backend->bo_get_plane_fd) { 25 | + fd = bo->drv->backend->bo_get_plane_fd(bo, plane); 26 | + return fd; 27 | + } 28 | + 29 | ret = drmPrimeHandleToFD(bo->drv->fd, bo->handle.u32, DRM_CLOEXEC | DRM_RDWR, &fd); 30 | 31 | // Older DRM implementations blocked DRM_RDWR, but gave a read/write mapping anyways 32 | diff --git a/drv_priv.h b/drv_priv.h 33 | index fea89ff..247c733 100644 34 | --- a/drv_priv.h 35 | +++ b/drv_priv.h 36 | @@ -99,6 +99,7 @@ struct backend { 37 | int (*bo_unmap)(struct bo *bo, struct vma *vma); 38 | int (*bo_invalidate)(struct bo *bo, struct mapping *mapping); 39 | int (*bo_flush)(struct bo *bo, struct mapping *mapping); 40 | + int (*bo_get_plane_fd)(struct bo *bo, size_t plane); 41 | void (*resolve_format_and_use_flags)(struct driver *drv, uint32_t format, 42 | uint64_t use_flags, uint32_t *out_format, 43 | uint64_t *out_use_flags); 44 | -- 45 | 2.43.0 46 | 47 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/minigbm/0004-minigbm-Add-const-to-the-backend-name.patch: -------------------------------------------------------------------------------- 1 | From f9f92dd09e78ede32820b28bf92946ec85905fde Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Wed, 23 Jun 2021 17:12:00 +0300 4 | Subject: [PATCH 04/16] minigbm: Add const to the backend::name 5 | 6 | ... to avoid compile-time error on C++: 7 | 8 | error: ISO C++11 does not allow conversion from string 9 | literal to 'char *' [-Werror,-Wwritable-strings] 10 | 11 | Signed-off-by: Roman Stratiienko 12 | Change-Id: I176eb657f72e92d6b5c7c3b25c78c56f776c20ab 13 | --- 14 | drv_priv.h | 2 +- 15 | 1 file changed, 1 insertion(+), 1 deletion(-) 16 | 17 | diff --git a/drv_priv.h b/drv_priv.h 18 | index 247c733..d6e0b53 100644 19 | --- a/drv_priv.h 20 | +++ b/drv_priv.h 21 | @@ -77,7 +77,7 @@ struct driver { 22 | }; 23 | 24 | struct backend { 25 | - char *name; 26 | + const char *name; 27 | void (*preload)(bool load); 28 | int (*init)(struct driver *drv); 29 | void (*close)(struct driver *drv); 30 | -- 31 | 2.43.0 32 | 33 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/minigbm/0005-minigbm-Add-drv_bo_get_pixel_stride-function.patch: -------------------------------------------------------------------------------- 1 | From a10400e21a965ad260c5177dc2be9dea8767b6cf Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Thu, 8 Sep 2022 18:41:09 +0300 4 | Subject: [PATCH 05/16] minigbm: Add drv_bo_get_pixel_stride function 5 | 6 | Some drivers may copy/convert the buffer during mapping and 7 | in some cases stride of copied image can be different from 8 | original. Android uses pixel_stride for CPU access and need 9 | map_time stride instead of original stride in this cases. 10 | 11 | Change-Id: I987da3b353c7067be686f2d4ff2469ad4f40c5c6 12 | Signed-off-by: Roman Stratiienko 13 | --- 14 | cros_gralloc/cros_gralloc_driver.cc | 4 +--- 15 | drv.c | 17 +++++++++++++++++ 16 | drv.h | 2 ++ 17 | drv_priv.h | 1 + 18 | 4 files changed, 21 insertions(+), 3 deletions(-) 19 | 20 | diff --git a/cros_gralloc/cros_gralloc_driver.cc b/cros_gralloc/cros_gralloc_driver.cc 21 | index 86c345e..2d0ac32 100644 22 | --- a/cros_gralloc/cros_gralloc_driver.cc 23 | +++ b/cros_gralloc/cros_gralloc_driver.cc 24 | @@ -257,7 +257,6 @@ int32_t cros_gralloc_driver::allocate(const struct cros_gralloc_buffer_descripto 25 | size_t num_fds; 26 | size_t num_ints; 27 | uint32_t resolved_format; 28 | - uint32_t bytes_per_pixel; 29 | uint64_t resolved_use_flags; 30 | struct bo *bo; 31 | struct cros_gralloc_handle *hnd; 32 | @@ -319,8 +318,7 @@ int32_t cros_gralloc_driver::allocate(const struct cros_gralloc_buffer_descripto 33 | hnd->tiling = drv_bo_get_tiling(bo); 34 | hnd->format_modifier = drv_bo_get_format_modifier(bo); 35 | hnd->use_flags = drv_bo_get_use_flags(bo); 36 | - bytes_per_pixel = drv_bytes_per_pixel_from_format(hnd->format, 0); 37 | - hnd->pixel_stride = DIV_ROUND_UP(hnd->strides[0], bytes_per_pixel); 38 | + hnd->pixel_stride = drv_bo_get_pixel_stride(bo); 39 | hnd->magic = cros_gralloc_magic; 40 | hnd->droid_format = descriptor->droid_format; 41 | hnd->usage = descriptor->droid_usage; 42 | diff --git a/drv.c b/drv.c 43 | index 1b8e27f..31a85e8 100644 44 | --- a/drv.c 45 | +++ b/drv.c 46 | @@ -767,6 +767,23 @@ void drv_bo_log_info(const struct bo *bo, const char *prefix) 47 | } 48 | } 49 | 50 | +uint32_t drv_bo_get_pixel_stride(struct bo *bo) 51 | +{ 52 | + struct driver *drv = bo->drv; 53 | + uint32_t bytes_per_pixel = 0; 54 | + uint32_t map_stride = 0; 55 | + 56 | + bytes_per_pixel = drv_bytes_per_pixel_from_format(bo->meta.format, 0); 57 | + 58 | + if ((bo->meta.use_flags & BO_USE_SW_MASK) && drv->backend->bo_get_map_stride) 59 | + map_stride = drv->backend->bo_get_map_stride(bo); 60 | + 61 | + if (!map_stride) 62 | + map_stride = bo->meta.strides[0]; 63 | + 64 | + return DIV_ROUND_UP(map_stride, bytes_per_pixel); 65 | +} 66 | + 67 | /* 68 | * Map internal fourcc codes back to standard fourcc codes. 69 | */ 70 | diff --git a/drv.h b/drv.h 71 | index d80b95e..f8f220a 100644 72 | --- a/drv.h 73 | +++ b/drv.h 74 | @@ -221,6 +221,8 @@ size_t drv_bo_get_total_size(struct bo *bo); 75 | 76 | void drv_bo_log_info(const struct bo *bo, const char *prefix); 77 | 78 | +uint32_t drv_bo_get_pixel_stride(struct bo *bo); 79 | + 80 | uint32_t drv_get_standard_fourcc(uint32_t fourcc_internal); 81 | 82 | uint32_t drv_bytes_per_pixel_from_format(uint32_t format, size_t plane); 83 | diff --git a/drv_priv.h b/drv_priv.h 84 | index d6e0b53..29e8302 100644 85 | --- a/drv_priv.h 86 | +++ b/drv_priv.h 87 | @@ -100,6 +100,7 @@ struct backend { 88 | int (*bo_invalidate)(struct bo *bo, struct mapping *mapping); 89 | int (*bo_flush)(struct bo *bo, struct mapping *mapping); 90 | int (*bo_get_plane_fd)(struct bo *bo, size_t plane); 91 | + uint32_t (*bo_get_map_stride)(struct bo *bo); 92 | void (*resolve_format_and_use_flags)(struct driver *drv, uint32_t format, 93 | uint64_t use_flags, uint32_t *out_format, 94 | uint64_t *out_use_flags); 95 | -- 96 | 2.43.0 97 | 98 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/minigbm/0006-minigbm-make-dumb-drivers-optional.patch: -------------------------------------------------------------------------------- 1 | From f76f44295055748c5f0a1dceff39a5e11fe4f9f4 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Thu, 22 Dec 2022 21:51:35 +0200 4 | Subject: [PATCH 06/16] minigbm: make dumb drivers optional 5 | 6 | Change-Id: Ie668d4a9d8f18ff1f885979ebe1dcd0a7646fda2 7 | Signed-off-by: Roman Stratiienko 8 | --- 9 | drv.c | 4 ++++ 10 | 1 file changed, 4 insertions(+) 11 | 12 | diff --git a/drv.c b/drv.c 13 | index 31a85e8..47e5f05 100644 14 | --- a/drv.c 15 | +++ b/drv.c 16 | @@ -51,6 +51,7 @@ extern const struct backend backend_vc4; 17 | #endif 18 | 19 | // Dumb / generic drivers 20 | +#ifdef DRV_DUMB 21 | extern const struct backend backend_evdi; 22 | extern const struct backend backend_marvell; 23 | extern const struct backend backend_mediatek; 24 | @@ -64,6 +65,7 @@ extern const struct backend backend_synaptics; 25 | extern const struct backend backend_virtgpu; 26 | extern const struct backend backend_udl; 27 | extern const struct backend backend_vkms; 28 | +#endif 29 | 30 | extern const struct backend backend_mock; 31 | 32 | @@ -80,10 +82,12 @@ static const struct backend *drv_backend_list[] = { 33 | #ifdef DRV_VC4 34 | &backend_vc4, 35 | #endif 36 | +#ifdef DRV_DUMB 37 | &backend_evdi, &backend_komeda, &backend_marvell, &backend_mediatek, 38 | &backend_meson, &backend_nouveau, &backend_radeon, &backend_rockchip, 39 | &backend_sun4i_drm, &backend_synaptics, &backend_udl, &backend_virtgpu, 40 | &backend_vkms, &backend_mock 41 | +#endif 42 | }; 43 | 44 | void drv_preload(bool load) 45 | -- 46 | 2.43.0 47 | 48 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/minigbm/0008-cros_gralloc-Add-name-to-reserved-buffer.patch: -------------------------------------------------------------------------------- 1 | From f0f2f0260180cde50ee4248ccf71614d36be2f53 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Sun, 2 Oct 2022 20:37:37 +0300 4 | Subject: [PATCH 08/16] cros_gralloc: Add name to reserved buffer 5 | 6 | Change-Id: If76a87d50cf430d5480ddc92925613daa5ac36ea 7 | Signed-off-by: Roman Stratiienko 8 | --- 9 | cros_gralloc/cros_gralloc_driver.cc | 4 +++- 10 | 1 file changed, 3 insertions(+), 1 deletion(-) 11 | 12 | diff --git a/cros_gralloc/cros_gralloc_driver.cc b/cros_gralloc/cros_gralloc_driver.cc 13 | index f7c6c93..4a31ca7 100644 14 | --- a/cros_gralloc/cros_gralloc_driver.cc 15 | +++ b/cros_gralloc/cros_gralloc_driver.cc 16 | @@ -249,8 +249,10 @@ int cros_gralloc_driver::create_reserved_region(const std::string &buffer_name, 17 | 18 | #if ANDROID_API_LEVEL >= 31 && defined(HAS_DMABUF_SYSTEM_HEAP) 19 | ret = allocator_.Alloc(kDmabufSystemHeapName, reserved_region_size); 20 | - if (ret >= 0) 21 | + if (ret >= 0) { 22 | + ioctl(ret, DMA_BUF_SET_NAME, "gralloc-meta"); 23 | return ret; 24 | + } 25 | #endif 26 | 27 | ret = memfd_create_reserved_region(buffer_name, reserved_region_size); 28 | -- 29 | 2.43.0 30 | 31 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/minigbm/0009-helpers-Add-helpers-to-convert-use_flags-to-string.patch: -------------------------------------------------------------------------------- 1 | From 85c43cb9c604bba2383c64ac93f9c4c8e90d2d2d Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Sun, 25 Sep 2022 19:22:53 +0300 4 | Subject: [PATCH 09/16] helpers: Add helpers to convert use_flags to string 5 | 6 | Change-Id: Icce8164cde8da483d683c06a4936ffde05b6f515 7 | Signed-off-by: Roman Stratiienko 8 | --- 9 | drv_helpers.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 10 | drv_helpers.h | 3 +++ 11 | 2 files changed, 52 insertions(+) 12 | 13 | diff --git a/drv_helpers.c b/drv_helpers.c 14 | index fcc44e5..fb1fe89 100644 15 | --- a/drv_helpers.c 16 | +++ b/drv_helpers.c 17 | @@ -696,3 +696,52 @@ void lru_init(struct lru *lru, int max) 18 | lru->count = 0; 19 | lru->max = max; 20 | } 21 | + 22 | +#define FLAG_TO_STR(flag, str) \ 23 | + if (use_flags & (flag)) { \ 24 | + int len = strlen(out); \ 25 | + snprintf(out + strlen(out), max_len - len, "%s%s", first ? "" : " ", (str)); \ 26 | + if (first < 2) \ 27 | + first = 0; \ 28 | + } 29 | + 30 | +int drv_use_flags_to_string(int use_flags, char *out, int max_len) 31 | +{ 32 | + int first = 1; 33 | + FLAG_TO_STR(BO_USE_LINEAR, "LIN"); 34 | + FLAG_TO_STR(BO_USE_CURSOR, "CURSOR"); 35 | + FLAG_TO_STR(BO_USE_SCANOUT, "SCANOUT"); 36 | + FLAG_TO_STR(BO_USE_SW_MASK, "CPU"); 37 | + FLAG_TO_STR(BO_USE_RENDERING, "RENDER"); 38 | + FLAG_TO_STR(BO_USE_TEXTURE, "TEXTURE"); 39 | + FLAG_TO_STR(BO_USE_CAMERA_WRITE, "CAMOUT"); 40 | + FLAG_TO_STR(BO_USE_CAMERA_READ, "CAMIN"); 41 | + FLAG_TO_STR(BO_USE_PROTECTED, "PROT"); 42 | + FLAG_TO_STR(BO_USE_HW_VIDEO_ENCODER, "VIENC"); 43 | + FLAG_TO_STR(BO_USE_HW_VIDEO_DECODER, "VIDEC"); 44 | + FLAG_TO_STR(BO_USE_FRONT_RENDERING, "FRONT"); 45 | + FLAG_TO_STR(BO_USE_GPU_DATA_BUFFER, "GPUDATA"); 46 | + FLAG_TO_STR(BO_USE_SENSOR_DIRECT_DATA, "SENSDATA"); 47 | + 48 | + return 0; 49 | +} 50 | + 51 | +int drv_use_flags_to_string_short(int use_flags, char *out, int max_len) 52 | +{ 53 | + int first = 2; 54 | + FLAG_TO_STR(BO_USE_LINEAR, "l"); 55 | + FLAG_TO_STR(BO_USE_CURSOR, "r"); 56 | + FLAG_TO_STR(BO_USE_SCANOUT, "D"); 57 | + FLAG_TO_STR(BO_USE_SW_MASK, "S"); 58 | + FLAG_TO_STR(BO_USE_RENDERING, "G"); 59 | + FLAG_TO_STR(BO_USE_TEXTURE, "g"); 60 | + FLAG_TO_STR(BO_USE_CAMERA_WRITE, "C"); 61 | + FLAG_TO_STR(BO_USE_CAMERA_READ, "c"); 62 | + FLAG_TO_STR(BO_USE_PROTECTED, "p"); 63 | + FLAG_TO_STR(BO_USE_HW_VIDEO_ENCODER | BO_USE_HW_VIDEO_DECODER, "V"); 64 | + FLAG_TO_STR(BO_USE_FRONT_RENDERING, "f"); 65 | + FLAG_TO_STR(BO_USE_GPU_DATA_BUFFER, "b"); 66 | + FLAG_TO_STR(BO_USE_SENSOR_DIRECT_DATA, "s"); 67 | + 68 | + return 0; 69 | +} 70 | diff --git a/drv_helpers.h b/drv_helpers.h 71 | index 6b315cf..35c2969 100644 72 | --- a/drv_helpers.h 73 | +++ b/drv_helpers.h 74 | @@ -74,4 +74,7 @@ struct lru_entry *lru_find(struct lru *lru, bool (*eq)(struct lru_entry *e, void 75 | void lru_insert(struct lru *lru, struct lru_entry *entry); 76 | void lru_init(struct lru *lru, int max); 77 | 78 | +int drv_use_flags_to_string(int use_flags, char *out, int max_len); 79 | +int drv_use_flags_to_string_short(int use_flags, char *out, int max_len); 80 | + 81 | #endif 82 | -- 83 | 2.43.0 84 | 85 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/minigbm/0012-cros_gralloc-Use-property-to-select-custom-backends.patch: -------------------------------------------------------------------------------- 1 | From 03adde3ace345d63aa9ce4f5f25135b583a689ca Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Mon, 6 Nov 2023 04:27:26 +0200 4 | Subject: [PATCH 12/16] cros_gralloc: Use property to select custom backends 5 | 6 | property name: vendor.gralloc.minigbm.backend 7 | possible values: 8 | 1. auto (default) 9 | 2. gbm_mesa 10 | 3. dmaheaps 11 | 12 | Change-Id: I5ab2649f98d40d139afb008ea8a804c790b81c31 13 | Signed-off-by: Roman Stratiienko 14 | --- 15 | cros_gralloc/cros_gralloc_driver.cc | 39 ++++++++++++++++++++++------- 16 | drv.c | 32 ++++++++++++++--------- 17 | drv.h | 3 +++ 18 | 3 files changed, 53 insertions(+), 21 deletions(-) 19 | 20 | diff --git a/cros_gralloc/cros_gralloc_driver.cc b/cros_gralloc/cros_gralloc_driver.cc 21 | index 4a31ca7..fbd2b83 100644 22 | --- a/cros_gralloc/cros_gralloc_driver.cc 23 | +++ b/cros_gralloc/cros_gralloc_driver.cc 24 | @@ -91,7 +91,6 @@ std::shared_ptr cros_gralloc_driver::get_instance() 25 | return s_instance; 26 | } 27 | 28 | -#ifndef DRV_EXTERNAL 29 | static struct driver *init_try_node(int idx, char const *str) 30 | { 31 | int fd; 32 | @@ -132,6 +131,27 @@ static struct driver *init_try_nodes() 33 | uint32_t min_card_node = DRM_CARD_NODE_START; 34 | uint32_t max_card_node = (min_card_node + num_nodes); 35 | 36 | + char lib_name[PROPERTY_VALUE_MAX]; 37 | + property_get("vendor.gralloc.minigbm.backend", lib_name, "auto"); 38 | + 39 | + if (strcmp(lib_name, "dmaheaps") == 0) { 40 | + ALOGI("Initializing dma-buf heaps backend"); 41 | + drv = drv_create(DRV_DMAHEAPS_DRIVER); 42 | + if (drv) 43 | + return drv; 44 | + 45 | + ALOGE("Failed to initialize dma-buf heap backend."); 46 | + } 47 | + 48 | + if (strcmp(lib_name, "gbm_mesa") == 0) { 49 | + ALOGI("Initializing gbm_mesa backend"); 50 | + drv = drv_create(DRV_GBM_MESA_DRIVER); 51 | + if (drv) 52 | + return drv; 53 | + 54 | + ALOGE("Failed to initialize gbm_mesa backend."); 55 | + } 56 | + 57 | // Try render nodes... 58 | for (uint32_t i = min_render_node; i < max_render_node; i++) { 59 | drv = init_try_node(i, render_nodes_fmt); 60 | @@ -146,18 +166,19 @@ static struct driver *init_try_nodes() 61 | return drv; 62 | } 63 | 64 | - return nullptr; 65 | -} 66 | + /* Fallback to gbm_mesa which is a way smarter than dumb_driver */ 67 | + if (strcmp(lib_name, "gbm_mesa") != 0) { 68 | + ALOGI("Falling-back to gbm_mesa backend"); 69 | + drv = drv_create(DRV_GBM_MESA_DRIVER); 70 | + if (drv) 71 | + return drv; 72 | + } 73 | 74 | -#else 75 | + ALOGE("Failed for find suitable backend"); 76 | 77 | -static struct driver *init_try_nodes() 78 | -{ 79 | - return drv_create(-1); 80 | + return nullptr; 81 | } 82 | 83 | -#endif 84 | - 85 | static void drv_destroy_and_close(struct driver *drv) 86 | { 87 | int fd = drv_get_fd(drv); 88 | diff --git a/drv.c b/drv.c 89 | index 040a16f..d407473 100644 90 | --- a/drv.c 91 | +++ b/drv.c 92 | @@ -28,15 +28,12 @@ 93 | #include "drv_priv.h" 94 | #include "util.h" 95 | 96 | -#ifdef DRV_EXTERNAL 97 | -extern struct backend *init_external_backend(); 98 | - 99 | -static const struct backend *drv_get_backend(int fd) 100 | -{ 101 | - return init_external_backend(); 102 | -} 103 | -#else 104 | - 105 | +#ifdef DRV_DMABUF_HEAP 106 | +extern const struct backend backend_dmabuf_heap; 107 | +#endif 108 | +#ifdef DRV_GBM_MESA 109 | +extern const struct backend backend_gbm_mesa; 110 | +#endif 111 | #ifdef DRV_AMDGPU 112 | extern const struct backend backend_amdgpu; 113 | #endif 114 | @@ -121,7 +118,6 @@ static const struct backend *drv_get_backend(int fd) 115 | drmFreeVersion(drm_version); 116 | return NULL; 117 | } 118 | -#endif 119 | 120 | struct driver *drv_create(int fd) 121 | { 122 | @@ -139,8 +135,20 @@ struct driver *drv_create(int fd) 123 | (minigbm_debug == NULL) || (strstr(minigbm_debug, "nocompression") == NULL); 124 | drv->log_bos = (minigbm_debug && strstr(minigbm_debug, "log_bos") != NULL); 125 | 126 | - drv->fd = fd; 127 | - drv->backend = drv_get_backend(fd); 128 | +#ifdef DRV_GBM_MESA 129 | + if (fd == DRV_GBM_MESA_DRIVER) { 130 | + drv->backend = &backend_gbm_mesa; 131 | + } else 132 | +#endif 133 | +#ifdef DRV_DMABUF_HEAP 134 | + if (fd == DRV_DMAHEAPS_DRIVER) { 135 | + drv->backend = &backend_dmabuf_heap; 136 | + } else 137 | +#endif 138 | + { 139 | + drv->fd = fd; 140 | + drv->backend = drv_get_backend(fd); 141 | + } 142 | 143 | if (!drv->backend) 144 | goto free_driver; 145 | diff --git a/drv.h b/drv.h 146 | index 79e4d36..15570d8 100644 147 | --- a/drv.h 148 | +++ b/drv.h 149 | @@ -16,6 +16,9 @@ extern "C" { 150 | #include 151 | #include 152 | 153 | +#define DRV_GBM_MESA_DRIVER (-2) 154 | +#define DRV_DMAHEAPS_DRIVER (-3) 155 | + 156 | #define DRV_MAX_PLANES 4 157 | 158 | // clang-format off 159 | -- 160 | 2.43.0 161 | 162 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/minigbm/0014-WIP-Add-build_deploy.sh-script.patch: -------------------------------------------------------------------------------- 1 | From 5c35b51cf410e94c4df0f67135b0874bd6f4b38a Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Thu, 22 Dec 2022 21:52:47 +0200 4 | Subject: [PATCH 14/16] WIP: Add build_deploy.sh script 5 | 6 | Works from obj/AOSPEXT/MINIGBM directory 7 | 8 | Change-Id: Ibbba57eec7b36d5efd01b48840175b9909d775d1 9 | Signed-off-by: Roman Stratiienko 10 | --- 11 | build_deploy.sh | 16 ++++++++++++++++ 12 | 1 file changed, 16 insertions(+) 13 | create mode 100755 build_deploy.sh 14 | 15 | diff --git a/build_deploy.sh b/build_deploy.sh 16 | new file mode 100755 17 | index 0000000..102fbe9 18 | --- /dev/null 19 | +++ b/build_deploy.sh 20 | @@ -0,0 +1,16 @@ 21 | +#!/bin/bash -e 22 | + 23 | +adb root && adb remount 24 | + 25 | +make all 26 | + 27 | +adb push ./install/vendor/etc/init/android.hardware.graphics.allocator@4.0-service.minigbm.rc /vendor/etc/init/ 28 | +adb push ./install/vendor/bin/hw/android.hardware.graphics.allocator@4.0-service.minigbm_gd /vendor/bin/hw/ 29 | +adb push ./install/vendor/lib64/libminigbm_gralloc_gd.so /vendor/lib64/ 30 | +adb push ./install/vendor/lib64/hw/gralloc.minigbm_gd.so /vendor/lib64/hw/ 31 | +adb push ./install/vendor/lib64/hw/android.hardware.graphics.mapper@4.0-impl.minigbm_gd.so /vendor/lib64/hw/ 32 | + 33 | +adb shell stop 34 | +adb shell stop vendor.graphics.allocator-4-0 35 | +adb shell start vendor.graphics.allocator-4-0 36 | +adb shell start 37 | -- 38 | 2.43.0 39 | 40 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/minigbm/0015-RPI4-Add-HW-codecs-support-and-constraints.patch: -------------------------------------------------------------------------------- 1 | From f3846b62eee43ba19a09a0abadf7f5c256dde370 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Sun, 1 Oct 2023 16:17:17 +0300 4 | Subject: [PATCH 15/16] RPI4: Add HW codecs support and constraints 5 | 6 | Change-Id: I8cd8eef9237268ce6945d3153542eedb506614a9 7 | Signed-off-by: Roman Stratiienko 8 | --- 9 | gbm_mesa_driver/gbm_mesa_internals.cpp | 10 ++++++++++ 10 | 1 file changed, 10 insertions(+) 11 | 12 | diff --git a/gbm_mesa_driver/gbm_mesa_internals.cpp b/gbm_mesa_driver/gbm_mesa_internals.cpp 13 | index da278c9..f26f533 100644 14 | --- a/gbm_mesa_driver/gbm_mesa_internals.cpp 15 | +++ b/gbm_mesa_driver/gbm_mesa_internals.cpp 16 | @@ -373,6 +373,16 @@ int gbm_mesa_bo_create2(struct bo *bo, uint32_t width, uint32_t height, uint32_t 17 | size_align = 4096; 18 | } 19 | 20 | + /* RPI4 hwcodecs */ 21 | + if (unmask64(&use_flags, BO_USE_HW_VIDEO_DECODER | BO_USE_HW_VIDEO_ENCODER)) { 22 | + scanout_strong = true; 23 | + alloc_args.use_scanout = true; 24 | + alloc_args.width = ALIGN(alloc_args.width, 32); 25 | + if (alloc_args.height > 1) /* Not sure if this is needed, but keep it for now */ 26 | + alloc_args.height = ALIGN(alloc_args.height, 16); 27 | + size_align = 4096; 28 | + } 29 | + 30 | if (alloc_args.drm_format == 0) { 31 | /* Always use linear for spoofed format allocations. */ 32 | drv_bo_from_format(bo, alloc_args.width, 1, alloc_args.height, format); 33 | -- 34 | 2.43.0 35 | 36 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/minigbm/0016-README.patch: -------------------------------------------------------------------------------- 1 | From c9e491bf48183a9fa7ab20518ffb780aed177df1 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Sat, 26 Aug 2023 12:48:05 +0300 4 | Subject: [PATCH 16/16] README 5 | 6 | This series brings 2 additional backends to minigbm: 7 | 1. Generic (gbm_mesa). It works similarly to gbm_gralloc but has the benefits 8 | of using minigbm core logic/helpers to allocate more advanced format 9 | combinations. 10 | 11 | 2. Lightweight (dma_heaps). It requires a full description for every platform. 12 | Therefore, at the moment, it is only experimental. 13 | 14 | For more information, reviews, comments, suggestions and questions visit: 15 | https://github.com/GloDroid/glodroid_forks/pull/10 16 | 17 | Change-Id: I2c3470d79c385b2b2e7a376f4ba6438f81d5c269 18 | --- 19 | _aospext_patched | 0 20 | 1 file changed, 0 insertions(+), 0 deletions(-) 21 | create mode 100644 _aospext_patched 22 | 23 | diff --git a/_aospext_patched b/_aospext_patched 24 | new file mode 100644 25 | index 0000000..e69de29 26 | -- 27 | 2.43.0 28 | 29 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/minigbm/0017-Fixup-gbm_mesa.patch: -------------------------------------------------------------------------------- 1 | From 5bffeba0b1f53181cafb3ec90b833de2678c8b16 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Fri, 25 Oct 2024 13:29:12 +0300 4 | Subject: [PATCH 17/17] Fixup gbm_mesa 5 | 6 | To account for new clang and stdlib requirements. 7 | 8 | Change-Id: I6968a4a7e4070119bc802be7590bb587b2dcf481 9 | Signed-off-by: Roman Stratiienko 10 | --- 11 | gbm_mesa_driver/gbm_mesa_internals.cpp | 1 + 12 | 1 file changed, 1 insertion(+) 13 | 14 | diff --git a/gbm_mesa_driver/gbm_mesa_internals.cpp b/gbm_mesa_driver/gbm_mesa_internals.cpp 15 | index f26f533..d119f6a 100644 16 | --- a/gbm_mesa_driver/gbm_mesa_internals.cpp 17 | +++ b/gbm_mesa_driver/gbm_mesa_internals.cpp 18 | @@ -39,6 +39,7 @@ extern "C" { 19 | #include 20 | #include 21 | #include 22 | +#include 23 | #include 24 | #include 25 | #include 26 | -- 27 | 2.43.0 28 | 29 | -------------------------------------------------------------------------------- /patches-aosp/glodroid/vendor/tinyhal/0001-GLODROID-config-Distinguish-between-rpi4b-and-rpi400.patch: -------------------------------------------------------------------------------- 1 | From 908728c07755c65c99acfae3d5c15de530d8aaf9 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Sun, 2 Apr 2023 01:51:49 +0300 4 | Subject: [PATCH] GLODROID: config: Distinguish between rpi4b and rpi400 board 5 | variants. 6 | 7 | Patch is temporary solution for raspberry-pi 400 to bypass audio. 8 | 9 | Change-Id: I13cd26048d8a33ddc2d4b862a27fa10fd59cd676 10 | Signed-off-by: Roman Stratiienko 11 | --- 12 | audio/audio_hw.c | 32 ++++++++++++++++++++++++++++++-- 13 | 1 file changed, 30 insertions(+), 2 deletions(-) 14 | 15 | diff --git a/audio/audio_hw.c b/audio/audio_hw.c 16 | index 3aa24b0..e1e94c5 100644 17 | --- a/audio/audio_hw.c 18 | +++ b/audio/audio_hw.c 19 | @@ -2471,8 +2471,36 @@ static int adev_open(const hw_module_t *module, const char *name, 20 | adev->hw_device.close_input_stream = adev_close_input_stream; 21 | adev->hw_device.dump = adev_dump; 22 | 23 | - property_get("ro.product.device", property, "generic"); 24 | - snprintf(file_name, sizeof(file_name), "%s/audio.%s.xml", ETC_PATH, property); 25 | + int f = open("/sys/firmware/devicetree/base/compatible", O_RDONLY); 26 | + if (f < 0) { 27 | + ret = -errno; 28 | + ALOGE("Failed to open /sys/firmware/devicetree/base/compatible"); 29 | + goto fail; 30 | + } 31 | + 32 | + char buf[256]; 33 | + memset(buf, 0, sizeof(buf)); 34 | + int len = read(f, buf, sizeof(buf)); 35 | + if (len < 0) { 36 | + ret = -errno; 37 | + ALOGE("Failed to read /sys/firmware/devicetree/base/compatible"); 38 | + goto fail; 39 | + } 40 | + 41 | + close(f); 42 | + 43 | + char *config_name; 44 | + const char RPI400_COMPAT[] = "raspberrypi,400"; 45 | + if (strncmp(buf, RPI400_COMPAT, sizeof(RPI400_COMPAT) - 1) == 0) { 46 | + config_name = "rpi400"; 47 | + } else { 48 | + config_name = "rpi4"; 49 | + } 50 | + 51 | + ALOGI("Compatible is '%s', using config '%s'", buf, config_name); 52 | + 53 | +// property_get("ro.product.device", property, "generic"); 54 | + snprintf(file_name, sizeof(file_name), "%s/audio.%s.xml", ETC_PATH, config_name); 55 | 56 | ALOGV("Reading configuration from %s\n", file_name); 57 | adev->cm = init_audio_config(file_name); 58 | -- 59 | 2.34.1 60 | 61 | -------------------------------------------------------------------------------- /patches-aosp/hardware/interfaces/0002-HCI-Fix-improper-rfkill-handling.patch: -------------------------------------------------------------------------------- 1 | From 100e07a6bd96c34c87013f1ef7d1e0ed1f094f27 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Thu, 12 Dec 2024 05:19:03 +0200 4 | Subject: [PATCH 2/2] HCI: Fix improper rfkill handling 5 | 6 | Current behavior with kernel rfkill module loaded produces a cascade of 7 | crash events starting from the following logcat error: 8 | 9 | unable to bind bluetooth user channel: Operation not possible due to RF-kill 10 | 11 | However, the same device configuration worked well with btlinux HAL, 12 | which I assume was used as a base for this HAL. 13 | 14 | After some investigation, I found that the rfkill(1) function call in the 15 | btlinux call changed the state to 1, which is RFKILL_STATE_UNBLOCKED. 16 | The current rfkill(1) sets the soft block value to 1, which corresponds 17 | to the state value 0 (RFKILL_STATE_SOFT_BLOCKED). 18 | 19 | Fix it by providing the correct values to the rfkill() call. 20 | 21 | Change-Id: I7a62744f9c21d80b9f8fa37f6c172afa2a5b6c8a 22 | Signed-off-by: Roman Stratiienko 23 | --- 24 | bluetooth/aidl/default/net_bluetooth_mgmt.cpp | 8 ++++---- 25 | 1 file changed, 4 insertions(+), 4 deletions(-) 26 | 27 | diff --git a/bluetooth/aidl/default/net_bluetooth_mgmt.cpp b/bluetooth/aidl/default/net_bluetooth_mgmt.cpp 28 | index 24693effcd..6b0cd63166 100644 29 | --- a/bluetooth/aidl/default/net_bluetooth_mgmt.cpp 30 | +++ b/bluetooth/aidl/default/net_bluetooth_mgmt.cpp 31 | @@ -259,8 +259,8 @@ int NetBluetoothMgmt::rfkill(int block) { 32 | int NetBluetoothMgmt::openHci(int hci_interface) { 33 | ALOGI("opening hci interface %d", hci_interface); 34 | 35 | - // Block Bluetooth. 36 | - rfkill(1); 37 | + // Unblock Bluetooth. 38 | + rfkill(0); 39 | 40 | // Wait for the HCI interface to complete initialization or to come online. 41 | int hci = waitHciDev(hci_interface); 42 | @@ -300,8 +300,8 @@ void NetBluetoothMgmt::closeHci() { 43 | bt_fd_ = -1; 44 | } 45 | 46 | - // Unblock Bluetooth. 47 | - rfkill(0); 48 | + // Block Bluetooth. 49 | + rfkill(1); 50 | } 51 | 52 | } // namespace aidl::android::hardware::bluetooth::impl 53 | -- 54 | 2.43.0 55 | 56 | -------------------------------------------------------------------------------- /patches-aosp/hardware/interfaces/usb/aidl/default/0001-GLODROID-Report-fake-port-if-no-one-was-detected.patch: -------------------------------------------------------------------------------- 1 | From dafe9a811fc78a53cca49df9921a10c9f6d730d4 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Mon, 30 Oct 2023 23:40:58 +0200 4 | Subject: [PATCH] GLODROID: Report fake port if no one was detected 5 | 6 | This allows devices without typec driver (rpi4, opi3) to be used in 7 | gadget-only mode. 8 | 9 | Change-Id: Ib30d70387c75c6a84c01950ae6441dddf2d863be 10 | Signed-off-by: Roman Stratiienko 11 | --- 12 | usb/aidl/default/Usb.cpp | 19 +++++++++++++++++++ 13 | 1 file changed, 19 insertions(+) 14 | 15 | diff --git a/usb/aidl/default/Usb.cpp b/usb/aidl/default/Usb.cpp 16 | index 593dd4f4c6..78a5970ad1 100644 17 | --- a/usb/aidl/default/Usb.cpp 18 | +++ b/usb/aidl/default/Usb.cpp 19 | @@ -526,6 +526,25 @@ Status getPortStatusHelper(std::vector *currentPortStatus) { 20 | 21 | return Status::SUCCESS; 22 | } 23 | + 24 | + currentPortStatus->resize(1); 25 | + (*currentPortStatus)[0].portName = "port"; 26 | + (*currentPortStatus)[0].canChangeMode = false; 27 | + (*currentPortStatus)[0].canChangeDataRole = false; 28 | + (*currentPortStatus)[0].canChangePowerRole = false; 29 | + (*currentPortStatus)[0].currentPowerRole = PortPowerRole::SINK; 30 | + (*currentPortStatus)[0].currentDataRole = PortDataRole::DEVICE; 31 | + (*currentPortStatus)[0].currentMode = PortMode::DRP; 32 | + (*currentPortStatus)[0].supportedModes.push_back(PortMode::DRP); 33 | + (*currentPortStatus)[0].usbDataStatus.push_back(UsbDataStatus::ENABLED); 34 | + 35 | + ALOGI("Fake USB port: canChangeMode:%d canChagedata:%d canChangePower:%d " 36 | + "usbDataEnabled:%d", 37 | + (*currentPortStatus)[i].canChangeMode, (*currentPortStatus)[i].canChangeDataRole, 38 | + (*currentPortStatus)[i].canChangePowerRole, 0); 39 | + 40 | + return Status::SUCCESS; 41 | + 42 | done: 43 | return Status::ERROR; 44 | } 45 | -- 46 | 2.39.2 47 | 48 | -------------------------------------------------------------------------------- /patches-aosp/system/core/0001-RFC-Fix-boot-from-one-mmc-dev-while-android-present-.patch: -------------------------------------------------------------------------------- 1 | From 993056a3a0e0b8fc8722fcd0dc94ab5981794ce8 Mon Sep 17 00:00:00 2001 2 | From: Roman Stratiienko 3 | Date: Tue, 21 Mar 2023 23:28:07 +0200 4 | Subject: [PATCH] RFC: Fix boot from one mmc dev while android present on 5 | another mmc dev. 6 | 7 | TODO: Send a bug report to Google. 8 | 9 | The 'device_handler_->HandleUevent(uevent);' function may not process 10 | the uevent (e.g. different path in androidboot.boot_devices cmdline 11 | argumment is specified). 12 | 13 | Current code logic will remove the partition names from devices list 14 | and stop processing uevents even if no symlink is created. 15 | 16 | Current patch workarounds an issue, but proper fix is required. 17 | 18 | Change-Id: I516c3697b96eaddac920104c0f56d95df5c9c649 19 | Signed-off-by: Roman Stratiienko 20 | --- 21 | init/block_dev_initializer.cpp | 9 ++++----- 22 | 1 file changed, 4 insertions(+), 5 deletions(-) 23 | 24 | diff --git a/init/block_dev_initializer.cpp b/init/block_dev_initializer.cpp 25 | index 05e00edfd..e03a2a663 100644 26 | --- a/init/block_dev_initializer.cpp 27 | +++ b/init/block_dev_initializer.cpp 28 | @@ -91,16 +91,15 @@ ListenerAction BlockDevInitializer::HandleUevent(const Uevent& uevent, 29 | if (!partition_name.empty()) { 30 | iter = devices->find(partition_name); 31 | } 32 | - if (iter == devices->end()) { 33 | - return ListenerAction::kContinue; 34 | - } 35 | + } 36 | + if (iter != devices->end()) { 37 | + devices->erase(iter); 38 | } 39 | 40 | LOG(VERBOSE) << __PRETTY_FUNCTION__ << ": found partition: " << name; 41 | 42 | - devices->erase(iter); 43 | device_handler_->HandleUevent(uevent); 44 | - return devices->empty() ? ListenerAction::kStop : ListenerAction::kContinue; 45 | + return ListenerAction::kContinue; 46 | } 47 | 48 | bool BlockDevInitializer::InitDevices(std::set devices) { 49 | -- 50 | 2.34.1 51 | 52 | -------------------------------------------------------------------------------- /unfold_aosp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | 3 | LOCAL_PATH=$(pwd) 4 | 5 | echo Init repo tree using AOSP manifest 6 | pushd aosptree 7 | repo init -u https://android.googlesource.com/platform/manifest -b refs/tags/android-platform-15.0.0_r3 ${GD_REPO_INIT_ARGS} 8 | cd .repo/manifests 9 | mv default.xml aosp.xml 10 | cp ${LOCAL_PATH}/manifests/glodroid.xml glodroid.xml 11 | cp ${LOCAL_PATH}/manifests/default_aosp.xml default.xml 12 | git add * 13 | git commit -m "Add GloDroid Project" --no-edit 14 | popd 15 | 16 | echo Sync repo tree 17 | pushd aosptree 18 | repo sync -c 19 | popd 20 | 21 | echo Patch AOSP tree 22 | patch_dir() { 23 | pushd aosptree/$1 24 | repo sync -l . 25 | git am ${LOCAL_PATH}/patches-aosp/$1/*.patch 26 | popd 27 | } 28 | 29 | pushd patches-aosp 30 | directories=$(find -name *patch | xargs dirname | uniq) 31 | popd 32 | 33 | for dir in ${directories} 34 | do 35 | echo "Patching: $dir" 36 | patch_dir $dir 37 | done 38 | 39 | # Hack to avoid rebuilding AOSP from scratch 40 | touch -c -t 200101010101 aosptree/external/libcxx/include/chrono 41 | 42 | echo -e "\n\033[32m Done \033[0m" 43 | -------------------------------------------------------------------------------- /unfold_lineageos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | 3 | echo "LineageOS-21 is not supported yet" 4 | 5 | exit 1 6 | 7 | LOCAL_PATH=$(pwd) 8 | 9 | echo Init repo tree using AOSP manifest 10 | pushd aosptree 11 | repo init -u https://github.com/LineageOS/android.git -b refs/heads/lineage-20.0 ${GD_REPO_INIT_ARGS} 12 | cd .repo/manifests 13 | rm default.xml 14 | cp ${LOCAL_PATH}/manifests/lineage-static.xml lineage.xml 15 | cp ${LOCAL_PATH}/manifests/glodroid.xml glodroid.xml 16 | cp ${LOCAL_PATH}/manifests/default_lineage.xml default.xml 17 | git add * 18 | git commit -m "Add GloDroid Project" --no-edit 19 | popd 20 | 21 | echo Sync repo tree 22 | pushd aosptree 23 | repo sync -cq 24 | popd 25 | 26 | echo Patch AOSP tree 27 | patch_dir() { 28 | pushd aosptree/$1 29 | repo sync -l . 30 | git am ${LOCAL_PATH}/patches-aosp/$1/*.patch 31 | popd 32 | } 33 | 34 | pushd patches-aosp 35 | directories=$(find -name *patch | xargs dirname | uniq) 36 | popd 37 | 38 | for dir in ${directories} 39 | do 40 | echo "Patching: $dir" 41 | patch_dir $dir 42 | done 43 | 44 | # Hack to avoid rebuilding AOSP from scratch 45 | touch -c -t 200101010101 aosptree/external/libcxx/include/chrono 46 | 47 | cd aosptree/external/chromium-webview/prebuilt/arm64 48 | git lfs pull 49 | cd - 50 | cd aosptree/external/chromium-webview/prebuilt/arm 51 | git lfs pull 52 | cd - 53 | 54 | echo -e "\n\033[32m Done \033[0m" 55 | --------------------------------------------------------------------------------