mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-22 02:01:55 +07:00
Make clear color a const
The damage tracker doesn't understand clear color changes.
This commit is contained in:
+2
-2
@@ -39,7 +39,7 @@ use smithay_drm_extras::drm_scanner::{DrmScanEvent, DrmScanner};
|
||||
use smithay_drm_extras::edid::EdidInfo;
|
||||
|
||||
use crate::config::Config;
|
||||
use crate::niri::{OutputRenderElements, State, RedrawState};
|
||||
use crate::niri::{OutputRenderElements, State, RedrawState, CLEAR_COLOR};
|
||||
use crate::utils::get_monotonic_time;
|
||||
use crate::Niri;
|
||||
|
||||
@@ -861,7 +861,7 @@ impl Tty {
|
||||
match drm_compositor.render_frame::<_, _, GlesTexture>(
|
||||
&mut device.gles,
|
||||
elements,
|
||||
niri.clear_color(),
|
||||
CLEAR_COLOR,
|
||||
) {
|
||||
Ok(res) => {
|
||||
if self
|
||||
|
||||
@@ -19,7 +19,7 @@ use smithay::utils::Transform;
|
||||
|
||||
use super::RenderResult;
|
||||
use crate::config::Config;
|
||||
use crate::niri::{OutputRenderElements, RedrawState, State};
|
||||
use crate::niri::{OutputRenderElements, RedrawState, State, CLEAR_COLOR};
|
||||
use crate::utils::get_monotonic_time;
|
||||
use crate::Niri;
|
||||
|
||||
@@ -157,10 +157,9 @@ impl Winit {
|
||||
|
||||
self.backend.bind().unwrap();
|
||||
let age = self.backend.buffer_age().unwrap();
|
||||
let clear_color = niri.clear_color();
|
||||
let res = self
|
||||
.damage_tracker
|
||||
.render_output(self.backend.renderer(), age, elements, clear_color)
|
||||
.render_output(self.backend.renderer(), age, elements, CLEAR_COLOR)
|
||||
.unwrap();
|
||||
|
||||
niri.update_primary_scanout_output(output, &res.states);
|
||||
|
||||
+4
-10
@@ -84,6 +84,8 @@ use crate::layout::{output_size, Layout, MonitorRenderElement};
|
||||
use crate::pw_utils::{Cast, PipeWire};
|
||||
use crate::utils::{center, get_monotonic_time, make_screenshot_path};
|
||||
|
||||
pub const CLEAR_COLOR: [f32; 4] = [0.2, 0.2, 0.2, 1.];
|
||||
|
||||
pub struct Niri {
|
||||
pub config: Rc<RefCell<Config>>,
|
||||
|
||||
@@ -888,10 +890,6 @@ impl Niri {
|
||||
};
|
||||
}
|
||||
|
||||
pub fn clear_color(&self) -> [f32; 4] {
|
||||
[0.1, 0.1, 0.1, 1.0]
|
||||
}
|
||||
|
||||
pub fn pointer_element(
|
||||
&mut self,
|
||||
renderer: &mut GlesRenderer,
|
||||
@@ -1416,7 +1414,6 @@ impl Niri {
|
||||
|
||||
let size = output.current_mode().unwrap().size;
|
||||
let scale = Scale::from(output.current_scale().fractional_scale());
|
||||
let clear_color = self.clear_color();
|
||||
|
||||
for cast in &mut self.casts {
|
||||
if !cast.is_active.get() {
|
||||
@@ -1452,9 +1449,7 @@ impl Niri {
|
||||
let dmabuf = cast.dmabufs.borrow()[&fd].clone();
|
||||
|
||||
// FIXME: Hidden / embedded / metadata cursor
|
||||
if let Err(err) =
|
||||
render_to_dmabuf(renderer, dmabuf, size, scale, clear_color, elements)
|
||||
{
|
||||
if let Err(err) = render_to_dmabuf(renderer, dmabuf, size, scale, elements) {
|
||||
error!("error rendering to dmabuf: {err:?}");
|
||||
continue;
|
||||
}
|
||||
@@ -1737,7 +1732,6 @@ fn render_to_dmabuf(
|
||||
dmabuf: smithay::backend::allocator::dmabuf::Dmabuf,
|
||||
size: Size<i32, Physical>,
|
||||
scale: Scale<f64>,
|
||||
clear_color: [f32; 4],
|
||||
elements: &[OutputRenderElements<GlesRenderer>],
|
||||
) -> anyhow::Result<()> {
|
||||
use smithay::backend::renderer::element::Element;
|
||||
@@ -1752,7 +1746,7 @@ fn render_to_dmabuf(
|
||||
.context("error starting frame")?;
|
||||
|
||||
frame
|
||||
.clear(clear_color, &[output_rect])
|
||||
.clear(CLEAR_COLOR, &[output_rect])
|
||||
.context("error clearing")?;
|
||||
|
||||
for element in elements.iter().rev() {
|
||||
|
||||
Reference in New Issue
Block a user