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
|
|
@ -95,6 +95,7 @@ pub struct Device {
|
||||||
pub drm: GbmDrmOutputManager,
|
pub drm: GbmDrmOutputManager,
|
||||||
|
|
||||||
supports_atomic: bool,
|
supports_atomic: bool,
|
||||||
|
pub texture_formats: FormatSet,
|
||||||
event_token: Option<RegistrationToken>,
|
event_token: Option<RegistrationToken>,
|
||||||
pub socket: Option<Socket>,
|
pub socket: Option<Socket>,
|
||||||
}
|
}
|
||||||
|
|
@ -285,7 +286,7 @@ impl State {
|
||||||
.with_context(|| format!("Failed to add drm device to event loop: {}", dev))?;
|
.with_context(|| format!("Failed to add drm device to event loop: {}", dev))?;
|
||||||
|
|
||||||
let socket = match (!is_software)
|
let socket = match (!is_software)
|
||||||
.then(|| self.create_socket(dh, render_node, texture_formats))
|
.then(|| self.create_socket(dh, render_node, texture_formats.clone()))
|
||||||
.transpose()
|
.transpose()
|
||||||
{
|
{
|
||||||
Ok(socket) => socket,
|
Ok(socket) => socket,
|
||||||
|
|
@ -349,6 +350,7 @@ impl State {
|
||||||
},
|
},
|
||||||
|
|
||||||
supports_atomic,
|
supports_atomic,
|
||||||
|
texture_formats,
|
||||||
event_token: Some(token),
|
event_token: Some(token),
|
||||||
socket,
|
socket,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ use indexmap::IndexMap;
|
||||||
use render::gles::GbmGlowBackend;
|
use render::gles::GbmGlowBackend;
|
||||||
use smithay::{
|
use smithay::{
|
||||||
backend::{
|
backend::{
|
||||||
allocator::{dmabuf::Dmabuf, format::FormatSet},
|
allocator::{Buffer, dmabuf::Dmabuf, format::FormatSet},
|
||||||
drm::{DrmDeviceFd, DrmNode, NodeType, VrrSupport, output::DrmOutputRenderElements},
|
drm::{DrmDeviceFd, DrmNode, NodeType, VrrSupport, output::DrmOutputRenderElements},
|
||||||
egl::{EGLContext, EGLDevice, EGLDisplay},
|
egl::{EGLContext, EGLDevice, EGLDisplay},
|
||||||
input::InputEvent,
|
input::InputEvent,
|
||||||
|
|
@ -491,7 +491,7 @@ impl KmsState {
|
||||||
global: &DmabufGlobal,
|
global: &DmabufGlobal,
|
||||||
dmabuf: Dmabuf,
|
dmabuf: Dmabuf,
|
||||||
) -> Result<DrmNode> {
|
) -> Result<DrmNode> {
|
||||||
let device = self
|
let mut device = self
|
||||||
.drm_devices
|
.drm_devices
|
||||||
.values_mut()
|
.values_mut()
|
||||||
.find(|device| {
|
.find(|device| {
|
||||||
|
|
@ -503,6 +503,21 @@ impl KmsState {
|
||||||
})
|
})
|
||||||
.context("Couldn't find gpu for dmabuf global")?;
|
.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_client = if let Some(client) = client {
|
||||||
let new = device.inner.active_clients.insert(client.id());
|
let new = device.inner.active_clients.insert(client.id());
|
||||||
device.inner.update_egl(
|
device.inner.update_egl(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue