We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5513

Summary: [KMS/DRM] backend can't manage several displays.
Product: SDL Reporter: Manuel Alfayate Corchete <redwindwanderer>
Component: videoAssignee: Manuel Alfayate Corchete <redwindwanderer>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.15   
Hardware: All   
OS: Linux   
Attachments: Patch that adds multiple displays support to the SDL2 KMSDRM backend.

Description Manuel Alfayate Corchete 2021-01-29 00:37:23 UTC
Created attachment 4731 [details]
Patch that adds multiple displays support to the SDL2 KMSDRM backend.

Hi,

Until now, the KMSDRM backend didn't even try to detect and use several connected connectors, resulting in a single display always (ie: a single SDL Display was created around the first connected connector, and that was about it).

The included patch adds support for several displays on the same machine.
Some notes:
-An SDL Display is an internal SDL2 entity built around a connected connector: a connector is a DRM-side resource.
-A single video card DRI dev node (/dev/dri/card0, for example) can have several connectors. We don't manage several video cards: just several connectors on a video card.
-Mouse cursor can be drawn on different displays, of course, so access to the cursor-related GBM-side resources is now done through each SDL Display driverdata pointer: each display driverdata pointer has it's own cursor GBM BO (so, in practice, each display can have it's own cursor on screen now).

Please review so I can merge. Thanks!
Comment 1 Sam Lantinga 2021-01-29 16:54:41 UTC
You have an empty SetWindowGrab implementation mixed in there. Otherwise it looks good.
Comment 2 Manuel Alfayate Corchete 2021-01-29 17:10:01 UTC
@Sam: removed the empty SetWindowGrab code (we don't use that in KMSDRM) and did the commit.

Closing this, thanks!