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

RFC: Add CDI generator for Wayland displays in (x)wayland images #1518

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

doanac
Copy link
Member

@doanac doanac commented Oct 3, 2024

We have a hard-to-remember way of running wayland applications inside Docker. By leveraging CDI we can make this much easier for users so that you could simply run:

 docker run --device org.wayland/display=wayland-1 <image>

and have all the correct bind-mounts and environment variables set inside the container.

doanac added 2 commits October 3, 2024 14:23
The Container Device Interface(CDI) is a specification supported by tools
like Docker and Podman to more easily access hardware.

Given the hardware-specific nature of our platform, this feature is
generically useful to our users and should be enabled.

Signed-off-by: Andy Doan <[email protected]>
This change introduces logic to generate a CDI definition for the Weston
display created at boot. With CDI enabled in a container runtime like
Docker, you could run Wayland apps with a command like:
running:
```
 docker run --rm -it --device=org.wayland/display=wayland-1 ubuntu
```

Signed-off-by: Andy Doan <[email protected]>
@doanac
Copy link
Member Author

doanac commented Oct 3, 2024

@ricardosalveti @EmbeddedAndroid - This is a rough idea of how we could start to use CDI to make accessing hardware inside containers easier. There are a couple of ways this could be done by I've chosen an approach that is:

  • dynamic - having a script generate the content gives a little more flexibility in the event defaults about Wayland somehow change
  • enforces a relationship between docker/weston - This could be controversial but I think containers needing Wayland (and this seems to be why you'd build our Wayland flavor) should use SystemD to ensure the container doesn't run until Weston is ready for it.

We could totally change this, but I wanted to get a dialog started.

@ricardosalveti ricardosalveti requested a review from a team October 3, 2024 19:41
@@ -5,3 +5,4 @@ DISTROOVERRIDES = "lmp:lmp-wayland"
DISTRO_NAME = "Linux-microPlatform Wayland"

DISTRO_FEATURES:append = " wayland opengl vulkan"
IMAGE_INSTALL:append:lmp-wayland = " wayland-cdi"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably move this to meta-lmp-base/recipes-samples/images/lmp-feature-docker.inc, and have it conditional to wayland (via DISTRO_FEATURES):

${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland-cdi, '', d)}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants