Commit 3d2b7f2
feat(linux/kms): scale captured plane to output size when hardware-scaled
Replaces the clamp-and-crop fix from 14a6f2a with the real fix: when
the display controller is hardware-scaling a plane at scanout (its
CRTC destination rect differs from the plane's native buffer size --
e.g. a game's native-resolution exclusive-fullscreen swapchain
stretched to fill a higher-resolution output), kmsgrab's raw DMA-BUF
import bypasses that scaler entirely and only ever sees the pre-scale
buffer. Reproduce the same upscale with a linear-filtered
glBlitFramebuffer into a scratch texture sized to the configured
capture resolution, before the existing GetTextureSubImage readback,
so the captured frame matches what the display actually shows instead
of being cropped to the plane's native corner.
The scratch texture/FBOs are lazily created on first use and reused
across frames; the common case (plane already fills the output, no
scaling needed) is unaffected and takes the same path as before.
Untested against real hardware in this session -- built by
cross-referencing this project's own glad config (gl:compatibility=4.6,
confirming BlitFramebuffer/GL_READ_FRAMEBUFFER/GL_DRAW_FRAMEBUFFER are
generated) and the existing FBO helper patterns already used elsewhere
in this file, but needs a live test to confirm the blit against an
EGLImage-backed source texture behaves as expected on this driver.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent 14a6f2a commit 3d2b7f2
1 file changed
Lines changed: 53 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1703 | 1703 | | |
1704 | 1704 | | |
1705 | 1705 | | |
1706 | | - | |
1707 | | - | |
1708 | | - | |
1709 | | - | |
1710 | | - | |
1711 | | - | |
1712 | | - | |
1713 | | - | |
1714 | | - | |
1715 | | - | |
1716 | | - | |
1717 | | - | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
1718 | 1744 | | |
1719 | | - | |
| 1745 | + | |
1720 | 1746 | | |
1721 | | - | |
1722 | | - | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
1723 | 1750 | | |
1724 | 1751 | | |
| 1752 | + | |
| 1753 | + | |
1725 | 1754 | | |
1726 | 1755 | | |
1727 | 1756 | | |
| |||
1761 | 1790 | | |
1762 | 1791 | | |
1763 | 1792 | | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
1764 | 1802 | | |
1765 | 1803 | | |
1766 | 1804 | | |
| |||
0 commit comments