Contribute
Register

NVIDIA: How-to Get Rid of the Black Border

Status
Not open for further replies.
Joined
Dec 23, 2011
Messages
170
Motherboard
HP ProBook 430 G6
CPU
i5-8265U
Graphics
UHD 620, 1920x1080
Mac
  1. MacBook Pro
Mobile Phone
  1. iOS
[GUIDE] NVIDIA: How-to Get Rid of the Black Border

This topic is about NVIDIA cards, If you have AMD card, check this http://www.tonymacx86.com/general-h...-correct-widescreen-resolution-boot-time.html

What is the Black Border? A picture is better than 1k words:

black-border-jpg.79364


Black border also appears in Windows without nvidia drivers installed. It's because that's a graphical card-specific issue.

win-jpg.79363


Even when I change screen resolution, the size occupied area of the screens does not change, size of border stays constant. That's because VBIOS works in scale mode.

There are three modes supported by nvidia bios:
1) Scale (default). It just stretch image and leave the black border around. No matter what resolution you have it will not affect the size of the border.
2) Centered 1:1 (we will switch to this mode below)
3) Left Corner 1:1

Why does the black border appear?
The video drivers are much complicated in our days and for this reason they need much space to be saved. Also complicated drivers can have bugs and need a way to be updated easily. For these reasons it make sense to save them as driver files instead of putting everything to video card ROM.

There are 5 solutions so far.

Level 0 Solution: Ignore
Just leave everything as is. This black border is not a problem because it will disappear as soon as OS X will load video driver during boot.

Level 1 Solution: Change background color to black like Windows does (Can I boot, Daddy?)

As you probably noticed, starting from Windows XP boot screen always has black background. This way the black border is not visible. Let’s do the same!

Modify the background color:
Code:
sudo perl -pi.bak -e 's;\xff\xff\xff\xbf\xbf\xbf;\xff\xff\xff\x00\x00\x00;g' /boot
(This command will backup file /boot to /boot.bak before patching)
In order this howto not to become a novel, I provided a short command, but you can find more details in http://www.tonymacx86.com/customiza...lack-stretched-boots-no-more-hex-editing.html

Apple logo also could be changed, it is located in /extra/themes/<themename>/boot.png
If you changed logo, ensure that LegacyLogo option is set to “No”, otherwise this file will not be used by chimera.

Here we go:
theme-jpg.79359


Advantages: this approach is safe and border is not longer visible
The disadvantage: Logo is stretched

Level 2 Solution: Unstretch (Don’t hurt me)

WARNING! After you apply this patch, your hard drive will boot only on PCs with Nvidia video card. I guess Intel and AMD will fail boot, but I haven't a chance to give it a shot. Please feel free to leave a comment if you was not scared to try.

The idea of this solution is just to call bios function which will switch video card from stretched to Centered mode:

Code:
    mov ax,4F14h ;VESA VBE OEM function
    mov bl,2     ;Subfunction 02 = Set Panel Expansion/Centering
    mov bh,1     ;00 = Return Current Setting, 01 = Set Centering/Expansion
    mov cx,0001h ;Exp. mode: 00 = Scaled, 01 = Centered 1:1, 02 = Left Corner 1:1
    int 10h      ;call VGA/VBE service

We need to build a custom master boot record (MBR) which will execute this code and write the MBR to disk.

There are two options
a) download binary boot0 attached http://www.tonymacx86.com/attachments/boot0-zip.79365/
b) get source code here http://forge.voodooprojects.org/svn/chameleon/branches/Chimera, apply boot0.patch attached http://www.tonymacx86.com/attachments/center-patch-txt.79362/ and build

Now, when you have boot0, install it:
Code:
sudo dd if=boot0 of=/dev/diskX bs=440 count=1
Unfortunately you can not do this on running Mac OS X, you’ll have to attach your hard drive to another machine to rewrite boot sector.

Before:
before-jpg.79366

After:
after-jpg.79367


We can see that stretching is disabled now.

HINT: if you combine Level 1 and Level 2, you will get a very beautiful black splash screen. Unfortunately I was not able to take good photo using my phone. Professional camera is needed to manage contrast. On this reason I'm pasting a screenshot:

level2-jpg.79370


Advantages:
- image becomes much sharper
- apple logo is not stretched
- works with any operating system: Mac, Linux, Windows, DOS, whatever
- does not require flashing video card
- could be easily undone by reinstalling chimera
Disadvantages:
- possible troubles while booting with non-NVIDIA video card (not tested).

Level 3 Solution (Bring 'em on)
Patch VBIOS in memory.
<Will be described later>

Level 4 Solution (I’m Death incarnate)
Patch Hardware Video Card
<Will be described later>

P.S. Press "Recommend" in the top of this page if this guide helped you ;)
 

Attachments

  • theme.jpg
    theme.jpg
    25.2 KB · Views: 7,319
  • center.patch.txt
    2.1 KB · Views: 711
  • win.jpg
    win.jpg
    119.3 KB · Views: 9,289
  • black-border.jpg
    black-border.jpg
    158 KB · Views: 8,209
  • boot0.zip
    583 bytes · Views: 841
  • before.jpg
    before.jpg
    29 KB · Views: 9,113
  • after.jpg
    after.jpg
    30.8 KB · Views: 7,186
  • level2.jpg
    level2.jpg
    5.9 KB · Views: 8,435
Last edited by a moderator:
I'm nervous to do both step one and two. Can you post commands to undo the changes?
 
dude im so subscribed waiting for step 3 and 4 :D
 
I'm nervous to do both step one and two. Can you post commands to undo the changes?

Good question. I will add undo instructions to the original post. Thanks for the feedback.
 
Yes, and when possible, add level 3 and 4 ;)
I've recently unstretched my video card by flashing the vBIOS and it thankfully went smoothly, but I still don't have the fullscreen bootscreen that I'd like.
keep up the good work man!
 
Ok. I confirm that my ZOTAC GTX 660 2GB ( Non Ti ) has the resolution of 1920x1080 by typing ?video in the latest Chimera bootloader, but the problem is the black boarder still appears in my monitor ( model : Topcon Bravo LED22 ). I wanted to try the level 2 solution but I don't how to install the boot0 file. As you said it can't be installed on a running-Mac so please tell me how to install.I tried to boot to Single-user mode but in vain. I really don't like the black boder, it's ugly. Any other easiest way to install boot0 into my hackintosh drive ?

Edit:
I used another installation method to deal with my problem:
http://www.insanelymac.com/forum/topic/164809-how-to-install-chameleon-manually-v-2-and-v-1/

Your boot0 file fixes my problem, thanks :)
 
Great guide, and it works great when I'm booting directly into Mac. The only problem is that I have my computer set up so that on a normal boot it will chainload chameleon from GRUB, because Linux is my main operating system, and the boot0 file you provided causes an error when applied to the drive with GRUB on it.

Could you maybe upload a GRUB-friendly boot0 file?

Or, even better yet, update levels 3 and 4. I enjoy a good bit of hardware tinkering, and I'm 100% positive that those would solve all of my problems ;)
 
This topic is about NVIDIA cards, If you have AMD card, chech this http://www.tonymacx86.com/general-h...-correct-widescreen-resolution-boot-time.html

What is the Black Border? A picture is better than 1k words:

79364d1389306186-nvidia-how-get-rid-black-border-black-border.jpg


Black border also appears in Windows without nvidia drivers installed. It's because that's a graphical card-specific issue.

79363d1389306177-nvidia-how-get-rid-black-border-win.jpg


Even when I change screen resolution, the size occupied area of the screens does not change, size of border stays constant. That's because VBIOS works in scale mode.

There are three modes supported by nvidia bios:
1) Scale (default). It just stretch image and leave the black border around. No matter what resolution you have it will not affect the size of the border.
2) Centered 1:1 (we will switch to this mode below)
3) Left Corner 1:1

Why does the black border appear?
The video drivers are much complicated in our days and for this reason they need much space to be saved. Also complicated drivers can have bugs and need a way to be updated easily. For these reasons it make sense to save them as driver files instead of putting everything to video card ROM.

There are 5 solutions so far.

Level 0 Solution: Ignore
Just leave everything as is. This black border is not a problem because it will disappear as soon as OS X will load video driver during boot.

Level 1 Solution: Change background color to black like Windows does (Can I boot, Daddy?)

As you probably noticed, starting from Windows XP boot screen always has black background. This way the black border is not visible. Let’s do the same!

Modify the background color:
Code:
sudo perl -pi.bak -e 's;\xff\xff\xff\xbf\xbf\xbf;\xff\xff\xff\x00\x00\x00;g' /boot
In order this howto not to become a novel, I provided a short command, but you can find more details in http://www.tonymacx86.com/customiza...lack-stretched-boots-no-more-hex-editing.html

Apple logo also could be changed, it is located in /extra/themes/<themename>/boot.png
If you changed logo, ensure that LegacyLogo option is set to “No”, otherwise this file will not be used by chimera.

Here we go:
79359d1389305946-nvidia-how-get-rid-black-border-theme.jpg


Advantages: this approach is safe and border is not longer visible
The disadvantage: Logo is stretched

Level 2 Solution: Unstretch (Don’t hurt me)

WARNING! After you apply this patch, your hard drive will boot only on PCs with Nvidia video card. I guess Intel and AMD will fail boot, but I haven't a chance to give it a shot. Please feel free to leave a comment if you was not scared to try.

The idea of this solution is just to call bios function which will switch video card from stretched to Centered mode:

Code:
    mov ax,4F14h ;VESA VBE OEM function
    mov bl,2     ;Subfunction 02 = Set Panel Expansion/Centering
    mov bh,1     ;00 = Return Current Setting, 01 = Set Centering/Expansion
    mov cx,0001h ;Exp. mode: 00 = Scaled, 01 = Centered 1:1, 02 = Left Corner 1:1
    int 10h      ;call VGA/VBE service

We need to build a custom master boot record (MBR) which will execute this code and write the MBR to disk.

There are two options
a) download binary boot0 attached http://www.tonymacx86.com/attachmen...259-nvidia-how-get-rid-black-border-boot0.zip
b) get source code here http://forge.voodooprojects.org/svn/chameleon/branches/Chimera, apply boot0.patch attached http://www.tonymacx86.com/attachmen...dia-how-get-rid-black-border-center.patch.txt and build

Now, when you have boot0, install it:
Code:
sudo dd if=boot0 of=/dev/diskX bs=440 count=1
Unfortunately you can not do this on running Mac OS X, you’ll have to attach your hard drive to another machine to rewrite boot sector.

Before:
79366d1389306567-nvidia-how-get-rid-black-border-before.jpg

After:
79367d1389306868-nvidia-how-get-rid-black-border-after.jpg


We can see that stretching is disabled now.

HINT: if you combine Level 1 and Level 2, you will get a very beautiful black splash screen. Unfortunately I was not able to take good photo using my phone. Professional camera is needed to manage contrast. On this reason I'm pasting a screenshot:

79370d1389308587-nvidia-how-get-rid-black-border-level2.jpg


Advantages:
- image becomes much sharper
- apple logo is not stretched
- works with any operating system: Mac, Linux, Windows, DOS, whatever
- does not require flashing video card
- could be easily undone by reinstalling chimera
Disadvantages:
- possible troubles while booting with non-NVIDIA video card (not tested).

Level 3 Solution (Bring 'em on)
Patch VBIOS in memory.
<Will be described later>

Level 4 Solution (I’m Death incarnate)
Patch Hardware Video Card
<Will be described later>

P.S. Press "Recommend" in the top of this page if this guide helped you ;)


sir can you please elaborate step 2 a bit im in the verge of discovering a way to show the loading bar but i need your help^^ thanks
 
Last edited by a moderator:
Does anybody have an update on how to do this on Clover with a UEFI loader?

I've got a GTX 660 TI and I've tried the steps above (step 2) with no luck...
 
Status
Not open for further replies.
Back
Top