MT2523 API Reference  LinkIt SDK v4
hal_g2d.h
1 /* Copyright Statement:
2  *
3  * (C) 2005-2016 MediaTek Inc. All rights reserved.
4  *
5  * This software/firmware and related documentation ("MediaTek Software") are
6  * protected under relevant copyright laws. The information contained herein
7  * is confidential and proprietary to MediaTek Inc. ("MediaTek") and/or its licensors.
8  * Without the prior written permission of MediaTek and/or its licensors,
9  * any reproduction, modification, use or disclosure of MediaTek Software,
10  * and information contained herein, in whole or in part, shall be strictly prohibited.
11  * You may only use, reproduce, modify, or distribute (as applicable) MediaTek Software
12  * if you have agreed to and been bound by the applicable license agreement with
13  * MediaTek ("License Agreement") and been granted explicit permission to do so within
14  * the License Agreement ("Permitted User"). If you are not a Permitted User,
15  * please cease any access or use of MediaTek Software immediately.
16  * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
17  * THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES
18  * ARE PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
19  * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
21  * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
22  * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
23  * SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
24  * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
25  * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
26  * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
27  * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
28  * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
29  * CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
30  * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE MEDIATEK SOFTWARE AT ISSUE,
31  * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
32  * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
33  */
34 
35 #ifndef __HAL_G2D_H__
36 #define __HAL_G2D_H__
37 
38 #include "hal_platform.h"
39 
40 #ifdef HAL_G2D_MODULE_ENABLED
41 
127 #ifdef __cplusplus
128 extern "C" {
129 #endif
130 
131 /*****************************************************************************
132  * Enums
133  *****************************************************************************/
134 
140 typedef enum {
148 
150 typedef enum {
153 
155 typedef enum {
159 
161 typedef enum {
173 
175 typedef enum {
182 
184 typedef enum {
190 
192 typedef enum {
197 
199 typedef enum {
209 
211 typedef enum {
217 
219 typedef enum {
224 
229 /*****************************************************************************
230  * Structures
231  *****************************************************************************/
232 
238 typedef struct hal_g2d_hanele_struct_t hal_g2d_handle_t;
239 
257 typedef bool (*hal_g2d_callback_t)(void *);
258 
263 /*****************************************************************************
264  * Functions
265  *****************************************************************************/
266 
272 
281 hal_g2d_status_t hal_g2d_get_handle(hal_g2d_handle_t **handle_ptr, hal_g2d_codec_type_t codec_type, hal_g2d_get_handle_mode_t handle_mode);
282 
290 
301  uint32_t *min_width, uint32_t *max_width, uint32_t *min_height, uint32_t *max_height);
302 
310 
321 hal_g2d_status_t hal_g2d_set_clipping_window(hal_g2d_handle_t *handle, int32_t x, int32_t y, int32_t width, int32_t height);
322 
337  uint8_t alpha0, uint8_t red0, uint8_t green0, uint8_t blue0, uint8_t alpha1, uint8_t red1, uint8_t green1, uint8_t blue1);
338 
349 hal_g2d_status_t hal_g2d_set_source_key(hal_g2d_handle_t *handle, uint8_t alpha, uint8_t red, uint8_t green, uint8_t blue);
350 
364  uint8_t *buffer, uint32_t size, uint32_t width, uint32_t height, hal_g2d_color_format_t color_format);
365 
378  uint8_t *buffer, uint32_t size, uint32_t width, uint32_t height, hal_g2d_color_format_t color_format);
379 
387 
395 hal_g2d_status_t hal_g2d_query_support(hal_g2d_codec_type_t codec_type, hal_g2d_supported_function_t function_type);
396 
405 
414  hal_g2d_overlay_layer_t layer, hal_g2d_overlay_layer_function_t function);
415 
424  hal_g2d_overlay_layer_t layer, uint32_t rectfill_color);
425 
436  hal_g2d_overlay_layer_t layer, uint8_t *buffer, uint32_t size);
437 
451  hal_g2d_overlay_layer_t layer, uint8_t *buffer, uint32_t size,
452  uint32_t width, uint32_t height, hal_g2d_color_format_t color_format);
453 
468  hal_g2d_overlay_layer_t layer, uint8_t *buffer[3], uint32_t size[3],
469  uint32_t width, uint32_t height, hal_g2d_color_format_t color_format);
470 
483  hal_g2d_overlay_layer_t layer, int32_t x, int32_t y, uint32_t width, uint32_t height);
484 
493  hal_g2d_overlay_layer_t layer, uint32_t src_key_value);
494 
503  hal_g2d_overlay_layer_t layer, hal_g2d_rotate_angle_t rotation);
504 
513  hal_g2d_overlay_layer_t layer, uint32_t alpha_value);
514 
522 
529 hal_g2d_status_t hal_g2d_overlay_set_alpha(hal_g2d_handle_t *handle, uint32_t alpha_value);
530 
538 hal_g2d_status_t hal_g2d_overlay_set_window(hal_g2d_handle_t *handle, int32_t x, int32_t y);
539 
550 hal_g2d_status_t hal_g2d_overlay_set_roi_window(hal_g2d_handle_t *handle, int32_t x, int32_t y, uint32_t width, uint32_t height);
551 
559 
570 hal_g2d_status_t hal_g2d_set_dithering(hal_g2d_handle_t *handle, hal_g2d_dithering_mode_t mode, uint8_t red_bit, uint8_t green_bit, uint8_t blue_bit);
571 
581 
591 
603 hal_g2d_status_t hal_g2d_rectfill_set_destination_window(hal_g2d_handle_t *handle, int32_t x, int32_t y, int32_t width, int32_t height);
604 
613 
629  int32_t *min_x, int32_t *max_x, int32_t *min_y, int32_t *max_y,
630  uint32_t *min_width, uint32_t *max_width, uint32_t *min_height, uint32_t *max_height);
631 
640 
641 #ifdef __cplusplus
642 }
643 #endif
644 
650 #endif /* HAL_G2D_MODULE_ENABLED */
651 #endif /* __HAL_G2D_H__ */
hal_g2d_status_t hal_g2d_overlay_set_alpha(hal_g2d_handle_t *handle, uint32_t alpha_value)
This function sets the destination alpha.
Mirror and then rotate 90 degrees.
Definition: hal_g2d.h:205
The G2D function is not supported.
Definition: hal_g2d.h:144
PARGB6666.
Definition: hal_g2d.h:169
Layer 0.
Definition: hal_g2d.h:185
hal_g2d_status_t hal_g2d_overlay_set_layer_alpha(hal_g2d_handle_t *handle, hal_g2d_overlay_layer_t layer, uint32_t alpha_value)
This function sets the alpha to a layer.
8-bit per font pixel.
Definition: hal_g2d.h:215
Layer 1.
Definition: hal_g2d.h:186
hal_g2d_status_t hal_g2d_overlay_set_background_color(hal_g2d_handle_t *handle, uint32_t bg_color)
This function sets the background color.
Rotate 180 degrees.
Definition: hal_g2d.h:202
ARGB8565.
Definition: hal_g2d.h:165
hal_g2d_status_t hal_g2d_get_handle(hal_g2d_handle_t **handle_ptr, hal_g2d_codec_type_t codec_type, hal_g2d_get_handle_mode_t handle_mode)
This function gets a G2D handle to access and control the G2D engine.
bool(* hal_g2d_callback_t)(void *)
Defines the prototype of the G2D callback function.
Definition: hal_g2d.h:257
Rotate 90 degrees.
Definition: hal_g2d.h:201
Bitblt function.
Definition: hal_g2d.h:176
hal_g2d_status_t
This enum defines the return status of the G2D API.
Definition: hal_g2d.h:140
hal_g2d_status_t hal_g2d_overlay_set_layer_buffer(hal_g2d_handle_t *handle, hal_g2d_overlay_layer_t layer, uint8_t *buffer, uint32_t size)
hal_g2d_status_t hal_g2d_overlay_set_layer_window(hal_g2d_handle_t *handle, hal_g2d_overlay_layer_t layer, int32_t x, int32_t y, uint32_t width, uint32_t height)
This function sets the rectangle to a layer.
Random dithering.
Definition: hal_g2d.h:221
4-bit per font pixel.
Definition: hal_g2d.h:214
hal_g2d_supported_function_t
This enum defines the G2D supported functions.
Definition: hal_g2d.h:175
Unsupported color format.
Definition: hal_g2d.h:142
hal_g2d_dithering_mode_t
This enum defines the G2D dithering mode.
Definition: hal_g2d.h:219
hal_g2d_status_t hal_g2d_rectfill_set_color(hal_g2d_handle_t *handle, uint32_t color)
hal_g2d_status_t hal_g2d_overlay_set_layer_font_color(hal_g2d_handle_t *handle, hal_g2d_overlay_layer_t layer, uint32_t color)
This function sets the font color for a layer.
hal_g2d_status_t hal_g2d_overlay_set_layer_function(hal_g2d_handle_t *handle, hal_g2d_overlay_layer_t layer, hal_g2d_overlay_layer_function_t function)
This function sets an overlay layer function to a specific layer.
hal_g2d_status_t hal_g2d_overlay_set_layer_font_format(hal_g2d_handle_t *handle, hal_g2d_overlay_layer_t layer, hal_g2d_font_format_t format)
This function sets the font format for a layer.
No rotation.
Definition: hal_g2d.h:200
Disable dithering.
Definition: hal_g2d.h:220
Fixed-pattern dithering.
Definition: hal_g2d.h:222
hal_g2d_status_t hal_g2d_query_support(hal_g2d_codec_type_t codec_type, hal_g2d_supported_function_t function_type)
This function queries whether a particular function type is supported by the G2D engine.
Blocking mode.
Definition: hal_g2d.h:156
hal_g2d_status_t hal_g2d_overlay_set_layer_source_key(hal_g2d_handle_t *handle, hal_g2d_overlay_layer_t layer, uint32_t src_key_value)
This function enables the source key for a layer.
The G2D hardware is busy.
Definition: hal_g2d.h:145
1-bit per font pixel.
Definition: hal_g2d.h:212
hal_g2d_status_t hal_g2d_overlay_enable_layer(hal_g2d_handle_t *handle, hal_g2d_overlay_layer_t layer, bool show_layer)
This function enables a layer.
hal_g2d_status_t hal_g2d_overlay_set_layer_rectfill_color(hal_g2d_handle_t *handle, hal_g2d_overlay_layer_t layer, uint32_t rectfill_color)
This function sets rectangle fill color to a specific layer.
hal_g2d_overlay_layer_t
This enum defines the G2D overlay layer.
Definition: hal_g2d.h:184
BGR888.
Definition: hal_g2d.h:164
Layer 2.
Definition: hal_g2d.h:187
hal_g2d_status_t hal_g2d_rectangle_fill_query_window_range(hal_g2d_handle_t *handle, int32_t *min_x, int32_t *max_x, int32_t *min_y, int32_t *max_y, uint32_t *min_width, uint32_t *max_width, uint32_t *min_height, uint32_t *max_height)
Overlay function.
Definition: hal_g2d.h:179
hal_g2d_status_t hal_set_rgb_buffer(hal_g2d_handle_t *handle, uint8_t *buffer, uint32_t size, uint32_t width, uint32_t height, hal_g2d_color_format_t color_format)
Rectfill function.
Definition: hal_g2d.h:177
hal_g2d_status_t hal_g2d_overlay_set_layer_rgb_buffer(hal_g2d_handle_t *handle, hal_g2d_overlay_layer_t layer, uint8_t *buffer, uint32_t size, uint32_t width, uint32_t height, hal_g2d_color_format_t color_format)
This function sets the RGB buffer information to this layer.
hal_g2d_status_t hal_g2d_replace_color(hal_g2d_handle_t *handle, uint8_t alpha0, uint8_t red0, uint8_t green0, uint8_t blue0, uint8_t alpha1, uint8_t red1, uint8_t green1, uint8_t blue1)
The color of the pixel that matches to the combination of the old set (alpha0, red0, green0, blue0) is replaced with the combination of the new set (alpha1, red1, green1, blue1).
hal_g2d_codec_type_t
This enum defines the G2D codec type.
Definition: hal_g2d.h:150
hal_g2d_status_t hal_g2d_set_rgb_buffer(hal_g2d_handle_t *handle, uint8_t *buffer, uint32_t size, uint32_t width, uint32_t height, hal_g2d_color_format_t color_format)
This function sets the destination buffer.
hal_g2d_font_format_t
This enum defines the G2D font format.
Definition: hal_g2d.h:211
hal_g2d_status_t hal_g2d_query_rgb_buffer_range(hal_g2d_handle_t *handle, uint32_t *min_width, uint32_t *max_width, uint32_t *min_height, uint32_t *max_height)
This function queries the range of the destination buffer.
hal_g2d_status_t hal_g2d_overlay_set_layer_rotation(hal_g2d_handle_t *handle, hal_g2d_overlay_layer_t layer, hal_g2d_rotate_angle_t rotation)
This function sets the rotation for a layer.
hal_g2d_status_t hal_g2d_set_dithering(hal_g2d_handle_t *handle, hal_g2d_dithering_mode_t mode, uint8_t red_bit, uint8_t green_bit, uint8_t blue_bit)
This function sets the dithering of the destination.
Font.
Definition: hal_g2d.h:193
PARGB8888.
Definition: hal_g2d.h:170
hal_g2d_status_t hal_g2d_register_callback(hal_g2d_handle_t *handle, hal_g2d_callback_t callback)
This function registers a user-defined callback function for the G2D completion events.
hal_g2d_status_t hal_g2d_rectfill_start(hal_g2d_handle_t *handle)
Mirror and then rotate 270 degrees.
Definition: hal_g2d.h:207
Buffer.
Definition: hal_g2d.h:195
hal_g2d_rotate_angle_t
This enum defines the G2D rotation angle.
Definition: hal_g2d.h:199
hal_g2d_color_format_t
This enum defines the G2D color format.
Definition: hal_g2d.h:161
Rotate 270 degrees.
Definition: hal_g2d.h:203
hal_g2d_status_t hal_g2d_overlay_set_window(hal_g2d_handle_t *handle, int32_t x, int32_t y)
This function sets the coordinates in the destination window.
ARGB8888.
Definition: hal_g2d.h:167
struct hal_g2d_hanele_struct_t hal_g2d_handle_t
This structure presents the G2D handle.
Definition: hal_g2d.h:238
RGB565.
Definition: hal_g2d.h:162
hal_g2d_status_t hal_g2d_release_handle(hal_g2d_handle_t *handle)
This function releases the G2D handle and frees its associated resources occupied by this G2D handle...
Successful.
Definition: hal_g2d.h:146
Font function.
Definition: hal_g2d.h:178
hal_g2d_status_t hal_g2d_init(void)
This function initializes the G2D module.
Invalid parameter, such as failed on the range check.
Definition: hal_g2d.h:143
hal_g2d_status_t hal_g2d_set_clipping_window(hal_g2d_handle_t *handle, int32_t x, int32_t y, int32_t width, int32_t height)
The function sets the clipping window for the destination buffer.
Hardware error.
Definition: hal_g2d.h:141
PARGB8565.
Definition: hal_g2d.h:168
Mirror and then rotate 180 degrees.
Definition: hal_g2d.h:206
Rectangle fill.
Definition: hal_g2d.h:194
UYVY.
Definition: hal_g2d.h:171
Dithering function.
Definition: hal_g2d.h:180
Non Blocking mode.
Definition: hal_g2d.h:157
Layer 3.
Definition: hal_g2d.h:188
Hardware codec.
Definition: hal_g2d.h:151
hal_g2d_status_t hal_g2d_set_source_key(hal_g2d_handle_t *handle, uint8_t alpha, uint8_t red, uint8_t green, uint8_t blue)
hal_g2d_status_t hal_g2d_overlay_set_roi_window(hal_g2d_handle_t *handle, int32_t x, int32_t y, uint32_t width, uint32_t height)
This function sets the ROI(region of interest) window.
hal_g2d_status_t hal_g2d_overlay_start(hal_g2d_handle_t *handle)
This function starts the overlay.
RGB888.
Definition: hal_g2d.h:163
hal_g2d_status_t hal_g2d_overlay_set_layer_yuv_buffer(hal_g2d_handle_t *handle, hal_g2d_overlay_layer_t layer, uint8_t *buffer[3], uint32_t size[3], uint32_t width, uint32_t height, hal_g2d_color_format_t color_format)
hal_g2d_status_t hal_g2d_get_status(hal_g2d_handle_t *handle)
The function gets the status of G2D engine.
2-bit per font pixel.
Definition: hal_g2d.h:213
hal_g2d_status_t hal_g2d_rectfill_set_destination_window(hal_g2d_handle_t *handle, int32_t x, int32_t y, int32_t width, int32_t height)
Mirror.
Definition: hal_g2d.h:204
hal_g2d_get_handle_mode_t
This enum defines the G2D get handle mode.
Definition: hal_g2d.h:155
hal_g2d_overlay_layer_function_t
This enum defines the G2D overlay layer function.
Definition: hal_g2d.h:192
ARGB6666.
Definition: hal_g2d.h:166