Remove Hikey targets and unsupported build configs
Remove Hikey family build targets and a few unsupported
build configs like the experimental AVF support. Also
revert vendor-package support and move back to locally
hosted firmware binaries.
Change-Id: Ia6026643e3586a055ad4724de5f38cb06d5341d8
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
diff --git a/Android.mk b/Android.mk
index 179188a..41d191f 100644
--- a/Android.mk
+++ b/Android.mk
@@ -24,19 +24,6 @@
LOCAL_PATH := $(call my-dir)
-
-ifeq (,$(wildcard $(LINARO_VENDOR_PATH)/hikey960/$(EXPECTED_LINARO_VENDOR_VERSION)/version.mk))
-droidcore: $(PRODUCT_OUT)/missing_vendor_package
-$(PRODUCT_OUT)/missing_vendor_package:
- echo
- echo "Missing Linaro Vendor Package!"
- echo "Please download new binaries here:"
- echo " $(VND_PKG_URL)"
- echo "And extract in the ANDROID_TOP_DIR"
- echo
- false
-endif
-
$(eval $(call declare-1p-copy-files,device/linaro/hikey,.conf))
$(eval $(call declare-1p-copy-files,device/linaro/hikey,.img))
$(eval $(call declare-1p-copy-files,device/linaro/hikey,.kl))
diff --git a/AndroidProducts.mk b/AndroidProducts.mk
index 9193abc..7d7ab60 100644
--- a/AndroidProducts.mk
+++ b/AndroidProducts.mk
@@ -10,16 +10,7 @@
#
PRODUCT_MAKEFILES := \
- $(LOCAL_DIR)/hikey.mk \
- $(LOCAL_DIR)/hikey32.mk \
- $(LOCAL_DIR)/hikey64_only.mk \
- $(LOCAL_DIR)/hikey_tv.mk \
- $(LOCAL_DIR)/hikey960.mk \
- $(LOCAL_DIR)/hikey960_tv.mk
+ $(LOCAL_DIR)/hikey960.mk
COMMON_LUNCH_CHOICES := \
- hikey-userdebug \
- hikey64_only-userdebug \
- hikey_tv-userdebug \
- hikey960-userdebug \
- hikey960_tv-userdebug
+ hikey960-userdebug
diff --git a/bt-wifi-firmware-util/NOTICE b/bt-wifi-firmware-util/NOTICE
new file mode 100644
index 0000000..e5bdc11
--- /dev/null
+++ b/bt-wifi-firmware-util/NOTICE
@@ -0,0 +1,72 @@
+TEXAS INSTRUMENTS TEXT FILE LICENSE
+
+
+Copyright (c) 2008 - 2013 Texas Instruments Incorporated
+
+All rights reserved not granted herein.
+
+Limited License.
+
+If you download and use any version of this software from www.github.com, you
+acknowledge and agree that the terms and conditions of this license control and any
+previous licenses under which this software may have been provided on www.github.com
+are superseded and replaced by the terms and conditions of this license.
+
+Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
+license under copyrights and patents it now or hereafter owns or controls to make,
+have made, use, import, offer to sell and sell ("Utilize") this software subject
+to the terms herein. With respect to the foregoing patent license, such license
+is granted solely to the extent that any such patent is necessary to Utilize the
+software alone. The patent license shall not apply to any combinations which
+include this software, other than combinations with devices manufactured by or
+for TI ("TI Devices"). No hardware patent is licensed hereunder.
+
+Redistributions must preserve existing copyright notices and reproduce this license
+(including the above copyright notice and the disclaimer and (if applicable) source
+code license limitations below) in the documentation and/or other materials provided
+with the distribution
+
+Redistribution and use in binary form, without modification, are permitted provided
+that the following conditions are met:
+
+* No reverse engineering, decompilation, or disassembly of this software is permitted
+ with respect to any software provided in binary form.
+
+* any redistribution and use are licensed by TI for use only with TI Devices.
+
+* Nothing shall obligate TI to provide you with source code for the software
+ licensed and provided to you in object code.
+
+If software source code is provided to you, modification and redistribution of the
+source code are permitted provided that the following conditions are met:
+
+* any redistribution and use of the source code, including any resulting
+ derivative works, are licensed by TI for use only with TI Devices.
+
+* any redistribution and use of any object code compiled from the source
+ code and any resulting derivative works, are licensed by TI for use only
+ with TI Devices.
+
+Neither the name of Texas Instruments Incorporated nor the names of its suppliers
+may be used to endorse or promote products derived from this software without specific
+prior written permission.
+
+DISCLAIMER.
+
+THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS
+OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+BY UTILIZING THIS SOFTWARE TO ENABLE ANT CODE EMBEDDED ON TI DEVICES, YOU
+AGREE THAT NOTHING IN THIS LICENSE GIVES RISE TO ANY WARRANTY OR OTHER
+OBLIGATIONS BY TI OR ITS LICENSORS WITH RESPECT TO THE ANT CODE EMBEDDED
+ON TI DEVICES AND ENABLED BY THE SOFTWARE UNDER THIS LICENSE. FURTHER, YOU
+AGREE THAT NOTHING IN THIS LICENSE GIVES RISE TO ANY RIGHT TO REVERSE ENGINEER,
+DECOMPILE OR DISASSEMBLE THE ANT CODE EMBEDDED ON THE TI DEVICES.
diff --git a/bt-wifi-firmware-util/TIInit_11.8.32-pcm-960.bts b/bt-wifi-firmware-util/TIInit_11.8.32-pcm-960.bts
new file mode 100644
index 0000000..ff56d1c
--- /dev/null
+++ b/bt-wifi-firmware-util/TIInit_11.8.32-pcm-960.bts
Binary files differ
diff --git a/bt-wifi-firmware-util/TIInit_11.8.32.bts b/bt-wifi-firmware-util/TIInit_11.8.32.bts
new file mode 100755
index 0000000..824ca0f
--- /dev/null
+++ b/bt-wifi-firmware-util/TIInit_11.8.32.bts
Binary files differ
diff --git a/bt-wifi-firmware-util/wl18xx-conf-wl1837mod.bin b/bt-wifi-firmware-util/wl18xx-conf-wl1837mod.bin
new file mode 100644
index 0000000..5dd913c
--- /dev/null
+++ b/bt-wifi-firmware-util/wl18xx-conf-wl1837mod.bin
Binary files differ
diff --git a/bt-wifi-firmware-util/wl18xx-conf.bin b/bt-wifi-firmware-util/wl18xx-conf.bin
new file mode 100644
index 0000000..2bd0f4d
--- /dev/null
+++ b/bt-wifi-firmware-util/wl18xx-conf.bin
Binary files differ
diff --git a/bt-wifi-firmware-util/wl18xx-fw-4.bin b/bt-wifi-firmware-util/wl18xx-fw-4.bin
new file mode 100755
index 0000000..71c160a
--- /dev/null
+++ b/bt-wifi-firmware-util/wl18xx-fw-4.bin
Binary files differ
diff --git a/build/tasks/dtimage.mk b/build/tasks/dtimage.mk
index 02b47f6..2e480df 100644
--- a/build/tasks/dtimage.mk
+++ b/build/tasks/dtimage.mk
@@ -1,11 +1,7 @@
ifneq ($(filter hikey%, $(TARGET_DEVICE)),)
ifneq ($(TARGET_NO_DTIMAGE), true)
-# make sure the vendor package is present
-include device/linaro/hikey/vendor-package-ver.mk
-ifneq (,$(wildcard $(LINARO_VENDOR_PATH)/hikey960/$(EXPECTED_LINARO_VENDOR_VERSION)/version.mk))
-
-MKDTIMG := $(LINARO_VENDOR_PATH)/hikey960/$(EXPECTED_LINARO_VENDOR_VERSION)/bootloader/mkdtimg
+MKDTIMG := device/linaro/hikey/installer/hikey960/mkdtimg
DTB := $(PRODUCT_OUT)/hi3660-hikey960.dtb
$(PRODUCT_OUT)/dt.img: $(DTB)
@@ -15,4 +11,3 @@
endif
endif
-endif
diff --git a/device-common.mk b/device-common.mk
index 6cb552c..f3ddd56 100644
--- a/device-common.mk
+++ b/device-common.mk
@@ -17,38 +17,10 @@
# Enable updating of APEXes
$(call inherit-product, $(SRC_TARGET_DIR)/product/updatable_apex.mk)
-# Check vendor package version
-# If you need to make changes to the vendor partition,
-# please modify the source git project here:
-# https://staging-git.codelinaro.org/linaro/linaro-aosp/aosp-linaro-vendor-package
-include $(LOCAL_PATH)/vendor-package-ver.mk
-ifneq (,$(wildcard $(LINARO_VENDOR_PATH)/hikey960/$(EXPECTED_LINARO_VENDOR_VERSION)/version.mk))
- # Unfortunately inherit-product doesn't export build variables from the
- # called make file to the caller, so we have to include it directly here.
- include $(LINARO_VENDOR_PATH)/hikey960/$(EXPECTED_LINARO_VENDOR_VERSION)/version.mk
- ifneq ($(TARGET_LINARO_VENDOR_VERSION), $(EXPECTED_LINARO_VENDOR_VERSION))
- $(warning TARGET_LINARO_VENDOR_VERSION ($(TARGET_LINARO_VENDOR_VERSION)) does not match exiting the build ($(EXPECTED_LINARO_VENDOR_VERSION)).)
- $(warning Please download and extract the new binaries by running the following script:)
- $(warning ./device/linaro/hikey/fetch-vendor-package.sh )
- endif
-else
- $(warning Missing Linaro Vendor Package!)
- $(warning Please download and extract the vendor binaries by running the following script:)
- $(warning ./device/linaro/hikey/fetch-vendor-package.sh )
-endif
-ifneq (,$(filter $(TARGET_PRODUCT),hikey960_tv hikey_tv))
-# Setup TV Build
-USE_OEM_TV_APP := true
-$(call inherit-product, device/google/atv/products/atv_base.mk)
-PRODUCT_CHARACTERISTICS := tv
-PRODUCT_AAPT_PREF_CONFIG := tvdpi
-PRODUCT_IS_ATV := true
-else
# Adjust the dalvik heap to be appropriate for a tablet.
$(call inherit-product, frameworks/native/build/tablet-10in-xhdpi-2048-dalvik-heap.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
-endif
# Set vendor kernel path
PRODUCT_VENDOR_KERNEL_HEADERS := device/linaro/hikey/kernel-headers
@@ -62,17 +34,12 @@
# Set custom settings
DEVICE_PACKAGE_OVERLAYS := device/linaro/hikey/overlay
-ifneq (,$(filter $(TARGET_PRODUCT),hikey960_tv hikey_tv))
-# Set TV Custom Settings
-DEVICE_PACKAGE_OVERLAYS += device/google/atv/overlay
-endif
#avoid usb crash
PRODUCT_PRODUCT_PROPERTIES += \
persist.adb.nonblocking_ffs=0 \
ro.adb.nonblocking_ffs=0 \
-
#Force navkeys on
PRODUCT_PROPERTY_OVERRIDES += qemu.hw.mainkeys=0
@@ -193,28 +160,9 @@
endif
-
-ifneq (,$(filter $(TARGET_PRODUCT),hikey960_tv hikey_tv))
-# TV Specific Packages
-PRODUCT_PACKAGES += \
- TvSettings \
- LiveTv \
- google-tv-pairing-protocol \
- TvProvision \
- LeanbackSampleApp \
- TvSampleLeanbackLauncher \
- TvProvider \
- SettingsIntelligence \
- tv_input.default \
- com.android.media.tv.remoteprovider \
- InputDevices
-PRODUCT_PROPERTY_OVERRIDES += ro.sf.lcd_density=260
-else
-
# Use Launcher3QuickStep
PRODUCT_PACKAGES += Launcher3QuickStep
PRODUCT_PROPERTY_OVERRIDES += ro.sf.lcd_density=160
-endif
# Copy hardware config file(s)
PRODUCT_COPY_FILES += \
diff --git a/fetch-vendor-package.sh b/fetch-vendor-package.sh
deleted file mode 100755
index 0a50853..0000000
--- a/fetch-vendor-package.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-# fetch, check & extract the current vendor package
-set -e
-
-DIR_PARENT=$(cd $(dirname $0); pwd)
-if [ -z "${ANDROID_BUILD_TOP}" ]; then
- ANDROID_BUILD_TOP=$(cd ${DIR_PARENT}/../../../; pwd)
-fi
-
-. "${ANDROID_BUILD_TOP}/device/linaro/hikey/vendor-package-ver.sh"
-
-PKG_FILE=extract-linaro_devices-${EXPECTED_LINARO_VENDOR_VERSION}
-
-pushd ${ANDROID_BUILD_TOP}
-
-# remove the older vendor-package, if any, because upstream
-# mesa prebuilts in linaro-vendor-package ain't declared
-# within a contained namespace and we can run into build
-# errors because of redefinition of mesa prebuilt modules
-# from the previous vendor-package.
-# FIXME move mesa prebuilts from Android.mk to Android.bp
-rm -rf ${ANDROID_BUILD_TOP}/vendor/linaro/
-
-if [ ! -e "${PKG_FILE}.tgz" ]; then
- curl -L ${VND_PKG_URL} -o ${PKG_FILE}.tgz
-fi
-
-# generate expected sha512sum, check & cleanup
-echo "${EXPECTED_LINARO_VENDOR_SHA} ${PKG_FILE}.tgz" > ${PKG_FILE}.tgz.sha
-sha512sum -c ${PKG_FILE}.tgz.sha
-rm ${PKG_FILE}.tgz.sha
-
-tar -xf ${PKG_FILE}.tgz
-./${PKG_FILE}.sh
-popd
diff --git a/gralloc/Android.bp b/gralloc/Android.bp
deleted file mode 100644
index aaca7cb..0000000
--- a/gralloc/Android.bp
+++ /dev/null
@@ -1,18 +0,0 @@
-package {
- // See: http://go/android-license-faq
- // A large-scale-change added 'default_applicable_licenses' to import
- // all of the 'license_kinds' from "device_linaro_hikey_license"
- // to get the below license kinds:
- // SPDX-license-identifier-Apache-2.0
- // SPDX-license-identifier-GPL-2.0
- default_applicable_licenses: ["device_linaro_hikey_license"],
-}
-
-cc_library_shared {
- name: "hwcomposer.drm_hikey",
- defaults: ["hwcomposer.drm_defaults"],
- srcs: [
- ":drm_hwcomposer_common",
- ":drm_hwcomposer_platformhisi",
- ],
-}
diff --git a/gralloc/Android.mk b/gralloc/Android.mk
deleted file mode 100644
index 947a184..0000000
--- a/gralloc/Android.mk
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# Copyright (C) 2010 ARM Limited. All rights reserved.
-#
-# Copyright (C) 2008 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.
-
-
-LOCAL_PATH := $(call my-dir)
-
-# HAL module implemenation, not prelinked and stored in
-# hw/<OVERLAY_HARDWARE_MODULE_ID>.<ro.product.board>.so
-include $(CLEAR_VARS)
-LOCAL_PRELINK_MODULE := false
-
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_VENDOR_MODULE := true
-
-MALI_DDK_TEST_PATH := hardware/arm/
-
-LOCAL_MODULE := gralloc.hikey
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-GPL-2.0
-LOCAL_LICENSE_CONDITIONS := notice restricted
-LOCAL_MODULE_RELATIVE_PATH := hw
-#LOCAL_MODULE_TAGS := optional
-
-# Mali-200/300/400MP DDK
-MALI_DDK_PATH := hardware/arm/mali
-#SHARED_MEM_LIBS := libUMP
-SHARED_MEM_LIBS := libion libhardware
-LOCAL_SHARED_LIBRARIES := liblog libsync libGLESv1_CM $(SHARED_MEM_LIBS)
-
-LOCAL_C_INCLUDES := system/core/include/ $(MALI_DDK_PATH)/include
-# Include the UMP header files
-LOCAL_C_INCLUDES += $(MALI_DDK_PATH)/src/ump/include
-
-LOCAL_CFLAGS := -DLOG_TAG=\"gralloc\" -DGRALLOC_32_BITS -DSTANDARD_LINUX_SCREEN -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
-
-LOCAL_SRC_FILES := \
- gralloc_module.cpp \
- alloc_device.cpp \
- framebuffer_device.cpp
-
-#LOCAL_CFLAGS+= -DMALI_VSYNC_EVENT_REPORT_ENABLE
-
-
-LOCAL_CFLAGS += -DDISABLE_FRAMEBUFFER_HAL
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/gralloc/alloc_device.cpp b/gralloc/alloc_device.cpp
deleted file mode 100644
index f458a62..0000000
--- a/gralloc/alloc_device.cpp
+++ /dev/null
@@ -1,871 +0,0 @@
-/*
- * Copyright (C) 2010 ARM Limited. All rights reserved.
- *
- * Copyright (C) 2008 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.
- */
-
-#include <cstdlib>
-#include <string.h>
-#include <errno.h>
-#include <pthread.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include <cutils/log.h>
-#include <cutils/atomic.h>
-#include <hardware/hardware.h>
-#include <hardware/gralloc.h>
-
-#include <sys/ioctl.h>
-
-#include "alloc_device.h"
-#include "gralloc_priv.h"
-#include "gralloc_helper.h"
-#include "framebuffer_device.h"
-
-#if GRALLOC_ARM_UMP_MODULE
-#include <ump/ump.h>
-#include <ump/ump_ref_drv.h>
-#endif
-
-#if GRALLOC_ARM_DMA_BUF_MODULE
-#include <ion/ion.h>
-#include "ion_4.12.h"
-#include "dma-heap.h"
-
-#define ION_SYSTEM (char*)"ion_system_heap"
-#define ION_CMA (char*)"linux,cma"
-
-#define DMABUF_SYSTEM (char*)"system"
-#define DMABUF_CMA (char*)"linux,cma"
-static enum {
- INTERFACE_UNKNOWN,
- INTERFACE_ION_LEGACY,
- INTERFACE_ION_MODERN,
- INTERFACE_DMABUF_HEAPS
-} interface_ver;
-
-static int system_heap_id;
-static int cma_heap_id;
-#endif
-
-#if GRALLOC_SIMULATE_FAILURES
-#include <cutils/properties.h>
-
-/* system property keys for controlling simulated UMP allocation failures */
-#define PROP_MALI_TEST_GRALLOC_FAIL_FIRST "mali.test.gralloc.fail_first"
-#define PROP_MALI_TEST_GRALLOC_FAIL_INTERVAL "mali.test.gralloc.fail_interval"
-
-static int __ump_alloc_should_fail()
-{
-
- static unsigned int call_count = 0;
- unsigned int first_fail = 0;
- int fail_period = 0;
- int fail = 0;
-
- ++call_count;
-
- /* read the system properties that control failure simulation */
- {
- char prop_value[PROPERTY_VALUE_MAX];
-
- if (property_get(PROP_MALI_TEST_GRALLOC_FAIL_FIRST, prop_value, "0") > 0)
- {
- sscanf(prop_value, "%11u", &first_fail);
- }
-
- if (property_get(PROP_MALI_TEST_GRALLOC_FAIL_INTERVAL, prop_value, "0") > 0)
- {
- sscanf(prop_value, "%11u", &fail_period);
- }
- }
-
- /* failure simulation is enabled by setting the first_fail property to non-zero */
- if (first_fail > 0)
- {
- LOGI("iteration %u (fail=%u, period=%u)\n", call_count, first_fail, fail_period);
-
- fail = (call_count == first_fail) ||
- (call_count > first_fail && fail_period > 0 && 0 == (call_count - first_fail) % fail_period);
-
- if (fail)
- {
- AERR("failed ump_ref_drv_allocate on iteration #%d\n", call_count);
- }
- }
-
- return fail;
-}
-#endif
-
-#ifdef FBIOGET_DMABUF
-static int fb_get_framebuffer_dmabuf(private_module_t *m, private_handle_t *hnd)
-{
- struct fb_dmabuf_export fb_dma_buf;
- int res;
- res = ioctl(m->framebuffer->fd, FBIOGET_DMABUF, &fb_dma_buf);
-
- if (res == 0)
- {
- hnd->share_fd = fb_dma_buf.fd;
- return 0;
- }
- else
- {
- AINF("FBIOGET_DMABUF ioctl failed(%d). See gralloc_priv.h and the integration manual for vendor framebuffer "
- "integration",
- res);
- return -1;
- }
-}
-#endif
-
-#if GRALLOC_ARM_DMA_BUF_MODULE
-#define DEVPATH "/dev/dma_heap"
-int dma_heap_open(const char* name)
-{
- int ret, fd;
- char buf[256];
-
- ret = sprintf(buf, "%s/%s", DEVPATH, name);
- if (ret < 0) {
- AERR("sprintf failed!\n");
- return ret;
- }
-
- fd = open(buf, O_RDONLY);
- if (fd < 0)
- AERR("open %s failed!\n", buf);
- return fd;
-}
-
-int dma_heap_alloc(int fd, size_t len, unsigned int flags, int *dmabuf_fd)
-{
- struct dma_heap_allocation_data data = {
- .len = len,
- .fd_flags = O_RDWR | O_CLOEXEC,
- .heap_flags = flags,
- };
- int ret;
-
- if (dmabuf_fd == NULL)
- return -EINVAL;
-
- ret = ioctl(fd, DMA_HEAP_IOCTL_ALLOC, &data);
- if (ret < 0)
- return ret;
- *dmabuf_fd = (int)data.fd;
- return ret;
-}
-
-static int alloc_ion_fd(int ion_fd, size_t size, unsigned int heap_mask, unsigned int flags, int *shared_fd)
-{
- int heap;
-
- if (interface_ver == INTERFACE_DMABUF_HEAPS) {
- int fd = system_heap_id;
- unsigned long flg = 0;
- if (heap_mask == ION_HEAP_TYPE_DMA_MASK)
- fd = cma_heap_id;
-
- return dma_heap_alloc(fd, size, flg, shared_fd);
- }
-
- if (interface_ver == INTERFACE_ION_MODERN) {
- heap = 1 << system_heap_id;
- if (heap_mask == ION_HEAP_TYPE_DMA_MASK)
- heap = 1 << cma_heap_id;
- } else {
- heap = heap_mask;
- }
- return ion_alloc_fd(ion_fd, size, 0, heap, flags, shared_fd);
-}
-#endif
-
-static int gralloc_alloc_buffer(alloc_device_t *dev, size_t size, int usage, buffer_handle_t *pHandle)
-{
-#if GRALLOC_ARM_DMA_BUF_MODULE
- {
- private_module_t *m = reinterpret_cast<private_module_t *>(dev->common.module);
- void *cpu_ptr = MAP_FAILED;
- int shared_fd;
- int ret;
- unsigned int heap_mask;
- int lock_state = 0;
- int map_mask = 0;
-
- if (usage & GRALLOC_USAGE_PROTECTED) {
-#if defined(ION_HEAP_SECURE_MASK)
- heap_mask = ION_HEAP_SECURE_MASK;
-#else
- AERR("The platform does NOT support protected ION memory.");
- return -1;
-#endif
- }
- else if (usage & GRALLOC_USAGE_HW_FB) {
- heap_mask = ION_HEAP_TYPE_DMA_MASK;
- }
- else {
- heap_mask = ION_HEAP_SYSTEM_MASK;
- }
-
- ret = alloc_ion_fd(m->ion_client, size, heap_mask, 0, &shared_fd);
- if (ret != 0) {
- AERR("Failed to ion_alloc_fd from ion_client:%d", m->ion_client);
- return -1;
- }
-
- if (!(usage & GRALLOC_USAGE_PROTECTED))
- {
- map_mask = PROT_READ | PROT_WRITE;
- }
- else
- {
- map_mask = PROT_WRITE;
- }
-
- cpu_ptr = mmap(NULL, size, map_mask, MAP_SHARED, shared_fd, 0);
-
- if (MAP_FAILED == cpu_ptr)
- {
- AERR("ion_map( %d ) failed", m->ion_client);
-
- close(shared_fd);
- return -1;
- }
-
- lock_state = private_handle_t::LOCK_STATE_MAPPED;
-
- private_handle_t *hnd = new private_handle_t(private_handle_t::PRIV_FLAGS_USES_ION, usage, size, cpu_ptr, lock_state);
-
- if (NULL != hnd)
- {
- hnd->share_fd = shared_fd;
- *pHandle = hnd;
- return 0;
- }
- else
- {
- AERR("Gralloc out of mem for ion_client:%d", m->ion_client);
- }
-
- close(shared_fd);
-
- ret = munmap(cpu_ptr, size);
-
- if (0 != ret)
- {
- AERR("munmap failed for base:%p size: %lu", cpu_ptr, (unsigned long)size);
- }
-
- return -1;
- }
-#endif
-
-#if GRALLOC_ARM_UMP_MODULE
- MALI_IGNORE(dev);
- {
- ump_handle ump_mem_handle;
- void *cpu_ptr;
- ump_secure_id ump_id;
- ump_alloc_constraints constraints;
-
- size = round_up_to_page_size(size);
-
- if ((usage & GRALLOC_USAGE_SW_READ_MASK) == GRALLOC_USAGE_SW_READ_OFTEN)
- {
- constraints = UMP_REF_DRV_CONSTRAINT_USE_CACHE;
- }
- else
- {
- constraints = UMP_REF_DRV_CONSTRAINT_NONE;
- }
-
-#ifdef GRALLOC_SIMULATE_FAILURES
-
- /* if the failure condition matches, fail this iteration */
- if (__ump_alloc_should_fail())
- {
- ump_mem_handle = UMP_INVALID_MEMORY_HANDLE;
- }
- else
-#endif
- {
- if (usage & GRALLOC_USAGE_PROTECTED)
- {
- AERR("gralloc_alloc_buffer() does not support to allocate protected UMP memory.");
- }
- else
- {
- ump_mem_handle = ump_ref_drv_allocate(size, constraints);
-
- if (UMP_INVALID_MEMORY_HANDLE != ump_mem_handle)
- {
- cpu_ptr = ump_mapped_pointer_get(ump_mem_handle);
-
- if (NULL != cpu_ptr)
- {
- ump_id = ump_secure_id_get(ump_mem_handle);
-
- if (UMP_INVALID_SECURE_ID != ump_id)
- {
- private_handle_t *hnd = new private_handle_t(private_handle_t::PRIV_FLAGS_USES_UMP, usage, size, cpu_ptr,
- private_handle_t::LOCK_STATE_MAPPED, ump_id, ump_mem_handle);
-
- if (NULL != hnd)
- {
- *pHandle = hnd;
- return 0;
- }
- else
- {
- AERR("gralloc_alloc_buffer() failed to allocate handle. ump_handle = %p, ump_id = %d", ump_mem_handle, ump_id);
- }
- }
- else
- {
- AERR("gralloc_alloc_buffer() failed to retrieve valid secure id. ump_handle = %p", ump_mem_handle);
- }
-
- ump_mapped_pointer_release(ump_mem_handle);
- }
- else
- {
- AERR("gralloc_alloc_buffer() failed to map UMP memory. ump_handle = %p", ump_mem_handle);
- }
-
- ump_reference_release(ump_mem_handle);
- }
- else
- {
- AERR("gralloc_alloc_buffer() failed to allocate UMP memory. size:%d constraints: %d", size, constraints);
- }
- }
- }
-
- return -1;
- }
-#endif
-
-}
-
-#ifndef DISABLE_FRAMEBUFFER_HAL
-static int gralloc_alloc_framebuffer_locked(alloc_device_t *dev, size_t size, int usage, buffer_handle_t *pHandle)
-{
- private_module_t *m = reinterpret_cast<private_module_t *>(dev->common.module);
-
- // allocate the framebuffer
- if (m->framebuffer == NULL)
- {
- // initialize the framebuffer, the framebuffer is mapped once and forever.
- int err = init_frame_buffer_locked(m);
-
- if (err < 0)
- {
- return err;
- }
- }
-
- uint32_t bufferMask = m->bufferMask;
- const uint32_t numBuffers = m->numBuffers;
- const size_t bufferSize = m->finfo.line_length * m->info.yres;
-
- if (numBuffers == 1)
- {
- // If we have only one buffer, we never use page-flipping. Instead,
- // we return a regular buffer which will be memcpy'ed to the main
- // screen when post is called.
- int newUsage = (usage & ~GRALLOC_USAGE_HW_FB) | GRALLOC_USAGE_HW_2D;
- AERR("fallback to single buffering. Virtual Y-res too small %d", m->info.yres);
- return gralloc_alloc_buffer(dev, bufferSize, newUsage, pHandle);
- }
-
- if (bufferMask >= ((1LU << numBuffers) - 1))
- {
- // We ran out of buffers, reset bufferMask.
- bufferMask = 0;
- m->bufferMask = 0;
- }
-
- void *vaddr = m->framebuffer->base;
-
- // find a free slot
- for (uint32_t i = 0 ; i < numBuffers ; i++)
- {
- if ((bufferMask & (1LU << i)) == 0)
- {
- m->bufferMask |= (1LU << i);
- break;
- }
-
- vaddr = (void *)((uintptr_t)vaddr + bufferSize);
- }
-
- // The entire framebuffer memory is already mapped, now create a buffer object for parts of this memory
- private_handle_t *hnd = new private_handle_t(private_handle_t::PRIV_FLAGS_FRAMEBUFFER, usage, size, vaddr,
- 0, m->framebuffer->fd, (uintptr_t)vaddr - (uintptr_t) m->framebuffer->base, m->framebuffer->fb_paddr);
-
-#if GRALLOC_ARM_UMP_MODULE
- hnd->ump_id = m->framebuffer->ump_id;
-
- /* create a backing ump memory handle if the framebuffer is exposed as a secure ID */
- if ((int)UMP_INVALID_SECURE_ID != hnd->ump_id)
- {
- hnd->ump_mem_handle = (int)ump_handle_create_from_secure_id(hnd->ump_id);
-
- if ((int)UMP_INVALID_MEMORY_HANDLE == hnd->ump_mem_handle)
- {
- AINF("warning: unable to create UMP handle from secure ID %i\n", hnd->ump_id);
- }
- }
-
-#endif
-
-#if GRALLOC_ARM_DMA_BUF_MODULE
- {
-#ifdef FBIOGET_DMABUF
- /*
- * Perform allocator specific actions. If these fail we fall back to a regular buffer
- * which will be memcpy'ed to the main screen when fb_post is called.
- */
- if (fb_get_framebuffer_dmabuf(m, hnd) == -1)
- {
- int newUsage = (usage & ~GRALLOC_USAGE_HW_FB) | GRALLOC_USAGE_HW_2D;
-
- AINF("Fallback to single buffering. Unable to map framebuffer memory to handle:%p", hnd);
- return gralloc_alloc_buffer(dev, bufferSize, newUsage, pHandle);
- }
-#endif
- }
-
- // correct numFds/numInts when there is no dmabuf fd
- if (hnd->share_fd < 0)
- {
- hnd->numFds--;
- hnd->numInts++;
- }
-#endif
-
- *pHandle = hnd;
-
- return 0;
-}
-
-static int gralloc_alloc_framebuffer(alloc_device_t *dev, size_t size, int usage, buffer_handle_t *pHandle)
-{
- private_module_t *m = reinterpret_cast<private_module_t *>(dev->common.module);
- pthread_mutex_lock(&m->lock);
- int err = gralloc_alloc_framebuffer_locked(dev, size, usage, pHandle);
- pthread_mutex_unlock(&m->lock);
- return err;
-}
-#endif /* DISABLE_FRAMEBUFFER_HAL */
-
-static int alloc_device_alloc(alloc_device_t *dev, int w, int h, int format, int usage, buffer_handle_t *pHandle, int *pStride)
-{
- if (!pHandle || !pStride)
- {
- return -EINVAL;
- }
-
- size_t size;
- size_t stride;
- int bpp = 1;
-
- if (format == HAL_PIXEL_FORMAT_YCrCb_420_SP || format == HAL_PIXEL_FORMAT_YV12
- /* HAL_PIXEL_FORMAT_YCbCr_420_SP, HAL_PIXEL_FORMAT_YCbCr_420_P, HAL_PIXEL_FORMAT_YCbCr_422_I are not defined in Android.
- * To enable Mali DDK EGLImage support for those formats, firstly, you have to add them in Android system/core/include/system/graphics.h.
- * Then, define SUPPORT_LEGACY_FORMAT in the same header file(Mali DDK will also check this definition).
- */
-#ifdef SUPPORT_LEGACY_FORMAT
- || format == HAL_PIXEL_FORMAT_YCbCr_420_SP || format == HAL_PIXEL_FORMAT_YCbCr_420_P || format == HAL_PIXEL_FORMAT_YCbCr_422_I
-#endif
- )
- {
- switch (format)
- {
- case HAL_PIXEL_FORMAT_YCrCb_420_SP:
- stride = GRALLOC_ALIGN(w, 16);
- size = GRALLOC_ALIGN(h, 16) * (stride + GRALLOC_ALIGN(stride / 2, 16));
- break;
-
- case HAL_PIXEL_FORMAT_YV12:
-#ifdef SUPPORT_LEGACY_FORMAT
- case HAL_PIXEL_FORMAT_YCbCr_420_P:
-#endif
- /*
- * Since Utgard has limitation that "64-byte alignment is enforced on texture and mipmap addresses", here to make sure
- * the v, u plane start addresses are 64-byte aligned.
- */
- stride = GRALLOC_ALIGN(w, (h % 8 == 0) ? GRALLOC_ALIGN_BASE_16 :
- ((h % 4 == 0) ? GRALLOC_ALIGN_BASE_64 : GRALLOC_ALIGN_BASE_128));
- size = GRALLOC_ALIGN(h, 2) * (stride + GRALLOC_ALIGN(stride / 2, 16));
-
- break;
-#ifdef SUPPORT_LEGACY_FORMAT
-
- case HAL_PIXEL_FORMAT_YCbCr_420_SP:
- stride = GRALLOC_ALIGN(w, 16);
- size = GRALLOC_ALIGN(h, 16) * (stride + GRALLOC_ALIGN(stride / 2, 16));
- break;
-
- case HAL_PIXEL_FORMAT_YCbCr_422_I:
- stride = GRALLOC_ALIGN(w, 16);
- size = h * stride * 2;
-
- break;
-#endif
-
- default:
- return -EINVAL;
- }
- }
- else
- {
-
- switch (format)
- {
- case HAL_PIXEL_FORMAT_RGBA_8888:
- case HAL_PIXEL_FORMAT_RGBX_8888:
- case HAL_PIXEL_FORMAT_BGRA_8888:
- bpp = 4;
- break;
-
- case HAL_PIXEL_FORMAT_RGB_888:
- bpp = 3;
- break;
-
- case HAL_PIXEL_FORMAT_RGB_565:
-#if PLATFORM_SDK_VERSION < 19
- case HAL_PIXEL_FORMAT_RGBA_5551:
- case HAL_PIXEL_FORMAT_RGBA_4444:
-#endif
- bpp = 2;
- break;
-
- case HAL_PIXEL_FORMAT_BLOB:
- if (h != 1) {
- AERR("Height for HAL_PIXEL_FORMAT_BLOB must be 1. h=%d", h);
- return -EINVAL;
- }
- break;
-
- default:
- AERR("The format is not supported yet: format=%d\n", format);
- return -EINVAL;
- }
-
- if (format == HAL_PIXEL_FORMAT_BLOB) {
- stride = 0; /* No 'rows', it's effectively a long one dimensional array */
- size = w;
- }else{
- size_t bpr = GRALLOC_ALIGN(w * bpp, 64);
- size = bpr * h;
- stride = bpr / bpp;
- }
- }
-
- int err;
-
-#ifndef DISABLE_FRAMEBUFFER_HAL
-
- if (usage & GRALLOC_USAGE_HW_FB)
- {
- err = gralloc_alloc_framebuffer(dev, size, usage, pHandle);
- }
- else
-#endif
-
- {
- err = gralloc_alloc_buffer(dev, size, usage, pHandle);
- }
-
- if (err < 0)
- {
- return err;
- }
-
- /* match the framebuffer format */
- if (usage & GRALLOC_USAGE_HW_FB)
- {
-#ifdef GRALLOC_16_BITS
- format = HAL_PIXEL_FORMAT_RGB_565;
-#else
- format = HAL_PIXEL_FORMAT_BGRA_8888;
-#endif
- }
-
- private_handle_t *hnd = (private_handle_t *)*pHandle;
- int private_usage = usage & (GRALLOC_USAGE_PRIVATE_0 |
- GRALLOC_USAGE_PRIVATE_1);
-
- switch (private_usage)
- {
- case 0:
- hnd->yuv_info = MALI_YUV_BT601_NARROW;
- break;
-
- case GRALLOC_USAGE_PRIVATE_1:
- hnd->yuv_info = MALI_YUV_BT601_WIDE;
- break;
-
- case GRALLOC_USAGE_PRIVATE_0:
- hnd->yuv_info = MALI_YUV_BT709_NARROW;
- break;
-
- case (GRALLOC_USAGE_PRIVATE_0 | GRALLOC_USAGE_PRIVATE_1):
- hnd->yuv_info = MALI_YUV_BT709_WIDE;
- break;
- }
-
- hnd->width = w;
- hnd->height = h;
- hnd->format = format;
- hnd->stride = stride;
- hnd->byte_stride = GRALLOC_ALIGN(w*bpp,64);
- *pStride = stride;
- return 0;
-}
-
-static int alloc_device_free(alloc_device_t __unused *dev, buffer_handle_t handle)
-{
- if (private_handle_t::validate(handle) < 0)
- {
- return -EINVAL;
- }
-
- private_handle_t const *hnd = reinterpret_cast<private_handle_t const *>(handle);
-
- if (hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER)
- {
-#if GRALLOC_ARM_UMP_MODULE
-
- if ((int)UMP_INVALID_MEMORY_HANDLE != hnd->ump_mem_handle)
- {
- ump_reference_release((ump_handle)hnd->ump_mem_handle);
- }
-
-#endif
- }
- else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_UMP)
- {
-#if GRALLOC_ARM_UMP_MODULE
-
- /* Buffer might be unregistered so we need to check for invalid ump handle*/
- if ((int)UMP_INVALID_MEMORY_HANDLE != hnd->ump_mem_handle)
- {
- ump_mapped_pointer_release((ump_handle)hnd->ump_mem_handle);
- ump_reference_release((ump_handle)hnd->ump_mem_handle);
- }
-
-#else
- AERR("Can't free ump memory for handle:%p. Not supported.", hnd);
-#endif
- }
- else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION)
- {
-#if GRALLOC_ARM_DMA_BUF_MODULE
- /* Buffer might be unregistered so we need to check for invalid ump handle*/
- if (0 != hnd->base)
- {
- if (0 != munmap((void *)hnd->base, hnd->size))
- {
- AERR("Failed to munmap handle %p", hnd);
- }
- }
-
- close(hnd->share_fd);
-
- memset((void *)hnd, 0, sizeof(*hnd));
-#else
- AERR("Can't free dma_buf memory for handle:0x%x. Not supported.", (unsigned int)hnd);
-#endif
-
- }
-
- delete hnd;
-
- return 0;
-}
-
-static int alloc_device_close(struct hw_device_t *device)
-{
- alloc_device_t *dev = reinterpret_cast<alloc_device_t *>(device);
-
- if (dev)
- {
-#if GRALLOC_ARM_DMA_BUF_MODULE
- private_module_t *m = reinterpret_cast<private_module_t *>(device);
-
- if (0 != ion_close(m->ion_client))
- {
- AERR("Failed to close ion_client: %d", m->ion_client);
- }
-
- close(m->ion_client);
-#endif
- delete dev;
-#if GRALLOC_ARM_UMP_MODULE
- ump_close(); // Our UMP memory refs will be released automatically here...
-#endif
- }
-
- return 0;
-}
-
-#if GRALLOC_ARM_DMA_BUF_MODULE
-static int find_heap_id(int ion_client, char* name)
-{
- int i, ret, cnt, heap_id = -1;
- struct ion_heap_data *data;
-
- ret = ion_query_heap_cnt(ion_client, &cnt);
-
- if (ret)
- {
- AERR("ion count query failed with %s", strerror(errno));
- return -1;
- }
-
- data = (struct ion_heap_data *)malloc(cnt * sizeof(*data));
- if (!data)
- {
- AERR("Error allocating data %s\n", strerror(errno));
- return -1;
- }
-
- ret = ion_query_get_heaps(ion_client, cnt, data);
- if (ret)
- {
- AERR("Error querying heaps from ion %s", strerror(errno));
- }
- else
- {
- for (i = 0; i < cnt; i++) {
- struct ion_heap_data *dat = (struct ion_heap_data *)data;
- if (strcmp(dat[i].name, name) == 0) {
- heap_id = dat[i].heap_id;
- break;
- }
- }
-
- if (i > cnt)
- {
- AERR("No System Heap Found amongst %d heaps\n", cnt);
- heap_id = -1;
- }
- }
-
- free(data);
- return heap_id;
-}
-#endif
-
-static int initialize_interface(private_module_t *m)
-{
- int fd;
-
- if (interface_ver != INTERFACE_UNKNOWN)
- return 0;
-
- /* test for dma-heaps*/
- fd = dma_heap_open(DMABUF_SYSTEM);
- if (fd >= 0) {
- AINF("Using DMA-BUF Heaps.\n");
- interface_ver = INTERFACE_DMABUF_HEAPS;
- system_heap_id = fd;
- cma_heap_id = dma_heap_open(DMABUF_CMA);
- /* Open other dma heaps here */
- return 0;
- }
-
- /* test for modern vs legacy ION */
- m->ion_client = ion_open();
- if (m->ion_client < 0) {
- AERR("ion_open failed with %s", strerror(errno));
- return -1;
- }
- if (!ion_is_legacy(m->ion_client)) {
- system_heap_id = find_heap_id(m->ion_client, ION_SYSTEM);
- cma_heap_id = find_heap_id(m->ion_client, ION_CMA);
- if (system_heap_id < 0) {
- ion_close(m->ion_client);
- m->ion_client = -1;
- AERR( "ion_open failed: no system heap found" );
- return -1;
- }
- if (cma_heap_id < 0) {
- AERR("No cma heap found, falling back to system");
- cma_heap_id = system_heap_id;
- }
- AINF("Using ION Modern interface.\n");
- interface_ver = INTERFACE_ION_MODERN;
- } else {
- AINF("Using ION Legacy interface.\n");
- interface_ver = INTERFACE_ION_LEGACY;
- }
- return 0;
-}
-
-int alloc_device_open(hw_module_t const *module, const char *name, hw_device_t **device)
-{
- MALI_IGNORE(name);
- alloc_device_t *dev;
-
- dev = new alloc_device_t;
-
- if (NULL == dev)
- {
- return -1;
- }
-
-#if GRALLOC_ARM_UMP_MODULE
- ump_result ump_res = ump_open();
-
- if (UMP_OK != ump_res)
- {
- AERR("UMP open failed with %d", ump_res);
- delete dev;
- return -1;
- }
-
-#endif
-
- /* initialize our state here */
- memset(dev, 0, sizeof(*dev));
-
- /* initialize the procs */
- dev->common.tag = HARDWARE_DEVICE_TAG;
- dev->common.version = 0;
- dev->common.module = const_cast<hw_module_t *>(module);
- dev->common.close = alloc_device_close;
- dev->alloc = alloc_device_alloc;
- dev->free = alloc_device_free;
-
-#if GRALLOC_ARM_DMA_BUF_MODULE
- private_module_t *m = reinterpret_cast<private_module_t *>(dev->common.module);
-
- if (initialize_interface(m) < 0) {
- delete dev;
- return -1;
- }
-#endif
-
- *device = &dev->common;
-
- return 0;
-}
diff --git a/gralloc/alloc_device.h b/gralloc/alloc_device.h
deleted file mode 100644
index 563c27c..0000000
--- a/gralloc/alloc_device.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2010 ARM Limited. All rights reserved.
- *
- * Copyright (C) 2008 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.
- */
-
-#include <hardware/hardware.h>
-
-#ifndef AWAR
-#define AWAR(fmt, args...) __android_log_print(ANDROID_LOG_WARN, "[Gralloc-Warning]", "%s:%d " fmt,__func__,__LINE__,##args)
-#endif
-#ifndef AINF
-#define AINF(fmt, args...) __android_log_print(ANDROID_LOG_INFO, "[Gralloc]", fmt,##args)
-#endif
-#ifndef AERR
-#define AERR(fmt, args...) __android_log_print(ANDROID_LOG_ERROR, "[Gralloc-ERROR]", "%s:%d " fmt,__func__,__LINE__,##args)
-#endif
-#ifndef AERR_IF
-#define AERR_IF( eq, fmt, args...) if ( (eq) ) AERR( fmt, args )
-#endif
-
-#define GRALLOC_ALIGN( value, base ) (((value) + ((base) - 1)) & ~((base) - 1))
-
-#define GRALLOC_ALIGN_BASE_16 16
-#define GRALLOC_ALIGN_BASE_64 64
-#define GRALLOC_ALIGN_BASE_128 128
-
-// Create an alloc device
-int alloc_device_open(hw_module_t const *module, const char *name, hw_device_t **device);
diff --git a/gralloc/dma-heap.h b/gralloc/dma-heap.h
deleted file mode 100644
index 6f84fa0..0000000
--- a/gralloc/dma-heap.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-/*
- * DMABUF Heaps Userspace API
- *
- * Copyright (C) 2011 Google, Inc.
- * Copyright (C) 2019 Linaro Ltd.
- */
-#ifndef _UAPI_LINUX_DMABUF_POOL_H
-#define _UAPI_LINUX_DMABUF_POOL_H
-
-#include <linux/ioctl.h>
-#include <linux/types.h>
-
-/**
- * DOC: DMABUF Heaps Userspace API
- */
-
-/* Valid FD_FLAGS are O_CLOEXEC, O_RDONLY, O_WRONLY, O_RDWR */
-#define DMA_HEAP_VALID_FD_FLAGS (O_CLOEXEC | O_ACCMODE)
-
-/* Currently no heap flags */
-#define DMA_HEAP_VALID_HEAP_FLAGS (0)
-
-/**
- * struct dma_heap_allocation_data - metadata passed from userspace for
- * allocations
- * @len: size of the allocation
- * @fd: will be populated with a fd which provides the
- * handle to the allocated dma-buf
- * @fd_flags: file descriptor flags used when allocating
- * @heap_flags: flags passed to heap
- *
- * Provided by userspace as an argument to the ioctl
- */
-struct dma_heap_allocation_data {
- __u64 len;
- __u32 fd;
- __u32 fd_flags;
- __u64 heap_flags;
-};
-
-#define DMA_HEAP_IOC_MAGIC 'H'
-
-/**
- * DOC: DMA_HEAP_IOCTL_ALLOC - allocate memory from pool
- *
- * Takes a dma_heap_allocation_data struct and returns it with the fd field
- * populated with the dmabuf handle of the allocation.
- */
-#define DMA_HEAP_IOCTL_ALLOC _IOWR(DMA_HEAP_IOC_MAGIC, 0x0,\
- struct dma_heap_allocation_data)
-
-#endif /* _UAPI_LINUX_DMABUF_POOL_H */
diff --git a/gralloc/framebuffer_device.cpp b/gralloc/framebuffer_device.cpp
deleted file mode 100644
index 6ab88a5..0000000
--- a/gralloc/framebuffer_device.cpp
+++ /dev/null
@@ -1,508 +0,0 @@
-/*
- * Copyright (C) 2010 ARM Limited. All rights reserved.
- *
- * Copyright (C) 2008 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.
- */
-
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <linux/fb.h>
-#include <stdlib.h>
-
-#include <cutils/log.h>
-#include <cutils/atomic.h>
-#include <hardware/hardware.h>
-#include <hardware/gralloc.h>
-
-#include <GLES/gl.h>
-
-#ifdef MALI_VSYNC_EVENT_REPORT_ENABLE
-#include "gralloc_vsync_report.h"
-#endif
-
-#include "alloc_device.h"
-#include "gralloc_priv.h"
-#include "gralloc_helper.h"
-
-// numbers of buffers for page flipping
-#define NUM_BUFFERS NUM_FB_BUFFERS
-
-static int swapInterval = 1;
-
-enum
-{
- PAGE_FLIP = 0x00000001,
-};
-
-
-static int fb_set_swap_interval(struct framebuffer_device_t *dev, int interval)
-{
- if (interval < dev->minSwapInterval)
- {
- interval = dev->minSwapInterval;
- }
- else if (interval > dev->maxSwapInterval)
- {
- interval = dev->maxSwapInterval;
- }
-
- swapInterval = interval;
-
- return 0;
-}
-
-static int fb_post(struct framebuffer_device_t *dev, buffer_handle_t buffer)
-{
- if (private_handle_t::validate(buffer) < 0)
- {
- return -EINVAL;
- }
-
- private_handle_t const *hnd = reinterpret_cast<private_handle_t const *>(buffer);
- private_module_t *m = reinterpret_cast<private_module_t *>(dev->common.module);
-
- if (m->currentBuffer)
- {
- m->base.unlock(&m->base, m->currentBuffer);
- m->currentBuffer = 0;
- }
-
- if (hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER)
- {
- m->base.lock(&m->base, buffer, private_module_t::PRIV_USAGE_LOCKED_FOR_POST,
- 0, 0, m->info.xres, m->info.yres, NULL);
-
- int interrupt;
- m->info.activate = FB_ACTIVATE_VBL;
- m->info.yoffset = hnd->offset / m->finfo.line_length;
-
-#ifdef STANDARD_LINUX_SCREEN
-#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
-#define S3CFB_SET_VSYNC_INT _IOW('F', 206, unsigned int)
-
- if (ioctl(m->framebuffer->fd, FBIOPAN_DISPLAY, &m->info) == -1)
- {
- AERR("FBIOPAN_DISPLAY failed for fd: %d", m->framebuffer->fd);
- m->base.unlock(&m->base, buffer);
- return 0;
- }
-
- if (swapInterval == 1)
- {
- // enable VSYNC
- interrupt = 1;
-
- if (ioctl(m->framebuffer->fd, S3CFB_SET_VSYNC_INT, &interrupt) < 0)
- {
- // AERR("S3CFB_SET_VSYNC_INT enable failed for fd: %d", m->framebuffer->fd);
- return 0;
- }
-
- // wait for VSYNC
-#ifdef MALI_VSYNC_EVENT_REPORT_ENABLE
- gralloc_mali_vsync_report(MALI_VSYNC_EVENT_BEGIN_WAIT);
-#endif
- int crtc = 0;
-
- if (ioctl(m->framebuffer->fd, FBIO_WAITFORVSYNC, &crtc) < 0)
- {
- AERR("FBIO_WAITFORVSYNC failed for fd: %d", m->framebuffer->fd);
-#ifdef MALI_VSYNC_EVENT_REPORT_ENABLE
- gralloc_mali_vsync_report(MALI_VSYNC_EVENT_END_WAIT);
-#endif
- return 0;
- }
-
-#ifdef MALI_VSYNC_EVENT_REPORT_ENABLE
- gralloc_mali_vsync_report(MALI_VSYNC_EVENT_END_WAIT);
-#endif
- // disable VSYNC
- interrupt = 0;
-
- if (ioctl(m->framebuffer->fd, S3CFB_SET_VSYNC_INT, &interrupt) < 0)
- {
- AERR("S3CFB_SET_VSYNC_INT disable failed for fd: %d", m->framebuffer->fd);
- return 0;
- }
- }
-
-#else
- /*Standard Android way*/
-#ifdef MALI_VSYNC_EVENT_REPORT_ENABLE
- gralloc_mali_vsync_report(MALI_VSYNC_EVENT_BEGIN_WAIT);
-#endif
-
- if (ioctl(m->framebuffer->fd, FBIOPUT_VSCREENINFO, &m->info) == -1)
- {
- AERR("FBIOPUT_VSCREENINFO failed for fd: %d", m->framebuffer->fd);
-#ifdef MALI_VSYNC_EVENT_REPORT_ENABLE
- gralloc_mali_vsync_report(MALI_VSYNC_EVENT_END_WAIT);
-#endif
- m->base.unlock(&m->base, buffer);
- return -errno;
- }
-
-#ifdef MALI_VSYNC_EVENT_REPORT_ENABLE
- gralloc_mali_vsync_report(MALI_VSYNC_EVENT_END_WAIT);
-#endif
-#endif
-
- m->currentBuffer = buffer;
- }
- else
- {
- void *fb_vaddr;
- void *buffer_vaddr;
-
- m->base.lock(&m->base, m->framebuffer, GRALLOC_USAGE_SW_WRITE_RARELY,
- 0, 0, m->info.xres, m->info.yres, &fb_vaddr);
-
- m->base.lock(&m->base, buffer, GRALLOC_USAGE_SW_READ_RARELY,
- 0, 0, m->info.xres, m->info.yres, &buffer_vaddr);
-
- memcpy(fb_vaddr, buffer_vaddr, m->finfo.line_length * m->info.yres);
-
- m->base.unlock(&m->base, buffer);
- m->base.unlock(&m->base, m->framebuffer);
- }
-
- return 0;
-}
-
-int init_frame_buffer_locked(struct private_module_t *module)
-{
- if (module->framebuffer)
- {
- return 0; // Nothing to do, already initialized
- }
-
- char const *const device_template[] =
- {
- "/dev/graphics/fb%u",
- "/dev/fb%u",
- NULL
- };
-
- int fd = -1;
- int i = 0;
- char name[64];
-
- while ((fd == -1) && device_template[i])
- {
- snprintf(name, 64, device_template[i], 0);
- fd = open(name, O_RDWR, 0);
- i++;
- }
-
- if (fd < 0)
- {
- return -errno;
- }
-
- struct fb_fix_screeninfo finfo;
-
- if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo) == -1)
- {
- return -errno;
- }
-
- struct fb_var_screeninfo info;
-
- if (ioctl(fd, FBIOGET_VSCREENINFO, &info) == -1)
- {
- return -errno;
- }
-
- info.reserved[0] = 0;
- info.reserved[1] = 0;
- info.reserved[2] = 0;
- info.xoffset = 0;
- info.yoffset = 0;
- info.activate = FB_ACTIVATE_NOW;
-
-#ifdef GRALLOC_16_BITS
- /*
- * Explicitly request 5/6/5
- */
- info.bits_per_pixel = 16;
- info.red.offset = 11;
- info.red.length = 5;
- info.green.offset = 5;
- info.green.length = 6;
- info.blue.offset = 0;
- info.blue.length = 5;
- info.transp.offset = 0;
- info.transp.length = 0;
-#else
- /*
- * Explicitly request 8/8/8
- */
- info.bits_per_pixel = 32;
- info.red.offset = 16;
- info.red.length = 8;
- info.green.offset = 8;
- info.green.length = 8;
- info.blue.offset = 0;
- info.blue.length = 8;
- info.transp.offset = 0;
- info.transp.length = 0;
-#endif
-
- /*
- * Request NUM_BUFFERS screens (at lest 2 for page flipping)
- */
- info.yres_virtual = info.yres * NUM_BUFFERS;
-
- uint32_t flags = PAGE_FLIP;
-
- if (ioctl(fd, FBIOPUT_VSCREENINFO, &info) == -1)
- {
- info.yres_virtual = info.yres;
- flags &= ~PAGE_FLIP;
- AWAR("FBIOPUT_VSCREENINFO failed, page flipping not supported fd: %d", fd);
- }
-
- if (info.yres_virtual < info.yres * 2)
- {
- // we need at least 2 for page-flipping
- info.yres_virtual = info.yres;
- flags &= ~PAGE_FLIP;
- AWAR("page flipping not supported (yres_virtual=%d, requested=%d)", info.yres_virtual, info.yres * 2);
- }
-
- if (ioctl(fd, FBIOGET_VSCREENINFO, &info) == -1)
- {
- return -errno;
- }
-
- int refreshRate = 0;
-
- if (info.pixclock > 0)
- {
- refreshRate = 1000000000000000LLU /
- (
- uint64_t(info.upper_margin + info.lower_margin + info.yres + info.hsync_len)
- * (info.left_margin + info.right_margin + info.xres + info.vsync_len)
- * info.pixclock
- );
- }
- else
- {
- AWAR("fbdev pixclock is zero for fd: %d", fd);
- }
-
- if (refreshRate == 0)
- {
- refreshRate = 60 * 1000; // 60 Hz
- }
-
- if (int(info.width) <= 0 || int(info.height) <= 0)
- {
- // the driver doesn't return that information
- // default to 160 dpi
- info.width = ((info.xres * 25.4f) / 160.0f + 0.5f);
- info.height = ((info.yres * 25.4f) / 160.0f + 0.5f);
- }
-
- float xdpi = (info.xres * 25.4f) / info.width;
- float ydpi = (info.yres * 25.4f) / info.height;
- float fps = refreshRate / 1000.0f;
-
- AINF("using (fd=%d)\n"
- "id = %s\n"
- "xres = %d px\n"
- "yres = %d px\n"
- "xres_virtual = %d px\n"
- "yres_virtual = %d px\n"
- "bpp = %d\n"
- "r = %2u:%u\n"
- "g = %2u:%u\n"
- "b = %2u:%u\n",
- fd,
- finfo.id,
- info.xres,
- info.yres,
- info.xres_virtual,
- info.yres_virtual,
- info.bits_per_pixel,
- info.red.offset, info.red.length,
- info.green.offset, info.green.length,
- info.blue.offset, info.blue.length);
-
- AINF("width = %d mm (%f dpi)\n"
- "height = %d mm (%f dpi)\n"
- "refresh rate = %.2f Hz\n",
- info.width, xdpi,
- info.height, ydpi,
- fps);
-
- if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo) == -1)
- {
- return -errno;
- }
-
- if (finfo.smem_len <= 0)
- {
- return -errno;
- }
-
- module->flags = flags;
- module->info = info;
- module->finfo = finfo;
- module->xdpi = xdpi;
- module->ydpi = ydpi;
- module->fps = fps;
-
- /*
- * map the framebuffer
- */
- size_t fbSize = round_up_to_page_size(finfo.line_length * info.yres_virtual);
- void *vaddr = mmap(0, fbSize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
-
- if (vaddr == MAP_FAILED)
- {
- AERR("Error mapping the framebuffer (%s)", strerror(errno));
- return -errno;
- }
-
- memset(vaddr, 0, fbSize);
-
- // Create a "fake" buffer object for the entire frame buffer memory, and store it in the module
- module->framebuffer = new private_handle_t(private_handle_t::PRIV_FLAGS_FRAMEBUFFER, 0, fbSize, vaddr,
- 0, fd, 0, (void *)finfo.smem_start);
-
- /* There is no share_fd in framebuffer handle, correct numFds/numInts */
- module->framebuffer->numFds--;
- module->framebuffer->numInts++;
-
- module->numBuffers = info.yres_virtual / info.yres;
- module->bufferMask = 0;
-
-#if GRALLOC_ARM_UMP_MODULE
-#ifdef IOCTL_GET_FB_UMP_SECURE_ID
- ioctl(fd, IOCTL_GET_FB_UMP_SECURE_ID, &module->framebuffer->ump_id);
-#endif
-
- if ((int)UMP_INVALID_SECURE_ID != module->framebuffer->ump_id)
- {
- AINF("framebuffer accessed with UMP secure ID %i\n", module->framebuffer->ump_id);
- }
-
-#endif
-
- return 0;
-}
-
-static int init_frame_buffer(struct private_module_t *module)
-{
- pthread_mutex_lock(&module->lock);
- int err = init_frame_buffer_locked(module);
- pthread_mutex_unlock(&module->lock);
- return err;
-}
-
-static int fb_close(struct hw_device_t *device)
-{
- framebuffer_device_t *dev = reinterpret_cast<framebuffer_device_t *>(device);
-
- if (dev)
- {
-#if GRALLOC_ARM_UMP_MODULE
- ump_close();
-#endif
- free(dev);
- }
-
- return 0;
-}
-
-int compositionComplete(struct framebuffer_device_t *dev)
-{
- MALI_IGNORE(dev);
- /* By doing a finish here we force the GL driver to start rendering
- all the drawcalls up to this point, and to wait for the rendering to be complete.*/
- glFinish();
- /* The rendering of the backbuffer is now completed.
- When SurfaceFlinger later does a call to eglSwapBuffer(), the swap will be done
- synchronously in the same thread, and not asynchronoulsy in a background thread later.
- The SurfaceFlinger requires this behaviour since it releases the lock on all the
- SourceBuffers (Layers) after the compositionComplete() function returns.
- However this "bad" behaviour by SurfaceFlinger should not affect performance,
- since the Applications that render the SourceBuffers (Layers) still get the
- full renderpipeline using asynchronous rendering. So they perform at maximum speed,
- and because of their complexity compared to the Surface flinger jobs, the Surface flinger
- is normally faster even if it does everyhing synchronous and serial.
- */
- return 0;
-}
-
-int framebuffer_device_open(hw_module_t const *module, const char *name, hw_device_t **device)
-{
- int status = -EINVAL;
-
- alloc_device_t *gralloc_device;
- status = gralloc_open(module, &gralloc_device);
-
- if (status < 0)
- {
- return status;
- }
-
- private_module_t *m = (private_module_t *)module;
- status = init_frame_buffer(m);
-
- if (status < 0)
- {
- gralloc_close(gralloc_device);
- return status;
- }
-
- /* initialize our state here */
- framebuffer_device_t *dev = (framebuffer_device_t *)malloc(sizeof(framebuffer_device_t));
- memset(dev, 0, sizeof(*dev));
-
- /* initialize the procs */
- dev->common.tag = HARDWARE_DEVICE_TAG;
- dev->common.version = 0;
- dev->common.module = const_cast<hw_module_t *>(module);
- dev->common.close = fb_close;
- dev->setSwapInterval = fb_set_swap_interval;
- dev->post = fb_post;
- dev->setUpdateRect = 0;
- dev->compositionComplete = &compositionComplete;
-
- int stride = m->finfo.line_length / (m->info.bits_per_pixel >> 3);
- const_cast<uint32_t &>(dev->flags) = 0;
- const_cast<uint32_t &>(dev->width) = m->info.xres;
- const_cast<uint32_t &>(dev->height) = m->info.yres;
- const_cast<int &>(dev->stride) = stride;
-#ifdef GRALLOC_16_BITS
- const_cast<int &>(dev->format) = HAL_PIXEL_FORMAT_RGB_565;
-#else
- const_cast<int &>(dev->format) = HAL_PIXEL_FORMAT_BGRA_8888;
-#endif
- const_cast<float &>(dev->xdpi) = m->xdpi;
- const_cast<float &>(dev->ydpi) = m->ydpi;
- const_cast<float &>(dev->fps) = m->fps;
- const_cast<int &>(dev->minSwapInterval) = 0;
- const_cast<int &>(dev->maxSwapInterval) = 1;
- *device = &dev->common;
- status = 0;
-
- MALI_IGNORE(name);
- return status;
-}
diff --git a/gralloc/framebuffer_device.h b/gralloc/framebuffer_device.h
deleted file mode 100644
index 528e65c..0000000
--- a/gralloc/framebuffer_device.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2010 ARM Limited. All rights reserved.
- *
- * Copyright (C) 2008 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.
- */
-
-#include <hardware/hardware.h>
-
-// Create a framebuffer device
-int framebuffer_device_open(hw_module_t const *module, const char *name, hw_device_t **device);
-
-// Initialize the framebuffer (must keep module lock before calling
-int init_frame_buffer_locked(struct private_module_t *module);
diff --git a/gralloc/gralloc_helper.h b/gralloc/gralloc_helper.h
deleted file mode 100644
index c8378f8..0000000
--- a/gralloc/gralloc_helper.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2010 ARM Limited. All rights reserved.
- *
- * Copyright (C) 2008 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.
- */
-
-#ifndef GRALLOC_HELPER_H_
-#define GRALLOC_HELPER_H_
-
-#include <sys/mman.h>
-
-inline size_t round_up_to_page_size(size_t x)
-{
- return (x + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
-}
-
-#endif /* GRALLOC_HELPER_H_ */
diff --git a/gralloc/gralloc_module.cpp b/gralloc/gralloc_module.cpp
deleted file mode 100644
index 6905478..0000000
--- a/gralloc/gralloc_module.cpp
+++ /dev/null
@@ -1,561 +0,0 @@
-/*
- * Copyright (C) 2010 ARM Limited. All rights reserved.
- *
- * Copyright (C) 2008 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.
- */
-
-#include <errno.h>
-#include <pthread.h>
-#include <string.h>
-//#include <sync/sync.h>
-#include <android/sync.h>
-
-#include <cutils/log.h>
-#include <cutils/atomic.h>
-#include <hardware/hardware.h>
-#include <hardware/gralloc.h>
-
-#include "gralloc_priv.h"
-#include "alloc_device.h"
-#include "framebuffer_device.h"
-
-#if GRALLOC_ARM_UMP_MODULE
-#include <ump/ump_ref_drv.h>
-static int s_ump_is_open = 0;
-#endif
-
-#if GRALLOC_ARM_DMA_BUF_MODULE
-#include <ion/ion.h>
-#include <sys/mman.h>
-#endif
-
-static pthread_mutex_t s_map_lock = PTHREAD_MUTEX_INITIALIZER;
-
-static int gralloc_device_open(const hw_module_t *module, const char *name, hw_device_t **device)
-{
- int status = -EINVAL;
-
- if (!strncmp(name, GRALLOC_HARDWARE_GPU0, MALI_GRALLOC_HARDWARE_MAX_STR_LEN))
- {
- status = alloc_device_open(module, name, device);
- }
- else if (!strncmp(name, GRALLOC_HARDWARE_FB0, MALI_GRALLOC_HARDWARE_MAX_STR_LEN))
- {
- status = framebuffer_device_open(module, name, device);
- }
-
- return status;
-}
-
-static int gralloc_register_buffer(gralloc_module_t const *module, buffer_handle_t handle)
-{
- MALI_IGNORE(module);
-
- if (private_handle_t::validate(handle) < 0)
- {
- AERR("Registering invalid buffer %p, returning error", handle);
- return -EINVAL;
- }
-
- // if this handle was created in this process, then we keep it as is.
- private_handle_t *hnd = (private_handle_t *)handle;
-
- int retval = -EINVAL;
-
- pthread_mutex_lock(&s_map_lock);
-
-#if GRALLOC_ARM_UMP_MODULE
-
- if (!s_ump_is_open)
- {
- ump_result res = ump_open(); // MJOLL-4012: UMP implementation needs a ump_close() for each ump_open
-
- if (res != UMP_OK)
- {
- pthread_mutex_unlock(&s_map_lock);
- AERR("Failed to open UMP library with res=%d", res);
- return retval;
- }
-
- s_ump_is_open = 1;
- }
-
-#endif
-
- hnd->pid = getpid();
-
- if (hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER)
- {
- AINF("Register buffer %p although it will be treated as a nop", handle);
- retval = 0;
- }
- else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_UMP)
- {
-#if GRALLOC_ARM_UMP_MODULE
- hnd->ump_mem_handle = (int)ump_handle_create_from_secure_id(hnd->ump_id);
-
- if (UMP_INVALID_MEMORY_HANDLE != (ump_handle)hnd->ump_mem_handle)
- {
- hnd->base = ump_mapped_pointer_get((ump_handle)hnd->ump_mem_handle);
-
- if (0 != hnd->base)
- {
- hnd->writeOwner = 0;
- hnd->lockState &= ~(private_handle_t::LOCK_STATE_UNREGISTERED);
-
- pthread_mutex_unlock(&s_map_lock);
- return 0;
- }
- else
- {
- AERR("Failed to map UMP handle 0x%x", hnd->ump_mem_handle);
- }
-
- ump_reference_release((ump_handle)hnd->ump_mem_handle);
- }
- else
- {
- AERR("Failed to create UMP handle 0x%x", hnd->ump_mem_handle);
- }
-
-#else
- AERR("Gralloc does not support UMP. Unable to register UMP memory for handle %p", hnd);
-#endif
- }
- else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION)
- {
-#if GRALLOC_ARM_DMA_BUF_MODULE
- unsigned char *mappedAddress;
- size_t size = hnd->size;
- hw_module_t *pmodule = NULL;
- private_module_t *m = NULL;
-
- if (hw_get_module(GRALLOC_HARDWARE_MODULE_ID, (const hw_module_t **)&pmodule) == 0)
- {
- m = reinterpret_cast<private_module_t *>(pmodule);
- }
- else
- {
- AERR("Could not get gralloc module for handle: %p", hnd);
- retval = -errno;
- goto cleanup;
- }
-
- /* the test condition is set to m->ion_client <= 0 here, because:
- * 1) module structure are initialized to 0 if no initial value is applied
- * 2) a second user process should get a ion fd greater than 0.
- */
- if (m->ion_client <= 0)
- {
- /* a second user process must obtain a client handle first via ion_open before it can obtain the shared ion buffer*/
- m->ion_client = ion_open();
-
- if (m->ion_client < 0)
- {
- AERR("Could not open ion device for handle: %p", hnd);
- retval = -errno;
- goto cleanup;
- }
- }
-
- mappedAddress = (unsigned char *)mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, hnd->share_fd, 0);
-
- if (MAP_FAILED == mappedAddress)
- {
- AERR("mmap( share_fd:%d ) failed with %s", hnd->share_fd, strerror(errno));
- retval = -errno;
- goto cleanup;
- }
-
- hnd->base = mappedAddress + hnd->offset;
- hnd->lockState &= ~(private_handle_t::LOCK_STATE_UNREGISTERED);
-
- pthread_mutex_unlock(&s_map_lock);
- return 0;
-#endif
- }
- else
- {
- AERR("registering non-UMP buffer not supported. flags = %d", hnd->flags);
- }
-
-#if GRALLOC_ARM_DMA_BUF_MODULE
-cleanup:
-#endif
- pthread_mutex_unlock(&s_map_lock);
- return retval;
-}
-
-static void unmap_buffer(private_handle_t *hnd)
-{
- if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_UMP)
- {
-#if GRALLOC_ARM_UMP_MODULE
- ump_mapped_pointer_release((ump_handle)hnd->ump_mem_handle);
- ump_reference_release((ump_handle)hnd->ump_mem_handle);
- hnd->ump_mem_handle = (int)UMP_INVALID_MEMORY_HANDLE;
-#else
- AERR("Can't unregister UMP buffer for handle %p. Not supported", hnd);
-#endif
- }
- else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION)
- {
-#if GRALLOC_ARM_DMA_BUF_MODULE
- void *base = (void *)hnd->base;
- size_t size = hnd->size;
-
- if (munmap(base, size) < 0)
- {
- AERR("Could not munmap base:%p size:%lu '%s'", base, (unsigned long)size, strerror(errno));
- }
-
-#else
- AERR("Can't unregister DMA_BUF buffer for hnd %p. Not supported", hnd);
-#endif
-
- }
- else
- {
- AERR("Unregistering unknown buffer is not supported. Flags = %d", hnd->flags);
- }
-
- hnd->base = 0;
- hnd->lockState = 0;
- hnd->writeOwner = 0;
-}
-
-static int gralloc_unregister_buffer(gralloc_module_t const *module, buffer_handle_t handle)
-{
- MALI_IGNORE(module);
-
- if (private_handle_t::validate(handle) < 0)
- {
- AERR("unregistering invalid buffer %p, returning error", handle);
- return -EINVAL;
- }
-
- private_handle_t *hnd = (private_handle_t *)handle;
-
- AERR_IF(hnd->lockState & private_handle_t::LOCK_STATE_READ_MASK, "[unregister] handle %p still locked (state=%08x)", hnd, hnd->lockState);
-
- if (hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER)
- {
- AERR("Can't unregister buffer %p as it is a framebuffer", handle);
- }
- else if (hnd->pid == getpid()) // never unmap buffers that were not registered in this process
- {
- pthread_mutex_lock(&s_map_lock);
-
- hnd->lockState &= ~(private_handle_t::LOCK_STATE_MAPPED);
-
- /* if handle is still locked, the unmapping would not happen until unlocked*/
- if (!(hnd->lockState & private_handle_t::LOCK_STATE_WRITE))
- {
- unmap_buffer(hnd);
- }
-
- hnd->lockState |= private_handle_t::LOCK_STATE_UNREGISTERED;
-
- pthread_mutex_unlock(&s_map_lock);
- }
- else
- {
- AERR("Trying to unregister buffer %p from process %d that was not created in current process: %d", hnd, hnd->pid, getpid());
- }
-
- return 0;
-}
-
-static int gralloc_lock(gralloc_module_t const *module, buffer_handle_t handle, int usage, int l, int t, int w, int h, void **vaddr)
-{
-
-
- if (private_handle_t::validate(handle) < 0)
- {
- AERR("Locking invalid buffer %p, returning error", handle);
- return -EINVAL;
- }
-
- private_handle_t *hnd = (private_handle_t *)handle;
-
- if (hnd->format == HAL_PIXEL_FORMAT_YCbCr_420_888)
- {
- AERR("Buffer with format HAL_PIXEL_FORMAT_YCbCr_*_888 must be locked by lock_ycbcr()");
- return -EINVAL;
- }
-
- pthread_mutex_lock(&s_map_lock);
-
- if (hnd->lockState & private_handle_t::LOCK_STATE_UNREGISTERED)
- {
- AERR("Locking on an unregistered buffer %p, returning error", hnd);
- pthread_mutex_unlock(&s_map_lock);
- return -EINVAL;
- }
-
- if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_UMP || hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION)
- {
- hnd->writeOwner = usage & GRALLOC_USAGE_SW_WRITE_MASK;
- }
-
- hnd->lockState |= private_handle_t::LOCK_STATE_WRITE;
-
- pthread_mutex_unlock(&s_map_lock);
-
- if (usage & (GRALLOC_USAGE_SW_READ_MASK | GRALLOC_USAGE_SW_WRITE_MASK))
- {
- *vaddr = (void *)hnd->base;
- }
-
- MALI_IGNORE(module);
- MALI_IGNORE(l);
- MALI_IGNORE(t);
- MALI_IGNORE(w);
- MALI_IGNORE(h);
- return 0;
-}
-
-static int gralloc_lock_ycbcr(gralloc_module_t const *module, buffer_handle_t handle, int usage, int l, int t, int w, int h, struct android_ycbcr *ycbcr)
-{
- int retval = 0;
- int ystride, cstride;
-
- if (private_handle_t::validate(handle) < 0)
- {
- AERR("Locking invalid buffer %p, returning error", handle);
- return -EINVAL;
- }
-
- private_handle_t *hnd = (private_handle_t *)handle;
-
- pthread_mutex_lock(&s_map_lock);
-
- if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_UMP || hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION)
- {
- hnd->writeOwner = usage & GRALLOC_USAGE_SW_WRITE_MASK;
- }
-
- hnd->lockState |= private_handle_t::LOCK_STATE_WRITE;
-
- pthread_mutex_unlock(&s_map_lock);
-
-
- if (usage & (GRALLOC_USAGE_SW_READ_MASK | GRALLOC_USAGE_SW_WRITE_MASK))
- {
- switch (hnd->format)
- {
- case HAL_PIXEL_FORMAT_YCrCb_420_SP:
- ystride = cstride = GRALLOC_ALIGN(hnd->width, 16);
- ycbcr->y = (void *)hnd->base;
- ycbcr->cr = (void *)((unsigned char *)hnd->base + ystride * hnd->height);
- ycbcr->cb = (void *)((unsigned char *)hnd->base + ystride * hnd->height + 1);
- ycbcr->ystride = ystride;
- ycbcr->cstride = cstride;
- ycbcr->chroma_step = 2;
- break;
-
- case HAL_PIXEL_FORMAT_YV12:
- /* Here to keep consistency with YV12 alignment, define the ystride according to image height. */
- ystride = GRALLOC_ALIGN(hnd->width, (hnd->height % 8 == 0) ? GRALLOC_ALIGN_BASE_16 :
- ((hnd->height % 4 == 0) ? GRALLOC_ALIGN_BASE_64 : GRALLOC_ALIGN_BASE_128));
- cstride = GRALLOC_ALIGN(ystride / 2, 16);
- ycbcr->y = (void *)hnd->base;
- /* the ystride calc is assuming the height can at least be divided by 2 */
- ycbcr->cr = (void *)((unsigned char *)hnd->base + ystride * GRALLOC_ALIGN(hnd->height, 2));
- ycbcr->cb = (void *)((unsigned char *)hnd->base + ystride * GRALLOC_ALIGN(hnd->height, 2) + cstride * hnd->height / 2);
- ycbcr->ystride = ystride;
- ycbcr->cstride = cstride;
- ycbcr->chroma_step = 1;
- break;
-
-#ifdef SUPPORT_LEGACY_FORMAT
-
- case HAL_PIXEL_FORMAT_YCbCr_420_SP:
- ystride = cstride = GRALLOC_ALIGN(hnd->width, 16);
- ycbcr->y = (void *)hnd->base;
- ycbcr->cb = (void *)((unsigned char *)hnd->base + ystride * hnd->height);
- ycbcr->cr = (void *)((unsigned char *)hnd->base + ystride * hnd->height + 1);
- ycbcr->ystride = ystride;
- ycbcr->cstride = cstride;
- ycbcr->chroma_step = 2;
- break;
-#endif
-
- default:
- AERR("Can not lock buffer, invalid format: 0x%x", hnd->format);
- retval = -EINVAL;
- }
- }
-
- MALI_IGNORE(module);
- MALI_IGNORE(l);
- MALI_IGNORE(t);
- MALI_IGNORE(w);
- MALI_IGNORE(h);
- return retval;
-}
-
-static int gralloc_unlock(gralloc_module_t const *module, buffer_handle_t handle)
-{
- MALI_IGNORE(module);
-
- if (private_handle_t::validate(handle) < 0)
- {
- AERR("Unlocking invalid buffer %p, returning error", handle);
- return -EINVAL;
- }
-
- private_handle_t *hnd = (private_handle_t *)handle;
-
- if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_UMP && hnd->writeOwner)
- {
-#if GRALLOC_ARM_UMP_MODULE
- ump_cpu_msync_now((ump_handle)hnd->ump_mem_handle, UMP_MSYNC_CLEAN_AND_INVALIDATE, (void *)hnd->base, hnd->size);
-#else
- AERR("Buffer %p is UMP type but it is not supported", hnd);
-#endif
- }
- else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION && hnd->writeOwner)
- {
-#if GRALLOC_ARM_DMA_BUF_MODULE
- hw_module_t *pmodule = NULL;
- private_module_t *m = NULL;
-
- if (hw_get_module(GRALLOC_HARDWARE_MODULE_ID, (const hw_module_t **)&pmodule) == 0)
- {
- m = reinterpret_cast<private_module_t *>(pmodule);
- //ion_sync_fd(m->ion_client, hnd->share_fd);
- }
- else
- {
- AERR("Couldnot get gralloc module for handle %p\n", handle);
- }
-
-#endif
- }
-
- pthread_mutex_lock(&s_map_lock);
-
- hnd->lockState &= ~(private_handle_t::LOCK_STATE_WRITE);
-
- /* if the handle has already been unregistered, unmap it here*/
- if (hnd->lockState & private_handle_t::LOCK_STATE_UNREGISTERED)
- {
- unmap_buffer(hnd);
- }
-
- pthread_mutex_unlock(&s_map_lock);
-
- return 0;
-}
-
-#if defined(GRALLOC_MODULE_API_VERSION_0_3)
-static int gralloc_lock_async (gralloc_module_t const *module, buffer_handle_t handle, int usage, int l, int t, int w, int h, void **vaddr, int fenceFD)
-{
- if (fenceFD >= 0)
- {
- sync_wait(fenceFD, -1);
- close(fenceFD);
- }
-
- return gralloc_lock(module, handle, usage, l, t, w, h, vaddr);
-}
-
-static int gralloc_unlock_async(gralloc_module_t const *module, buffer_handle_t handle, int *fenceFD)
-{
- *fenceFD = -1;
-
- if (gralloc_unlock(module, handle) < 0)
- {
- return -EINVAL;
- }
-
- return 0;
-
-}
-
-static int gralloc_lock_async_ycbcr(gralloc_module_t const *module, buffer_handle_t handle, int usage, int l, int t, int w, int h, struct android_ycbcr *ycbcr, int fenceFD)
-{
- if (fenceFD >= 0)
- {
- sync_wait(fenceFD, -1);
- close(fenceFD);
- }
-
- return gralloc_lock_ycbcr(module, handle, usage, l, t, w, h, ycbcr);
-}
-#endif
-
-// There is one global instance of the module
-
-static struct hw_module_methods_t gralloc_module_methods =
-{
- .open = gralloc_device_open
-};
-
-private_module_t::private_module_t()
-{
-#define INIT_ZERO(obj) (memset(&(obj),0,sizeof((obj))))
-
- base.common.tag = HARDWARE_MODULE_TAG;
-#if defined(GRALLOC_MODULE_API_VERSION_0_3)
- base.common.version_major = GRALLOC_MODULE_API_VERSION_0_3;
-#else
- base.common.version_major = GRALLOC_MODULE_API_VERSION_0_2;
-#endif
- base.common.version_minor = 0;
- base.common.id = GRALLOC_HARDWARE_MODULE_ID;
- base.common.name = "Graphics Memory Allocator Module";
- base.common.author = "ARM Ltd.";
- base.common.methods = &gralloc_module_methods;
- base.common.dso = NULL;
- INIT_ZERO(base.common.reserved);
-
- base.registerBuffer = gralloc_register_buffer;
- base.unregisterBuffer = gralloc_unregister_buffer;
- base.lock = gralloc_lock;
- base.unlock = gralloc_unlock;
- base.perform = NULL;
- base.lock_ycbcr = gralloc_lock_ycbcr;
- base.getTransportSize = NULL;
- base.validateBufferSize = NULL;
-#if defined(GRALLOC_MODULE_API_VERSION_0_3)
- base.lockAsync = gralloc_lock_async;
- base.unlockAsync = gralloc_unlock_async;
- base.lockAsync_ycbcr = gralloc_lock_async_ycbcr;
-#endif
- INIT_ZERO(base.reserved_proc);
-
- framebuffer = NULL;
- flags = 0;
- numBuffers = 0;
- bufferMask = 0;
- pthread_mutex_init(&(lock), NULL);
- currentBuffer = NULL;
- INIT_ZERO(info);
- INIT_ZERO(finfo);
- xdpi = 0.0f;
- ydpi = 0.0f;
- fps = 0.0f;
-
-#undef INIT_ZERO
-};
-
-/*
- * HAL_MODULE_INFO_SYM will be initialized using the default constructor
- * implemented above
- */
-struct private_module_t HAL_MODULE_INFO_SYM;
-
diff --git a/gralloc/gralloc_priv.h b/gralloc/gralloc_priv.h
deleted file mode 100644
index 14cb07a..0000000
--- a/gralloc/gralloc_priv.h
+++ /dev/null
@@ -1,369 +0,0 @@
-/*
- * Copyright (C) 2010 ARM Limited. All rights reserved.
- *
- * Copyright (C) 2008 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.
- */
-
-#ifndef GRALLOC_PRIV_H_
-#define GRALLOC_PRIV_H_
-
-#include <stdint.h>
-#include <pthread.h>
-#include <errno.h>
-#include <linux/fb.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <hardware/gralloc.h>
-#include <cutils/native_handle.h>
-#include "alloc_device.h"
-#include <utils/Log.h>
-
-#ifdef MALI_600
-#define GRALLOC_ARM_UMP_MODULE 0
-#define GRALLOC_ARM_DMA_BUF_MODULE 1
-#else
-
-/* NOTE:
- * If your framebuffer device driver is integrated with UMP, you will have to
- * change this IOCTL definition to reflect your integration with the framebuffer
- * device.
- * Expected return value is a UMP secure id backing your framebuffer device memory.
- */
-
-/*#define IOCTL_GET_FB_UMP_SECURE_ID _IOR('F', 311, unsigned int)*/
-#define GRALLOC_ARM_UMP_MODULE 0
-#define GRALLOC_ARM_DMA_BUF_MODULE 1
-
-/* NOTE:
- * If your framebuffer device driver is integrated with dma_buf, you will have to
- * change this IOCTL definition to reflect your integration with the framebuffer
- * device.
- * Expected return value is a structure filled with a file descriptor
- * backing your framebuffer device memory.
- */
-#if GRALLOC_ARM_DMA_BUF_MODULE
-struct fb_dmabuf_export
-{
- __u32 fd;
- __u32 flags;
-};
-
-/* Un-comment this line to use dma_buf framebuffer */
-/*#define FBIOGET_DMABUF _IOR('F', 0x21, struct fb_dmabuf_export)*/
-
-#if PLATFORM_SDK_VERSION >= 21
-typedef int ion_user_handle_t;
-#define ION_INVALID_HANDLE 0
-#else
-
-typedef struct ion_handle *ion_user_handle_t;
-
-#define ION_INVALID_HANDLE NULL
-#endif /* new libion */
-
-#endif /* GRALLOC_ARM_DMA_BUF_MODULE */
-
-
-#endif
-
-/* the max string size of GRALLOC_HARDWARE_GPU0 & GRALLOC_HARDWARE_FB0
- * 8 is big enough for "gpu0" & "fb0" currently
- */
-#define MALI_GRALLOC_HARDWARE_MAX_STR_LEN 8
-#define NUM_FB_BUFFERS 2
-
-#if GRALLOC_ARM_UMP_MODULE
-#include <ump/ump.h>
-#endif
-
-#define MALI_IGNORE(x) (void)x
-typedef enum
-{
- MALI_YUV_NO_INFO,
- MALI_YUV_BT601_NARROW,
- MALI_YUV_BT601_WIDE,
- MALI_YUV_BT709_NARROW,
- MALI_YUV_BT709_WIDE,
-} mali_gralloc_yuv_info;
-
-struct private_handle_t;
-
-struct private_module_t
-{
- gralloc_module_t base;
-
- private_handle_t *framebuffer;
- uint32_t flags;
- uint32_t numBuffers;
- uint32_t bufferMask;
- pthread_mutex_t lock;
- buffer_handle_t currentBuffer;
- int ion_client;
- int system_heap_id;
- int cma_heap_id;
- bool gralloc_legacy_ion;
-
- struct fb_var_screeninfo info;
- struct fb_fix_screeninfo finfo;
- float xdpi;
- float ydpi;
- float fps;
-
- enum
- {
- // flag to indicate we'll post this buffer
- PRIV_USAGE_LOCKED_FOR_POST = 0x80000000
- };
-
- /* default constructor */
- private_module_t();
-};
-
-#ifdef __cplusplus
-struct private_handle_t : public native_handle
-{
-#else
-struct private_handle_t
-{
- struct native_handle nativeHandle;
-#endif
-
- enum
- {
- PRIV_FLAGS_FRAMEBUFFER = 0x00000001,
- PRIV_FLAGS_USES_UMP = 0x00000002,
- PRIV_FLAGS_USES_ION = 0x00000004,
- };
-
- enum
- {
- LOCK_STATE_WRITE = 1 << 31,
- LOCK_STATE_MAPPED = 1 << 30,
- LOCK_STATE_UNREGISTERED = 1 << 29,
- LOCK_STATE_READ_MASK = 0x3FFFFFFF
- };
-
- // ints
-#if GRALLOC_ARM_DMA_BUF_MODULE
- /*shared file descriptor for dma_buf sharing*/
- int share_fd;
-#endif
- int magic;
- int flags;
- int usage;
- int size;
- int width;
- int height;
- union {
- int format;
- int req_format; /* same name as gralloc960 */
- /*unused but referenced in drm_hwc */
- int internal_format;
- };
- int stride;
- union
- {
- void *base;
- uint64_t padding;
- };
- int lockState;
- int writeOwner;
- int pid;
-
- mali_gralloc_yuv_info yuv_info;
-
- // Following members are for UMP memory only
-#if GRALLOC_ARM_UMP_MODULE
- int ump_id;
- int ump_mem_handle;
-#endif
-
- // Following members is for framebuffer only
- int fd; //Shallow copy, DO NOT duplicate
- int offset;
- union
- {
- void *fb_paddr;
- uint64_t fb_paddr_padding;
- };
- int byte_stride;
-#if GRALLOC_ARM_DMA_BUF_MODULE
- ion_user_handle_t ion_hnd;
-#endif
-#if GRALLOC_ARM_DMA_BUF_MODULE
-#define GRALLOC_ARM_NUM_FDS 1
-#else
-#define GRALLOC_ARM_NUM_FDS 0
-#endif
-
-#ifdef __cplusplus
- static const int sNumFds = GRALLOC_ARM_NUM_FDS;
- static const int sMagic = 0x3141592;
-
-#if GRALLOC_ARM_UMP_MODULE
- private_handle_t(int flags, int usage, int size, void *base, int lock_state, ump_secure_id secure_id, ump_handle handle):
-#if GRALLOC_ARM_DMA_BUF_MODULE
- share_fd(-1),
-#endif
- magic(sMagic),
- flags(flags),
- usage(usage),
- size(size),
- width(0),
- height(0),
- format(0),
- stride(0),
- base(base),
- lockState(lock_state),
- writeOwner(0),
- pid(getpid()),
- yuv_info(MALI_YUV_NO_INFO),
- ump_id((int)secure_id),
- ump_mem_handle((int)handle),
- fd(0),
- offset(0),
- fb_paddr(NULL)
-#if GRALLOC_ARM_DMA_BUF_MODULE
- ,
- ion_hnd(ION_INVALID_HANDLE)
-#endif
-
- {
- version = sizeof(native_handle);
- numFds = sNumFds;
- numInts = (sizeof(private_handle_t) - sizeof(native_handle)) / sizeof(int) - sNumFds;
- }
-#endif
-
-#if GRALLOC_ARM_DMA_BUF_MODULE
- private_handle_t(int flags, int usage, int size, void *base, int lock_state):
- share_fd(-1),
- magic(sMagic),
- flags(flags),
- usage(usage),
- size(size),
- width(0),
- height(0),
- format(0),
- stride(0),
- base(base),
- lockState(lock_state),
- writeOwner(0),
- pid(getpid()),
- yuv_info(MALI_YUV_NO_INFO),
-#if GRALLOC_ARM_UMP_MODULE
- ump_id((int)UMP_INVALID_SECURE_ID),
- ump_mem_handle((int)UMP_INVALID_MEMORY_HANDLE),
-#endif
- fd(0),
- offset(0),
- fb_paddr(NULL),
- ion_hnd(ION_INVALID_HANDLE)
-
- {
- version = sizeof(native_handle);
- numFds = sNumFds;
- numInts = (sizeof(private_handle_t) - sizeof(native_handle)) / sizeof(int) - sNumFds;
- }
-
-#endif
-
- private_handle_t(int flags, int usage, int size, void *base, int lock_state, int fb_file, int fb_offset, void *fb_paddr):
-#if GRALLOC_ARM_DMA_BUF_MODULE
- share_fd(-1),
-#endif
- magic(sMagic),
- flags(flags),
- usage(usage),
- size(size),
- width(0),
- height(0),
- format(0),
- stride(0),
- base(base),
- lockState(lock_state),
- writeOwner(0),
- pid(getpid()),
- yuv_info(MALI_YUV_NO_INFO),
-#if GRALLOC_ARM_UMP_MODULE
- ump_id((int)UMP_INVALID_SECURE_ID),
- ump_mem_handle((int)UMP_INVALID_MEMORY_HANDLE),
-#endif
- fd(fb_file),
- offset(fb_offset),
- fb_paddr(fb_paddr)
-#if GRALLOC_ARM_DMA_BUF_MODULE
- ,
- ion_hnd(ION_INVALID_HANDLE)
-#endif
-
- {
- version = sizeof(native_handle);
- numFds = sNumFds;
- numInts = (sizeof(private_handle_t) - sizeof(native_handle)) / sizeof(int) - sNumFds;
- }
-
- ~private_handle_t()
- {
- magic = 0;
- }
-
- bool usesPhysicallyContiguousMemory()
- {
- return (flags & PRIV_FLAGS_FRAMEBUFFER) ? true : false;
- }
-
- static int validate(const native_handle *h)
- {
- const private_handle_t *hnd = (const private_handle_t *)h;
-
- if (!hnd || hnd->version != sizeof(native_handle) || hnd->magic != sMagic)
- {
- return -EINVAL;
- }
-
- int numFds = sNumFds;
- int numInts = (sizeof(private_handle_t) - sizeof(native_handle)) / sizeof(int) - sNumFds;
-
-#if GRALLOC_ARM_DMA_BUF_MODULE
- if (hnd->share_fd < 0)
- {
- numFds--;
- numInts++;
- }
-#endif
-
- if (hnd->numFds != numFds || hnd->numInts != numInts)
- {
- return -EINVAL;
- }
-
- return 0;
- }
-
- static private_handle_t *dynamicCast(const native_handle *in)
- {
- if (validate(in) == 0)
- {
- return (private_handle_t *) in;
- }
-
- return NULL;
- }
-#endif
-};
-
-#endif /* GRALLOC_PRIV_H_ */
diff --git a/gralloc/gralloc_vsync_report.h b/gralloc/gralloc_vsync_report.h
deleted file mode 100644
index fde0f2d..0000000
--- a/gralloc/gralloc_vsync_report.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2011 ARM Limited. All rights reserved.
- *
- * 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.
- */
-
-#ifndef GRALLOC_VSYNC_REPORT_H_
-#define GRALLOC_VSYNC_REPORT_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-typedef enum mali_vsync_event
-{
- MALI_VSYNC_EVENT_BEGIN_WAIT = 0,
- MALI_VSYNC_EVENT_END_WAIT
-} mali_vsync_event;
-
-extern void _mali_base_arch_vsync_event_report(mali_vsync_event);
-
-inline void gralloc_mali_vsync_report(mali_vsync_event event)
-{
- _mali_base_arch_vsync_event_report(event);
-}
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* GRALLOC_VSYNC_REPORT_H_ */
diff --git a/gralloc/ion_4.12.h b/gralloc/ion_4.12.h
deleted file mode 100644
index 6ae79d4..0000000
--- a/gralloc/ion_4.12.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Adapted from drivers/staging/android/uapi/ion.h
- *
- * Copyright (C) 2011 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef _UAPI_LINUX_ION_NEW_H
-#define _UAPI_LINUX_ION_NEW_H
-
-#include <linux/ioctl.h>
-#include <linux/types.h>
-
-#define ION_NUM_HEAP_IDS (sizeof(unsigned int) * 8)
-
-/**
- * DOC: Ion Userspace API
- *
- * create a client by opening /dev/ion
- * most operations handled via following ioctls
- *
- */
-
-/**
- * struct ion_new_allocation_data - metadata passed from userspace for allocations
- * @len: size of the allocation
- * @heap_id_mask: mask of heap ids to allocate from
- * @flags: flags passed to heap
- * @handle: pointer that will be populated with a cookie to use to
- * refer to this allocation
- *
- * Provided by userspace as an argument to the ioctl - added _new to denote
- * this belongs to the new ION interface.
- */
-struct ion_new_allocation_data {
- __u64 len;
- __u32 heap_id_mask;
- __u32 flags;
- __u32 fd;
- __u32 unused;
-};
-
-#define MAX_HEAP_NAME 32
-
-/**
- * struct ion_heap_data - data about a heap
- * @name - first 32 characters of the heap name
- * @type - heap type
- * @heap_id - heap id for the heap
- */
-struct ion_heap_data {
- char name[MAX_HEAP_NAME];
- __u32 type;
- __u32 heap_id;
- __u32 reserved0;
- __u32 reserved1;
- __u32 reserved2;
-};
-
-/**
- * struct ion_heap_query - collection of data about all heaps
- * @cnt - total number of heaps to be copied
- * @heaps - buffer to copy heap data
- */
-struct ion_heap_query {
- __u32 cnt; /* Total number of heaps to be copied */
- __u32 reserved0; /* align to 64bits */
- __u64 heaps; /* buffer to be populated */
- __u32 reserved1;
- __u32 reserved2;
-};
-
-#define ION_IOC_MAGIC 'I'
-
-/**
- * DOC: ION_IOC_NEW_ALLOC - allocate memory
- *
- * Takes an ion_allocation_data struct and returns it with the handle field
- * populated with the opaque handle for the allocation.
- * TODO: This IOCTL will clash by design; however, only one of
- * ION_IOC_ALLOC or ION_IOC_NEW_ALLOC paths will be exercised,
- * so this should not conflict.
- */
-#define ION_IOC_NEW_ALLOC _IOWR(ION_IOC_MAGIC, 0, struct ion_new_allocation_data)
-
-/**
- * DOC: ION_IOC_FREE - free memory
- *
- * Takes an ion_handle_data struct and frees the handle.
- *
- * #define ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data)
- * This will come from the older kernels, so don't redefine here
- */
-
-/**
- * DOC: ION_IOC_SHARE - creates a file descriptor to use to share an allocation
- *
- * Takes an ion_fd_data struct with the handle field populated with a valid
- * opaque handle. Returns the struct with the fd field set to a file
- * descriptor open in the current address space. This file descriptor
- * can then be passed to another process. The corresponding opaque handle can
- * be retrieved via ION_IOC_IMPORT.
- *
- * #define ION_IOC_SHARE _IOWR(ION_IOC_MAGIC, 4, struct ion_fd_data)
- * This will come from the older kernels, so don't redefine here
- */
-
-/**
- * DOC: ION_IOC_HEAP_QUERY - information about available heaps
- *
- * Takes an ion_heap_query structure and populates information about
- * available Ion heaps.
- */
-#define ION_IOC_HEAP_QUERY _IOWR(ION_IOC_MAGIC, 8, struct ion_heap_query)
-
-#endif /* _UAPI_LINUX_ION_NEW_H */
diff --git a/hikey-common.mk b/hikey-common.mk
deleted file mode 100644
index bf3bd24..0000000
--- a/hikey-common.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-ifndef TARGET_KERNEL_USE
-TARGET_KERNEL_USE=4.19
-endif
-
-LOCAL_KERNEL_HOME ?= device/linaro/hikey-kernel/hikey/$(TARGET_KERNEL_USE)
-TARGET_PREBUILT_KERNEL := $(LOCAL_KERNEL_HOME)/Image.gz-dtb
-TARGET_PREBUILT_DTB := $(LOCAL_KERNEL_HOME)/hi6220-hikey.dtb
-
-PRODUCT_ENFORCE_VINTF_MANIFEST_OVERRIDE := true
-
-TARGET_FSTAB := fstab.hikey
-
-$(call inherit-product, device/linaro/hikey/hikey/device-hikey.mk)
-$(call inherit-product, device/linaro/hikey/device-common.mk)
diff --git a/hikey.mk b/hikey.mk
deleted file mode 100644
index 31631af..0000000
--- a/hikey.mk
+++ /dev/null
@@ -1,57 +0,0 @@
-include $(LOCAL_PATH)/vendor-package-ver.mk
-$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
-$(call inherit-product, device/linaro/hikey/hikey-common.mk)
-$(call inherit-product-if-exists, vendor/linaro/hikey960/$(EXPECTED_LINARO_VENDOR_VERSION)/hikey.mk)
-
-PRODUCT_PROPERTY_OVERRIDES += \
- ro.opengles.version=131072 \
- ro.hardware.egl=mali
-
-PRODUCT_NAME := hikey
-PRODUCT_DEVICE := hikey
-PRODUCT_BRAND := Android
-
-ifneq ($(HIKEY_USES_GKI),)
-HIKEY_MOD_DIR := $(LOCAL_KERNEL_HOME)
-HIKEY_MODS := $(wildcard $(HIKEY_MOD_DIR)/*.ko)
-ifneq ($(HIKEY_MODS),)
- BOARD_VENDOR_KERNEL_MODULES += $(HIKEY_MODS)
- # XXX dwc2/phy-hi6220-usb have some timing
- # issue that prevents gadget mode from working
- # unless they are loaded from initrd. Need to fix.
- BOARD_VENDOR_RAMDISK_KERNEL_MODULES += \
- $(HIKEY_MOD_DIR)/dwc2.ko \
- $(HIKEY_MOD_DIR)/phy-hi6220-usb.ko
-
- # make sure ion cma heap loads early
- CMA_HEAP_KO := $(wildcard $(HIKEY_MOD_DIR)/cma_heap*.ko)
- ION_CMA_HEAP_KO := $(wildcard $(HIKEY_MOD_DIR)/ion_cma_heap*.ko)
- BOARD_VENDOR_RAMDISK_KERNEL_MODULES += \
- $(CMA_HEAP_KO) \
- $(ION_CMA_HEAP_KO)
-
- # Not sure why, but powerkey has to be initrd
- # or else we'll see stalls or issues at bootup
- BOARD_VENDOR_RAMDISK_KERNEL_MODULES += \
- $(HIKEY_MOD_DIR)/hisi_powerkey.ko
-
- MMC_CORE_KO := $(wildcard $(HIKEY_MOD_DIR)/mmc_core.ko)
- MMC_BLOCK_KO := $(wildcard $(HIKEY_MOD_DIR)/mmc_block.ko)
- BOARD_VENDOR_RAMDISK_KERNEL_MODULES += \
- $(MMC_CORE_KO) \
- $(MMC_BLOCK_KO)
-
- BOARD_VENDOR_RAMDISK_KERNEL_MODULES += \
- $(HIKEY_MOD_DIR)/hi655x-regulator.ko \
- $(HIKEY_MOD_DIR)/clk-hi655x.ko \
- $(HIKEY_MOD_DIR)/hi655x-pmic.ko \
- $(HIKEY_MOD_DIR)/dw_mmc-k3.ko \
- $(HIKEY_MOD_DIR)/dw_mmc-pltfm.ko \
- $(HIKEY_MOD_DIR)/dw_mmc.ko \
-
-endif
-endif
-
-PRODUCT_SOONG_NAMESPACES += \
- vendor/linaro/hikey960/$(EXPECTED_LINARO_VENDOR_VERSION)/mali/utgard
-
diff --git a/hikey/BoardConfig.mk b/hikey/BoardConfig.mk
deleted file mode 100644
index 5f03ddb..0000000
--- a/hikey/BoardConfig.mk
+++ /dev/null
@@ -1,44 +0,0 @@
-include device/linaro/hikey/BoardConfigCommon.mk
-
-TARGET_BOOTLOADER_BOARD_NAME := hikey
-TARGET_BOARD_PLATFORM := hikey
-
-TARGET_CPU_VARIANT := cortex-a53
-TARGET_2ND_CPU_VARIANT := cortex-a53
-
-BOARD_KERNEL_CMDLINE := androidboot.hardware=hikey firmware_class.path=/vendor/firmware efi=noruntime init=/init
-BOARD_KERNEL_CMDLINE += androidboot.boot_devices=soc/f723d000.dwmmc0
-BOARD_KERNEL_CMDLINE += console=ttyAMA3,115200 androidboot.console=ttyAMA3
-BOARD_KERNEL_CMDLINE += androidboot.verifiedbootstate=orange
-
-ifneq ($(TARGET_SENSOR_MEZZANINE),)
-BOARD_KERNEL_CMDLINE += overlay_mgr.overlay_dt_entry=hardware_cfg_$(TARGET_SENSOR_MEZZANINE)
-endif
-
-## printk.devkmsg only has meaning for kernel 4.9 and later
-## it would be ignored by kernel 4.4
-BOARD_KERNEL_CMDLINE += printk.devkmsg=on
-
-TARGET_NO_DTIMAGE := true
-
-BOARD_BOOTIMAGE_PARTITION_SIZE := 67108864
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1610612736
-ifeq ($(TARGET_USERDATAIMAGE_4GB), true) # to build for aosp-4g partition table
-BOARD_USERDATAIMAGE_PARTITION_SIZE := 1595915776
-else
-ifeq ($(TARGET_WITH_SWAP), true) # to build for swap-8g partition table
-BOARD_USERDATAIMAGE_PARTITION_SIZE := 4246715904
-else
-BOARD_USERDATAIMAGE_PARTITION_SIZE := 5588893184
-endif
-endif
-BOARD_FLASH_BLOCK_SIZE := 131072
-
-# Vendor partition definitions
-TARGET_COPY_OUT_VENDOR := vendor
-BOARD_VENDORIMAGE_PARTITION_SIZE := 268435456 # 256MB
-BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
-BOARD_VENDORIMAGE_JOURNAL_SIZE := 0
-BOARD_VENDORIMAGE_EXTFS_INODE_COUNT := 2048
-
-TARGET_RECOVERY_FSTAB := device/linaro/hikey/hikey/$(TARGET_FSTAB)
diff --git a/hikey/README b/hikey/README
deleted file mode 100644
index 25c1df3..0000000
--- a/hikey/README
+++ /dev/null
@@ -1,55 +0,0 @@
-Running Android on hikey board:
-
-* Compiling userspace:
-Pull AOSP source:
-$ repo init -u https://android.googlesource.com/platform/manifest -b master & repo sync -j24
-
-Install mcopy utility:
-$ apt-get install mtools
-
-Build:
-$ . ./build/envsetup.sh
-$ lunch hikey-userdebug
-$ make -j32
-
-Note: For 4 GB eMMC part use:
-$ make -j32 TARGET_USERDATAIMAGE_4GB=true
-
-* Installing initial fastboot and ptable:
-Select special bootloader mode by linking J15 1-2 and 3-4 pins
-Connect USB to PC to get ttyUSB device (ex: ttyUSB1)
-Power the board
-$ cd device/linaro/hikey/installer/hikey
-$ ./flash-all.sh /dev/ttyUSB1 [4g]
-Remove link 3-4 and power the board
-
-* Flashing images:
-Enter fastboot mode by linking J15 1-2 and 5-6 pins
-$ fastboot flash boot out/target/product/hikey/boot.img
-$ fastboot flash system out/target/product/hikey/system.img
-$ fastboot flash vendor out/target/product/hikey/vendor.img
-$ fastboot flash cache out/target/product/hikey/cache.img
-$ fastboot flash userdata out/target/product/hikey/userdata.img
-Remove jumper 5-6 and power the board
-
-* Building kernel
-$ git clone https://android.googlesource.com/kernel/hikey-linaro
-$ cd hikey-linaro
-$ git checkout -b android-hikey-linaro-4.9 origin/android-hikey-linaro-4.9
-$ make ARCH=arm64 hikey_defconfig
-$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- -j24
-Output: arch/arm64/boot/Image & arch/arm64/boot/dts/hisilicon/hi6220-hikey.dtb
- copy Image-dtb and hi6220-hikey.dtb to hikey-kernel directory to files
- Image-dtb-4.9 and hi6220-hikey.dtb-4.9
-
-* Setting monitor resolution
-Add to BOARD_KERNEL_CMDLINE in BoardConfig.mk:
- video= (for example for 24” monitor): video=HDMI-A-1:1280x800@60
-
-* Kernel serial output (uart3):
-J2 (LS Expansion): 1 - Gnd, 11 - Rx, 13 - Tx
-
-External links:
-Board: https://www.96boards.org/products/ce/hikey/
-Howto: https://github.com/96boards/documentation/wiki/LatestSnapshots
-Schematics: https://github.com/96boards/documentation/blob/master/consumer/hikey/hardware-docs/HiKey_schematics_LeMaker_version_Rev_A1.pdf
diff --git a/hikey/board-info.txt b/hikey/board-info.txt
deleted file mode 100644
index a167e4d..0000000
--- a/hikey/board-info.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-require board=hikey
-require version-bootloader=0.7
diff --git a/hikey/device-hikey.mk b/hikey/device-hikey.mk
deleted file mode 100644
index 55eaf72..0000000
--- a/hikey/device-hikey.mk
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# Copyright (C) 2011 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.
-#
-
-PRODUCT_COPY_FILES += $(TARGET_PREBUILT_KERNEL):kernel \
- $(TARGET_PREBUILT_DTB):hi6220-hikey.dtb \
- $(LOCAL_PATH)/$(TARGET_FSTAB):$(TARGET_COPY_OUT_VENDOR)/etc/fstab.hikey \
- device/linaro/hikey/fstab.ramdisk:$(TARGET_COPY_OUT_RAMDISK)/fstab.hikey \
- device/linaro/hikey/hikey/init.hikey.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.hikey.rc \
- device/linaro/hikey/init.hikey.power.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.hikey.power.rc \
- device/linaro/hikey/hikey/init.hikey.usb.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.hikey.usb.rc \
- device/linaro/hikey/ueventd.common.rc:$(TARGET_COPY_OUT_VENDOR)/ueventd.rc \
- frameworks/base/data/keyboards/Generic.kl:$(TARGET_COPY_OUT_VENDOR)/usr/keylayout/hikey.kl
-
-# Build HiKey HDMI audio HAL
-PRODUCT_PACKAGES += audio.primary.hikey
-
-# Include USB speed switch App
-PRODUCT_PACKAGES += UsbSpeedSwitch
-
-# Build libion
-PRODUCT_PACKAGES += libion
-
-# Build gralloc for hikey
-PRODUCT_PACKAGES += gralloc.hikey
-
-# PowerHAL
-PRODUCT_PACKAGES += power.hikey
-
-# Sensors HAL
-PRODUCT_PACKAGES += sensors.hikey
-
-PRODUCT_PACKAGES += hwcomposer.drm_hikey
-
-# Include mali blobs from ARM
-PRODUCT_PACKAGES += libGLES_mali
-
-ifneq ($(TARGET_NO_RECOVERY),true)
-PRODUCT_COPY_FILES += \
- device/linaro/hikey/init.recovery.common.rc:recovery/root/init.recovery.hikey.rc
-endif
diff --git a/hikey/fstab.hikey b/hikey/fstab.hikey
deleted file mode 100644
index fbaf2c6..0000000
--- a/hikey/fstab.hikey
+++ /dev/null
@@ -1,9 +0,0 @@
-# Android fstab file.
-#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
-# The filesystem that contains the filesystem checker binary (typically /system) cannot
-# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
-
-/dev/block/platform/soc/f723d000.dwmmc0/by-name/userdata /data f2fs discard,noatime,nosuid,nodev wait,check,fileencryption=software,quota
-/dev/block/platform/soc/f723d000.dwmmc0/by-name/userdata /data ext4 discard,noatime,noauto_da_alloc,nosuid,nodev,data=ordered,user_xattr,barrier=1 wait,formattable,quota
-/devices/platform/soc/f723e000.dwmmc1/mmc_host/mmc* auto auto defaults voldmanaged=sdcard1:auto,encryptable=userdata
-/devices/platform/soc/f72c0000.usb/usb* auto auto defaults voldmanaged=usbdisk:auto,encryptable=userdata
diff --git a/hikey/init.hikey.rc b/hikey/init.hikey.rc
deleted file mode 100644
index 6ea3b3b..0000000
--- a/hikey/init.hikey.rc
+++ /dev/null
@@ -1,9 +0,0 @@
-import init.common.rc
-
-on fs
- mount_all /vendor/etc/fstab.${ro.hardware}
-
-on post-fs
- # Set supported opengles version
- setprop ro.hardware.hwcomposer drm_hikey
-
diff --git a/hikey/init.hikey.usb.rc b/hikey/init.hikey.usb.rc
deleted file mode 100644
index baffb12..0000000
--- a/hikey/init.hikey.usb.rc
+++ /dev/null
@@ -1,92 +0,0 @@
-on boot
- mount configfs none /config
- mkdir /config/usb_gadget/g1 0770 shell shell
- mkdir /config/usb_gadget/g1/strings/0x409 0770 shell shell
- write /config/usb_gadget/g1/bcdUSB 0x0200
- write /config/usb_gadget/g1/driver_match_existing_only 0
- write /config/usb_gadget/g1/idVendor 0x18d1
- write /config/usb_gadget/g1/bcdDevice 0x0223
- write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
- write /config/usb_gadget/g1/strings/0x409/manufacturer "HISILICON"
- write /config/usb_gadget/g1/strings/0x409/product "ADB Gadget"
- mkdir /config/usb_gadget/g1/functions/accessory.gs2
- mkdir /config/usb_gadget/g1/functions/audio_source.gs3
- mkdir /config/usb_gadget/g1/functions/midi.gs5
- mkdir /config/usb_gadget/g1/functions/ffs.adb
- mkdir /config/usb_gadget/g1/functions/ffs.mtp
- mkdir /config/usb_gadget/g1/functions/ffs.ptp
- mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell
- mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell
- write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1
- write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100"
- write /config/usb_gadget/g1/configs/b.1/MaxPower 500
- mkdir /dev/usb-ffs 0775 shell shell
- mkdir /dev/usb-ffs/adb 0770 shell shell
- mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
- mkdir /dev/usb-ffs/mtp 0770 mtp mtp
- mkdir /dev/usb-ffs/ptp 0770 mtp mtp
- mount functionfs mtp /dev/usb-ffs/mtp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
- mount functionfs ptp /dev/usb-ffs/ptp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
-
- setprop sys.usb.controller "f72c0000.usb"
-
- setprop sys.usb.mtp.device_type 3
- setprop sys.usb.configfs 1
- setprop sys.usb.ffs.aio_compat 1
- symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1
-
-on property:sys.usb.config=none && property:sys.usb.configfs=1
- write /config/usb_gadget/g1/os_desc/use 0
-
-on property:sys.usb.config=mtp && property:sys.usb.configfs=1
- write /config/usb_gadget/g1/idProduct 0x4ee1
- write /config/usb_gadget/g1/os_desc/use 1
- symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
-
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1
- write /config/usb_gadget/g1/idProduct 0x4ee2
- write /config/usb_gadget/g1/os_desc/use 1
- symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
-
-on property:sys.usb.config=rndis && property:sys.usb.configfs=1
- write /config/usb_gadget/g1/idProduct 0x4ee3
-
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1
- write /config/usb_gadget/g1/idProduct 0x4ee4
-
-on property:sys.usb.config=ptp && property:sys.usb.configfs=1
- write /config/usb_gadget/g1/idProduct 0x4ee5
- write /config/usb_gadget/g1/os_desc/use 1
- symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
-
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1
- write /config/usb_gadget/g1/idProduct 0x4ee6
- write /config/usb_gadget/g1/os_desc/use 1
- symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
-
-on property:sys.usb.config=adb && property:sys.usb.configfs=1
- write /config/usb_gadget/g1/idProduct 0x4ee7
-
-on property:sys.usb.config=midi && property:sys.usb.configfs=1
- write /config/usb_gadget/g1/idProduct 0x4ee8
-
-on property:sys.usb.config=midi,adb && property:sys.usb.configfs=1
- write /config/usb_gadget/g1/idProduct 0x4ee9
-
-on property:sys.usb.config=accessory && property:sys.usb.configfs=1
- write /config/usb_gadget/g1/idProduct 0x2d00
-
-on property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1
- write /config/usb_gadget/g1/idProduct 0x2d01
-
-on property:sys.usb.config=audio_source && property:sys.usb.configfs=1
- write /config/usb_gadget/g1/idProduct 0x2d02
-
-on property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1
- write /config/usb_gadget/g1/idProduct 0x2d03
-
-on property:sys.usb.config=accessory,audio_source && property:sys.usb.configfs=1
- write /config/usb_gadget/g1/idProduct 0x2d04
-
-on property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1
- write /config/usb_gadget/g1/idProduct 0x2d05
diff --git a/hikey32.mk b/hikey32.mk
deleted file mode 100644
index 2ae48a6..0000000
--- a/hikey32.mk
+++ /dev/null
@@ -1,5 +0,0 @@
-$(call inherit-product, device/linaro/hikey/hikey-common.mk)
-
-PRODUCT_NAME := hikey32
-PRODUCT_DEVICE := hikey32
-PRODUCT_BRAND := Android
diff --git a/hikey32/BoardConfig.mk b/hikey32/BoardConfig.mk
deleted file mode 100644
index d7e4180..0000000
--- a/hikey32/BoardConfig.mk
+++ /dev/null
@@ -1,13 +0,0 @@
-include device/linaro/hikey/hikey/BoardConfig.mk
-
-TARGET_ARCH := arm
-TARGET_ARCH_VARIANT := armv7-a-neon
-TARGET_CPU_ABI := armeabi-v7a
-TARGET_CPU_ABI2 := armeabi
-TARGET_CPU_VARIANT := generic
-
-TARGET_2ND_ARCH :=
-TARGET_2ND_ARCH_VARIANT :=
-TARGET_2ND_CPU_ABI :=
-TARGET_2ND_CPU_ABI2 :=
-TARGET_2ND_CPU_VARIANT :=
diff --git a/hikey32/board-info.txt b/hikey32/board-info.txt
deleted file mode 100644
index a167e4d..0000000
--- a/hikey32/board-info.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-require board=hikey
-require version-bootloader=0.7
diff --git a/hikey64/BoardConfig.mk b/hikey64/BoardConfig.mk
deleted file mode 100644
index 56f5111..0000000
--- a/hikey64/BoardConfig.mk
+++ /dev/null
@@ -1,13 +0,0 @@
-include device/linaro/hikey/hikey/BoardConfig.mk
-
-TARGET_ARCH := arm64
-TARGET_ARCH_VARIANT := armv8-a
-TARGET_CPU_ABI := arm64-v8a
-TARGET_CPU_ABI2 :=
-TARGET_CPU_VARIANT := cortex-a53
-
-TARGET_2ND_ARCH :=
-TARGET_2ND_ARCH_VARIANT :=
-TARGET_2ND_CPU_ABI :=
-TARGET_2ND_CPU_ABI2 :=
-TARGET_2ND_CPU_VARIANT :=
diff --git a/hikey64/board-info.txt b/hikey64/board-info.txt
deleted file mode 100644
index a167e4d..0000000
--- a/hikey64/board-info.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-require board=hikey
-require version-bootloader=0.7
diff --git a/hikey64_only.mk b/hikey64_only.mk
deleted file mode 100644
index c2b4320..0000000
--- a/hikey64_only.mk
+++ /dev/null
@@ -1,6 +0,0 @@
-$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit_only.mk)
-$(call inherit-product, device/linaro/hikey/hikey-common.mk)
-
-PRODUCT_NAME := hikey64_only
-PRODUCT_DEVICE := hikey64
-PRODUCT_BRAND := Android
diff --git a/hikey960.mk b/hikey960.mk
index dd7082b..1c6ac7b 100644
--- a/hikey960.mk
+++ b/hikey960.mk
@@ -21,36 +21,10 @@
endif
endif
-# only kernels after 5.10 support KVM
-ifndef HIKEY960_ENABLE_AVF
- ifeq ($(TARGET_KERNEL_USE), mainline)
- HIKEY960_ENABLE_AVF := true
- else
- KERNEL_MAJ := $(word 1, $(subst ., ,$(TARGET_KERNEL_USE)))
- KERNEL_MIN := $(word 2, $(subst ., ,$(TARGET_KERNEL_USE)))
- KER_GT_5 := $(shell [ $(KERNEL_MAJ) -gt 5 ] && echo true)
- KER_GE_5_10 := $(shell [ $(KERNEL_MIN) -ge 10 ] && echo true)
-
- ifeq ($(KER_GT_5), true)
- HIKEY960_ENABLE_AVF := true
- else
- ifeq ($(KERNEL_MAJ), 5)
- # for kernel after 5.10
- ifeq ($(KER_GE_5_10),true)
- HIKEY960_ENABLE_AVF := true
- endif
- endif # end for 5.10
- endif # end for 5.X
- endif # end for mainline
-endif # end for HIKEY960_ENABLE_AVF
-
-include $(LOCAL_PATH)/vendor-package-ver.mk
-
# Inherit the common device configuration
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
$(call inherit-product, device/linaro/hikey/hikey960/device-hikey960.mk)
$(call inherit-product, device/linaro/hikey/device-common.mk)
-$(call inherit-product-if-exists, vendor/linaro/hikey960/$(EXPECTED_LINARO_VENDOR_VERSION)/hikey960.mk)
PRODUCT_PROPERTY_OVERRIDES += \
ro.opengles.version=196608 \
@@ -85,4 +59,4 @@
endif
PRODUCT_SOONG_NAMESPACES += \
- vendor/linaro/hikey960/$(EXPECTED_LINARO_VENDOR_VERSION)/mali/bifrost
+ device/linaro/hikey/mali/bifrost
diff --git a/hikey960/BoardConfig.mk b/hikey960/BoardConfig.mk
index 32f2992..6d7b023 100644
--- a/hikey960/BoardConfig.mk
+++ b/hikey960/BoardConfig.mk
@@ -13,18 +13,6 @@
BOARD_KERNEL_CMDLINE += loglevel=15 androidboot.slot_suffix=_a
BOARD_KERNEL_CMDLINE += androidboot.verifiedbootstate=orange
-ifeq ($(HIKEY960_ENABLE_AVF), true)
-# The GKI kernel set protected mode by default via gki_defconfig,
-# but hikey960 does not support the protected kvm mode, here overwriting
-# to make it possible to play with AVF in the non-protected mode.
-BOARD_KERNEL_CMDLINE += kvm-arm.mode=nvhe
-# hypervisor.version would be better to be the same as CROSVM_PLATFORM_VERSION in
-# packages/modules/Virtualization/virtualizationmanager/src/crosvm.rs
-BOARD_KERNEL_CMDLINE += androidboot.hypervisor.version=1.0.0
-BOARD_KERNEL_CMDLINE += androidboot.hypervisor.vm.supported=1
-BOARD_KERNEL_CMDLINE += androidboot.hypervisor.protected_vm.supported=0
-endif
-
ifeq ($(TARGET_BUILTIN_EDID), true)
BOARD_KERNEL_CMDLINE += drm_kms_helper.edid_firmware=edid/1920x1080.bin
endif
diff --git a/hikey960/device-hikey960.mk b/hikey960/device-hikey960.mk
index 7d17880..ed7f6f4 100644
--- a/hikey960/device-hikey960.mk
+++ b/hikey960/device-hikey960.mk
@@ -14,13 +14,6 @@
# limitations under the License.
#
-ifeq ($(HIKEY960_ENABLE_AVF), true)
-# Based on the instructions in the following link:
-# https://android.googlesource.com/platform/packages/modules/Virtualization/+/refs/heads/master/microdroid/README.md
-# Tested with the android13-5.10 and android-mainline kernels.
-$(call inherit-product, packages/modules/Virtualization/apex/product_packages.mk)
-endif
-
# Enable Virtual A/B
AB_OTA_UPDATER := true
AB_OTA_PARTITIONS += \
@@ -55,6 +48,15 @@
PRODUCT_USE_DYNAMIC_PARTITIONS := true
PRODUCT_USE_DYNAMIC_PARTITION_SIZE :=true
+# Copy BT firmware
+PRODUCT_COPY_FILES += \
+ device/linaro/hikey/bt-wifi-firmware-util/TIInit_11.8.32-pcm-960.bts:$(TARGET_COPY_OUT_VENDOR)/firmware/ti-connectivity/TIInit_11.8.32.bts
+
+# Copy wlan firmware
+PRODUCT_COPY_FILES += \
+ device/linaro/hikey/bt-wifi-firmware-util/wl18xx-fw-4.bin:$(TARGET_COPY_OUT_VENDOR)/firmware/ti-connectivity/wl18xx-fw-4.bin \
+ device/linaro/hikey/bt-wifi-firmware-util/wl18xx-conf-wl1837mod.bin:$(TARGET_COPY_OUT_VENDOR)/firmware/ti-connectivity/wl18xx-conf.bin
+
# Build HiKey960 HDMI audio HAL. Experimental only may not work. FIXME
PRODUCT_PACKAGES += audio.primary.hikey960
diff --git a/hikey960_tv.mk b/hikey960_tv.mk
deleted file mode 100644
index 7c9b8de..0000000
--- a/hikey960_tv.mk
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# Inherit the full_base and device configurations
-$(call inherit-product, device/linaro/hikey/hikey960.mk)
-
-#
-# Overrides
-PRODUCT_NAME := hikey960_tv
-PRODUCT_DEVICE := hikey960
-PRODUCT_BRAND := Android
-PRODUCT_MODEL := AOSP TV on hikey960
diff --git a/hikey_tv.mk b/hikey_tv.mk
deleted file mode 100644
index c55a4ea..0000000
--- a/hikey_tv.mk
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# Inherit the full_base and device configurations
-$(call inherit-product, device/linaro/hikey/hikey.mk)
-
-#
-# Overrides
-PRODUCT_NAME := hikey_tv
-PRODUCT_DEVICE := hikey
-PRODUCT_BRAND := Android
-PRODUCT_MODEL := AOSP TV on hikey
diff --git a/init.hikey.power.rc b/init.hikey.power.rc
deleted file mode 100644
index cc268c6..0000000
--- a/init.hikey.power.rc
+++ /dev/null
@@ -1,30 +0,0 @@
-on post-fs
- #
- # EAS feature enabling
- #
- write /sys/kernel/debug/sched_features "ENERGY_AWARE"
- write /proc/sys/kernel/sched_is_big_little 0
- write /proc/sys/kernel/sched_cstate_aware 1
- write /proc/sys/kernel/sched_sync_hint_enable 1
- write /proc/sys/kernel/sched_initial_task_util 0
-
- #
- # EAS stune boosting interfaces
- #
- chown system system /dev/stune/top-app/schedtune.boost
- chown system system /dev/stune/top-app/schedtune.prefer_idle
- chown system system /dev/stune/foreground/schedtune.boost
- chown system system /dev/stune/foreground/schedtune.prefer_idle
- chown system system /dev/stune/schedtune.boost
-
- write /dev/stune/top-app/schedtune.boost 10
- write /dev/stune/top-app/schedtune.prefer_idle 1
- write /dev/stune/foreground/schedtune.boost 0
- write /dev/stune/foreground/schedtune.prefer_idle 1
- write /dev/stune/schedtune.boost 0
-
- setprop ro.config.schetune.touchboost.value 40
- setprop ro.config.schetune.touchboost.time_ns 1000000000
-
- setprop ro.config.cpufreq.max_freq.cluster0 "/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq"
- setprop ro.config.cpufreq.low_power_max.cluster0 "729000"
diff --git a/installer/hikey960/flash-all.sh b/installer/hikey960/flash-all.sh
index c894558..70bb432 100755
--- a/installer/hikey960/flash-all.sh
+++ b/installer/hikey960/flash-all.sh
@@ -5,7 +5,7 @@
# for cases that don't run "lunch hikey960-userdebug"
if [ -z "${ANDROID_BUILD_TOP}" ]; then
- ANDROID_BUILD_TOP=$(cd ${INSTALLER_DIR}/../../../../../; pwd)
+ ANDROID_BUILD_TOP=${INSTALLER_DIR}/../../../../../
ANDROID_PRODUCT_OUT="${ANDROID_BUILD_TOP}/out/target/product/hikey960"
fi
@@ -16,22 +16,6 @@
echo ${ECHO_PREFIX}"android out dir:${ANDROID_PRODUCT_OUT}"
-. "${ANDROID_BUILD_TOP}/device/linaro/hikey/vendor-package-ver.sh"
-
-VENDOR_DIR=$ANDROID_BUILD_TOP/vendor/linaro/hikey960/${EXPECTED_LINARO_VENDOR_VERSION}/
-
-# TODO: Pull one-time recovery/qdl path out of standard install
-# Flash bootloader firmware files
-if [ ! -d "${VENDOR_DIR}/" ]; then
- echo "FLASH-ALL-AOSP: Missing vendor firmware package?"
- echo " Make sure the vendor binaries have been downloaded from"
- echo " ${VND_PKG_URL}"
- echo " and extracted to $ANDROID_BUILD_TOP."
- exit
-fi
-
-pushd $VENDOR_DIR/bootloader/
-
function check_partition_table_version () {
fastboot erase reserved
if [ $? -eq 0 ]
@@ -43,21 +27,21 @@
}
function flashing_atf_uefi () {
- fastboot flash ptable prm_ptable.img
- fastboot flash xloader hisi-sec_xloader.img
+ fastboot flash ptable "${INSTALLER_DIR}"/prm_ptable.img
+ fastboot flash xloader "${INSTALLER_DIR}"/hisi-sec_xloader.img
fastboot reboot-bootloader
- fastboot flash fastboot l-loader.bin
- fastboot flash fip fip.bin
- fastboot flash nvme hisi-nvme.img
- fastboot flash fw_lpm3 hisi-lpm3.img
- fastboot flash trustfirmware hisi-bl31.bin
+ fastboot flash fastboot "${INSTALLER_DIR}"/l-loader.bin
+ fastboot flash fip "${INSTALLER_DIR}"/fip.bin
+ fastboot flash nvme "${INSTALLER_DIR}"/hisi-nvme.img
+ fastboot flash fw_lpm3 "${INSTALLER_DIR}"/hisi-lpm3.img
+ fastboot flash trustfirmware "${INSTALLER_DIR}"/hisi-bl31.bin
fastboot reboot-bootloader
- fastboot flash ptable prm_ptable.img
- fastboot flash xloader hisi-sec_xloader.img
- fastboot flash fastboot l-loader.bin
- fastboot flash fip fip.bin
+ fastboot flash ptable "${INSTALLER_DIR}"/prm_ptable.img
+ fastboot flash xloader "${INSTALLER_DIR}"/hisi-sec_xloader.img
+ fastboot flash fastboot "${INSTALLER_DIR}"/l-loader.bin
+ fastboot flash fip "${INSTALLER_DIR}"/fip.bin
fastboot flash boot "${ANDROID_PRODUCT_OUT}"/boot.img
fastboot flash super "${ANDROID_PRODUCT_OUT}"/super.img
@@ -66,9 +50,9 @@
}
function upgrading_ptable_1mb_aligned () {
- fastboot flash xloader hisi-sec_xloader.img
- fastboot flash ptable hisi-ptable.img
- fastboot flash fastboot hisi-fastboot.img
+ fastboot flash xloader "${INSTALLER_DIR}"/hisi-sec_xloader.img
+ fastboot flash ptable "${INSTALLER_DIR}"/hisi-ptable.img
+ fastboot flash fastboot "${INSTALLER_DIR}"/hisi-fastboot.img
fastboot reboot-bootloader
}
@@ -89,4 +73,3 @@
fi
fastboot reboot
-popd
diff --git a/installer/hikey960/legacy-flash-all.sh b/installer/hikey960/legacy-flash-all.sh
new file mode 100755
index 0000000..3f8bf9b
--- /dev/null
+++ b/installer/hikey960/legacy-flash-all.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+INSTALLER_DIR="`dirname ${0}`"
+
+# for cases that don't run "lunch hikey960-userdebug"
+if [ -z "${ANDROID_BUILD_TOP}" ]; then
+ ANDROID_BUILD_TOP=${INSTALLER_DIR}/../../../../../
+ ANDROID_PRODUCT_OUT="${ANDROID_BUILD_TOP}/out/target/product/hikey960"
+fi
+
+if [ ! -d "${ANDROID_PRODUCT_OUT}" ]; then
+ echo "error in locating out directory, check if it exist"
+ exit
+fi
+
+echo "android out dir:${ANDROID_PRODUCT_OUT}"
+
+fastboot flash xloader "${INSTALLER_DIR}"/hisi-sec_xloader.img
+fastboot flash ptable "${INSTALLER_DIR}"/hisi-ptable.img
+fastboot flash fastboot "${INSTALLER_DIR}"/hisi-fastboot.img
+fastboot reboot-bootloader
+fastboot flash nvme "${INSTALLER_DIR}"/hisi-nvme.img
+fastboot flash fw_lpm3 "${INSTALLER_DIR}"/hisi-lpm3.img
+fastboot flash trustfirmware "${INSTALLER_DIR}"/hisi-bl31.bin
+fastboot flash boot "${ANDROID_PRODUCT_OUT}"/boot.img
+fastboot flash dts "${ANDROID_PRODUCT_OUT}"/dt.img
+fastboot flash super "${ANDROID_PRODUCT_OUT}"/super.img
+fastboot flash userdata "${ANDROID_PRODUCT_OUT}"/userdata.img
+fastboot format:ext4:10000000 cache
+fastboot reboot
diff --git a/installer/hikey960/mkdtimg b/installer/hikey960/mkdtimg
new file mode 100755
index 0000000..33c982e
--- /dev/null
+++ b/installer/hikey960/mkdtimg
@@ -0,0 +1,159 @@
+#!/usr/bin/env python2
+# Copyright 2017, 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.
+from __future__ import print_function
+try:
+ from os import fstat, stat, remove
+ from sys import exit
+ from argparse import ArgumentParser, FileType
+ from ctypes import sizeof, Structure, c_char, c_int
+ from struct import pack, calcsize
+ import zlib
+except Exception as e:
+ print("some module is needed:" + str(e))
+ exit(-1)
+
+dt_head_info_fmt = '4sII'
+dt_entry_fmt = 'Q4I2Q'
+dtimg_version = 1
+dtb_count = 1
+
+def write32(output, value):
+ output.write(chr(value & 255)) ; value=value // 256
+ output.write(chr(value & 255)) ; value=value // 256
+ output.write(chr(value & 255)) ; value=value // 256
+ output.write(chr(value & 255))
+
+def compress(filename, input, output):
+ output.write('\037\213\010')
+ output.write(chr(0))
+
+ statval = stat(filename)
+ write32(output, 0)
+ output.write('\002')
+ output.write('\003')
+
+ crcval = zlib.crc32("")
+ compobj = zlib.compressobj(9, zlib.DEFLATED, -zlib.MAX_WBITS,
+ zlib.DEF_MEM_LEVEL, 0)
+ while True:
+ data = input.read(1024)
+ if data == "":
+ break
+ crcval = zlib.crc32(data, crcval)
+ output.write(compobj.compress(data))
+ output.write(compobj.flush())
+ write32(output, crcval)
+ write32(output, statval.st_size)
+
+def dtb_compress(dtb_file):
+ try:
+ outputname = dtb_file + '.gz'
+ input = open(dtb_file, 'rb')
+ output = open(outputname, 'wb')
+ compress(dtb_file, input, output)
+ input.close()
+ output.close()
+ except Exception as e:
+ print('dtb_compress error:' + str(e))
+ exit(-1)
+ return outputname
+
+class dt_head_info(Structure):
+ _fields_ = [('magic', c_char * 4),
+ ('version', c_int),
+ ('dt_count', c_int)]
+
+class dt_entry_t(Structure):
+ _fields_ = [('dtb_size', c_int),
+ ('dtb_offset', c_int)]
+
+def align_page_size(offset, pagesize):
+ return (pagesize - (offset % pagesize))
+
+def write_head_info(head_info, args):
+ args.output.write(pack(dt_head_info_fmt,
+ head_info.magic,
+ head_info.version,
+ head_info.dt_count))
+
+def write_dtb_entry_t(dt_entry, args):
+ args.output.write(pack(dt_entry_fmt,
+ 0, # reserved
+ dt_entry.dtb_size,
+ 0, # reserved
+ dt_entry.dtb_offset,
+ 0, # reserved
+ 0, # reserved
+ 0)) # reserved
+
+def write_padding(args, padding):
+ for i in range(0, padding):
+ args.output.write('\x00')
+
+def write_dtb(args):
+ dtb_file = args.dtb
+ out_dtb = dtb_file
+ if args.compress == True:
+ out_dtb = dtb_compress(dtb_file)
+ try:
+ dtb_offset = calcsize(dt_head_info_fmt) + \
+ calcsize(dt_entry_fmt) + \
+ 4
+ padding = align_page_size(dtb_offset, args.pagesize)
+ dtb_size = stat(out_dtb).st_size
+ dtb_size_padding = align_page_size(dtb_size, args.pagesize)
+ dt_entry = dt_entry_t(dtb_size + dtb_size_padding,
+ dtb_offset + padding)
+ write_dtb_entry_t(dt_entry, args)
+ args.output.write(pack('I', 0)) # SUCCESS code number
+ write_padding(args, padding)
+ with open(out_dtb, 'rb') as dtb_fd:
+ args.output.write(dtb_fd.read(dtb_size))
+ write_padding(args, dtb_size_padding)
+ except Exception as e:
+ print('write dtb error:' + str(e))
+ exit(-1)
+
+def clean_gz_file(args):
+ try:
+ if args.compress != True:
+ return
+ remove(args.dtb + '.gz')
+ except Exception as e:
+ print('clean gz file error:' + str(e))
+ exit(-1)
+
+def parse_cmdline():
+ parser = ArgumentParser()
+ parser.add_argument('-c', '--compress', help='compress dtb or not',
+ action='store_true')
+ parser.add_argument('-d', '--dtb', help='path to the dtb', type=str,
+ required=True)
+ parser.add_argument('-s', '--pagesize', help='align page size',
+ type=int, choices=[2**i for i in range(11,15)],
+ default=2048)
+ parser.add_argument('-o', '--output', help='output file name',
+ type=FileType('wb'), required=True)
+ return parser.parse_args()
+
+def main():
+ args = parse_cmdline()
+ dtimg_head_info = dt_head_info('HSDT', dtimg_version, dtb_count)
+ write_head_info(dtimg_head_info, args)
+ write_dtb(args)
+ clean_gz_file(args)
+
+if __name__ == '__main__':
+ main()
diff --git a/installer/hikey960/uefi-flash-all.sh b/installer/hikey960/uefi-flash-all.sh
new file mode 100755
index 0000000..347b5b2
--- /dev/null
+++ b/installer/hikey960/uefi-flash-all.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+INSTALLER_DIR="`dirname ${0}`"
+${INSTALLER_DIR}/flash-all.sh
diff --git a/mali/bifrost/APACHE_LICENSE.txt b/mali/bifrost/APACHE_LICENSE.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/mali/bifrost/APACHE_LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
diff --git a/mali/bifrost/Android.bp b/mali/bifrost/Android.bp
new file mode 100644
index 0000000..ad875ed
--- /dev/null
+++ b/mali/bifrost/Android.bp
@@ -0,0 +1,151 @@
+// ANDROIDMK TRANSLATION ERROR: unsupported conditional
+// ifneq ($(filter hikey960, $(TARGET_DEVICE)),)
+
+// *** THIS PACKAGE HAS SPECIAL LICENSING CONDITIONS. PLEASE
+// CONSULT THE OWNERS BEFORE DEPENDING ON IT IN YOUR PROJECT. ***
+soong_namespace {}
+
+package {
+ default_applicable_licenses: ["mali_bifrost_license"],
+}
+
+license_kind {
+ name: "mali_bifrost",
+ conditions: ["proprietary"],
+}
+
+license {
+ name: "mali_bifrost_license",
+ visibility: [":__subpackages__"],
+ license_kinds: ["mali_bifrost"],
+ license_text: [
+ "END_USER_LICENCE_AGREEMENT.txt",
+ ],
+}
+
+cc_prebuilt_library_shared {
+ name: "libGLES_mali",
+ strip: {
+ none: true,
+ },
+ arch: {
+ arm: {
+ srcs: ["lib/egl/libGLES_mali.so"],
+ },
+ arm64: {
+ srcs: ["lib64/egl/libGLES_mali.so"],
+ },
+ },
+ vendor: true,
+ relative_install_path: "egl",
+
+ compile_multilib: "both",
+ shared_libs: [
+ "android.hardware.graphics.common@1.0",
+ "libz",
+ "libnativewindow",
+ "libc++",
+ "liblog",
+ "libm",
+ "libc",
+ "libdl",
+ ],
+}
+
+cc_prebuilt_library_shared {
+ name: "libbccArm",
+ strip: {
+ none: true,
+ },
+ arch: {
+ arm64: {
+ srcs: ["lib64/libbccArm.so"],
+ },
+ },
+ vendor: true,
+ compile_multilib: "64",
+ // Bypass prebuilt ELF check because libLLVM is not a module (it is copied by
+ // PRODUCT_COPY_FILES instead).
+ check_elf_files: false,
+}
+
+cc_prebuilt_library_shared {
+ name: "libRSDriverArm",
+ strip: {
+ none: true,
+ },
+ arch: {
+ arm: {
+ srcs: ["lib/libRSDriverArm.so"],
+ },
+ arm64: {
+ srcs: ["lib64/libRSDriverArm.so"],
+ },
+ },
+ vendor: true,
+ compile_multilib: "both",
+ shared_libs: [
+ "libRS_internal",
+ "libRSCpuRef",
+ "liblog",
+ "libnativewindow",
+ "libbcinfo",
+ "libdl",
+ "libc++",
+ "libc",
+ "libm",
+ ],
+}
+
+cc_prebuilt_library_shared {
+ name: "libmalicore.bc",
+
+ strip: {
+ none: true,
+ },
+ arch: {
+ arm: {
+ srcs: ["lib/libmalicore.bc"],
+ },
+ arm64: {
+ srcs: ["lib64/libmalicore.bc"],
+ },
+ },
+ vendor: true,
+ compile_multilib: "both",
+}
+
+cc_prebuilt_library_shared {
+ name: "vulkan.hikey960",
+
+ strip: {
+ none: true,
+ },
+ arch: {
+ arm: {
+ srcs: ["lib/hw/vulkan.hikey960.so"],
+ },
+ arm64: {
+ srcs: ["lib64/hw/vulkan.hikey960.so"],
+ },
+ },
+ vendor: true,
+ relative_install_path: "hw",
+ compile_multilib: "both",
+ shared_libs: [
+ "android.hardware.graphics.common@1.0",
+ "libz",
+ "libnativewindow",
+ "libc++",
+ "liblog",
+ "libm",
+ "libc",
+ "libdl",
+ ],
+ // Bypass prebuilt ELF check because the DT_SONAME "libGLES_mali.so" is
+ // different from LOCAL_MODULE "vulkan.hikey960.so".
+ check_elf_files: false,
+}
+
+// ANDROIDMK TRANSLATION ERROR: endif from unsupported conditional
+// endif
diff --git a/mali/bifrost/END_USER_LICENCE_AGREEMENT.txt b/mali/bifrost/END_USER_LICENCE_AGREEMENT.txt
new file mode 100644
index 0000000..34da5f8
--- /dev/null
+++ b/mali/bifrost/END_USER_LICENCE_AGREEMENT.txt
@@ -0,0 +1,194 @@
+LES-PRE-20769
+SP-Version: 1.0
+25 November 2015
+
+END USER LICENCE AGREEMENT FOR THE MALI USERSPACE DRIVER ("Mali DRIVER")
+
+THIS END USER LICENCE AGREEMENT ("LICENCE") IS A LEGAL AGREEMENT
+BETWEEN YOU (EITHER A SINGLE INDIVIDUAL, OR SINGLE LEGAL ENTITY) AND
+ARM LIMITED ("ARM") FOR THE USE OF THE SOFTWARE ACCOMPANYING THIS
+LICENCE. ARM IS ONLY WILLING TO LICENSE THE SOFTWARE TO YOU ON
+CONDITION THAT YOU ACCEPT ALL OF THE TERMS IN THIS LICENCE. BY
+INSTALLING OR OTHERWISE USING OR COPYING THE SOFTWARE YOU INDICATE
+THAT YOU AGREE TO BE BOUND BY ALL OF THE TERMS OF THIS LICENCE. IF YOU
+DO NOT AGREE TO THE TERMS OF THIS LICENCE, ARM IS UNWILLING TO LICENSE
+THE SOFTWARE TO YOU AND YOU MAY NOT INSTALL, USE OR COPY THE SOFTWARE,
+AND YOU SHOULD PROMPTLY RETURN THE SOFTWARE TO YOUR SUPPLIER.
+
+"Applications" means applications for use solely in conjunction with
+Mali-based products manufactured under licence from ARM.
+
+"Output" means data resulting from your use of the Software and all
+direct and indirect derivatives thereof.
+
+"Software" means any software, firmware and data accompanying this
+Licence, any printed, electronic or online documentation supplied with
+it under the terms of this Licence for the Mali Driver.
+
+1. LICENCE GRANTS TO YOU.
+
+1.1 ARM hereby grants to you, subject to the terms and conditions of
+this Licence, a non-exclusive, non-transferable, revocable, worldwide
+licence to:
+
+(i) use and copy the Software or certain components or optional
+ functionality in the Software, as applicable, solely for the
+ purposes of running, designing or developing Applications; and
+
+(ii) subject to Clause 1.2, distribute the whole of the Software;
+ and/or (b) the whole or any part of the Software together
+ with, or as incorporated into, Applications; and
+
+1.2 If you choose to redistribute the whole or any part of the
+Software pursuant to the licences granted in Clause 1.1(ii), you
+agree: (i) not to use ARM's or any of its licensors names, logos or
+trademarks to market Applications; (ii) to retain any and all
+copyright notices and other notices (whether ARM's or its licensor's)
+which are included with the Software; and (iii) include a copy of this
+Licence with such redistribution.
+
+2. RESTRICTIONS ON USE OF THE SOFTWARE.
+
+BENCHMARKING: This Licence does not prevent you from using the
+Software for benchmarking purposes. However, you shall ensure that any
+and all benchmarking data relating to the Software, and any other
+results of your use or testing of the Software which are indicative of
+its performance, efficacy, reliability or quality, shall not be used
+to disparage ARM, its products or services, or in a manner that, in
+ARM's reasonable judgment, may diminish or otherwise damage the
+reputation of ARM.
+
+COPYRIGHT AND RESERVATION OF RIGHTS: The Software is owned by ARM or
+its licensors and is protected by copyright and other intellectual
+property laws and international treaties. The Software is licensed not
+sold. You acquire no rights to the Software other than as expressly
+provided by this Licence. You shall not remove from the Software any
+copyright notice or other notice and shall ensure that any such notice
+is reproduced in any copies of the whole or any part of the Software
+made by you or other permitted users.
+
+REVERSE ENGINEERING: Except to the extent that such activity is
+permitted by applicable law you shall not reverse engineer, decompile
+or disassemble any of the Software. If the Software was provided to
+you in Europe you shall not reverse engineer, decompile or disassemble
+any of the Software for the purposes of error correction.
+
+RESTRICTED USE: You agree that you shall not use the Software or the
+Output other than pursuant to and in accordance with the exercise of
+any of the licences granted under this Licence. Without limiting the
+generality of the foregoing, you shall not use the Software or any
+Output: (a) for determining if any features, functions or processes
+provided by the Software are covered by any patents or patent
+applications owned by you or a third party; or (b) for developing
+technology, applications or products which avoid any of ARM's
+intellectual property in the Software licensed hereunder; or (c) as a
+reference for modifying existing patents or patent applications or
+creating any continuation, continuation in part, or extension of
+existing patents or patent applications.
+
+3. SUPPORT.
+
+ARM is not under an obligation to provide support, but it may do so at
+its own discretion, and if it does, it will only be in respect of the
+Software as delivered.
+
+4. NO WARRANTIES.
+
+YOU AGREE THAT THE SOFTWARE IS LICENSED "AS IS", AND THAT ARM
+EXPRESSLY DISCLAIMS ALL REPRESENTATIONS, WARRANTIES, CONDITIONS OR
+OTHER TERMS, EXPRESS OR IMPLIED OR STATUTORY, INCLUDING WITHOUT
+LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, SATISFACTORY
+QUALITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+
+YOU EXPRESSLY ASSUME ALL LIABILITIES AND RISKS, FOR USE OR OPERATION
+OF APPLICATIONS, INCLUDING WITHOUT LIMITATION, APPLICATIONS DESIGNED
+OR INTENDED FOR MISSION CRITICAL APPLICATIONS, SUCH AS PACEMAKERS,
+WEAPONRY, AIRCRAFT NAVIGATION, FACTORY CONTROL SYSTEMS, ETC. SHOULD
+THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE ENTIRE COST OF ALL
+NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+5. LIMITATION OF LIABILITY.
+
+TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL
+ARM BE LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
+DAMAGES (INCLUDING LOSS OF PROFITS) ARISING OUT OF THE USE OR
+INABILITY TO USE THE SOFTWARE WHETHER BASED ON A CLAIM UNDER CONTRACT,
+TORT OR OTHER LEGAL THEORY, EVEN IF ARM WAS ADVISED OF THE POSSIBILITY
+OF SUCH DAMAGES.
+
+ARM does not seek to limit or exclude liability for death or personal
+injury arising from ARM's negligence or ARM's fraud and because some
+jurisdictions do not permit the exclusion or limitation of liability
+for consequential or incidental damages the above limitation relating
+to liability for consequential damages may not apply to you.
+
+NOTWITHSTANDING ANYTHING TO THE CONTRARY CONTAINED IN THIS LICENCE,
+THE MAXIMUM LIABILITY OF ARM TO YOU IN AGGREGATE FOR ALL CLAIMS MADE
+AGAINST ARM IN CONTRACT TORT OR OTHERWISE UNDER OR IN CONNECTION WITH
+THE SUBJECT MATTER OF THIS LICENCE SHALL NOT EXCEED THE GREATER OF:
+(I) THE TOTAL OF SUMS PAID BY YOU TO ARM (IF ANY) FOR THIS LICENCE;
+AND (II) $10.00 USD. THE EXISTENCE OF MORE THAN ONE CLAIM WILL NOT
+ENLARGE OR EXTEND THE LIMIT.
+
+6. U.S. GOVERNMENT END USERS.
+
+US Government Restrictions: Use, duplication, reproduction, release,
+modification, disclosure or transfer of the Software is restricted in
+accordance with the terms of this Licence.
+
+7. TERM AND TERMINATION.
+
+This Licence shall remain in force until terminated by you or by ARM.
+Without prejudice to any of its other rights if you are in breach of
+any of the terms and conditions of this Licence then ARM may terminate
+this Licence immediately upon giving written notice to you or on
+thirty (30) days written notice without cause. You may terminate this
+Licence at any time. Upon termination of this Licence by you or by ARM
+, you shall stop using the Software and destroy all copies of the
+Software in your possession, together with all documentation and
+related materials. The provisions of clauses 2, 3, 4, 5, 6, 7, and 8
+shall survive termination of this Licence.
+
+8. GENERAL.
+
+This Licence is governed by English Law. Except where ARM agrees
+otherwise in: (i) a written contract signed by you and ARM; or (ii) a
+written contract provided by ARM and accepted by you, this is the only
+agreement between you and ARM relating to the Software and it may only
+be modified by written agreement between you and ARM. Except as
+expressly agreed in writing, this Licence may not be modified by
+purchase orders, advertising or other representation by any person. If
+any clause or sentence in this Licence is held by a court of law to be
+illegal or unenforceable the remaining provisions of this Licence
+shall not be affected thereby. The failure by ARM to enforce any of
+the provisions of this Licence, unless waived in writing, shall not
+constitute a waiver of ARM's rights to enforce such provision or any
+other provision of this Licence in the future.
+
+At ARM's request, you agree to check your computers for installations
+of the Software and any other information requested by ARM relating to
+Software installation and to provide this information to ARM. You
+agree that auditors nominated by ARM may also perform such checking
+and reporting on behalf of ARM by prior appointment during your normal
+business hours on seven (7) days' notice. ARM shall bear the auditors'
+costs for that audit unless it reveals unlicensed usage in which case
+you shall promptly reimburse ARM for all reasonable costs and
+expenses, including professional fees, relating to such audit. Any
+information which is disclosed to ARM or such auditors during checking
+or audit shall be treated as your confidential information and shall
+only be used by ARM for licence management, compliance and enforcement
+purposes.
+
+The Software provided under this Agreement is subject to U.K.,
+European Union, and U.S. export control laws and regulations,
+including the U.S. Export Administration Act and its associated
+regulations (hereafter collectively referred to as "Export
+Regulations"). LICENSEE agrees to comply fully with all such Export
+Regulations and LICENSEE agrees that it shall not, either directly or
+indirectly, export in breach of the Export Regulations, any Software
+received under this Agreement, nor any direct products thereof; (i) to
+any country, company or person subject to export restrictions or
+sanctions under the Export Regulations; or (ii) for any prohibited end
+use, which at the time of export requires an export license or other
+governmental approval, without first obtaining such license or
+approval.
diff --git a/mali/bifrost/bin/bcc b/mali/bifrost/bin/bcc
new file mode 100755
index 0000000..c828bca
--- /dev/null
+++ b/mali/bifrost/bin/bcc
Binary files differ
diff --git a/mali/bifrost/lib/egl/libGLES_mali.so b/mali/bifrost/lib/egl/libGLES_mali.so
new file mode 100755
index 0000000..092d472
--- /dev/null
+++ b/mali/bifrost/lib/egl/libGLES_mali.so
Binary files differ
diff --git a/mali/bifrost/lib/hw/vulkan.hikey960.so b/mali/bifrost/lib/hw/vulkan.hikey960.so
new file mode 120000
index 0000000..57c186c
--- /dev/null
+++ b/mali/bifrost/lib/hw/vulkan.hikey960.so
@@ -0,0 +1 @@
+../egl/libGLES_mali.so
\ No newline at end of file
diff --git a/mali/bifrost/lib/libRSDriverArm.so b/mali/bifrost/lib/libRSDriverArm.so
new file mode 100755
index 0000000..721e324
--- /dev/null
+++ b/mali/bifrost/lib/libRSDriverArm.so
Binary files differ
diff --git a/mali/bifrost/lib/libclcore.bc b/mali/bifrost/lib/libclcore.bc
new file mode 100644
index 0000000..ee0429a
--- /dev/null
+++ b/mali/bifrost/lib/libclcore.bc
Binary files differ
diff --git a/mali/bifrost/lib/libclcore_neon.bc b/mali/bifrost/lib/libclcore_neon.bc
new file mode 100644
index 0000000..ce3da69
--- /dev/null
+++ b/mali/bifrost/lib/libclcore_neon.bc
Binary files differ
diff --git a/mali/bifrost/lib/libmalicore.bc b/mali/bifrost/lib/libmalicore.bc
new file mode 100644
index 0000000..5901017
--- /dev/null
+++ b/mali/bifrost/lib/libmalicore.bc
Binary files differ
diff --git a/mali/bifrost/lib64/egl/libGLES_mali.so b/mali/bifrost/lib64/egl/libGLES_mali.so
new file mode 100755
index 0000000..19c41f1
--- /dev/null
+++ b/mali/bifrost/lib64/egl/libGLES_mali.so
Binary files differ
diff --git a/mali/bifrost/lib64/hw/vulkan.hikey960.so b/mali/bifrost/lib64/hw/vulkan.hikey960.so
new file mode 120000
index 0000000..57c186c
--- /dev/null
+++ b/mali/bifrost/lib64/hw/vulkan.hikey960.so
@@ -0,0 +1 @@
+../egl/libGLES_mali.so
\ No newline at end of file
diff --git a/mali/bifrost/lib64/libLLVM.so b/mali/bifrost/lib64/libLLVM.so
new file mode 100755
index 0000000..894b1d1
--- /dev/null
+++ b/mali/bifrost/lib64/libLLVM.so
Binary files differ
diff --git a/mali/bifrost/lib64/libRSDriverArm.so b/mali/bifrost/lib64/libRSDriverArm.so
new file mode 100755
index 0000000..0a10776
--- /dev/null
+++ b/mali/bifrost/lib64/libRSDriverArm.so
Binary files differ
diff --git a/mali/bifrost/lib64/libbcc.so b/mali/bifrost/lib64/libbcc.so
new file mode 100755
index 0000000..b95b141
--- /dev/null
+++ b/mali/bifrost/lib64/libbcc.so
Binary files differ
diff --git a/mali/bifrost/lib64/libbccArm.so b/mali/bifrost/lib64/libbccArm.so
new file mode 100755
index 0000000..7fe1dfd
--- /dev/null
+++ b/mali/bifrost/lib64/libbccArm.so
Binary files differ
diff --git a/mali/bifrost/lib64/libclcore.bc b/mali/bifrost/lib64/libclcore.bc
new file mode 100644
index 0000000..ca3d10b
--- /dev/null
+++ b/mali/bifrost/lib64/libclcore.bc
Binary files differ
diff --git a/mali/bifrost/lib64/libmalicore.bc b/mali/bifrost/lib64/libmalicore.bc
new file mode 100644
index 0000000..f8c6d71
--- /dev/null
+++ b/mali/bifrost/lib64/libmalicore.bc
Binary files differ
diff --git a/mali/utgard/Android.bp b/mali/utgard/Android.bp
new file mode 100644
index 0000000..4222971
--- /dev/null
+++ b/mali/utgard/Android.bp
@@ -0,0 +1,47 @@
+// *** THIS PACKAGE HAS SPECIAL LICENSING CONDITIONS. PLEASE
+// CONSULT THE OWNERS BEFORE DEPENDING ON IT IN YOUR PROJECT. ***
+soong_namespace {}
+
+package {
+ default_applicable_licenses: ["mali_utgard_license"],
+}
+
+license_kind {
+ name: "mali_utgard",
+ conditions: ["proprietary"],
+}
+
+license {
+ name: "mali_utgard_license",
+ visibility: [":__subpackages__"],
+ license_kinds: ["mali_utgard"],
+ license_text: [
+ "END_USER_LICENCE_AGREEMENT.txt",
+ ],
+}
+
+cc_prebuilt_library_shared {
+ name: "libGLES_mali",
+ strip: {
+ none: true,
+ },
+ arch: {
+ arm: {
+ srcs: ["lib/egl/libGLES_mali.so"],
+ },
+ arm64: {
+ srcs: ["lib64/egl/libGLES_mali.so"],
+ },
+ },
+ vendor: true,
+ relative_install_path: "egl",
+
+ compile_multilib: "both",
+ shared_libs: [
+ "libc++",
+ "libc",
+ "libdl",
+ "liblog",
+ "libm",
+ ],
+}
diff --git a/mali/utgard/Android.mk.old b/mali/utgard/Android.mk.old
new file mode 100644
index 0000000..c7afa7b
--- /dev/null
+++ b/mali/utgard/Android.mk.old
@@ -0,0 +1,30 @@
+ifneq ($(filter hikey hikey64 hikey32, $(TARGET_DEVICE)),)
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := END_USER_LICENCE_AGREEMENT.txt
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
+LOCAL_LICENSE_CONDITIONS := notice
+LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+LOCAL_STRIP_MODULE := false
+LOCAL_SRC_FILES_arm := $(LOCAL_MODULE)
+LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)
+LOCAL_MULTILIB := 32
+LOCAL_SHARED_LIBRARIES := libc++ libc libdl liblog libm
+include $(BUILD_PREBUILT)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libGLES_mali.so
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
+LOCAL_LICENSE_CONDITIONS := notice
+LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+LOCAL_STRIP_MODULE := false
+LOCAL_SRC_FILES_arm := lib/egl/$(LOCAL_MODULE)
+LOCAL_SRC_FILES_arm64 := lib64/egl/$(LOCAL_MODULE)
+LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib/egl/
+LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64/egl/
+LOCAL_MULTILIB := both
+LOCAL_SHARED_LIBRARIES := libc++ libc libdl liblog libm
+include $(BUILD_PREBUILT)
+
+endif
diff --git a/mali/utgard/END_USER_LICENCE_AGREEMENT.txt b/mali/utgard/END_USER_LICENCE_AGREEMENT.txt
new file mode 100644
index 0000000..34da5f8
--- /dev/null
+++ b/mali/utgard/END_USER_LICENCE_AGREEMENT.txt
@@ -0,0 +1,194 @@
+LES-PRE-20769
+SP-Version: 1.0
+25 November 2015
+
+END USER LICENCE AGREEMENT FOR THE MALI USERSPACE DRIVER ("Mali DRIVER")
+
+THIS END USER LICENCE AGREEMENT ("LICENCE") IS A LEGAL AGREEMENT
+BETWEEN YOU (EITHER A SINGLE INDIVIDUAL, OR SINGLE LEGAL ENTITY) AND
+ARM LIMITED ("ARM") FOR THE USE OF THE SOFTWARE ACCOMPANYING THIS
+LICENCE. ARM IS ONLY WILLING TO LICENSE THE SOFTWARE TO YOU ON
+CONDITION THAT YOU ACCEPT ALL OF THE TERMS IN THIS LICENCE. BY
+INSTALLING OR OTHERWISE USING OR COPYING THE SOFTWARE YOU INDICATE
+THAT YOU AGREE TO BE BOUND BY ALL OF THE TERMS OF THIS LICENCE. IF YOU
+DO NOT AGREE TO THE TERMS OF THIS LICENCE, ARM IS UNWILLING TO LICENSE
+THE SOFTWARE TO YOU AND YOU MAY NOT INSTALL, USE OR COPY THE SOFTWARE,
+AND YOU SHOULD PROMPTLY RETURN THE SOFTWARE TO YOUR SUPPLIER.
+
+"Applications" means applications for use solely in conjunction with
+Mali-based products manufactured under licence from ARM.
+
+"Output" means data resulting from your use of the Software and all
+direct and indirect derivatives thereof.
+
+"Software" means any software, firmware and data accompanying this
+Licence, any printed, electronic or online documentation supplied with
+it under the terms of this Licence for the Mali Driver.
+
+1. LICENCE GRANTS TO YOU.
+
+1.1 ARM hereby grants to you, subject to the terms and conditions of
+this Licence, a non-exclusive, non-transferable, revocable, worldwide
+licence to:
+
+(i) use and copy the Software or certain components or optional
+ functionality in the Software, as applicable, solely for the
+ purposes of running, designing or developing Applications; and
+
+(ii) subject to Clause 1.2, distribute the whole of the Software;
+ and/or (b) the whole or any part of the Software together
+ with, or as incorporated into, Applications; and
+
+1.2 If you choose to redistribute the whole or any part of the
+Software pursuant to the licences granted in Clause 1.1(ii), you
+agree: (i) not to use ARM's or any of its licensors names, logos or
+trademarks to market Applications; (ii) to retain any and all
+copyright notices and other notices (whether ARM's or its licensor's)
+which are included with the Software; and (iii) include a copy of this
+Licence with such redistribution.
+
+2. RESTRICTIONS ON USE OF THE SOFTWARE.
+
+BENCHMARKING: This Licence does not prevent you from using the
+Software for benchmarking purposes. However, you shall ensure that any
+and all benchmarking data relating to the Software, and any other
+results of your use or testing of the Software which are indicative of
+its performance, efficacy, reliability or quality, shall not be used
+to disparage ARM, its products or services, or in a manner that, in
+ARM's reasonable judgment, may diminish or otherwise damage the
+reputation of ARM.
+
+COPYRIGHT AND RESERVATION OF RIGHTS: The Software is owned by ARM or
+its licensors and is protected by copyright and other intellectual
+property laws and international treaties. The Software is licensed not
+sold. You acquire no rights to the Software other than as expressly
+provided by this Licence. You shall not remove from the Software any
+copyright notice or other notice and shall ensure that any such notice
+is reproduced in any copies of the whole or any part of the Software
+made by you or other permitted users.
+
+REVERSE ENGINEERING: Except to the extent that such activity is
+permitted by applicable law you shall not reverse engineer, decompile
+or disassemble any of the Software. If the Software was provided to
+you in Europe you shall not reverse engineer, decompile or disassemble
+any of the Software for the purposes of error correction.
+
+RESTRICTED USE: You agree that you shall not use the Software or the
+Output other than pursuant to and in accordance with the exercise of
+any of the licences granted under this Licence. Without limiting the
+generality of the foregoing, you shall not use the Software or any
+Output: (a) for determining if any features, functions or processes
+provided by the Software are covered by any patents or patent
+applications owned by you or a third party; or (b) for developing
+technology, applications or products which avoid any of ARM's
+intellectual property in the Software licensed hereunder; or (c) as a
+reference for modifying existing patents or patent applications or
+creating any continuation, continuation in part, or extension of
+existing patents or patent applications.
+
+3. SUPPORT.
+
+ARM is not under an obligation to provide support, but it may do so at
+its own discretion, and if it does, it will only be in respect of the
+Software as delivered.
+
+4. NO WARRANTIES.
+
+YOU AGREE THAT THE SOFTWARE IS LICENSED "AS IS", AND THAT ARM
+EXPRESSLY DISCLAIMS ALL REPRESENTATIONS, WARRANTIES, CONDITIONS OR
+OTHER TERMS, EXPRESS OR IMPLIED OR STATUTORY, INCLUDING WITHOUT
+LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, SATISFACTORY
+QUALITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+
+YOU EXPRESSLY ASSUME ALL LIABILITIES AND RISKS, FOR USE OR OPERATION
+OF APPLICATIONS, INCLUDING WITHOUT LIMITATION, APPLICATIONS DESIGNED
+OR INTENDED FOR MISSION CRITICAL APPLICATIONS, SUCH AS PACEMAKERS,
+WEAPONRY, AIRCRAFT NAVIGATION, FACTORY CONTROL SYSTEMS, ETC. SHOULD
+THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE ENTIRE COST OF ALL
+NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+5. LIMITATION OF LIABILITY.
+
+TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL
+ARM BE LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
+DAMAGES (INCLUDING LOSS OF PROFITS) ARISING OUT OF THE USE OR
+INABILITY TO USE THE SOFTWARE WHETHER BASED ON A CLAIM UNDER CONTRACT,
+TORT OR OTHER LEGAL THEORY, EVEN IF ARM WAS ADVISED OF THE POSSIBILITY
+OF SUCH DAMAGES.
+
+ARM does not seek to limit or exclude liability for death or personal
+injury arising from ARM's negligence or ARM's fraud and because some
+jurisdictions do not permit the exclusion or limitation of liability
+for consequential or incidental damages the above limitation relating
+to liability for consequential damages may not apply to you.
+
+NOTWITHSTANDING ANYTHING TO THE CONTRARY CONTAINED IN THIS LICENCE,
+THE MAXIMUM LIABILITY OF ARM TO YOU IN AGGREGATE FOR ALL CLAIMS MADE
+AGAINST ARM IN CONTRACT TORT OR OTHERWISE UNDER OR IN CONNECTION WITH
+THE SUBJECT MATTER OF THIS LICENCE SHALL NOT EXCEED THE GREATER OF:
+(I) THE TOTAL OF SUMS PAID BY YOU TO ARM (IF ANY) FOR THIS LICENCE;
+AND (II) $10.00 USD. THE EXISTENCE OF MORE THAN ONE CLAIM WILL NOT
+ENLARGE OR EXTEND THE LIMIT.
+
+6. U.S. GOVERNMENT END USERS.
+
+US Government Restrictions: Use, duplication, reproduction, release,
+modification, disclosure or transfer of the Software is restricted in
+accordance with the terms of this Licence.
+
+7. TERM AND TERMINATION.
+
+This Licence shall remain in force until terminated by you or by ARM.
+Without prejudice to any of its other rights if you are in breach of
+any of the terms and conditions of this Licence then ARM may terminate
+this Licence immediately upon giving written notice to you or on
+thirty (30) days written notice without cause. You may terminate this
+Licence at any time. Upon termination of this Licence by you or by ARM
+, you shall stop using the Software and destroy all copies of the
+Software in your possession, together with all documentation and
+related materials. The provisions of clauses 2, 3, 4, 5, 6, 7, and 8
+shall survive termination of this Licence.
+
+8. GENERAL.
+
+This Licence is governed by English Law. Except where ARM agrees
+otherwise in: (i) a written contract signed by you and ARM; or (ii) a
+written contract provided by ARM and accepted by you, this is the only
+agreement between you and ARM relating to the Software and it may only
+be modified by written agreement between you and ARM. Except as
+expressly agreed in writing, this Licence may not be modified by
+purchase orders, advertising or other representation by any person. If
+any clause or sentence in this Licence is held by a court of law to be
+illegal or unenforceable the remaining provisions of this Licence
+shall not be affected thereby. The failure by ARM to enforce any of
+the provisions of this Licence, unless waived in writing, shall not
+constitute a waiver of ARM's rights to enforce such provision or any
+other provision of this Licence in the future.
+
+At ARM's request, you agree to check your computers for installations
+of the Software and any other information requested by ARM relating to
+Software installation and to provide this information to ARM. You
+agree that auditors nominated by ARM may also perform such checking
+and reporting on behalf of ARM by prior appointment during your normal
+business hours on seven (7) days' notice. ARM shall bear the auditors'
+costs for that audit unless it reveals unlicensed usage in which case
+you shall promptly reimburse ARM for all reasonable costs and
+expenses, including professional fees, relating to such audit. Any
+information which is disclosed to ARM or such auditors during checking
+or audit shall be treated as your confidential information and shall
+only be used by ARM for licence management, compliance and enforcement
+purposes.
+
+The Software provided under this Agreement is subject to U.K.,
+European Union, and U.S. export control laws and regulations,
+including the U.S. Export Administration Act and its associated
+regulations (hereafter collectively referred to as "Export
+Regulations"). LICENSEE agrees to comply fully with all such Export
+Regulations and LICENSEE agrees that it shall not, either directly or
+indirectly, export in breach of the Export Regulations, any Software
+received under this Agreement, nor any direct products thereof; (i) to
+any country, company or person subject to export restrictions or
+sanctions under the Export Regulations; or (ii) for any prohibited end
+use, which at the time of export requires an export license or other
+governmental approval, without first obtaining such license or
+approval.
diff --git a/mali/utgard/lib/egl/libGLES_mali.so b/mali/utgard/lib/egl/libGLES_mali.so
new file mode 100755
index 0000000..f86da7e
--- /dev/null
+++ b/mali/utgard/lib/egl/libGLES_mali.so
Binary files differ
diff --git a/mali/utgard/lib64/egl/libGLES_mali.so b/mali/utgard/lib64/egl/libGLES_mali.so
new file mode 100755
index 0000000..5c0af47
--- /dev/null
+++ b/mali/utgard/lib64/egl/libGLES_mali.so
Binary files differ
diff --git a/vendor-package-ver.mk b/vendor-package-ver.mk
deleted file mode 100644
index be369eb..0000000
--- a/vendor-package-ver.mk
+++ /dev/null
@@ -1,4 +0,0 @@
-HELPER_SCRIPT=./device/linaro/hikey/vendor-package-ver.sh
-EXPECTED_LINARO_VENDOR_VERSION := $(shell $(HELPER_SCRIPT) ver)
-VND_PKG_URL := $(shell $(HELPER_SCRIPT) url)
-LINARO_VENDOR_PATH := vendor/linaro/
diff --git a/vendor-package-ver.sh b/vendor-package-ver.sh
deleted file mode 100755
index 85e9251..0000000
--- a/vendor-package-ver.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-
-export EXPECTED_LINARO_VENDOR_VERSION=20230510
-#make sure to use sha512sum here
-export EXPECTED_LINARO_VENDOR_SHA=37aebd6fef4294226293ebe1945bd7a327b2653aaa8b294578d5a00141c1717f3aeb9b1b1832157d894193dd836e8c783b3fe0b4674aa9bd69fee3555d4ec0c3
-export VND_PKG_URL=https://releases.linaro.org/android/aosp-linaro-vendor-package/extract-linaro_devices-20230510.tgz
-
-if [ "$1" = "url" ]; then
- echo $VND_PKG_URL
-elif [ "$1" = "ver" ]; then
- echo $EXPECTED_LINARO_VENDOR_VERSION
-elif [ "$1" = "sha" ]; then
- echo $EXPECTED_LINARO_VENDOR_SHA
-fi