aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaroslav Hensl <jara@hensl.cz>2024-07-28 21:59:12 +0200
committerJaroslav Hensl <jara@hensl.cz>2024-07-28 21:59:12 +0200
commitfa14048fc349d2a0d3ba58b313dcc3137a48dd1d (patch)
tree220a7906657753529ef8704e8f263b1cf286271e
parentc7057f9dcfa40cfcbfdd104150ff27f505f6fea0 (diff)
downloadvmdisp9x-fa14048fc349d2a0d3ba58b313dcc3137a48dd1d.tar.gz
CB queue limit, parallel MOB config
-rw-r--r--makefile2
-rw-r--r--vxd_svga.c10
-rw-r--r--vxd_svga.h3
-rw-r--r--vxd_svga_cb.c44
-rw-r--r--vxd_svga_mem.c31
5 files changed, 68 insertions, 22 deletions
diff --git a/makefile b/makefile
index 8cccb2a..f340c10 100644
--- a/makefile
+++ b/makefile
@@ -12,7 +12,7 @@ OBJS += &
INCS = -I$(%WATCOM)\h\win -Iddk -Ivmware
-VER_BUILD = 69
+VER_BUILD = 70
FLAGS = -DDRV_VER_BUILD=$(VER_BUILD)
diff --git a/vxd_svga.c b/vxd_svga.c
index 9d78250..7ccdef8 100644
--- a/vxd_svga.c
+++ b/vxd_svga.c
@@ -78,6 +78,8 @@ static DWORD fence_next_id = 1;
void *cmdbuf = NULL;
void *ctlbuf = NULL;
+DWORD async_mobs = 1;
+
/* guest frame buffer is dirty */
BOOL ST_FB_invalid = FALSE;
@@ -100,6 +102,7 @@ static char SVGA_conf_st_flags[] = "STOptions";
static char SVGA_vxd_name[] = "vmwsmini.vxd";
static char SVGA_conf_disable_multisample[] = "NoMultisample";
+static char SVGA_conf_async_mobs[] = "AsyncMOBs";
/**
* Notify virtual HW that is some work to do
@@ -412,6 +415,13 @@ BOOL SVGA_init_hw()
RegReadConf(HKEY_LOCAL_MACHINE, SVGA_conf_path, SVGA_conf_st_flags, &st_flags);
RegReadConf(HKEY_LOCAL_MACHINE, SVGA_conf_path, SVGA_conf_disable_multisample, &disable_multisample);
+ RegReadConf(HKEY_LOCAL_MACHINE, SVGA_conf_path, SVGA_conf_async_mobs, &async_mobs);
+
+ if(async_mobs < 1)
+ async_mobs = 1;
+
+ if(async_mobs >= SVGA_CB_MAX_QUEUED_PER_CONTEXT)
+ async_mobs = SVGA_CB_MAX_QUEUED_PER_CONTEXT-1;
if(!FBHDA_init_hw())
{
diff --git a/vxd_svga.h b/vxd_svga.h
index 1fd237f..c86cdcb 100644
--- a/vxd_svga.h
+++ b/vxd_svga.h
@@ -27,9 +27,7 @@ DWORD SVGA_GetDevCap(DWORD search_id);
#ifdef DBGPRINT
void SVGA_fence_wait_dbg(DWORD fence_id, int line);
-
#define SVGA_fence_wait(_fence) SVGA_fence_wait_dbg(_fence, __LINE__)
-
#endif
@@ -66,6 +64,7 @@ void cache_init();
void cache_enable(BOOL enabled);
/* CB */
+extern DWORD async_mobs;
DWORD *SVGA_CMB_alloc_size(DWORD datasize);
void SVGA_CMB_free(DWORD *cmb);
void SVGA_CB_start();
diff --git a/vxd_svga_cb.c b/vxd_svga_cb.c
index 9c81c39..47242b4 100644
--- a/vxd_svga_cb.c
+++ b/vxd_svga_cb.c
@@ -70,6 +70,7 @@ typedef struct _cb_queue_info_t
{
cb_queue_t *first;
cb_queue_t *last;
+ DWORD items;
} cb_queue_info_t;
/*
@@ -88,7 +89,7 @@ inline BOOL CB_queue_check_inline(SVGACBHeader *tracked);
/*
* Locals
**/
-static cb_queue_info_t cb_queue_info = {NULL, NULL};
+static cb_queue_info_t cb_queue_info = {NULL, NULL, 0};
static uint64 cb_next_id = {0, 0};
/*
@@ -233,6 +234,7 @@ inline BOOL CB_queue_check_inline(SVGACBHeader *tracked)
//dbg_printf(dbg_trace_remove, item);
item = item->next;
+ cb_queue_info.items--;
}
else
{
@@ -281,7 +283,7 @@ BOOL CB_queue_check(SVGACBHeader *tracked)
return CB_queue_check_inline(tracked);
}
-void CB_queue_valid(SVGACBHeader *check, char *msg)
+static BOOL CB_queue_item_valid(SVGACBHeader *check)
{
cb_queue_t *test = (cb_queue_t*)(check-1);
cb_queue_t *item = cb_queue_info.first;
@@ -290,12 +292,22 @@ void CB_queue_valid(SVGACBHeader *check, char *msg)
{
if(item == test)
{
- dbg_printf(dbg_cb_valid_err, msg, check, ((SVGACBHeader *)cmdbuf)-1);
- dbg_printf(dbg_cb_valid_status, check->status);
+ return FALSE;
}
item = item->next;
}
+
+ return TRUE;
+}
+
+void CB_queue_valid(SVGACBHeader *check, char *msg)
+{
+ if(!CB_queue_item_valid(check))
+ {
+ dbg_printf(dbg_cb_valid_err, msg, check, ((SVGACBHeader *)cmdbuf)-1);
+ dbg_printf(dbg_cb_valid_status, check->status);
+ }
}
static BOOL CB_queue_is_flags_set(DWORD flags)
@@ -330,11 +342,13 @@ void CB_queue_insert(SVGACBHeader *cb, DWORD flags)
{
cb_queue_info.last->next = item;
cb_queue_info.last = item;
+ cb_queue_info.items++;
}
else
{
cb_queue_info.first = item;
cb_queue_info.last = item;
+ cb_queue_info.items = 1;
}
}
@@ -468,7 +482,13 @@ static void SVGA_CMB_submit_critical(DWORD FBPTR cmb, DWORD cmb_size, SVGA_CMB_s
do
{
CB_queue_check_inline(NULL);
- } while(CB_queue_is_flags_set(cbq_check));
+ } while(CB_queue_is_flags_set(cbq_check) ||
+ cb_queue_info.items >= (SVGA_CB_MAX_QUEUED_PER_CONTEXT-1));
+
+ if(!CB_queue_item_valid(cb))
+ {
+ return;
+ }
}
if(status)
@@ -821,15 +841,13 @@ void SVGA_CMB_wait_update()
}
}
-#define MOB_CB_COUNT 8
-
-void *mob_cb[MOB_CB_COUNT];
-DWORD act = 0;
+static void *mob_cb[SVGA_CB_MAX_QUEUED_PER_CONTEXT];
+static DWORD mob_act = 0;
void mob_cb_alloc()
{
int i = 0;
- for(i = 0; i < MOB_CB_COUNT; i++)
+ for(i = 0; i < async_mobs; i++)
{
mob_cb[i] = SVGA_CMB_alloc_size(1024);
}
@@ -837,10 +855,10 @@ void mob_cb_alloc()
void *mob_cb_get()
{
- int id = act++;
- if(act >= MOB_CB_COUNT)
+ int id = mob_act++;
+ if(mob_act >= async_mobs)
{
- act = 0;
+ mob_act = 0;
}
WAIT_FOR_CB(mob_cb[id], 0);
diff --git a/vxd_svga_mem.c b/vxd_svga_mem.c
index 7ac915b..7d2a95f 100644
--- a/vxd_svga_mem.c
+++ b/vxd_svga_mem.c
@@ -871,9 +871,16 @@ BOOL SVGA_region_create(SVGA_region_info_t *rinfo)
mob->base = rinfo->mob_ppn;
mob->ptDepth = rinfo->mob_pt_depth;
mob->sizeInBytes = rinfo->size;
-
- //submit_cmdbuf(cmdoff, SVGA_CB_SYNC, 0);
- SVGA_CMB_submit(mobcb, cmdoff, NULL, 0, 0);
+
+ if(async_mobs == 1)
+ {
+ SVGA_CMB_submit(mobcb, cmdoff, NULL, SVGA_CB_SYNC, 0);
+ SVGA_Sync();
+ }
+ else
+ {
+ SVGA_CMB_submit(mobcb, cmdoff, NULL, 0, 0);
+ }
rinfo->is_mob = 1;
}
@@ -909,15 +916,27 @@ void SVGA_region_free(SVGA_region_info_t *rinfo)
{
SVGA3dCmdDestroyGBMob *mob;
DWORD cmdoff = 0;
+ void *mobcb = mob_cb_get();
wait_for_cmdbuf();
- mob = SVGA_cmd3d_ptr(cmdbuf, &cmdoff, SVGA_3D_CMD_DESTROY_GB_MOB, sizeof(SVGA3dCmdDestroyGBMob));
+ mob = SVGA_cmd3d_ptr(mobcb, &cmdoff, SVGA_3D_CMD_DESTROY_GB_MOB, sizeof(SVGA3dCmdDestroyGBMob));
mob->mobid = rinfo->region_id;
if(saved_in_cache)
- submit_cmdbuf(cmdoff, 0, 0);
+ {
+ SVGA_CMB_submit(mobcb, cmdoff, NULL, 0, 0);
+ }
else
- submit_cmdbuf(cmdoff, SVGA_CB_SYNC, 0);
+ {
+ if(async_mobs == 1)
+ {
+ SVGA_CMB_submit(mobcb, cmdoff, NULL, SVGA_CB_SYNC, 0);
+ }
+ else
+ {
+ SVGA_CMB_submit(mobcb, cmdoff, NULL, 0, 0);
+ }
+ }
}
if(!rinfo->mobonly)