--- /dev/null
+#!/bin/sh
+
+PRODUCT_OUT=${OUT}
+SOURCE_CODE=utgard/r10p0
+MESON_GPU_DIR=./
+PREFIX_CROSS_COMPILE=/opt/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
+KERNEL_ARCH=arm64
+GPU_MODS_OUT=obj/lib_vendor/
+
+ rm ${PRODUCT_OUT}/obj/mali -rf
+ mkdir -p ${PRODUCT_OUT}/obj/mali
+ cp ${SOURCE_CODE}/* ${PRODUCT_OUT}/obj/mali -airf
+ cp ${MESON_GPU_DIR}/utgard/platform ${PRODUCT_OUT}/obj/mali/ -airf
+ echo "make mali module KERNEL_ARCH is ${KERNEL_ARCH}"
+ echo "make mali module MALI_OUT is ${PRODUCT_OUT}/obj/mali ${MALI_OUT}"
+ PATH=${TARGET_HOST_TOOL_PATH}:$PATH
+ make -C ${PRODUCT_OUT}/obj/KERNEL_OBJ M=${PRODUCT_OUT}/obj/mali \
+ ARCH=${KERNEL_ARCH} CROSS_COMPILE=${PREFIX_CROSS_COMPILE} CONFIG_MALI400=m CONFIG_MALI450=m \
+ CONFIG_MALI_DMA_BUF_LAZY_MAP=y \
+ EXTRA_CFLAGS="-DCONFIG_MALI400=m -DCONFIG_MALI450=m -DCONFIG_MALI_DMA_BUF_LAZY_MAP=y" \
+ EXTRA_LDFLAGS+="--strip-debug" \
+ CONFIG_AM_VDEC_H264_4K2K=y 2>&1 | tee mali.txt
+
+ echo "GPU_MODS_OUT is ${GPU_MODS_OUT}"
+ mkdir -p ${PRODUCT_OUT}/${GPU_MODS_OUT}
+ cp ${PRODUCT_OUT}/obj/mali/mali.ko ${PRODUCT_OUT}/${GPU_MODS_OUT}/mali.ko
+
+ cp ${PRODUCT_OUT}/${GPU_MODS_OUT}/mali.ko ${PRODUCT_OUT}/obj/lib_vendor/mali.ko
+ echo "${GPU_ARCH}.ko build finished"
+
+exit
#define MALI_IOC_MEM_QUERY_MMU_PAGE_TABLE_DUMP_SIZE _IOR (MALI_IOC_MEMORY_BASE, _MALI_UK_QUERY_MMU_PAGE_TABLE_DUMP_SIZE, _mali_uk_query_mmu_page_table_dump_size_s)
#define MALI_IOC_MEM_DUMP_MMU_PAGE_TABLE _IOWR(MALI_IOC_MEMORY_BASE, _MALI_UK_DUMP_MMU_PAGE_TABLE, _mali_uk_dump_mmu_page_table_s)
#define MALI_IOC_MEM_WRITE_SAFE _IOWR(MALI_IOC_MEMORY_BASE, _MALI_UK_MEM_WRITE_SAFE, _mali_uk_mem_write_safe_s)
+#define MALI_IOC_MESON_UPDATE_VIDEO_TEXTURE _IOWR(MALI_IOC_MEMORY_BASE, _MALI_UK_MESON_UPDATE_VIDEO_TEXTURE, _meson_update_video_texture_s)
#define MALI_IOC_PP_START_JOB _IOWR(MALI_IOC_PP_BASE, _MALI_UK_PP_START_JOB, _mali_uk_pp_start_job_s)
#define MALI_IOC_PP_AND_GP_START_JOB _IOWR(MALI_IOC_PP_BASE, _MALI_UK_PP_AND_GP_START_JOB, _mali_uk_pp_and_gp_start_job_s)
_MALI_UK_DUMP_MMU_PAGE_TABLE, /**< _mali_ukk_mem_dump_mmu_page_table() */
_MALI_UK_DMA_BUF_GET_SIZE, /**< _mali_ukk_dma_buf_get_size() */
_MALI_UK_MEM_WRITE_SAFE, /**< _mali_uku_mem_write_safe() */
+ _MALI_UK_MESON_UPDATE_VIDEO_TEXTURE, /**< _mali_uku_meson_update_video_texture() */
/** Common functions for each core */
u32 vaddr; /**< [in] identifier for mapped memory object in kernel space */
} _mali_uk_unbind_mem_s;
+typedef struct {
+ u64 ctx; /**< [in,out] user-kernel context (trashed on output) */
+ s32 fd; /**< [in] dma fd */
+} _meson_update_video_texture_s;
+
typedef struct {
u64 ctx; /**< [in,out] user-kernel context (trashed on output) */
u32 target_handle; /**< [in] handle of allocation need to do COW */
err = mem_free_wrapper(session_data, (_mali_uk_free_mem_s __user *)arg);
break;
+ case MALI_IOC_MESON_UPDATE_VIDEO_TEXTURE:
+ BUILD_BUG_ON(!IS_ALIGNED(sizeof(_meson_update_video_texture_s), sizeof(s32)));
+ err = meson_mem_start_wrapper(session_data, (_meson_update_video_texture_s __user *)arg);
+ break;
+
case MALI_IOC_MEM_BIND:
BUILD_BUG_ON(!IS_ALIGNED(sizeof(_mali_uk_bind_mem_s), sizeof(u64)));
err = mem_bind_wrapper(session_data, (_mali_uk_bind_mem_s __user *)arg);
_mali_osk_free(mem);
mali_session_memory_unlock(session);
}
+
+_mali_osk_errcode_t meson_update_video_texture(struct mali_session_data *session, int fd)
+{
+ struct dma_buf *buf;
+ struct dma_buf_attachment *attachment;
+ struct sg_table *sgt;
+ _mali_osk_errcode_t ret = _MALI_OSK_ERR_OK;
+
+ /* get dma buffer */
+ buf = dma_buf_get(fd);
+ if (IS_ERR_OR_NULL(buf)) {
+ return _MALI_OSK_ERR_FAULT;
+ }
+
+ attachment = dma_buf_attach(buf, &mali_platform_device->dev);
+ if (NULL == attachment) {
+ ret = _MALI_OSK_ERR_FAULT;
+ goto failed_dma_attach;
+ }
+
+ sgt = dma_buf_map_attachment(attachment, DMA_BIDIRECTIONAL);
+ if (IS_ERR_OR_NULL(sgt)) {
+ MALI_DEBUG_PRINT_ERROR(("Failed to map dma-buf attachment\n"));
+ ret = _MALI_OSK_ERR_FAULT;
+ return -EFAULT;
+ }
+
+ dma_buf_unmap_attachment(attachment, sgt, DMA_BIDIRECTIONAL);
+ sgt = NULL;
+
+ dma_buf_detach(buf, attachment);
+failed_dma_attach:
+ dma_buf_put(buf);
+
+ return ret;
+}
int mali_dma_buf_get_size(struct mali_session_data *session, _mali_uk_dma_buf_get_size_s __user *arg);
void mali_mem_unbind_dma_buf(mali_mem_backend *mem_backend);
+_mali_osk_errcode_t meson_update_video_texture(struct mali_session_data *session, int fd);
_mali_osk_errcode_t mali_mem_bind_dma_buf(mali_mem_allocation *alloc,
mali_mem_backend *mem_backend,
return _MALI_OSK_ERR_OK;
}
+_mali_osk_errcode_t _meson_update_video_texture(_meson_update_video_texture_s *args)
+{
+ struct mali_session_data *session = (struct mali_session_data *)(uintptr_t)args->ctx;
+ int fd = args->fd;
+
+ return meson_update_video_texture(session, fd);
+}
+
/*
* Function _mali_ukk_mem_cow -- COW for an allocation
* This function allocate new pages for a range (range, range+size) of allocation
_mali_osk_errcode_t _mali_ukk_mem_free(_mali_uk_free_mem_s *args);
_mali_osk_errcode_t _mali_ukk_mem_bind(_mali_uk_bind_mem_s *args);
_mali_osk_errcode_t _mali_ukk_mem_unbind(_mali_uk_unbind_mem_s *args);
+_mali_osk_errcode_t _meson_update_video_texture(_meson_update_video_texture_s *args);
_mali_osk_errcode_t _mali_ukk_mem_cow(_mali_uk_cow_mem_s *args);
_mali_osk_errcode_t _mali_ukk_mem_cow_modify_range(_mali_uk_cow_modify_range_s *args);
_mali_osk_errcode_t _mali_ukk_mem_usage_get(_mali_uk_profiling_memory_usage_get_s *args);
return 0;
}
+int meson_mem_start_wrapper(struct mali_session_data *session_data, _meson_update_video_texture_s __user *uargs)
+{
+ _meson_update_video_texture_s kargs;
+ _mali_osk_errcode_t err;
+
+ MALI_CHECK_NON_NULL(uargs, -EINVAL);
+ MALI_CHECK_NON_NULL(session_data, -EINVAL);
+
+ if (0 != copy_from_user(&kargs, uargs, sizeof(_meson_update_video_texture_s))) {
+ return -EFAULT;
+ }
+ kargs.ctx = (uintptr_t)session_data;
+
+ err = _meson_update_video_texture(&kargs);
+
+ if (_MALI_OSK_ERR_OK != err) {
+ return map_errcode(err);
+ }
+
+ return 0;
+}
+
int mem_bind_wrapper(struct mali_session_data *session_data, _mali_uk_bind_mem_s __user *uargs)
{
_mali_uk_bind_mem_s kargs;
int mem_alloc_wrapper(struct mali_session_data *session_data, _mali_uk_alloc_mem_s __user *uargs);
int mem_free_wrapper(struct mali_session_data *session_data, _mali_uk_free_mem_s __user *uargs);
+int meson_mem_start_wrapper(struct mali_session_data *session_data, _meson_update_video_texture_s __user *uargs);
int mem_bind_wrapper(struct mali_session_data *session_data, _mali_uk_bind_mem_s __user *uargs);
int mem_unbind_wrapper(struct mali_session_data *session_data, _mali_uk_unbind_mem_s __user *uargs);
int mem_cow_wrapper(struct mali_session_data *session_data, _mali_uk_cow_mem_s __user *uargs);