X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=plugins%2Fgpulib%2Fgpu.h;h=bb62d597dcce062252b4533dafd010fbab243163;hb=4ebf57912b63d794ce6df44376a8f531ad65e2c7;hp=9f4271408dc01fd3d2a810f21d42111d419dcc3f;hpb=61124a6d0fb6a2980f9025630382d9b76c07066f;p=pcsx_rearmed.git diff --git a/plugins/gpulib/gpu.h b/plugins/gpulib/gpu.h index 9f427140..bb62d597 100644 --- a/plugins/gpulib/gpu.h +++ b/plugins/gpulib/gpu.h @@ -13,15 +13,34 @@ #include +#define gpu_log(fmt, ...) \ + printf("%d:%03d: " fmt, *gpu.state.frame_count, *gpu.state.hcnt, ##__VA_ARGS__) + +//#define log_anomaly gpu_log +#define log_anomaly(...) + #ifdef __cplusplus extern "C" { #endif #define CMD_BUFFER_LEN 1024 +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +#define HTOLE32(x) __builtin_bswap32(x) +#define HTOLE16(x) __builtin_bswap16(x) +#define LE32TOH(x) __builtin_bswap32(x) +#define LE16TOH(x) __builtin_bswap16(x) +#else +#define HTOLE32(x) (x) +#define HTOLE16(x) (x) +#define LE32TOH(x) (x) +#define LE16TOH(x) (x) +#endif + #define BIT(x) (1 << (x)) #define PSX_GPU_STATUS_DHEIGHT BIT(19) +#define PSX_GPU_STATUS_PAL BIT(20) #define PSX_GPU_STATUS_RGB24 BIT(21) #define PSX_GPU_STATUS_INTERLACE BIT(22) #define PSX_GPU_STATUS_BLANKING BIT(23) @@ -41,6 +60,7 @@ struct psx_gpu { int x, y, w, h; int x1, x2; int y1, y2; + int src_x, src_y; } screen; struct { int x, y, w, h; @@ -55,8 +75,10 @@ struct psx_gpu { uint32_t blanked:1; uint32_t enhancement_enable:1; uint32_t enhancement_active:1; + uint32_t enhancement_was_active:1; uint32_t downscale_enable:1; uint32_t downscale_active:1; + uint32_t dims_changed:1; uint32_t *frame_count; uint32_t *hcnt; /* hsync count */ struct { @@ -66,6 +88,10 @@ struct psx_gpu { uint32_t hcnt; } last_list; uint32_t last_vram_read_frame; + uint32_t w_out_old, h_out_old, status_vo_old; + int screen_centering_type; // 0 - auto, 1 - game conrolled, 2 - manual + int screen_centering_x; + int screen_centering_y; } state; struct { int32_t set:3; /* -1 auto, 0 off, 1-3 fixed */ @@ -80,8 +106,7 @@ struct psx_gpu { uint32_t pending_fill[3]; } frameskip; uint32_t scratch_ex_regs[8]; // for threaded rendering - int useDithering:1; /* 0 - off , 1 - on */ - uint16_t *(*get_enhancement_bufer) + void *(*get_enhancement_bufer) (int *x, int *y, int *w, int *h, int *vram_h); uint16_t *(*get_downscale_buffer) (int *x, int *y, int *w, int *h, int *vram_h); @@ -100,13 +125,14 @@ struct rearmed_cbs; int renderer_init(void); void renderer_finish(void); void renderer_sync_ecmds(uint32_t * ecmds); -void renderer_update_caches(int x, int y, int w, int h); +void renderer_update_caches(int x, int y, int w, int h, int state_changed); void renderer_flush_queues(void); void renderer_set_interlace(int enable, int is_odd); void renderer_set_config(const struct rearmed_cbs *config); void renderer_notify_res_change(void); void renderer_notify_update_lace(int updated); void renderer_sync(void); +void renderer_notify_scanout_x_change(int x, int w); int vout_init(void); int vout_finish(void); @@ -120,7 +146,7 @@ struct GPUFreeze; long GPUinit(void); long GPUshutdown(void); void GPUwriteDataMem(uint32_t *mem, int count); -long GPUdmaChain(uint32_t *rambase, uint32_t addr); +long GPUdmaChain(uint32_t *rambase, uint32_t addr, uint32_t *progress_addr); void GPUwriteData(uint32_t data); void GPUreadDataMem(uint32_t *mem, int count); uint32_t GPUreadData(void);