linaro_swr: A generic build target using software rendering
linaro_swr is an attempt to prepare a generic arm64 build
target booting with software rendering support SwANGLE
i.e. GLES implementation (ANGLE) on top of SwiftShader’s
vulkan (Pastel) implementation.
Though it is developed and tested for Qcom target devices
for now, but the plan is to make it generic enough to boot
on any generic arm64 device.
Change-Id: I135b4d2148330368ff298cb5d4bd290a67a94422
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
diff --git a/shared/graphics/swangle/device.mk b/shared/graphics/swangle/device.mk
new file mode 100644
index 0000000..0eebc66
--- /dev/null
+++ b/shared/graphics/swangle/device.mk
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2014 The Android Open-Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# TODO(b/65201432): Swiftshader needs to create executable memory.
+PRODUCT_REQUIRES_INSECURE_EXECMEM_FOR_SWIFTSHADER := true
+
+# ANGLE provides an OpenGL implementation built on top of Vulkan.
+PRODUCT_PACKAGES := \
+ libEGL_angle \
+ libGLESv1_CM_angle \
+ libGLESv2_angle
+
+PRODUCT_VENDOR_PROPERTIES := \
+ ro.hardware.egl=angle \
+
+PRODUCT_PROPERTY_OVERRIDES := \
+ ro.sf.lcd_density=160 \
+ ro.opengles.version=196608 \
+ persist.demo.rotationlock=1
+
+PRODUCT_COPY_FILES := \
+ frameworks/native/data/etc/android.hardware.opengles.aep.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.opengles.aep.xml \
+ frameworks/native/data/etc/android.software.opengles.deqp.level-2022-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml
+
+# Vulkan
+TARGET_VULKAN_SUPPORT := true
+TARGET_USES_VULKAN := true
+
+PRODUCT_PACKAGES += vulkan.pastel
+
+PRODUCT_COPY_FILES += \
+ frameworks/native/data/etc/android.hardware.vulkan.compute-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.compute.xml \
+ frameworks/native/data/etc/android.hardware.vulkan.level-1.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.level.xml \
+ frameworks/native/data/etc/android.hardware.vulkan.version-1_1.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \
+ frameworks/native/data/etc/android.software.vulkan.deqp.level-2021-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml
+
+PRODUCT_VENDOR_PROPERTIES += \
+ ro.hardware.vulkan=pastel
diff --git a/shared/graphics/swangle/sepolicy/file_contexts b/shared/graphics/swangle/sepolicy/file_contexts
new file mode 100644
index 0000000..472f013
--- /dev/null
+++ b/shared/graphics/swangle/sepolicy/file_contexts
@@ -0,0 +1,5 @@
+/vendor/lib(64)?/hw/vulkan.pastel.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libEGL_angle\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libGLESv1_CM_angle\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libGLESv2_angle\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libfeature_support_angle\.so u:object_r:same_process_hal_file:s0
diff --git a/shared/graphics/swangle/sepolicy/sw_execmem.te b/shared/graphics/swangle/sepolicy/sw_execmem.te
new file mode 100644
index 0000000..0844c3c
--- /dev/null
+++ b/shared/graphics/swangle/sepolicy/sw_execmem.te
@@ -0,0 +1,5 @@
+# TODO(b/65201432): Swiftshader needs to create executable memory.
+allow bootanim self:process execmem;
+allow surfaceflinger self:process execmem;
+allow system_server self:process execmem;
+allow zygote self:process execmem;