OSDev.org
https://forum.osdev.org/

How do you change the display mode after enter protect mode
https://forum.osdev.org/viewtopic.php?f=1&t=33818
Page 1 of 1

Author:  benji [ Fri Aug 09, 2019 8:05 am ]
Post subject:  How do you change the display mode after enter protect mode

Hello every one. I am a OS developer beginner. As we all know we can change the display mode in real mode(X86) like this
Code:
MOV AL, 0x13
MOV AH, 0x00
INT 0x10

The 0x13 means 24bits color mode in BIOS.
But How to change the display mode after you enter protect mode?
And, How to use the video card(GPU) to display picture on screen quickly?
I really like the beautiful GUI. I'd like to add GUI in my OS.

Author:  Octocontrabass [ Fri Aug 09, 2019 8:12 am ]
Post subject:  Re: How do you change the display mode after enter protect m

Both of those questions have the same answer: write a driver for the video card.

Writing a driver is a lot of work, though, and you need a separate driver for each kind of video card. If you want to make your GUI now and worry about the drivers later, have your bootloader set up a linear frame buffer.

Author:  LtG [ Fri Aug 09, 2019 9:01 am ]
Post subject:  Re: How do you change the display mode after enter protect m

Graphics adapter display pretty pictures.

GPU calculates (renders) those pretty pictures.

If you want GPU support, you need hardware specific drivers, as mentioned.

Switching to LFB is relatively easy (lookup BIOS and VESA, or UEFI).

Simply put, don't change graphics mode after boot, instead choose one during boot, Win95 did that IIRC (you had to boot to change resolution). Realistically, by the time this becomes a problem you're OS has millions of users so then it's not an issue anymore.

As for good graphics, you don't need GPU support for that. Games needs GPU support, but your OS won't support pre-existing games for a long time, and if they ever do, it's likely thru emulation/virtualization, and at that point you can also emulate/virtualize drivers from other OS's.

Fast bitblit is relatively easy, so again, no issues there. You don't have to worry about any of the issues here yet.

Author:  benji [ Fri Aug 09, 2019 12:40 pm ]
Post subject:  Re: How do you change the display mode after enter protect m

Octocontrabass wrote:
Both of those questions have the same answer: write a driver for the video card.

Writing a driver is a lot of work, though, and you need a separate driver for each kind of video card. If you want to make your GUI now and worry about the drivers later, have your bootloader set up a linear frame buffer.

Could you tell me the detials about writing driver and set up the linear frame buffer?

Author:  benji [ Fri Aug 09, 2019 12:42 pm ]
Post subject:  Re: How do you change the display mode after enter protect m

LtG wrote:
Graphics adapter display pretty pictures.

GPU calculates (renders) those pretty pictures.

If you want GPU support, you need hardware specific drivers, as mentioned.

Switching to LFB is relatively easy (lookup BIOS and VESA, or UEFI).

Simply put, don't change graphics mode after boot, instead choose one during boot, Win95 did that IIRC (you had to boot to change resolution). Realistically, by the time this becomes a problem you're OS has millions of users so then it's not an issue anymore.

As for good graphics, you don't need GPU support for that. Games needs GPU support, but your OS won't support pre-existing games for a long time, and if they ever do, it's likely thru emulation/virtualization, and at that point you can also emulate/virtualize drivers from other OS's.

Fast bitblit is relatively easy, so again, no issues there. You don't have to worry about any of the issues here yet.

Could you tell me the details about the vesa?
and How do I use this?

Author:  Octocontrabass [ Sat Aug 10, 2019 12:53 am ]
Post subject:  Re: How do you change the display mode after enter protect m

benji wrote:
Could you tell me the detials about writing driver and set up the linear frame buffer?

To write a driver, find the documentation for the video card you want to write a driver for, then follow that documentation.

Setting up the linear frame buffer depends on the bootloader. If you're using GRUB, set the appropriate bits in your multiboot header and tell GRUB what video mode you would like. If you're writing your own legacy BIOS bootloader, follow the VESA VBE Core specification to set the video mode, and maybe VBE/DDC to detect the attached display. If you're writing your own UEFI bootloader, look for Graphics Output Protocol in the UEFI specification, and maybe Universal Graphics Adapter in the EFI specification if you want to support Apple hardware.

Author:  benji [ Sat Aug 10, 2019 4:02 am ]
Post subject:  Re: How do you change the display mode after enter protect m

Octocontrabass wrote:
benji wrote:
Could you tell me the detials about writing driver and set up the linear frame buffer?

To write a driver, find the documentation for the video card you want to write a driver for, then follow that documentation.

Setting up the linear frame buffer depends on the bootloader. If you're using GRUB, set the appropriate bits in your multiboot header and tell GRUB what video mode you would like. If you're writing your own legacy BIOS bootloader, follow the VESA VBE Core specification to set the video mode, and maybe VBE/DDC to detect the attached display. If you're writing your own UEFI bootloader, look for Graphics Output Protocol in the UEFI specification, and maybe Universal Graphics Adapter in the EFI specification if you want to support Apple hardware.

Yeah, I see. Now I chose the BIOS bootloader. I am going to search they in google later on. But I slightly confuse about these words. I really really want to know those conception like VESA VBE. Could you tell me the relationship between VESA, VGA, framebuffer and video card driver? And If I want to write a video card driver. How do I do? IHow am I start this program (I am a beginner). If I got those conception, I ensure I can finish my job quickly. Thank you so much!

Author:  eekee [ Sun Aug 25, 2019 2:09 pm ]
Post subject:  Re: How do you change the display mode after enter protect m

benji wrote:
Could you tell me the relationship between VESA, VGA, framebuffer and video card driver?

VESA VBE is a crude video card driver in ROM. All it can do is switch resolutions and set up a linear framebuffer. It doesn't provide access to any of the other features of the video card. A linear framebuffer is just a series of memory locations which correspond pixels on the screen. Write to those memory locations and pixels change.

benji wrote:
And If I want to write a video card driver. How do I do? IHow am I start this program (I am a beginner). If I got those conception, I ensure I can finish my job quickly. Thank you so much!

It's up to you to decide how drivers fit into your operating system. A relatively simple way is to build them into your kernel; programs make syscalls which call the functions of your driver.

I think someone already told you how to write a driver. Read the hardware documentation, and see what to do. I will add this: Don't try to understand everything before you start. I tried to understand everything first, and so I made no real progress in 30 years! :lol:

Author:  pvc [ Sun Aug 25, 2019 7:04 pm ]
Post subject:  Re: How do you change the display mode after enter protect m

To do that you have to make HUUUUGE companies to become user (don't mistake $ for user) friendly.

Author:  m7a10a3 [ Thu Oct 03, 2019 1:17 am ]
Post subject:  Re: How do you change the display mode after enter protect m

Quote:
I think someone already told you how to write a driver. Read the hardware documentation, and see what to do. I will add this: Don't try to understand everything before you start. I tried to understand everything first, and so I made no real progress in 30 years! :lol


The same here :(

Author:  bzt [ Fri Oct 04, 2019 5:28 am ]
Post subject:  Re: How do you change the display mode after enter protect m

Hi,

Well, using BIOS assumes you're using VESA too. In the VESA mode description block, there's bit which tells you if the given mode accepts VGA registers. If so, then you can change the resolution using standard VGA IO ports in protected mode. However most VESA modes does not have VGA-compatibility flag set (mostly SVGA modes only, 640x400, 640x480, 800x600, 1024x768 but not higher resolutions), and in those modes writing to VGA IO ports would most likely crash.

Without a VGA compatibility layer, writing a driver is the only option.

Cheers,
bzt

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/