Skip to content

Commit

Permalink
Add option to disable Double Buffering by setting refresh rate < 4fps
Browse files Browse the repository at this point in the history
  • Loading branch information
PluMGMK committed Jan 9, 2025
1 parent 996618d commit b492676
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ This table lists the parameters you can specify in the `[VBESVGA.DRV]` section o
|`Depth` | 8 - 24 | Significant bits per pixel of the desired video mode ("significant" means that padding bits are excluded, so for example if you choose 24, both 24-bit and 32-bit modes will qualify) | 24 |
|`fontsize` | `small` or `large` | Choose whether to use 96dpi or 120dpi fonts | `small` |
|`dacdepth` | 6 or 8 | Significant bits to use per colour in 256-colour modes | 6 |
|`DoubleBufRefreshRate` | 4 - 255 | Number of times per second to swap buffers if [double-buffering](#linear-modes-and-double-buffering) is enabled | 60 |
|`DoubleBufRefreshRate` | 0 - 255 | Number of times per second to swap buffers if [double-buffering](#linear-modes-and-double-buffering) is enabled; specifying a value less than 4 **disables** double-buffering | 60 |
|`PMIDcheck` | `disable`, `none`, `sum` or `sanity` | See [below](#protected-mode-interface) | `sum` |

### Protected-Mode Interface
Expand Down Expand Up @@ -108,6 +108,8 @@ When using a linear framebuffer, the driver also attempts to use [Double Bufferi

Basically, if you're using 386 Enhanced Mode (or Standard Mode without `EMM386`), with a modern graphics card and a decent amount of system RAM, then the driver will probably enable Double Buffering. In that case, you can adjust the refresh rate using the `DoubleBufRefreshRate=` setting in `SYSTEM.INI`!

If you suspect there are problems with Double Buffering, you can force-disable it by setting `DoubleBufRefreshRate=0` (or any value less than 4). This can **significantly** degrade performance for certain operations on large screens, but may be useful for debugging...

## Mode selection

When Windows boots, the driver queries the BIOS for available modes, and automatically selects the first one which fulfills the following criteria:
Expand Down
5 changes: 5 additions & 0 deletions VBESVGA/src/DBLBUF.ASM
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,11 @@ cBegin
jz @F
jmp setup_done

@@: ; has user force-disabled double buffering?
cmp [desired_fps],4
jnb @F
jmp setup_done

@@: ; Calculate the relevant period
mov ax,1000 ; milliseconds per second
div [desired_fps] ; AL := milliseconds per frame, AH := remainder
Expand Down
8 changes: 5 additions & 3 deletions VBESVGA/src/ENABLE.ASM
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ fail_reason dw offset general_fail
bad_width db 'Width < 640 is not allowed',13,10,'$'
bad_height db 'Height < 480 is not allowed',13,10,'$'
bad_depth db 'Depth < 8 is not allowed',13,10,'$'
bad_framerate db 'Refresh rate must be in range 4-255 fps inclusive',13,10,'$'
;bad_framerate db 'Refresh rate must be in range 4-255 fps inclusive',13,10,'$'
bad_framerate db 'Refresh rate must be in less than 256 fps',13,10
db '(Note that values less than 4 fps disable double buffering)',13,10,'$'
general_fail db 'Unsuitable settings for current driver / hardware',13,10,'$'
press_key db 'Press any key to abort booting Windows...',13,10,'$'

Expand Down Expand Up @@ -403,8 +405,8 @@ enable_read_profile PROC NEAR
lea bx,fps_member
lea cx,aszSystemIni ;ptr to "system.ini" string
cCall GetPrivateProfileInt,<ds,ax,ds,bx,60,ds,cx>
cmp al,4
rcl ah,1
;cmp al,4
;rcl ah,1
test ah,ah ; AH is non-zero if user went over 255 OR below 4
jz @F
mov [fail_reason],offset bad_framerate
Expand Down

0 comments on commit b492676

Please sign in to comment.