Uh oh!
There was an error while loading. Please reload this page.
Continuous framebuffer refresh: display new frames as they arrive on stdin - #13
Conversation
1c0edd6 to
b856deaCompare6bffe8e to
f701031CompareThere was a problem hiding this comment.
Pull request overview
This PR updates drm-framebuffer to support continuously reading frames from stdin and updating the display as each full frame arrives, and documents how to stream multiple frames and generate .fb files.
Changes:
- Refactors display logic into a helper and adds a
select()+signalfd()driven loop to read and display multiple frames fromstdin. - Updates README with a “Streaming multiple frames” example and an ImageMagick command for producing BGRA
.fbfiles.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| README.md | Documents multi-frame streaming usage and ImageMagick conversion to .fb. |
| main.c | Implements continuous frame ingestion from stdin and signal-driven termination. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Instead of blocking with sigwait() after displaying the first frame, use signalfd() + select() to simultaneously monitor: - stdin for new frame data - SIGINT/SIGTERM for clean shutdown When a new complete frame is received on stdin it is immediately displayed. When stdin reaches EOF the last frame stays on screen and the program continues waiting for a signal. SIGINT or SIGTERM still causes a clean exit (restoring the original CRTC state). The display logic is extracted into a separate display_framebuffer() helper to avoid duplication. Co-authored-by: Stefan Eichenberger <eichest@gmail.com>
Co-authored-by: Stefan Eichenberger <eichest@gmail.com>
…andle pitch The inner read loop used `dumb_framebuffer.size` as the number of bytes to collect before displaying a frame. The kernel's DRM_IOCTL_MODE_CREATE_DUMB may align the pitch (row stride) beyond `width * bpp/8`, making `size` (`= pitch * height`) larger than the packed pixel data users actually supply. The code would therefore block waiting for phantom padding bytes until more data arrived, causing the "need 2 KB extra" symptom. Fix: - Compute `row_stride = width * bpp/8` (packed bytes per row). - Compute `image_size = row_stride * height` (bytes the user provides). - Read row-by-row: each `read()` targets at most the remaining bytes in the current row, written to `fb->data + row * pitch + col`. This places every row at the correct pitched offset in the mapped buffer, fixing the silent display corruption that would occur when pitch > row_stride. - Stop after `image_size` bytes, so a complete frame is displayed as soon as the last pixel byte arrives, with no extra data needed. Co-authored-by: Stefan Eichenberger <eichest@gmail.com>
01577c0 to
8b048b6CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.