Retrieving monitor connection information

2022-09-01 Thread Andrew Marshall
I have an application that requires the equivalent of the `ConnectorNumber`
and `ConnectorType` properties that are available in the RandR protocol in
X11 (see
https://github.com/freedesktop/xorg-xorgproto/blob/master/randrproto.txt)

For various reasons related to multi-monitor setups and refresh rates I'd
prefer to run this application under Wayland (It's implemented in GTK4 and
I'm seeing significant performance degradation under X versus Wayland)

Is there a way of retrieving these properties under Wayland? I know they
are provided by the NVidia driver. I'm open to providing some sort of patch
to do this myself but unsure where to look.

Thanks,
Andrew.


-- 
Andrew Marshall
Independent C++ Consultant
https://www.algodynamic.co.uk/
https://github.com/planetmarshall
https://www.linkedin.com/in/algodynamic/


Re: Retrieving monitor connection information

2022-09-01 Thread Simon Ser
Hi,

On Thursday, September 1st, 2022 at 11:23, Andrew Marshall 
 wrote:

> I have an application that requires the equivalent of the
> `ConnectorNumber` and `ConnectorType` properties that are available
> in the RandR protocol in X11 (see
> https://github.com/freedesktop/xorg-xorgproto/blob/master/randrproto.txt)

There is no equivalent to X11's RandR extension in Wayland.

Why do you need to fetch this information? What's your use-case?

Thanks,

Simon


Re: Retrieving monitor connection information

2022-09-01 Thread Andrew Marshall
On Thu, 1 Sept 2022 at 10:27, Simon Ser  wrote:

> Hi,
>
> On Thursday, September 1st, 2022 at 11:23, Andrew Marshall <
> and...@algodynamic.com> wrote:
>
> > I have an application that requires the equivalent of the
> > `ConnectorNumber` and `ConnectorType` properties that are available
> > in the RandR protocol in X11 (see
> > https://github.com/freedesktop/xorg-xorgproto/blob/master/randrproto.txt
> )
>
> There is no equivalent to X11's RandR extension in Wayland.
>

No, but the information is available - so there must be a means of
retrieving that information?


>
> Why do you need to fetch this information? What's your use-case?
>
>
A medical device outputs a camera display to each of four monitors,
attached to display port connectors on the graphics card.  There is a 1:1
relationship between camera outputs and displays, and a UI allows assigning
a specific camera output to a specific display port output.


-- 
Andrew Marshall
Independent C++ Consultant
https://www.algodynamic.co.uk/
https://github.com/planetmarshall
https://www.linkedin.com/in/algodynamic/


Re: Retrieving monitor connection information

2022-09-01 Thread Simon Ser
On Thursday, September 1st, 2022 at 12:23, Andrew Marshall 
 wrote:

> > Why do you need to fetch this information? What's your use-case?
> 
> A medical device outputs a camera display to each of four monitors,
> attached to display port connectors on the graphics card. There is a
> 1:1 relationship between camera outputs and displays, and a UI allows
> assigning a specific camera output to a specific display port output.

It seems like wl_output.name would be useful for this purpose.
wl_output.description contains a human-readable string which can be
included in the UI.

Note, do not assume that wl_output.name will have any defined format.
Some compositors will send e.g. "DP-2", some will send an arbitrary ID
such as "CD6767WZ", etc.


Re: Retrieving monitor connection information

2022-09-01 Thread Simon Zeni
On Thu Sep 1, 2022 at 6:23 AM EDT, Andrew Marshall wrote:
> No, but the information is available - so there must be a means of
> retrieving that information?

Not without a protocol.

> A medical device outputs a camera display to each of four monitors,
> attached to display port connectors on the graphics card.  There is a 1:1
> relationship between camera outputs and displays, and a UI allows assigning
> a specific camera output to a specific display port output.

Maybe you can find your way around using the drm-lease-v1 [1] protocol, but
it would be a bit hacky and a lot of work.

[1]: 
https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/drm-lease/drm-lease-v1.xml


Re: Retrieving monitor connection information

2022-09-01 Thread Mikhail Gusarov
On 1 Sep 2022, at 12:26, Simon Ser wrote:

>> A medical device outputs a camera display to each of four monitors,
>> attached to display port connectors on the graphics card. There is a
>> 1:1 relationship between camera outputs and displays, and a UI allows
>> assigning a specific camera output to a specific display port output.
>
> It seems like wl_output.name would be useful for this purpose.
> wl_output.description contains a human-readable string which can be
> included in the UI.
>
> Note, do not assume that wl_output.name will have any defined format.
> Some compositors will send e.g. "DP-2", some will send an arbitrary ID
> such as "CD6767WZ", etc.

In the described use-case compositor is most likely known and fixed.

Best,
Mikhail.


Re: Retrieving monitor connection information

2022-09-01 Thread Andrew Marshall
On Thu, 1 Sept 2022 at 12:01, Mikhail Gusarov 
wrote:

>
> In the described use-case compositor is most likely known and fixed.
>
>
Yes, however can I guarantee that the output names will remain the same in
the following scenarios -

* Rebooting of the system
* Disconnection and reconnection of display devices

?

Thanks,
Andrew.
-- 
Andrew Marshall
Independent C++ Consultant
https://www.algodynamic.co.uk/
https://github.com/planetmarshall
https://www.linkedin.com/in/algodynamic/


Re: Retrieving monitor connection information

2022-09-01 Thread Andrew Marshall
For example, the advantage of having connection information is that I can
provide the following behaviour:

1. User assigns Camera 1 to DisplayPort1
2. User disconnects DisplayPort1
3. User connects a new monitor to DisplayPort1
4. Camera 1 is restored on the new monitor.

Regards,
Andrew.



On Thu, 1 Sept 2022 at 12:36, Andrew Marshall 
wrote:

>
> On Thu, 1 Sept 2022 at 12:01, Mikhail Gusarov 
> wrote:
>
>>
>> In the described use-case compositor is most likely known and fixed.
>>
>>
> Yes, however can I guarantee that the output names will remain the same in
> the following scenarios -
>
> * Rebooting of the system
> * Disconnection and reconnection of display devices
>
> ?
>
> Thanks,
> Andrew.
> --
> Andrew Marshall
> Independent C++ Consultant
> https://www.algodynamic.co.uk/
> https://github.com/planetmarshall
> https://www.linkedin.com/in/algodynamic/
>


-- 
Andrew Marshall
Independent C++ Consultant
https://www.algodynamic.co.uk/
https://github.com/planetmarshall
https://www.linkedin.com/in/algodynamic/


Re: Retrieving monitor connection information

2022-09-01 Thread Simon Ser
On Thursday, September 1st, 2022 at 13:36, Andrew Marshall 
 wrote:

> On Thu, 1 Sept 2022 at 12:01, Mikhail Gusarov  wrote:
> 
> > 
> > In the described use-case compositor is most likely known and fixed.
> 
> Yes, however can I guarantee that the output names will remain the same in 
> the following scenarios -
> 
> * Rebooting of the system
> * Disconnection and reconnection of display devices
> 
> ?

No. KMS names ("DP-2") cannot be used for a reliable identifier.
wl_output.name specification states:

The name is not guaranteed to be persistent across sessions, thus cannot
be used to reliably identify an output in e.g. configuration files.

See the discussion at [1] for more info. To fix this, we'd need a new
wl_output event and a new KMS property.

[1]: 
https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/109#note_813539