Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5ce6e0a
improves the support for Cortex-A
GorgonMeducer Jul 8, 2026
e2c404c
minor fix
GorgonMeducer Jul 8, 2026
7fdd2e6
use __aarch64__
GorgonMeducer Jul 8, 2026
e7f7ad3
Update Virtual_TFT_Port.c
GorgonMeducer Jul 8, 2026
8bc8d47
minor update
GorgonMeducer Jul 8, 2026
13a12d5
minor update
GorgonMeducer Jul 8, 2026
e4ab3ab
add FPS30Score to the generic benchmark
GorgonMeducer Jul 8, 2026
af641f8
improves FPS30Score accuracy.
GorgonMeducer Jul 9, 2026
ade6e09
fixes __arm_2d_impl_ccca8888_tile_fill_to_xxx_with_src_mask
GorgonMeducer Jul 9, 2026
cd68afa
minor fix
GorgonMeducer Jul 9, 2026
04decc6
minor update
GorgonMeducer Jul 10, 2026
0748faa
Update Makefile
GorgonMeducer Jul 10, 2026
31d48d5
minor update
GorgonMeducer Jul 10, 2026
84dfdf2
minor fix
GorgonMeducer Jul 10, 2026
15b4456
fixes rgb565 alpha-blending and update the code template
GorgonMeducer Jul 10, 2026
9fe1941
Update __arm_2d_impl.h
GorgonMeducer Jul 10, 2026
56f28b8
Update README.md
GorgonMeducer Jul 11, 2026
6e31f7d
Use clang for windows env
GorgonMeducer Jul 11, 2026
e4cf0c8
fixes nano only non-blocking example
GorgonMeducer Jul 13, 2026
89df53c
update demo: panel
GorgonMeducer Jul 13, 2026
cabbc07
Adds an example control draw_battery_gasgauge_bar
GorgonMeducer Jul 13, 2026
30462b4
Adds FPS30Score to benchmark: watchpanel
GorgonMeducer Jul 16, 2026
92d67b8
minor update
GorgonMeducer Jul 16, 2026
60193e0
Update arm_2d_asset_circle_mask.c
GorgonMeducer Jul 16, 2026
45b7ff8
Adds LMSK to watchpanel
GorgonMeducer Jul 16, 2026
ab26669
improves wsl/linux debug experience
GorgonMeducer Aug 28, 2026
da1e8f2
Update Makefile
GorgonMeducer Aug 28, 2026
800d832
Update README.md
GorgonMeducer Aug 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions ARM.Arm-2D.pdsc
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
<file category="sourceC" name="Library/Source/arm_2d_conversion.c" />
<file category="sourceC" name="Library/Source/arm_2d_helium.c" condition="Helium" />
<file category="doc" name="documentation/index.html"/>
<file category="preIncludeGlobal" name="Library/Include/template/arm_2d_cfg.h" attr="config" version="1.6.0" />
<file category="preIncludeGlobal" name="Library/Include/template/arm_2d_cfg.h" attr="config" version="1.7.0" />
<file category="utility" name="tools/img2c.py" attr="config" version="2.1.0"/>
<file category="utility" name="tools/__img2c_zhRGB565.py" attr="config" version="1.0.0"/>
<file category="utility" name="tools/__img2c_lmsk.py" attr="config" version="1.0.0"/>
Expand Down Expand Up @@ -352,7 +352,7 @@
</RTE_Components_h>
</component>

<component Cclass="Acceleration" Cgroup="Arm-2D Helper" Csub="PFB" Cversion="3.3.0" condition="Arm-2D-CORE">
<component Cclass="Acceleration" Cgroup="Arm-2D Helper" Csub="PFB" Cversion="3.4.1" condition="Arm-2D-CORE">
<description>Helper services for LCD adaptor(s), e.g. Generic Partial Framebuffer, Scene Player etc.</description>
<files>
<file category="include" name="Helper/Include/" />
Expand Down Expand Up @@ -556,7 +556,7 @@
</Pre_Include_Global_h>
</component>

<component Cclass="Acceleration" Cgroup="Arm-2D Extras" Csub="Controls" Cversion="2.16.3" condition="Arm-2D-Controls">
<component Cclass="Acceleration" Cgroup="Arm-2D Extras" Csub="Controls" Cversion="2.16.4" condition="Arm-2D-Controls">
<description>A set of example controls, e.g. round-corner-box, spinning-wheels etc</description>
<files>
<!-- example control source files -->
Expand Down Expand Up @@ -685,7 +685,7 @@
</RTE_Components_h>
</component>

<component Cclass="Acceleration" Cgroup="Arm-2D Extras" Csub="Benchmark-Generic" Cversion="1.5.3" condition="Arm-2D-Benchmark-Generic">
<component Cclass="Acceleration" Cgroup="Arm-2D Extras" Csub="Benchmark-Generic" Cversion="2.0.1" condition="Arm-2D-Benchmark-Generic">
<description>An all-in-one generic benchmark for arm-2d.</description>
<files>
<file category="include" name="examples/common/benchmark/" />
Expand All @@ -699,7 +699,7 @@
</RTE_Components_h>
</component>

<component Cclass="Acceleration" Cgroup="Arm-2D Extras" Csub="Benchmark-WatchPanel" Cversion="1.7.0" condition="Arm-2D-Benchmark-WatchPanel">
<component Cclass="Acceleration" Cgroup="Arm-2D Extras" Csub="Benchmark-WatchPanel" Cversion="2.1.0" condition="Arm-2D-Benchmark-WatchPanel">
<description>A watch-panel benchmark for arm-2d.</description>
<files>
<file category="include" name="examples/common/benchmark/" />
Expand Down Expand Up @@ -790,11 +790,11 @@
</RTE_Components_h>
</component>

<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Panel" Cversion="1.3.0" condition="Arm-2D-Demos">
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Panel" Cversion="2.1.0" condition="Arm-2D-Demos">
<description>A demo for typical controls on a panel </description>
<files>
<file category="sourceC" name="examples/demos/arm_2d_scene_panel.c" attr="config" version="1.3.0" />
<file category="header" name="examples/demos/arm_2d_scene_panel.h" attr="config" version="1.3.0" />
<file category="sourceC" name="examples/demos/arm_2d_scene_panel.c" attr="config" version="2.1.0" />
<file category="header" name="examples/demos/arm_2d_scene_panel.h" attr="config" version="2.1.0" />
</files>
<RTE_Components_h>
#define RTE_Acceleration_Arm_2D_Demos_Panel
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ if (ARM2D_CONTROLS)
examples/common/asset/arm_2d_asset_QuarterSector.c
examples/common/asset/arm_2d_asset_ThreeQuarterRing.c
examples/common/asset/arm_2d_asset_SolidSquare.c
examples/common/asset/arm_2d_asset_signal_strength.c

examples/common/asset/arm_2d_asset_icon_automobile.c
examples/common/asset/arm_2d_asset_icon_compute.c
Expand Down
17 changes: 2 additions & 15 deletions Helper/Include/__arm_2d_helper_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
* Description: Public header file for the all common definitions used in
* arm-2d helper services
*
* $Date: 06. Jan 2026
* $Revision: V.2.0.0
* $Date: 10. July 2026
* $Revision: V.2.1.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
Expand Down Expand Up @@ -3622,19 +3622,6 @@ const __arm_2d_layout_align_tab_t ARM_2D_LAYOUT_ALIGN_RIGHT_TO_LEFT_BOTTOM_UP =

/*============================ PROTOTYPES ====================================*/

__STATIC_INLINE
uint8_t arm_2d_helper_alpha_mix(uint_fast8_t chAlpha1,
uint_fast8_t chAlpha2)
{
chAlpha1 = MIN(255, chAlpha1);
chAlpha2 = MIN(255, chAlpha2);
return (uint8_t)( (chAlpha1 == 255)
? chAlpha2
: ( (chAlpha2 == 255)
? chAlpha1
: ((uint16_t)chAlpha1 * (uint16_t)chAlpha2 >> 8)));
}

extern
ARM_NONNULL(2)
void __arm_2d_layout_wrap_horizontal( int16_t iTempX,
Expand Down
13 changes: 11 additions & 2 deletions Helper/Include/arm_2d_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
* Title: #include "arm_2d_helper.h"
* Description: Public header file for the all helper services
*
* $Date: 13. Feb 2026
* $Revision: V.2.5.5
* $Date: 9. July 2026
* $Revision: V.2.6.1
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
Expand Down Expand Up @@ -252,12 +252,12 @@
uint16_t hwFrameIndex; /*!< the frame index used at runtime */
} arm_2d_helper_film_t;

struct __arm_2d_fifo_reader_pointer {

Check warning on line 255 in Helper/Include/arm_2d_helper.h

View workflow job for this annotation

GitHub Actions / Generate pack

Compound __arm_2d_fifo_reader_pointer is not documented.
uint16_t hwPointer;
uint16_t hwDataAvailable;
};

typedef struct arm_2d_byte_fifo_t {

Check warning on line 260 in Helper/Include/arm_2d_helper.h

View workflow job for this annotation

GitHub Actions / Generate pack

Compound arm_2d_byte_fifo_t is not documented.
ARM_PROTECTED (
uint8_t *pchBuffer;
uint16_t hwSize;
Expand Down Expand Up @@ -708,6 +708,15 @@
const char *pchString);
#endif

__STATIC_INLINE
uint32_t __arm_2d_helper_benchmark_calculate_fps30score(int64_t dwTotal,
size_t uIterationCount)
{
int64_t lFPS30TimeInMs = arm_2d_helper_convert_ticks_to_ms(dwTotal);
return (uint32_t)( ((double)(1000ul * 10000ul * uIterationCount) / 30.0f)
/ (double)lFPS30TimeInMs);
}

/*! @} */

/*============================ INCLUDES ======================================*/
Expand Down
26 changes: 21 additions & 5 deletions Helper/Source/arm_2d_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
* Title: #include "arm_2d_helper.h"
* Description: The source code for arm-2d helper utilities
*
* $Date: 13. Feb 2026
* $Revision: V.2.5.5
* $Date: 9. July 2026
* $Revision: V.2.6.1
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
Expand Down Expand Up @@ -138,6 +138,7 @@ void arm_2d_helper_init(void)
if (s_tHelper.wMSUnit == 0) {
s_tHelper.wMSUnit = 1;
}

#if __ARM_2D_HAS_ASYNC__
/*! \note create a event flag and attach it to the default OP */
arm_2d_op_attach_semaphore(NULL, arm_2d_port_new_semaphore());
Expand Down Expand Up @@ -168,18 +169,27 @@ void arm_2d_helper_init(void)

/* NOTE: for non-arm architecture, you have to implement those functions.
*/
#if __IS_SUPPORTED_ARM_ARCH_M__
#if __IS_SUPPORTED_ARM_ARCH_M__ || __IS_SUPPORTED_ARM_ARCH_A__
__WEAK
int64_t arm_2d_helper_get_system_timestamp(void)
{
int64_t iOriginTimestamp =
int64_t iOriginTimestamp = 0;
#if defined(__PERF_COUNTER__)
get_system_ticks();
iOriginTimestamp = get_system_ticks();
#elif defined(_POSIX_VERSION) || defined(CLOCK_REALTIME) || defined(__APPLE__)
struct timespec timestamp;
clock_gettime(CLOCK_REALTIME, &timestamp);

return (1000000ll * timestamp.tv_sec) + (timestamp.tv_nsec / 1000ll);
#elif defined(__aarch64__)
__asm volatile("mrs %0, cntvct_el0" : "=r" (iOriginTimestamp));
#else
0;
#endif

#if !(defined(_POSIX_VERSION) || defined(CLOCK_REALTIME) || defined(__APPLE__))
return iOriginTimestamp + s_tHelper.lTimestampInit;
#endif
}

__WEAK
Expand All @@ -188,6 +198,12 @@ uint32_t arm_2d_helper_get_reference_clock_frequency(void)
#if defined(__PERF_COUNTER__) && __PER_COUNTER_VER__ >= 20300
extern uint32_t perfc_port_get_system_timer_freq(void);
return perfc_port_get_system_timer_freq();
#elif defined(_POSIX_VERSION) || defined(CLOCK_REALTIME) || defined(__APPLE__)
return 1000000ul;
#elif defined(__aarch64__)
uint64_t dwFrequency;
__asm volatile("mrs %0, cntfrq_el0" : "=r" (dwFrequency));
return (uint32_t)dwFrequency;
#else
extern uint32_t SystemCoreClock;
return SystemCoreClock;
Expand Down
79 changes: 50 additions & 29 deletions Library/Include/__arm_2d_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
* Title: __arm_2d_impl.h
* Description: header files for internal users or professional developers
*
* $Date: 25 June 2026
* $Revision: V.2.4.0
* $Date: 10 July 2026
* $Revision: V.2.5.0
*
* Target Processor: Cortex-M cores
*
Expand Down Expand Up @@ -105,10 +105,9 @@ extern "C" {
uint8_t *ARM_2D_SAFE_NAME(pchDes) = (uint8_t *)(__DES_ADDR); \
\
*ARM_2D_SAFE_NAME(pchDes) \
= ((uint16_t)( ( (uint16_t)(*ARM_2D_SAFE_NAME(pchSrc)) \
* ARM_2D_SAFE_NAME(hwOPA)) \
+ ((uint16_t)(*ARM_2D_SAFE_NAME(pchDes)) * (__TRANS)) \
) >> 8); \
= arm_2d_helper_blend_chn( *ARM_2D_SAFE_NAME(pchSrc), \
*ARM_2D_SAFE_NAME(pchDes), \
ARM_2D_SAFE_NAME(hwOPA)); \
} while(0)
#endif

Expand All @@ -120,25 +119,28 @@ extern "C" {
__arm_2d_color_fast_rgb_t ARM_2D_SAFE_NAME(tSrcPix); \
__arm_2d_ccca8888_unpack(*(__SRC_ADDR), &ARM_2D_SAFE_NAME(tSrcPix)); \
uint16_t ARM_2D_SAFE_NAME(hwOPA) = ARM_2D_SAFE_NAME(tSrcPix).BGRA[3]; \
ARM_2D_SAFE_NAME(hwOPA) += (ARM_2D_SAFE_NAME(hwOPA) == 255); \
ARM_2D_SAFE_NAME(hwOPA) = ARM_2D_SAFE_NAME(hwOPA) * ((__TRANS) == 0) \
+ ( (ARM_2D_SAFE_NAME(hwOPA) * (256 - (__TRANS)) >> 8) \
* ((__TRANS) != 0)); \
uint16_t ARM_2D_SAFE_NAME(hwTRANS) = 256 - ARM_2D_SAFE_NAME(hwOPA); \
ARM_2D_SAFE_NAME(hwOPA) \
= arm_2d_helper_opacity_mix(ARM_2D_SAFE_NAME(hwOPA), (__TRANS)); \
\
uint8_t *ARM_2D_SAFE_NAME(pchTargetPixel) = (__DES_ADDR); \
uint8_t ARM_2D_SAFE_NAME(chSrcPixel) \
= __arm_2d_gray8_pack(&ARM_2D_SAFE_NAME(tSrcPix)); \
\
*ARM_2D_SAFE_NAME(pchTargetPixel) = \
((uint16_t) ( ( (uint16_t)ARM_2D_SAFE_NAME(chSrcPixel) \
* ARM_2D_SAFE_NAME(hwOPA)) \
+ ( (uint16_t)(*ARM_2D_SAFE_NAME(pchTargetPixel)) \
* (ARM_2D_SAFE_NAME(hwTRANS))) \
) >> 8); \
arm_2d_helper_blend_chn(ARM_2D_SAFE_NAME(chSrcPixel), \
*ARM_2D_SAFE_NAME(pchTargetPixel), ARM_2D_SAFE_NAME(hwOPA)); \
} while(0)
#endif

#ifndef __ARM_2D_PIXEL_BLENDING_CCCA8888_TO_GRAY8_OPA
# define __ARM_2D_PIXEL_BLENDING_CCCA8888_TO_GRAY8_OPA( __SRC_ADDR, \
__DES_ADDR, \
__OPA) \
__ARM_2D_PIXEL_BLENDING_CCCA8888_TO_GRAY8( (__SRC_ADDR), \
(__DES_ADDR), \
256 - (__OPA))
#endif

__STATIC_INLINE
void __arm_2d_rgb565_pixel_blend_sw(uint16_t * phwSource,
uint16_t * phwTarget,
Expand All @@ -148,11 +150,11 @@ void __arm_2d_rgb565_pixel_blend_sw(uint16_t * phwSource,
uint32_t wTargetPixel = *phwTarget;
uint32_t wOpacity = hwOpacity >> 3;

wSourcePixel = (wSourcePixel | wSourcePixel << 16) & 0x07e0f81f;
wTargetPixel = (wTargetPixel | wTargetPixel << 16) & 0x07e0f81f;
wSourcePixel = (wSourcePixel | (wSourcePixel << 16)) & 0x07e0f81f;
wTargetPixel = (wTargetPixel | (wTargetPixel << 16)) & 0x07e0f81f;
wTargetPixel += (wSourcePixel - wTargetPixel) * wOpacity >> 5;
wTargetPixel &= 0x07e0f81f;
*phwTarget = (uint16_t)(wTargetPixel | wTargetPixel >> 16);
*phwTarget = (uint16_t)(wTargetPixel | (wTargetPixel >> 16));
}

#ifndef __ARM_2D_PIXEL_BLENDING_RGB565
Expand All @@ -171,20 +173,20 @@ void __arm_2d_ccca8888_pixel_blend_to_rgb565_sw(uint32_t *pwSource,

if (wOpacity) {
if (wOpacity == (0xFF >> 3)) {
*hwTarget = (uint16_t)( (wSourcePixel >> 8 & 0xf800)
+ (wSourcePixel >> 5 & 0x7e0)
+ (wSourcePixel >> 3 & 0x1f));
*hwTarget = (uint16_t)( ((wSourcePixel >> 8) & 0xf800)
+ ((wSourcePixel >> 5) & 0x7e0)
+ ((wSourcePixel >> 3) & 0x1f));
} else {
uint32_t wTargetPixel = *hwTarget;

wSourcePixel = ((wSourcePixel & 0xfc00) << 11)
+ (wSourcePixel >> 8 & 0xf800)
+ (wSourcePixel >> 3 & 0x1f);
+ ((wSourcePixel >> 8) & 0xf800)
+ ((wSourcePixel >> 3) & 0x1f);

wTargetPixel = (wTargetPixel | wTargetPixel << 16) & 0x07e0f81f;
wTargetPixel = (wTargetPixel | (wTargetPixel << 16)) & 0x07e0f81f;
wTargetPixel += (wSourcePixel - wTargetPixel) * wOpacity >> 5;
wTargetPixel &= 0x07e0f81f;
*hwTarget = (uint16_t)(wTargetPixel | wTargetPixel >> 16);
*hwTarget = (uint16_t)(wTargetPixel | (wTargetPixel >> 16));
}
}
}
Expand All @@ -198,6 +200,15 @@ void __arm_2d_ccca8888_pixel_blend_to_rgb565_sw(uint32_t *pwSource,
256 - (__TRANS))
#endif

#ifndef __ARM_2D_PIXEL_BLENDING_CCCA8888_TO_RGB565_OPA
# define __ARM_2D_PIXEL_BLENDING_CCCA8888_TO_RGB565_OPA( __SRC_ADDR, \
__DES_ADDR, \
__OPA) \
__arm_2d_ccca8888_pixel_blend_to_rgb565_sw( (__SRC_ADDR), \
(__DES_ADDR), \
(__OPA))
#endif

__STATIC_INLINE
void __arm_2d_cccn888_pixel_blend_sw(uint32_t * pwSource,
uint32_t * pwTarget,
Expand All @@ -208,7 +219,7 @@ void __arm_2d_cccn888_pixel_blend_sw(uint32_t * pwSource,

dwSourcePixel = (dwSourcePixel | dwSourcePixel << 32) & 0x0000FF0000FF00FF;
dwTargetPixel = (dwTargetPixel | dwTargetPixel << 32) & 0x0000FF0000FF00FF;
dwTargetPixel += (dwSourcePixel - dwTargetPixel) * hwOpacity >> 8;
dwTargetPixel += ((dwSourcePixel - dwTargetPixel) * hwOpacity) >> 8;
dwTargetPixel &= 0x0000FF0000FF00FF;
*pwTarget = (uint32_t)(dwTargetPixel | (dwTargetPixel >> 32) | 0xFF000000);
}
Expand All @@ -227,10 +238,11 @@ void __arm_2d_ccca8888_pixel_blend_to_cccn888_sw(uint32_t * pwSource,
uint64_t dwSourcePixel = *pwSource;
uint64_t dwTargetPixel = *pwTarget;

uint32_t wOpacity = ((*pwSource >> 24) * hwOpacity) >> 8;
uint32_t wOpacity = arm_2d_helper_opacity_mix((*pwSource >> 24), hwOpacity);

dwSourcePixel = (dwSourcePixel | dwSourcePixel << 32) & 0x0000FF0000FF00FF;
dwTargetPixel = (dwTargetPixel | dwTargetPixel << 32) & 0x0000FF0000FF00FF;
dwTargetPixel += (dwSourcePixel - dwTargetPixel) * wOpacity >> 8;
dwTargetPixel += ((dwSourcePixel - dwTargetPixel) * hwOpacity) >> 8;
dwTargetPixel &= 0x0000FF0000FF00FF;
*pwTarget = (uint32_t)(dwTargetPixel | (dwTargetPixel >> 32) | 0xFF000000);
}
Expand All @@ -245,6 +257,15 @@ void __arm_2d_ccca8888_pixel_blend_to_cccn888_sw(uint32_t * pwSource,
256 - (__TRANS))
#endif

#ifndef __ARM_2D_PIXEL_BLENDING_CCCA8888_TO_CCCN888_OPA
# define __ARM_2D_PIXEL_BLENDING_CCCA8888_TO_CCCN888_OPA( __SRC_ADDR, \
__DES_ADDR, \
__OPA) \
__arm_2d_ccca8888_pixel_blend_to_cccn888_sw((__SRC_ADDR), \
(__DES_ADDR), \
(__OPA))
#endif

#ifndef __ARM_2D_PIXEL_BLENDING_OPA_GRAY8
# define __ARM_2D_PIXEL_BLENDING_OPA_GRAY8(__SRC_ADDR, __DES_ADDR, __OPA) \
do { \
Expand Down
Loading
Loading