3 ** Copyright 2008, The Android Open Source Project
4 ** Copyright 2009 Samsung Electronics Co, Ltd. All Rights Reserved.
6 ** Licensed under the Apache License, Version 2.0 (the "License");
7 ** you may not use this file except in compliance with the License.
8 ** You may obtain a copy of the License at
10 ** http://www.apache.org/licenses/LICENSE-2.0
12 ** Unless required by applicable law or agreed to in writing, software
13 ** distributed under the License is distributed on an "AS IS" BASIS,
14 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 ** See the License for the specific language governing permissions and
16 ** limitations under the License.
21 #ifndef FIMG_EXYNOS5_H
22 #define FIMG_EXYNOS5_H
34 #include <sys/ioctl.h>
38 #include <utils/threads.h>
39 #include <utils/StopWatch.h>
43 #include "sec_g2d_4x.h"
48 #define NUMBER_FIMG_LIST (1)
49 #define GET_RECT_SIZE(rect) ((rect->full_w) * (rect->h) * (rect->bytes_per_pixel))
50 #define GET_REAL_SIZE(rect) ((rect->full_w) * (rect->h) * (rect->bytes_per_pixel))
51 #define GET_START_ADDR(rect) (rect->virt_addr + ((rect->y * rect->full_w) * rect->bytes_per_pixel))
52 #define SLEEP_TIME (100000) // 100 msec
54 int compare_size
[][4] = { {160, 97, 240, 146}, {228, 228, 266, 266}, {160, 97, 280, 170} };
56 //---------------------------------------------------------------------------//
57 // class FimgV4x : public FimgBase
58 //---------------------------------------------------------------------------//
59 class FimgV4x
: public FimgApi
64 unsigned char *m_g2dVirtAddr
;
65 unsigned int m_g2dSize
;
66 unsigned char *m_g2dSrcVirtAddr
;
67 unsigned int m_g2dSrcSize
;
68 unsigned char *m_g2dDstVirtAddr
;
69 unsigned int m_g2dDstSize
;
70 struct pollfd m_g2dPoll
;
74 static unsigned m_curFimgV4xIndex
;
75 static int m_numOfInstance
;
77 static FimgApi
*m_ptrFimgApiList
[NUMBER_FIMG_LIST
];
84 static FimgApi
*CreateInstance();
85 static void DestroyInstance(FimgApi
*ptrFimgApi
);
86 static void DestroyAllInstance(void);
89 virtual bool t_Create(void);
90 virtual bool t_Destroy(void);
91 virtual bool t_Stretch(struct fimg2d_blit
*cmd
);
92 virtual bool t_Sync(void);
93 virtual bool t_Lock(void);
94 virtual bool t_UnLock(void);
97 bool m_CreateG2D(void);
98 bool m_DestroyG2D(void);
100 bool m_DoG2D(struct fimg2d_blit
*cmd
);
102 inline bool m_PollG2D(struct pollfd
*events
);
104 inline int m_ColorFormatFimgApi2FimgHw(int colorFormat
);
107 class FimgApiAutoFreeThread
;
109 static sp
<FimgApiAutoFreeThread
> fimgApiAutoFreeThread
= 0;
111 class FimgApiAutoFreeThread
: public Thread
118 FimgApiAutoFreeThread(void):
123 ~FimgApiAutoFreeThread(void)
125 if (mDestroyed
== false) {
126 FimgV4x::DestroyAllInstance();
131 virtual void onFirstRef()
133 run("FimgApiAutoFreeThread", PRIORITY_BACKGROUND
);
136 virtual bool threadLoop()
139 if (mOneMoreSleep
== true) {
140 mOneMoreSleep
= false;
146 if (mDestroyed
== false) {
147 FimgV4x::DestroyAllInstance();
151 fimgApiAutoFreeThread
= 0;
157 void SetOneMoreSleep(void)
159 mOneMoreSleep
= true;
163 }; // namespace android
165 #endif // FIMG_EXYNOS5_H