X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=plugins%2Fgpulib%2Fgpu.c;fp=plugins%2Fgpulib%2Fgpu.c;h=c9b05d4daf82baf27dd83ad845493241b1bf36cd;hp=337e27a7ad98182c5450a989e5876bf8f5038bdc;hb=8f5f2dd5a70f47322614eda6f97304808447199c;hpb=c632283d5c48d7731ec5704c3d5eef54951fec20 diff --git a/plugins/gpulib/gpu.c b/plugins/gpulib/gpu.c index 337e27a7..c9b05d4d 100644 --- a/plugins/gpulib/gpu.c +++ b/plugins/gpulib/gpu.c @@ -13,8 +13,16 @@ #include "gpu.h" #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +#ifdef __GNUC__ #define unlikely(x) __builtin_expect((x), 0) +#define preload __builtin_prefetch #define noinline __attribute__((noinline)) +#else +#define unlikely(x) +#define preload(...) +#define noinline +#error huh +#endif #define gpu_log(fmt, ...) \ printf("%d:%03d: " fmt, *gpu.state.frame_count, *gpu.state.hcnt, ##__VA_ARGS__) @@ -518,6 +526,8 @@ long GPUdmaChain(uint32_t *rambase, uint32_t start_addr) int len, left, count; long cpu_cycles = 0; + preload(rambase + (start_addr & 0x1fffff) / 4); + if (unlikely(gpu.cmd_len > 0)) flush_cmd_buffer(); @@ -537,6 +547,8 @@ long GPUdmaChain(uint32_t *rambase, uint32_t start_addr) list = rambase + (addr & 0x1fffff) / 4; len = list[0] >> 24; addr = list[0] & 0xffffff; + preload(rambase + (addr & 0x1fffff) / 4); + cpu_cycles += 10; if (len > 0) cpu_cycles += 5 + len;