Host X11 on one GPU, incus container X11 on 2nd GPU (essentially two PCs,) possible? (Without blacklisting 2nd GPU on host)

What I have:

Intel iGPU (i9-13900kf) for my host, usually running Plasma/X11
RTX 4070, not used by host for desktop, but proprietary nvidia drivers installed

What I have been able to do:

Run some AI/ML stuff in an incus container (oobabooga in Docker in incus container,) of course this doesn’t use it for actual graphics

What I want to do (not necessarily at the same time as the above):

Run X11 apps in an incus container, using the 4070 for video output to a second monitor, without changing host config (not blacklisting card)

Is this possible, and are there tutorials/documentation I can refer to?

I saw this one, oriented toward AMD:

But before I get into sharing configs and such, let me make sure I’m trying the right approach.

First I want to get video working, then would like audio/inputs to be separate, but one step at a time (unless tutorials already cover that.)

How much of LXD documentation is still relevant? Internet searches for incus still find mostly “bone in the middle ear,” lol.

Welcome to the Incus forum!

A container is practically a process tree that is separated from other process trees of the host. The magic is that in spite of being just another process tree, it has been setup so that it appears as another system, a system container. In that respect, when you create a container and you expose a specific GPU to that container, you are allowing the container to access the said GPU. When you are running GUI apps in a container, you are tricking the host to consider those container GUI apps are not different from those that run on the host. And the X server or Wayland on the host will happily show the output.

In contrast to containers, there are virtual machines (implemented in Incus with KVM/Qemu). In a typical setup your VM gets a virtualized GPU of the main GPU of the host. You can then run GUI apps in somewhat decent speeds. But if you have two GPUs, can you expose the other GPU (not the one used by the host) exclusively to a VM?
Yes, you can, with something that is called GPU Passthrough. You add gputype=physical and the GPU is gone from the host and appears into the Incus VM (or Incus container). Note that there are a few additional issues to read up on GPU Passthrough.

Therefore, one way is to go exclusive and give the other GPU to a single Incus VM or container.

However, you would rather not lose any of the GPUs from the host.
In that respect, I think that you cannot get a container to use the unused GPU to show a GUI app on the host. I think you have to configure first the host to use the two GPUs separately in two desktops, then configure the containers to show their GUI windows to the respective desktop. That is, the quest is how to get two separate desktops on two separate displays on the same host. This is doable with a VM and GPU Passthrough. I feel it should be doable with some weird X11 configuration.

Also I tried this and it works on Incus. It’s desktop in a container.