aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaroslav Hensl <jara@hensl.cz>2024-02-25 23:54:01 +0100
committerJaroslav Hensl <jara@hensl.cz>2024-02-25 23:54:01 +0100
commit253cd05e58298800ea0038868203defd9b64a374 (patch)
tree1fbaa892e8fe7483d1f2dd372a51b3bad1b2bbf5
parent1725ae3a841d51e8fda682ad8a8265cc760e1e16 (diff)
downloadvmdisp9x-253cd05e58298800ea0038868203defd9b64a374.tar.gz
redone surface memory limitation
-rw-r--r--vxd_main.c9
-rw-r--r--vxd_mouse_conv.h6
-rw-r--r--vxd_svga.c26
3 files changed, 31 insertions, 10 deletions
diff --git a/vxd_main.c b/vxd_main.c
index 499112f..e5bdc6a 100644
--- a/vxd_main.c
+++ b/vxd_main.c
@@ -409,6 +409,8 @@ void __declspec(naked) VXD_API_entry()
{
_asm {
push ebp
+ mov eax,cr3 ; TLB bug here? Looks like...
+ mov cr3,eax
call VXD_API_Proc
mov [ebp+1Ch], ax
retn
@@ -529,7 +531,12 @@ DWORD __stdcall Device_IO_Control_proc(struct DIOCParams *params)
{
memcpy(outio, inio, sizeof(SVGA_region_info_t));
}
- SVGA_region_create(outio);
+ outio->address = NULL;
+ if(!SVGA_region_create(outio))
+ {
+ SVGA_flushcache();
+ SVGA_region_create(outio);
+ }
return 0;
}
case OP_SVGA_REGION_FREE:
diff --git a/vxd_mouse_conv.h b/vxd_mouse_conv.h
index 778e5c8..198a817 100644
--- a/vxd_mouse_conv.h
+++ b/vxd_mouse_conv.h
@@ -35,6 +35,12 @@ static BOOL calc_save(int x, int y)
return FALSE;
}
+ if((DWORD)(mouse_swap_w * mouse_swap_h * mouse_ps) > mouse_mem_size)
+ {
+ mouse_swap_valid = FALSE;
+ return FALSE;
+ }
+
return TRUE;
}
diff --git a/vxd_svga.c b/vxd_svga.c
index 6484789..ad52ce1 100644
--- a/vxd_svga.c
+++ b/vxd_svga.c
@@ -49,10 +49,10 @@ THE SOFTWARE.
#define PTONPAGE (P_SIZE/sizeof(DWORD))
-#define SPARE_REGIONS 6
+#define SPARE_REGIONS 5
#define SPARE_REGION_SIZE (1*1024*1024)
-#define SPARE_REGIONS_LARGE 2
+#define SPARE_REGIONS_LARGE 1
#define SPARE_REGION_LARGE_SIZE (32*1024*1024)
/*
@@ -102,7 +102,7 @@ static struct spare_region
SVGA_region_info_t region;
};
-static struct spare_region spare_regions[SPARE_REGIONS] = {FALSE};
+static struct spare_region spare_regions[SPARE_REGIONS];
/* object table for GPU10 */
static SVGA_OT_info_entry_t otable_setup[SVGA_OTABLE_DX_MAX] = {
@@ -746,6 +746,8 @@ BOOL SVGA_init_hw()
hda->flags |= FB_ACCEL_VMSVGA10;
}
+ memset(&spare_regions[0], 0, sizeof(spare_regions));
+
SVGA_is_valid = TRUE;
return TRUE;
@@ -1005,8 +1007,8 @@ void SVGA_region_free(SVGA_region_info_t *rinfo)
SVGA_WriteReg(SVGA_REG_GMR_DESCRIPTOR, 0);
SVGA_Sync(); // notify register change
- /* save 2 large regions */
- if(rinfo->size >= SPARE_REGION_LARGE_SIZE)
+ /* save 1 large region */
+ if(rinfo->size == SPARE_REGION_LARGE_SIZE)
{
int i;
for(i = 0; i < SPARE_REGIONS_LARGE; i++)
@@ -1023,7 +1025,8 @@ void SVGA_region_free(SVGA_region_info_t *rinfo)
}
}
}
- else if(rinfo->size >= SPARE_REGION_SIZE)
+ else if(rinfo->size >= SPARE_REGION_SIZE &&
+ rinfo->size < SPARE_REGION_LARGE_SIZE)
{
int i;
for(i = SPARE_REGIONS_LARGE; i < SPARE_REGIONS; i++)
@@ -1325,8 +1328,14 @@ BOOL SVGA_setmode(DWORD w, DWORD h, DWORD bpp)
}
/* free chached regions */
+ /*
SVGA_flushcache();
+ ^JH: no alloc/free operations here (don't know why,
+ but when VXD si called from 16 bits, these
+ operations are bit unstable)
+ */
+ mouse_invalidate();
FBHDA_access_begin(0);
Begin_Critical_Section(0);
@@ -1381,9 +1390,7 @@ BOOL SVGA_setmode(DWORD w, DWORD h, DWORD bpp)
hda->pitch = SVGA_ReadReg(SVGA_REG_BYTES_PER_LINE);
hda->stride = hda->height * hda->pitch;
hda->surface = 0;
-
- mouse_invalidate();
-
+
if(has3D && SVGA_GetDevCap(SVGA3D_DEVCAP_3D) > 0)
{
hda->flags |= FB_ACCEL_VMSVGA3D;
@@ -1395,6 +1402,7 @@ BOOL SVGA_setmode(DWORD w, DWORD h, DWORD bpp)
End_Critical_Section();
+ mouse_invalidate();
FBHDA_access_end(0);
return TRUE;