diff options
author | Jaroslav Hensl <jara@hensl.cz> | 2024-03-02 20:16:10 +0100 |
---|---|---|
committer | Jaroslav Hensl <jara@hensl.cz> | 2024-03-02 20:16:10 +0100 |
commit | 1b56bc0ecac9f9e6b362971965ca37df732462c0 (patch) | |
tree | 53e1107d0ec6e067b6cd5b5035516d30dac737b9 | |
parent | 23b80d45224f83527e6284273cb3ec25fa8dee76 (diff) | |
download | vmdisp9x-1b56bc0ecac9f9e6b362971965ca37df732462c0.tar.gz |
opengl: software/qemu-3dfx switch, directdraw: 128b align, prefer fifo for vGPU9
-rw-r--r-- | control.c | 4 | ||||
-rw-r--r-- | dddrv.c | 3 | ||||
-rw-r--r-- | vxd_lib.c | 79 | ||||
-rw-r--r-- | vxd_lib.h | 3 | ||||
-rw-r--r-- | vxd_main.c | 58 | ||||
-rw-r--r-- | vxd_svga.c | 72 |
6 files changed, 132 insertions, 87 deletions
@@ -170,11 +170,11 @@ LONG WINAPI __loadds Control(LPVOID lpDevice, UINT function, }
else if(function == OPENGL_GETINFO) /* input: NULL, output: opengl_icd_t */
{
- if(hda->flags & FB_ACCEL_VMSVGA3D)
+ if((hda->flags & FB_ACCEL_VMSVGA3D) && ((hda->flags & FB_FORCE_SOFTWARE) == 0))
{
_fmemcpy(lpOutput, &vmwsvga_icd, OPENGL_ICD_SIZE);
}
- else if(hda->flags & FB_ACCEL_QEMU3DFX)
+ else if((hda->flags & FB_ACCEL_QEMU3DFX) && ((hda->flags & FB_FORCE_SOFTWARE) == 0))
{
_fmemcpy(lpOutput, &qemu3dfx_icd, OPENGL_ICD_SIZE);
}
@@ -231,8 +231,9 @@ static void buildPixelFormat(LPDDHALMODEINFO lpMode, LPDDPIXELFORMAT lpddpf) */
static void buildDDHALInfo(VMDAHAL_t __far *hal, int modeidx)
{
- static DWORD AlignTbl [ 9 ] = { 64, 64, 64, 64, 64, 64, 64, 64, 64 };
+// static DWORD AlignTbl [ 9 ] = { 64, 64, 64, 64, 64, 64, 64, 64, 64 };
// static DWORD AlignTbl [ 9 ] = { 8, 8, 8, 8, 16, 8, 24, 8, 32 };
+ static DWORD AlignTbl [ 9 ] = { 128, 128, 128, 128, 128, 128, 128, 128, 128 }; /* we can now use aligned SSE to manipulate with surfaces */
int ii;
BOOL can_flip;
WORD heap;
@@ -82,6 +82,57 @@ void *memcpy(void *dst, const void *src, unsigned int size) return dst;
}
+/* temp for reading registry */
+static union
+{
+ DWORD dw;
+ char str[64];
+} RegReadConfBuf = {0};
+
+/**
+ * Read integer value from registry
+ *
+ **/
+BOOL RegReadConf(UINT root, const char *path, const char *name, DWORD *out)
+{
+ DWORD hKey;
+ DWORD type;
+ DWORD cbData = sizeof(RegReadConfBuf);
+ BOOL rv = FALSE;
+
+ if(_RegOpenKey(root, (char*)path, &hKey) == ERROR_SUCCESS)
+ {
+ if(_RegQueryValueEx(hKey, (char*)name, 0, &type, &(RegReadConfBuf.str), &cbData) == ERROR_SUCCESS)
+ {
+ if(type == REG_SZ)
+ {
+ DWORD cdw = 0;
+ char *ptr = &(RegReadConfBuf.str);
+
+ while(*ptr == ' '){ptr++;}
+
+ while(*ptr >= '0' && *ptr <= '9')
+ {
+ cdw *= 10;
+ cdw += *ptr - '0';
+ ptr++;
+ }
+
+ *out = cdw;
+ }
+ else
+ {
+ *out = RegReadConfBuf.dw;
+ }
+
+ rv = TRUE;
+ }
+
+ _RegCloseKey(hKey);
+ }
+
+ return rv;
+}
/**
* VMM calls wrapers
@@ -203,6 +254,34 @@ void __cdecl *Map_Flat(BYTE SegOffset, BYTE OffOffset) return result;
}
+void __cdecl Install_IO_Handler(DWORD port, DWORD callback)
+{
+ static DWORD sPort = 0;
+ static DWORD sCallback = 0;
+
+ sPort = port;
+ sCallback = callback;
+
+/*
+ * esi <- IOCallback
+ * edx <- I/O port numbers
+ */
+ _asm
+ {
+ push esi
+ push edx
+ mov esi, [sCallback]
+ mov edx, [sPort]
+ }
+ VMMCall(Install_IO_Handler);
+ _asm
+ {
+ pop edx
+ pop esi
+ }
+}
+
+
ULONG __declspec(naked) __cdecl _PageAllocate(ULONG nPages, ULONG pType, ULONG VM, ULONG AlignMask, ULONG minPhys, ULONG maxPhys, ULONG *PhysAddr, ULONG flags)
{
VMMJmp(_PageAllocate);
@@ -27,6 +27,8 @@ THE SOFTWARE. void memset(void *dst, int c, unsigned int size);
void *memcpy(void *dst, const void *src, unsigned int size);
+BOOL RegReadConf(UINT root, const char *path, const char *name, DWORD *out);
+
DWORD Get_VMM_Version();
ULONG __cdecl _PageAllocate(ULONG nPages, ULONG pType, ULONG VM, ULONG AlignMask, ULONG minPhys, ULONG maxPhys, ULONG *PhysAddr, ULONG flags);
ULONG __cdecl _PageFree(PVOID hMem, DWORD flags);
@@ -46,6 +48,7 @@ void __cdecl Destroy_Semaphore(ULONG SemHandle); void __cdecl Wait_Semaphore(ULONG semHandle, ULONG flags);
void __cdecl Signal_Semaphore(ULONG SemHandle);
void __cdecl *Map_Flat(BYTE SegOffset, BYTE OffOfset);
+void __cdecl Install_IO_Handler(DWORD port, DWORD callback);
/**
* round size in bytes to number of pages
@@ -95,33 +95,6 @@ DWORD DispatchTableLength = 0; DWORD ThisVM = 0;
#ifdef QEMU
-void Install_IO_Handler(DWORD port, DWORD callback)
-{
- static DWORD sPort = 0;
- static DWORD sCallback = 0;
-
- sPort = port;
- sCallback = callback;
-
-/*
- * esi <- IOCallback
- * edx <- I/O port numbers
- */
- _asm
- {
- push esi
- push edx
- mov esi, [sCallback]
- mov edx, [sPort]
- }
- VMMCall(Install_IO_Handler);
- _asm
- {
- pop edx
- pop esi
- }
-}
-
/**
* This is fix of broken screen when open DOS window
*
@@ -417,6 +390,35 @@ void __declspec(naked) VXD_API_entry() }
}
+static char reg_path[] = "Software\\vmdisp9x";
+static char reg_force_sw[] = "FORCE_SOFTWARE";
+static char reg_force_qemu3dfx[] = "FORCE_QEMU3DFX";
+
+static void configure_FBHDA()
+{
+ FBHDA_t *fbhda;
+ DWORD force_sw = 0;
+ DWORD force_qemu3dfx = 0;
+
+ fbhda = FBHDA_setup();
+
+ if(fbhda)
+ {
+ RegReadConf(HKEY_LOCAL_MACHINE, reg_path, reg_force_sw, &force_sw);
+ RegReadConf(HKEY_LOCAL_MACHINE, reg_path, reg_force_qemu3dfx, &force_qemu3dfx);
+
+ if(force_sw)
+ {
+ fbhda->flags |= FB_FORCE_SOFTWARE;
+ }
+
+ if(force_qemu3dfx)
+ {
+ fbhda->flags |= FB_ACCEL_QEMU3DFX;
+ }
+ }
+}
+
/* generate all entry pro VDD function */
#define VDDFUNC(_fnname, _procname) void __declspec(naked) _procname ## _entry() { \
_asm { push ebp }; \
@@ -457,6 +459,8 @@ void Device_Dynamic_Init_proc(DWORD VM) {
#include "vxd_vdd_list.h"
}
+
+ configure_FBHDA();
}
#undef VDDFUNC
@@ -105,17 +105,13 @@ static BOOL gb_support = FALSE; static BOOL cb_support = FALSE;
static BOOL cb_context0 = FALSE;
+/* for GPU9 is FIFO more stable (VMWARE) or faster (VBOX) */
+static DWORD prefer_fifo = 1;
+
static BOOL SVGA_is_valid = FALSE;
static volatile SVGACBHeader *last_cb = NULL;
-/* temp for reading registry */
-static union
-{
- DWORD dw;
- char str[64];
-} RegReadConfBuf = {0};
-
static uint64 cb_next_id = {0, 0};
static DWORD fence_next_id = 1;
static void *cmdbuf = NULL;
@@ -148,6 +144,7 @@ static char SVGA_conf_hw_cursor[] = "HWCursor"; static char SVGA_conf_vram_limit[] = "VRAMLimit";
static char SVGA_conf_rgb565bug[] = "RGB565bug";
static char SVGA_conf_cb[] = "CommandBuffers";
+static char SVGA_conf_pref_fifo[] = "PreferFIFO";
static char SVGA_conf_hw_version[] = "HWVersion";
static char SVGA_vxd_name[] = "vmwsmini.vxd";
@@ -183,51 +180,6 @@ static void SVGA_Flush_CB() }
#endif
-/**
- * Read integer value from registry
- *
- **/
-static BOOL RegReadConf(const char *value, DWORD *out)
-{
- DWORD hKey;
- DWORD type;
- DWORD cbData = sizeof(RegReadConfBuf);
- BOOL rv = FALSE;
-
- if(_RegOpenKey(HKEY_LOCAL_MACHINE, SVGA_conf_path, &hKey) == ERROR_SUCCESS)
- {
- if(_RegQueryValueEx(hKey, (char*)value, 0, &type, &(RegReadConfBuf.str), &cbData) == ERROR_SUCCESS)
- {
- if(type == REG_SZ)
- {
- DWORD cdw = 0;
- char *ptr = &(RegReadConfBuf.str);
-
- while(*ptr == ' '){ptr++;}
-
- while(*ptr >= '0' && *ptr <= '9')
- {
- cdw *= 10;
- cdw += *ptr - '0';
- ptr++;
- }
-
- *out = cdw;
- }
- else
- {
- *out = RegReadConfBuf.dw;
- }
-
- rv = TRUE;
- }
-
- _RegCloseKey(hKey);
- }
-
- return rv;
-}
-
/* map physical addresses to system linear space */
void SVGA_MapIO()
{
@@ -638,11 +590,12 @@ BOOL SVGA_init_hw() int rc;
/* configs in registry */
- RegReadConf(SVGA_conf_hw_cursor, &conf_hw_cursor);
- RegReadConf(SVGA_conf_vram_limit, &conf_vram_limit);
- RegReadConf(SVGA_conf_rgb565bug, &conf_rgb565bug);
- RegReadConf(SVGA_conf_cb, &conf_cb);
- RegReadConf(SVGA_conf_hw_version, &conf_hw_version);
+ RegReadConf(HKEY_LOCAL_MACHINE, SVGA_conf_path, SVGA_conf_hw_cursor, &conf_hw_cursor);
+ RegReadConf(HKEY_LOCAL_MACHINE, SVGA_conf_path, SVGA_conf_vram_limit, &conf_vram_limit);
+ RegReadConf(HKEY_LOCAL_MACHINE, SVGA_conf_path, SVGA_conf_rgb565bug, &conf_rgb565bug);
+ RegReadConf(HKEY_LOCAL_MACHINE, SVGA_conf_path, SVGA_conf_cb, &conf_cb);
+ RegReadConf(HKEY_LOCAL_MACHINE, SVGA_conf_path, SVGA_conf_hw_version, &conf_hw_version);
+ RegReadConf(HKEY_LOCAL_MACHINE, SVGA_conf_path, SVGA_conf_pref_fifo, &prefer_fifo);
if(!FBHDA_init_hw())
{
@@ -737,6 +690,11 @@ BOOL SVGA_init_hw() /* enable command buffers if supported and enabled */
if(SVGA_ReadReg(SVGA_REG_CAPABILITIES) & (SVGA_CAP_COMMAND_BUFFERS | SVGA_CAP_CMD_BUFFERS_2))
{
+ if(prefer_fifo && !gb_support)
+ {
+ conf_cb = FALSE;
+ }
+
if(conf_cb)
{
cb_support = TRUE;
|