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
47 #include "Exynos_log.h"
49 #ifndef EXYNOS_GSCALER_H_
50 #define EXYNOS_GSCALER_H_
56 //#define EXYNOS_GSC_TRACE 1
57 #ifdef EXYNOS_GSC_TRACE
58 #define EXYNOS_GSC_LOG_TAG "Exynos_gscaler"
59 #define Exynos_gsc_In() Exynos_Log(EXYNOS_DEV_LOG_DEBUG, EXYNOS_GSC_LOG_TAG, "%s In , Line: %d", __FUNCTION__, __LINE__)
60 #define Exynos_gsc_Out() Exynos_Log(EXYNOS_DEV_LOG_DEBUG, EXYNOS_GSC_LOG_TAG, "%s Out , Line: %d", __FUNCTION__, __LINE__)
62 #define Exynos_gsc_In() ((void *)0)
63 #define Exynos_gsc_Out() ((void *)0)
85 #ifdef USES_VR_FRONT_BUFFER
97 /* [Sa + (1 - Sa)*Da, Rc = Sc + (1 - Sa)*Dc] */
99 /* [Sa + (1 - Sa)*Da, Rc = Dc + (1 - Da)*Sc] */
101 /* [Sa * Da, Sc * Da] */
103 /* [Sa * Da, Sa * Dc] */
105 /* [Sa * (1 - Da), Sc * (1 - Da)] */
107 /* [Da * (1 - Sa), Dc * (1 - Sa)] */
109 /* [Da, Sc * Da + (1 - Sa) * Dc] */
111 /* [Sa, Sc * (1 - Da) + Sa * Dc ] */
113 /* [-(Sa * Da), Sc * (1 - Da) + (1 - Sa) * Dc] */
115 /* [Sa + Da - Sa*Da, Sc*(1 - Da) + Dc*(1 - Sa) + min(Sc, Dc)] */
117 /* [Sa + Da - Sa*Da, Sc*(1 - Da) + Dc*(1 - Sa) + max(Sc, Dc)] */
119 /** [Sa * Da, Sc * Dc] */
121 /* [Sa + Da - Sa * Da, Sc + Dc - Sc * Dc] */
123 /* Saturate(S + D) */
128 COLORSPACE_SMPTE170M
,
129 COLORSPACE_SMPTE240M
,
132 COLORSPACE_470_SYSTEM_M
,
133 COLORSPACE_470_SYSTEM_BG
,
138 struct SrcGlobalAlpha
{
144 uint32_t enable
; // set 'true' for user-defined
145 enum colorspace space
;
149 struct SrcBlendInfo
{
151 unsigned int srcblendfmt
;
152 unsigned int srcblendhpos
;
153 unsigned int srcblendvpos
;
154 unsigned int srcblendpremulti
;
155 unsigned int srcblendstride
;
156 unsigned int srcblendwidth
;
157 unsigned int srcblendheight
;
158 struct SrcGlobalAlpha globalalpha
;
159 struct CSC_Spec cscspec
;
163 * Create libgscaler handle.
164 * Gscaler dev_num is dynamically changed.
166 * \ingroup exynos_gscaler
171 void *exynos_gsc_create(
175 * Create exclusive libgscaler handle.
176 * Other module can't use dev_num of Gscaler.
178 * \ingroup exynos_gscaler
181 * gscaler dev_num[in]
183 *It should be set to GSC_M2M_MODE or GSC_OUTPUT_MODE.
186 *It should be set to GSC_OUT_FIMD or GSC_OUT_TV.
191 void *exynos_gsc_create_exclusive(
198 * Destroy libgscaler handle
200 * \ingroup exynos_gscaler
203 * libgscaler handle[in]
205 void exynos_gsc_destroy(
209 * Set csc equation property
211 * \ingroup exynos_gscaler
214 * libgscaler handle[in]
217 * csc mode (0: user, 1: auto)[in]
220 * csc range (0: narrow, 1: full)[in]
222 * \param v4l2_colorspace
223 * ITU_R v4l2 colorspace(1: 601, 3: 709)[in]
225 int exynos_gsc_set_csc_property(
227 unsigned int eq_auto
,
228 unsigned int range_full
,
229 unsigned int v4l2_colorspace
);
234 * \ingroup exynos_gscaler
237 * libgscaler handle[in]
246 * image left crop size[in]
249 * image top crop size[in]
252 * cropped image width[in]
255 * cropped image height[in]
257 * \param v4l2_colorformat
269 int exynos_gsc_set_src_format(
273 unsigned int crop_left
,
274 unsigned int crop_top
,
275 unsigned int crop_width
,
276 unsigned int crop_height
,
277 unsigned int v4l2_colorformat
,
278 unsigned int cacheable
,
279 unsigned int mode_drm
);
282 * Set destination format.
284 * \ingroup exynos_gscaler
287 * libgscaler handle[in]
296 * image left crop size[in]
299 * image top crop size[in]
302 * cropped image width[in]
305 * cropped image height[in]
307 * \param v4l2_colorformat
319 int exynos_gsc_set_dst_format(
323 unsigned int crop_left
,
324 unsigned int crop_top
,
325 unsigned int crop_width
,
326 unsigned int crop_height
,
327 unsigned int v4l2_colorformat
,
328 unsigned int cacheable
,
329 unsigned int mode_drm
);
334 * \ingroup exynos_gscaler
337 * libgscaler handle[in]
340 * image rotation. It should be multiple of 90[in]
342 * \param flip_horizontal
343 * image flip_horizontal[in]
345 * \param flip_vertical
346 * image flip_vertical[in]
351 int exynos_gsc_set_rotation(
360 * \ingroup exynos_gscaler
363 * libgscaler handle[in]
366 * buffer pointer array[in]
368 * \param acquireFenceFd
369 * acquire fence fd for the buffer or -1[in]
374 int exynos_gsc_set_src_addr(
381 * Set destination buffer
384 * libgscaler handle[in]
387 * buffer pointer array[in]
389 * \param acquireFenceFd
390 * acquire fence fd for the buffer or -1[in]
395 int exynos_gsc_set_dst_addr(
402 * Convert color space with presetup color format
404 * \ingroup exynos_gscaler
407 * libgscaler handle[in]
412 int exynos_gsc_convert(
416 * API for setting GSC subdev crop
419 int exynos_gsc_subdev_s_crop(
421 exynos_mpp_img
*src_img
,
422 exynos_mpp_img
*dst_img
);
425 *api for setting the GSC config.
426 It configures the GSC for given config
428 int exynos_gsc_config_exclusive(
430 exynos_mpp_img
*src_img
,
431 exynos_mpp_img
*dst_img
);
434 *api for GSC-OUT run.
435 It queues the srcBuf to GSC and deques a buf from driver.
436 It should be called after configuring the GSC.
438 int exynos_gsc_run_exclusive(
440 exynos_mpp_img
*src_img
,
441 exynos_mpp_img
*dst_img
);
444 * Create exclusive libgscaler blend handle.
445 * Other module can't use dev_num of Gscaler.
447 * \ingroup exynos_gscaler
450 * gscaler dev_num[in]
455 void *exynos_gsc_create_blend_exclusive(
462 *api for setting the GSC blend config.
463 It configures the GSC for given config
465 int exynos_gsc_config_blend_exclusive(
467 exynos_mpp_img
*src_img
,
468 exynos_mpp_img
*dst_img
,
469 struct SrcBlendInfo
*srcblendinfo
);
472 * Blocks until the current frame is done processing.
474 int exynos_gsc_wait_frame_done_exclusive
479 It stops the GSC OUT streaming.
481 int exynos_gsc_stop_exclusive
485 *api for GSC free_and_close.
487 int exynos_gsc_free_and_close
506 GSC_DONE_CNG_CFG
= 0,
521 #endif /*EXYNOS_GSCALER_H_*/