Closed JefkeB closed 1 year ago
cc @mariotaku
Hi,
Been looking in this some more. When using a white source image it seems to work almost as expected. Colors are still a bit off compared to the color without gpu.
As far as I understand it : The reason must be in the sdl gpu drawing functions. It seems the problem is in the function static void apply_recolor_opa(SDL_Texture texture, const lv_draw_img_dsc_t draw_dsc) in https://github.com/lvgl/lvgl/blob/release/v8.3/src/draw/sdl/lv_draw_sdl_img.c.
The sdl function used is SDL_SetTextureColorMod to do the recolor Looking @ https://wiki.libsdl.org/SDL_SetTextureColorMod call returns 0 so is supported by renderer The formula 'srcC = srcC * (color / 255)' is used My image is black, so srcC = 0, the result will always be 0 so no color change ??
Am I correct or is the something else. Is it possible to use the 'default' lvgl recoloring from https://github.com/lvgl/lvgl/blob/release/v8.3/src/draw/sw/lv_draw_sw_img.c in combination with the gpu ?
Thanks
@JefkeB Which SDL2 version do you have? On newer versions (2.0.6+), the implementation should use custom blend mode.
Hi,
On PC (linux) and on embedded (Raspberry CM3+) SDL2-2.0.10
We compiled against SDL version 2.0.10 ... But we are linking against SDL version 2.0.10
I saw a comment in lv_conf.h
/*Custom blend mode for mask drawing, disable if you need to link with older SDL2 lib*/
#define LV_GPU_SDL_CUSTOM_BLEND_MODE (SDL_VERSION_ATLEAST(2, 0, 6))
But ignored it because my version used is newer, did I do wrong ?
This is strange as it should be enabled by default. Did you try adding breakpoint in blending code?
can you point me to a location in the code to place a breakpoint ?
Maybe I missed somewhere while drawing image button...
Hi, nope no stopping in there for imgbutton and button on the screen, not even the function is called. Must be a problem on my side ? In the sdl mode without gpu enabled though all is working as expected.
anything else to enable besides the 2 defines in the lvgl config file ?
This issue or pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
For me not stale ... Nobody can help me ?
Want to have the gpu working cause it gives me much better performance on an embedded rPi system using sdl. The direct framebuffer shows loads of tearing during changes on the screen
J
@JefkeB Is Home_48 an icon with deep blue color? Due to SDL_SetTextureColorMod's limitation I think it's better to provide a white image.
Hi,
thanks for your reply. Changed the images from black to white Now the colors are as expected Never expected it would be this simple
So solved for me
Thanks again for the help
J
Hi,
I'm evaluating the SDL driver with the lv_port_pc_eclipse simulator.
When running this in the simulator the working is as expected. default after starting application, color is grey as expected
after pressing (checked style ), color is lime as expected
When the GPU is enabled
default after starting application Wrong color should be grey
after pressing (checked style ) Wrong color should be lime
Is this a problem in the GPU code or some where else ? The same problem is visible when running on a raspberry pi (the intended target).
The complete project is at https://github.com/JefkeB/lv_port_pc_eclipse