# lv_draw_private.h (/api/draw/lv_draw_private_h)



<RelatedHeaders name="lv_draw.h" isPrivate="true" />

<ApiSummary structs="4" />

Structs [#structs]

<ApiMember kind="struct" name="_lv_draw_task_t">
  \_lv_draw_task_t [#_lv_draw_task_t]

  Modified by NXP in 2024

  | Member                   | Type                                                         | Description                                                                                                                                                                                                                                                                                                 |
  | ------------------------ | ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | `next`                   | <ApiLink name="lv_draw_task_t" display="lv_draw_task_t *" /> |                                                                                                                                                                                                                                                                                                             |
  | `type`                   | <ApiLink name="lv_draw_task_type_t" />                       |                                                                                                                                                                                                                                                                                                             |
  | `area`                   | <ApiLink name="lv_area_t" />                                 | The area where to draw                                                                                                                                                                                                                                                                                      |
  | `_real_area`             | <ApiLink name="lv_area_t" />                                 | The real draw area. E.g. for shadow, outline, or transformed images it's different from `area`                                                                                                                                                                                                              |
  | `clip_area_original`     | <ApiLink name="lv_area_t" />                                 | The original area which is updated                                                                                                                                                                                                                                                                          |
  | `clip_area`              | <ApiLink name="lv_area_t" />                                 | The clip area of the layer is saved here when the draw task is created. As the clip area of the layer can be changed as new draw tasks are added its current value needs to be saved. Therefore during drawing the layer's clip area shouldn't be used as it might be already changed for other draw tasks. |
  | `target_layer`           | <ApiLink name="lv_layer_t" display="lv_layer_t *" />         |                                                                                                                                                                                                                                                                                                             |
  | `draw_unit`              | <ApiLink name="lv_draw_unit_t" display="lv_draw_unit_t *" /> |                                                                                                                                                                                                                                                                                                             |
  | `state`                  | `volatile int`                                               |                                                                                                                                                                                                                                                                                                             |
  | `draw_dsc`               | `void *`                                                     | int instead of lv\_draw\_task\_state\_t to be sure its atomic                                                                                                                                                                                                                                               |
  | `opa`                    | <ApiLink name="lv_opa_t" />                                  | Opacity of the layer                                                                                                                                                                                                                                                                                        |
  | `preferred_draw_unit_id` | <ApiLink name="uint8_t" />                                   | The ID of the draw\_unit which should take this task                                                                                                                                                                                                                                                        |
  | `preference_score`       | <ApiLink name="uint8_t" />                                   | Set to which extent `preferred_draw_unit_id` is good at this task. 80: means 20% better (faster) than software rendering 100: the default value 110: means 10% worse (slower) than software rendering                                                                                                       |
</ApiMember>

<ApiMember kind="struct" name="_lv_draw_mask_t">
  \_lv_draw_mask_t [#_lv_draw_mask_t]

  | Member      | Type     | Description |
  | ----------- | -------- | ----------- |
  | `user_data` | `void *` |             |
</ApiMember>

<ApiMember kind="struct" name="_lv_draw_unit_t">
  \_lv_draw_unit_t [#_lv_draw_unit_t]

  | Member               | Type                                                          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
  | -------------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | `next`               | <ApiLink name="lv_draw_unit_t" display="lv_draw_unit_t *" />  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
  | `name`               | `const char *`                                                | Name and ID of the draw unit, for debugging purposes only.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
  | `idx`                | <ApiLink name="int32_t" />                                    |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
  | `dispatch_cb`        | `int32_t(*)(lv_draw_unit_t *draw_unit, lv_layer_t *layer)`    | Called to try to assign a draw task to itself. `lv_draw_get_next_available_task` can be used to get an independent draw task. A draw task should be assign only if the draw unit can draw it too                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
  | `evaluate_cb`        | `int32_t(*)(lv_draw_unit_t *draw_unit, lv_draw_task_t *task)` |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
  | `wait_for_finish_cb` | `int32_t(*)(lv_draw_unit_t *draw_unit)`                       | Called to signal the unit to complete all tasks in order to return their ready status. This callback can be implemented in case of asynchronous task processing. Below is an example to show the difference between synchronous and asynchronous:<br /><br />Synchronous: LVGL thread DRAW thread HW<br /><br />task1 --> submit --> Receive task1 wait\_for\_finish() \<– task1->state = READY \<– Complete task1 task2 --> submit --> Receive task2 wait\_for\_finish() task2->state = READY \<– Complete task2 task3 --> submit --> Receive task3 wait\_for\_finish() \<– task3->state = READY \<– Complete task3 task4 --> submit --> Receive task4 wait\_for\_finish() \<– task4->state = READY \<– Complete task4 NO MORE TASKS<br /><br />Asynchronous: LVGL thread DRAW thread HW is IDLE task1 --> queue task1 submit --> Receive task1 task2 --> queue task2 is BUSY (with task1) task3 --> queue task3 still BUSY (with task1) task4 --> queue task4 becomes IDLE \<– task1->state = READY \<– Complete task1 submit --> Receive task2, task3, task4 NO MORE TASKS wait\_for\_finish\_cb() wait\_for\_finish() \<– Complete task2, task3, task4 \<– task2->state = READY \<– \<– task3->state = READY \<– \<– task4->state = READY \<– |
  | `delete_cb`          | `int32_t(*)(lv_draw_unit_t *draw_unit)`                       | Called to delete draw unit.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
  | `event_cb`           | `void(*)(lv_event_t *event)`                                  | Called when an event is sent to the draw unit.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
</ApiMember>

<ApiMember kind="struct" name="lv_draw_global_info_t">
  lv_draw_global_info_t [#lv_draw_global_info_t]

  | Member                   | Type                                                         | Description |
  | ------------------------ | ------------------------------------------------------------ | ----------- |
  | `unit_head`              | <ApiLink name="lv_draw_unit_t" display="lv_draw_unit_t *" /> |             |
  | `unit_cnt`               | <ApiLink name="uint32_t" />                                  |             |
  | `used_memory_for_layers` | <ApiLink name="uint32_t" />                                  |             |
  | `sync`                   | `lv_thread_sync_t`                                           |             |
  | `circle_cache_mutex`     | `lv_mutex_t`                                                 |             |
  | `task_running`           | <ApiLink name="bool" />                                      |             |
</ApiMember>

Dependencies [#dependencies]

<FileIncludes includes="[&#x22;lv_draw.h&#x22;, &#x22;lv_os_private.h&#x22;, &#x22;lv_cache.h&#x22;]" includedBy="[&#x22;lv_global.h&#x22;, &#x22;lv_draw_dma2d_private.h&#x22;, &#x22;lv_draw_ppa.h&#x22;, &#x22;lv_draw_ppa_private.h&#x22;, &#x22;lv_draw_eve_private.h&#x22;, &#x22;lv_draw_nanovg_private.h&#x22;, &#x22;lv_draw_nema_gfx.h&#x22;, &#x22;lv_draw_pxp.h&#x22;, &#x22;lv_draw_dave2d.h&#x22;, &#x22;lv_draw_sw_arm2d.h&#x22;, &#x22;lv_draw_sw_private.h&#x22;, &#x22;lv_draw_vg_lite_type.h&#x22;]" transitiveIncludes="[&#x22;lv_anim.h&#x22;, &#x22;lv_area.h&#x22;, &#x22;lv_array.h&#x22;, &#x22;lv_assert.h&#x22;, &#x22;lv_bidi.h&#x22;, &#x22;lv_cache_class.h&#x22;, &#x22;lv_cache_entry.h&#x22;, &#x22;lv_cache_instance.h&#x22;, &#x22;lv_cache_lru_ll.h&#x22;, &#x22;lv_cache_lru_rb.h&#x22;, &#x22;lv_cache_private.h&#x22;, &#x22;lv_cache_sc_da.h&#x22;, &#x22;lv_color.h&#x22;, &#x22;lv_color_op.h&#x22;, &#x22;lv_conf_internal.h&#x22;, &#x22;lv_conf_kconfig.h&#x22;, &#x22;lv_draw_buf.h&#x22;, &#x22;lv_event.h&#x22;, &#x22;lv_ext_data.h&#x22;, &#x22;lv_flex.h&#x22;, &#x22;lv_font.h&#x22;, &#x22;lv_fs.h&#x22;, &#x22;lv_grad.h&#x22;, &#x22;lv_grid.h&#x22;, &#x22;lv_image_cache.h&#x22;, &#x22;lv_image_decoder.h&#x22;, &#x22;lv_image_dsc.h&#x22;, &#x22;lv_image_header_cache.h&#x22;, &#x22;lv_layout.h&#x22;, &#x22;lv_ll.h&#x22;, &#x22;lv_log.h&#x22;, &#x22;lv_math.h&#x22;, &#x22;lv_matrix.h&#x22;, &#x22;lv_mem.h&#x22;, &#x22;lv_os.h&#x22;, &#x22;lv_palette.h&#x22;, &#x22;lv_profiler.h&#x22;, &#x22;lv_profiler_builtin.h&#x22;, &#x22;lv_pthread.h&#x22;, &#x22;lv_sprintf.h&#x22;, &#x22;lv_string.h&#x22;, &#x22;lv_style.h&#x22;, &#x22;lv_style_gen.h&#x22;, &#x22;lv_symbol_def.h&#x22;, &#x22;lv_text.h&#x22;, &#x22;lv_tick.h&#x22;, &#x22;lv_timer.h&#x22;, &#x22;lv_types.h&#x22;]" />
