From ea1515b7cf450746fbab16ee0150324bc113237e Mon Sep 17 00:00:00 2001 From: Deborah Brouwer Date: Mon, 29 Sep 2025 16:37:37 -0700 Subject: [PATCH] CI: Return to using mesa software drivers When the CI pipeline was converted to Android 16, the mesa software drivers (llvmpipe and lavapipe) were temporarily removed until mesa's Android.mk build could be reconciled with the Soong build of mesa. Keep the Soong blueprints for other devices, but use mesa's make files to build llvmpipe and lavapipe. Use mesa drivers when running CI jobs. Signed-off-by: Deborah Brouwer Reviewed-by: Valentine Burley Reviewed-by: Antonio Ospite --- .ci/.gitlab-ci.yml | 2 +- .ci/container/debian/x86_64_cuttlefish.sh | 61 ++++++++++++++++++++++- 2 files changed, 60 insertions(+), 3 deletions(-) diff --git a/.ci/.gitlab-ci.yml b/.ci/.gitlab-ci.yml index b6ad002..cc16bf3 100644 --- a/.ci/.gitlab-ci.yml +++ b/.ci/.gitlab-ci.yml @@ -18,7 +18,7 @@ debian/x86_64_cuttlefish: - .container timeout: 6h variables: - FDO_DISTRIBUTION_VERSION: "bookworm-slim" + FDO_DISTRIBUTION_VERSION: "trixie-slim" FDO_DISTRIBUTION_EXEC: 'bash .ci/container/debian/x86_64_cuttlefish.sh' HWC_TAG: $DEBIAN_CUTTLEFISH_TAG after_script: diff --git a/.ci/container/debian/x86_64_cuttlefish.sh b/.ci/container/debian/x86_64_cuttlefish.sh index 8a21bb4..40c3ffb 100755 --- a/.ci/container/debian/x86_64_cuttlefish.sh +++ b/.ci/container/debian/x86_64_cuttlefish.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# shellcheck disable=SC1091 # no need to follow references to other shell scripts +# shellcheck disable=SC1090,SC1091 # no need to follow references to other shell scripts # For changes in this file to take effect, bump both: # DEBIAN_CUTTLEFISH_TAG and UBUNTU_ANDROID_TAG set -e @@ -71,11 +71,13 @@ EPHEMERAL_DEPS=( glslang-tools gpg gpg-agent - libncurses5 + libncurses-dev + meson ninja-build openssl openssh-client openssh-server + patch perl pkg-config pipx @@ -135,8 +137,63 @@ DRMHWC_DIR="${TOP}/external/drm_hwcomposer" get_repo "${DRMHWC_DIR}" # Ensure that __ANDROID_API__ is defined as ANDROID_SDK_VERSION +: "${ANDROID_SDK_VERSION:?ANDROID_SDK_VERSION is not set}" sed -i "/cc_defaults[[:space:]]*{/a\ min_sdk_version: \"${ANDROID_SDK_VERSION}\"," "${DRMHWC_DIR}/Android.bp" +# Keep mesa's Android.bp files for other devices that reference them, but, +# since the blueprint files don't support building lavapipe and llvmpipe for cuttlefish, +# continue to use Android.mk for these drivers +MESA3D_DIR="${TOP}/external/mesa3d" +pushd "${MESA3D_DIR}" +git remote add upstream https://gitlab.freedesktop.org/mesa/mesa.git +git fetch upstream + +# Fetch upstream mesa at the commit which uses the static LLVM library available from AOSP. +# When this commit is included in the next mesa release, then just use the released version. +MESA3D_LLVM_COMMIT="9029c8b1e37" +git restore --source="$MESA3D_LLVM_COMMIT" android/ + +# Revert the commit which removed the libglapi module since we still +# need it for the Android 16 build +MESA3D_LIBGLAPI_COMMIT="a1333d60e9f" +git log -1 -p "${MESA3D_LIBGLAPI_COMMIT}" | patch -p1 -R +popd + +# Remove references to AOSP's vulkan.lvp to avoid conflicts with Mesa make files +rm "${MESA3D_DIR}/src/gallium/targets/lavapipe/Android.bp" +CUTTLEFISH_DEVICE_DIR="${TOP}/device/google/cuttlefish" +sed -i '/"vulkan\.lvp"/d' "${CUTTLEFISH_DEVICE_DIR}/build/Android.bp" + +ALLOW_MESA_DIR="${TOP}/vendor/google/build/androidmk" +mkdir -p "${ALLOW_MESA_DIR}" +echo 'external/mesa3d/android/Android.mk' > "${ALLOW_MESA_DIR}/allowlist.txt" + +ALLOW_MESA_PRODUCT="${TOP}/device/google/cuttlefish/vsoc_x86_64/phone/aosp_cf.mk" +sed -i '/^PRODUCT_ALLOWED_ANDROIDMK_FILES := art\/Android.mk$/ s|$| external/mesa3d/android/Android.mk|' \ + "${ALLOW_MESA_PRODUCT}" + +cat >> "${CUTTLEFISH_DEVICE_DIR}/shared/virgl/BoardConfig.mk" <> "${CUTTLEFISH_DEVICE_DIR}/shared/virgl/device_vendor.mk" <