feat(drawing) hardware accelerated rendering by SDL2 (#2484)

* Hardware accelerated SDL render WIP

* Rect drawing code cleanup

* Fixed arc drawing angle
Fixed compact rect drawing

* Refactoring
Fixed cache deinit order

* Image recolor
Drawing left and right border

* Math problems

* Improving draw cache

* Improving line drawing logic

* Improving arc drawing quality

* Added round function

* Attempts to render properly on Pi

* Updated lruc function names

* Updated symbol names

* Saved ram by reusing part of background rect

* Added outline drawing
Removed arc texture caching

* rect drawing cache rendering

* high efficiency rect shadow texture caching

* fixed simple borders drawing

* fixed generic borders drawing

* Simplified text atlas caching logic
Supports chroma keyed image

* Color palette WIP

* Improved draw cache

* Updated defines for better build

* renaming files for better consistency

* fix includes

* Updated lv_conf_internal with generator

* Fixing build issues

* fixed img rotation pivot

* better font atlas caching WIP

* fix includes

* full font atlas support
improved gpu caching for rect

* update conf header

* fix palette creation

* Fixed font atlas key matching

* fixed chroma key image background

* added 3bpp mask palette (WIP)

* fixed caching key initialization

* disabled gpu arc drawing for now
updated naming convention

* updated naming convention

* fix makefile and include path

* improved rect drawing when having masks

* improved rect drawing when having masks

* reduced texture allocation while drawing with mask

* accurate clipping for rects and texts

* fixed build error

* fixed build error

* line drawing WIP

* updated imports

* fixed freezes if LRU has smaller new item

* fixed clipping rect color

* fixed build error

* using built-in free function for LRU key

* Added custom background drawing function

* fixing imports

* fixed shadow bitmap on old SDL libs

* improved draw_img compatibility

* fixing font baking

* fixed font rendering

* fixed lv_draw_line check

* configurable SDL include path

* disabled SDL line drawing implementation

* supports screen resize

* sdl: Remove duplicated object

Observed issue:

  /usr/bin/ld: lv_gpu_sdl_texture_cache.o: \
  in function `_lv_gpu_sdl_texture_cache_init':
  lv_gpu_sdl_texture_cache.c:(.text+0x30): \
  multiple definition of `_lv_gpu_sdl_texture_cache_init'; \
  lv_gpu_sdl_texture_cache.o:lv_gpu_sdl_texture_cache.c:(.text+0x30): \
  first defined here

Forwarded: https://github.com/mariotaku/lvgl/pull/1
Relate-to: https://github.com/lvgl/lvgl/pull/2484
Signed-off-by: Philippe Coval <philippe.coval@huawei.com>

* Reduced opening of image

* Closes image resource properly

* improved draw image logic

* Moved driver related code to lv_drivers

* fixed lv_deinit implicit sdl code invocation

* improved shadow clipping

* fixed outline area invalidation

* updated comments

* formatted code using astyle

* Updated README

* formatted code

* fixed typo

* fixed static declaration

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
Co-authored-by: Philippe Coval <philippe.coval@huawei.com>
This commit is contained in:
Mariotaku
2021-09-17 01:20:32 +09:00
committed by GitHub
parent 71e6f65d51
commit efc5bb40d9
34 changed files with 3445 additions and 13 deletions

View File

@@ -35,6 +35,10 @@
#include "../gpu/lv_gpu_nxp_pxp_osa.h"
#endif
#if LV_USE_GPU_SDL
#include "../gpu/lv_gpu_sdl.h"
#endif
/*********************
* DEFINES
*********************/
@@ -121,6 +125,9 @@ void lv_init(void)
for(; ;) ;
}
#endif
#if LV_USE_GPU_SDL
lv_gpu_sdl_init();
#endif
_lv_obj_style_init();
_lv_ll_init(&LV_GC_ROOT(_lv_disp_ll), sizeof(lv_disp_t));
@@ -177,10 +184,13 @@ void lv_init(void)
LV_LOG_TRACE("finished");
}
#if LV_ENABLE_GC || !LV_MEM_CUSTOM
#if LV_ENABLE_GC || !LV_MEM_CUSTOM || LV_USE_GPU_SDL
void lv_deinit(void)
{
#if LV_USE_GPU_SDL
lv_gpu_sdl_deinit();
#endif
_lv_gc_clear_roots();
lv_disp_set_default(NULL);