On Wed, 2018-10-10 at 13:33 +0200, Gerd Hoffmann wrote: > Hi, > > > Also, can you respond to Frediano's comments below about e.g. HDMI- > > A, > > etc? As far as I can tell, libdrm doesn't really give us a > > canonical > > name for the output, it only gives us a connection type > > enumeration. I > > borrowed a function from your drminfo utility to construct an > > output > > name, but that doesn't seem to perfectly match the xrandr output > > names. > > xrandr names come from the driver, so maybe take the table from the > modesetting driver instead. When you talk about the table from the modesetting driver, do you mean this? https://gitlab.freedesktop.org/xorg/xserver/blob/master/hw/xfree86/drivers/modesetting/drmmode_display.c#L2779 But if the names are driver-specific, a different driver can use different names. For example, the xorg QXL driver uses fairly different names: https://gitlab.freedesktop.org/xorg/driver/xf86-video-qxl/blob/master/src/qxl_drmmode.c#L723 Comparing the modesetting table above to the QXL table, there are differences between: DVI-I -> DVI DVI-D -> DVI DVI-A -> DVI HDMI-B -> HDMI Granted, the qxl driver will probably only use the 'Virtual' output type (I assume?) so I'm not sure how much of an issue it is in practice, but in general it doesn't seem like a very reliable way to match drm outputs with xrandr outputs. In addition, I've noticed that on my laptop I have the following discrepancies: drm xrandr --- ------ DP-4 DP-3-1 DP-5 DP-3-2 DP-6 DP-3-3 Jonathon > > > > The POC is pretty long but mostly the issue seems that the Xorg > > > names > > > are "inspired" and not derived from DRM. I said inspired because > > > it > > > seems every Xorg driver is able to register whatever name they > > > want, > > > is just that usually they use DRM information. > > Yep. Most hardware is handled by the modesetting driver these days. When you say "these days", what do you mean exactly? How long ago did this transition happen? Will we run into issues supporting older releases? And can you be a bit more specific about "most" as well? What are the exceptions? > > qxl will continue to use its own driver, which is needed for > multihead > support. The modesetting driver can handle qxl too, but only in > single > head mode. For multihead it would try to use one framebuffer per > monitor, simliar to wayland. > > And, yes, the qxl driver shifts output numbering by one > (qxl_drmmode.c): > > /* need to do smart conversion here for compat with non-kms > ATI driver */ > snprintf(name, 32, "%s-%d", output_names[koutput- > >connector_type], koutput->connector_type_id - 1); > > The comment looks like this was simply cut&pasted from another > driver, > which has this for reasons not applying to qxl. So maybe we should > simply change that in the qxl driver ... > > > > In the code there are manually adjustment for: > > > - Virtual-XX outputs starting from 0 instead of 1 (like kernel > > > names); > > ... even though it probably doesn't remove the need for this quirk. > > > > > $ ./src/get-xrandr-output 0000:00:02.0 0 > > > > Device /dev/dri/card0 is at ../../../0000:00:02.0 > > > > DRM connector for monitor 0: name=eDP-1 id=71 (*CONNECTED*) > > > > Found matching X Output: name=eDP-1 id=114 (*CONNECTED*) > > > > > > > > > > I though the format of the PCI ID was different (a long string > > > with > > > all the path), are we going to have a function to extract this > > > new > > > "PCI address" from the PCI ID we discussed? > > Yes, you get something like "pci/0000/02.0" (or longer in case > pci-bridges are in the path). So you can search that in sysfs, > or walk all drm devices and compare. The matching sysfs path > would be this: > > /sys/devices/pci0000:00/0000:00:02.0/drm/card0 > ^^^^ ^^^^ > In case of virtio there will be another path element, like this: > > /sys/devices/pci0000:00/0000:00:02.0/virtio4/drm/card0 > > Don't become confused by this. So let's say that I have the following sysfs path: ../../devices/pci0000:00/0000:00:03.0/0000:01:01.0/0000:02:03.0/virtio2 /drm/card0 How would that translate to your proposed format? pci/0000/03.0/01.0/03.0 ??? Would we just ignore the different bus numbers for each device? Jonathon > > > > This does not support different order of detecting card, the > > > array > > > should be scan > > > in advance to check if given name starts with 0 or 1, would be > > > better > > > to check > > > for every name, not just QXL. > > See above. Add a special case for qxl is fine I think. > > cheers, > Gerd > _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel