xfree86: Detect the primary device by checking outputs

Before this patch, X server detects/sets the primary device by:
1. The "PrimaryGPU" option in extra X configuration
2. pci_device_is_boot_vga() for PCI devices
3. Set the first (0 index) device as the primary device, if it is not
   found yet.

However, the other display controllers like Amlogic's meson cannot be
detected as the primary device by pci_device_is_boot_vga(). Thus, it has
to set the extra X configuration for the "PrimaryGPU" option.
Otherwise, X server will set the first (0 index) device as the primary
device. But it may not be the correct one, because it has no output.
For example, Amlogic puts the GPU and display controller as different
devices:

(II) xfree86: Adding drm device (/dev/dri/card0)
(II) Platform probe for /sys/devices/platform/soc/d0000000.apb/d00c0000.gpu/drm/card0
(II) xfree86: Adding drm device (/dev/dri/card1)
(II) Platform probe for /sys/devices/platform/soc/d0100000.vpu/drm/card1

This patch introduces a new member num_connectors into OdevAttributes to
hold the number of display connectors for each DRM device. It gets the
number of the device's connectors by detecting the output connecters of
devices in platform dev driver, that refers to the check_outputs()
function in modesetting driver.
Then, adds a new way to set the primary device by checking the number of
display connectors for drm devices, before use the first platform device
as a fallback.

Buglink: xorg/xserver#1023
Signed-off-by: Jian-Hong Pan <jian-hong@endlessm.com>
4 jobs for master in 3 minutes and 41 seconds (queued for 2 seconds)
latest
Status Job ID Name Coverage
  Docker Image
passed #3886387
debian-testing

00:00:25

 
  Build And Test
passed #3886388
autotools

00:03:16

passed #3886389
meson

00:01:14

passed #3886390
meson-noglamor

00:01:52