[Spice-devel] [PATCH linux vdagent] Add POC for getting xrandr output from monitor ID
Jonathon Jongsma
jjongsma at redhat.com
Wed Oct 24 20:29:42 UTC 2018
On Wed, 2018-10-24 at 14:44 +0200, Gerd Hoffmann wrote:
> On Tue, Oct 23, 2018 at 03:24:21PM -0500, Jonathon Jongsma wrote:
> > 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
>
> Probably (can't look right now, conference wifi is rather flaky).
>
> > 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
>
> The qxl kernel driver uses connector type virtual, so you will not
> see
> the other ones. But, yes, it might be we need hardware-specific code
> here. Not sure what nvidia is doing here. Also the qxl driver
> shifts
> the index by one so you'll see VIRTUAL-0 instead of -1.
>
> > 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
>
> What hardware is this?
This is a Lenovo T460p laptop with intel graphics.
Interesting bit from lspci:
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 530
(rev 06)
It looks like this naming schema may be coming from the modesetting
driver as well. At least I see the following code in
drmmmode_create_name():
if (koutput->connector_type >= ARRAY_SIZE(output_names))
snprintf(name, 32, "Unknown%d-%d", koutput->connector_type, koutput->connector_type_id);
else if (pScrn->is_gpu)
snprintf(name, 32, "%s-%d-%d", output_names[koutput->connector_type], pScrn->scrnIndex - GPU_SCREEN_OFFSET + 1, koutput->connector_type_id);
else
snprintf(name, 32, "%s-%d", output_names[koutput->connector_type], koutput->connector_type_id);
The name format within the "if (pScrn->is_gpu)" block seems similar,
though I'm not sure if that branch applies in this situation.
>
> > > 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?
>
> Hardware sepcific xorg drivers are slowly going away in favor of
> using
> modesetting and glamor (i.e. use the mesa 3d driver for acceleration,
> if available).
>
> > And can you be a bit more specific about "most" as well? What are
> > the
> > exceptions?
>
> All qemu emulated display devices except qxl use modesetting (stdvga,
> cirrus, virtio).
>
> On recent intel hardware modesetting is used by default. I think
> this
> includes all hardware revisions which are supported by gvt.
>
> Nvidia has its own driver, so it might need a special case (as
> already
> mentioned above).
>
> Other hardware should not show up in a virtual machine.
>
> > > /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/vir
> > tio2
> > /drm/card0
> >
> > How would that translate to your proposed format?
> >
> > pci/0000/03.0/01.0/03.0 ???
>
> Yes.
>
> > Would we just ignore the different bus numbers for each device?
>
> Yes.
>
> cheers,
> Gerd
>
More information about the Spice-devel
mailing list