I'm trying to find a robust way to handle the phrasing of UDev rules and systemd dependencies about /dev/dri/cardXXX nodes to ensure that several compositor services running on different graphics cards of a device all can reliably start up. First, some basic observations:
On a system with multiple cards with each one used by a separate compositor application, this makes it a bit difficult to start each compositor only when its specific card is enumerated in UDev a bit tricky.
If the systemd .device unit (e.g. dev-dri-card-amd.device) activated by the initial UDev rule firing is already up and running, and a second UDev rule instance executes at the same time that a compositor application is just starting up, there is a small but feasible chance that the UDev helper program will acquire DRM master rights during exactly the duration that the compositor is attempting its own initializer. The compositor will therefore be denied DRM master status, and fail. I'm not really sure how the race in the final bullet point can be prevented. It seems to me that the only ironclad way to avoid it would be to perform the UDev rule matches strictly based on sysfs attributes. Has there ever been any talk about exporting the DRI card name through sysfs? On the other hand, maybe I'm approach this problem completely wrongly. Is it a losing game to try to phrase systemd ordering constraints on /dev/dri cards? -Matt |