Skip to content

Commit

Permalink
SVGA: config in registry, better locking, HW cursor off by default
Browse files Browse the repository at this point in the history
  • Loading branch information
JHRobotics committed Sep 7, 2023
1 parent 6eb9ffb commit acde242
Show file tree
Hide file tree
Showing 8 changed files with 244 additions and 43 deletions.
11 changes: 9 additions & 2 deletions control.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ typedef struct _svga_hda_t
#define ULF_PITCH 4
#define ULF_LOCK_UL 5
#define ULF_LOCK_FIFO 6
#define ULF_LOCK_FB 7
#define ULF_LOCK_CB 8
#define ULF_LOCK_GMR 9
#define ULF_CNT 10

#define GMR_INDEX_CNT 6
#define CTX_INDEX_CNT 2
Expand Down Expand Up @@ -346,8 +350,8 @@ void SVGAHDA_init()
{
_fmemset(&SVGAHDA, 0, sizeof(svga_hda_t));

SVGAHDA.ul_flags_index = 0; // dirty, width, height, bpp, pitch, fifo_lock, ul_lock, fb_lock
SVGAHDA.ul_fence_index = SVGAHDA.ul_flags_index + 8;
SVGAHDA.ul_flags_index = 0; // dirty, width, height, bpp, pitch, fifo_lock, ul_lock, fb_lock...
SVGAHDA.ul_fence_index = SVGAHDA.ul_flags_index + ULF_CNT;
SVGAHDA.ul_gmr_start = SVGAHDA.ul_fence_index + 1;
SVGAHDA.ul_gmr_count = SVGA_ReadReg(SVGA_REG_GMR_MAX_IDS);
//SVGAHDA.ul_gmr_count = SVGA3D_MAX_MOBS;
Expand All @@ -368,6 +372,9 @@ void SVGAHDA_init()

SVGAHDA.userlist_pm16[ULF_LOCK_UL] = 0;
SVGAHDA.userlist_pm16[ULF_LOCK_FIFO] = 0;
SVGAHDA.userlist_pm16[ULF_LOCK_FB] = 0;
SVGAHDA.userlist_pm16[ULF_LOCK_CB] = 0;
SVGAHDA.userlist_pm16[ULF_LOCK_GMR] = 0;
}

dbg_printf("SVGAHDA_init: %ld\n", SVGAHDA.userlist_length * sizeof(uint32_t));
Expand Down
11 changes: 11 additions & 0 deletions dibcall.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ void WINAPI __loadds MoveCursor(WORD absX, WORD absY)
SVGA_MoveCursor(cursorVisible, absX, absY, 0);
SVGAHDA_unlock(LOCK_FIFO);
}

/* save last position */
cursorX = absX;
cursorY = absY;
}
else
{
Expand Down Expand Up @@ -281,6 +285,13 @@ WORD WINAPI __loadds SetCursor_driver(CURSORSHAPE __far *lpCursor)
}
}

/* move cursor to last known position */
if(SVGAHDA_trylock(LOCK_FIFO))
{
SVGA_MoveCursor(cursorVisible, cursorX, cursorY, 0);
SVGAHDA_unlock(LOCK_FIFO);
}

cursorVisible = TRUE;
}
else
Expand Down
4 changes: 2 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ OBJS = dibthunk.obj dibcall.obj enable.obj init.obj palette.obj &

INCS = -I$(%WATCOM)\h\win -Iddk -Ivmware

VER_BUILD = 22
VER_BUILD = 24

FLAGS = -DDRV_VER_BUILD=$(VER_BUILD) -DCAP_R5G6B5_ALWAYS_WRONG
FLAGS = -DDRV_VER_BUILD=$(VER_BUILD)

# Define HWBLT if BitBlt can be accelerated.
#FLAGS += -DHWBLT
Expand Down
2 changes: 1 addition & 1 deletion version.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#define DRV_STR(x) DRV_STR_(x)

/* DRV, VXD and DLL have to have the same */
#define DRV_API_LEVEL 20230814UL
#define DRV_API_LEVEL 20230907UL

/* on binaries equals 1 and for INF is 1 = separate driver, 2 = softgpu pack */
#define DRV_VER_MAJOR 1
Expand Down
11 changes: 10 additions & 1 deletion vmware/svga.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ static char dbg_siz[] = "Size of gSVGA(1) = %d %d\n";
*/

int
#ifndef VXD32
SVGA_Init(Bool enableFIFO)
#else
SVGA_Init(Bool enableFIFO, uint32 hwversion)
#endif
{
int vga_found = 0;

Expand Down Expand Up @@ -189,8 +193,13 @@ SVGA_Init(Bool enableFIFO)
* a. If we read back the same value, this ID is supported. We're done.
* b. If not, decrement the ID and repeat.
*/

if(hwversion == 0)
{
hwversion = SVGA_VERSION_2;
}

gSVGA.deviceVersionId = SVGA_ID_2;
gSVGA.deviceVersionId = SVGA_MAKE_ID(hwversion);
do {
SVGA_WriteReg(SVGA_REG_ID, gSVGA.deviceVersionId);
if (SVGA_ReadReg(SVGA_REG_ID) == gSVGA.deviceVersionId) {
Expand Down
2 changes: 1 addition & 1 deletion vmware/svga.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ extern SVGADevice gSVGA;
#ifndef VXD32
int __loadds SVGA_Init(Bool enableFIFO);
#else
int SVGA_Init(Bool enableFIFO);
int SVGA_Init(Bool enableFIFO, uint32 hwversion);
#endif
void SVGA_Enable(void);
void SVGA_SetMode(uint32 width, uint32 height, uint32 bpp);
Expand Down
2 changes: 1 addition & 1 deletion vmware/svga_reg.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ typedef struct uint64 {
#define SVGA_MAKE_ID(ver) (SVGA_MAGIC << 8 | (ver))

#define SVGA_VERSION_3 3
#define SVGA_ID_3 SVGA_MAKE_ID(SVGA_VERSION_3)
#define SVGA_ID_3 SVGA_MAKE_ID(SVGA_VERSION_3)

/* Version 2 let the address of the frame buffer be unsigned on Win32 */
#define SVGA_VERSION_2 2
Expand Down
Loading

0 comments on commit acde242

Please sign in to comment.