drm: Do support IN_FORMATS on legacy surfaces (mostly for nouveau)

This commit is contained in:
Victor Brekenfeld 2021-05-15 21:01:18 +02:00
parent 4e2afb0f1f
commit 3012e87e0e
1 changed files with 17 additions and 5 deletions

View File

@ -410,16 +410,28 @@ impl<A: AsRawFd + 'static> DrmDevice<A> {
}); });
} }
if let (Ok(1), &DrmSurfaceInternal::Atomic(ref surf)) = ( if let Ok(1) =
self.get_driver_capability(DriverCapability::AddFB2Modifiers), self.get_driver_capability(DriverCapability::AddFB2Modifiers)
&internal, {
) {
let set = self.get_properties(plane).map_err(|source| Error::Access { let set = self.get_properties(plane).map_err(|source| Error::Access {
errmsg: "Failed to query properties", errmsg: "Failed to query properties",
dev: self.dev_path(), dev: self.dev_path(),
source, source,
})?; })?;
if let Ok(prop) = surf.plane_prop_handle(plane, "IN_FORMATS") { let (handles, _) = set.as_props_and_values();
// for every handle ...
let prop = handles.iter().find(|handle| {
// get information of that property
if let Some(info) = self.get_property(**handle).ok() {
// to find out, if we got the handle of the "IN_FORMATS" property ...
if info.name().to_str().map(|x| x == "IN_FORMATS").unwrap_or(false) {
// so we can use that to get formats
return true;
}
}
false
}).copied();
if let Some(prop) = prop {
let prop_info = self.get_property(prop).map_err(|source| Error::Access { let prop_info = self.get_property(prop).map_err(|source| Error::Access {
errmsg: "Failed to query property", errmsg: "Failed to query property",
dev: self.dev_path(), dev: self.dev_path(),