From b492676c9d2b297a7b6b28fff3b9f493a1696257 Mon Sep 17 00:00:00 2001 From: Michael Keyes Date: Thu, 9 Jan 2025 20:25:55 +0000 Subject: [PATCH] Add option to disable Double Buffering by setting refresh rate < 4fps --- README.md | 4 +++- VBESVGA/src/DBLBUF.ASM | 5 +++++ VBESVGA/src/ENABLE.ASM | 8 +++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7e318cc..d4b163b 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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: diff --git a/VBESVGA/src/DBLBUF.ASM b/VBESVGA/src/DBLBUF.ASM index 1be2c82..a6da011 100644 --- a/VBESVGA/src/DBLBUF.ASM +++ b/VBESVGA/src/DBLBUF.ASM @@ -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 diff --git a/VBESVGA/src/ENABLE.ASM b/VBESVGA/src/ENABLE.ASM index c432bce..34f7d6d 100644 --- a/VBESVGA/src/ENABLE.ASM +++ b/VBESVGA/src/ENABLE.ASM @@ -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,'$' @@ -403,8 +405,8 @@ enable_read_profile PROC NEAR lea bx,fps_member lea cx,aszSystemIni ;ptr to "system.ini" string cCall GetPrivateProfileInt, - 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