summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorcodewalker <codewalker@hardkernel.com>2014-08-19 18:20:50 +0900
committerDongjin Kim <tobetter@gmail.com>2014-08-19 18:47:59 +0900
commit500214a10db4a78d4eee9649ced413716b7c2fbb (patch)
tree5731fbcab43476265d26996e5be9e6fe50545f8b /include
parent6414706ded5e58737ec115a9963d24627e02f8e1 (diff)
downloadandroid_hardware_samsung_slsi_exynos5430-500214a10db4a78d4eee9649ced413716b7c2fbb.tar.gz
android_hardware_samsung_slsi_exynos5430-500214a10db4a78d4eee9649ced413716b7c2fbb.tar.xz
android_hardware_samsung_slsi_exynos5430-500214a10db4a78d4eee9649ced413716b7c2fbb.zip
Samsung Patch (05/27/2014) - RTM 1.00
Change-Id: I013f933ac0a52c4cc1b5e5b550a92b06534a0a34
Diffstat (limited to 'include')
-rw-r--r--include/ExynosJpegApi.h252
-rwxr-xr-xinclude/gralloc_priv.h178
-rw-r--r--include/sec_g2d_comp.h78
3 files changed, 508 insertions, 0 deletions
diff --git a/include/ExynosJpegApi.h b/include/ExynosJpegApi.h
new file mode 100644
index 0000000..58fb937
--- /dev/null
+++ b/include/ExynosJpegApi.h
@@ -0,0 +1,252 @@
+/*
+ * Copyright Samsung Electronics Co.,LTD.
+ * Copyright (C) 2012~2013 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 __EXYNOS_JPEG_BASE_H__
+#define __EXYNOS_JPEG_BASE_H__
+
+#include "videodev2.h"
+#include "videodev2_exynos_media.h"
+
+#define JPEG_CACHE_OFF (0)
+#define JPEG_CACHE_ON (1)
+
+#define JPEG_BUF_TYPE_USER_PTR (1)
+#define JPEG_BUF_TYPE_DMA_BUF (2)
+
+class ExynosJpegBase {
+public:
+ #define JPEG_MAX_PLANE_CNT (3)
+ ExynosJpegBase();
+ virtual ~ExynosJpegBase();
+
+ enum ERROR_JPEG_HAL {
+ ERROR_JPEG_DEVICE_ALREADY_CREATE = -0x100,
+ ERROR_INVALID_JPEG_MODE,
+ ERROR_CANNOT_OPEN_JPEG_DEVICE,
+ ERROR_JPEG_DEVICE_ALREADY_CLOSED,
+ ERROR_JPEG_DEVICE_ALREADY_DESTROY,
+ ERROR_JPEG_DEVICE_NOT_CREATE_YET,
+ ERROR_INVALID_COLOR_FORMAT,
+ ERROR_INVALID_JPEG_FORMAT,
+ ERROR_INVALID_IMAGE_SIZE,
+ ERROR_JPEG_CONFIG_POINTER_NULL,
+ ERROR_INVALID_JPEG_CONFIG,
+ ERROR_IN_BUFFER_CREATE_FAIL,
+ ERROR_OUT_BUFFER_CREATE_FAIL,
+ ERROR_EXCUTE_FAIL,
+ ERROR_JPEG_SIZE_TOO_SMALL,
+ ERROR_CANNOT_CHANGE_CACHE_SETTING,
+ ERROR_SIZE_NOT_SET_YET,
+ ERROR_BUFFR_IS_NULL,
+ ERROR_BUFFER_TOO_SMALL,
+ ERROR_GET_SIZE_FAIL,
+ ERROR_BUF_NOT_SET_YET,
+ ERROR_REQBUF_FAIL,
+ ERROR_INVALID_V4l2_BUF_TYPE = -0x80,
+ ERROR_INVALID_SELECT,
+ ERROR_MMAP_FAILED,
+ ERROR_FAIL,
+ ERROR_NONE = 0
+ };
+
+ enum MODE {
+ MODE_ENCODE = 0,
+ MODE_DECODE
+ };
+
+ struct BUFFER{
+ int numOfPlanes;
+ int i_addr[JPEG_MAX_PLANE_CNT];
+ char *c_addr[JPEG_MAX_PLANE_CNT];
+ int size[JPEG_MAX_PLANE_CNT];
+ };
+
+ struct BUF_INFO{
+ int numOfPlanes;
+ enum v4l2_memory memory;
+ enum v4l2_buf_type buf_type;
+ int reserved[4];
+ };
+
+ struct PIX_FMT{
+ int in_fmt;
+ int out_fmt;
+ int reserved[4];
+ };
+
+ struct CONFIG{
+ int mode;
+ int enc_qual;
+ int width;
+ int height;
+ int scaled_width;
+ int scaled_height;
+ int numOfPlanes;
+ int sizeJpeg;
+ union {
+ PIX_FMT enc_fmt;
+ PIX_FMT dec_fmt;
+ } pix;
+ int reserved[8];
+ };
+
+ int setSize(int iW, int iH);
+ int setCache(int iValue);
+ void *getJpegConfig(void);
+ int selectJpegHW(int iSel);
+ int ckeckJpegSelct(enum MODE eMode);
+
+protected:
+ bool t_bFlagCreate;
+ bool t_bFlagCreateInBuf;
+ bool t_bFlagCreateOutBuf;
+ bool t_bFlagExcute;
+ bool t_bFlagSelect;
+ int t_iCacheValue;
+ int t_iSelectNode;
+ int t_iPlaneNum;
+ int t_iJpegFd;
+
+ struct CONFIG t_stJpegConfig;
+ struct BUFFER t_stJpegInbuf;
+ struct BUFFER t_stJpegOutbuf;
+
+ int t_v4l2Querycap(int iFd);
+ int t_v4l2SetJpegcomp(int iFd, int iQuality);
+ int t_v4l2SetFmt(int iFd, enum v4l2_buf_type eType, struct CONFIG *pstConfig);
+ int t_v4l2GetFmt(int iFd, enum v4l2_buf_type eType, struct CONFIG *pstConfig);
+ int t_v4l2Reqbufs(int iFd, int iBufCount, struct BUF_INFO *pstBufInfo);
+ int t_v4l2Querybuf(int iFd, struct BUF_INFO *pstBufInfo, struct BUFFER *pstBuf);
+ int t_v4l2Qbuf(int iFd, struct BUF_INFO *pstBufInfo, struct BUFFER *pstBuf);
+ int t_v4l2Dqbuf(int iFd, enum v4l2_buf_type eType, enum v4l2_memory eMemory, int iNumPlanes);
+ int t_v4l2StreamOn(int iFd, enum v4l2_buf_type eType);
+ int t_v4l2StreamOff(int iFd, enum v4l2_buf_type eType);
+ int t_v4l2SetCtrl(int iFd, int iCid, int iValue);
+ int t_v4l2GetCtrl(int iFd, int iCid);
+
+ int create(enum MODE eMode);
+ int openJpeg(enum MODE eMode);
+ int openNode(enum MODE eMode);
+ int destroy(int iInBufs, int iOutBufs);
+ int setJpegConfig(enum MODE eMode, void *pConfig);
+ int setColorFormat(enum MODE eMode, int iV4l2ColorFormat);
+ int setJpegFormat(enum MODE eMode, int iV4l2JpegFormat);
+ int setColorBufSize(enum MODE eMode, int *piBufSize, int iSize);
+ int setColorBufSize(int iFormat, int *piBufSize, int iSize, int width, int height);
+
+ int checkBufType(struct BUFFER *pstBuf);
+ int getBufType(struct BUFFER *pstBuf);
+
+ int getBuf(bool bCreateBuf, struct BUFFER *pstBuf, int *piBuf, int *iBufSize, int iSize, int iPlaneNum);
+ int setBuf(struct BUFFER *pstBuf, int *piBuf, int *iSize, int iPlaneNum);
+
+ int getBuf(bool bCreateBuf, struct BUFFER *pstBuf, char **pcBuf, int *iBufSize, int iSize, int iPlaneNum);
+ int setBuf(struct BUFFER *pstBuf, char **pcBuf, int *iSize, int iPlaneNum);
+ int updateConfig(enum MODE eMode, int iInBufs, int iOutBufs, int iInBufPlanes, int iOutBufPlanes);
+ int execute(int iInBufPlanes, int iOutBufPlanes);
+};
+
+/*
+ * ExynosJpegEncoder class
+ */
+class ExynosJpegEncoder : public ExynosJpegBase {
+public:
+ ExynosJpegEncoder();
+ virtual ~ExynosJpegEncoder();
+
+ enum QUALITY {
+ QUALITY_LEVEL_1 = 0, /* high */
+ QUALITY_LEVEL_2,
+ QUALITY_LEVEL_3,
+ QUALITY_LEVEL_4,
+ QUALITY_LEVEL_5,
+ QUALITY_LEVEL_6, /* low */
+ };
+
+ int create(void);
+ int destroy(void);
+
+ int setJpegConfig(void* pConfig);
+
+ int checkInBufType(void);
+ int checkOutBufType(void);
+
+ int getInBuf(int *piBuf, int *piInputSize, int iSize);
+ int getOutBuf(int *piBuf, int *piOutputSize);
+
+ int setInBuf(int *piBuf, int *iSize);
+ int setOutBuf(int iBuf, int iSize);
+
+ int getInBuf(char **pcBuf, int *piInputSize, int iSize);
+ int getOutBuf(char **pcBuf, int *piOutputSize);
+
+ int setInBuf(char **pcBuf, int *iSize);
+ int setOutBuf(char *pcBuf, int iSize);
+
+ int getSize(int *piWidth, int *piHeight);
+ int getColorFormat(void);
+ int setColorFormat(int iV4l2ColorFormat);
+ int setJpegFormat(int iV4l2JpegFormat);
+ int setColorBufSize(int *piBufSize, int iSize);
+ int updateConfig(void);
+
+ int setQuality(int iQuality);
+ int getJpegSize(void);
+
+ int encode(void);
+};
+
+/*
+ * ExynosJpegDecoder class
+ */
+class ExynosJpegDecoder : public ExynosJpegBase {
+public:
+ ExynosJpegDecoder();
+ virtual ~ExynosJpegDecoder();
+
+ int create(void);
+ int destroy(void);
+
+ int setJpegConfig(void* pConfig);
+
+ int checkInBufType(void);
+ int checkOutBufType(void);
+
+ int getInBuf(int *piBuf, int *piInputSize);
+ int getOutBuf(int *picBuf, int *piOutputSize, int iSize);
+
+ int setInBuf(int iBuf, int iSize);
+ int setOutBuf(int *piBuf, int *iSize);
+
+ int getInBuf(char **pcBuf, int *piInputSize);
+ int getOutBuf(char **pcBuf, int *piOutputSize, int iSize);
+
+ int setInBuf(char *pcBuf, int iSize);
+ int setOutBuf(char **pcBuf, int *iSize);
+
+ int getSize(int *piWidth, int *piHeight);
+ int setColorFormat(int iV4l2ColorFormat);
+ int setJpegFormat(int iV4l2JpegFormat);
+ int updateConfig(void);
+
+ int setScaledSize(int iW, int iH);
+ int setJpegSize(int iJpegSize);
+
+ int decode(void);
+};
+
+#endif /* __EXYNOS_JPEG_BASE_H__ */
diff --git a/include/gralloc_priv.h b/include/gralloc_priv.h
new file mode 100755
index 0000000..059a018
--- /dev/null
+++ b/include/gralloc_priv.h
@@ -0,0 +1,178 @@
+/*
+ * Copyright (C) 2013 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 <limits.h>
+#include <sys/cdefs.h>
+#include <hardware/gralloc.h>
+#include <pthread.h>
+#include <errno.h>
+#include <unistd.h>
+
+#include <cutils/native_handle.h>
+
+#include <linux/fb.h>
+
+/*****************************************************************************/
+
+struct private_module_t;
+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 ionfd;
+
+ struct fb_var_screeninfo info;
+ struct fb_fix_screeninfo finfo;
+ int xres;
+ int yres;
+ int line_length;
+ float xdpi;
+ float ydpi;
+ float fps;
+ void *queue;
+ pthread_mutex_t queue_lock;
+
+};
+
+/*****************************************************************************/
+
+#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 = 0x00000020
+ };
+
+ // file-descriptors
+ int fd;
+ int fd1;
+ int fd2;
+ // ints
+ int magic;
+ int flags;
+ int size;
+ int offset;
+
+ int format;
+ int width;
+ int height;
+ int stride;
+ int vstride;
+
+ // FIXME: the attributes below should be out-of-line
+ void *base;
+ void *base1;
+ void *base2;
+ struct ion_handle *handle;
+ struct ion_handle *handle1;
+ struct ion_handle *handle2;
+
+#ifdef __cplusplus
+ static const int sNumFds = 3;
+ static const int sNumInts = 15;
+ static const int sMagic = 0x3141592;
+
+ private_handle_t(int fd, int size, int flags) :
+ fd(fd), fd1(-1), fd2(-1), magic(sMagic), flags(flags), size(size),
+ offset(0), format(0), width(0), height(0), stride(0),
+ vstride(0), base(0), base1(0), base2(0), handle(0), handle1(0),
+ handle2(0)
+ {
+ version = sizeof(native_handle);
+ numInts = sNumInts + 2;
+ numFds = sNumFds - 2;
+ }
+
+ private_handle_t(int fd, int size, int flags, int w,
+ int h, int format, int stride, int vstride) :
+ fd(fd), fd1(-1), fd2(-1), magic(sMagic), flags(flags), size(size),
+ offset(0), format(format), width(w), height(h), stride(stride),
+ vstride(vstride), base(0), base1(0), base2(0), handle(0), handle1(0),
+ handle2(0)
+ {
+ version = sizeof(native_handle);
+ numInts = sNumInts + 2;
+ numFds = sNumFds - 2;
+ }
+
+ private_handle_t(int fd, int fd1, int size, int flags, int w,
+ int h, int format, int stride, int vstride) :
+ fd(fd), fd1(fd1), fd2(-1), magic(sMagic), flags(flags), size(size),
+ offset(0), format(format), width(w), height(h), stride(stride),
+ vstride(vstride), base(0), base1(0), base2(0), handle(0), handle1(0),
+ handle2(0)
+ {
+ version = sizeof(native_handle);
+ numInts = sNumInts + 1;
+ numFds = sNumFds - 1;
+ }
+
+ private_handle_t(int fd, int fd1, int fd2, int size, int flags, int w,
+ int h, int format, int stride, int vstride) :
+ fd(fd), fd1(fd1), fd2(fd2), magic(sMagic), flags(flags), size(size),
+ offset(0), format(format), width(w), height(h), stride(stride),
+ vstride(vstride), base(0), base1(0), base2(0), handle(0), handle1(0),
+ handle2(0)
+ {
+ version = sizeof(native_handle);
+ numInts = sNumInts;
+ numFds = sNumFds;
+ }
+ ~private_handle_t() {
+ magic = 0;
+ }
+
+ static int validate(const native_handle* h) {
+ const private_handle_t* hnd = (const private_handle_t*)h;
+ if (!h || h->version != sizeof(native_handle) ||
+ hnd->numInts + hnd->numFds != sNumInts + sNumFds ||
+ hnd->magic != sMagic)
+ {
+ ALOGE("invalid gralloc handle (at %p)", reinterpret_cast<void *>(const_cast<native_handle *>(h)));
+ 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/include/sec_g2d_comp.h b/include/sec_g2d_comp.h
new file mode 100644
index 0000000..14ce416
--- /dev/null
+++ b/include/sec_g2d_comp.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright Samsung Electronics Co.,LTD.
+ * Copyright (C) 2013 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 <stdlib.h>
+#include <stdio.h>
+
+/* int comp_value[src][dst][scale][filter_mode][blending_mode]
+ * [src]
+ * 0 : kRGB_565_Config
+ * 1 : kARGB_4444_Config
+ * 2 : kARGB_8888_Config
+ * 3 : kNo_Config
+ * [dst]
+ * 0 : kRGB_565_Config
+ * 1 : kARGB_4444_Config
+ * 2 : kARGB_8888_Config
+ * [scale]
+ * 0 : No scaling
+ * 1 : Scaling_up
+ * 2 : Scaling_down
+ * [filter_mode]
+ * 0 : nearest
+ * 1 : bilinear
+ * [blending_mode]
+ * 0 : SRC
+ * 1 : SRC_OVER
+ */
+
+int comp_value[3][2][3][2][2] = {
+//rgb565 to rgb565
+//{ nearest }, { bilinear }
+//{ SRC , SRC_OVER }, { SRC , SRC_OVER }
+{{
+{{ 135* 76,1920*1080 }, { 125* 70, 922* 519 }}, //No scaling
+{{ 121* 68, 438* 246 }, { 111* 62, 145* 81 }}, //Scaling up
+{{ 119* 67, 374* 211 }, { 96* 54, 144* 81 }}}, //Scaling down
+//rgb565 to argb8888
+{
+{{ 194* 109, 221* 124 }, { 197* 111, 203* 114 }}, //No Scaling
+{{ 201* 113, 201* 113 }, { 155* 87, 159* 89 }}, //Scaling up
+{{ 202* 114, 200* 112 }, { 125* 70, 116* 66 }}} //Scaling down
+},
+//argb8888 to rgb565
+{{
+{{ 136* 77, 343* 193 }, { 139* 78, 357* 201 }}, //No Scaling
+{{ 148* 83, 282* 159 }, { 107* 60, 143* 81 }}, //Scaling up
+{{ 144* 81, 243* 137 }, { 95* 53, 122* 69 }}}, //Scaling down
+//argb8888 to argb8888
+{
+{{ 744* 418, 712* 401 }, { 736* 414, 478* 269 }}, //No Scaling
+{{ 406* 228, 305* 172 }, { 187* 105, 162* 91 }}, //Scaling up
+{{ 307* 173, 257* 144 }, { 118* 66, 115* 65 }}} //Scaling down
+},
+//No Src to rgb565 (Not measured yet)
+{{
+{{8000*8000,8000*8000 }, {8000*8000,8000*8000 }}, //No Scaling
+{{8000*8000,8000*8000 }, {8000*8000,8000*8000 }}, //Scaling up
+{{8000*8000,8000*8000 }, {8000*8000,8000*8000 }}}, //Scaling down
+//No src to argb8888 (Fill to argb8888)
+{
+{{1920*1080,1279* 719 }, {1266* 712,1276* 718 }}, //No Scaling
+{{1272* 715,1272* 715 }, {1258* 707,1278* 719 }}, //Scaling up
+{{1269* 714,1269* 714 }, {1258* 708,1271* 715 }}} //Scaling down
+}
+};