metal: handle cursor plane allocation failures gracefully
This commit is contained in:
parent
c691a7b429
commit
e5de85299b
1 changed files with 21 additions and 7 deletions
|
|
@ -418,11 +418,11 @@ impl MetalDeviceTransaction {
|
||||||
crtc.new.mode_blob = Some(Rc::new(blob));
|
crtc.new.mode_blob = Some(Rc::new(blob));
|
||||||
mode.clone()
|
mode.clone()
|
||||||
};
|
};
|
||||||
for plane in [crtc_planes.primary, crtc_planes.cursor] {
|
for plane_id in [&mut crtc_planes.primary, &mut crtc_planes.cursor] {
|
||||||
if plane.is_none() {
|
if plane_id.is_none() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let plane = slf.planes.get_mut(&plane).unwrap();
|
let plane = slf.planes.get_mut(plane_id).unwrap();
|
||||||
plane.new.assigned_crtc = crtc.obj.id;
|
plane.new.assigned_crtc = crtc.obj.id;
|
||||||
plane.changed.extend(crtc.changed.iter().cloned());
|
plane.changed.extend(crtc.changed.iter().cloned());
|
||||||
let (x, y, width, height, format, old_buffers);
|
let (x, y, width, height, format, old_buffers);
|
||||||
|
|
@ -484,7 +484,8 @@ impl MetalDeviceTransaction {
|
||||||
None => {
|
None => {
|
||||||
let modifiers = &plane.obj.formats.get(&format.drm).unwrap().modifiers;
|
let modifiers = &plane.obj.formats.get(&format.drm).unwrap().modifiers;
|
||||||
connector.changed.set(true);
|
connector.changed.set(true);
|
||||||
let buffers = slf
|
let is_cursor = plane.obj.ty == PlaneType::Cursor;
|
||||||
|
let res = slf
|
||||||
.dev
|
.dev
|
||||||
.dev
|
.dev
|
||||||
.backend
|
.backend
|
||||||
|
|
@ -495,15 +496,28 @@ impl MetalDeviceTransaction {
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
render_ctx,
|
render_ctx,
|
||||||
plane.obj.ty == PlaneType::Cursor,
|
is_cursor,
|
||||||
)
|
)
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
BackendConnectorTransactionError::AllocateScanoutBuffers(
|
BackendConnectorTransactionError::AllocateScanoutBuffers(
|
||||||
connector.obj.kernel_id(),
|
connector.obj.kernel_id(),
|
||||||
Box::new(e),
|
Box::new(e),
|
||||||
)
|
)
|
||||||
})?;
|
});
|
||||||
let buffers = Rc::new(buffers);
|
if let Err(e) = &res
|
||||||
|
&& is_cursor
|
||||||
|
{
|
||||||
|
log::error!(
|
||||||
|
"Could not allocate buffers for cursor plane of {}: {}",
|
||||||
|
connector.obj.kernel_id(),
|
||||||
|
ErrorFmt(e),
|
||||||
|
);
|
||||||
|
plane.new = DrmPlaneState::default();
|
||||||
|
unused_planes.insert(*plane_id, ());
|
||||||
|
*plane_id = DrmPlane::NONE;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let buffers = Rc::new(res?);
|
||||||
plane.new.buffers = Some(buffers.clone());
|
plane.new.buffers = Some(buffers.clone());
|
||||||
new_buffers = Some(buffers.clone());
|
new_buffers = Some(buffers.clone());
|
||||||
buffers
|
buffers
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue