Description
We already have simpledrm for firmware framebuffers. But the driver is originally for ARM boards, not PCs. It is already overloaded with code to support both use cases. At the same time it is missing possible features for VESA and EFI, such as palette modes or EDID support. We should have DRM drivers for VESA and EFI interfaces. The infrastructure exists already and initial drivers can be forked from simpledrm.
Goals
- Initially, a bare driver for VESA or EFI should be created. It can take functionality from simpledrm.
- Then we can begin to add additional features. The boot loader can provide EDID data. With VGA hardware, VESA can support paletted modes or color management. Example code exists in vesafb.
This project is part of:
Hack Week 24
Activity
Comments
-
about 1 year ago by tdz | Reply
Day 1: I forked of simpledrm into a new vesadrm driver. This immediately works well on non-EFI PC hardware. I further added support for EDID information. This data has to be provided by the boot loader. There's already a field in Linux's boot parameters. It is not set by grub. So a patch there seems required.
See: https://gitlab.suse.de/tzimmermann/linux/-/commits/vesadrm-day1
-
about 1 year ago by tdz | Reply
Day 2: With vesadrm in place and the EDID property attached, it was time to fill it with data. As mentioned, there's already such a field in the kernel's boot params on x86. It has never been used; or at least i could not find any related code in grub2, grub(-legacy) or even LiLo.
But grub2 already reads out the EDID for its graphics backends. And all we have to do is to copy is to the Linux boot parameters. We cannot transfer EDID extension headers, so we have to clear the extension field. Still, the result is EDID data for the firmware drivers. A patch for grub2 is on OBS at https://build.opensuse.org/package/show/home:tdz:branches:Base:System/grub2.
Here's a screenshot of my test system's GNOME, where it correctly names the monitor from the provided data.
This was on Wayland. I also have a patch pending for Xorg, so that it accepts vesadrm as driver.
Overall, this project is going nicely and I'm very happy with the progress being made.
See: https://gitlab.suse.de/tzimmermann/linux/-/commits/vesadrm-day2
-
about 1 year ago by tdz | Reply
Day 3: EDID support in vesadrm works well the patched grub2. So today I worked on support for color LUTs. On VGA hardware, it is possible to write the VGA color LUT behind the back of the VESA interface. VESA even tells us if it runs on VGA-compatible hardware. Linux' existing vesafb driver contains example code to do this. If set up, pixels in framebuffer memory will be look into the VGA color LUT during scanout to produce the actual output color.
With this in place, vesadrm now sets up a gamma-LUT property for userspace. Compositors can load gamma tables into the property and vesadrm programs them to VGA. Combined with the EDID data, this enables simple SDR color management. GNOME also implements 'night mode' via gamma luts. When I tested, this now works nicely with vesadrm.
See: https://gitlab.suse.de/tzimmermann/linux/-/commits/vesadrm-day3
-
about 1 year ago by tdz | Reply
Day 4: The gamma LUT also serves as the color look-up table for color-index modes. Getting DRM format C8 done was the topic of day 4. C8 is a palette mode with 8 bits per pixel. The value is the index into the color LUT. The LUT itself is again in the VGA hardware. C8 is supported by fbcon, so I could wire-up everything directly. When grub programs the mode and runs the kernel, vesadrm now displayes the console correctly. Before day 4, vesadrm would have simply refused to probe.
Compositors don't support C8 (X11 window managers did in the early 90s, but that likely don't count today.) Instead they want XRGB8888. Vesadrm also emulates this via the color LUT. The compositor's framebuffer is in XRGB8888 format, which vesadrm transforms to RGB332 during screen updates. RGB332 is 3 bits of red, 3 bits of green and 2 bits of blue; all packed into a single byte. With the hardware programmed to C8, that byte is the index into the color LUT, which vesadrm programs to RGB666 values that VGA requires. This process is called dithering and transforms the compositor's 24-bit RGB output into an 256-color output on the display.
A photo of the output of my test system is here. This is Firefox on GNOME ruining at 800x600 with 256 colors. While not exactly pretty, it is fast and usable. The desktop UI elements are fairly close to their expected colors. Graphics with higher fidelity, such as the picture on that opened website, show significant distortion.
See: https://gitlab.suse.de/tzimmermann/linux/-/commits/vesadrm-day4
-
about 1 year ago by tdz | Reply
Summary: I'm really happy how this project turned out. With some polish, everything up-to-and-including day 3 has the potential to go upstream as new driver. That would give a vesadrm driver similar to simpledrm, but with EDID and color management. Support for color-index modes could be added later. There, it would make sense to add additional modes, such as C4, C2, and C1. A bit more work would be required in the DRM framework work support that. Not only would that enable support for really low-end PC hardware, but it would also give an easily available (via qemu) testbed for these low-end features. Some of them are required by today's LCD display, which can be hard to obtain.
For a possible efidrm, it would be a fork of vesadrm up-to-and-including day 2. That is simpledrm plus EDID support. Seems simple enough. AFAICT grub can also provide EDID data from EFI on x86. On non-x86, the kernel would have to fetch it by itself from the EFI firmware.
-
about 1 year ago by Pharaoh_Atem | Reply
This is awesome! Do you know when you'll submit it to be included upstream?
-
Similar Projects
Improve UML page fault handler by ptesarik
Description
Improve UML handling of segmentation faults in kernel mode. Although such page faults are generally caused by a kernel bug, it is annoying if they cause an infinite loop, or panic the kernel. More importantly, a robust implementation allows to write KUnit tests for various guard pages, preventing potential kernel self-protection regressions.
Goals
Convert the UML page fault handler to use oops_* helpers, go through a few review rounds and finally get my patch series merged in 6.14.
Resources
Wrong initial attempt: https://lore.kernel.org/lkml/20231215121431.680-1-petrtesarik@huaweicloud.com/T/
Add Qualcomm Snapdragon 765G (SM7250) basic device tree to mainline linux kernel by pvorel
Qualcomm Snapdragon 765G (SM7250) (smartphone SoC) has no support in the linux kernel, nor in u-boot. Try to add basic device tree support. The hardest part will be to create boot.img which will be accepted by phone.
UART is available for smartphone :).
early stage kdump support by mbrugger
Project Description
When we experience a early boot crash, we are not able to analyze the kernel dump, as user-space wasn't able to load the crash system. The idea is to make the crash system compiled into the host kernel (think of initramfs) so that we can create a kernel dump really early in the boot process.
Goal for the Hackweeks
- Investigate if this is possible and the implications it would have (done in HW21)
- Hack up a PoC (done in HW22 and HW23)
- Prepare RFC series (giving it's only one week, we are entering wishful thinking territory here).
update HW23
- I was able to include the crash kernel into the kernel Image.
- I'll need to find a way to load that from
init/main.c:start_kernel()probably afterkcsan_init() - I workaround for a smoke test was to hack
kexec_file_load()systemcall which has two problems:- My initramfs in the porduction kernel does not have a new enough kexec version, that's not a blocker but where the week ended
- As the crash kernel is part of init.data it will be already stale once I can call
kexec_file_load()from user-space.
The solution is probably to rewrite the POC so that the invocation can be done from init.text (that's my theory) but I'm not sure if I can reuse the kexec infrastructure in the kernel from there, which I rely on heavily.
update HW24
- Day1
- rebased on v6.12 with no problems others then me breaking the config
- setting up a new compilation and qemu/virtme env
- getting desperate as nothing works that used to work
- Day 2
- getting to call the invocation of loading the early kernel from
__initafterkcsan_init()
- getting to call the invocation of loading the early kernel from
Day 3
- fix problem of memdup not being able to alloc so much memory... use 64K page sizes for now
- code refactoring
- I'm now able to load the crash kernel
- When using virtme I can boot into the crash kernel, also it doesn't boot completely (major milestone!), crash in
elfcorehdr_read_notes()
Day 4
- crash systems crashes (no pun intended) in
copy_old_mempage()link; will need to understand elfcorehdr... - call path
vmcore_init() -> parse_crash_elf_headers() -> elfcorehdr_read() -> read_from_oldmem() -> copy_oldmem_page() -> copy_to_iter()
- crash systems crashes (no pun intended) in
Day 5
- hacking
arch/arm64/kernel/crash_dump.c:copy_old_mempage()to see if crash system really starts. It does. - fun fact: retested with more reserved memory and with UEFI FW, host kernel crashes in init but directly starts the crash kernel, so it works (somehow) \o/
- hacking
update HW25
- Day 1
- rebased crash-kernel on v6.12.59 (for now), still crashing
dynticks-testing: analyse perf / trace-cmd output and aggregate data by m.crivellari
Description
dynticks-testing is a project started years ago by Frederic Weisbecker. One of the feature is to check the actual configuration (isolcpus, irqaffinity etc etc) and give feedback on it.
An important goal of this tool is to parse the output of trace-cmd / perf and provide more readable data, showing the duration of every events grouped by PID (showing also the CPU number, if the tasks has been migrated etc).
An example of data captured on my laptop (incomplete!!):
-0 [005] dN.2. 20310.270699: sched_wakeup: WaylandProxy:46380 [120] CPU:005
-0 [005] d..2. 20310.270702: sched_switch: swapper/5:0 [120] R ==> WaylandProxy:46380 [120]
...
WaylandProxy-46380 [004] d..2. 20310.295397: sched_switch: WaylandProxy:46380 [120] S ==> swapper/4:0 [120]
-0 [006] d..2. 20310.295397: sched_switch: swapper/6:0 [120] R ==> firefox:46373 [120]
firefox-46373 [006] d..2. 20310.295408: sched_switch: firefox:46373 [120] S ==> swapper/6:0 [120]
-0 [004] dN.2. 20310.295466: sched_wakeup: WaylandProxy:46380 [120] CPU:004
Output of noise_parse.py:
Task: WaylandProxy Pid: 46380 cpus: {4, 5} (Migrated!!!)
Wakeup Latency Nr: 24 Duration: 89
Sched switch: kworker/12:2 Nr: 1 Duration: 6
My first contribution is around Nov. 2024!
Goals
- add more features (eg cpuset)
- test / bugfix
Resources
- Frederic's public repository: https://git.kernel.org/pub/scm/linux/kernel/git/frederic/dynticks-testing.git/
- https://docs.kernel.org/timers/no_hz.html#testing
Progresses
isolcpus and cpusets implemented and merged in master: dynticks-testing.git commit
Backporting patches using LLM by jankara
Description
Backporting Linux kernel fixes (either for CVE issues or as part of general git-fixes workflow) is boring and mostly mechanical work (dealing with changes in context, renamed variables, new helper functions etc.). The idea of this project is to explore usage of LLM for backporting Linux kernel commits to SUSE kernels using LLM.
Goals
- Create safe environment allowing LLM to run and backport patches without exposing the whole filesystem to it (for privacy and security reasons).
- Write prompt that will guide LLM through the backporting process. Fine tune it based on experimental results.
- Explore success rate of LLMs when backporting various patches.
Resources
- Docker
- Gemini CLI
Repository
Current version of the container with some instructions for use are at: https://gitlab.suse.de/jankara/gemini-cli-backporter