News for hackers. Stuff that matters.
Re:The AMD Radeon Graphics Driver Makes Up Roughly 10.5% of ... by m463 on Monday October 12, 2020 @01:41AM (#24751713)
I would also mention that gpus are a GIANT abstraction, and since they are rev'd faster than arguably any hardware in a sytem, there are abstractions layered on top of that for the families and models of gpus too.

Another way of looking at it is -- I started playing with openwrt for a relatively small router, with 5 ports plus wifi.

I was amazed at not only the amount of openwrt code required to support the different router families and the different router models, but at the sheer amount of stuff turned on by default in the kernel just in case I might need to load a module for some obscure feature or package. I assume the same goes for a gpu driver both at the source level and in the kernel.

Re:The AMD Radeon Graphics Driver Makes Up Roughly 10.5% of ... by andromeduck on Monday October 12, 2020 @01:45AM (#24751726)
Yeah AMD/NV typically do 2-3 chips per year. That complexity adds up pretty quickly when backwards/forwards compatibility is fairly strict and the inputs/abstractions not particularly well defined or behaved.
Re:The AMD Radeon Graphics Driver Makes Up Roughly 10.5% of ... by simfoo on Monday October 12, 2020 @02:32AM (#24751944)
I'm wondering at which point it would make sense to split the driver into multiple device family drivers instead of lumping it all together into a mess of unmaintainable abstractions.
Re:The AMD Radeon Graphics Driver Makes Up Roughly 10.5% of ... by inopinatus on Monday October 12, 2020 @10:14AM (#24754511)
At the point where people are making jokes about the Linux kernel making up X% of the GPU driver.
Re:The AMD Radeon Graphics Driver Makes Up Roughly 10.5% of ... by rurban on Monday October 12, 2020 @02:58AM (#24752069)
The opposite. The lack of abstractions, mere industrial copy pasta code is the problem.
Re:The AMD Radeon Graphics Driver Makes Up Roughly 10.5% of ... by andy_ppp on Monday October 12, 2020 @03:55AM (#24752323)
I’m not saying it’s true here but duplication over the wrong abstraction is always better. Seems to me if each graphics card is different enough there’s probably lots to duplicate.
Re:The AMD Radeon Graphics Driver Makes Up Roughly 10.5% of ... by VBprogrammer on Monday October 12, 2020 @05:08AM (#24752644)
In software development absolutes are always dangerous.
Re:The AMD Radeon Graphics Driver Makes Up Roughly 10.5% of ... by andy_ppp on Monday October 12, 2020 @05:19AM (#24752702)
Apart from absolutes about absolutes.
Re:The AMD Radeon Graphics Driver Makes Up Roughly 10.5% of ... by rurban on Thursday October 15, 2020 @06:19AM (#24786905)
Nonsense. This duplication is not maintainable and needs massive amounts of memory. Proper abstraction adds a few if else in the data, and is about 20x smaller. You can even read and understand that, e.g. what changed with this HW upgrade. No chance with duplicated blobs of structs and enums.
Re:The AMD Radeon Graphics Driver Makes Up Roughly 10.5% of ... by andy_ppp on Thursday October 15, 2020 @08:39AM (#24787943)
> I’m not saying it’s true

Yes, I did caveat my suggestion. Why not submit a fix if it's so simple ;-)

Re:The AMD Radeon Graphics Driver Makes Up Roughly 10.5% of ... by mrweasel on Monday October 12, 2020 @06:36AM (#24753079)
If the Radeon driver is in the kernel now, then maybe at some point someone other than AMD will pick it up and start cleaning up excessive copy paste code.

Assuming they play nice with the community, it could be a huge benefit to AMD in the long run.

Still, 2 million lines is a massive amount of code to start working on.

Re:The AMD Radeon Graphics Driver Makes Up Roughly 10.5% of ... by samus on Thursday October 15, 2020 @01:54AM (#24785313)
Unlikely, unless that entity has all the supported hardware at hand and ready for automated tests. Refactoring without a thorough test harness is ref*toring.
Re:The AMD Radeon Graphics Driver Makes Up Roughly 10.5% of ... by jimmySixDOF on Monday October 12, 2020 @05:35AM (#24752777)
isn't that what Google are hoping to do with Fuchsia to make a next generation of Android that's not dependant on device drivers in the kernel ?
Re:The AMD Radeon Graphics Driver Makes Up Roughly 10.5% of ... by junon on Monday October 12, 2020 @06:45AM (#24753125)
I can't see how they'd be able to achieve that, unless you mean simply that the device drivers would run in userland.
Re:The AMD Radeon Graphics Driver Makes Up Roughly 10.5% of ... by CyberDildonics on Monday October 12, 2020 @10:16AM (#24754537)
Reinventing QNX will always be cutting edge
Re:The AMD Radeon Graphics Driver Makes Up Roughly 10.5% of ... by de_watcher on Monday October 12, 2020 @02:20AM (#24751884)
Are there still workarounds for specific games/programs inside the driver?
Re:The AMD Radeon Graphics Driver Makes Up Roughly 10.5% of ... by Cloudef on Monday October 12, 2020 @06:58AM (#24753185)
You can see all the workaround used in mesa here: https://gitlab.freedesktop.org/mesa/mesa/-/blob/master/src/u...

Propriatery drivers (especially nvidia), most likely has lots of similar game specific workarounds and optimizations (even going as far as overriding shaders in games with better ones they wrote). [1]

1: https://www.gamedev.net/forums/topic/666419-what-are-your-op...

Re:The AMD Radeon Graphics Driver Makes Up Roughly 10.5% of ... by TheFlash on Monday October 12, 2020 @04:26AM (#24752466)
Yes. In fact, that's essentially what the drivers are.
Re:The AMD Radeon Graphics Driver Makes Up Roughly 10.5% of ... by psykotic on Monday October 12, 2020 @04:54AM (#24752567)
Leaving aside arguments about "what the drivers are", the kernel driver being discussed here generally doesn't have or need that kind of thing. The user-space drivers which talk to the kernel drivers are under the Mesa umbrella as part of Gallium for OpenGL and Direct3D support (e.g. https://github.com/mesa3d/mesa/tree/master/src/gallium/drive...) or as a standalone driver for Vulkan support (https://github.com/mesa3d/mesa/tree/master/src/amd/vulkan). That said, I haven't seen many app-specific hacks in the open source drivers, even in the user-space code.

If anyone wants to learn more about lower-level aspects of GPUs, the Vulkan driver code I linked is one of the best places to start. It directly implements the Vulkan API on one end and talks to the kernel drivers on the other end, so it's relatively easy to follow if you're a systems programmer with an API-level understanding of graphics. Just pick a Vulkan function of your choice and start tracing through the code, e.g. vkCmdDraw: https://github.com/mesa3d/mesa/blob/master/src/amd/vulkan/ra.... The Vulkan driver calls into some of the low-level radeonsi code I linked from the Gallium tree but it isn't a Gallium-based driver, so you don't have to deal with those extra layers of abstraction.

Re:The AMD Radeon Graphics Driver Makes Up Roughly 10.5% of ... by account42 on Monday October 12, 2020 @06:44AM (#24753118)
> That said, I haven't seen many app-specific hacks in the open source drivers, even in the user-space code.

They are enabled via driconf [0]. Not nearly as many as what I imagine you'd find in the proprietary Windows drivers though.

[0] https://github.com/mesa3d/mesa/blob/master/src/util/00-mesa-...

Re:The AMD Radeon Graphics Driver Makes Up Roughly 10.5% of ... by Audiophilip on Monday October 12, 2020 @08:45AM (#24753822)