incubator-nuttx/include/nuttx/lcd
Tiago Medicci Serrano ab60d0d3fb Framebuffer's callback buffer starts from the area being drawn.
The commit 664d45dcba updated the
behavior of the framebuffer's putarea callback enabling it to be
used to draw a particular area of the display. Previously, putarea
was only used to draw the entire area of the display. Any different
area was drawn, row by row, by putrun. Also, before checking for
which callback to call, the framebuffer driver adjusted the buffer
reference that was going to be used for calling the driver's callback
to point to the init of the relevant data. After that commit, the
framebuffer's buffer reference passed to the driver's putarea now
contains the data to draw the entire display. Unlike the previous
version of that implementation, only the putrun's callback buffer
was being referenced from the address that contains the data that
actually is being drawn.

This commit fixes it by adjusting the reference for the run buffer
passed to the putrun/putarea callback. It always starts from the
beginning of the relevant data that is actually being drawn. That is
necessary because lcddev (which uses the same LCD display driver
callbacks) actually don't allocate a buffer containing the data to
draw the whole display, so the same putarea implementation of the
LCD drivers would'n be able to work for both lcddev and framebuffer.
Also it's necessary to pass the stride argument to the LCD drivers
in order to enable them to do partial writes by calculating the
buffer offset while sending row-by-row. The stride is equal the
width multiplied by the bytes per pixel (may add some padding)
for framebuffer and is equal to the lenght of the row being drawn
(multiplied by the same BPP) for lcddev.

Why this approach?
Other possible approaches would be:
1) modify lcddev driver to translate received buffer data to a
buffer similar to the framebuffer. That wouldn't be efficient
considering memory allocation.
2) Create a new callback function. While possible, it'd be confusing
to create a different callback to draw the whole screen and another
to draw only an area of the screen. Also, these callbacks would
differ themselves only from the way the buffer is filled.
3) Simply reverting 664d45dcba would
break the usage of the putarea callback to draw an area of the
display, which would also be inefficient.

This approach is based on the Zephyr's implementation of the ST7789
driver: the buffer starts from the beginiing of the region that would
be drawn. The display device driver's putarea implementation should
check if the operation refers to a full screen/full row and implement
(if possible) a single operation to send the data to be drawn more
efficiently.

Finally, this approach requires that the drivers which implement
the putarea callback and expects the entire framebuffer buffer
to be modified. They don't need to calculate where the data begins
as the new buffer represents the data from the address that is
actually being drawn. This includes adjusting the LCD drivers
GC9A01 and ST7789 and the driver for APA102-based LED matrix display.
2022-08-13 20:36:45 +08:00
..
apa102.h drivers/lcd: Add support to use APA102 LED Matrix as LCD Display 2022-07-19 18:50:04 +03:00
ft80x.h include: nuttx: update licenses to Apache 2.0 2021-02-01 11:21:57 -03:00
gc9a01.h include: fix double include pre-processor guards 2022-01-16 11:11:14 -03:00
hd4478ou.h include: fix double include pre-processor guards 2022-01-16 11:11:14 -03:00
ht16k33.h include: fix double include pre-processor guards 2022-01-16 11:11:14 -03:00
ili9225.h Fix various typos 2021-07-25 18:36:53 -07:00
ili9325.h include: nuttx: update licenses to Apache 2.0 2021-02-01 11:21:57 -03:00
ili9340.h NuttX: Marco Krahl: update licenses to Apache 2021-04-06 12:50:41 -05:00
ili9341.h NuttX: Marco Krahl: update licenses to Apache 2021-04-06 12:50:41 -05:00
ili9488.h include: nuttx: lcd: nxstyle fixes 2021-01-26 05:11:58 -08:00
lcd.h Framebuffer's callback buffer starts from the area being drawn. 2022-08-13 20:36:45 +08:00
lcd_dev.h include: fix double include pre-processor guards 2022-01-16 11:11:14 -03:00
lcd_ioctl.h include: nuttx: update licenses to Apache 2.0 2021-02-01 11:21:57 -03:00
lcddrv_spiif.h include: update licenses to Apache 2021-05-27 08:07:25 +09:00
lpm013m091a.h include: nuttx: lcd: nxstyle fixes 2021-01-26 05:11:58 -08:00
max7219.h include: Author: Alan Carvalho de Assis: update licenses to Apache 2.0 2021-02-04 03:33:58 -08:00
memlcd.h include: fix double include pre-processor guards 2022-01-16 11:11:14 -03:00
mio283qt2.h include: nuttx: fix nxstyle errors 2021-02-04 03:33:58 -08:00
mio283qt9a.h Add lcd_dev_s pointer to lcd_planeinfo_s 2022-06-21 21:33:23 +08:00
p14201.h include: fix double include pre-processor guards 2022-01-16 11:11:14 -03:00
pcd8544.h include: fix double include pre-processor guards 2022-01-16 11:11:14 -03:00
pcf8574_lcd_backpack.h include: update licenses to Apache 2021-05-27 08:07:25 +09:00
ra8875.h include: nuttx: fix nxstyle errors 2021-02-04 03:33:58 -08:00
slcd_codec.h Rename LIB_ to LIBC_ for all libc Kconfig 2021-08-05 19:45:24 +02:00
slcd_ioctl.h include: nuttx: update licenses to Apache 2.0 2021-02-01 11:21:57 -03:00
ssd1289.h include: nuttx: fix nxstyle errors 2021-02-04 03:33:58 -08:00
ssd1306.h include: fix double include pre-processor guards 2022-01-16 11:11:14 -03:00
ssd1351.h include: Omni Hoverboards: update licenses to Apache 2021-09-28 04:37:38 -07:00
ssd1680.h e-ink ssd1680 driver 2022-06-10 22:19:29 +08:00
st7032.h include: fix double include pre-processor guards 2022-01-16 11:11:14 -03:00
st7565.h include: fix double include pre-processor guards 2022-01-16 11:11:14 -03:00
st7567.h include: fix double include pre-processor guards 2022-01-16 11:11:14 -03:00
st7735.h include: fix double include pre-processor guards 2022-01-16 11:11:14 -03:00
st7789.h include: fix double include pre-processor guards 2022-01-16 11:11:14 -03:00
tda19988.h sourcefiles: Fix relative path in file header 2021-03-09 23:18:28 +08:00
ug-2864ambag01.h include: fix double include pre-processor guards 2022-01-16 11:11:14 -03:00
ug-9664hswag01.h include: fix double include pre-processor guards 2022-01-16 11:11:14 -03:00