From 3d6bc996cac73e1ba9a7093cd93730c2db6c9ba9 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Thu, 14 Sep 2023 22:33:49 +0400 Subject: Disable ColorTransformations, add debug flag to enable Speeds up the rendering slightly, doesn't seem to cause issues? --- src/backend/tty.rs | 22 ++++++++++++++++------ src/config.rs | 3 +++ 2 files changed, 19 insertions(+), 6 deletions(-) (limited to 'src') 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, } } } -- cgit