kms: Import on device supporting format, if not advertised device
Fixes https://github.com/pop-os/cosmic-epoch/issues/2978.
This reverses the part of
ca00df0b37 that made it
only try import on the advertised GPU. But this version avoids
initializing an EGL context simply to re-check the supported texture
formats.
This commit is contained in:
parent
0e97ddbd00
commit
2ea1186723
2 changed files with 20 additions and 3 deletions
|
|
@ -14,7 +14,7 @@ use indexmap::IndexMap;
|
|||
use render::gles::GbmGlowBackend;
|
||||
use smithay::{
|
||||
backend::{
|
||||
allocator::{dmabuf::Dmabuf, format::FormatSet},
|
||||
allocator::{Buffer, dmabuf::Dmabuf, format::FormatSet},
|
||||
drm::{DrmDeviceFd, DrmNode, NodeType, VrrSupport, output::DrmOutputRenderElements},
|
||||
egl::{EGLContext, EGLDevice, EGLDisplay},
|
||||
input::InputEvent,
|
||||
|
|
@ -491,7 +491,7 @@ impl KmsState {
|
|||
global: &DmabufGlobal,
|
||||
dmabuf: Dmabuf,
|
||||
) -> Result<DrmNode> {
|
||||
let device = self
|
||||
let mut device = self
|
||||
.drm_devices
|
||||
.values_mut()
|
||||
.find(|device| {
|
||||
|
|
@ -503,6 +503,21 @@ impl KmsState {
|
|||
})
|
||||
.context("Couldn't find gpu for dmabuf global")?;
|
||||
|
||||
// If device advertised to client doesn't support format/modifier, select
|
||||
// first device that does. This is needed for image-copy from
|
||||
// output/toplevel on a different node.
|
||||
//
|
||||
// TODO: After
|
||||
// https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/268,
|
||||
// only try the device specified explicitly by the client, if set.
|
||||
if !device.texture_formats.contains(&dmabuf.format()) {
|
||||
device = self
|
||||
.drm_devices
|
||||
.values_mut()
|
||||
.find(|device| device.texture_formats.contains(&dmabuf.format()))
|
||||
.context("Dmabuf cannot be imported on any gpu")?;
|
||||
}
|
||||
|
||||
let new_client = if let Some(client) = client {
|
||||
let new = device.inner.active_clients.insert(client.id());
|
||||
device.inner.update_egl(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue