feat(gpu): reattach nxp pxp vglite accelerators(#3322)
* feat(pxp/vglite) Attach NXP GPUs to the new draw context. Create a single NXP draw layer on top of PXP and VGLITE. Extra changes: 1. Add VGLITE image blits acceleration. 2. Reenable blit split workaround for quality issue in RT500. 3. Increase threshold from 32 to 5000 px to fill/blit with both PXP and VGLITE. 4. Allow to enable both PXP and VGLITE. Add a fallback mechanism: - by default the PXP will try to accelerate. if that is not supported (or fails due to threshold limit condition from 3.) then it will fallback to VGLITE. - if VGLITE does not support that feature (or fails due to threshold limit condition from 3.) the it will fallback to CPU. Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com> * feat(vglite) Add VGLITE support to draw the backgroud of rectangles. optim: draw only a circle when radius has value LV_RADIUS_CIRCLE. optim: to draw rounded corners, use cubic bezier curves Signed-off-by: Seb Fagard <sebastien.fagard@nxp.com> Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com> * feat(vglite) Add VGLITE support to draw arcs. Use up to 4 bezier curves to optimize the drawing of an arc. The arc curve has to be constant when growing the angle: for this we compute sub-arc based on a best approximation of quarter-arc. use dichotomy to find the sub-arc 't' param, instead of tangent approximation. Signed-off-by: Seb Fagard <sebastien.fagard@nxp.com> Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com> * feat(pxp) Add ARGB88888 format support for PXP backend. Supports per pixel and global alpha blending, and combination of alpha blending with recolor feature. Signed-off-by: Jerome Evillard <jerome.evillard@nxp.com> Signed-off-by: Seb Fagard <sebastien.fagard@nxp.com> Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com> * feat(vglite) Add the support of ARGB 32bits color format. Signed-off-by: Seb Fagard <sebastien.fagard@nxp.com> Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com> * feat(vglite) Add VGLITE acceleration support for rotation and zoom. Signed-off-by: Seb Fagard <sebastien.fagard@nxp.com> Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com> * feat(pxp) Add PXP acceleratin to rotate in blit. Applies the rotation on the pxp output. Signed-off-by: Seb Fagard <sebastien.fagard@nxp.com> Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com> * fix(pxp/vglite) Avoid calling the blend callback from image decoded callback. Add lv_gpu_nxp_pxp_blit_transform() and lv_gpu_nxp_vglite_blit_transform(). This will simplify a lot the fallback mechanism and the way of adding new image decoded features. (MGG-884) Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com> * feat(pxp) Add image rotate 90x. Simplify the two steps process by adding the blit_cover and blit_opa functions. In order to rotate or recolor with opacity, two steps must be fallowed: 1. Run the operation without opa. 2. Blend the result by applying the opa. (MGG-469) Obs: Recolor and rotate is currently not supported with opa or alpha channel.(MGG-883) Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com> * fix(vglite) Fix incorrect slider widget indicator when vglite acceleration is enabled (MGG-863) Signed-off-by: Stefan Babatie <stefan.babatie@nxp.com> Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com> * fix(pxp) Fix pxp fill (simple rect draw) on 32 bit color depth. (MGG-890) Signed-off-by: Stefan Babatie <stefan.babatie@nxp.com> * fix(pxp) Separate blit simple by the blit with transformation. While we run into blit with transformation we have to decide if the operation needs to be done in one or two steps. Blit with color format (opa or alpha or chroma key) - require one step: blit_cf(). Blit with rotate or recolor but no color format - require one step: blit_cover(). Blit with rotate or recolor + opa or alpha - require two steps: blit_opa() = blit_cover() + blit_cf(). Blit with rotate or recolor + chroma key - not supported yet. Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com> * feat(pxp) Add support for recolor with chroma-keying. (MGG-434) Signed-off-by: Stefan Babatie <stefan.babatie@nxp.com> * fix(pxp) Fix temporary buffer allocation limit. Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com> * fix(pxp) Add PXP limitation while rotating images not aligned to 16x16 blocks. Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com> * fix(nxp) Add makefiles. Tested with: working-directory: tests/makefile run: make test_file Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com> * feat(nxp) Update NXP github documentation. (MGG-864) Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com> * fix(nxp) Move the API comments of global functions only in the H files to make maintenance simpler. Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com> * fix(nxp/vglite) Fixed some warnings. Remove unused variables. Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com> * fix(nxp) lv_draw_nxp_ctx_deinit() shall simply fallback to sofware call. Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com> * fix(nxp) Fallback to software callbacks if need for argb8565 support. During rendering, LVGL might initializes new draw_ctxs and start drawing into a separate buffer (called layer). If the content to be rendered has "holes", e.g. rounded corner, LVGL temporarily sets the disp_drv.screen_transp flag. It means the renderers should draw into an ARGB buffer. With 32 bit color depth it's not a big problem but with 16 bit color depth the target pixel format is ARGB8565 which is not supported by the GPU. In this case, the NXP callbacks should fallback to SW rendering. Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com> * fix(pxp) Fix wrong demo widget transparency. 1. Fix alpha inverted calculation for fill with opacity. 2. Fix also the ratio of recoloring for chroma key. Signed-off-by: Stefan Babatie <stefan.babatie@nxp.com> * fix(vglite) Remove software pre-multiplication when hardware pre-multiplication is available. (MGG-886) Signed-off-by: Stefan Babatie <stefan.babatie@nxp.com> * doc(vglite) Add vglite initialization info. Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com> * fix(pxp/vglite) Fix unused variable warnings when PXP/VGLite are not enabled simultaneously. Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com> * fix(pxp) Fixed the color key recoloring on 16 bits color depth. 1. Fixed the arguments of lv_color_mix(), previously was using an inversed logic. But it works anyway. 2. Use LV_COLOR_SET_X for adjusting the channels on both 16 and 32 bits. Fixed the max values. Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com> Co-authored-by: Stefan Babatie <stefan.babatie@nxp.com>
This commit is contained in:
143
src/draw/nxp/pxp/lv_draw_pxp_blend.h
Normal file
143
src/draw/nxp/pxp/lv_draw_pxp_blend.h
Normal file
@@ -0,0 +1,143 @@
|
||||
/**
|
||||
* @file lv_draw_pxp_blend.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2020-2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_PXP_BLEND_H
|
||||
#define LV_DRAW_PXP_BLEND_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
#include "lv_gpu_nxp_pxp.h"
|
||||
#include "../../sw/lv_draw_sw.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_BLIT_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) for image copy with 100% opacity to be handled by PXP*/
|
||||
#define LV_GPU_NXP_PXP_BLIT_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) for image copy with transparency to be handled by PXP*/
|
||||
#define LV_GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT 5000
|
||||
#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 5000
|
||||
#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 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_FILL_OPA_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) to be filled by PXP with transparency*/
|
||||
#define LV_GPU_NXP_PXP_FILL_OPA_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Fill area, with optional opacity.
|
||||
*
|
||||
* @param[in/out] dest_buf destination buffer
|
||||
* @param[in] dest_stride width (stride) of destination buffer in pixels
|
||||
* @param[in] fill_area area to fill
|
||||
* @param[in] color color
|
||||
* @param[in] opa transparency of the color
|
||||
* @retval LV_RES_OK Fill completed
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_PXP_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_pxp_fill(lv_color_t * dest_buf, lv_coord_t dest_stride, const lv_area_t * fill_area,
|
||||
lv_color_t color, lv_opa_t opa);
|
||||
|
||||
/**
|
||||
* BLock Image Transfer - copy rectangular image from src_buf to dst_buf with effects.
|
||||
* By default, image is copied directly, with optional opacity. This function can also
|
||||
* rotate the display output buffer to a specified angle (90x step).
|
||||
*
|
||||
* @param[in/out] dest_buf destination buffer
|
||||
* @param[in] dest_area destination area
|
||||
* @param[in] dest_stride width (stride) of destination buffer in pixels
|
||||
* @param[in] src_buf source buffer
|
||||
* @param[in] src_area source area with absolute coordinates to draw on destination buffer
|
||||
* @param[in] opa opacity of the result
|
||||
* @param[in] angle display rotation angle (90x)
|
||||
* @retval LV_RES_OK Fill completed
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_PXP_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_pxp_blit(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area, lv_opa_t opa, lv_disp_rot_t angle);
|
||||
|
||||
/**
|
||||
* BLock Image Transfer - copy rectangular image from src_buf to dst_buf with transformation.
|
||||
*
|
||||
*
|
||||
* @param[in/out] dest_buf destination buffer
|
||||
* @param[in] dest_area destination area
|
||||
* @param[in] dest_stride width (stride) of destination buffer in pixels
|
||||
* @param[in] src_buf source buffer
|
||||
* @param[in] src_area source area with absolute coordinates to draw on destination buffer
|
||||
* @param[in] dsc image descriptor
|
||||
* @param[in] cf color format
|
||||
* @retval LV_RES_OK Fill completed
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_PXP_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_pxp_blit_transform(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area, const lv_draw_img_dsc_t * dsc, lv_img_cf_t cf);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_PXP*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_PXP_BLEND_H*/
|
||||
Reference in New Issue
Block a user