aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tty.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-01-03 11:28:42 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-01-03 11:38:02 +0400
commit31bb9096e2e18f9f385a56a1657c307738ec80b4 (patch)
tree4dc0c0290539ff580b26d54b44c15b2b2fdfb6c0 /src/backend/tty.rs
parentdae93ee1598b3f80e2904de26508b8d9da076219 (diff)
downloadniri-31bb9096e2e18f9f385a56a1657c307738ec80b4.tar.gz
niri-31bb9096e2e18f9f385a56a1657c307738ec80b4.tar.bz2
niri-31bb9096e2e18f9f385a56a1657c307738ec80b4.zip
Move Niri::render() invocation to backends
Diffstat (limited to 'src/backend/tty.rs')
-rw-r--r--src/backend/tty.rs25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/backend/tty.rs b/src/backend/tty.rs
index 679073e5..89952192 100644
--- a/src/backend/tty.rs
+++ b/src/backend/tty.rs
@@ -40,7 +40,7 @@ use wayland_protocols::wp::presentation_time::server::wp_presentation_feedback;
use super::RenderResult;
use crate::config::Config;
-use crate::niri::{OutputRenderElements, RedrawState, State};
+use crate::niri::{RedrawState, State};
use crate::utils::get_monotonic_time;
use crate::Niri;
@@ -868,7 +868,6 @@ impl Tty {
&mut self,
niri: &mut Niri,
output: &Output,
- elements: &[OutputRenderElements<GlesRenderer>],
target_presentation_time: Duration,
) -> RenderResult {
let span = tracy_client::span!("Tty::render");
@@ -880,6 +879,11 @@ impl Tty {
return rv;
};
+ if !device.drm.is_active() {
+ warn!("device is inactive");
+ return rv;
+ }
+
let tty_state: &TtyOutputState = output.user_data().get().unwrap();
let Some(surface) = device.surfaces.get_mut(&tty_state.crtc) else {
error!("missing surface");
@@ -888,9 +892,14 @@ impl Tty {
span.emit_text(&surface.name);
+ let renderer = &mut device.gles;
+
+ // Render the elements.
+ let elements = niri.render(renderer, output, true);
+
+ // Hand them over to the DRM.
let drm_compositor = &mut surface.compositor;
- match drm_compositor.render_frame::<_, _, GlesTexture>(&mut device.gles, elements, [0.; 4])
- {
+ match drm_compositor.render_frame::<_, _, GlesTexture>(renderer, &elements, [0.; 4]) {
Ok(res) => {
if self
.config
@@ -995,14 +1004,6 @@ impl Tty {
self.output_device.as_ref().map(|d| d.gbm.clone())
}
- pub fn is_active(&self) -> bool {
- let Some(device) = &self.output_device else {
- return false;
- };
-
- device.drm.is_active()
- }
-
pub fn set_monitors_active(&self, active: bool) {
let Some(device) = &self.output_device else {
return;