Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for static display geometry #495

Closed
Saviq opened this issue Jul 26, 2018 · 9 comments
Closed

Add support for static display geometry #495

Saviq opened this issue Jul 26, 2018 · 9 comments
Assignees

Comments

@Saviq
Copy link
Collaborator

Saviq commented Jul 26, 2018

In digital signage space, it's often required to have a static display geometry configuration. Displays being disconnected or connected should not change the geometry of the overall display.

Most common case seems to be mapping outputs by name (DP-1, eDP-1 etc.) to geometry (WxHx+X+Y). Multiple GPUs need also be supported.

Mir (and by extension, mir-kiosk) should support this via command line arguments and/or config file.

Let's use this issue to design this feature.

@AlanGriffiths
Copy link
Contributor

While I can see this being important for mir-kiosk, should Mir support this?

My preference would be for Mir (libmiral) to provide a more general API that this particular case to be handled by miral-kiosk.

@Saviq
Copy link
Collaborator Author

Saviq commented Jul 27, 2018

@AlanGriffiths if you think a developer desktop with 3 screens, while it might not need static configuration, it will likely want to store and restore display configuration. My gut feeling is that it would be nice if Mir handled this by default for shells. So why wouldn't a static config be something Mir could support as well?

@AlanGriffiths
Copy link
Contributor

I was thinking shells would have their own ways of allowing display config.

But I guess we could offer a usable default

@AlanGriffiths
Copy link
Contributor

The obvious place is in the configuration file we could do something like:

# ~/.config/mir-kiosk.config
...
[display]
output1=position=0,0:size=1200,700;orientation=normal:mode=1200x720 60.00Hz:scale=1.00
output2=position=1200,0:size=1200,700:scale=1.00

@Saviq what's not clear to me is how we identify the outputs: The monitors are likely to have identical EDID. Do we just use the order they are listed on the card(s) - if so, how do we handle slots that are disconnected or powered down?

@AlanGriffiths AlanGriffiths self-assigned this Aug 15, 2018
@Saviq
Copy link
Collaborator Author

Saviq commented Aug 15, 2018

@AlanGriffiths if we can't uniquely identify displays, let's not even try, and instead rely on output names, those should be unique and static?

It's a more common use case anyway where you want the physical output to always have the same content, even if you replace the display?

Disconnecting or powering down should have zero effect on the output.

@AlanGriffiths
Copy link
Contributor

OK, I can identify the cards, ports and types (and count ports of each type):

Output: card_id: 0      id: 1   type: VGA       count: 1
Output: card_id: 0      id: 2   type: HDMI-A    count: 1
Output: card_id: 0      id: 3   type: DisplayPort       count: 1
Output: card_id: 0      id: 4   type: HDMI-A    count: 2
Output: card_id: 0      id: 5   type: DisplayPort       count: 2

And that ties up with:

$ xrandr | awk '/connected/ { print $1 }'VGA-1
HDMI-1
DP-1
HDMI-2
DP-2

@AlanGriffiths
Copy link
Contributor

AlanGriffiths commented Aug 15, 2018

On further thought using the config file directly will be a bit clunky. I think an optional --output-layout <file> would be easier to manage. (And maybe --list-outputs-to <file> to create a template?)

We can look at adding things later (orientation, refresh rate, ...), but I'm thinking the file could have something like:

card_id=0, output_id=1: pos=0,0; size=1200x720 # type: VGA, modes: 1920×1080@60.00, 1680×1050@59.88, 1280×1024@75.02, 1280×1024@60.01, 1440×900@59.90, 1280×960@60.00, 1280×800@59.90, 1152×864@75.00, 1280×720@60.00, 1024×768@75.02, 1024×768@70.06, 1024×768@60.00, 832×624@74.55, 800×600@75.00, 800×600@72.18, 800×600@60.31, 800×600@56.25, 640×480@75.00, 640×480@66.66, 640×480@59.94, 720×400@70.08
card_id=0, output_id=2: # type: DisplayPort
card_id=0, output_id=3: # type: DisplayPort
card_id=0, output_id=1: pos=1200,720; size=1200x720 # type: HDMI, modes: 1920×1080@60.00, 1680×1050@59.88, 1280×1024@75.02, 1280×1024@60.01, 1440×900@59.90, 1280×960@60.00, 1280×800@59.90, 1152×864@75.00, 1280×720@60.00, 1024×768@75.02, 1024×768@70.06, 1024×768@60.00, 832×624@74.55, 800×600@75.00, 800×600@72.18, 800×600@60.31, 800×600@56.25, 640×480@75.00, 640×480@66.66, 640×480@59.94, 720×400@70.08

Stuff after "#" is a comment, but if we generate it we can populate it with the output type and available display modes.

@Saviq
Copy link
Collaborator Author

Saviq commented Aug 15, 2018

I'd go for something like --dump-outputs, if someone wants to redirect it to a file, they will. Would it be a separate tool? A client? Otherwise you'd need to stop Mir and run the tool with the permissions to interrogate the GPUs?

The comments could also include the connection status (and data about the connected display, if any).
I feel like card_id and output_id are somewhat redundant.

Also, is card ordering something we can rely on? It could change on boot, couldn't it?

@AlanGriffiths
Copy link
Contributor

Well, I think (without good evidence) that the cards are ordered by their physical location. That can, of course change between boots. But it isn't immediately obvious to me how better to identify them.

So I'm going to punt that out of the scope of "the simplest thing that might possibly work".

Updating the above example:

output_id=0/1: pos=0,0; size=1200x720 # type: VGA, modes: 1920×1080@60.00, 1680×1050@59.88, 1280×1024@75.02, 1280×1024@60.01, 1440×900@59.90, 1280×960@60.00, 1280×800@59.90, 1152×864@75.00, 1280×720@60.00, 1024×768@75.02, 1024×768@70.06, 1024×768@60.00, 832×624@74.55, 800×600@75.00, 800×600@72.18, 800×600@60.31, 800×600@56.25, 640×480@75.00, 640×480@66.66, 640×480@59.94, 720×400@70.08
output_id=0/2: # type: DisplayPort (disconnected)
output_id=0/3: # type: DisplayPort (disconnected)
output_id=1/1: pos=1200,720; size=1200x720 # type: HDMI, modes: 1920×1080@60.00, 1680×1050@59.88, 1280×1024@75.02, 1280×1024@60.01, 1440×900@59.90, 1280×960@60.00, 1280×800@59.90, 1152×864@75.00, 1280×720@60.00, 1024×768@75.02, 1024×768@70.06, 1024×768@60.00, 832×624@74.55, 800×600@75.00, 800×600@72.18, 800×600@60.31, 800×600@56.25, 640×480@75.00, 640×480@66.66, 640×480@59.94, 720×400@70.08

Stuff after "#" is a comment, but if we generate it we can populate it with the output type and available display modes.

bors bot added a commit that referenced this issue Aug 24, 2018
551: Add a "--display-config static=<filename>" option r=Saviq a=AlanGriffiths

Add a "--display-config static=\<filename\>" option. (Fixes #495)

This reads the indicated file and tries to position the display outputs accordingly.
If the file does not exist, or if actual outputs are not specified defaults are applied.
The complete resulting layout is listed in the Mir "info" log.

Note: Specifying a non-existent file is an easy way to get a template for editing.

(As with other configuration options this can also be specified with environment variables or a config file.)

Co-authored-by: Alan Griffiths <alan@octopull.co.uk>
Co-authored-by: Alan Griffiths <alan.griffiths@canonical.com>
@bors bors bot closed this as completed in #551 Aug 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants