diff options
-rw-r--r-- | camera/Android.mk | 5 | ||||
-rw-r--r-- | camera/MemoryManager.cpp | 2 | ||||
-rw-r--r-- | domx/domx/Android.mk | 2 | ||||
-rw-r--r-- | domx/domx/omx_proxy_common/src/omx_proxy_common.c | 2 | ||||
-rw-r--r-- | domx/omx_proxy_component/Android.mk | 3 | ||||
-rwxr-xr-x | domx/omx_proxy_component/omx_camera/src/omx_proxy_camera.c | 2 | ||||
-rw-r--r-- | ion/Android.mk | 13 | ||||
-rw-r--r-- | ion/ion.c | 156 | ||||
-rw-r--r-- | ion/ion.h | 35 | ||||
-rw-r--r-- | ion/linux_ion.h | 66 | ||||
-rw-r--r-- | ion/omap_ion.h | 59 | ||||
-rw-r--r-- | libdrmdecrypt/Android.mk | 32 | ||||
-rw-r--r-- | omap4.mk | 3 |
13 files changed, 339 insertions, 41 deletions
diff --git a/camera/Android.mk b/camera/Android.mk index 1d7e048..f1d7cb4 100644 --- a/camera/Android.mk +++ b/camera/Android.mk @@ -59,6 +59,7 @@ LOCAL_C_INCLUDES += \ $(LOCAL_PATH)/inc/OMXCameraAdapter \ $(LOCAL_PATH)/../libtiutils \ hardware/ti/omap4xxx/tiler \ + hardware/ti/omap4xxx/ion \ hardware/ti/omap4xxx/domx/omx_core/inc \ hardware/ti/omap4xxx/domx/mm_osal/inc \ frameworks/base/include/media/stagefright \ @@ -78,7 +79,7 @@ LOCAL_SHARED_LIBRARIES:= \ libcamera_client \ libgui \ libdomx \ - libion \ + libion_ti \ libjpeg \ libexif @@ -123,7 +124,7 @@ LOCAL_SHARED_LIBRARIES:= \ libcutils \ libtiutils \ libcamera_client \ - libion \ + libion_ti \ LOCAL_CFLAGS := -fno-short-enums -DCOPY_IMAGE_BUFFER diff --git a/camera/MemoryManager.cpp b/camera/MemoryManager.cpp index b1dbbcf..8631bbd 100644 --- a/camera/MemoryManager.cpp +++ b/camera/MemoryManager.cpp @@ -24,7 +24,7 @@ extern "C" { -#include <ion/ion.h> +#include <ion.h> //#include <timm_osal_interfaces.h> //#include <timm_osal_trace.h> diff --git a/domx/domx/Android.mk b/domx/domx/Android.mk index 0997db5..3a47878 100644 --- a/domx/domx/Android.mk +++ b/domx/domx/Android.mk @@ -26,7 +26,7 @@ LOCAL_SHARED_LIBRARIES := \ libmm_osal \ libc \ liblog \ - libion + libion_ti LOCAL_MODULE:= libdomx LOCAL_MODULE_TAGS:= optional diff --git a/domx/domx/omx_proxy_common/src/omx_proxy_common.c b/domx/domx/omx_proxy_common/src/omx_proxy_common.c index 60507c6..3014bf1 100644 --- a/domx/domx/omx_proxy_common/src/omx_proxy_common.c +++ b/domx/domx/omx_proxy_common/src/omx_proxy_common.c @@ -75,7 +75,7 @@ #ifdef USE_ION #include <unistd.h> -#include <ion/ion.h> +#include <ion.h> #include <sys/ioctl.h> #include <sys/mman.h> #include <sys/eventfd.h> diff --git a/domx/omx_proxy_component/Android.mk b/domx/omx_proxy_component/Android.mk index 58eb424..7931962 100644 --- a/domx/omx_proxy_component/Android.mk +++ b/domx/omx_proxy_component/Android.mk @@ -70,6 +70,7 @@ LOCAL_C_INCLUDES += \ $(LOCAL_PATH)/../omx_core/inc \ $(LOCAL_PATH)/../mm_osal/inc \ $(LOCAL_PATH)/../domx \ + $(HARDWARE_TI_OMAP4_BASE)/ion/ \ $(LOCAL_PATH)/../domx/omx_rpc/inc LOCAL_SHARED_LIBRARIES := \ @@ -77,7 +78,7 @@ LOCAL_SHARED_LIBRARIES := \ libc \ libOMX_Core \ liblog \ - libion \ + libion_ti \ libdomx LOCAL_CFLAGS += -DTMS32060 -D_DB_TIOMAP -DSYSLINK_USE_SYSMGR -DSYSLINK_USE_LOADER diff --git a/domx/omx_proxy_component/omx_camera/src/omx_proxy_camera.c b/domx/omx_proxy_component/omx_camera/src/omx_proxy_camera.c index 50ac002..729c190 100755 --- a/domx/omx_proxy_component/omx_camera/src/omx_proxy_camera.c +++ b/domx/omx_proxy_component/omx_camera/src/omx_proxy_camera.c @@ -74,7 +74,7 @@ #ifdef USE_ION #include <unistd.h> -#include <ion/ion.h> +#include <ion.h> #include <sys/ioctl.h> #include <sys/mman.h> #include <sys/eventfd.h> diff --git a/ion/Android.mk b/ion/Android.mk new file mode 100644 index 0000000..58fc9f9 --- /dev/null +++ b/ion/Android.mk @@ -0,0 +1,13 @@ +# only include if running on an omap4 platform +ifeq ($(TARGET_BOARD_PLATFORM),omap4) + +LOCAL_PATH:= $(call my-dir) + +include $(CLEAR_VARS) +LOCAL_SRC_FILES := ion.c +LOCAL_MODULE := libion_ti +LOCAL_MODULE_TAGS := optional +LOCAL_SHARED_LIBRARIES := liblog +include $(BUILD_HEAPTRACKED_SHARED_LIBRARY) + +endif diff --git a/ion/ion.c b/ion/ion.c new file mode 100644 index 0000000..54579db --- /dev/null +++ b/ion/ion.c @@ -0,0 +1,156 @@ +/* + * ion.c + * + * Memory Allocator functions for ion + * + * Copyright 2011 Google, Inc + * + * 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 <fcntl.h> +#include <stdio.h> +#include <sys/ioctl.h> +#include <sys/mman.h> +#include <sys/types.h> + +#define LOG_TAG "ion" +#include <cutils/log.h> + +#include "linux_ion.h" +#include "omap_ion.h" +#include "ion.h" + +int ion_open() +{ + int fd = open("/dev/ion", O_RDWR); + if (fd < 0) + ALOGE("open /dev/ion failed!\n"); + return fd; +} + +int ion_close(int fd) +{ + return close(fd); +} + +static int ion_ioctl(int fd, int req, void *arg) +{ + int ret = ioctl(fd, req, arg); + if (ret < 0) { + ALOGE("ioctl %d failed with code %d: %s\n", req, + ret, strerror(errno)); + return -errno; + } + return ret; +} + +int ion_alloc(int fd, size_t len, size_t align, unsigned int flags, + struct ion_handle **handle) +{ + int ret; + struct ion_allocation_data data = { + .len = len, + .align = align, + .flags = flags, + }; + + ret = ion_ioctl(fd, ION_IOC_ALLOC, &data); + if (ret < 0) + return ret; + *handle = data.handle; + return ret; +} + +int ion_alloc_tiler(int fd, size_t w, size_t h, int fmt, unsigned int flags, + struct ion_handle **handle, size_t *stride) +{ + int ret; + struct omap_ion_tiler_alloc_data alloc_data = { + .w = w, + .h = h, + .fmt = fmt, + .flags = flags, + }; + + struct ion_custom_data custom_data = { + .cmd = OMAP_ION_TILER_ALLOC, + .arg = (unsigned long)(&alloc_data), + }; + + ret = ion_ioctl(fd, ION_IOC_CUSTOM, &custom_data); + if (ret < 0) + return ret; + *stride = alloc_data.stride; + *handle = alloc_data.handle; + return ret; +} + +int ion_free(int fd, struct ion_handle *handle) +{ + struct ion_handle_data data = { + .handle = handle, + }; + return ion_ioctl(fd, ION_IOC_FREE, &data); +} + +int ion_map(int fd, struct ion_handle *handle, size_t length, int prot, + int flags, off_t offset, unsigned char **ptr, int *map_fd) +{ + struct ion_fd_data data = { + .handle = handle, + }; + int ret = ion_ioctl(fd, ION_IOC_MAP, &data); + if (ret < 0) + return ret; + *map_fd = data.fd; + if (*map_fd < 0) { + ALOGE("map ioctl returned negative fd\n"); + return -EINVAL; + } + *ptr = mmap(NULL, length, prot, flags, *map_fd, offset); + if (*ptr == MAP_FAILED) { + ALOGE("mmap failed: %s\n", strerror(errno)); + return -errno; + } + return ret; +} + +int ion_share(int fd, struct ion_handle *handle, int *share_fd) +{ + int map_fd; + struct ion_fd_data data = { + .handle = handle, + }; + int ret = ion_ioctl(fd, ION_IOC_SHARE, &data); + if (ret < 0) + return ret; + *share_fd = data.fd; + if (*share_fd < 0) { + ALOGE("map ioctl returned negative fd\n"); + return -EINVAL; + } + return ret; +} + +int ion_import(int fd, int share_fd, struct ion_handle **handle) +{ + struct ion_fd_data data = { + .fd = share_fd, + }; + int ret = ion_ioctl(fd, ION_IOC_IMPORT, &data); + if (ret < 0) + return ret; + *handle = data.handle; + return ret; +} diff --git a/ion/ion.h b/ion/ion.h new file mode 100644 index 0000000..c0d9476 --- /dev/null +++ b/ion/ion.h @@ -0,0 +1,35 @@ +/* + * ion.c + * + * Memory Allocator functions for ion + * + * Copyright 2011 Google, Inc + * + * 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 "linux_ion.h" +#include "omap_ion.h" + +int ion_open(); +int ion_close(int fd); +int ion_alloc(int fd, size_t len, size_t align, unsigned int flags, + struct ion_handle **handle); +int ion_alloc_tiler(int fd, size_t w, size_t h, int fmt, unsigned int flags, + struct ion_handle **handle, size_t *stride); +int ion_free(int fd, struct ion_handle *handle); +int ion_map(int fd, struct ion_handle *handle, size_t length, int prot, + int flags, off_t offset, unsigned char **ptr, int *map_fd); +int ion_share(int fd, struct ion_handle *handle, int *share_fd); +int ion_import(int fd, int share_fd, struct ion_handle **handle); + diff --git a/ion/linux_ion.h b/ion/linux_ion.h new file mode 100644 index 0000000..b8715a3 --- /dev/null +++ b/ion/linux_ion.h @@ -0,0 +1,66 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#ifndef _LINUX_ION_H +#define _LINUX_ION_H +#include <linux/types.h> +struct ion_handle; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +enum ion_heap_type { + ION_HEAP_TYPE_SYSTEM, + ION_HEAP_TYPE_SYSTEM_CONTIG, + ION_HEAP_TYPE_CARVEOUT, +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + ION_HEAP_TYPE_CUSTOM, + ION_NUM_HEAPS, +}; +#define ION_HEAP_SYSTEM_MASK (1 << ION_HEAP_TYPE_SYSTEM) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define ION_HEAP_SYSTEM_CONTIG_MASK (1 << ION_HEAP_TYPE_SYSTEM_CONTIG) +#define ION_HEAP_CARVEOUT_MASK (1 << ION_HEAP_TYPE_CARVEOUT) +struct ion_allocation_data { + size_t len; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + size_t align; + unsigned int flags; + struct ion_handle *handle; +}; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +struct ion_fd_data { + struct ion_handle *handle; + int fd; +}; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +struct ion_handle_data { + struct ion_handle *handle; +}; +struct ion_custom_data { +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned int cmd; + unsigned long arg; +}; +#define ION_IOC_MAGIC 'I' +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, struct ion_allocation_data) +#define ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data) +#define ION_IOC_MAP _IOWR(ION_IOC_MAGIC, 2, struct ion_fd_data) +#define ION_IOC_SHARE _IOWR(ION_IOC_MAGIC, 4, struct ion_fd_data) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define ION_IOC_IMPORT _IOWR(ION_IOC_MAGIC, 5, int) +#define ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, struct ion_custom_data) +#endif diff --git a/ion/omap_ion.h b/ion/omap_ion.h new file mode 100644 index 0000000..65af914 --- /dev/null +++ b/ion/omap_ion.h @@ -0,0 +1,59 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#ifndef _LINUX_OMAP_ION_H +#define _LINUX_OMAP_ION_H +#include <linux/types.h> +struct omap_ion_tiler_alloc_data { +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + size_t w; + size_t h; + int fmt; + unsigned int flags; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + struct ion_handle *handle; + size_t stride; + size_t offset; +}; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +enum { + OMAP_ION_HEAP_TYPE_TILER = ION_HEAP_TYPE_CUSTOM + 1, +}; +#define OMAP_ION_HEAP_TILER_MASK (1 << OMAP_ION_HEAP_TYPE_TILER) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +enum { + OMAP_ION_TILER_ALLOC, +}; +enum { +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + TILER_PIXEL_FMT_MIN = 0, + TILER_PIXEL_FMT_8BIT = 0, + TILER_PIXEL_FMT_16BIT = 1, + TILER_PIXEL_FMT_32BIT = 2, +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + TILER_PIXEL_FMT_PAGE = 3, + TILER_PIXEL_FMT_MAX = 3 +}; +enum { +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + OMAP_ION_HEAP_LARGE_SURFACES, + OMAP_ION_HEAP_TILER, + OMAP_ION_HEAP_SECURE_INPUT, +}; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#endif diff --git a/libdrmdecrypt/Android.mk b/libdrmdecrypt/Android.mk deleted file mode 100644 index 324221c..0000000 --- a/libdrmdecrypt/Android.mk +++ /dev/null @@ -1,32 +0,0 @@ -ifeq ($(TARGET_BOARD_PLATFORM),omap4) - -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -ifneq ($(TARGET_DEVICE),panda) --include $(TOP)/vendor/widevine/proprietary/cryptoPlugin/decrypt-core.mk -endif - -LOCAL_C_INCLUDES:= \ - $(TOP)/frameworks/native/include/media/hardware \ - $(TOP)/vendor/widevine/proprietary/cryptoPlugin \ - -ifeq ($(BOARD_USES_SECURE_SERVICES),true) -LOCAL_STATIC_LIBRARIES += \ - libtee_client_api_driver \ - -endif - -LOCAL_SHARED_LIBRARIES := \ - libstagefright_foundation \ - liblog \ - libcutils \ - libcrypto - -LOCAL_MODULE := libdrmdecrypt - -LOCAL_MODULE_TAGS := optional - -include $(BUILD_SHARED_LIBRARY) - -endif @@ -24,12 +24,11 @@ PRODUCT_PACKAGES := \ libOMX.TI.DUCATI1.VIDEO.DECODER.secure \ libOMX.TI.DUCATI1.VIDEO.CAMERA \ libOMX.TI.DUCATI1.MISC.SAMPLE \ - libdrmdecrypt \ libstagefrighthw \ libI420colorconvert \ libtiutils \ libcamera \ - libion \ + libion_ti \ camera.omap4 \ libomxcameraadapter \ hwcomposer.omap4 \ |