News for hackers. Stuff that matters.
Re:GTK: Introducing Graphics Offload by AshamedCaptain on Saturday November 18, 2023 @08:16AM (#38319188)
To this day, moving a Haiku window under a 5k unaccelerated EFI GOP framebuffer still feels _significantly_ faster than doing the same under Windows 11, and everything KWin's X/Wayland has to offer on the same hardware (AMD Navi 2 GPU).

> BeOS and Haiku allowed exposure to kernel graphics buffers decades ago

In any case, X also allowed this for ages, with XV and XShm and the like. Of course then everyone got rid of this in order to have the GPU in the middle for fancier animations and whatnot, and things went downhill since.

[dead]
Re:GTK: Introducing Graphics Offload by ElectricalUnion on Saturday November 18, 2023 @06:41PM (#38326188)
Hardware acceleration in this case is to draw less power doing day-to-day operations and not melt the user's hand.

In the general case most effective hardware acceleration uses are supposed to increase latency.

Let's take another example for the analogy: you can run your LLM straight in the CPU and it will have awesome latency and very poor throughput; or you can take your sweet time to load the weights into your GPU/NPU/TPU/memory-in-compute device and run it hardware accelerated at lower energy cost and higher throughput.

Re:GTK: Introducing Graphics Offload by play_ac on Saturday November 18, 2023 @09:14AM (#38319820)
>In any case, X also allowed this for ages, with XV and XShm and the like.

No, XShm doesn't do that and the way XV does it is completely dependent on drivers. If you're using Glamour then XV won't use overlays at all. XShm uses a buffer created in CPU memory allocated by the client that the X server then has to copy to the screen.

> Of course then everyone got rid of this in order to have the GPU in the middle for fancier animations

No, for video, the GPU is used in the middle so you can do post-processing without copying everything into main memory and stalling the whole pipeline. I'd like to see an actual benchmark for how a fullscreen 5k video with post-processing plays on Haiku without any hardware acceleration.

Re:GTK: Introducing Graphics Offload by AshamedCaptain on Saturday November 18, 2023 @09:34AM (#38320053)
> XShm uses a buffer created in CPU memory allocated by the client that the X server then has to copy to the screen.

This is completely wrong. The _entire point_ of XShm, as the name implies, is to have _shared memory_ between the client and the X server. And the server controls the card's framebuffer (at least, in traditional X). There's absolutely no copy and that was the entire point of the extension.

(if compositing is enabled, and therefore the GPU is in between, the server eventually has to call texture_from_surface; at that point, whether there is a copy or not depends on the GPU's driver).

You could literally read the PREVIOUS contents of your card's framebuffer by doing XShmGetImage on the root window.

> No, for video, the GPU is used in the middle so you can do post-processing without copying everything into main memory and stalling the whole pipeline.

You can do many types of card-accelerated zero-copy post-processing using XV: colorspace conversion, scaling, etc., which, again, was the point of the extension. At the time, scaling the video in software or even just doing a memory copy per frame would have completely tanked frame rate. How do you think I used Xine to watch DVDs on Pentium II-level hardware? Obviously you cannot put the video in faces of rotating 3D cube, but this is precisely what I call "fancy animations".

Re:GTK: Introducing Graphics Offload by AshamedCaptain on Saturday November 18, 2023 @10:13AM (#38320452)
> XShm uses a buffer created in CPU memory allocated by the client that the X server then has to copy to the screen.

Fair enough. Even with XShmCreatePixmap, you are still never simply mmaping the card's actual entire framebuffer, unlike what BDirectWindow allows (if https://www.haiku-os.org/legacy-docs/benewsletter/Issue3-12.... is to believed, which is closer to something like DGA). In XShm, the server still has to copy your shared memory segment to the actual framebuffer.

(sorry for previous answer here, I misunderstood your comment)

> No, for video, the GPU is used in the middle so you can do post-processing without copying everything into main memory and stalling the whole pipeline.

Depends on what you mean by "post-processing". You can do many types of card-accelerated zero-copy post-processing using XV: colorspace conversion, scaling, etc. At the time, scaling the video in software or even just doing an extra memory copy per frame would have tanked frame rate -- Xine can be used to watch DVDs in PentiumII-level hardware. Obviously you cannot put the video in the faces of rotating 3D cubes, but this is precisely what I call "fancy animations".

[dead]
Re:GTK: Introducing Graphics Offload by AshamedCaptain on Saturday November 18, 2023 @11:16AM (#38321112)
I don't see what you mean by "condescending remarks", but I do think it is stretching it to claim "arbitrary filters" is a "basic feature that a video player is required to support now". As a consumer, I have absolutely _never_ used any such video filters, doubt most consumers are even aware of them, have seen few video players which support them, and most definitely I have no idea what they are in VLC. Do they even enable any video filters by default? The only video filter I have sometimes used is deinterlacing which doesn't really fit well in the GPU rendering pipeline anyway but fits very nicely in fixed hardware. So yes, I hardly see the need to stop using native accelerated video output and fallback to GPU just in case someone wants to use such filters. This is how I end up with a card which consumes 20W just for showing a static desktop on two monitors.

Anyway, discussing about this is besides the point, and forgive me from the rant above.

If you really need GPU video filters then the GPU is obviously going to be the best way to implement them, there's no discussion possible about that. But the entire point of TFA is to (dynamically) go back to a model where the GPU is _not_ in the middle. And that model -- sans GPU -- happens to match what Xv was doing and is actually faster and less power consuming than to always blindly use the GPU which is where we are now post-Xv.