30#ifndef __ARM_2D_HELPER_H__
31#define __ARM_2D_HELPER_H__
35#include "./arm_2d_helper_pfb.h"
36#include "./arm_2d_helper_scene.h"
37#include "./arm_2d_disp_adapters.h"
44# pragma clang diagnostic push
45# pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
46# pragma clang diagnostic ignored "-Wunused-function"
57#define __declare_tile(__name) \
58 extern const arm_2d_tile_t __name;
59#define declare_tile(__name) __declare_tile(__name)
61#define dcl_tile(__name) declare_tile(__name)
62#define dcl_fb(__name) declare_tile(__name)
65#define __impl_fb(__NAME, __WIDTH, __HEIGHT, __TYPE, ...) \
66 ARM_NOINIT static __TYPE \
67 __NAME##Buffer[(__WIDTH) * (__HEIGHT)]; \
68 const arm_2d_tile_t __NAME = { \
70 .tSize = {(__WIDTH), (__HEIGHT)}, \
72 .tInfo.bIsRoot = true, \
73 .pchBuffer = (uint8_t *)__NAME##Buffer, \
77#define impl_fb(__NAME, __WIDTH, __HEIGHT, __TYPE, ...) \
78 __impl_fb(__NAME, __WIDTH, __HEIGHT, __TYPE, ##__VA_ARGS__)
80#define get_tile_buffer_pixel_count(__NAME) \
81 (uint32_t)( (__NAME.tRegion.tSize.iWidth) \
82 * (__NAME.tRegion.tSize.iHeight))
84#define get_tile_buffer_size(__NAME, __TYPE) \
85 (get_2d_layer_buffer_pixel_count(__NAME) * sizeof(TYPE))
88#define impl_child_tile(__PARENT, __X, __Y, __WIDTH, __HEIGHT, ...) { \
95 .iWidth = (__WIDTH), \
96 .iHeight = (__HEIGHT), \
99 .tInfo.bIsRoot = false, \
100 .tInfo.bDerivedResource = true, \
101 .ptParent = (arm_2d_tile_t *)&(__PARENT), \
105#define __arm_2d_align_centre2(__region, __size) \
106 for (arm_2d_region_t __centre_region = { \
109 .iX = ((__region).tSize.iWidth - (__size).iWidth) >> 1,\
110 .iY = ((__region).tSize.iHeight - (__size).iHeight)>> 1,\
113 *ARM_CONNECT3(__ARM_USING_, __LINE__,_ptr) = NULL; \
114 ARM_CONNECT3(__ARM_USING_, __LINE__,_ptr)++ == NULL; \
115 arm_2d_op_wait_async(NULL) \
118#define __arm_2d_align_centre3(__region, __width, __height) \
119 for (arm_2d_region_t __centre_region = { \
121 .iWidth = (__width), \
122 .iHeight = (__height), \
125 .iX = ((__region).tSize.iWidth - (__width)) >> 1, \
126 .iY = ((__region).tSize.iHeight - (__height))>> 1, \
129 *ARM_CONNECT3(__ARM_USING_, __LINE__,_ptr) = NULL; \
130 ARM_CONNECT3(__ARM_USING_, __LINE__,_ptr)++ == NULL; \
131 arm_2d_op_wait_async(NULL) \
134#define arm_2d_align_centre(...) \
135 ARM_CONNECT2( __arm_2d_align_centre, \
136 __ARM_VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__)
146#define arm_2d_helper_is_time_out(__MS, ...) \
147 __arm_2d_helper_is_time_out((__MS), (NULL, ##__VA_ARGS__))
154__STATIC_INLINE
bool __arm_2d_helper_is_time_out(uint32_t wMS, int64_t *plTimestamp)
157 static int64_t s_lTimestamp = 0;
158 if (NULL == plTimestamp) {
159 plTimestamp = &s_lTimestamp;
162 if (0 == *plTimestamp) {
164 *plTimestamp += lTimestamp;
169 if (lTimestamp >= *plTimestamp) {
179#if defined(__clang__)
180# pragma clang diagnostic pop