1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
/*
* Copyright@ Samsung Electronics 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 SecFimc.h
* \brief header file for Fimc HAL MODULE
* \author Hyunkyung, Kim(hk310.kim@samsung.com)
* \date 2010/10/13
*
* <b>Revision History: </b>
* - 2010/10/13 : Hyunkyung, Kim(hk310.kim@samsung.com) \n
* Initial version
*
* - 2011/11/15 : Sunmi, Lee(carrotsm.lee@samsung.com) \n
* Adjust V4L2 architecture \n
*/
#ifndef __SEC_FIMC_H__
#define __SEC_FIMC_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <linux/fb.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <asm/sizes.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/poll.h>
#include <sys/mman.h>
#include <hardware/hardware.h>
#include "utils/Timers.h"
#include "s5p_fimc_v4l2.h"
#include "sec_utils_v4l2.h"
#include "sec_format.h"
#include "SecBuffer.h"
#include "SecRect.h"
#define PFX_NODE_FIMC "/dev/video"
#define MAX_DST_BUFFERS (3)
#define MAX_SRC_BUFFERS (1)
#define MAX_PLANES (3)
#ifdef __cplusplus
}
class SecFimc
{
public:
enum DEV {
DEV_0 = 0,
DEV_1,
DEV_2,
DEV_3,
DEV_MAX,
};
enum MODE {
MODE_NONE = 0,
MODE_SINGLE_BUF,
MODE_MULTI_BUF,
MODE_DMA_AUTO,
MODE_MAX,
};
private:
bool mFlagCreate;
int mDev;
int mFimcMode;
int mNumOfBuf;
int mRealDev;
int mFd;
int mHwVersion;
int mBufIndex;
int mRotVal;
bool mFlagGlobalAlpha;
int mGlobalAlpha;
bool mFlagLocalAlpha;
bool mFlagColorKey;
int mColorKey;
bool mFlagSetSrcParam;
bool mFlagSetDstParam;
bool mFlagStreamOn;
s5p_fimc_t mS5pFimc;
struct v4l2_capability mFimcCap;
SecBuffer mSrcBuffer;
SecBuffer mDstBuffer[MAX_DST_BUFFERS];
public:
SecFimc();
virtual ~SecFimc();
bool create(enum DEV dev, enum MODE mode, int numOfBuf);
bool destroy(void);
bool flagCreate(void);
int getFd(void);
SecBuffer * getMemAddr(int index = 0);
int getHWVersion(void);
bool setSrcParams(unsigned int width, unsigned int height,
unsigned int cropX, unsigned int cropY,
unsigned int *cropWidth, unsigned int *cropHeight,
int colorFormat,
bool forceChange = true);
bool getSrcParams(unsigned int *width, unsigned int *height,
unsigned int *cropX, unsigned int *cropY,
unsigned int *cropWidth, unsigned int *cropHeight,
int *colorFormat);
bool setSrcAddr(unsigned int physYAddr,
unsigned int physCbAddr = 0,
unsigned int physCrAddr = 0,
int colorFormat = 0);
bool setDstParams(unsigned int width, unsigned int height,
unsigned int cropX, unsigned int cropY,
unsigned int *cropWidth, unsigned int *cropHeight,
int colorFormat,
bool forceChange = true);
bool getDstParams(unsigned int *width, unsigned int *height,
unsigned int *cropX, unsigned int *cropY,
unsigned int *cropWidth, unsigned int *cropHeight,
int *colorFormat);
bool setDstAddr(unsigned int physYAddr, unsigned int physCbAddr = 0, unsigned int physCrAddr = 0, int buf_index = 0);
bool setRotVal(unsigned int rotVal);
bool setGlobalAlpha(bool enable = true, int alpha = 0xff);
bool setLocalAlpha(bool enable);
bool setColorKey(bool enable = true, int colorKey = 0xff);
bool draw(int src_index, int dst_index);
private:
bool m_streamOn(void);
bool m_checkSrcSize(unsigned int width, unsigned int height,
unsigned int cropX, unsigned int cropY,
unsigned int *cropWidth, unsigned int *cropHeight,
int colorFormat,
bool forceChange = false);
bool m_checkDstSize(unsigned int width, unsigned int height,
unsigned int cropX, unsigned int cropY,
unsigned int *cropWidth, unsigned int *cropHeight,
int colorFormat,
int rotVal,
bool forceChange = false);
int m_widthOfFimc(int v4l2ColorFormat, int width);
int m_heightOfFimc(int v4l2ColorFormat, int height);
int m_getYuvBpp(unsigned int fmt);
int m_getYuvPlanes(unsigned int fmt);
};
#endif
#endif //__SEC_FIMC_H__
|