Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v9 discussion and changes #3298

Closed
kisvegabor opened this issue Apr 26, 2022 · 145 comments
Closed

v9 discussion and changes #3298

kisvegabor opened this issue Apr 26, 2022 · 145 comments
Labels
pinned Not closed automatically

Comments

@kisvegabor
Copy link
Member

kisvegabor commented Apr 26, 2022

See the ROADMAP.

v9 schedule

  • December 4: Feature stop, start updating the docs and testing
  • December 18: Release candidate version and call to test
  • January 15: Release v9.0

A large update was merged to master which involves API changes as well. You can use master to try out the latest changes but for production we recommend using the release/v8.3 branch.

Below you can see the main changes.

Built in drivers

  • The goal of these changes is to have built-in drivers right in the LVGL repo
  • Now SDL (supporting window resize and multiple windows), Linux Frame buffer, and a TFT_eSPI wrapper is available
  • Later display controllers (e.g. ILI9341) will be added too
  • A "vendor layer" will be added as well to make it simpler to use the display or touch controllers e.g. with STM's SPI, or ESP's I2C, etc.

General API changes

  • lv_obj_add_event_cb is renamed to lv_obj_add_event
  • lv_disp_... is renamed to lv_display_...
  • lv_btn_... is renamed to lv_button_...
  • lv_btnmatrix_... is renamed to lv_buttonmatrix_...
  • lv_img_... is renamed to lv_image_...
  • zoom is renamed to scale
  • angle is renamed to rotation
  • scr is renamed to screen
  • act is renamed to active
  • del is renamed to delete
  • lv_obj_clear_flag is renamed to lv_obj_remove_flag
  • lv_obj_clear_state is renamed to lv_obj_remove_state

New color format management

  • LV_IMG_CF_... was removed and was replaced by LV_COLOR_FORMAT_...
  • The image converter is not updated yet so you need to manually update the color format of the generated images
  • Alpha 1bit, 2bit and 4bit color formats were removed because they can be replaced by Indexed 1 bit, 2 bit and 4 bit (alpha 8 bit is available)
  • LV_COLOR_DEPTH 24 is supported for RGB888 rendering

Display API

  • lv_disp_drv_t and lv_disp_draw_buf_t was removed
  • To create a display and set it up:
lv_display_t * disp = lv_display_create(hor_res, ver_res)
lv_display_set_flush_cb(disp, flush_cb);
lv_display_set_draw_buffers(disp, buf1, buf2, buf_size_in_bytes, mode);
  • Note that now the buf size is in bytes and not pixels
  • modes can be:
    • LV_DISPLAY_RENDER_MODE_PARTIAL This way the buffers can be smaller then the display to save RAM. At least 1/10 sceen size buffer(s) are recommended.
    • LV_DISPLAY_RENDER_MODE_DIRECT The buffer(s) has to be screen sized and LVGL will render into the correct location of the buffer. This way the buffer always contain the whole image. With 2 buffers the buffers' content are kept in sync automatically. (Old v7 behaviour)
    • LV_DISPLAY_RENDER_MODE_FULL Just always redraw the whole screen
  • Similarly to the widgets, now you can attach events to the display too, using lv_display_add_event()
  • monitor_cb is removed and a LV_EVENT_RENDER_READY event is fired instead
  • Instead of having display background color and image, lv_layer_bottom() is added where any color can be set or any widget can be created.
  • For more details check out the docs here and here.

Color format of the display

  • The target color format can be adjusted in the display by calling lv_display_set_color_format(disp, LV_COLOR_FORMAT_...)
  • LV_COLOR_16_SWAP is removed and lv_display_set_color_format(disp, LV_COLOR_FORMAT_NATIVE_REVERSED) can be used instead
  • disp_drv.scr_transp was removed and lv_display_set_color_format(disp, LV_COLOR_FORMAT_NATIVE_ALPHA) can be used instead
  • set_px_cb is removed, you can add a custom color format converter with disp->draw_ctx->buffer_convert = my_converter;. As a reference see the built-in converter

Indev API

  • Similarly to the display lv_indev_drv_t was removed and an input device can be created like this:
lv_indev_t * indev = lv_indev_create();
lv_indev_set_type(indev, LV_INDEV_TYPE_...);
lv_indev_set_read_cb(indev, read_cb);

Others

  • lv_msg is removed and replaced by lv_observer
  • lv_chart ticks support was removed, lv_scale can be used instead

The parallel rendering update is also merged to master on 2023.06.05. lv_conf.h was changed a lot too so don't forget to update it from lv_conf_template.h. You can read more about the parallel rendering changes here.


I'll update this post if there will new changes or if something important is missing.

@kisvegabor kisvegabor added pinned Not closed automatically next major labels Apr 26, 2022
@KLVN
Copy link

KLVN commented May 25, 2022

@kisvegabor
Copy link
Member Author

Perspective distortion can be added in any minor version as it doesn't require a conceptual change. It's just an other option next to scale and rotation.

@Cuixudong
Copy link

Add control animation group to reduce the amount of independent control animation code.
for example:https://www.bilibili.com/video/BV1EV411s7tK and https://www.bilibili.com/video/BV1644y1z7MS

@kisvegabor
Copy link
Member Author

For this I checked GSAP stagger as inspiration/reference: https://greensock.com/docs/v3/Staggers
What do you think about it?

@Cuixudong
Copy link

For this I checked GSAP stagger as inspiration/reference: https://greensock.com/docs/v3/Staggers What do you think about it?

Looks great.

@kisvegabor
Copy link
Member Author

I added a reminder about staggers

@GorgonMeducer
Copy link
Contributor

GorgonMeducer commented Jun 14, 2022

Placeholder:

  • Introduce 9patch-images widgets/style
  • Introduce an option to replace RGB565 with RGB565-A8 when LV_COLOR_DEPTH to 16 in benchmark
  • Introduce a pipeline in renderer to support multi-GPUs/Accelerators, such as 2D-capable-DMAs, 2D GPUs, dedicated processor cores for 2D tasks etc.

@kisvegabor
Copy link
Member Author

Introduce an option to replace RGB565 with RGB565-A8 when LV_COLOR_DEPTH to 16 in benchmark

Can't we do it now in v8.3?

I added the other two to the list.

@GorgonMeducer
Copy link
Contributor

@kisvegabor sure, we can do this in 8.3.

@kctan0805
Copy link
Contributor

kctan0805 commented Jun 18, 2022

Our platform supports HW acceleration on image format RGB565 and ARGB8888.
If I set LV_COLOR_DEPTH as 16, the LV_IMG_CF_TRUE_COLOR_ALPHA image will be ARGB8565.
If I set LV_COLOR_DEPTH as 32, both LV_IMG_CF_TRUE_COLOR and LV_IMG_CF_TRUE_COLOR_ALPHA images will be ARGB8888.
Could we have an option to set LV_IMG_CF_TRUE_COLOR_ALPHA image as ARGB8888 format even LV_COLOR_DEPTH == 16?

@kisvegabor
Copy link
Member Author

@GorgonMeducer
See #3379

@kctan0805
Yes, we can create "direct formats" like LV_IMG_CF_ARGB8888 or so.

@weblqb
Copy link

weblqb commented Jul 3, 2022

Build-in thread-safe if it is practical. Thanks! ^_^

@kisvegabor kisvegabor changed the title v9 reminders v9 planning Jul 6, 2022
@kisvegabor
Copy link
Member Author

Build-in thread-safe if it is practical.

I find to it too complex to manage on our end compared to how simple it is to manage on the user's end 🙂

@kisvegabor
Copy link
Member Author

I merged the ROADMAP with the list of ideas in the first post.

I collected the API breaking changes in to the "Plannel for v9" section. "Planned in general" contains ideas that can be added in any minor version therefore they not critical for v9.

Please take a look at the list and tell what you think.

My approach is to start with with the simple tasks (naming, minor refactoring) and let the few complex ones for later (masking, color formats, label features).

@Cuixudong
Copy link

what about PicoGL?

@GorgonMeducer
Copy link
Contributor

@kisvegabor did you forget the 9paches-image widgets?

@kisvegabor
Copy link
Member Author

@Cuixudong For for what purpose do you mean PicoGL?

@GorgonMeducer It's already added here.

@Mair
Copy link

Mair commented Jul 13, 2022

@kisvegabor please keep me updated to the progress (I'll also check in periodically). I'll start updating the course as soon as its stable 😊

@kisvegabor
Copy link
Member Author

kisvegabor commented Jul 13, 2022

Thanks, @Mair. I think it will take at least a half year (probably more) to get close to release v9.

@kisvegabor
Copy link
Member Author

I'm thinking about going back to a flatter directory structure. It means e.g. moving extra/widgets to src/widgets. The goal of this change would be make the features more visible and unified. Storing widgets in two places look odd in the practice.

Do see any problems with it?

@pete-pjb
Copy link
Collaborator

pete-pjb commented Jul 19, 2022

Hi @kisvegabor ,

Having all the widgets in one place makes good sense and gets my vote 🙂

Cheers,

Pete

@GorgonMeducer
Copy link
Contributor

@kisvegabor Once you make this happen, please could you also update the PDSC file?

<file category="sourceC" name="src/extra/lv_extra.c" />
<!-- src/extra/themes -->
<file category="sourceC" name="src/extra/themes/default/lv_theme_default.c" />
<file category="sourceC" name="src/extra/themes/basic/lv_theme_basic.c" />
<file category="sourceC" name="src/extra/themes/mono/lv_theme_mono.c" />
<!-- src/extra/widgets -->
<file category="sourceC" name="src/extra/widgets/animimg/lv_animimg.c" />
<file category="sourceC" name="src/extra/widgets/calendar/lv_calendar.c" />
<file category="sourceC" name="src/extra/widgets/calendar/lv_calendar_header_arrow.c" />
<file category="sourceC" name="src/extra/widgets/calendar/lv_calendar_header_dropdown.c" />
<file category="sourceC" name="src/extra/widgets/chart/lv_chart.c" />
<file category="sourceC" name="src/extra/widgets/colorwheel/lv_colorwheel.c" />
<file category="sourceC" name="src/extra/widgets/imgbtn/lv_imgbtn.c" />
<file category="sourceC" name="src/extra/widgets/keyboard/lv_keyboard.c" />
<file category="sourceC" name="src/extra/widgets/led/lv_led.c" />
<file category="sourceC" name="src/extra/widgets/list/lv_list.c" />
<file category="sourceC" name="src/extra/widgets/menu/lv_menu.c" />
<file category="sourceC" name="src/extra/widgets/meter/lv_meter.c" />
<file category="sourceC" name="src/extra/widgets/msgbox/lv_msgbox.c" />
<file category="sourceC" name="src/extra/widgets/span/lv_span.c" />
<file category="sourceC" name="src/extra/widgets/spinbox/lv_spinbox.c" />
<file category="sourceC" name="src/extra/widgets/spinner/lv_spinner.c" />
<file category="sourceC" name="src/extra/widgets/tabview/lv_tabview.c" />
<file category="sourceC" name="src/extra/widgets/tileview/lv_tileview.c" />
<file category="sourceC" name="src/extra/widgets/win/lv_win.c" />
<!-- src/extra/layouts -->
<file category="sourceC" name="src/extra/layouts/flex/lv_flex.c" />
<file category="sourceC" name="src/extra/layouts/grid/lv_grid.c" />

@kisvegabor
Copy link
Member Author

@GorgonMeducer
Yes, no problem.
FYI, I"ve also started to refactor lv_conf.h which probably affects the CMSIS pack too.

@kisvegabor
Copy link
Member Author

@sukesh-ak Yes, sorry for not mentioning it clearly. I've just added it to the top comment here. It's a pretty new feature so please don't hesitate to let us know if you have any improvement ideas or find any issues.

@calvin2021y
Using the OS virtual keyboard should be possible by writing a driver for it. Similar to this one.

@sukesh-ak
Copy link

@sukesh-ak Yes, sorry for not mentioning it clearly. I've just added it to the top comment here. It's a pretty new feature so please don't hesitate to let us know if you have any improvement ideas or find any issues.

Thanks will check it out.

@mhaberler
Copy link
Contributor

mhaberler commented Nov 26, 2023

played with observers - super elegant and useful!

I tried to deal with transient values which might become unavailable after a TTL (e.g. BLE beacon out of reach)

In my example I dealt with invalidation by setting a magic value (INT_MAX) in a timeout and detecting this in the observer callbackso a label or color can be set accordingly

maybe there's a more general way to convey "not available" to an observer?

what about a user_data member in lv_subject_t which observers can inspect?

edit: it occurred to me the easiest way is to set the type to LV_SUBJECT_TYPE_NONE, notify the observers and have the client inspect the type

@kisvegabor
Copy link
Member Author

played with observers - super elegant and useful!

Thank you for the feedback, happy that you like it 🙂

it occurred to me the easiest way is to set the type to LV_SUBJECT_TYPE_NONE, notify the observers and have the client inspect the type

Interesting idea! In general it's hard to give advice about it without knowing more about the details. Anyway, it's great that you have found a pleasing solution.

@mhaberler
Copy link
Contributor

it's really about conveying a value like None in Python

sensor defective is not the same temperature as 0° - no value available is not the same as value zero

any specific reason why observers have a user_data field, but subjects do not?

@kisvegabor
Copy link
Member Author

sensor defective is not the same temperature as 0° - no value available is not the same as value zero

I see now. In this case I think a special value is a good idea. A more advanced solution could be to have 3 subjects:

  1. for the actual value
  2. for the error state
  3. a subject group for both

You can subscribe to the group the get notified if there are an errors or a new value.

any specific reason why observers have a user_data field, but subjects do not?

Yes, oversight 😄 I've just added it in 767a44b

@mhaberler
Copy link
Contributor

mhaberler commented Nov 27, 2023

yep, that would do it - need to explore subject groups

appreciate the user data - escape hatch for the weird ;)

edit: actually the subject user data opens another simple way of dealing with null values: setting the format string for a say lv_label_set_text_fmt

  • "n/a" if invalid value
  • "%d" if valid

@mhaberler
Copy link
Contributor

mhaberler commented Nov 27, 2023

I'm missing how a subject group gets notified?

I would think the sequence is to set all the member subjects, then "set the group" ?

edit: ah I guess it's lv_subject_notify

edit2: all working so far, including groups - no issues

@kisvegabor
Copy link
Member Author

I've updated the docs of the observer to describe it in more detail. It will be compiled and updated in ~10 minutes.

@djixon
Copy link

djixon commented Nov 27, 2023

Challenge 1:
Provide a simple rendering (lighting and shadowing) of all objects taking into account their Z depth, real transparency, material property (which can become part of style) on the fly. In such a model, all existing colors become diffuse colors (which means final resulting color at screen is computed based on lighting and illumination model of surface materials, that base color (or color from texture), and position of light source. Each lv_obj can have its own light source with its own properties (lighting_model, light_color, light_intensity, ligtht_type (point, directional) and 3D coordinate light_position "above" (in terms of Z order with x, and y position of light source). Lighting model can be any of Lambert, Phong, specular only, isotropic or un-isotropic. Within style, now there should be property Material with its own properties like: shading_model (lambert, phong, SSS, specular only), roughness, texture, (or simple procedural texture), index of reflection/refraction, opacity (basically a alpha channel but can be changed on the fly for example if material is configured to receives shadows from "upper" layers) etc.

It may looks like a huge challenging task but at simplest form it can be performed "on the fly" by actually utilizing lighting effects only over NON-FULLY-TRANSPARENT pixels (until refraction is involved). Different tricks can be used for fast calcs of any of mentioned lighting models in terms of pre-calculated tables etc. As current lv_obj are just "flat surfaces" stacked along (virtual) Z depth, for such an effect to achieve really impresive results, there is only one internal parameter required to current style elements lets call it thickness. So any border can have its own Z thickness, Padding too, PART_MAIN too, TEXT too etc. that would allow final rendering routine to properly distribute lighting effect on each part differentially based on that local Z offset of each part with respect to a Z position of object itself. Real shadowing is nothing else than taking whole rendered layer, removing chroma component from it (getting it as transparent gray-scaled image) and applying proper scaling, repositioning and blurring (depends on lighting model) with respect to position of light source, it is then applied as an overlay into shadow buffer which is propagated to "under" layer(s) until it reach the layer which material has marked property SHADOW_RECEVER. If material of that layer has also turned on property SHADOW_CASTER, than shadow buffer is "mixed" with shadow of that layer and propagated further until it reach layer with SHADOW_CASTER property turned off where it blends to rendered "surface" of that layer. So materials with marked SHADOW_RECEIVER property without SHADOW_CAST property will blend that shadow buffer from "above" layers into its surface buffer (which can change opacity (alpha) of that layer at those places where shadow is received). However, if SHADOW_CAST is also turned ON at such a layer, than whole shadow buffer is propagated further and actual transparency of surface of that layer is not altered by shadow.

@mhaberler
Copy link
Contributor

mhaberler commented Nov 28, 2023

observer: I have a question on "directionality" (for the lack of a better term and before I try it out):

for example, lv_slider_bind_value would set the corresponding subject based on slider position
so that is the "slider -> subject" direction

what about the other direction -"subject -> slider"?

would not make it sense to change the slider position if the subject's value changed "externally" (eg set in application code)?

if that were the case, the subject would be the only link between UI and application
for some widgets bidirectional tracking might make sense, e.g. checkbox

disclaimer: I might be missing something fundamental - total LVGL noob here

@kisvegabor
Copy link
Member Author

@mhaberler It's bidirectional and should work in both ways. If change the slider the subject will be updated. If the subject is updated the slider will be updated too.

@djixon
I also find this idea very interested but please open a new issue for it.

@mhaberler
Copy link
Contributor

mhaberler commented Nov 28, 2023

@kisvegabor that seriously rocks ;)
next time I try it before posting

edit: read the code. two callbacks involved..

@kisvegabor
Copy link
Member Author

No worries, I have already used the observer in a few project but it's not community approved yet. 🙂
So all feedback is very welcome. If it wasn't obvious for you it won't be for others either and it shows that the docs and comments needs to be improved.

@mhaberler
Copy link
Contributor

observer and animations:

what would be the suggested way to run an animation on subject change?

a combination of lv_obj_bind_state_if_eq and lv_objec_add_event like given here: https://docs.lvgl.io/master/overview/anim.html#start-animation-on-an-event ?

@kisvegabor
Copy link
Member Author

You can just the animation in an observer.

@kisvegabor
Copy link
Member Author

I've added the schedule for the last weeks of v9 to the roadmap:

Schedule

  • December 4: Feature stop, start updating the docs and testing
  • December 18: Release candidate version and call to test
  • January 15: Release v9.0

@mhaberler
Copy link
Contributor

observers: compass widget adapted to use a subject group for updates

https://www.youtube.com/watch?v=K5RPykaw1eU

@kisvegabor
Copy link
Member Author

@mhaberler Very nice! It seems you have used style_rotation as well. 🙂

@mhaberler
Copy link
Contributor

mhaberler commented Nov 29, 2023

it’s just the compass widget from https://github.com/bareboat-necessities/bbn-m5stack-tough.git mutated to use observers: https://github.com/mhaberler/arduino3-playground/blob/lvgl8-observer/test-ui/custom/ui_compass.c

it needs polishing (like disable updates when hidden) but works

the nice part is: this is completely standalone, no dependencies on specific methods of retrieving values like in the original: https://github.com/bareboat-necessities/bbn-m5stack-tough/blob/main/bbn_m5tough_active_boat/ui_compass.h#L136-L155

so it should be a drop-in: add, instantiate, set subject, done!

btw I found observing a subject which accidentally was not initialized produces a hang - maybe there’s a cheap test for the subject beint uninitialized and fail with a message?

@kisvegabor
Copy link
Member Author

btw I found observing a subject which accidentally was not initialized produces a hang - maybe there’s a cheap test for the subject beint uninitialized and fail with a message?

We could easily check subject->type != LV_SUBJECT_TYPE_NONE, however earlier you have manually set the type to NONE. What do you think?

@mhaberler
Copy link
Contributor

I would add LV_SUBJECT_TYPE_INVALID as zero, and make LV_SUBJECT_TYPE_NONE > 0

@kisvegabor
Copy link
Member Author

Makes sense! Would you be interested in sending a PR with this update?

@mhaberler
Copy link
Contributor

yes will do

@kisvegabor kisvegabor mentioned this issue Dec 4, 2023
22 tasks
@kisvegabor kisvegabor unpinned this issue Dec 4, 2023
@kisvegabor
Copy link
Member Author

I close this issue in favor of #4926

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pinned Not closed automatically
Projects
None yet
Development

No branches or pull requests