Skip to content

Commit

Permalink
fb: cfb: Introducing a command structure for framebuffer operations
Browse files Browse the repository at this point in the history
Store operations for the frame buffer as commands,
Change to a method that draws at once and transfers at finalize.

Commands are managed in a linked list and processed at the finalization.
The behavior of drawing APIs does not change.
It's just that the timing at which drawing is done to memory
is internally delayed a little.

Typical usage stores command in the buffer.
The behavior of existing drawing APIs has been changed to store
commands in this buffer.
For this reason, an argument for buffer specification is added to
the initialization function cfb_display_init.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
  • Loading branch information
soburi committed May 2, 2024
1 parent ee6a960 commit 01537cb
Show file tree
Hide file tree
Showing 12 changed files with 1,212 additions and 196 deletions.
781 changes: 714 additions & 67 deletions include/zephyr/display/cfb.h

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions samples/subsys/display/cfb/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ config CFB_SAMPLE_TRANSFER_BUFFER_SIZE
help
Dynamically allocate display object if set 0 to this option,

config CFB_SAMPLE_COMMAND_BUFFER_SIZE
int "Buffer size for store commands"
default 0

source "Kconfig.zephyr"
3 changes: 3 additions & 0 deletions samples/subsys/display/cfb/boards/longan_nano.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CONFIG_HEAP_MEM_POOL_SIZE=4096
CONFIG_CFB_SAMPLE_TRANSFER_BUFFER_SIZE=6400
CONFIG_CFB_SAMPLE_COMMAND_BUFFER_SIZE=128
3 changes: 3 additions & 0 deletions samples/subsys/display/cfb/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#if CONFIG_CFB_SAMPLE_TRANSFER_BUFFER_SIZE != 0
static uint8_t transfer_buffer[CONFIG_CFB_SAMPLE_TRANSFER_BUFFER_SIZE];
static uint8_t command_buffer[CONFIG_CFB_SAMPLE_COMMAND_BUFFER_SIZE];
#endif

int main(void)
Expand All @@ -30,6 +31,8 @@ int main(void)
.dev = dev,
.transfer_buf = transfer_buffer,
.transfer_buf_size = sizeof(transfer_buffer),
.command_buf = command_buffer,
.command_buf_size = sizeof(transfer_buffer),
};
#endif

Expand Down
4 changes: 4 additions & 0 deletions samples/subsys/display/cfb_custom_font/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ config CFB_CUSTOM_FONT_SAMPLE_TRANSFER_BUFFER_SIZE
int "Buffer size for image transfer"
default 0

config CFB_CUSTOM_FONT_SAMPLE_COMMAND_BUFFER_SIZE
int "Buffer size for store commands"
default 0

source "Kconfig.zephyr"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CONFIG_HEAP_MEM_POOL_SIZE=4096
CONFIG_CFB_SAMPLE_TRANSFER_BUFFER_SIZE=6400
CONFIG_CFB_SAMPLE_COMMAND_BUFFER_SIZE=128
3 changes: 3 additions & 0 deletions samples/subsys/display/cfb_custom_font/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#if CONFIG_CFB_CUSTOM_FONT_SAMPLE_TRANSFER_BUFFER_SIZE != 0
static uint8_t transfer_buffer[CONFIG_CFB_CUSTOM_FONT_SAMPLE_TRANSFER_BUFFER_SIZE];
static uint8_t command_buffer[CONFIG_CFB_CUSTOM_FONT_SAMPLE_COMMAND_BUFFER_SIZE];
#endif

int main(void)
Expand All @@ -27,6 +28,8 @@ int main(void)
.dev = dev,
.transfer_buf = transfer_buffer,
.transfer_buf_size = sizeof(transfer_buffer),
.command_buf = command_buffer,
.command_buf_size = sizeof(command_buffer),
};
#endif

Expand Down
3 changes: 3 additions & 0 deletions samples/subsys/display/cfb_shell/boards/longan_nano.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CONFIG_HEAP_MEM_POOL_SIZE=4096
CONFIG_CFB_SAMPLE_TRANSFER_BUFFER_SIZE=6400
CONFIG_CFB_SAMPLE_COMMAND_BUFFER_SIZE=128
Loading

0 comments on commit 01537cb

Please sign in to comment.