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"
43# pragma clang diagnostic push
44# pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
45# pragma clang diagnostic ignored "-Wunused-function"
56#define __declare_tile(__NAME) \
57 extern const arm_2d_tile_t __NAME;
58#define declare_tile(__NAME) __declare_tile(__NAME)
60#define __implement_tile(__NAME, __WIDTH, __HEIGHT, __TYPE, ...) \
61 ARM_NOINIT static __TYPE \
62 __NAME##Buffer[(__WIDTH) * (__HEIGHT)]; \
63 const arm_2d_tile_t __NAME = { \
65 .tSize = {(__WIDTH), (__HEIGHT)}, \
67 .tInfo.bIsRoot = true, \
68 .pchBuffer = (uint8_t *)__NAME##Buffer, \
72#define implement_tile(__NAME, __WIDTH, __HEIGHT, __TYPE, ...) \
73 __implement_tile(__NAME, __WIDTH, __HEIGHT, __TYPE, ##__VA_ARGS__)
75#define get_tile_buffer_pixel_count(__NAME) \
76 (uint32_t)( (__NAME.tRegion.tSize.iWidth) \
77 * (__NAME.tRegion.tSize.iHeight))
79#define get_tile_buffer_size(__NAME, __TYPE) \
80 (get_2d_layer_buffer_pixel_count(__NAME) * sizeof(TYPE))
84#define __arm_2d_align_centre2(__region, __size) \
85 for (arm_2d_region_t __centre_region = { \
88 .iX = ((__region).tSize.iWidth - (__size).iWidth) >> 1,\
89 .iY = ((__region).tSize.iHeight - (__size).iHeight)>> 1,\
92 *ARM_CONNECT3(__ARM_USING_, __LINE__,_ptr) = NULL; \
93 ARM_CONNECT3(__ARM_USING_, __LINE__,_ptr)++ == NULL; \
96#define __arm_2d_align_centre3(__region, __width, __height) \
97 for (arm_2d_region_t __centre_region = { \
99 .iWidth = (__width), \
100 .iHeight = (__height), \
103 .iX = ((__region).tSize.iWidth - (__width)) >> 1, \
104 .iY = ((__region).tSize.iHeight - (__height))>> 1, \
107 *ARM_CONNECT3(__ARM_USING_, __LINE__,_ptr) = NULL; \
108 ARM_CONNECT3(__ARM_USING_, __LINE__,_ptr)++ == NULL; \
109 arm_2d_op_wait_async(NULL) \
112#define arm_2d_align_centre(...) \
113 ARM_CONNECT2( __arm_2d_align_centre, \
114 __ARM_VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__)
131 static int64_t s_lTimestamp = 0;
132 if (0 == s_lTimestamp) {
134 s_lTimestamp += lTimestamp;
139 if (lTimestamp >= s_lTimestamp) {
149#if defined(__clang__)
150# pragma clang diagnostic pop