Skip to content

Conversation

@jserv
Copy link
Contributor

@jserv jserv commented Oct 19, 2025

This fixes critical bugs in the Linux framebuffer backend:

  1. BPP crash prevention
  • Return false instead of break for unsupported bits per pixel
  • Prevents array out-of-bounds access in put_span table
  1. Damage callback logic
  • Fix inverted condition that prevented screen updates
  • !tx->vt_active && MAP_FAILED → tx->vt_active && != MAP_FAILED
  • Enables all rendering when VT is active
  1. VT restoration in error path
  • Restore VT mode before closing fd on init failure
  • Prevents blank TTY after failed initialization
  1. Poll function registration (lines 350-353, 376)
  • Add twin_fbdev_poll() stub for dispatch compatibility

Tested-on: lima ARM64 Linux (virtio_gpudrmfb 1280x800@32bpp)


Summary by cubic

Fixes fbdev rendering and VT handling to prevent crashes and blank TTYs. Ensures screen updates when the VT is active and registers a no-op poll for dispatcher compatibility.

  • Bug Fixes
    • Return false for unsupported bpp to avoid out-of-bounds writes.
    • Fix damage check to update only when VT is active and framebuffer is mapped.
    • Restore VT mode on init failure and on exit to prevent a blank TTY.
    • Add and register twin_fbdev_poll() to keep the main loop running.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="backend/fbdev.c">

<violation number="1" location="backend/fbdev.c:192">
This condition is still inverted: tx-&gt;vt_active becomes true when the VT is inactive (see linux_vt.h), so the draw loop never runs and the screen stays stale.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

This fixes critical bugs in the Linux framebuffer backend:
1. BPP crash prevention
  - Return false instead of break for unsupported bits per pixel
  - Prevents array out-of-bounds access in put_span table
2. Damage callback logic
  - Fix inverted condition that prevented screen updates
  - !tx->vt_active && MAP_FAILED → tx->vt_active && != MAP_FAILED
  - Enables all rendering when VT is active
3. VT restoration in error path
 - Restore VT mode before closing fd on init failure
 - Prevents blank TTY after failed initialization
4. Poll function registration (lines 350-353, 376)
 - Add twin_fbdev_poll() stub for dispatch compatibility

Tested-on: lima ARM64 Linux (virtio_gpudrmfb 1280x800@32bpp)
@jserv jserv merged commit 16193dc into main Oct 19, 2025
8 checks passed
@jserv jserv deleted the fix-fbdev branch October 19, 2025 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants