sm8x50: Add Mesa (zink+turnip) support
Add Mesa support in sm8x50-userdebug device config but do
not enable it yet, until a740* Adreno binaries land in
linux-firmware project. TARGET_USES_SWR still defaults to
"true" i.e. we boot with s/w rendering by default.
SM8550-HDK uses Zink Gallium and Freedreno/Turnip Vulkan
driver to boot with h/w accelerated Mesa graphics.
Turnip Vulkan driver doesn't have Android Hardware Buffer
support implemented yet, so setting HWUI renderer to SkiaGL.
This pending Mesa MR fixes an AOSP breakage upstream
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28579
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Change-Id: I1e2462b8f2dc848bc31a268aa1de405248cf16e5
diff --git a/sm8x50/BoardConfig.mk b/sm8x50/BoardConfig.mk
index 9015b1c..4995b75 100644
--- a/sm8x50/BoardConfig.mk
+++ b/sm8x50/BoardConfig.mk
@@ -48,5 +48,9 @@
# Graphics
include device/linaro/dragonboard/shared/graphics/drm_hwcomposer/BoardConfig.mk
+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/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 79d5441..55f8476 100644
--- a/sm8x50/sm8x50.mk
+++ b/sm8x50/sm8x50.mk
@@ -2,10 +2,17 @@
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit_only.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
-# Target boots with 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)
-$(call inherit-product, device/linaro/dragonboard/shared/graphics/swangle/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)