mirror of
https://github.com/lvgl/lvgl.git
synced 2024-11-23 09:43:41 +08:00
feat(nxp): Release/nxp patches for LVGL master (#6978)
Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com> Signed-off-by: Cristian Stoica <cristianmarian.stoica@nxp.com> Signed-off-by: Cosmin-Daniel Radu <cosmin.radu_1@nxp.com> Co-authored-by: Nicușor Cîțu <nicusor.citu@nxp.com> Co-authored-by: Cristian Stoica <cristianmarian.stoica@nxp.com>
This commit is contained in:
parent
8d47460580
commit
b8b581a83d
12
Kconfig
12
Kconfig
@ -372,8 +372,18 @@ menu "LVGL configuration"
|
||||
depends on LV_USE_DRAW_VGLITE
|
||||
default n
|
||||
|
||||
config LV_USE_PXP
|
||||
bool "Use NXP's PXP on iMX RTxxx platforms"
|
||||
default n
|
||||
|
||||
config LV_USE_DRAW_PXP
|
||||
bool "Use NXP's PXP on iMX RTxxx platforms"
|
||||
bool "Use PXP for drawing"
|
||||
depends on LV_USE_PXP
|
||||
default y
|
||||
|
||||
config LV_USE_ROTATE_PXP
|
||||
bool "Use PXP to rotate display"
|
||||
depends on LV_USE_PXP
|
||||
default n
|
||||
|
||||
config LV_USE_PXP_DRAW_THREAD
|
||||
|
@ -36,7 +36,9 @@ PXP accelerator
|
||||
Basic configuration:
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
- Select NXP PXP engine in "lv_conf.h": Set :c:macro:`LV_USE_DRAW_PXP` to `1`.
|
||||
- Select NXP PXP engine in "lv_conf.h": Set :c:macro:`LV_USE_PXP` to `1`.
|
||||
- In order to use PXP as a draw unit, select in "lv_conf.h": Set :c:macro:`LV_USE_DRAW_PXP` to `1`.
|
||||
- In order to use PXP to rotate the screen, select in "lv_conf.h": Set :c:macro:`LV_USE_ROTATE_PXP` to `1`.
|
||||
- Enable PXP asserts in "lv_conf.h": Set :c:macro: `LV_USE_PXP_ASSERT` to `1`.
|
||||
There are few PXP assertions that can stop the program execution in case the
|
||||
c:macro:`LV_ASSERT_HANDLER` is set to `while(1);` (Halt by default). Else,
|
||||
@ -48,16 +50,16 @@ Basic initialization:
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
PXP draw initialization is done automatically in :cpp:func:`lv_init()` once the
|
||||
PXP is enabled, no user code is required:
|
||||
PXP is enabled as a draw unit or to rotate the screen, no user code is required:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
#if LV_USE_DRAW_PXP
|
||||
lv_draw_pxp_init();
|
||||
#endif
|
||||
#if LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP
|
||||
lv_draw_pxp_init();
|
||||
#endif
|
||||
|
||||
During PXP initialization, a new draw unit `lv_draw_pxp_unit_t` will be created
|
||||
with the additional callbacks:
|
||||
with the additional callbacks, if :c:macro:`LV_USE_DRAW_PXP` is set to `1`:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
|
@ -115,7 +115,6 @@
|
||||
/*
|
||||
* Unblocking an RTOS task with a direct notification is 45% faster and uses less RAM
|
||||
* than unblocking a task using an intermediary object such as a binary semaphore.
|
||||
*
|
||||
* RTOS task notifications can only be used when there is only one task that can be the recipient of the event.
|
||||
*/
|
||||
#define LV_USE_FREERTOS_TASK_NOTIFY 1
|
||||
@ -229,10 +228,16 @@
|
||||
#endif
|
||||
|
||||
/** Use NXP's PXP on iMX RTxxx platforms. */
|
||||
#define LV_USE_DRAW_PXP 0
|
||||
#define LV_USE_PXP 0
|
||||
|
||||
#if LV_USE_DRAW_PXP
|
||||
#if LV_USE_OS
|
||||
#if LV_USE_PXP
|
||||
/** Use PXP for drawing.*/
|
||||
#define LV_USE_DRAW_PXP 1
|
||||
|
||||
/** Use PXP to rotate display.*/
|
||||
#define LV_USE_ROTATE_PXP 0
|
||||
|
||||
#if LV_USE_DRAW_PXP && LV_USE_OS
|
||||
/** Use additional draw thread for PXP processing.*/
|
||||
#define LV_USE_PXP_DRAW_THREAD 1
|
||||
#endif
|
||||
|
@ -451,6 +451,31 @@ void lv_display_set_buffers(lv_display_t * disp, void * buf1, void * buf2, uint3
|
||||
lv_display_set_render_mode(disp, render_mode);
|
||||
}
|
||||
|
||||
void lv_display_set_buffers_with_stride(lv_display_t * disp, void * buf1, void * buf2, uint32_t buf_size,
|
||||
uint32_t stride, lv_display_render_mode_t render_mode)
|
||||
{
|
||||
LV_ASSERT_MSG(buf1 != NULL, "Null buffer");
|
||||
lv_color_format_t cf = lv_display_get_color_format(disp);
|
||||
uint32_t w = lv_display_get_horizontal_resolution(disp);
|
||||
uint32_t h = lv_display_get_vertical_resolution(disp);
|
||||
LV_ASSERT_MSG(w != 0 && h != 0, "display resolution is 0");
|
||||
|
||||
if(render_mode == LV_DISPLAY_RENDER_MODE_PARTIAL) {
|
||||
/* for partial mode, we calculate the height based on the buf_size and stride */
|
||||
h = buf_size / stride;
|
||||
LV_ASSERT_MSG(h != 0, "the buffer is too small");
|
||||
}
|
||||
else {
|
||||
LV_ASSERT_FORMAT_MSG(stride * h <= buf_size, "%s mode requires screen sized buffer(s)",
|
||||
render_mode == LV_DISPLAY_RENDER_MODE_FULL ? "FULL" : "DIRECT");
|
||||
}
|
||||
|
||||
lv_draw_buf_init(&disp->_static_buf1, w, h, cf, stride, buf1, buf_size);
|
||||
lv_draw_buf_init(&disp->_static_buf2, w, h, cf, stride, buf2, buf_size);
|
||||
lv_display_set_draw_buffers(disp, &disp->_static_buf1, buf2 ? &disp->_static_buf2 : NULL);
|
||||
lv_display_set_render_mode(disp, render_mode);
|
||||
}
|
||||
|
||||
void lv_display_set_render_mode(lv_display_t * disp, lv_display_render_mode_t render_mode)
|
||||
{
|
||||
if(disp == NULL) disp = lv_display_get_default();
|
||||
|
@ -239,6 +239,21 @@ int32_t lv_display_get_dpi(const lv_display_t * disp);
|
||||
void lv_display_set_buffers(lv_display_t * disp, void * buf1, void * buf2, uint32_t buf_size,
|
||||
lv_display_render_mode_t render_mode);
|
||||
|
||||
/**
|
||||
* Set the frame buffers for a display, similarly to `lv_display_set_buffers`, but allow
|
||||
* for a custom stride as required by a display controller.
|
||||
* This allows the frame buffers to have a stride alignment different from the rest of
|
||||
* the buffers`
|
||||
* @param disp pointer to a display
|
||||
* @param buf1 first buffer
|
||||
* @param buf2 second buffer (can be `NULL`)
|
||||
* @param buf_size buffer size in byte
|
||||
* @param stride buffer stride in bytes
|
||||
* @param render_mode LV_DISPLAY_RENDER_MODE_PARTIAL/DIRECT/FULL
|
||||
*/
|
||||
void lv_display_set_buffers_with_stride(lv_display_t * disp, void * buf1, void * buf2, uint32_t buf_size,
|
||||
uint32_t stride, lv_display_render_mode_t render_mode);
|
||||
|
||||
/**
|
||||
* Set the buffers for a display, accept a draw buffer pointer.
|
||||
* Normally use `lv_display_set_buffers` is enough for most cases.
|
||||
|
@ -83,6 +83,16 @@ lv_draw_buf_handlers_t * lv_draw_buf_get_handlers(void)
|
||||
return &default_handlers;
|
||||
}
|
||||
|
||||
lv_draw_buf_handlers_t * lv_draw_buf_get_font_handlers(void)
|
||||
{
|
||||
return &font_draw_buf_handlers;
|
||||
}
|
||||
|
||||
lv_draw_buf_handlers_t * lv_draw_buf_get_image_handlers(void)
|
||||
{
|
||||
return &image_cache_draw_buf_handlers;
|
||||
}
|
||||
|
||||
uint32_t lv_draw_buf_width_to_stride(uint32_t w, lv_color_format_t color_format)
|
||||
{
|
||||
return lv_draw_buf_width_to_stride_ex(&default_handlers, w, color_format);
|
||||
|
@ -129,6 +129,9 @@ void lv_draw_buf_handlers_init(lv_draw_buf_handlers_t * handlers,
|
||||
* @return pointer to the struct of handlers
|
||||
*/
|
||||
lv_draw_buf_handlers_t * lv_draw_buf_get_handlers(void);
|
||||
lv_draw_buf_handlers_t * lv_draw_buf_get_font_handlers(void);
|
||||
lv_draw_buf_handlers_t * lv_draw_buf_get_image_handlers(void);
|
||||
|
||||
|
||||
/**
|
||||
* Align the address of a buffer. The buffer needs to be large enough for the real data after alignment
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "lv_draw_pxp.h"
|
||||
|
||||
#if LV_USE_PXP
|
||||
#if LV_USE_DRAW_PXP
|
||||
#include "../../lv_draw_buf_private.h"
|
||||
#include "lv_pxp_cfg.h"
|
||||
@ -51,8 +52,12 @@ static void _invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_t *
|
||||
void lv_draw_buf_pxp_init_handlers(void)
|
||||
{
|
||||
lv_draw_buf_handlers_t * handlers = lv_draw_buf_get_handlers();
|
||||
lv_draw_buf_handlers_t * font_handlers = lv_draw_buf_get_font_handlers();
|
||||
lv_draw_buf_handlers_t * image_handlers = lv_draw_buf_get_image_handlers();
|
||||
|
||||
handlers->invalidate_cache_cb = _invalidate_cache;
|
||||
font_handlers->invalidate_cache_cb = _invalidate_cache;
|
||||
image_handlers->invalidate_cache_cb = _invalidate_cache;
|
||||
}
|
||||
|
||||
/**********************
|
||||
@ -66,7 +71,7 @@ static void _invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_t *
|
||||
lv_color_format_t cf = header->cf;
|
||||
|
||||
if(area->y1 == 0) {
|
||||
uint16_t size = stride * lv_area_get_height(area);
|
||||
uint32_t size = stride * lv_area_get_height(area);
|
||||
|
||||
/* Invalidate full buffer. */
|
||||
DEMO_CleanInvalidateCacheByAddr((void *)draw_buf->data, size);
|
||||
@ -109,3 +114,4 @@ static void _invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_t *
|
||||
}
|
||||
|
||||
#endif /*LV_USE_DRAW_PXP*/
|
||||
#endif /*LV_USE_PXP*/
|
||||
|
@ -15,7 +15,8 @@
|
||||
|
||||
#include "lv_draw_pxp.h"
|
||||
|
||||
#if LV_USE_DRAW_PXP
|
||||
#if LV_USE_PXP
|
||||
#if LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP
|
||||
#include "lv_pxp_cfg.h"
|
||||
#include "lv_pxp_utils.h"
|
||||
|
||||
@ -82,6 +83,9 @@ static void _pxp_execute_drawing(lv_draw_pxp_unit_t * u);
|
||||
|
||||
void lv_draw_pxp_init(void)
|
||||
{
|
||||
lv_pxp_init();
|
||||
|
||||
#if LV_USE_DRAW_PXP
|
||||
lv_draw_buf_pxp_init_handlers();
|
||||
|
||||
lv_draw_pxp_unit_t * draw_pxp_unit = lv_draw_create_unit(sizeof(lv_draw_pxp_unit_t));
|
||||
@ -89,11 +93,10 @@ void lv_draw_pxp_init(void)
|
||||
draw_pxp_unit->base_unit.dispatch_cb = _pxp_dispatch;
|
||||
draw_pxp_unit->base_unit.delete_cb = _pxp_delete;
|
||||
|
||||
lv_pxp_init();
|
||||
|
||||
#if LV_USE_PXP_DRAW_THREAD
|
||||
lv_thread_init(&draw_pxp_unit->thread, LV_THREAD_PRIO_HIGH, _pxp_render_thread_cb, 2 * 1024, draw_pxp_unit);
|
||||
#endif
|
||||
#endif /*LV_USE_DRAW_PXP*/
|
||||
}
|
||||
|
||||
void lv_draw_pxp_deinit(void)
|
||||
@ -159,7 +162,7 @@ void lv_draw_pxp_rotate(const void * src_buf, void * dest_buf, int32_t src_width
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#if LV_USE_DRAW_PXP
|
||||
static inline bool _pxp_src_cf_supported(lv_color_format_t cf)
|
||||
{
|
||||
bool is_cf_supported = false;
|
||||
@ -321,8 +324,7 @@ static int32_t _pxp_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * layer)
|
||||
if(t == NULL || t->preferred_draw_unit_id != DRAW_UNIT_ID_PXP)
|
||||
return LV_DRAW_UNIT_IDLE;
|
||||
|
||||
void * buf = lv_draw_layer_alloc_buf(layer);
|
||||
if(buf == NULL)
|
||||
if(lv_draw_layer_alloc_buf(layer) == NULL)
|
||||
return LV_DRAW_UNIT_IDLE;
|
||||
|
||||
t->state = LV_DRAW_TASK_STATE_IN_PROGRESS;
|
||||
@ -484,5 +486,6 @@ static void _pxp_render_thread_cb(void * ptr)
|
||||
LV_LOG_INFO("Exit PXP draw thread.");
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*LV_USE_DRAW_PXP*/
|
||||
#endif /*LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP*/
|
||||
#endif /*LV_USE_PXP*/
|
||||
|
@ -22,8 +22,10 @@ extern "C" {
|
||||
|
||||
#include "../../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_DRAW_PXP
|
||||
#include "../../sw/lv_draw_sw.h"
|
||||
#if LV_USE_PXP
|
||||
#if LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP
|
||||
#include "../../sw/lv_draw_sw_private.h"
|
||||
#include "../../../misc/lv_area_private.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@ -39,8 +41,6 @@ typedef lv_draw_sw_unit_t lv_draw_pxp_unit_t;
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_draw_buf_pxp_init_handlers(void);
|
||||
|
||||
void lv_draw_pxp_init(void);
|
||||
|
||||
void lv_draw_pxp_deinit(void);
|
||||
@ -49,6 +49,9 @@ void lv_draw_pxp_rotate(const void * src_buf, void * dest_buf, int32_t src_width
|
||||
int32_t src_stride, int32_t dest_stride, lv_display_rotation_t rotation,
|
||||
lv_color_format_t cf);
|
||||
|
||||
#if LV_USE_DRAW_PXP
|
||||
void lv_draw_buf_pxp_init_handlers(void);
|
||||
|
||||
void lv_draw_pxp_fill(lv_draw_unit_t * draw_unit, const lv_draw_fill_dsc_t * dsc,
|
||||
const lv_area_t * coords);
|
||||
|
||||
@ -62,6 +65,8 @@ void lv_draw_pxp_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * d
|
||||
* MACROS
|
||||
**********************/
|
||||
#endif /*LV_USE_DRAW_PXP*/
|
||||
#endif /*LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP*/
|
||||
#endif /*LV_USE_PXP*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "lv_draw_pxp.h"
|
||||
|
||||
#if LV_USE_PXP
|
||||
#if LV_USE_DRAW_PXP
|
||||
#include "lv_pxp_cfg.h"
|
||||
#include "lv_pxp_utils.h"
|
||||
@ -145,3 +146,4 @@ static void _pxp_fill(uint8_t * dest_buf, const lv_area_t * dest_area, int32_t d
|
||||
}
|
||||
|
||||
#endif /*LV_USE_DRAW_PXP*/
|
||||
#endif /*LV_USE_PXP*/
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "lv_draw_pxp.h"
|
||||
|
||||
#if LV_USE_PXP
|
||||
#if LV_USE_DRAW_PXP
|
||||
#include "lv_pxp_cfg.h"
|
||||
#include "lv_pxp_utils.h"
|
||||
@ -363,3 +364,4 @@ static void _pxp_blit(uint8_t * dest_buf, const lv_area_t * dest_area, int32_t d
|
||||
}
|
||||
|
||||
#endif /*LV_USE_DRAW_PXP*/
|
||||
#endif /*LV_USE_PXP*/
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "lv_draw_pxp.h"
|
||||
|
||||
#if LV_USE_PXP
|
||||
#if LV_USE_DRAW_PXP
|
||||
|
||||
#include "../../../stdlib/lv_string.h"
|
||||
@ -154,3 +155,4 @@ void lv_draw_pxp_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * d
|
||||
}
|
||||
|
||||
#endif /*LV_USE_DRAW_PXP*/
|
||||
#endif /*LV_USE_PXP*/
|
||||
|
@ -15,7 +15,8 @@
|
||||
|
||||
#include "lv_pxp_cfg.h"
|
||||
|
||||
#if LV_USE_DRAW_PXP
|
||||
#if LV_USE_PXP
|
||||
#if LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP
|
||||
#include "lv_pxp_osa.h"
|
||||
|
||||
/*********************
|
||||
@ -88,4 +89,5 @@ void lv_pxp_wait(void)
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_DRAW_PXP*/
|
||||
#endif /*LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP*/
|
||||
#endif /*LV_USE_PXP*/
|
||||
|
@ -22,7 +22,8 @@ extern "C" {
|
||||
|
||||
#include "../../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_DRAW_PXP
|
||||
#if LV_USE_PXP
|
||||
#if LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP
|
||||
#include "fsl_cache.h"
|
||||
#include "fsl_pxp.h"
|
||||
|
||||
@ -93,7 +94,8 @@ void lv_pxp_wait(void);
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_DRAW_PXP*/
|
||||
#endif /*LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP*/
|
||||
#endif /*LV_USE_PXP*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
|
@ -15,7 +15,8 @@
|
||||
|
||||
#include "lv_pxp_osa.h"
|
||||
|
||||
#if LV_USE_DRAW_PXP
|
||||
#if LV_USE_PXP
|
||||
#if LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP
|
||||
#include "lv_pxp_utils.h"
|
||||
#include "../../../misc/lv_log.h"
|
||||
#include "../../../osal/lv_os.h"
|
||||
@ -183,4 +184,5 @@ static void _pxp_wait(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /*LV_USE_DRAW_PXP*/
|
||||
#endif /*LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP*/
|
||||
#endif /*LV_USE_PXP*/
|
||||
|
@ -22,7 +22,8 @@ extern "C" {
|
||||
|
||||
#include "../../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_DRAW_PXP
|
||||
#if LV_USE_PXP
|
||||
#if LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP
|
||||
#include "lv_pxp_cfg.h"
|
||||
|
||||
/*********************
|
||||
@ -51,7 +52,8 @@ pxp_cfg_t * pxp_get_default_cfg(void);
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_DRAW_PXP*/
|
||||
#endif /*LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP*/
|
||||
#endif /*LV_USE_PXP*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
|
@ -15,7 +15,8 @@
|
||||
|
||||
#include "lv_pxp_utils.h"
|
||||
|
||||
#if LV_USE_DRAW_PXP
|
||||
#if LV_USE_PXP
|
||||
#if LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@ -89,6 +90,7 @@ pxp_as_pixel_format_t pxp_get_as_px_format(lv_color_format_t cf)
|
||||
return as_px_format;
|
||||
}
|
||||
|
||||
#if LV_USE_DRAW_PXP
|
||||
pxp_ps_pixel_format_t pxp_get_ps_px_format(lv_color_format_t cf)
|
||||
{
|
||||
pxp_ps_pixel_format_t ps_px_format = kPXP_PsPixelFormatRGB565;
|
||||
@ -143,3 +145,5 @@ bool pxp_buf_aligned(const void * buf, uint32_t stride)
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_DRAW_PXP*/
|
||||
#endif /*LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP*/
|
||||
#endif /*LV_USE_PXP*/
|
||||
|
@ -21,7 +21,8 @@ extern "C" {
|
||||
*********************/
|
||||
#include "../../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_DRAW_PXP
|
||||
#if LV_USE_PXP
|
||||
#if LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP
|
||||
#include "fsl_pxp.h"
|
||||
#include "../../../misc/lv_color.h"
|
||||
|
||||
@ -59,6 +60,7 @@ pxp_output_pixel_format_t pxp_get_out_px_format(lv_color_format_t cf);
|
||||
|
||||
pxp_as_pixel_format_t pxp_get_as_px_format(lv_color_format_t cf);
|
||||
|
||||
#if LV_USE_DRAW_PXP
|
||||
pxp_ps_pixel_format_t pxp_get_ps_px_format(lv_color_format_t cf);
|
||||
|
||||
bool pxp_buf_aligned(const void * buf, uint32_t stride);
|
||||
@ -72,6 +74,8 @@ bool pxp_buf_aligned(const void * buf, uint32_t stride);
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_DRAW_PXP*/
|
||||
#endif /*LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP*/
|
||||
#endif /*LV_USE_PXP*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
|
@ -35,6 +35,7 @@
|
||||
**********************/
|
||||
|
||||
static void _invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_t * area);
|
||||
static uint32_t _width_to_stride(uint32_t w, lv_color_format_t cf);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@ -51,8 +52,17 @@ static void _invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_t *
|
||||
void lv_draw_buf_vglite_init_handlers(void)
|
||||
{
|
||||
lv_draw_buf_handlers_t * handlers = lv_draw_buf_get_handlers();
|
||||
lv_draw_buf_handlers_t * font_handlers = lv_draw_buf_get_font_handlers();
|
||||
lv_draw_buf_handlers_t * image_handlers = lv_draw_buf_get_image_handlers();
|
||||
|
||||
handlers->invalidate_cache_cb = _invalidate_cache;
|
||||
font_handlers->invalidate_cache_cb = _invalidate_cache;
|
||||
image_handlers->invalidate_cache_cb = _invalidate_cache;
|
||||
|
||||
handlers->width_to_stride_cb = _width_to_stride;
|
||||
font_handlers->width_to_stride_cb = _width_to_stride;
|
||||
image_handlers->width_to_stride_cb = _width_to_stride;
|
||||
|
||||
}
|
||||
|
||||
/**********************
|
||||
@ -66,7 +76,7 @@ static void _invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_t *
|
||||
lv_color_format_t cf = header->cf;
|
||||
|
||||
if(area->y1 == 0) {
|
||||
uint16_t size = stride * lv_area_get_height(area);
|
||||
uint32_t size = stride * lv_area_get_height(area);
|
||||
|
||||
/* Invalidate full buffer. */
|
||||
DEMO_CleanInvalidateCacheByAddr((void *)draw_buf->data, size);
|
||||
@ -108,4 +118,14 @@ static void _invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_t *
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t _width_to_stride(uint32_t w, lv_color_format_t cf)
|
||||
{
|
||||
uint8_t bits_per_pixel = lv_color_format_get_bpp(cf);
|
||||
uint32_t width_bits = (w * bits_per_pixel + 7) & ~7;
|
||||
uint32_t width_bytes = width_bits / 8;
|
||||
uint8_t align_bytes = vglite_get_stride_alignment(cf);
|
||||
|
||||
return (width_bytes + align_bytes - 1) & ~(align_bytes - 1);
|
||||
}
|
||||
|
||||
#endif /*LV_USE_DRAW_VGLITE*/
|
||||
|
@ -291,16 +291,14 @@ static int32_t _vglite_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * layer)
|
||||
if(t == NULL)
|
||||
return LV_DRAW_UNIT_IDLE;
|
||||
|
||||
if(lv_draw_get_unit_count() > 1) {
|
||||
/* Let the SW unit to draw this task. */
|
||||
if(t->preferred_draw_unit_id != DRAW_UNIT_ID_VGLITE)
|
||||
if(t->preferred_draw_unit_id != DRAW_UNIT_ID_VGLITE) {
|
||||
/* Let the preferred known unit to draw this task. */
|
||||
if(t->preferred_draw_unit_id != LV_DRAW_UNIT_NONE) {
|
||||
return LV_DRAW_UNIT_IDLE;
|
||||
}
|
||||
else {
|
||||
/* Fake unsupported tasks as ready. */
|
||||
if(t->preferred_draw_unit_id != DRAW_UNIT_ID_VGLITE) {
|
||||
}
|
||||
else {
|
||||
/* Fake unsupported tasks as ready. */
|
||||
t->state = LV_DRAW_TASK_STATE_READY;
|
||||
|
||||
/* Request a new dispatching as it can get a new task. */
|
||||
lv_draw_dispatch_request();
|
||||
|
||||
@ -308,8 +306,7 @@ static int32_t _vglite_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * layer)
|
||||
}
|
||||
}
|
||||
|
||||
void * buf = lv_draw_layer_alloc_buf(layer);
|
||||
if(buf == NULL)
|
||||
if(lv_draw_layer_alloc_buf(layer) == NULL)
|
||||
return LV_DRAW_UNIT_IDLE;
|
||||
|
||||
t->state = LV_DRAW_TASK_STATE_IN_PROGRESS;
|
||||
|
@ -97,8 +97,8 @@ static void _vglite_draw_triangle(const lv_area_t * coords, const lv_area_t * cl
|
||||
tri_area.x2 = (int32_t)LV_MAX3(dsc->p[0].x, dsc->p[1].x, dsc->p[2].x);
|
||||
tri_area.y2 = (int32_t)LV_MAX3(dsc->p[0].y, dsc->p[1].y, dsc->p[2].y);
|
||||
|
||||
uint32_t width = tri_area.x2 - tri_area.x1;
|
||||
uint32_t height = tri_area.y2 - tri_area.y1;
|
||||
uint32_t width = lv_area_get_width(&tri_area);
|
||||
uint32_t height = lv_area_get_height(&tri_area);
|
||||
|
||||
/* Init path */
|
||||
int32_t triangle_path[] = { /*VG line path*/
|
||||
|
@ -286,7 +286,6 @@
|
||||
/*
|
||||
* Unblocking an RTOS task with a direct notification is 45% faster and uses less RAM
|
||||
* than unblocking a task using an intermediary object such as a binary semaphore.
|
||||
*
|
||||
* RTOS task notifications can only be used when there is only one task that can be the recipient of the event.
|
||||
*/
|
||||
#ifndef LV_USE_FREERTOS_TASK_NOTIFY
|
||||
@ -644,16 +643,38 @@
|
||||
#endif
|
||||
|
||||
/** Use NXP's PXP on iMX RTxxx platforms. */
|
||||
#ifndef LV_USE_DRAW_PXP
|
||||
#ifdef CONFIG_LV_USE_DRAW_PXP
|
||||
#define LV_USE_DRAW_PXP CONFIG_LV_USE_DRAW_PXP
|
||||
#ifndef LV_USE_PXP
|
||||
#ifdef CONFIG_LV_USE_PXP
|
||||
#define LV_USE_PXP CONFIG_LV_USE_PXP
|
||||
#else
|
||||
#define LV_USE_DRAW_PXP 0
|
||||
#define LV_USE_PXP 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if LV_USE_DRAW_PXP
|
||||
#if LV_USE_OS
|
||||
#if LV_USE_PXP
|
||||
/** Use PXP for drawing.*/
|
||||
#ifndef LV_USE_DRAW_PXP
|
||||
#ifdef LV_KCONFIG_PRESENT
|
||||
#ifdef CONFIG_LV_USE_DRAW_PXP
|
||||
#define LV_USE_DRAW_PXP CONFIG_LV_USE_DRAW_PXP
|
||||
#else
|
||||
#define LV_USE_DRAW_PXP 0
|
||||
#endif
|
||||
#else
|
||||
#define LV_USE_DRAW_PXP 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Use PXP to rotate display.*/
|
||||
#ifndef LV_USE_ROTATE_PXP
|
||||
#ifdef CONFIG_LV_USE_ROTATE_PXP
|
||||
#define LV_USE_ROTATE_PXP CONFIG_LV_USE_ROTATE_PXP
|
||||
#else
|
||||
#define LV_USE_ROTATE_PXP 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if LV_USE_DRAW_PXP && LV_USE_OS
|
||||
/** Use additional draw thread for PXP processing.*/
|
||||
#ifndef LV_USE_PXP_DRAW_THREAD
|
||||
#ifdef LV_KCONFIG_PRESENT
|
||||
|
@ -43,8 +43,10 @@
|
||||
#if LV_USE_DRAW_VGLITE
|
||||
#include "draw/nxp/vglite/lv_draw_vglite.h"
|
||||
#endif
|
||||
#if LV_USE_DRAW_PXP
|
||||
#include "draw/nxp/pxp/lv_draw_pxp.h"
|
||||
#if LV_USE_PXP
|
||||
#if LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP
|
||||
#include "draw/nxp/pxp/lv_draw_pxp.h"
|
||||
#endif
|
||||
#endif
|
||||
#if LV_USE_DRAW_DAVE2D
|
||||
#include "draw/renesas/dave2d/lv_draw_dave2d.h"
|
||||
@ -201,9 +203,11 @@ void lv_init(void)
|
||||
lv_draw_vglite_init();
|
||||
#endif
|
||||
|
||||
#if LV_USE_DRAW_PXP
|
||||
#if LV_USE_PXP
|
||||
#if LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP
|
||||
lv_draw_pxp_init();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if LV_USE_DRAW_DAVE2D
|
||||
lv_draw_dave2d_init();
|
||||
@ -392,9 +396,11 @@ void lv_deinit(void)
|
||||
|
||||
lv_obj_style_deinit();
|
||||
|
||||
#if LV_USE_DRAW_PXP
|
||||
#if LV_USE_PXP
|
||||
#if LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP
|
||||
lv_draw_pxp_deinit();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if LV_USE_DRAW_VGLITE
|
||||
lv_draw_vglite_deinit();
|
||||
|
Loading…
Reference in New Issue
Block a user