Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LinuxKMS: Add support for the Slint software renderer #4334

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

tronical
Copy link
Member

No description provided.

Copy link
Member

@ogoffart ogoffart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As seen in the CI result, the screenshot test need to be adjusted for the change of rotation direction. (by swapping Rotate90 and rotate 270 in the test


let renderer = Box::new(Self { renderer: SoftwareRenderer::new(), display, size });

eprintln!("Using Software renderer");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leftover?

Copy link
Member Author

@tronical tronical Jun 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentional , all the renderers currently print when they’re in use.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. Althoug they probably shouldn't in a production binary. (it would be shown with the FPS env variable, right?)

&self,
buffer: &mut [impl TargetPixel],
pixel_stride: usize,
post_render_callback: Option<&dyn Fn(&mut dyn ItemRenderer)>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of having that in the pubic API (even if hidden) of the software renderer.
Also because we will never end up "stabilizing" this since it uses the ItemRenderer which is even more private.

I'd prefer if you would just blit the pixel manually in linuxkms on top of the surface.

The alternative would be to move the cursor handling in i-slint-core and having it as an Image{} item on top of the scene. I think this may be usefull for other backend too such as the uefi.

Otherwise if you don't have time for that, please add an InternalToken parameter to be sure.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I'll try the approach with an Image on top, wrapped in a hand-written ItemTree and rendered inline like an inline popup on top of the scene, using the slice passed to draw_contents.

@tronical
Copy link
Member Author

Pushed only the CI fix. The cursor drawing is not implemented yet, but I'd like to do that in this PR. I don't want to add more technical debt than absolutely necessary.

@@ -0,0 +1,144 @@
// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[xtask license_header] reported by reviewdog 🐶

Suggested change
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0

@ogoffart
Copy link
Member

ogoffart commented Jun 6, 2024

The reason not to merge that is the mouse cursor API, right?

I suggest, to avoid further bitrot, to take the mouse cursor out for now, and merge it with that limitation. (i'd assume this is meant to be used with touchscreen anyway that don't have mouse)

@tronical
Copy link
Member Author

tronical commented Jun 6, 2024

That sounds good to me. I’ll remove those bits.

Comment on lines +120 to +124
let cursor_rect = LogicalRect::new(
euclid::point2(mouse_position.x, mouse_position.y),
euclid::Size2D::from_untyped(cursor_image.size().cast()),
);
self.renderer.as_core_renderer().mark_dirty_region(cursor_rect.into());
Copy link
Member Author

@tronical tronical Jun 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is harmless, but I can also remove it if desired. It's a no-op as there won't be a mouse with the sw renderer, and otherwise mark_dirty_region is a no-op with the GPU renderers.

But for strictly speaking this is the correct thing to do while we have the code for this approach here (to be removed later with the image we discussed).


#[repr(transparent)]
#[derive(Copy, Clone, bytemuck::Pod, bytemuck::Zeroable)]
struct DumbBufferPixel(pub u32);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't the existing argb8pixel be used?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see an argb8pixel in our code base.

I see these:

  • Rgba8Pixel: TargetPixel is not implemented for it and it's the wrong order. (Softbuffer expects 0RGB)
  • PremultipliedRgbaColor: TargetPixel is implemented for it, but it's the wrong order.

This is basically the same as in commit 46ec787 . If you have a suggestion where it could be shared, then I'm all for it. Should I introduce a "softbuffer-pixel" feature in i-slint-core perhaps? I wonder in which module to place it.


let renderer = Box::new(Self { renderer: SoftwareRenderer::new(), display, size });

eprintln!("Using Software renderer");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. Althoug they probably shouldn't in a production binary. (it would be shown with the FPS env variable, right?)

@@ -20,6 +20,7 @@ renderer-skia = ["renderer-skia-opengl"]
renderer-skia-vulkan = ["i-slint-renderer-skia/vulkan", "vulkano"]
renderer-skia-opengl = ["i-slint-renderer-skia/opengl", "drm", "gbm", "gbm-sys", "glutin", "raw-window-handle"]
renderer-femtovg = ["i-slint-renderer-femtovg", "drm", "gbm", "gbm-sys", "glutin", "raw-window-handle"]
renderer-software = ["i-slint-core/software-renderer-systemfonts", "i-slint-core/software-renderer-rotation", "dep:bytemuck"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enabling rotation here means that the rotation becomes public API if the user enable (public) linuxkms feature of Slint :-(

We have the following option:

  1. don't care and still do breaking change later
  2. stabilize it as it (we can still discuss small changes before the release)
  3. Actually polish the rotation feature sooner
  4. use a different way to gate it to make sure it's not callable without importing i-slint-core directly. (using InternalToken or so)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooops, good point about it becoming public API. That's not intentional in this PR.

It's a bummer, because the feature itself works well (used in mcu as well as here). But we're not sure yet about the exact API, i.e. explicit in SoftwareRenderer as property, as a parameter to render(), or implicit in the Window, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants