mirror of
https://github.com/86Box/86Box.git
synced 2026-02-24 10:28:19 -07:00
Accumulated changes. Update copyright year in anticipation of 2025. More PGRAPH stuff. Start working on guest CPU independent timer (RivaTimer) but not really tested or used yet. Add more docs
This commit is contained in:
@@ -318,14 +318,30 @@ extern const device_config_t nv3_config[];
|
||||
#define NV3_PGRAPH_CONTEXT_USER 0x400194 // Current DMA context state, may rename
|
||||
#define NV3_PGRAPH_CONTEXT_CACHE(i) 0x4001A0+(i*4) // Context Cache
|
||||
#define NV3_PGRAPH_CONTEXT_CACHE_SIZE 8
|
||||
#define NV3_PGRAPH_SRC_CANVAS_MIN 0x440550 // Minimum Source Canvas for Blit, X,Y position
|
||||
#define NV3_PGRAPH_SRC_CANVAS_MAX 0x440554 // Maximum Source Canvas for Blit, X,Y position
|
||||
#define NV3_PGRAPH_DST_CANVAS_MIN 0x440558 // Minimum Destination Canvas for Blit, X,Y position
|
||||
#define NV3_PGRAPH_DST_CANVAS_MAX 0x44055C // Maximum Destination Canvas for Blit, X,Y position
|
||||
#define NV3_PGRAPH_CLIP0_MIN 0x440690 // Clip for Blitting 0 Min
|
||||
#define NV3_PGRAPH_CLIP0_MAX 0x440694 // Clip for Blitting 0 Max
|
||||
#define NV3_PGRAPH_CLIP1_MIN 0x440698 // Clip for Blitting 1 Min
|
||||
#define NV3_PGRAPH_CLIP1_MAX 0x44069C // Clip for Blitting 1 Max
|
||||
#define NV3_PGRAPH_ABS_UCLIP_XMIN 0x40053C // Clip X minimum
|
||||
#define NV3_PGRAPH_ABS_UCLIP_XMAX 0x400540 // Clip X maximum
|
||||
#define NV3_PGRAPH_ABS_UCLIP_YMIN 0x400544 // Clip Y minimum
|
||||
#define NV3_PGRAPH_ABS_UCLIP_YMAX 0x400548 // Clip Y maximum
|
||||
#define NV3_PGRAPH_SRC_CANVAS_MIN 0x400550 // Minimum Source Canvas for Blit, X,Y position
|
||||
#define NV3_PGRAPH_SRC_CANVAS_MAX 0x400554 // Maximum Source Canvas for Blit, X,Y position
|
||||
#define NV3_PGRAPH_DST_CANVAS_MIN 0x400558 // Minimum Destination Canvas for Blit, X,Y position
|
||||
#define NV3_PGRAPH_DST_CANVAS_MAX 0x40055C // Maximum Destination Canvas for Blit, X,Y position
|
||||
#define NV3_PGRAPH_PATTERN_COLOR_0_0 0x400600
|
||||
#define NV3_PGRAPH_PATTERN_COLOR_0_1 0x400604
|
||||
#define NV3_PGRAPH_PATTERN_COLOR_1_0 0x400608
|
||||
#define NV3_PGRAPH_PATTERN_COLOR_1_1 0x40060C // pattern color
|
||||
#define NV3_PGRAPH_PATTERN_BITMAP_HIGH 0x400610 // pattern bitmap [31:0]
|
||||
#define NV3_PGRAPH_PATTERN_BITMAP_LOW 0x400614 // pattern bitmap [63:32]
|
||||
#define NV3_PGRAPH_PATTERN_SHAPE 0x400618
|
||||
#define NV3_PGRAPH_ROP3 0x400624 // ROP3
|
||||
#define NV3_PGRAPH_PLANE_MASK 0x400628
|
||||
#define NV3_PGRAPH_CHROMA_KEY 0x40062C
|
||||
#define NV3_PGRAPH_BETA 0x400640 // Beta factor (30:23 fractional, 22:0 before fraction)
|
||||
#define NV3_PGRAPH_NOTIFY 0x400684 // Notifier for PGRAPH
|
||||
#define NV3_PGRAPH_CLIP0_MIN 0x400690 // Clip for Blitting 0 Min
|
||||
#define NV3_PGRAPH_CLIP0_MAX 0x400694 // Clip for Blitting 0 Max
|
||||
#define NV3_PGRAPH_CLIP1_MIN 0x400698 // Clip for Blitting 1 Min
|
||||
#define NV3_PGRAPH_CLIP1_MAX 0x40069C // Clip for Blitting 1 Max
|
||||
#define NV3_PGRAPH_FIFO_ACCESS 0x4006A4 // Is PGRAPH enabled?
|
||||
#define NV3_PGRAPH_FIFO_ACCESS_DISABLED 0x0
|
||||
#define NV3_PGRAPH_FIFO_ACCESS_ENABLED 0x1
|
||||
@@ -335,6 +351,8 @@ extern const device_config_t nv3_config[];
|
||||
#define NV3_PGRAPH_TRAPPED_DATA 0x4006B8
|
||||
#define NV3_PGRAPH_TRAPPED_INSTANCE 0x4006BC
|
||||
|
||||
#define NV3_PGRAPH_DMA_INTR_0 0x401000 // PGRAPH DMA Interrupt Status
|
||||
#define NV3_PGRAPH_DMA_INTR_EN_0 0x401140 // PGRAPH DMA Interrupt Enable 0
|
||||
|
||||
// not sure about the class ids
|
||||
// these are NOT what each class is, just uSed to manipulate it (there isn't a one to one class->reg mapping anyway)
|
||||
|
||||
83
src/include/86box/nv/vid_nv_rivatimer.h
Normal file
83
src/include/86box/nv/vid_nv_rivatimer.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Fast, high-frequency, guest CPU-independent timer for Riva emulation.
|
||||
*
|
||||
*
|
||||
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
|
||||
*
|
||||
* Copyright 2024-2025 starfrost
|
||||
*/
|
||||
|
||||
/*
|
||||
RivaTimer
|
||||
|
||||
This is a fast, high-frequency, guest CPU-independent timer.
|
||||
|
||||
The main 86box timer is dependent on the TSC (time-stamp counter) register of the emulated CPU core.
|
||||
This is fine for most purposes and has advantages in the fields of synchronisation and integrates neatly with
|
||||
the clock dividers of the PC architecture, but in the case of the RIVA 128 it does not particularly suffice
|
||||
(although it can be made to work with various techniques) since the clock source on the RIVA 128 is on the board itself
|
||||
and the GPU has several different clocks that control different parts of the GPU (e.g., PTIMER runs on the memory clock but the core gpu is using the pixel clock).
|
||||
|
||||
As faster graphics cards that offload more and more of the 3D graphics pipeline are emulated in the future, more and more work needs to be done by the emulator and
|
||||
issues of synchronisation with a host CPU will simply make that work harder. Some features that are required for
|
||||
|
||||
Architecture Brand Name 3D Features
|
||||
NV1 (1995) NV1 Some weird URBS rectangle crap but feature set generally similar to nv3 but a bit worse
|
||||
NV3 (1997) RIVA 128 (ZX) Triangle setup, edge-slope calculations, edge interpolation, span-slope calculations, span interpolation (Color-buffer, z-buffer, texture mapping, filtering)
|
||||
NV4 (1998) RIVA TNT NV3 + 2x1 pixel pipelines + 32-bit colour + larger textures + trilinear + more ram (16mb)
|
||||
NV5 (1999) RIVA TNT2 NV4 + higher clock speed
|
||||
NV10 (1999) GeForce 256 NV5 + initial geometry transformation + lighting (8x lights) + MPEG-2 motion compensation + 4x1 pixel pipelines
|
||||
NV15 (2000) GeForce 2 NV10 + First attempt at programmability + 4x2 pixel pipelines
|
||||
NV20 (2001) GeForce 3 Programmable shaders!
|
||||
|
||||
As you can see, the performance basically exponentially increases over a period of only 4 years.
|
||||
|
||||
So I decided to create this timer that is completely separate from the CPU Core.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <86Box\86box.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
// Linux & MacOS should have the same API since OSX 10.12
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
typedef struct rivatimer_s
|
||||
{
|
||||
struct rivatimer_s* prev; // Previous Rivatimer
|
||||
double period; // Period in uS before firing
|
||||
double value; // The current value of the rivatimer
|
||||
bool running; // Is this RivaTimer running?
|
||||
struct rivatimer_s* next; // Next RivaTimer
|
||||
void (*callback)(); // Callback to call on fire
|
||||
#ifdef _WIN32
|
||||
LARGE_INTEGER starting_time; // Starting time.
|
||||
#else
|
||||
struct timespec starting_time; // Starting time.
|
||||
#endif
|
||||
double time; // Accumulated time in uS.
|
||||
} rivatimer_t;
|
||||
|
||||
void rivatimer_init(); // Initialise the Rivatimer.
|
||||
rivatimer_t* rivatimer_create(double period, void (*callback)());
|
||||
void rivatimer_destroy(rivatimer_t* rivatimer_ptr);
|
||||
|
||||
void rivatimer_update_all();
|
||||
void rivatimer_start(rivatimer_t* rivatimer_ptr);
|
||||
void rivatimer_stop(rivatimer_t* rivatimer_ptr);
|
||||
double rivatimer_get_time(rivatimer_t* rivatimer_ptr);
|
||||
void rivatimer_set_callback(rivatimer_t* rivatimer_ptr, void (*callback)());
|
||||
Reference in New Issue
Block a user