start working on the actual graphics objects. Since we figured out the pfifo/ramht/object class crap.

This commit is contained in:
starfrost013
2024-12-31 00:38:06 +00:00
parent 56a5522aa6
commit bdc47bf3ee
15 changed files with 591 additions and 20 deletions

View File

@@ -0,0 +1,81 @@
Memory map (RIVA 128)
32 megabytes of MMIO starting at <nvAddr> 0x0000000-0x01FFFFFF
MC (Master Control) 0x00000000-0x00000FFF
Config/Boot 0x00000000-0x000000FF
Master Config 0x00000100-0x00000FFF
Also used to define DMA channel IDs?
MPU-401 I/O 0x00000330-0x00000331 Probably NV1 leftover, NV1 has mpu401 emulation -- no audio in nv3
VGA emulated ports 0x000003B0-0x000003DF Emulated I/O ports for VGA
Bus Control (PBUS) 0x00001000-0x00001FFF
FIFO (PFIFO) 0x00002000-0x00003FFF Submit starting at 0x00800000. Used to configure RAMHT,RAMFC,RAMRO structures & cache
PRM 0x00004000-0x00005FFF Realmode DOS device support
PRMIO 0x00007000-0x00007FFF Realmode access to PCI BAR (Base Address Register) + PCI I/O
PTIMER 0x00009000-0x00009FFF Timer
VGA emulation 0x0000A000-0x0000BFFF
VGA vram emulation 0x000A0000-0x000BFFFF (PRMVGA)
VGA 0x000C0000-0x000C7FFF VGA sequencer + graph controller registers (PRMVIO)
(All of this up to 0x0000FFFF can be traced)
PFB (Framebuffer) 0x00100000-0x00100FFF Interface to vram
PEXTDEV 0x00101000-0x00101FFF External device interface - contains straps
Straps 0x00101000 11 bits of cfg
ROM (VBIOS?) 0x00110000-0x0011FFFF
PALT (?) 0x00120000-0x00120FFF
PEXTDEV 0x00101000-0x00101FFF External Devices
Media Engine (PME) 0x00200000-0x00200FFF Allows for external video capture according to envytools?
PGRAPH (3D rendering) 0x00400000-0x00401FFF
PGRAPH objects (using RAMHT???)
*i assume that when you submit an object these are the registers used to actually draw the current object
Beta blending factor 0x00410000-0x00411FFF
ROP 0x00420000-0x00421FFF Global bitwise operation (Render OPeration) for filtering the final pixel
Color Key 0x00430000-0x00431FFF
Plane Switch 0x00440000-0x00441FFF Something to do with color formats and objects?
Clipping 0x00450000-0x00451FFF
Blend Pattern 0x00460000-0x00461FFF Used for specific blending modes
Quad [OBSOLETE] 0x00470000-0x00471FFF A rectangle. NV1 LEFTOVER, OBSOLETE
Point 0x00480000-0x00481FFF A single point
Line 0x00490000-0x00491FFF A line (with an optional colour). Can also draw a polygon made out of lines - polyline
Lin 0x004A0000-0x004A1FFF A line, without starting or ending pixel (with an optional colour). Can also draw a "polylin"
Triangle [OBSOLETE] 0x004B0000-0x004B1FFF A triangle. NV1 LEFTOVER, OBSOLETE?
Win95 GDI text 0x004C0000-0x004C1FFF Win95 text acceleration
Memory to memory xfer 0x004D0000-0x004D1FFF Represents a memory to memory transfer
Scaled image from vram 0x004E0000-0x004E1FFF Scaled image from GPU VRAM
Image blit from vram 0x00500000-0x00501FFF Image from GPU VRAM
Image blit from cpu 0x00510000-0x00511FFF Image from CPU
Bitmap from cpu 0x00520000-0x00521FFF Bitmap from CPU
Image to memory 0x00540000-0x00541FFF Image to GPU VRAM
Stretch image from cpu 0x00550000-0x00551FFF Stretched image from CPU
Direct3D 5.0 triangle 0x00570000-0x00571FFF A triangle optimised explicitly for directx3/directx5 rendering - supercedes UTRI
PointZ 0x00580000-0x00581FFF A single point with "zeta factor" (not sure what this is yet)
Image in memory 0x005C0000-0x005C0FFF Image in vram(?)
PVIDEO (Video Control) 0x00680000-0x006802FF
External DAC 0x00680000-0x006800FF
PRMCIO 0x00601000-0x00601FFF VGA emulation - CRTC + attribute controller
PRAMDAC 0x00680300-0x00680FFF (used for color lookup tables, hardware cursor, video overlay, PLL for clocking and pixel generation)
"USER" DAC 0x00681200-0x00681FFF
DMA submission w/FIFO 0x00800000-0x00FFFFFF NV_USER - uses FIFO buffer
PNVM / PDFB / VRAM 0x01000000-0x017FFFFF (actual VRAM amount depends on card, but max is 8MB)
RAMIN 0x01C00000-0x01FFFFFF (note that this is actually mapped in the last 1mb of vram)
contains ramht that has obj parameters for submission, configurable

38
doc/PFIFO RAMHT RAMRO.txt Normal file
View File

@@ -0,0 +1,38 @@
PIO VS dma
driver is DIRECTLY modifying pfifo
8X8 channel setup
Names are 32-bit integers >4096
RAMFC - DMA Context object 0,0 to 8,8
context = channel, render object, object type, offset in instance memory
for a rectangle (type 0x47), object render = 1, channel 0, at 0x0400 in the ramht memory
=0x00c70400 as the context
the ramht hash :
xor every byte of the hash individually and then xor that with the channel number
so obj id 01020304 in channel 0 is 1 xor 2 xor 3 xor 4 xor 0
Store in RAMHT at <subchannel start within RAMHT> + 4*16 = name
Store in RAMHT at <subchannel start within RAMHT> + 4*16 + 4 = context
then the ramin stuff starts at *0xc04000 since c00000 is the start of ramin [PCI BAR1] which is where you put the contents of the class struct
nv_user
Consider the 8x8 channels as 64 subchannels.
Now you can do:
They seem to end at 0x880000
(0x880000)/64 = 0x2000 for each channel
FAILURE -> RAMRO!

View File

@@ -105,3 +105,4 @@ NvFindAdapter -> RmInitNvMapping Success 19:18 26/11/2024
NvFindAdapter -> RmPostNvDevice Success 17:32 27/11/2024
NvFindAdapter -> NVGetNVInfo Success 17:32 27/11/2024
NvFindAdapter -> NVMapFrameBuffer Success 17:32 27/11/2024

View File

@@ -0,0 +1,37 @@
Object classes as understood by the GPU.
(May be represented, in RAMFC, as 0x40+ 22:16)
0x00 = Invalid
0x01 = beta factor
0x02 = ROP5 operation
0x03 = Chroma key
0x04 = Plane mask
0x05 = Clipping rectangle
0x06 = Pattern
0x07 = Rectangle
0x08 = Point
0x09 = Line
0x0A = Lin (line without starting or ending pixel)
0x0B = Triangle
0x0C = Windows 95 GDI text acceleration
0x0D = Memory to memory format
0x0E = Scaled image from memory
0x0F = INVALID
0x10 = Blit
0x11 = Image
0x12 = Bitmap
0x13 = INVALID
0x14 = Transfer to Memory
0x15 = Stretched image from CPU
0x16 = INVALID
0x17 = Direct3D 5.0 accelerated textured triangle w/zeta buffer
0x18 = INVALID
0x19 = INVALID
0x1A = INVALID
0x1B = INVALID
0x1C = Image in memory
0x1D = INVALID
0x1E = INVALID
0x1F = INVALID

View File

@@ -0,0 +1,57 @@
Object classes
NOT represented by the GPU. These are the ones the drivers recognise. Most of them are faked.
Version 0.77_win95 (!!!)
object class 1 = "general" methods shared across all objects
object class 2 = DMA from memory
object class 3 = DMA to memory
object class 4 = timer
object class 5 = chip ID
object class 6 = "context ordinal"
object class 10/0Ah = patchcord (links objects together)
object class 11/0Bh = video sink
object class 12/0Ch = video switch
object class 13/0Dh = video colormap
object class 14/0Eh = patchcord...again
object class 15/0Fh = image to video
object class 16/10h = image stencil buffer
object class 17/11h = image blending methods
object class 18/12h = beta solid
object class 19/13h = image -> render operation
object class 20/14h = ROP5 (2^5 = 32bit rop)
object class 21/15h = color key
object class 22/16h = plane switch
object class 23/17h = "solid image"
object class 24/18h = pattern
object class 25/19h = black rectangle
object class 26/1Ah = solid point
object class 27/1Bh = solid line
object class 28/1Ch = solid lin (line without its ending or starting pixel)
object class 29/1Dh = triangle
object class 30/1Eh = solid rectangle
object class 31/1Fh = blit image
object class 33/21h = get image from cpu
object class 34/22h = get image from cpu, monochrome
object class 37/25h = get image from local GPU memory
object class 49/31h and 51/33h = patchcord, again
object class 54/36h = get image from cpu, stretched
object class 55/37h = get image from vram, scaled
object class 56/38h = get image from vram, scaled, YUV 420 color space (probably internal colour space used for rendering)
object class 57/39h = convert image(?) between formats in place in vram, allows you to set an in and out buffer and all that jazz
object class 61/3Dh = In-Memory DMA (vram to vram?)
object class 62/3Eh = get image from vram
object class 63/3Fh = get video from vram
object class 64/40h = video scaler
object class 65/41h = video color key (as opposed to image)
object class 66/42h = capture video to memory
object class 67/43h = Solid ROP5
object class 68/44h = zeta buffer (something to do with how the gpu internally renders 3d stuff) from CPU(?)
object class 69/45h = zeta buffer in VRAM
object class 70/46h = zeta buffer patchcord
object class 71/47h = render solid point into zeta buffer (Also rectangle0
object class 72/48h = render Direct3D 5.x ("D3D0") accelerated triangle into zeta buffer
object class 73/49h = render Direct3D 5.x ("D3D0") accelerated triangle
object class 74/4Ah = video source
object class 75/4Bh = render Windows GDI accelerated rectangle and text

161
doc/nv3d3d_t.txt Normal file
View File

@@ -0,0 +1,161 @@
12=unk_int12
16=unk_short16
22=unk_short22 (seems to determine if nv_sys_ptr is valid)
24=unk_short24
26=unk_short26
44=unk_int44
56=unk_int56
60=unk_int60
64=unk_short64
66=unk_short66
82=unk_short82
362..822:
big_struct
(weird alignment?)
477
489
505
1140=nv_sys_ptr
<very big structure - add when we add this structure>
1156=unk_int1156 [start of structure]
1160=unk_int1160
1168=unk_int1168 [possibly a byte array of up to 16 bytes)
1184=unk_int1184
1208=unk_int1208
1212=unk_int1212
1216=unk_int1216
1220=unk_int1220
1224=unk_int1224
1236=unk_int1236
1240=unk_int1240
1244=unk_int1244
1248=unk_int1248
1256=unk_int1256
1260=fog_table_enable
1264=unk_int1264
1270=unk_int1270
1272=unk_byte1272
1273=unk_byte1273
1274=unk_byte1274 (?)
1275=unk_byte1275
1316=unk_int1316
1320=unk_int1320
1332=unk_int1332
1340=unk_int1340
1344=unk_int1344
1356=unk_int1356
1360=d3d_clear_enabled
1364=texture_enabled
1368=mipmap_size_max
1372=mipmap_levels
1376=user_mipmaps
1380=zoh_mode (bool)
1384=tex_heap
1388=text_size
1392=video_texture
1396=min_video_tex_size
1400=draw_prim
1404=spread_x
1408=spread_y
1412=size_adj
1416=turbo_adj
1420=dma_min_push_count
1424=dma_push_enable
1436=unk_int1436
1440=unk_int1440
1448=unk_int1448
1452=unk_int1452 (set to value of unk_int1908)
1456=unk_int1456 (set to value of unk_int1956)
1460=unk_int1460 (set to value of unk_int2020)
1516=unk_int1516
1520=unk_int1520
1524=unk_int1524
1528=unk_int1528
1532=unk_int1532
1548=unk_int1548
1552=unk_int1552
1556=unk_int1556
1560=unk_int1560
1564=unk_int1564
1600=unk_int1600
1612=unk_int1612
1616=unk_int1616
1620=unk_int1620
1632=unk_int1632
1640=unk_int1640
1644=unk_ptr1644
1676=unk_int1676
1680=unk_int1680
1684=unk_int1684
1688=unk_int1688
1692=unk_int1692
1696=unk_int1696
1700=unk_int1700
1716=unk_int1716
1720=unk_int1720
1724=unk_int1724
1728=unk_ptr1728
1848=unk_int1848
1852=unk_int1852
1856=unk_int1856 (unk_int1552 | 0x800)
1864=unk_func_ptr1864
1868=unk_int1868
1884=unk_int1884
1888=ptr_to_start_of_structure?
1892=hInstDll
1896=unk_int1896
1900=unk_int1900
1908=unk_int1908
1912=unk_int1912
1916=unk_func_ptr1916
1920=unk_func_ptr1920
1932=unk_func_ptr1932
1936=unk_func_ptr1936
1944=unk_func_ptr1944
1956..2020: Set of function pointrs
1956=unk_int1956
1960=unk_int1960
1960=unk_func_ptr1960
1964=unk_func_ptr1964
1968=unk_func_ptr1968
1976=unk_func_ptr1976
1980=unk_func_ptr1980
1988=unk_func_ptr1988
1996=unk_func_ptr1996
2000=unk_func_ptr2000
2004=unk_func_ptr2004
2008=unk_func_ptr2008
2020=unk_int2020
2024=unk_int2024
2028=unk_int2028
2032=unk_int2032