aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2023-09-14 22:33:49 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2023-09-14 22:43:24 +0400
commit3d6bc996cac73e1ba9a7093cd93730c2db6c9ba9 (patch)
treefb3e44e0b4e246c80756d0b7acca6039b3ceb130 /src
parent89f9e11f65d00290029e9fb1719f2165de5e8006 (diff)
downloadniri-3d6bc996cac73e1ba9a7093cd93730c2db6c9ba9.tar.gz
niri-3d6bc996cac73e1ba9a7093cd93730c2db6c9ba9.tar.bz2
niri-3d6bc996cac73e1ba9a7093cd93730c2db6c9ba9.zip
Disable ColorTransformations, add debug flag to enable
Speeds up the rendering slightly, doesn't seem to cause issues?
Diffstat (limited to 'src')
-rw-r--r--src/backend/tty.rs22
-rw-r--r--src/config.rs3
2 files changed, 19 insertions, 6 deletions
diff --git a/src/backend/tty.rs b/src/backend/tty.rs
index 2fd17eca..7ac63422 100644
--- a/src/backend/tty.rs
+++ b/src/backend/tty.rs
@@ -14,7 +14,7 @@ use smithay::backend::drm::compositor::{DrmCompositor, PrimaryPlaneElement};
use smithay::backend::drm::{DrmDevice, DrmDeviceFd, DrmEvent, DrmEventTime};
use smithay::backend::egl::{EGLContext, EGLDisplay};
use smithay::backend::libinput::{LibinputInputBackend, LibinputSessionInterface};
-use smithay::backend::renderer::gles::{GlesRenderer, GlesTexture};
+use smithay::backend::renderer::gles::{GlesRenderer, GlesTexture, Capability};
use smithay::backend::renderer::{Bind, DebugFlags, ImportDma, ImportEgl};
use smithay::backend::session::libseat::LibSeatSession;
use smithay::backend::session::{Event as SessionEvent, Session};
@@ -281,11 +281,21 @@ impl Tty {
let display = EGLDisplay::new(gbm.clone())?;
let egl_context = EGLContext::new(&display)?;
- // let capabilities = unsafe { GlesRenderer::supported_capabilities(&egl_context) }?
- // .into_iter()
- // .filter(|c| *c != Capability::ColorTransformations);
- // let mut gles = unsafe { GlesRenderer::with_capabilities(egl_context, capabilities)? };
- let mut gles = unsafe { GlesRenderer::new(egl_context)? };
+ // ColorTransformations is disabled by default as it makes rendering slightly slower.
+ let mut gles = if self
+ .config
+ .borrow()
+ .debug
+ .enable_color_transformations_capability
+ {
+ unsafe { GlesRenderer::new(egl_context)? }
+ } else {
+ let capabilities = unsafe { GlesRenderer::supported_capabilities(&egl_context) }?
+ .into_iter()
+ .filter(|c| *c != Capability::ColorTransformations);
+ unsafe { GlesRenderer::with_capabilities(egl_context, capabilities)? }
+ };
+
gles.bind_wl_display(&niri.display_handle)?;
let token = niri
diff --git a/src/config.rs b/src/config.rs
index d309e23c..16a831e1 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -132,6 +132,8 @@ pub struct DebugConfig {
pub screen_cast_in_non_session_instances: bool,
#[knuffel(child)]
pub wait_for_frame_completion_before_queueing: bool,
+ #[knuffel(child)]
+ pub enable_color_transformations_capability: bool,
}
impl Default for DebugConfig {
@@ -140,6 +142,7 @@ impl Default for DebugConfig {
animation_slowdown: 1.,
screen_cast_in_non_session_instances: false,
wait_for_frame_completion_before_queueing: false,
+ enable_color_transformations_capability: false,
}
}
}