Disable ColorTransformations, add debug flag to enable

Speeds up the rendering slightly, doesn't seem to cause issues?
This commit is contained in:
Ivan Molodetskikh
2023-09-14 22:33:49 +04:00
parent 89f9e11f65
commit 3d6bc996ca
2 changed files with 19 additions and 6 deletions
+16 -6
View File
@@ -14,7 +14,7 @@ use smithay::backend::drm::compositor::{DrmCompositor, PrimaryPlaneElement};
use smithay::backend::drm::{DrmDevice, DrmDeviceFd, DrmEvent, DrmEventTime}; use smithay::backend::drm::{DrmDevice, DrmDeviceFd, DrmEvent, DrmEventTime};
use smithay::backend::egl::{EGLContext, EGLDisplay}; use smithay::backend::egl::{EGLContext, EGLDisplay};
use smithay::backend::libinput::{LibinputInputBackend, LibinputSessionInterface}; 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::renderer::{Bind, DebugFlags, ImportDma, ImportEgl};
use smithay::backend::session::libseat::LibSeatSession; use smithay::backend::session::libseat::LibSeatSession;
use smithay::backend::session::{Event as SessionEvent, Session}; use smithay::backend::session::{Event as SessionEvent, Session};
@@ -281,11 +281,21 @@ impl Tty {
let display = EGLDisplay::new(gbm.clone())?; let display = EGLDisplay::new(gbm.clone())?;
let egl_context = EGLContext::new(&display)?; let egl_context = EGLContext::new(&display)?;
// let capabilities = unsafe { GlesRenderer::supported_capabilities(&egl_context) }? // ColorTransformations is disabled by default as it makes rendering slightly slower.
// .into_iter() let mut gles = if self
// .filter(|c| *c != Capability::ColorTransformations); .config
// let mut gles = unsafe { GlesRenderer::with_capabilities(egl_context, capabilities)? }; .borrow()
let mut gles = unsafe { GlesRenderer::new(egl_context)? }; .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)?; gles.bind_wl_display(&niri.display_handle)?;
let token = niri let token = niri
+3
View File
@@ -132,6 +132,8 @@ pub struct DebugConfig {
pub screen_cast_in_non_session_instances: bool, pub screen_cast_in_non_session_instances: bool,
#[knuffel(child)] #[knuffel(child)]
pub wait_for_frame_completion_before_queueing: bool, pub wait_for_frame_completion_before_queueing: bool,
#[knuffel(child)]
pub enable_color_transformations_capability: bool,
} }
impl Default for DebugConfig { impl Default for DebugConfig {
@@ -140,6 +142,7 @@ impl Default for DebugConfig {
animation_slowdown: 1., animation_slowdown: 1.,
screen_cast_in_non_session_instances: false, screen_cast_in_non_session_instances: false,
wait_for_frame_completion_before_queueing: false, wait_for_frame_completion_before_queueing: false,
enable_color_transformations_capability: false,
} }
} }
} }