You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "JianyuWang0623 (via GitHub)" <gi...@apache.org> on 2026/04/03 03:06:31 UTC
[PR] graphics/nxglib: use putarea for lcd copyrectangle when available [nuttx]
JianyuWang0623 opened a new pull request, #18667:
URL: https://github.com/apache/nuttx/pull/18667
## Summary
When `nxgl_copyrectangle` draws a bitmap onto an LCD via the NX graphics subsystem, it currently iterates row by row, calling `putrun()` for each scanline. Each `putrun()` call on a typical SPI LCD (e.g. ST7789) must send CASET + RASET commands to set the display window before sending pixel data, adding significant per-row overhead.
LCD drivers that implement the `putarea()` callback can accept an entire rectangular region in a single call, setting the display window once for the whole rectangle.
This change adds a fast path in `nxgl_copyrectangle`: when `NXGLIB_BITSPERPIXEL >= 8` and `pinfo->putarea` is non-NULL, delegate the entire copy to `putarea()` and return immediately, bypassing the per-row loop. For sub-byte pixel formats (< 8 bpp), the existing `putrun()` path with bit-alignment handling is preserved unchanged.
## Impact
- **Performance**: On an ESP32-S3 + ST7789 SPI LCD (40 MHz, 320x240 RGB565), full-screen `nx_bitmap()` draw time dropped from ~2210 ms to ~50 ms (~44x improvement) by eliminating 240 redundant CASET/RASET SPI transactions.
- **Compatibility**: No behavior change for LCD drivers that do not implement `putarea()` (the pointer is NULL, fallback to existing `putrun()` loop). No change for sub-byte pixel formats (1/2/4 bpp).
- **Build**: No new Kconfig options. No additional memory usage.
## Testing
**Host**: Ubuntu x86_64
**Board**: lckfb-szpi-esp32s3 (ESP32-S3-WROOM-1-N16R8)
**Display**: ST7789 320x240 SPI LCD (40 MHz, RGB565)
**Config**: `lckfb-szpi-esp32s3:camera`
Ran the `camera` example application in continuous preview mode (`camera 0`), which calls `nx_bitmap()` for every frame from a QVGA camera (320x240 RGB565):
```
nsh> camera 0
nximage_listener: Connected
nximage_initialize: Screen resolution (320,240)
Start video this mode is eternal. (Non stop, non save files.)
DQBUF 70ms draw 50ms QBUF 0ms
DQBUF 40ms draw 50ms QBUF 0ms
DQBUF 30ms draw 50ms QBUF 0ms
DQBUF 30ms draw 50ms QBUF 0ms
DQBUF 40ms draw 50ms QBUF 0ms
DQBUF 30ms draw 50ms QBUF 0ms
DQBUF 30ms draw 50ms QBUF 0ms
DQBUF 40ms draw 50ms QBUF 0ms
```
The `draw` column shows the time spent inside `nx_bitmap()` → `nxgl_copyrectangle` → `putarea`. Before this change, `draw` was ~2210 ms per frame; after, it is consistently ~50 ms.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] graphics/nxglib: use putarea for lcd copyrectangle when available [nuttx]
Posted by "lupyuen (via GitHub)" <gi...@apache.org>.
lupyuen commented on PR #18667:
URL: https://github.com/apache/nuttx/pull/18667#issuecomment-4182779066
@simbit18 Yep hopefully this will all go away when we roll out CI Build Retry. So far it looks promising, the CI Build Retry fixed some Download Problems recently:
OK after 4 attempts: libmetal.zip (OpenAMP)
https://github.com/NuttX/nuttx/actions/runs/23807439231/job/69384886722#step:10:522
OK after 2 attempts: llvmorg-17.0.6/libcxx-17.0.6.src.tar.xz
https://github.com/apache/nuttx/actions/runs/23934730717/job/69808952040#step:10:964
OK after 3 attempts: codeload.github.com (what is ESP32 downloading?)
https://github.com/apache/nuttx/actions/runs/23882896642/job/69641956931#step:10:911
OK after 2 attempts: nestlabs/nlunit-test
https://github.com/apache/nuttx/actions/runs/23934730717/job/69808952040#step:10:964
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] graphics/nxglib: use putarea for lcd copyrectangle when available [nuttx]
Posted by "simbit18 (via GitHub)" <gi...@apache.org>.
simbit18 commented on PR #18667:
URL: https://github.com/apache/nuttx/pull/18667#issuecomment-4183852627
All jobs have been completed, so the PR has been merged
There are 6 Linux processes (arm-13) stuck in an infinite loop
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] graphics/nxglib: use putarea for lcd copyrectangle when available [nuttx]
Posted by "simbit18 (via GitHub)" <gi...@apache.org>.
simbit18 commented on PR #18667:
URL: https://github.com/apache/nuttx/pull/18667#issuecomment-4182672845
Hi @lupyuen Take a look at what’s happening in this PR there are 7 Linux (arm-13)
https://github.com/apache/nuttx/actions/runs/23931941213/job/69824286526?pr=18667
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] graphics/nxglib: use putarea for lcd copyrectangle when available [nuttx]
Posted by "simbit18 (via GitHub)" <gi...@apache.org>.
simbit18 commented on PR #18667:
URL: https://github.com/apache/nuttx/pull/18667#issuecomment-4183375213
Hi @JianyuWang0623, is this PR ready?
A Linux job (arm-13) has completed successfully
Another 6 are stuck, so we need to force the merge
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] graphics/nxglib: use putarea for lcd copyrectangle when available [nuttx]
Posted by "simbit18 (via GitHub)" <gi...@apache.org>.
simbit18 commented on PR #18667:
URL: https://github.com/apache/nuttx/pull/18667#issuecomment-4182716706
> @simbit18 Yeah isn't this the same problem we saw 2 months ago? Looks like a bug in GitHub.
>
> https://github.com/apache/nuttx/actions/runs/21600990965/job/62279838438
@lupyuen Yes, perhaps this may happen when you restart the workflow using
“Re-run failed jobs” instead of “Re-run all jobs”
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] graphics/nxglib: use putarea for lcd copyrectangle when available [nuttx]
Posted by "lupyuen (via GitHub)" <gi...@apache.org>.
lupyuen commented on PR #18667:
URL: https://github.com/apache/nuttx/pull/18667#issuecomment-4182684069
@simbit18 Yeah isn't this the same problem we saw 2 months ago? Looks like a bug in GitHub.
https://github.com/apache/nuttx/actions/runs/21600990965/job/62279838438
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] graphics/nxglib: use putarea for lcd copyrectangle when available [nuttx]
Posted by "JianyuWang0623 (via GitHub)" <gi...@apache.org>.
JianyuWang0623 commented on PR #18667:
URL: https://github.com/apache/nuttx/pull/18667#issuecomment-4183791860
> Hi @JianyuWang0623, is this PR ready?
>
> A Linux job (arm-13) has completed successfully
>
> Another 6 are stuck, so we need to force the merge
@simbit18 This PR is ready for review. It has passed local testing and is currently waiting for CI results.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] graphics/nxglib: use putarea for lcd copyrectangle when available [nuttx]
Posted by "simbit18 (via GitHub)" <gi...@apache.org>.
simbit18 merged PR #18667:
URL: https://github.com/apache/nuttx/pull/18667
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org