config: allow disabling direct scanout
This commit is contained in:
parent
da84e9ec27
commit
114c293950
9 changed files with 63 additions and 1 deletions
|
|
@ -81,6 +81,7 @@ pub struct MetalDrmDevice {
|
|||
pub handle_events: HandleEvents,
|
||||
pub ctx: CloneCell<Rc<MetalRenderContext>>,
|
||||
pub on_change: OnChange<crate::backend::DrmEvent>,
|
||||
pub direct_scanout_enabled: Cell<Option<bool>>,
|
||||
}
|
||||
|
||||
impl BackendDrmDevice for MetalDrmDevice {
|
||||
|
|
@ -115,6 +116,10 @@ impl BackendDrmDevice for MetalDrmDevice {
|
|||
fn version(&self) -> Result<DrmVersion, DrmError> {
|
||||
self.gbm.drm.version()
|
||||
}
|
||||
|
||||
fn set_direct_scanout_enabled(&self, enabled: bool) {
|
||||
self.direct_scanout_enabled.set(Some(enabled));
|
||||
}
|
||||
}
|
||||
|
||||
pub struct HandleEvents {
|
||||
|
|
@ -466,6 +471,13 @@ 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,
|
||||
rr: &mut RenderResult,
|
||||
|
|
@ -485,7 +497,9 @@ impl MetalConnector {
|
|||
output.global.preferred_scale.get(),
|
||||
render_hw_cursor,
|
||||
);
|
||||
let try_direct_scanout = try_direct_scanout && !output.global.have_shm_screencopies();
|
||||
let try_direct_scanout = try_direct_scanout
|
||||
&& !output.global.have_shm_screencopies()
|
||||
&& self.direct_scanout_enabled();
|
||||
let mut direct_scanout_data = None;
|
||||
if try_direct_scanout {
|
||||
if let Some(dsd) = self.prepare_direct_scanout(&pass, plane) {
|
||||
|
|
@ -1394,6 +1408,7 @@ impl MetalBackend {
|
|||
},
|
||||
ctx: CloneCell::new(ctx),
|
||||
on_change: Default::default(),
|
||||
direct_scanout_enabled: Default::default(),
|
||||
});
|
||||
|
||||
let (connectors, futures) = get_connectors(self, &dev, &resources.connectors)?;
|
||||
|
|
|
|||
|
|
@ -989,6 +989,10 @@ impl BackendDrmDevice for XDrmDevice {
|
|||
fn version(&self) -> Result<DrmVersion, DrmError> {
|
||||
self.backend.gbm.drm.version()
|
||||
}
|
||||
|
||||
fn set_direct_scanout_enabled(&self, enabled: bool) {
|
||||
let _ = enabled;
|
||||
}
|
||||
}
|
||||
|
||||
struct XOutput {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue