Brendan wrote:I've never seen RGBA for 24bpp - normally there's only RGB, with "8-bit blue byte, then 8-bit green byte, then 8-bit red byte". For 16bpp normally the lowest 5 bits are for blue, then middle 6 bits are green and the highest 5 bits are for red.
In all cases, different video cards are allowed to do anything they like (e.g. 16bpp might be 5 bits for each with a spare bit for padding, or could be BGR instead of RGB, or 2-bits for blue and red with 12 bits for green, or anything else); and you should consult the bit positions and masks that VBE provides. This information should have been kept by the multi-boot boot loader (e.g. the "vbe_mode_info" pointer at offset 76 in the Multiboot information structure should point to the VBE mode info that contains the bit positions and masks that you need to use).
Yeah I know that. All pixel formats are in RGB or BGR or other things but theres no alpha in them.
Thank you for the information
Brendan wrote:They use whatever the firmware provides to set an initial video mode during boot (e.g. VBE for BIOS or GOP/UGA for UEFI), and then start a native video driver for switching video modes after boot.
Note: Writing native video drivers sounds extremely hard; and to be honest it is extremely difficult if you want a full function native video driver. However; native video drivers that are only able to change video modes (and don't support fancy features like hardware mouse pointers, overlays, 2D/3D acceleration, shaders, GPGPU, etc) is probably a lot easier than most people realise.
So they all have native video drivers. How hard is it to write a native video driver to just change the resolution or bit depth? I'm sure I will need it because I will test my kernel on different machines when my memory manager and VFS is finished.
rdos wrote:You could keep more than one copy of the video code at the same time, switching which VBE to switch mode on. So this should not be a problem really. Access to hardware cursor register wouldn't work though (at least not without some substantial hacks).
You mean I cant have a cursor on screen without a native video driver? Or your meaning of hardware cursor is an accelerated cursor?
Antti wrote:My graphics API will be based on something like "DrawLine", "DrawPrimitive", "DrawText", et cetera. I have not designed it yet but it will be resolution-independent and applications will not modify pixels directly. To be realistic, my video driver will need a linear frame buffer. I do not think any other option is realistic for a small hobby OS. As much as I hate the word "hobby"...
However, it looks quite good now. I can get a linear frame buffer either from VBE or from GOP. Because of this, I would say that an extremely wide range of computers is supported. I do not need a driver to set the actual mode because it is already set up for me when the OS starts or the OS will run "headlessly". In my case the video driver is more like a render driver. The only thing the render driver does is to render the content to the linear frame buffer (multiple monitors could be supported also). Of course, this is not very trivial because a set of different pixel formats must be handled and there must good software render functions to draw primitives as efficiently as possible. This design does not prevent using hardware acceleration but I do not think it would become reality.
Too long; did not read? I would be extremely happy if the thing you said about the easiness of changing video modes is true. I am not asking much from the native video driver: just set me a video mode. My render driver would take care of the rest if it got enough information (LFB address, pixel format, etc) from the "low-level" video driver.
Do you think the whole concept of "linear frame buffer" is something that can be relied on like this?
First of all, I've read all your post
My GFX functions take care of all drawing stuff such as drawing or filling boxes or circles and etc
So as you said VBE and GOP will provide everything I need to have a working graphics. But not accelerated
But now my video driver only supports 800x600 24bpp resolution because I've got the graphics in two last days and I will add support for other resolutions later
Brendan wrote:To get decent performance, video code tends to be very carefully designed to suit the specific case - it's a bad idea to adapt someone else's code (designed for a different specific case
Drawing on screen is just copying some bytes to frame buffer. I dont think there should be something faster than doing this
And I'm not using someone else code. The whole video driver is written by me. Not only the video driver, but also all other parts. Except the GDT and IDT and ISR assembly which I've used Bran's Kernel Development code
because I didn't want to mess up with the GDT and IDT shifts. If I do a bit wrong, some unexpected results may happen and I will never find the source of that error