79 lines
2.5 KiB
Diff
79 lines
2.5 KiB
Diff
From d4c7c547c1c3ea36c08a5decf6b9d68ce4739044 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Nicu=C8=99or=20C=C3=AE=C8=9Bu?= <nicusor.citu@nxp.com>
|
|
Date: Wed, 1 Nov 2023 10:57:34 +0200
|
|
Subject: [PATCH 2/2] feat(draw_unit) Add unit_count to figure out if other
|
|
units are available.
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com>
|
|
---
|
|
src/draw/lv_draw.c | 1 +
|
|
src/draw/lv_draw.h | 1 +
|
|
src/draw/nxp/vglite/lv_draw_vglite.c | 10 ++++++++--
|
|
3 files changed, 10 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/draw/lv_draw.c b/src/draw/lv_draw.c
|
|
index c84816c91..0f6f85bbf 100644
|
|
--- a/src/draw/lv_draw.c
|
|
+++ b/src/draw/lv_draw.c
|
|
@@ -57,6 +57,7 @@ void * lv_draw_create_unit(size_t size)
|
|
|
|
new_unit->next = _draw_info.unit_head;
|
|
_draw_info.unit_head = new_unit;
|
|
+ _draw_info.unit_count++;
|
|
|
|
return new_unit;
|
|
}
|
|
diff --git a/src/draw/lv_draw.h b/src/draw/lv_draw.h
|
|
index 6eb99e71a..497a444be 100644
|
|
--- a/src/draw/lv_draw.h
|
|
+++ b/src/draw/lv_draw.h
|
|
@@ -174,6 +174,7 @@ typedef struct {
|
|
|
|
typedef struct {
|
|
lv_draw_unit_t * unit_head;
|
|
+ uint32_t unit_count;
|
|
uint32_t used_memory_for_layers_kb;
|
|
#if LV_USE_OS
|
|
lv_thread_sync_t sync;
|
|
diff --git a/src/draw/nxp/vglite/lv_draw_vglite.c b/src/draw/nxp/vglite/lv_draw_vglite.c
|
|
index 3278bb548..fe2fd8179 100644
|
|
--- a/src/draw/nxp/vglite/lv_draw_vglite.c
|
|
+++ b/src/draw/nxp/vglite/lv_draw_vglite.c
|
|
@@ -20,12 +20,15 @@
|
|
#include "lv_vglite_buf.h"
|
|
#include "lv_vglite_utils.h"
|
|
|
|
+#include "../../../core/lv_global.h"
|
|
#include "../../../display/lv_display_private.h"
|
|
|
|
/*********************
|
|
* DEFINES
|
|
*********************/
|
|
|
|
+#define _draw_info LV_GLOBAL_DEFAULT()->draw_info
|
|
+
|
|
#define DRAW_UNIT_ID_VGLITE 2
|
|
|
|
#if LV_USE_OS
|
|
@@ -237,9 +240,12 @@ static int32_t _vglite_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * layer)
|
|
/* Try to get an ready to draw. */
|
|
lv_draw_task_t * t = lv_draw_get_next_available_task(layer, NULL, DRAW_UNIT_ID_VGLITE);
|
|
|
|
- /* Return 0 is no selection, some tasks can be supported by other units. */
|
|
+ /* If no selection:
|
|
+ * return 0 if any other unit is available and might support the task
|
|
+ * return -1 if no more units
|
|
+ */
|
|
if(t == NULL || t->preferred_draw_unit_id != DRAW_UNIT_ID_VGLITE)
|
|
- return 0;
|
|
+ return (_draw_info.unit_count > 1 ? 0 : -1);
|
|
|
|
void * buf = lv_draw_layer_alloc_buf(layer);
|
|
if(buf == NULL)
|
|
--
|
|
2.25.1
|
|
|