Skip to content

Commit

Permalink
fix(pxp): update for v8
Browse files Browse the repository at this point in the history
includes updates from NXP MCU SDK 2.10 with adaptation for lvgl v8:

Updated cache handling

- range limited cache flushing changed to complete cache flush, which is
faster and shold be safe
- flushing done via callback system, so OS specific code is removed
from LVGL

Signed-off-by: Jozef Bastek <jozef.bastek@nxp.com>

gpu: pxp: Buffer sync with BLITs

Added buffer synchronisation with BLITs instead of memcpy for PXP.
In LVGL v8, buffer synchronisation acceleration is moved to littlevgl_support.c.

Signed-off-by: Jozef Bastek <jozef.bastek@nxp.com>

gpu: pxp: updates for v8

cache callback type changed in display driver struct
chroma key name changed

Signed-off-by: Seb Fagard <sebastien.fagard@nxp.com>

gpu: pxp: new log header file for v8

Signed-off-by: Seb Fagard <sebastien.fagard@nxp.com>

core: init PXP accelerator

Signed-off-by: Seb Fagard <sebastien.fagard@nxp.com>
  • Loading branch information
jozba authored and sebastienfagard committed Jun 21, 2021
1 parent 75209e8 commit 8a2a4a1
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 37 deletions.
12 changes: 12 additions & 0 deletions src/core/lv_obj.c
Expand Up @@ -30,6 +30,11 @@
#include "../gpu/lv_gpu_stm32_dma2d.h"
#endif

#if LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT
#include "../gpu/lv_gpu_nxp_pxp.h"
#include "../gpu/lv_gpu_nxp_pxp_osa.h"
#endif

/*********************
* DEFINES
*********************/
Expand Down Expand Up @@ -105,6 +110,13 @@ void lv_init(void)
lv_gpu_stm32_dma2d_init();
#endif

#if LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT
if(lv_gpu_nxp_pxp_init(&pxp_default_cfg) != LV_RES_OK) {
LV_LOG_ERROR("PXP init error. STOP.\n");
for(; ;) ;
}
#endif

_lv_obj_style_init();
_lv_ll_init(&LV_GC_ROOT(_lv_disp_ll), sizeof(lv_disp_t));
_lv_ll_init(&LV_GC_ROOT(_lv_indev_ll), sizeof(lv_indev_t));
Expand Down
46 changes: 9 additions & 37 deletions src/gpu/lv_gpu_nxp_pxp.c
Expand Up @@ -71,8 +71,6 @@ static void lv_gpu_nxp_pxp_run(void);
static void lv_gpu_nxp_pxp_blit_recolor(lv_color_t * dest, lv_coord_t dest_width, const lv_color_t * src,
lv_coord_t src_width,
lv_coord_t copy_width, lv_coord_t copy_height, lv_opa_t opa, lv_color_t recolor, lv_opa_t recolorOpa);
static void lv_gpu_nxp_invalidate_cache(uint32_t address, uint32_t width, uint32_t height, uint32_t stride,
uint32_t pxSize);

/**********************
* STATIC VARIABLES
Expand Down Expand Up @@ -160,8 +158,7 @@ void lv_gpu_nxp_pxp_fill(lv_color_t * dest_buf, lv_coord_t dest_width, const lv_
.width = fill_area->x2 - fill_area->x1 + 1,
.height = fill_area->y2 - fill_area->y1 + 1,
};
lv_gpu_nxp_invalidate_cache(outputConfig.buffer0Addr, outputConfig.width, outputConfig.height, outputConfig.pitchBytes,
sizeof(lv_color_t));

PXP_SetOutputBufferConfig(LV_GPU_NXP_PXP_ID, &outputConfig);

if(opa > LV_OPA_MAX) {
Expand Down Expand Up @@ -272,9 +269,6 @@ void lv_gpu_nxp_pxp_blit(lv_color_t * dest, lv_coord_t dest_width, const lv_colo
PXP_SetAlphaSurfacePosition(LV_GPU_NXP_PXP_ID, 0U, 0U, copy_width - 1U, copy_height - 1U);
PXP_SetAlphaSurfaceBlendConfig(LV_GPU_NXP_PXP_ID, &asBlendConfig);

lv_gpu_nxp_invalidate_cache(asBufferConfig.bufferAddr, copy_width, copy_height, asBufferConfig.pitchBytes,
sizeof(lv_color_t));

if(colorKeyEnabled) {
PXP_SetAlphaSurfaceOverlayColorKey(LV_GPU_NXP_PXP_ID, colorKey, colorKey);
}
Expand All @@ -290,10 +284,7 @@ void lv_gpu_nxp_pxp_blit(lv_color_t * dest, lv_coord_t dest_width, const lv_colo
outputBufferConfig.height = copy_height;
PXP_SetOutputBufferConfig(LV_GPU_NXP_PXP_ID, &outputBufferConfig);

lv_gpu_nxp_invalidate_cache(outputBufferConfig.buffer0Addr, outputBufferConfig.width, outputBufferConfig.height,
outputBufferConfig.pitchBytes, sizeof(lv_color_t));

lv_gpu_nxp_pxp_run(); /*Start PXP task*/
lv_gpu_nxp_pxp_run(); /* Start PXP task */
}

/**
Expand Down Expand Up @@ -349,6 +340,12 @@ void lv_gpu_nxp_pxp_disable_recolor(void)
*/
static void lv_gpu_nxp_pxp_run(void)
{
lv_disp_t * disp = _lv_refr_get_disp_refreshing();

if(disp && disp->driver->clean_dcache_cb) { /* Clean & invalidate cache */
disp->driver->clean_dcache_cb(disp->driver);
}

pxp_cfg.pxp_run();
}

Expand Down Expand Up @@ -396,9 +393,6 @@ static void lv_gpu_nxp_pxp_blit_recolor(lv_color_t * dest, lv_coord_t dest_width
PXP_SetAlphaSurfaceBufferConfig(LV_GPU_NXP_PXP_ID, &asBufferConfig);
PXP_SetAlphaSurfacePosition(LV_GPU_NXP_PXP_ID, 0U, 0U, copy_width - 1U, copy_height - 1U);

lv_gpu_nxp_invalidate_cache(asBufferConfig.bufferAddr, copy_width, copy_height, asBufferConfig.pitchBytes,
sizeof(lv_color_t));

/*Disable PS buffer, use as color generator*/
PXP_SetProcessSurfacePosition(LV_GPU_NXP_PXP_ID, 0xFFFFU, 0xFFFFU, 0U, 0U);
PXP_SetProcessSurfaceBackGroundColor(LV_GPU_NXP_PXP_ID, lv_color_to32(recolor));
Expand All @@ -413,9 +407,6 @@ static void lv_gpu_nxp_pxp_blit_recolor(lv_color_t * dest, lv_coord_t dest_width
outputBufferConfig.height = copy_height;
PXP_SetOutputBufferConfig(LV_GPU_NXP_PXP_ID, &outputBufferConfig);

lv_gpu_nxp_invalidate_cache(outputBufferConfig.buffer0Addr, outputBufferConfig.width, outputBufferConfig.height,
outputBufferConfig.pitchBytes, sizeof(lv_color_t));

pxp_porter_duff_config_t pdConfig;

/*Configure Porter-Duff blending - For RGB 565 only!*/
Expand Down Expand Up @@ -454,23 +445,4 @@ static void lv_gpu_nxp_pxp_blit_recolor(lv_color_t * dest, lv_coord_t dest_width
}
}

/**
* @brief Invalidate cache for rectangular area of memory
*
* @param[in] address starting address of area
* @param[in] width width of area in pixels
* @param[in] height height of area in pixels
* @param[in] stride stride in bytes
* @param[in] pxSize pixel size in bytes
*/
static void lv_gpu_nxp_invalidate_cache(uint32_t address, uint32_t width, uint32_t height, uint32_t stride,
uint32_t pxSize)
{
int y;

for(y = 0; y < height; y++) {
DCACHE_CleanInvalidateByRange(address, width * pxSize);
address += stride;
}
}
#endif /*LV_USE_GPU && LV_USE_GPU_NXP_PXP*/
#endif /* LV_USE_GPU_NXP_PXP */
5 changes: 5 additions & 0 deletions src/gpu/lv_gpu_nxp_pxp.h
Expand Up @@ -61,6 +61,11 @@ extern "C" {
#define LV_GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT 16
#endif

#ifndef LV_GPU_NXP_PXP_BUFF_SYNC_BLIT_SIZE_LIMIT
/** Minimum invalidated area (in pixels) to be synchronized by PXP during buffer sync */
#define LV_GPU_NXP_PXP_BUFF_SYNC_BLIT_SIZE_LIMIT 32
#endif

#ifndef LV_GPU_NXP_PXP_FILL_SIZE_LIMIT
/** Minimum area (in pixels) to be filled by PXP with 100% opacity*/
#define LV_GPU_NXP_PXP_FILL_SIZE_LIMIT 64
Expand Down
1 change: 1 addition & 0 deletions src/gpu/lv_gpu_nxp_pxp_osa.c
Expand Up @@ -32,6 +32,7 @@
*********************/

#include "../lv_conf_internal.h"
#include "../misc/lv_log.h"

#if LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT

Expand Down

0 comments on commit 8a2a4a1

Please sign in to comment.