diff options
author | codeworkx <daniel.hillenbrand@codeworkx.de> | 2012-05-20 12:00:36 +0200 |
---|---|---|
committer | codeworkx <daniel.hillenbrand@codeworkx.de> | 2012-05-20 12:00:36 +0200 |
commit | 62f02ba4f4b7b561aa15408ebd9951600bdd71aa (patch) | |
tree | ac05dc645945a58edbc26e96df1a78ac16f27706 /exynos4/hal/include | |
parent | e54debb12ecdf92d12acab00a261c0c5a6ef1d64 (diff) | |
download | android_hardware_samsung-62f02ba4f4b7b561aa15408ebd9951600bdd71aa.tar.gz android_hardware_samsung-62f02ba4f4b7b561aa15408ebd9951600bdd71aa.tar.bz2 android_hardware_samsung-62f02ba4f4b7b561aa15408ebd9951600bdd71aa.zip |
exynos: reorganized and updated from insignal
Changes needed on exynos4210 devices:
libcsc -> libseccscapi
libswconverter -> remove
TARGET_HAL_PATH := hardware/samsung/exynos4/hal
TARGET_OMX_PATH := hardware/samsung/exynos/multimedia/openmax
$(call inherit-product, hardware/samsung/exynos4210.mk)
Change-Id: Ic59ef95b85ef37b3f38fb36cf6a364a5414685ee
Diffstat (limited to 'exynos4/hal/include')
-rw-r--r-- | exynos4/hal/include/SecHdmi.h | 1 | ||||
-rw-r--r-- | exynos4/hal/include/gralloc_priv.h | 313 | ||||
-rw-r--r-- | exynos4/hal/include/s3c_lcd.h | 1 | ||||
-rw-r--r-- | exynos4/hal/include/sec_format.h | 2 | ||||
-rw-r--r-- | exynos4/hal/include/swconverter.h | 462 | ||||
-rw-r--r-- | exynos4/hal/include/ump.h | 263 | ||||
-rw-r--r-- | exynos4/hal/include/ump_platform.h | 46 | ||||
-rw-r--r-- | exynos4/hal/include/ump_ref_drv.h | 59 |
8 files changed, 557 insertions, 590 deletions
diff --git a/exynos4/hal/include/SecHdmi.h b/exynos4/hal/include/SecHdmi.h index 67c3378..08bee20 100644 --- a/exynos4/hal/include/SecHdmi.h +++ b/exynos4/hal/include/SecHdmi.h @@ -159,6 +159,7 @@ private : void *mFBaddr; unsigned int mFBsize; int mFBionfd; + unsigned int mFBIndex; int mHdmiFd[HDMI_LAYER_MAX]; int mDstWidth[HDMI_LAYER_MAX]; diff --git a/exynos4/hal/include/gralloc_priv.h b/exynos4/hal/include/gralloc_priv.h index 9f3346a..8ffd161 100644 --- a/exynos4/hal/include/gralloc_priv.h +++ b/exynos4/hal/include/gralloc_priv.h @@ -1,6 +1,14 @@ /* * Copyright (C) 2010 ARM Limited. All rights reserved. * + * Portions of this code have been modified from the original. + * These modifications are: + * * includes + * * struct private_handle_t + * * usesPhysicallyContiguousMemory() + * * validate() + * * dynamicCast() + * * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,145 +35,200 @@ #include <hardware/gralloc.h> #include <cutils/native_handle.h> -#include <ump/ump.h> +/*#include <ump/ump.h>*/ +#include "ump.h" + +/* + * HWC_HWOVERLAY is flag for location of glReadPixels(). + * Enable this define if you want that glReadPixesl() is in HWComposer. + * If you disable this define, glReadPixesl() is called in threadloop(). + */ +#define HWC_HWOVERLAY 1 #define GRALLOC_ARM_UMP_MODULE 1 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; - - 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 - }; +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; + + struct fb_var_screeninfo info; + struct fb_fix_screeninfo finfo; + float xdpi; + float ydpi; + float fps; + int enableVSync; + + enum { + PRIV_USAGE_LOCKED_FOR_POST = 0x80000000 + }; }; +#ifdef USE_PARTIAL_FLUSH +struct private_handle_rect { + int handle; + int stride; + int l; + int t; + int w; + int h; + int locked; + struct private_handle_rect *next; +}; +#endif + #ifdef __cplusplus struct private_handle_t : public native_handle { #else -struct private_handle_t -{ - struct native_handle nativeHandle; +struct private_handle_t { + struct native_handle nativeHandle; #endif - - enum - { - PRIV_FLAGS_FRAMEBUFFER = 0x00000001, - PRIV_FLAGS_USES_UMP = 0x00000002, - }; - - enum - { - LOCK_STATE_WRITE = 1<<31, - LOCK_STATE_MAPPED = 1<<30, - LOCK_STATE_READ_MASK = 0x3FFFFFFF - }; - - // ints - int magic; - int flags; - int size; - int base; - int lockState; - int writeOwner; - int pid; - - // Following members are for UMP memory only - int ump_id; - int ump_mem_handle; - - // Following members is for framebuffer only - int fd; - int offset; - + enum { + PRIV_FLAGS_FRAMEBUFFER = 0x00000001, + PRIV_FLAGS_USES_UMP = 0x00000002, + PRIV_FLAGS_USES_PMEM = 0x00000004, + PRIV_FLAGS_USES_IOCTL = 0x00000008, + PRIV_FLAGS_USES_HDMI = 0x00000010, + PRIV_FLAGS_USES_ION = 0x00000020, + PRIV_FLAGS_NONE_CACHED = 0x00000040, + }; + + enum { + LOCK_STATE_WRITE = 1<<31, + LOCK_STATE_MAPPED = 1<<30, + LOCK_STATE_READ_MASK = 0x3FFFFFFF + }; + + int fd; + + int magic; + int flags; + int size; + int base; + int lockState; + int writeOwner; + int pid; + + /* Following members are for UMP memory only */ + int ump_id; + int ump_mem_handle; + int offset; + int paddr; + + int format; + int usage; + int width; + int height; + int bpp; + int stride; + + /* Following members are for ION memory only */ + int ion_client; + + /* Following members ard for YUV information */ + unsigned int yaddr; + unsigned int uoffset; + unsigned int voffset; #ifdef __cplusplus - static const int sNumInts = 11; - static const int sNumFds = 0; - static const int sMagic = 0x3141592; - - private_handle_t(int flags, int size, int base, int lock_state, ump_secure_id secure_id, ump_handle handle): - magic(sMagic), - flags(flags), - size(size), - base(base), - lockState(lock_state), - writeOwner(0), - pid(getpid()), - ump_id((int)secure_id), - ump_mem_handle((int)handle), - fd(0), - offset(0) - { - version = sizeof(native_handle); - numFds = sNumFds; - numInts = sNumInts; - } - - private_handle_t(int flags, int size, int base, int lock_state, int fb_file, int fb_offset): - magic(sMagic), - flags(flags), - size(size), - base(base), - lockState(lock_state), - writeOwner(0), - pid(getpid()), - ump_id((int)UMP_INVALID_SECURE_ID), - ump_mem_handle((int)UMP_INVALID_MEMORY_HANDLE), - fd(fb_file), - offset(fb_offset) - { - version = sizeof(native_handle); - numFds = sNumFds; - numInts = sNumInts; - } - - ~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 (!h || h->version != sizeof(native_handle) || h->numInts != sNumInts || h->numFds != sNumFds || hnd->magic != sMagic) - { - return -EINVAL; - } - return 0; - } - - static private_handle_t* dynamicCast(const native_handle* in) - { - if (validate(in) == 0) - { - return (private_handle_t*) in; - } - return NULL; - } + static const int sNumInts = 21; + static const int sNumFds = 1; + static const int sMagic = 0x3141592; + + private_handle_t(int flags, int size, int base, int lock_state, ump_secure_id secure_id, ump_handle handle,int fd_val, int offset_val, int paddr_val): + fd(fd_val), + magic(sMagic), + flags(flags), + size(size), + base(base), + lockState(lock_state), + writeOwner(0), + pid(getpid()), + ump_id((int)secure_id), + ump_mem_handle((int)handle), + offset(offset_val), + paddr(paddr_val), + format(0), + usage(0), + width(0), + height(0), + bpp(0), + stride(0), + ion_client(0), + yaddr(0), + uoffset(0), + voffset(0) + { + version = sizeof(native_handle); + numFds = sNumFds; + numInts = sNumInts; + } + + private_handle_t(int flags, int size, int base, int lock_state, int fb_file, int fb_offset): + fd(fb_file), + magic(sMagic), + flags(flags), + size(size), + base(base), + lockState(lock_state), + writeOwner(0), + pid(getpid()), + ump_id((int)UMP_INVALID_SECURE_ID), + ump_mem_handle((int)UMP_INVALID_MEMORY_HANDLE), + offset(fb_offset), + paddr(0), + format(0), + usage(0), + width(0), + height(0), + bpp(0), + stride(0), + ion_client(0), + yaddr(0), + uoffset(0), + voffset(0) + { + version = sizeof(native_handle); + numFds = sNumFds; + numInts = sNumInts; + } + + ~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 (!h || h->version != sizeof(native_handle) || + h->numInts != sNumInts || + h->numFds != sNumFds || + hnd->magic != sMagic) + 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 }; diff --git a/exynos4/hal/include/s3c_lcd.h b/exynos4/hal/include/s3c_lcd.h index 7f2dec7..2782542 100644 --- a/exynos4/hal/include/s3c_lcd.h +++ b/exynos4/hal/include/s3c_lcd.h @@ -55,7 +55,6 @@ typedef struct { #ifdef BOARD_USE_V4L2_ION struct s3c_fb_user_ion_client { int fd; - int offset; }; #endif diff --git a/exynos4/hal/include/sec_format.h b/exynos4/hal/include/sec_format.h index 8722b45..23534c5 100644 --- a/exynos4/hal/include/sec_format.h +++ b/exynos4/hal/include/sec_format.h @@ -27,8 +27,6 @@ enum { HAL_PIXEL_FORMAT_CbYCrY_420_I = 0x104, HAL_PIXEL_FORMAT_YCbCr_420_SP = 0x105, HAL_PIXEL_FORMAT_YCrCb_422_SP = 0x106, - HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED = 0x107, - HAL_PIXEL_FORMAT_ARGB888 = 0x108, // support custom format for zero copy HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP = 0x110, HAL_PIXEL_FORMAT_CUSTOM_YCrCb_420_SP = 0x111, diff --git a/exynos4/hal/include/swconverter.h b/exynos4/hal/include/swconverter.h deleted file mode 100644 index eb2eae3..0000000 --- a/exynos4/hal/include/swconverter.h +++ /dev/null @@ -1,462 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file swconverter.h - * @brief SEC_OMX specific define. It support MFC 5.x tiled. - * NV12T(tiled) layout: - * Each element is not pixel. It is 64x32 pixel block. - * uv pixel block is interleaved as u v u v u v ... - * y1 y2 y7 y8 y9 y10 y15 y16 - * y3 y4 y5 y6 y11 y12 y13 y14 - * y17 y18 y23 y24 y25 y26 y31 y32 - * y19 y20 y21 y22 y27 y28 y29 y30 - * uv1 uv2 uv7 uv8 uv9 uv10 uv15 uv16 - * uv3 uv4 uv5 uv6 uv11 uv12 uv13 uv14 - * YUV420Planar(linear) layout: - * Each element is not pixel. It is 64x32 pixel block. - * y1 y2 y3 y4 y5 y6 y7 y8 - * y9 y10 y11 y12 y13 y14 y15 y16 - * y17 y18 y19 y20 y21 y22 y23 y24 - * y25 y26 y27 y28 y29 y30 y31 y32 - * u1 u2 u3 u4 u5 u6 u7 u8 - * v1 v2 v3 v4 v5 v6 v7 v8 - * YUV420Semiplanar(linear) layout: - * Each element is not pixel. It is 64x32 pixel block. - * uv pixel block is interleaved as u v u v u v ... - * y1 y2 y3 y4 y5 y6 y7 y8 - * y9 y10 y11 y12 y13 y14 y15 y16 - * y17 y18 y19 y20 y21 y22 y23 y24 - * y25 y26 y27 y28 y29 y30 y31 y32 - * uv1 uv2 uv3 uv4 uv5 uv6 uv7 uv8 - * uv9 uv10 uv11 uv12 uv13 uv14 uv15 uv16 - * @author ShinWon Lee (shinwon.lee@samsung.com) - * @version 1.0 - * @history - * 2012.02.01 : Create - */ - -#ifndef SW_CONVERTOR_H_ -#define SW_CONVERTOR_H_ - -/*--------------------------------------------------------------------------------*/ -/* Format Conversion API */ -/*--------------------------------------------------------------------------------*/ -/* - * De-interleaves src to dest1, dest2 - * - * @param dest1 - * Address of de-interleaved data[out] - * - * @param dest2 - * Address of de-interleaved data[out] - * - * @param src - * Address of interleaved data[in] - * - * @param src_size - * Size of interleaved data[in] - */ -void csc_deinterleave_memcpy( - unsigned char *dest1, - unsigned char *dest2, - unsigned char *src, - unsigned int src_size); - -/* - * Interleaves src1, src2 to dest - * - * @param dest - * Address of interleaved data[out] - * - * @param src1 - * Address of de-interleaved data[in] - * - * @param src2 - * Address of de-interleaved data[in] - * - * @param src_size - * Size of de-interleaved data[in] - */ -void csc_interleave_memcpy( - unsigned char *dest, - unsigned char *src1, - unsigned char *src2, - unsigned int src_size); - -/* C Code */ -/* - * Converts tiled data to linear - * 1. y of nv12t to y of yuv420p - * 2. y of nv12t to y of yuv420s - * - * @param dst - * y address of yuv420[out] - * - * @param src - * y address of nv12t[in] - * - * @param yuv420_width - * real width of yuv420[in] - * it should be even - * - * @param yuv420_height - * real height of yuv420[in] - * it should be even. - * - */ -void csc_tiled_to_linear_y( - unsigned char *y_dst, - unsigned char *y_src, - unsigned int width, - unsigned int height); - -/* - * Converts tiled data to linear - * 1. uv of nv12t to y of yuv420s - * - * @param dst - * uv address of yuv420s[out] - * - * @param src - * uv address of nv12t[in] - * - * @param yuv420_width - * real width of yuv420s[in] - * - * @param yuv420_height - * real height of yuv420s[in] - * - */ -void csc_tiled_to_linear_uv( - unsigned char *uv_dst, - unsigned char *uv_src, - unsigned int width, - unsigned int height); - -/* - * Converts tiled data to linear - * 1. uv of nt12t to uv of yuv420p - * - * @param u_dst - * u address of yuv420p[out] - * - * @param v_dst - * v address of yuv420p[out] - * - * @param uv_src - * uv address of nt12t[in] - * - * @param yuv420_width - * real width of yuv420p[in] - * - * @param yuv420_height - * real height of yuv420p[in] - */ -void csc_tiled_to_linear_uv_deinterleave( - unsigned char *u_dst, - unsigned char *v_dst, - unsigned char *uv_src, - unsigned int width, - unsigned int height); - -/* - * Converts linear data to tiled - * 1. y of yuv420 to y of nv12t - * - * @param dst - * y address of nv12t[out] - * - * @param src - * y address of yuv420[in] - * - * @param yuv420_width - * real width of yuv420[in] - * it should be even - * - * @param yuv420_height - * real height of yuv420[in] - * it should be even. - * - */ -void csc_linear_to_tiled_y( - unsigned char *y_dst, - unsigned char *y_src, - unsigned int width, - unsigned int height); - -/* - * Converts and interleaves linear data to tiled - * 1. uv of nv12t to uv of yuv420 - * - * @param dst - * uv address of nv12t[out] - * - * @param src - * u address of yuv420[in] - * - * @param src - * v address of yuv420[in] - * - * @param yuv420_width - * real width of yuv420[in] - * - * @param yuv420_height - * real height of yuv420[in] - * - */ -void csc_linear_to_tiled_uv( - unsigned char *uv_dst, - unsigned char *u_src, - unsigned char *v_src, - unsigned int width, - unsigned int height); - -/* - * Converts tiled data to linear for mfc 6.x - * 1. Y of NV12T to Y of YUV420P - * 2. Y of NV12T to Y of YUV420S - * - * @param dst - * Y address of YUV420[out] - * - * @param src - * Y address of NV12T[in] - * - * @param yuv420_width - * real width of YUV420[in] - * - * @param yuv420_height - * Y: real height of YUV420[in] - * - */ -void csc_tiled_to_linear_y_neon( - unsigned char *y_dst, - unsigned char *y_src, - unsigned int width, - unsigned int height); - -/* - * Converts tiled data to linear for mfc 6.x - * 1. UV of NV12T to Y of YUV420S - * - * @param u_dst - * UV plane address of YUV420P[out] - * - * @param nv12t_src - * Y or UV plane address of NV12T[in] - * - * @param yuv420_width - * real width of YUV420[in] - * - * @param yuv420_height - * (real height)/2 of YUV420[in] - */ -void csc_tiled_to_linear_uv_neon( - unsigned char *uv_dst, - unsigned char *uv_src, - unsigned int width, - unsigned int height); - -/* - * Converts tiled data to linear for mfc 6.x - * Deinterleave src to u_dst, v_dst - * 1. UV of NV12T to Y of YUV420P - * - * @param u_dst - * U plane address of YUV420P[out] - * - * @param v_dst - * V plane address of YUV420P[out] - * - * @param nv12t_src - * Y or UV plane address of NV12T[in] - * - * @param yuv420_width - * real width of YUV420[in] - * - * @param yuv420_height - * (real height)/2 of YUV420[in] - */ -void csc_tiled_to_linear_uv_deinterleave_neon( - unsigned char *u_dst, - unsigned char *v_dst, - unsigned char *uv_src, - unsigned int width, - unsigned int height); - -/* - * Converts linear data to tiled - * 1. y of yuv420 to y of nv12t - * - * @param dst - * y address of nv12t[out] - * - * @param src - * y address of yuv420[in] - * - * @param yuv420_width - * real width of yuv420[in] - * it should be even - * - * @param yuv420_height - * real height of yuv420[in] - * it should be even. - * - */ -void csc_linear_to_tiled_y_neon( - unsigned char *y_dst, - unsigned char *y_src, - unsigned int width, - unsigned int height); - -/* - * Converts and interleaves linear data to tiled - * 1. uv of nv12t to uv of yuv420 - * - * @param dst - * uv address of nv12t[out] - * - * @param src - * u address of yuv420[in] - * - * @param src - * v address of yuv420[in] - * - * @param yuv420_width - * real width of yuv420[in] - * - * @param yuv420_height - * real height of yuv420[in] - * - */ -void csc_linear_to_tiled_uv_neon( - unsigned char *uv_dst, - unsigned char *u_src, - unsigned char *v_src, - unsigned int width, - unsigned int height); - -/* - * Converts RGB565 to YUV420P - * - * @param y_dst - * Y plane address of YUV420P[out] - * - * @param u_dst - * U plane address of YUV420P[out] - * - * @param v_dst - * V plane address of YUV420P[out] - * - * @param rgb_src - * Address of RGB565[in] - * - * @param width - * Width of RGB565[in] - * - * @param height - * Height of RGB565[in] - */ -void csc_RGB565_to_YUV420P( - unsigned char *y_dst, - unsigned char *u_dst, - unsigned char *v_dst, - unsigned char *rgb_src, - unsigned int width, - unsigned int height); - -/* - * Converts RGB565 to YUV420S - * - * @param y_dst - * Y plane address of YUV420S[out] - * - * @param uv_dst - * UV plane address of YUV420S[out] - * - * @param rgb_src - * Address of RGB565[in] - * - * @param width - * Width of RGB565[in] - * - * @param height - * Height of RGB565[in] - */ -void csc_RGB565_to_YUV420SP( - unsigned char *y_dst, - unsigned char *uv_dst, - unsigned char *rgb_src, - unsigned int width, - unsigned int height); - -/* - * Converts ARGB8888 to YUV420P - * - * @param y_dst - * Y plane address of YUV420P[out] - * - * @param u_dst - * U plane address of YUV420P[out] - * - * @param v_dst - * V plane address of YUV420P[out] - * - * @param rgb_src - * Address of ARGB8888[in] - * - * @param width - * Width of ARGB8888[in] - * - * @param height - * Height of ARGB8888[in] - */ -void csc_ARGB8888_to_YUV420P( - unsigned char *y_dst, - unsigned char *u_dst, - unsigned char *v_dst, - unsigned char *rgb_src, - unsigned int width, - unsigned int height); - -/* - * Converts ARGB888 to YUV420SP - * - * @param y_dst - * Y plane address of YUV420SP[out] - * - * @param uv_dst - * UV plane address of YUV420SP[out] - * - * @param rgb_src - * Address of ARGB8888[in] - * - * @param width - * Width of ARGB8888[in] - * - * @param height - * Height of ARGB8888[in] - */ -void csc_ARGB8888_to_YUV420SP( - unsigned char *y_dst, - unsigned char *uv_dst, - unsigned char *rgb_src, - unsigned int width, - unsigned int height); - -#endif /*COLOR_SPACE_CONVERTOR_H_*/ diff --git a/exynos4/hal/include/ump.h b/exynos4/hal/include/ump.h new file mode 100644 index 0000000..fd01c44 --- /dev/null +++ b/exynos4/hal/include/ump.h @@ -0,0 +1,263 @@ +/* + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2008-2010 ARM Limited + * ALL RIGHTS RESERVED + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + */ + +/** + * @file ump.h + * + * This file contains the user space part of the UMP API. + */ + +#ifndef _UNIFIED_MEMORY_PROVIDER_H_ +#define _UNIFIED_MEMORY_PROVIDER_H_ + + +/** @defgroup ump_user_space_api UMP User Space API + * @{ */ + + +#include "ump_platform.h" + + +#include "ion.h" +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * External representation of a UMP handle in user space. + */ +typedef void * ump_handle; + +/** + * Typedef for a secure ID, a system wide identificator for UMP memory buffers. + */ +typedef unsigned int ump_secure_id; + +/** + * Value to indicate an invalid UMP memory handle. + */ +#define UMP_INVALID_MEMORY_HANDLE ((ump_handle)0) + +/** + * Value to indicate an invalid secure Id. + */ +#define UMP_INVALID_SECURE_ID ((ump_secure_id)-1) + +/** + * UMP error codes for user space. + */ +typedef enum +{ + UMP_OK, /**< indicates success */ + UMP_ERROR, /**< indicates failure */ +} ump_result; + + +/** + * Opens and initializes the UMP library. + * + * This function must be called at least once before calling any other UMP API functions. + * Each open is reference counted and must be matched with a call to @ref ump_close "ump_close". + * + * @see ump_close + * + * @return UMP_OK indicates success, UMP_ERROR indicates failure. + */ +UMP_API_EXPORT ump_result ump_open(void); + + +/** + * Terminate the UMP library. + * + * This must be called once for every successful @ref ump_open "ump_open". The UMP library is + * terminated when, and only when, the last open reference to the UMP interface is closed. + * + * @see ump_open + */ +UMP_API_EXPORT void ump_close(void); + + +/** + * Retrieves the secure ID for the specified UMP memory. + * + * This identificator is unique across the entire system, and uniquely identifies + * the specified UMP memory. This identificator can later be used through the + * @ref ump_handle_create_from_secure_id "ump_handle_create_from_secure_id" or + * @ref ump_dd_handle_create_from_secure_id "ump_dd_handle_create_from_secure_id" + * functions in order to access this UMP memory, for instance from another process. + * + * @note There is a kernel space equivalent function called @ref ump_dd_secure_id_get "ump_dd_secure_id_get" + * + * @see ump_handle_create_from_secure_id + * @see ump_dd_handle_create_from_secure_id + * @see ump_dd_secure_id_get + * + * @param mem Handle to UMP memory. + * + * @return Returns the secure ID for the specified UMP memory. + */ +UMP_API_EXPORT ump_secure_id ump_secure_id_get(ump_handle mem); + + +/** + * Retrieves a handle to allocated UMP memory. + * + * The usage of UMP memory is reference counted, so this will increment the reference + * count by one for the specified UMP memory. + * Use @ref ump_reference_release "ump_reference_release" when there is no longer any + * use for the retrieved handle. + * + * @note There is a kernel space equivalent function called @ref ump_dd_handle_create_from_secure_id "ump_dd_handle_create_from_secure_id" + * + * @see ump_reference_release + * @see ump_dd_handle_create_from_secure_id + * + * @param secure_id The secure ID of the UMP memory to open, that can be retrieved using the @ref ump_secure_id_get "ump_secure_id_get " function. + * + * @return UMP_INVALID_MEMORY_HANDLE indicates failure, otherwise a valid handle is returned. + */ +UMP_API_EXPORT ump_handle ump_handle_create_from_secure_id(ump_secure_id secure_id); + + +/** + * Retrieves the actual size of the specified UMP memory. + * + * The size is reported in bytes, and is typically page aligned. + * + * @note There is a kernel space equivalent function called @ref ump_dd_size_get "ump_dd_size_get" + * + * @see ump_dd_size_get + * + * @param mem Handle to UMP memory. + * + * @return Returns the allocated size of the specified UMP memory, in bytes. + */ +UMP_API_EXPORT unsigned long ump_size_get(ump_handle mem); + + +/** + * Read from specified UMP memory. + * + * Another way of reading from (and writing to) UMP memory is to use the + * @ref ump_mapped_pointer_get "ump_mapped_pointer_get" to retrieve + * a CPU mapped pointer to the memory. + * + * @see ump_mapped_pointer_get + * + * @param dst Destination buffer. + * @param src Handle to UMP memory to read from. + * @param offset Where to start reading, given in bytes. + * @param length How much to read, given in bytes. + */ +UMP_API_EXPORT void ump_read(void * dst, ump_handle src, unsigned long offset, unsigned long length); + + +/** + * Write to specified UMP memory. + * + * Another way of writing to (and reading from) UMP memory is to use the + * @ref ump_mapped_pointer_get "ump_mapped_pointer_get" to retrieve + * a CPU mapped pointer to the memory. + * + * @see ump_mapped_pointer_get + * + * @param dst Handle to UMP memory to write to. + * @param offset Where to start writing, given in bytes. + * @param src Buffer to read from. + * @param length How much to write, given in bytes. + */ +UMP_API_EXPORT void ump_write(ump_handle dst, unsigned long offset, const void * src, unsigned long length); + + +/** + * Retrieves a memory mapped pointer to the specified UMP memory. + * + * This function retrieves a memory mapped pointer to the specified UMP memory, + * that can be used by the CPU. Every successful call to + * @ref ump_mapped_pointer_get "ump_mapped_pointer_get" is reference counted, + * and must therefor be followed by a call to + * @ref ump_mapped_pointer_release "ump_mapped_pointer_release " when the + * memory mapping is no longer needed. + * + * @note Systems without a MMU for the CPU only return the physical address, because no mapping is required. + * + * @see ump_mapped_pointer_release + * + * @param mem Handle to UMP memory. + * + * @return NULL indicates failure, otherwise a CPU mapped pointer is returned. + */ +UMP_API_EXPORT void * ump_mapped_pointer_get(ump_handle mem); + + +/** + * Releases a previously mapped pointer to the specified UMP memory. + * + * The CPU mapping of the specified UMP memory memory is reference counted, + * so every call to @ref ump_mapped_pointer_get "ump_mapped_pointer_get" must + * be matched with a call to this function when the mapping is no longer needed. + * + * The CPU mapping is not removed before all references to the mapping is released. + * + * @note Systems without a MMU must still implement this function, even though no unmapping should be needed. + * + * @param mem Handle to UMP memory. + */ +UMP_API_EXPORT void ump_mapped_pointer_release(ump_handle mem); + + +/** + * Adds an extra reference to the specified UMP memory. + * + * This function adds an extra reference to the specified UMP memory. This function should + * be used every time a UMP memory handle is duplicated, that is, assigned to another ump_handle + * variable. The function @ref ump_reference_release "ump_reference_release" must then be used + * to release each copy of the UMP memory handle. + * + * @note You are not required to call @ref ump_reference_add "ump_reference_add" + * for UMP handles returned from + * @ref ump_handle_create_from_secure_id "ump_handle_create_from_secure_id", + * because these handles are already reference counted by this function. + * + * @note There is a kernel space equivalent function called @ref ump_dd_reference_add "ump_dd_reference_add" + * + * @see ump_dd_reference_add + * + * @param mem Handle to UMP memory. + */ +UMP_API_EXPORT void ump_reference_add(ump_handle mem); + + +/** + * Releases a reference from the specified UMP memory. + * + * This function should be called once for every reference to the UMP memory handle. + * When the last reference is released, all resources associated with this UMP memory + * handle are freed. + * + * @note There is a kernel space equivalent function called @ref ump_dd_reference_release "ump_dd_reference_release" + * + * @see ump_dd_reference_release + * + * @param mem Handle to UMP memory. + */ +UMP_API_EXPORT void ump_reference_release(ump_handle mem); + + +#ifdef __cplusplus +} +#endif + + +/** @} */ /* end group ump_user_space_api */ + + +#endif /*_UNIFIED_MEMORY_PROVIDER_H_ */ diff --git a/exynos4/hal/include/ump_platform.h b/exynos4/hal/include/ump_platform.h new file mode 100644 index 0000000..9285aef --- /dev/null +++ b/exynos4/hal/include/ump_platform.h @@ -0,0 +1,46 @@ +/* + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2008-2010 ARM Limited + * ALL RIGHTS RESERVED + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + */ + +/** + * @file ump_platform.h + * + * This file should define UMP_API_EXPORT, + * which dictates how the UMP user space API should be exported/imported. + * Modify this file, if needed, to match your platform setup. + */ + +#ifndef __UMP_PLATFORM_H__ +#define __UMP_PLATFORM_H__ + +/** @addtogroup ump_user_space_api + * @{ */ + +/** + * A define which controls how UMP user space API functions are imported and exported. + * This define should be set by the implementor of the UMP API. + */ +#if defined(_WIN32) + +#define UMP_API_EXPORT + +#elif defined(__SYMBIAN32__) + +#define UMP_API_EXPORT IMPORT_C + +#else + +#define UMP_API_EXPORT + +#endif + +/** @} */ /* end group ump_user_space_api */ + + +#endif /* __UMP_PLATFORM_H__ */ diff --git a/exynos4/hal/include/ump_ref_drv.h b/exynos4/hal/include/ump_ref_drv.h new file mode 100644 index 0000000..6320f1d --- /dev/null +++ b/exynos4/hal/include/ump_ref_drv.h @@ -0,0 +1,59 @@ +/* + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2009-2010 ARM Limited + * ALL RIGHTS RESERVED + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + */ + +/** + * @file ump_ref_drv.h + * + * Reference driver extensions to the UMP user space API for allocating UMP memory + */ + +#ifndef _UNIFIED_MEMORY_PROVIDER_REF_DRV_H_ +#define _UNIFIED_MEMORY_PROVIDER_REF_DRV_H_ + +#include "ump.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + /* This enum must match with the IOCTL enum in ump_ioctl.h */ + UMP_REF_DRV_CONSTRAINT_NONE = 0, + UMP_REF_DRV_CONSTRAINT_PHYSICALLY_LINEAR = 1, + /* This enum is included by samsung */ + UMP_REF_DRV_CONSTRAINT_USE_CACHE = 128, +} ump_alloc_constraints; + +/** Allocate an UMP handle containing a memory buffer. + * Input: Size: The minimum size for the allocation. + * Usage: If this is UMP_REF_DRV_CONSTRAINT_USE_CACHE, the allocation is mapped as cached by the cpu. + * If it is UMP_REF_DRV_CONSTRAINT_NONE it is mapped as noncached. + * The flag UMP_REF_DRV_CONSTRAINT_PHYSICALLY_LINEAR is not supported.*/ +UMP_API_EXPORT ump_handle ump_ref_drv_allocate(unsigned long size, ump_alloc_constraints usage); + +UMP_API_EXPORT ump_handle ump_ref_drv_ion_import(int ion_fd, ump_alloc_constraints constraints); +typedef enum { + UMP_MSYNC_CLEAN = 0 , + UMP_MSYNC_CLEAN_AND_INVALIDATE = 1, + UMP_MSYNC_READOUT_CACHE_ENABLED = 128, +} ump_cpu_msync_op; + +/** Flushing cache for an ump_handle. + * The function will always CLEAN_AND_INVALIDATE as long as the \a op is not UMP_MSYNC_READOUT_CACHE_ENABLED. + * If so it will only report back if the given ump_handle is cacheable. + * At the momement the implementation does not use \a address or \a size. + * Return value is 1 if cache is enabled, and 0 if it is disabled for the given allocation.*/ +UMP_API_EXPORT int ump_cpu_msync_now(ump_handle mem, ump_cpu_msync_op op, void* address, int size); + +#ifdef __cplusplus +} +#endif + +#endif /*_UNIFIED_MEMORY_PROVIDER_REF_DRV_H_ */ |