backend: add getters
This commit is contained in:
parent
042070ee99
commit
acec4c7f09
3 changed files with 19 additions and 9 deletions
|
|
@ -540,6 +540,9 @@ pub trait BackendDrmDevice {
|
|||
fn version(&self) -> Result<DrmVersion, DrmError>;
|
||||
fn set_direct_scanout_enabled(&self, enabled: bool);
|
||||
fn is_render_device(&self) -> bool;
|
||||
fn direct_scanout_enabled(&self) -> bool {
|
||||
false
|
||||
}
|
||||
fn create_lease(
|
||||
self: Rc<Self>,
|
||||
lessee: Rc<dyn BackendDrmLessee>,
|
||||
|
|
@ -551,6 +554,10 @@ pub trait BackendDrmDevice {
|
|||
fn set_flip_margin(&self, margin: u64) {
|
||||
let _ = margin;
|
||||
}
|
||||
#[expect(dead_code)]
|
||||
fn flip_margin(&self) -> Option<u64> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub trait BackendDrmLease {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue