3 * Copyright 2012 Samsung Electronics S.LSI Co. LTD
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 * \file exynos_gscaler.h
20 * \brief header file for Gscaler HAL
21 * \author ShinWon Lee (shinwon.lee@samsung.com)
24 * <b>Revision History: </b>
25 * - 2012/01/09 : ShinWon Lee(shinwon.lee@samsung.com) \n
28 * - 2012/02/07 : ShinWon Lee(shinwon.lee@samsung.com) \n
29 * Change file name to exynos_gscaler.h
31 * - 2012/02/09 : Sangwoo, Parkk(sw5771.park@samsung.com) \n
32 * Use Multiple Gscaler by Multiple Process
34 * - 2012/02/20 : Sangwoo, Park(sw5771.park@samsung.com) \n
35 * Add exynos_gsc_set_rotation() API
37 * - 2012/02/20 : ShinWon Lee(shinwon.lee@samsung.com) \n
43 * \defgroup exynos_gscaler
44 * \brief API for gscaler
48 #ifndef EXYNOS_GSCALER_H_
49 #define EXYNOS_GSCALER_H_
57 //#define EXYNOS_GSC_TRACE 1
58 #ifdef EXYNOS_GSC_TRACE
59 #define EXYNOS_GSC_LOG_TAG "Exynos_gscaler"
60 #define Exynos_gsc_In() Exynos_Log(EXYNOS_DEV_LOG_DEBUG, EXYNOS_GSC_LOG_TAG, "%s In , Line: %d", __FUNCTION__, __LINE__)
61 #define Exynos_gsc_Out() Exynos_Log(EXYNOS_DEV_LOG_DEBUG, EXYNOS_GSC_LOG_TAG, "%s Out , Line: %d", __FUNCTION__, __LINE__)
63 #define Exynos_gsc_In()
64 #define Exynos_gsc_Out()
95 /* [Sa + (1 - Sa)*Da, Rc = Sc + (1 - Sa)*Dc] */
97 /* [Sa + (1 - Sa)*Da, Rc = Dc + (1 - Da)*Sc] */
99 /* [Sa * Da, Sc * Da] */
101 /* [Sa * Da, Sa * Dc] */
103 /* [Sa * (1 - Da), Sc * (1 - Da)] */
105 /* [Da * (1 - Sa), Dc * (1 - Sa)] */
107 /* [Da, Sc * Da + (1 - Sa) * Dc] */
109 /* [Sa, Sc * (1 - Da) + Sa * Dc ] */
111 /* [-(Sa * Da), Sc * (1 - Da) + (1 - Sa) * Dc] */
113 /* [Sa + Da - Sa*Da, Sc*(1 - Da) + Dc*(1 - Sa) + min(Sc, Dc)] */
115 /* [Sa + Da - Sa*Da, Sc*(1 - Da) + Dc*(1 - Sa) + max(Sc, Dc)] */
117 /** [Sa * Da, Sc * Dc] */
119 /* [Sa + Da - Sa * Da, Sc + Dc - Sc * Dc] */
121 /* Saturate(S + D) */
126 COLORSPACE_SMPTE170M,
127 COLORSPACE_SMPTE240M,
130 COLORSPACE_470_SYSTEM_M,
131 COLORSPACE_470_SYSTEM_BG,
136 struct SrcGlobalAlpha {
142 uint32_t enable; // set 'true' for user-defined
143 enum colorspace space;
147 struct SrcBlendInfo {
149 unsigned int srcblendfmt;
150 unsigned int srcblendhpos;
151 unsigned int srcblendvpos;
152 unsigned int srcblendpremulti;
153 unsigned int srcblendstride;
154 unsigned int srcblendwidth;
155 unsigned int srcblendheight;
156 struct SrcGlobalAlpha globalalpha;
157 struct CSC_Spec cscspec;
161 * Create libgscaler handle.
162 * Gscaler dev_num is dynamically changed.
164 * \ingroup exynos_gscaler
169 void *exynos_gsc_create(
173 * Create exclusive libgscaler handle.
174 * Other module can't use dev_num of Gscaler.
176 * \ingroup exynos_gscaler
179 * gscaler dev_num[in]
181 *It should be set to GSC_M2M_MODE or GSC_OUTPUT_MODE.
184 *It should be set to GSC_OUT_FIMD or GSC_OUT_TV.
189 void *exynos_gsc_create_exclusive(
196 * Destroy libgscaler handle
198 * \ingroup exynos_gscaler
201 * libgscaler handle[in]
203 void exynos_gsc_destroy(
207 * Set csc equation property
209 * \ingroup exynos_gscaler
212 * libgscaler handle[in]
215 * csc mode (0: user, 1: auto)[in]
218 * csc range (0: narrow, 1: full)[in]
220 * \param v4l2_colorspace
221 * ITU_R v4l2 colorspace(1: 601, 3: 709)[in]
223 int exynos_gsc_set_csc_property(
225 unsigned int eq_auto,
226 unsigned int range_full,
227 unsigned int v4l2_colorspace);
232 * \ingroup exynos_gscaler
235 * libgscaler handle[in]
244 * image left crop size[in]
247 * image top crop size[in]
250 * cropped image width[in]
253 * cropped image height[in]
255 * \param v4l2_colorformat
267 int exynos_gsc_set_src_format(
271 unsigned int crop_left,
272 unsigned int crop_top,
273 unsigned int crop_width,
274 unsigned int crop_height,
275 unsigned int v4l2_colorformat,
276 unsigned int cacheable,
277 unsigned int mode_drm);
280 * Set destination format.
282 * \ingroup exynos_gscaler
285 * libgscaler handle[in]
294 * image left crop size[in]
297 * image top crop size[in]
300 * cropped image width[in]
303 * cropped image height[in]
305 * \param v4l2_colorformat
317 int exynos_gsc_set_dst_format(
321 unsigned int crop_left,
322 unsigned int crop_top,
323 unsigned int crop_width,
324 unsigned int crop_height,
325 unsigned int v4l2_colorformat,
326 unsigned int cacheable,
327 unsigned int mode_drm);
332 * \ingroup exynos_gscaler
335 * libgscaler handle[in]
338 * image rotation. It should be multiple of 90[in]
340 * \param flip_horizontal
341 * image flip_horizontal[in]
343 * \param flip_vertical
344 * image flip_vertical[in]
349 int exynos_gsc_set_rotation(
358 * \ingroup exynos_gscaler
361 * libgscaler handle[in]
364 * buffer pointer array[in]
366 * \param acquireFenceFd
367 * acquire fence fd for the buffer or -1[in]
372 int exynos_gsc_set_src_addr(
379 * Set destination buffer
382 * libgscaler handle[in]
385 * buffer pointer array[in]
387 * \param acquireFenceFd
388 * acquire fence fd for the buffer or -1[in]
393 int exynos_gsc_set_dst_addr(
400 * Convert color space with presetup color format
402 * \ingroup exynos_gscaler
405 * libgscaler handle[in]
410 int exynos_gsc_convert(
414 * API for setting GSC subdev crop
417 int exynos_gsc_subdev_s_crop(
419 exynos_mpp_img *src_img,
420 exynos_mpp_img *dst_img);
423 *api for setting the GSC config.
424 It configures the GSC for given config
426 int exynos_gsc_config_exclusive(
428 exynos_mpp_img *src_img,
429 exynos_mpp_img *dst_img);
432 *api for GSC-OUT run.
433 It queues the srcBuf to GSC and deques a buf from driver.
434 It should be called after configuring the GSC.
436 int exynos_gsc_run_exclusive(
438 exynos_mpp_img *src_img,
439 exynos_mpp_img *dst_img);
442 * Create exclusive libgscaler blend handle.
443 * Other module can't use dev_num of Gscaler.
445 * \ingroup exynos_gscaler
448 * gscaler dev_num[in]
453 void *exynos_gsc_create_blend_exclusive(
460 *api for setting the GSC blend config.
461 It configures the GSC for given config
463 int exynos_gsc_config_blend_exclusive(
465 exynos_mpp_img *src_img,
466 exynos_mpp_img *dst_img,
467 struct SrcBlendInfo *srcblendinfo);
470 * Blocks until the current frame is done processing.
472 int exynos_gsc_wait_frame_done_exclusive
477 It stops the GSC OUT streaming.
479 int exynos_gsc_stop_exclusive
483 *api for GSC free_and_close.
485 int exynos_gsc_free_and_close
504 GSC_DONE_CNG_CFG = 0,
519 #endif /*EXYNOS_GSCALER_H_*/