1
0
Fork 0
forked from wry/wry

backend: add getters

This commit is contained in:
Julian Orth 2026-03-07 11:46:32 +01:00
parent 042070ee99
commit acec4c7f09
3 changed files with 19 additions and 9 deletions

View file

@ -1,6 +1,6 @@
use {
crate::{
backend::Connector,
backend::{BackendDrmDevice, Connector},
backends::metal::{
MetalError,
allocator::{RenderBuffer, RenderBufferCopy},
@ -814,13 +814,6 @@ impl MetalConnector {
data
}
fn direct_scanout_enabled(&self) -> bool {
self.dev
.direct_scanout_enabled
.get()
.unwrap_or(self.state.direct_scanout_enabled.get())
}
fn prepare_present_fb(
&self,
cd: &Rc<ColorDescription>,
@ -832,7 +825,7 @@ impl MetalConnector {
) -> Result<PresentFb, MetalError> {
self.trim_scanout_cache();
let try_direct_scanout = try_direct_scanout
&& self.direct_scanout_enabled()
&& self.dev.direct_scanout_enabled()
// at least on AMD, using a FB on a different device for rendering will fail
// and destroy the render context. it's possible to work around this by waiting
// until the FB is no longer being scanned out, but if a notification pops up

View file

@ -186,6 +186,12 @@ impl BackendDrmDevice for MetalDrmDevice {
Some(self.id) == self.backend.ctx.get().map(|c| c.dev_id)
}
fn direct_scanout_enabled(&self) -> bool {
self.direct_scanout_enabled
.get()
.unwrap_or(self.backend.state.direct_scanout_enabled.get())
}
fn create_lease(
self: Rc<Self>,
lessee: Rc<dyn BackendDrmLessee>,
@ -314,6 +320,10 @@ impl BackendDrmDevice for MetalDrmDevice {
}
}
}
fn flip_margin(&self) -> Option<u64> {
Some(self.min_post_commit_margin.get())
}
}
pub struct HandleEvents {