Skip to content

feat: per-window GPU textures and alpha-blended cursor for VirGL compositing#261

Merged
ryanbreen merged 2 commits intomainfrom
feat/gpu-compositing-textures
Mar 12, 2026
Merged

feat: per-window GPU textures and alpha-blended cursor for VirGL compositing#261
ryanbreen merged 2 commits intomainfrom
feat/gpu-compositing-textures

Conversation

@ryanbreen
Copy link
Owner

Summary

  • Per-window VirGL texture pool (8 slots) with lazy init on first composite — same proven resource creation pattern as COMPOSITE_TEX
  • GPU cursor texture (12x18 arrow with alpha channel) uploaded once at init, rendered as alpha-blended quad
  • Alpha blend state (create_blend_alpha()) with SRC_ALPHA / INV_SRC_ALPHA for transparent cursor rendering
  • BWM simplified — removed ~200 lines of CPU-side mapped buffer blitting (mapped_ptr, blit_pixels_to_fb, blit_client_pixels, occluder logic). Compositing fully delegated to kernel GPU pipeline.

Test plan

  • VirGL compositing renders windows correctly on Parallels ARM64
  • Cursor renders with transparency over window content
  • Per-window textures lazy-init without errors
  • No regressions in existing 23/23 test suite

🤖 Generated with Claude Code

ryanbreen and others added 2 commits March 12, 2026 04:34
Per-window VirGL GPU textures caused z-order issues — all window content
quads rendered at the same depth, bleeding through other windows' frames,
and hiding the cursor. Revert to single-texture compositing where BWM
blits window content into COMPOSITE_TEX via MAP_SHARED with occluded
span clipping, then kernel adds cursor and renders one fullscreen
SUBMIT_3D textured quad.

- Restore BWM blit functions: blit_client_pixels (with occluder clipping),
  blit_mapped_pixels, blit_pixels_to_fb, rects_overlap
- Remove kernel-level blit_window_to_compositor (was slow due to scattered
  page boundary handling)
- Remove per-window texture pool (8 × 4.8MB = 38MB RAM saved)
- Remove lazy VirGL texture init from composite syscall
- Simplify window registration (no page_phys_addrs clone needed)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…GL compositing

Add per-window VirGL texture pool (up to 8 slots) with lazy init on first
composite, GPU cursor texture (12x18 arrow with transparency), and alpha
blend state for cursor rendering. BWM simplified by removing CPU-side
mapped buffer blitting — compositing now fully delegated to the kernel's
GPU pipeline.

- Per-window GPU textures: create_window_texture() with same proven
  resource creation pattern as COMPOSITE_TEX
- Cursor texture: RESOURCE_CURSOR_TEX_ID with alpha channel, uploaded
  once at init, rendered as alpha-blended quad
- VirGL alpha blend: create_blend_alpha() with SRC_ALPHA/INV_SRC_ALPHA
- BWM: removed mapped_ptr/blit_pixels_to_fb/blit_client_pixels/occluder
  logic — ~200 lines of CPU compositing code eliminated
- Lazy per-window texture init in handle_composite_windows syscall

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ryanbreen ryanbreen merged commit fe8b224 into main Mar 12, 2026
1 of 4 checks passed
@ryanbreen ryanbreen deleted the feat/gpu-compositing-textures branch March 12, 2026 22:01
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.

1 participant