Page 1 of 2

High Performance Graphics Driver for most devices

Posted: Tue Aug 16, 2022 1:00 pm
by devc1
I see that Windows & Linux will not boot if they have not a basic display driver for the GPU, for a Windows VM you must run QEMU with virt-io GPU to work, otherwise windows will not boot. Is there any way windows has a driver that works on most NVIDIA/AMD/INTEL GPUs before the official driver is downloaded. Because windows & linux graphics are always fast without drivers (And it is acheived because they do not use GOP or VESA).
- Is there any specification to make drivers that work on most GPUs (I use SSE & AVX for some optimization but it does not the trick)
- Fancy effects require high performance graphics, or we will be stuck there for an hour

Re: High Performance Graphics Driver for most devices

Posted: Tue Aug 16, 2022 1:40 pm
by Octocontrabass
They use VBE and GOP. Failing to boot in QEMU means the firmware you're using in QEMU doesn't provide any usable video modes.

They also use cache control mechanisms like MTRRs or PAT to make the framebuffer write-combining.

Re: High Performance Graphics Driver for most devices

Posted: Tue Aug 16, 2022 2:44 pm
by devc1
I run my OS normally with Both VESA & GOP with almost any QEMU gpu, but Windows runs only when I specify virt-io GPU because it has its driver, otherwise it will be stuck on the loading screen (Not a black screen) Windows normally uses VESA or GOP at startup but then loads a display adapter or High Performance GPU Driver.

My Main Question is : Is there any specification or way to make a basic display driver for accelerated graphics running on most GPU hardware or a specific family of GPUs ?

Re: High Performance Graphics Driver for most devices

Posted: Tue Aug 16, 2022 3:05 pm
by Gigasoft
There is not. A tip for increasing the performance when moving windows, scrolling and alpha blending when no acceleration is present is to perform all drawing in system memory and keep a copy around for later, so that you do not have to read from video memory.

Re: High Performance Graphics Driver for most devices

Posted: Tue Aug 16, 2022 3:42 pm
by devc1
Are you sure, how can these operating systems use (and force) hardware acceleration no matter what GPU you put on them ?? (I am not interested in changing the resolution and 3d acceleration) I just want an accelerated frame buffer driver and the 3d things can be done in CPU.

Re: High Performance Graphics Driver for most devices

Posted: Tue Aug 16, 2022 3:50 pm
by Octocontrabass
They're not using any hardware acceleration. They use the ordinary GOP or VBE framebuffer with write combining.

Re: High Performance Graphics Driver for most devices

Posted: Tue Aug 16, 2022 7:48 pm
by devc1
You may be right, but I tried it. With my OS (in my current pc), I also use write combining, AVX to clear the screen multiple times and I don't see anything near the 60 FPS. Windows with 1% Processor usage on each processes it keeps up with a smooth 60 fps in my Nvidia GPU (Quadro 2000) without its driver, it says (Basic Display Adapter) and thats's what I wan't to understand.

---------------

Fun Fact : In my old laptop, I enumerated the GPU (I remember intel g45) and found some BAR starting at like 0xC00000000 and Another BAR. I tried to search specification and I found nothing, tried to write to the first BAR and nothing, then spammed 0xFF on the second bar and the screen is just a mess of different colors !

I think there is something universal (not between all GPU but between families of GPUs) because GOP and VESA are really slow and intended for Pre-OS Phase, how SSE will make 60FPS good graphics in an old computer with core 2 duo.

Re: High Performance Graphics Driver for most devices

Posted: Tue Aug 16, 2022 9:29 pm
by Octocontrabass
devc1 wrote:You may be right, but I tried it. With my OS (in my current pc), I also use write combining, AVX to clear the screen multiple times and I don't see anything near the 60 FPS. Windows with 1% Processor usage on each processes it keeps up with a smooth 60 fps in my Nvidia GPU (Quadro 2000) without its driver, it says (Basic Display Adapter) and thats's what I wan't to understand.
Is Windows clearing the whole screen? It takes less time to update less of the screen.

Are you doing anything that can hurt write-combining performance? For example, you should write the entire framebuffer sequentially - or at least the parts you want to update - and you shouldn't read the framebuffer or access any uncached memory, MMIO, or I/O ports.

Are you using AVX correctly? Mixing AVX and SSE will hurt performance if you do it incorrectly. Using AVX at all can also reduce the CPU frequency, which could potentially hurt performance if you're not executing very many AVX instructions.
devc1 wrote:Fun Fact : In my old laptop, I enumerated the GPU (I remember intel g45) and found some BAR starting at like 0xC00000000 and Another BAR. I tried to search specification and I found nothing, tried to write to the first BAR and nothing, then spammed 0xFF on the second bar and the screen is just a mess of different colors !
Here are the manuals. It's hard to say what happened without knowing which MMIO range you were accessing.
devc1 wrote:I think there is something universal (not between all GPU but between families of GPUs) because GOP and VESA are really slow and intended for Pre-OS Phase, how SSE will make 60FPS good graphics in an old computer with core 2 duo.
There isn't anything like that.

Re: High Performance Graphics Driver for most devices

Posted: Tue Aug 16, 2022 9:39 pm
by klange
There is nothing more universal than a linear framebuffer. VBE did support some blit operations, but the interface for them is clunky, and with GOP they're gone completely.
AVX to clear the screen multiple times
How are you observing frame rates if all you're doing is clearing the screen? Also, using AVX for this may be part of your problem - are you sure your AVX instructions aren't trying to read data from the framebuffer?

I have no accelerated graphics drivers. I only have a basic modesetting driver for very specific Intel cards so my laptop can use its native panel resolution - and it continues to use the framebuffer address originally configured by VESA. I have no trouble rendering my alpha-composited windowing environment, complete with animations and even some blurring effects, entirely in software, on a wide range of hardware (including tolerable performance in QEMU's TCG software emulation). I don't even use many tricks - simple scanline-based dirty regions, and a bit of SSE2-accelerated alpha blending (obviously only on x86, and my pure software alpha blitter seems to be faster on aarch64 anyway!).

If you're sure you're configuring memory correctly, and you're not hitting common pitfalls like trying to read from video memory, there could be any number of other contributing factors in poor performance - did you request a color depth the GPU emulates rather than supporting natively, did you request a resolution that the GPU uses a fallback path to scale (common in laptops), do you have an interrupt storm hogging all of your CPU resources?

Re: High Performance Graphics Driver for most devices

Posted: Wed Aug 17, 2022 6:24 am
by Gigasoft
Are you sure that Windows did not automatically find a driver? What does Device Manager say?

Re: High Performance Graphics Driver for most devices

Posted: Wed Aug 17, 2022 3:39 pm
by devc1
I agree now, and Thanks for giving me the specification. I am excited to implement it on my laptop !
You guys mean by Write combining that in the Page Tables you set "Write-Through" Bit ? (Thats what I do)
I have a problem now so I can't really test on my current pc (with AVX), the problem is that UEFI EDK2 is no more compiling the "build" command doesn't appear even after doing the "source edksetup.sh" thing, I'll fix that later.
Ahhh I think I have a whole in my memory now I remember! I cleared the screen with AVX from 0 to 0xFF shades of white and it took (maybe) less than a second! Sorry guys.
Yes, you guys are right AVX & SSE Will do the job !

How u found that specification I couldn't do it lol!

Re: High Performance Graphics Driver for most devices

Posted: Wed Aug 17, 2022 3:59 pm
by devc1
Can u find a specification for "Nvidia QUADRO 2000" Please ! This is the GPU of my current Desktop

Re: High Performance Graphics Driver for most devices

Posted: Wed Aug 17, 2022 4:39 pm
by Octocontrabass
devc1 wrote:You guys mean by Write combining that in the Page Tables you set "Write-Through" Bit ? (Thats what I do)
No. Write-combining and write-through are two different cache configurations. You need to use MTRRs or the PAT to set up write-combining.
devc1 wrote:How u found that specification I couldn't do it lol!
I went to 01.org and clicked on "documentation". I tried searching for it but Intel calls it a "programmer's reference manual" and I was searching for things like datasheets and specifications (which I did find, but those documents didn't have any information about the GPU).
devc1 wrote:Can u find a specification for "Nvidia QUADRO 2000" Please ! This is the GPU of my current Desktop
Unfortunately, Nvidia has not published complete documentation for Fermi GPUs. You can find the pieces they have published here.

Re: High Performance Graphics Driver for most devices

Posted: Thu Aug 18, 2022 6:45 pm
by devc1
Millions thanks for you, you save my O.S everytime !

Re: High Performance Graphics Driver for most devices

Posted: Fri Aug 19, 2022 11:01 am
by devc1
One Last Question, is the Page Attribute Table (PAT) available on all x64 Processors ?