mirror of
https://github.com/86Box/86Box.git
synced 2026-02-23 01:48:21 -07:00
Merge branch '86Box:master' into master
This commit is contained in:
@@ -98,6 +98,48 @@
|
||||
# define LIKELY(x) (x)
|
||||
#endif
|
||||
|
||||
/* Platform-specific atomic handling */
|
||||
#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86)
|
||||
/* On x86/x64, aligned int/uint32_t accesses are naturally atomic */
|
||||
/* Use volatile for performance, as the original code did */
|
||||
#define ATOMIC_INT volatile int
|
||||
#define ATOMIC_UINT volatile uint32_t
|
||||
#define ATOMIC_DOUBLE volatile double
|
||||
#define ATOMIC_LOAD(var) (var)
|
||||
#define ATOMIC_STORE(var, val) ((var) = (val))
|
||||
#define ATOMIC_INC(var) (++(var))
|
||||
#define ATOMIC_DEC(var) (--(var))
|
||||
#define ATOMIC_ADD(var, val) ((var) += (val))
|
||||
#define ATOMIC_SUB(var, val) ((var) -= (val))
|
||||
#define ATOMIC_DOUBLE_ADD(var, val) ((var) += (val))
|
||||
#else
|
||||
/* On ARM and other architectures, use proper atomics */
|
||||
#ifdef failing_code
|
||||
#ifdef __cplusplus
|
||||
# include <atomic>
|
||||
using atomic_int = std::atomic<int>;
|
||||
using atomic_uint = std::atomic<unsigned int>;
|
||||
#else
|
||||
# include <stdatomic.h>
|
||||
#endif
|
||||
#else
|
||||
#ifndef __cplusplus
|
||||
# include <stdatomic.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define ATOMIC_INT atomic_int
|
||||
#define ATOMIC_UINT atomic_uint
|
||||
#define ATOMIC_DOUBLE _Atomic double
|
||||
#define ATOMIC_LOAD(var) atomic_load(&(var))
|
||||
#define ATOMIC_STORE(var, val) atomic_store(&(var), (val))
|
||||
#define ATOMIC_INC(var) atomic_fetch_add(&(var), 1)
|
||||
#define ATOMIC_DEC(var) atomic_fetch_sub(&(var), 1)
|
||||
#define ATOMIC_ADD(var, val) atomic_fetch_add(&(var), val)
|
||||
#define ATOMIC_SUB(var, val) atomic_fetch_sub(&(var), val)
|
||||
#define ATOMIC_DOUBLE_ADD(var, val) atomic_double_add(&(var), val)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@@ -22,11 +22,12 @@
|
||||
enum {
|
||||
AD1848_TYPE_DEFAULT = 0,
|
||||
AD1848_TYPE_CS4248 = 1,
|
||||
AD1848_TYPE_CS4231 = 2,
|
||||
AD1848_TYPE_CS4232 = 3,
|
||||
AD1848_TYPE_CS4236 = 4,
|
||||
AD1848_TYPE_CS4236B = 5,
|
||||
AD1848_TYPE_CS4235 = 6
|
||||
AD1848_TYPE_OPTI930 = 2,
|
||||
AD1848_TYPE_CS4231 = 3,
|
||||
AD1848_TYPE_CS4232 = 4,
|
||||
AD1848_TYPE_CS4236 = 5,
|
||||
AD1848_TYPE_CS4236B = 6,
|
||||
AD1848_TYPE_CS4235 = 7
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -44,6 +45,7 @@ typedef struct ad1848_t {
|
||||
uint8_t regs[32];
|
||||
uint8_t xregs[32];
|
||||
uint8_t status; /* 16 original registers + 16 CS4231A extensions + 32 CS4236 extensions */
|
||||
uint8_t opti930_mode2;
|
||||
|
||||
int count;
|
||||
uint8_t trd;
|
||||
|
||||
@@ -222,6 +222,9 @@ extern const device_t entertainer_device;
|
||||
/* Mindscape Music Board */
|
||||
extern const device_t mmb_device;
|
||||
|
||||
/* OPTi 82c930 */
|
||||
extern const device_t opti_82c930_device;
|
||||
|
||||
/* Pro Audio Spectrum Plus, 16, and 16D */
|
||||
extern const device_t pasplus_device;
|
||||
extern const device_t pas16_device;
|
||||
|
||||
@@ -29,13 +29,6 @@
|
||||
|
||||
#define TEX_CACHE_MAX 64
|
||||
|
||||
#ifdef __cplusplus
|
||||
# include <atomic>
|
||||
using atomic_int = std::atomic<int>;
|
||||
#else
|
||||
# include <stdatomic.h>
|
||||
#endif
|
||||
|
||||
enum {
|
||||
VOODOO_1 = 0,
|
||||
VOODOO_SB50,
|
||||
@@ -230,8 +223,8 @@ typedef struct voodoo_params_t {
|
||||
typedef struct texture_t {
|
||||
uint32_t base;
|
||||
uint32_t tLOD;
|
||||
atomic_int refcount;
|
||||
atomic_int refcount_r[4];
|
||||
ATOMIC_INT refcount;
|
||||
ATOMIC_INT refcount_r[4];
|
||||
int is16;
|
||||
uint32_t palette_checksum;
|
||||
uint32_t addr_start[4];
|
||||
@@ -400,16 +393,16 @@ typedef struct voodoo_t {
|
||||
int type;
|
||||
|
||||
fifo_entry_t fifo[FIFO_SIZE];
|
||||
atomic_int fifo_read_idx;
|
||||
atomic_int fifo_write_idx;
|
||||
atomic_int cmd_read;
|
||||
atomic_int cmd_written;
|
||||
atomic_int cmd_written_fifo;
|
||||
atomic_int cmd_written_fifo_2;
|
||||
ATOMIC_INT fifo_read_idx;
|
||||
ATOMIC_INT fifo_write_idx;
|
||||
ATOMIC_INT cmd_read;
|
||||
ATOMIC_INT cmd_written;
|
||||
ATOMIC_INT cmd_written_fifo;
|
||||
ATOMIC_INT cmd_written_fifo_2;
|
||||
|
||||
voodoo_params_t params_buffer[PARAM_SIZE];
|
||||
atomic_int params_read_idx[4];
|
||||
atomic_int params_write_idx;
|
||||
ATOMIC_INT params_read_idx[4];
|
||||
ATOMIC_INT params_write_idx;
|
||||
|
||||
uint32_t cmdfifo_base;
|
||||
uint32_t cmdfifo_end;
|
||||
@@ -418,9 +411,9 @@ typedef struct voodoo_t {
|
||||
int cmdfifo_ret_addr;
|
||||
int cmdfifo_in_sub;
|
||||
int cmdfifo_in_agp;
|
||||
atomic_int cmdfifo_depth_rd;
|
||||
atomic_int cmdfifo_depth_wr;
|
||||
atomic_int cmdfifo_enabled;
|
||||
ATOMIC_INT cmdfifo_depth_rd;
|
||||
ATOMIC_INT cmdfifo_depth_wr;
|
||||
ATOMIC_INT cmdfifo_enabled;
|
||||
uint32_t cmdfifo_amin;
|
||||
uint32_t cmdfifo_amax;
|
||||
int cmdfifo_holecount;
|
||||
@@ -432,14 +425,14 @@ typedef struct voodoo_t {
|
||||
int cmdfifo_ret_addr_2;
|
||||
int cmdfifo_in_sub_2;
|
||||
int cmdfifo_in_agp_2;
|
||||
atomic_int cmdfifo_depth_rd_2;
|
||||
atomic_int cmdfifo_depth_wr_2;
|
||||
atomic_int cmdfifo_enabled_2;
|
||||
ATOMIC_INT cmdfifo_depth_rd_2;
|
||||
ATOMIC_INT cmdfifo_depth_wr_2;
|
||||
ATOMIC_INT cmdfifo_enabled_2;
|
||||
uint32_t cmdfifo_amin_2;
|
||||
uint32_t cmdfifo_amax_2;
|
||||
int cmdfifo_holecount_2;
|
||||
|
||||
atomic_uint cmd_status, cmd_status_2;
|
||||
ATOMIC_UINT cmd_status, cmd_status_2;
|
||||
|
||||
uint32_t sSetupMode;
|
||||
vert_t verts[4];
|
||||
|
||||
Reference in New Issue
Block a user