Skip to content

xfree86: Fix autoconfig secondary GPU devices

Jacob Cherry requested to merge jcherry/xserver:master into master

The code path added by commit 69e4b8e6 (xfree86: attempt to autoconfig gpu slave devices (v3)) assumes that it will only be run if the primary device on the screen is the first device in xf86configptr->conf_device_lst. While this is true most of the time, there are two specific cases where this assumption fails.

First, if the first device in conf_device_lst is assigned to a different seat than the running X server, it will be skipped by the previous FIND_SUITABLE macro usage. Second, if the primary device was explicitly assigned to the screen but auto_gpu_device is still set and no secondary devices were explicitly listed, that device may not be the first device in conf_device_lst.

When the first device in conf_device_lst is not the primary device assigned to the screen, two problems emerge. First, the first device in conf_device_lst will never be assigned to the screen as a secondary device. Second, the primary device is additionally assigned to the screen as a secondary device. The combination of these problems causes certain otherwise valid configurations to be invalid. For example, if a primary device is assigned to a screen and a secondary device is listed in the config but not explicitly assigned to the screen, then one order of the device sections results in a usable PRIME or Reverse PRIME setup and the other order does not.

This commit removes the assumption that the primary device is the first device in conf_device_lst by starting the loop from the start of conf_device_lst and skipping the primary device when it is encountered.

Signed-off-by: Jacob Cherry jcherry@nvidia.com

Merge request reports