Merge remote branch 'd4a' into 'aosp-main'

* origin/d4a:
  sm8x50-userdebug: Add a generic build target for Snapdragon 8 gen devboards

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
diff --git a/AndroidProducts.mk b/AndroidProducts.mk
index fd0884a..f121e04 100644
--- a/AndroidProducts.mk
+++ b/AndroidProducts.mk
@@ -17,5 +17,4 @@
     $(LOCAL_DIR)/sm8x50/sm8x50.mk
 
 COMMON_LUNCH_CHOICES := \
-    db845c-trunk_staging-userdebug \
-    sm8x50-trunk_staging-userdebug
+    db845c-trunk_staging-userdebug
diff --git a/etc/mixer_paths.xml b/etc/mixer_paths.xml
index 2757f58..966e1ef 100644
--- a/etc/mixer_paths.xml
+++ b/etc/mixer_paths.xml
@@ -8,8 +8,4 @@
     <path name="hdmi_rb5">
         <ctl name="TERT_MI2S_RX Audio Mixer MultiMedia1" value="1" />
     </path>
-
-    <!-- Enable HDMI out for sm8550-hdk -->
-    <!-- Enable Audio out for sm8550-qrd -->
-    <!-- Enable Audio out for sm8650-qrd -->
 </mixer>
diff --git a/linaro_swr.mk b/linaro_swr.mk
index 5530e4f..2a31395 100644
--- a/linaro_swr.mk
+++ b/linaro_swr.mk
@@ -1,13 +1,14 @@
 $(call inherit-product, device/linaro/dragonboard/full.mk)
 $(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit_only.mk)
 $(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
-$(call inherit-product, device/linaro/dragonboard/shared/graphics/drm_hwcomposer/device.mk)
-$(call inherit-product, device/linaro/dragonboard/shared/graphics/minigbm_msm/device.mk)
-$(call inherit-product, device/linaro/dragonboard/shared/graphics/swangle/device.mk)
-$(call inherit-product, device/linaro/dragonboard/linaro_swr/device.mk)
 
 # Target is using software rendering
 TARGET_USES_SWR := true
+$(call inherit-product, device/linaro/dragonboard/shared/graphics/drm_hwcomposer/device.mk)
+$(call inherit-product, device/linaro/dragonboard/shared/graphics/minigbm_msm/device.mk)
+$(call inherit-product, device/linaro/dragonboard/shared/graphics/swangle/device.mk)
+
+$(call inherit-product, device/linaro/dragonboard/linaro_swr/device.mk)
 
 # Product overrides
 PRODUCT_NAME := linaro_swr
diff --git a/linaro_swr/device.mk b/linaro_swr/device.mk
index 829d02a..8219bfb 100644
--- a/linaro_swr/device.mk
+++ b/linaro_swr/device.mk
@@ -55,9 +55,6 @@
     ro.soc.manufacturer=Generic Qcom arm64 arch \
     ro.soc.model=linaro_swr
 
-PRODUCT_VENDOR_PROPERTIES += \
-    vendor.minigbm.debug=nocompression
-
 PRODUCT_SOONG_NAMESPACES += \
     vendor/linaro/db845c/$(EXPECTED_LINARO_VENDOR_VERSION) \
     vendor/linaro/rb5/$(EXPECTED_LINARO_VENDOR_VERSION)
diff --git a/shared/graphics/mesa/BoardConfig.mk b/shared/graphics/mesa/BoardConfig.mk
index 8836060..e05a372 100644
--- a/shared/graphics/mesa/BoardConfig.mk
+++ b/shared/graphics/mesa/BoardConfig.mk
@@ -17,7 +17,7 @@
 BOARD_GPU_DRIVERS := freedreno
 ifeq ($(TARGET_BUILD_MESA),true)
 BOARD_MESA3D_USES_MESON_BUILD := true
-BOARD_MESA3D_GALLIUM_DRIVERS := freedreno
+BOARD_MESA3D_GALLIUM_DRIVERS := freedreno zink
 BOARD_MESA3D_VULKAN_DRIVERS := freedreno
 else
 BOARD_USE_CUSTOMIZED_MESA := true
diff --git a/shared/graphics/minigbm_msm/device.mk b/shared/graphics/minigbm_msm/device.mk
index fcdb6a0..b7c1caa 100644
--- a/shared/graphics/minigbm_msm/device.mk
+++ b/shared/graphics/minigbm_msm/device.mk
@@ -21,3 +21,8 @@
 
 PRODUCT_PROPERTY_OVERRIDES := \
     ro.hardware.gralloc=minigbm_msm
+
+ifeq ($(TARGET_USES_SWR), true)
+PRODUCT_VENDOR_PROPERTIES := \
+    vendor.minigbm.debug=nocompression
+endif
diff --git a/sm8x50/BoardConfig.mk b/sm8x50/BoardConfig.mk
index 0fa9015..4995b75 100644
--- a/sm8x50/BoardConfig.mk
+++ b/sm8x50/BoardConfig.mk
@@ -12,7 +12,7 @@
 
 TARGET_NO_KERNEL := false
 BOARD_INCLUDE_DTB_IN_BOOTIMG := true
-BOARD_BOOT_HEADER_VERSION := 2
+BOARD_BOOT_HEADER_VERSION := 2 # XXX v4 is WIP
 BOARD_MKBOOTIMG_ARGS := --header_version $(BOARD_BOOT_HEADER_VERSION)
 
 BOARD_KERNEL_BASE := 0x80000000
@@ -30,7 +30,7 @@
 # Image Configuration
 BOARD_BOOTIMAGE_PARTITION_SIZE := 67108864 #64M
 BOARD_USERDATAIMAGE_PARTITION_SIZE := 223226966016 #200+G
-BOARD_FLASH_BLOCK_SIZE := 4096
+BOARD_FLASH_BLOCK_SIZE := 131072
 # Super partition
 BOARD_SUPER_PARTITION_SIZE := 6442450944 #6GB
 BOARD_DB_DYNAMIC_PARTITIONS_SIZE := 6438256640 # Reserve 4M for DAP metadata
@@ -48,6 +48,9 @@
 
 # Graphics
 include device/linaro/dragonboard/shared/graphics/drm_hwcomposer/BoardConfig.mk
-BOARD_SEPOLICY_DIRS += \
-    device/linaro/dragonboard/shared/graphics/minigbm_msm/sepolicy \
-    device/linaro/dragonboard/shared/graphics/swangle/sepolicy
+ifeq ($(TARGET_USES_SWR), true)
+BOARD_SEPOLICY_DIRS += device/linaro/dragonboard/shared/graphics/swangle/sepolicy
+else
+include device/linaro/dragonboard/shared/graphics/mesa/BoardConfig.mk
+endif
+BOARD_SEPOLICY_DIRS += device/linaro/dragonboard/shared/graphics/minigbm_msm/sepolicy
diff --git a/sm8x50/device.mk b/sm8x50/device.mk
index 18ff4cf..1613a5f 100644
--- a/sm8x50/device.mk
+++ b/sm8x50/device.mk
@@ -59,12 +59,13 @@
     ro.soc.manufacturer=Snapdragon 8 Gen Devboard \
     ro.soc.model=SM8x50
 
-PRODUCT_VENDOR_PROPERTIES += \
-    vendor.minigbm.debug=nocompression
-
 PRODUCT_SOONG_NAMESPACES += \
     vendor/linaro/sm8x50/$(EXPECTED_LINARO_VENDOR_VERSION)
 
+# XXX until v4 support
+PRODUCT_COPY_FILES += \
+    device/linaro/dragonboard/shared/utils/dlkm_loader/vendor_ramdisk.modules.blocklist:$(TARGET_COPY_OUT_RAMDISK)/lib/modules/modules.blocklist
+
 # Copy firmware files
 $(call inherit-product-if-exists, vendor/linaro/sm8x50/$(EXPECTED_LINARO_VENDOR_VERSION)/device.mk)
 
diff --git a/sm8x50/init.environ.rc b/sm8x50/init.environ.rc
new file mode 100644
index 0000000..bd44494
--- /dev/null
+++ b/sm8x50/init.environ.rc
@@ -0,0 +1,3 @@
+# set up the global environment
+on early-init
+    export MESA_LOADER_DRIVER_OVERRIDE zink
diff --git a/sm8x50/sm8x50.mk b/sm8x50/sm8x50.mk
index 930d0f6..55f8476 100644
--- a/sm8x50/sm8x50.mk
+++ b/sm8x50/sm8x50.mk
@@ -1,13 +1,21 @@
 $(call inherit-product, device/linaro/dragonboard/full.mk)
 $(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit_only.mk)
 $(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
-$(call inherit-product, device/linaro/dragonboard/shared/graphics/drm_hwcomposer/device.mk)
-$(call inherit-product, device/linaro/dragonboard/shared/graphics/minigbm_msm/device.mk)
-$(call inherit-product, device/linaro/dragonboard/shared/graphics/swangle/device.mk)
-$(call inherit-product, device/linaro/dragonboard/sm8x50/device.mk)
 
-# Target is using software rendering
-TARGET_USES_SWR := true
+# Target boots with software rendering by default
+TARGET_USES_SWR ?= true
+$(call inherit-product, device/linaro/dragonboard/shared/graphics/drm_hwcomposer/device.mk)
+ifeq ($(TARGET_USES_SWR), true)
+  $(call inherit-product, device/linaro/dragonboard/shared/graphics/swangle/device.mk)
+else
+  $(call inherit-product, device/linaro/dragonboard/shared/graphics/mesa/device.mk)
+  TARGET_USES_VULKAN := true
+  PRODUCT_VENDOR_PROPERTIES += debug.hwui.renderer=skiagl
+  PRODUCT_COPY_FILES += $(LOCAL_PATH)/init.environ.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.environ.rc
+endif
+$(call inherit-product, device/linaro/dragonboard/shared/graphics/minigbm_msm/device.mk)
+
+$(call inherit-product, device/linaro/dragonboard/sm8x50/device.mk)
 
 # Product overrides
 PRODUCT_NAME := sm8x50
diff --git a/vendor-package-ver.sh b/vendor-package-ver.sh
index 695d643..127a208 100755
--- a/vendor-package-ver.sh
+++ b/vendor-package-ver.sh
@@ -1,9 +1,9 @@
 #!/bin/bash
 
-export EXPECTED_LINARO_VENDOR_VERSION=20240318
+export EXPECTED_LINARO_VENDOR_VERSION=20240405
 #make sure to use sha512sum here
-export EXPECTED_LINARO_VENDOR_SHA=5adf8f15aaed3d36c4fc7531a77e3bc0daf88fbf1532482804b157c0d4a18ed1f43c273bfd4f05e531adb5815913d71c1172d42bd41034a3dbd1a3d51ac7e4f4
-export VND_PKG_URL=https://releases.devboardsforandroid.linaro.org/vendor-packages/20240318/extract-linaro_devices-20240318.tgz
+export EXPECTED_LINARO_VENDOR_SHA=b287858201bb3d3eaac4f2fa2626e2a594b5ea4364ad9fff8910c572e4c1b1a81283c48d342c1dc86984990fbd13720cdf4469e180a70624a739ccd168b50837
+export VND_PKG_URL=https://releases.devboardsforandroid.linaro.org/vendor-packages/20240405/extract-linaro_devices-20240405.tgz
 
 if [ "$1" = "url" ]; then
  echo $VND_PKG_URL