2 * Copyright (C) 2013 The Android Open Source Project
3 * Copyright@ Samsung Electronics 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_blender.h
20 * \brief User's API for Exynos Blender library
21 * \author Eunseok Choi (es10.choi@samsung.com)
24 * <b>Revision History: </b>
25 * - 2013.09.21 : Eunseok Choi (eunseok.choi@samsung.com) \n
29 #ifndef __EXYNOS_BLENDER_H__
30 #define __EXYNOS_BLENDER_H__
32 #include <linux/videodev2.h>
34 #define BL_MAX_PLANES 3
38 DEV_G2D0
, DEVID_G2D_END
,
70 //! transparent mode. need bgcolor
72 //! bluescreen mode. need bgcolor and bscolor
78 //! true: device open with NONBLOCK flag.
82 typedef void *bl_handle_t
;
89 * Create exynos_blender handle
91 * \ingroup exynos_blender
94 * blender property[in]
97 * exynos_blender handle
99 bl_handle_t
exynos_bl_create(struct bl_property
*prop
);
102 * Destroy exynos_blender handle
104 * \ingroup exynos_blender
107 * exynos_blender handle[in]
109 void exynos_bl_destroy(bl_handle_t handle
);
112 * Deactivate exynos_blender: g2d-specific for drm
114 * \ingroup exynos_blender
117 * exynos_blender handle[in]
120 * true: deactivate, false: activated (default)
125 int exynos_bl_deactivate(bl_handle_t handle
, bool deact
);
128 * Set color fill mode and src color
130 * \ingroup exynos_blender
133 * exynos_blender handle[in]
136 * true: color fill mode.
137 * if true, src_addr & src_format is ignored.
139 * \param color_argb8888
140 * 32-bit color value, 'a' is msb.
145 int exynos_bl_set_color_fill(
148 uint32_t color_argb8888
);
151 * Set rotate and flip
153 * \ingroup exynos_blender
156 * exynos_blender handle[in]
159 * 90/180/270: clockwise degree
162 * true: hoizontal(y-axis) flip
165 * true: vertical(x-axis) flip
170 int exynox_bl_set_rotate(
179 * \ingroup exynos_blender
182 * exynos_blender handle[in]
185 * 2: SRC COPY (default), 4: SRC OVER
187 * \param premultiplied
188 * true: alpha premultiplied mode for src and dst
193 int exynos_bl_set_blend(
199 * Set global alpha value
201 * \ingroup exynos_blender
204 * exynos_blender handle[in]
210 * 0x0 for transpranet, 0xff for opaque. (default '0xff')
215 int exynos_bl_set_galpha(
218 unsigned char g_alpha
);
223 * \ingroup exynos_blender
226 * exynos_blender handle[in]
229 * true: enable dithering effect
234 int exynos_bl_set_dither(bl_handle_t handle
, bool enable
);
239 * \ingroup exynos_blender
242 * exynos_blender handle[in]
245 * 1: nearest, 2: bilinear, 3: polyphase
248 * src width in pixels of horizontal scale ratio
251 * dst width in pixels of horizontal scale ratio
254 * src height in pixels of vertical scale ratio
257 * dst height in pixels of vertical scale ratio
262 int exynos_bl_set_scale(
273 * \ingroup exynos_blender
276 * exynos_blender handle[in]
279 * 1: normal, 3: mirror(reflect), 4: clamp
284 int exynos_bl_set_repeat(bl_handle_t handle
, enum BL_REPEAT mode
);
289 * \ingroup exynos_blender
292 * exynos_blender handle[in]
295 * true: clip rect is inside of dst crop rect.
312 int exynos_bl_set_clip(
321 * Set colorspace conversion spec
323 * \ingroup exynos_blender
326 * exynos_blender handle[in]
329 * true: user-defined, false: auto
332 * V4L2_COLORSPACE_SMPTE170M: 601, V4L2_COLORSPACE_REC709: 709
335 * true: wide, false: narrow
340 int exynos_bl_set_csc_spec(
343 enum v4l2_colorspace space
,
347 * Set src image format
349 * \ingroup exynos_blender
352 * exynos_blender handle[in]
355 * full width in pixels
358 * full height in pixels
375 int exynos_bl_set_src_format(
381 unsigned int crop_width
,
382 unsigned int crop_height
,
383 unsigned int v4l2_colorformat
);
386 * Set dst image format
388 * \ingroup exynos_blender
391 * exynos_blender handle[in]
394 * full width in pixels
397 * full height in pixels
414 int exynos_bl_set_dst_format(
420 unsigned int crop_width
,
421 unsigned int crop_height
,
422 unsigned int v4l2_colorformat
);
427 * \ingroup exynos_blender
430 * exynos_blender handle[in]
433 * base address: userptr(ion or malloc), ion_fd: dmabuf
436 * V4L2_MEMORY_USERPTR: 2, V4L2_MEMORY_DMABUF: 4
441 int exynos_bl_set_src_addr(
443 void *addr
[BL_MAX_PLANES
],
444 enum v4l2_memory type
);
449 * \ingroup exynos_blender
452 * exynos_blender handle[in]
455 * base address: userptr(ion or malloc), fd: dmabuf(ion)
458 * V4L2_MEMORY_USERPTR: 2, V4L2_MEMORY_DMABUF: 4
463 int exynos_bl_set_dst_addr(
465 void *addr
[BL_MAX_PLANES
],
466 enum v4l2_memory type
);
469 * Start blending single frame
471 * \ingroup exynos_blender
474 * exynos_blender handle[in]
479 int exynos_bl_do_blend(bl_handle_t handle
);
482 * Start 2-step(scaling & rotation) blending single frame
484 * \ingroup exynos_blender
489 int exynos_bl_do_blend_fast(bl_handle_t handle
);
495 #endif // __EXYNOS_BLENER_H__