Skip to content

drm: expose the connector TILE property#2034

Open
algesten wants to merge 1 commit into
Smithay:masterfrom
algesten:cosmic-5k-tile
Open

drm: expose the connector TILE property#2034
algesten wants to merge 1 commit into
Smithay:masterfrom
algesten:cosmic-5k-tile

Conversation

@algesten
Copy link
Copy Markdown

Disclosure: I have done this PR using Claude Code. Whilst I am well versed in Rust (I wrote ureq among other), I know very little about the graphics stack in Linux. I had Claude teach me what I need to know to fix my problem.

I use a LG UltraFine 5K that is about 8 years old and uses tiled DP 1.2 to render 5K. I just now installed PopOS/COSMIC and it doesn't drive my monitor correctly. The monitor is Thunderbolt only, and connected to a Maple Ridge PCIe card that in turn takes two DP cables from my NVIDIA card. I believe the problem is described here (pop-os/cosmic-comp#2295)

The monitor presents itself as two DP streams with two EDID. In the EDID there is a TILE property, which is available in drm, but currently not possible to read from Smithay.

This TILE property contains the necessary info to understand that it's a tiled situation and the DP streams should be rendered to as if two halves of the same screen.

The PR adds backend::drm::TileInfo and DrmDevice::tile_info(), along with the ASCII-blob parser for the kernel format. It is what is needed from Smithay.

I got the full thing working in cosmic-comp locally. group_id, positions (0,0) and (1,0) in a 2x1 grid, tile size 2560x2880.

The first generation of 5K monitors (LG UltraFine 5K, Dell UP2715K,
mid-2010s) couldn't fit 5120x2880@60 down a single DP 1.2 cable and
instead carry the image as two streams, one per tile half. Each half
presents as its own DRM connector, with a DisplayID Tile Topology
block in its EDID describing where it sits in the monitor. The
kernel parses that block and exposes the result as the `TILE`
immutable blob, formatted as eight ':'-delimited decimals:
group_id:flags:num_h_tiles:num_v_tiles:loc_h:loc_v:tile_w:tile_h.

Newer 5K panels carry the image on a single cable using DSC over
DP 1.4, or uncompressed over DP 2.1 UHBR.

`DrmDevice::tile_info()` reads the blob, parses it into a new
`backend::drm::TileInfo` struct, and returns `None` for connectors
without one. Compositors can use the shared `group_id` to identify
connectors that belong to the same physical monitor.

The kernel's `flags` field is parsed and discarded. It isn't
documented and Mutter ignores it.

AI-generated: This code was co-authored with Claude (Anthropic).
@Drakulix
Copy link
Copy Markdown
Member

Hmm. Exposing the TILE property is definitely not wrong, as we need this information to correctly handle this case.

I just wonder if a pure drm-helper in smithay is the right approach or whether we could provide more abstractions for this in smithay and if we perhaps even should.

  • For one I am not sure, if doing separate commits for the two halves can cause tearing between the different parts of the panel or if the two crtcs need to be updated in a single atomic commit for frame-locking to be correctly applied.
  • Are there tiled monitors, which support VRR? that might make this problem even more pronounced as we likely want to drive both at the same refresh rate.
  • So I am thinking we might need to make the DrmCompositor at least support multiple DrmSurfaces. (Ping @cmeissl)
  • If we were to purely provide the TILE-property, this code might be better suited for the smithay-drm-extras crate. (Which I wanted to integrate into cosmic-comp for the longest time anyway, so this would be a good opportunity.)

Either way thanks for working on this. We might just need a little more design work first. Luckily the code you wrote so far for smithay at least is very universally applicable and just needs to be moved around at worst.

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