OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 10:47 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: How do you change the display mode after enter protect mode
PostPosted: Fri Aug 09, 2019 8:05 am 
Offline

Joined: Fri Nov 23, 2018 10:53 pm
Posts: 22
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.


Top
 Profile  
 
 Post subject: Re: How do you change the display mode after enter protect m
PostPosted: Fri Aug 09, 2019 8:12 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
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.


Top
 Profile  
 
 Post subject: Re: How do you change the display mode after enter protect m
PostPosted: Fri Aug 09, 2019 9:01 am 
Offline
Member
Member

Joined: Thu Aug 13, 2015 4:57 pm
Posts: 384
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.


Top
 Profile  
 
 Post subject: Re: How do you change the display mode after enter protect m
PostPosted: Fri Aug 09, 2019 12:40 pm 
Offline

Joined: Fri Nov 23, 2018 10:53 pm
Posts: 22
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?


Top
 Profile  
 
 Post subject: Re: How do you change the display mode after enter protect m
PostPosted: Fri Aug 09, 2019 12:42 pm 
Offline

Joined: Fri Nov 23, 2018 10:53 pm
Posts: 22
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?


Top
 Profile  
 
 Post subject: Re: How do you change the display mode after enter protect m
PostPosted: Sat Aug 10, 2019 12:53 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
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.


Top
 Profile  
 
 Post subject: Re: How do you change the display mode after enter protect m
PostPosted: Sat Aug 10, 2019 4:02 am 
Offline

Joined: Fri Nov 23, 2018 10:53 pm
Posts: 22
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!


Top
 Profile  
 
 Post subject: Re: How do you change the display mode after enter protect m
PostPosted: Sun Aug 25, 2019 2:09 pm 
Offline
Member
Member
User avatar

Joined: Mon May 22, 2017 5:56 am
Posts: 812
Location: Hyperspace
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:

_________________
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie


Top
 Profile  
 
 Post subject: Re: How do you change the display mode after enter protect m
PostPosted: Sun Aug 25, 2019 7:04 pm 
Offline
Member
Member
User avatar

Joined: Mon Jan 15, 2018 2:27 pm
Posts: 201
To do that you have to make HUUUUGE companies to become user (don't mistake $ for user) friendly.


Top
 Profile  
 
 Post subject: Re: How do you change the display mode after enter protect m
PostPosted: Thu Oct 03, 2019 1:17 am 
Offline

Joined: Tue Mar 20, 2018 9:47 am
Posts: 1
Location: Cairo, Egypt
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 :(


Top
 Profile  
 
 Post subject: Re: How do you change the display mode after enter protect m
PostPosted: Fri Oct 04, 2019 5:28 am 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 1584
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], MichaelPetch and 56 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group