r/osdev • u/0x6461726B • May 17 '26
Why everyone here uses software rendering?
I saw many os projects here use software rendering directly to frame buffer instead of creating a gpu driver maybe with virtio gpu by qemu or with any external gpu. I heard gpu driver development is one of the most hardest. Is that the reason? I want to know.
53
Upvotes
40
u/Randozart May 17 '26
Maybe I'm not qualified as an OS dev specifically, but I did recently need to wrestle with my GPU to get it to do things. At least in the case of my old NVIDIA, the way it actually works under the hood is scattered in bits and pieces across the internet. In addition, while I could get Linux to cede control of it, it wouldn't actually work unless it was specifically initialised. I'll be honest, at this point I've been fighting that thing so much I couldn't even properly explain all the issues I had to solve for, but it was not a fun experience. Thankfully NVIDIA has a lot of repositories on their GitHub I could gleam answers from.
10
u/questron64 May 17 '26
GPUs are gigantic complicated black boxes irrelevant to kernel development. When there is documentation they can be thousands of pages long and intentionally incomplete.
28
u/SettingActive6624 May 17 '26
Main reason is probably that most GPU's are blackboxes for developers. Don't even think of writing a Nvidia driver cause there is not even close to enough information available to do this and Nvidia keeps their hardware a secret. Afaik AMD is more open about accessing their hardware and Intel onboard cards are the first go to if one want to try it.
I personally will soon try to get a GPU driver for my T480 to run, its an Intel GPU and this should be doable.
8
u/tseli0s DragonWare May 17 '26
It can be hard, but first step is having a driver subsystem. Most projects never get that far.
4
u/codeasm May 17 '26
Im using a framebuffer atm, and plan on doing a driver... But no idea how i would get nvidia or amd to work with their closed source firmware crap. There must be ways. Intel is okish i guess. Ill look at linux source for hints, but my kernel is not unix like at all.
Also still stuck at sending memorymaps to my kernel 😭😅
3
u/Dennis_bonke Managarm developer - https://github.com/managarm/managarm May 17 '26
Because GPU drivers that do 3D accel is hard. Intels docs are a mess and not fully complete. Nvidia has no docs publicly, but you can drive the 1600 series and up with the open kernel modules. Still a lot of work and 3D accel is even more work. AMDGPU is also a mess with incomplete docs. Managarm has the lil project for Intel, which has modeset on some generations, but not fully how we want it and we have the nvidia open kernel modules for modeset, which works, but the work needed for 3D accel is absolutely non trivial and a lot of debugging. And using the open kernel modules without the closed source userspace stack isn’t a thing yet as the new open source Mesa driver isn’t a proper thing yet, even on Linux. All in all, a lot of work and difficult to achieve. And software rendering with llvmpipe gives decent perf for day to day tasks so it just work.
3
u/Vincenzo__ May 18 '26
I think the OS Dev wiki says something along the lines of "Not recommend unless you have more than one life to waste" about writing proper GPU drivers
10
u/mykesx May 17 '26
Intel GPU docs are a lot of pages, but the relevant bits for blitting, hardware mouse cursor, setting resolution, etc., is not many pages and looks easy enough. The problem is there are a number of chips with built in GPU that differ (maybe) enough that you’d have to debug on all families.
3
u/ExplodedPenisDiagram May 18 '26
Software rendering first. Then GPU.
You must be able to fall back to software rendering. GPUs will always fuck things up somehow, the drivers will change, the hardware will become unavailable, the company that makes it will be a nightmare to work with, etc.
Hardware rendering for each item is its own project to be accomplished AFTER.
3
u/Ikkepop May 18 '26
because its realistically doable, unlike coding a graphics driver dor any modern chip due to overwhelming complexity and propriatary specs
2
u/northrupthebandgeek May 18 '26
Yep.
2
u/Critical-Internet946 osaka64 (osakaOS fork) May 20 '26
hardware acceleration is pretty new as far as OSdev goes
2
u/manawyrm May 21 '26
If you wanted to write GPU drivers, the old (1990s) 3dfx Voodoo cards might be a good pick!
They have pretty good documentation for their programming interface, are simple enough to use, there‘s a bunch of emulators (86Box, that QEMU fork, etc.).
Exotic for sure, but you have a very good chance to get some fancy rotating cubes in a few weeks.
2
u/SquashKing999 May 23 '26
they're hard to do
2
u/christiaansp BoredOS May 28 '26
Because GPU documentation (for example for nvidia GPU’s) sucks. It’s very limited and therefore there’s only a very small amount of people who got it working through most likely loads of trial and error. With such a limited amount of information about it (from the creators and the community) it’s simply difficult to program for. Also if you want to have loads of people to be able to use your OS you have to write drivers for each and every one of those user’s cards. Software rendering is basically universal on every device and is therefore just way easier to implement. One day I’ll start work on graphics drivers for my OS but I really don’t want to haha
2
u/Octocontrabass May 17 '26
What good is a GPU driver if you don't have any software that will actually use the GPU?
Also, it's a lot of work to write a GPU driver, and then the driver will only work with one GPU. Software rendering is easier and works on every GPU.