X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=plugins%2Fdfxvideo%2Fgpulib_if.c;h=20383ab52c5d7fd80511a1da8b5210ccba134744;hb=90ac6fed274c1d573a971c66f8a1338e8918f066;hp=47cccedf0c573a7336211002fddf4acfd4d592fb;hpb=0a371c2c4a1097bbbe888ed00d5f2d1d1fafa1f5;p=pcsx_rearmed.git diff --git a/plugins/dfxvideo/gpulib_if.c b/plugins/dfxvideo/gpulib_if.c index 47cccedf..20383ab5 100644 --- a/plugins/dfxvideo/gpulib_if.c +++ b/plugins/dfxvideo/gpulib_if.c @@ -18,6 +18,10 @@ #include "../gpulib/gpu.h" #include "../../include/arm_features.h" +#if defined(__GNUC__) && (__GNUC__ >= 6 || (defined(__clang_major__) && __clang_major__ >= 10)) +#pragma GCC diagnostic ignored "-Wmisleading-indentation" +#endif + #define u32 uint32_t #define INFO_TW 0 @@ -233,12 +237,8 @@ extern int32_t drawH; PSXDisplay_t PSXDisplay; unsigned char *psxVub; -signed char *psxVsb; unsigned short *psxVuw; unsigned short *psxVuw_eom; -signed short *psxVsw; -uint32_t *psxVul; -int32_t *psxVsl; long lGPUstatusRet; uint32_t lGPUInfoVals[16]; @@ -266,13 +266,7 @@ long lLowerpart; static void set_vram(void *vram) { psxVub=vram; - - psxVsb=(signed char *)psxVub; // different ways of accessing PSX VRAM - psxVsw=(signed short *)psxVub; - psxVsl=(int32_t *)psxVub; psxVuw=(unsigned short *)psxVub; - psxVul=(uint32_t *)psxVub; - psxVuw_eom=psxVuw+1024*512; // pre-calc of end of vram } @@ -305,16 +299,23 @@ void renderer_notify_res_change(void) { } +void renderer_notify_scanout_change(int x, int y) +{ +} + +#include "../gpulib/gpu_timing.h" extern const unsigned char cmd_lengths[256]; -int do_cmd_list(unsigned int *list, int list_len, int *last_cmd) +int do_cmd_list(uint32_t *list, int list_len, int *cpu_cycles_out, int *last_cmd) { unsigned int cmd = 0, len; - unsigned int *list_start = list; - unsigned int *list_end = list + list_len; + uint32_t *list_start = list; + uint32_t *list_end = list + list_len; + u32 cpu_cycles = 0; for (; list < list_end; list += 1 + len) { + short *slist = (void *)list; cmd = GETLE32(list) >> 24; len = cmd_lengths[cmd]; if (list + 1 + len > list_end) { @@ -323,7 +324,7 @@ int do_cmd_list(unsigned int *list, int list_len, int *last_cmd) } #ifndef TEST - if (cmd == 0xa0 || cmd == 0xc0) + if (0x80 <= cmd && cmd < 0xe0) break; // image i/o, forward to upper layer else if ((cmd & 0xf8) == 0xe0) gpu.ex_regs[cmd & 7] = GETLE32(list); @@ -340,6 +341,8 @@ int do_cmd_list(unsigned int *list, int list_len, int *last_cmd) while(1) { + cpu_cycles += gput_line(0); + if(list_position >= list_end) { cmd = -1; goto breakloop; @@ -363,6 +366,8 @@ int do_cmd_list(unsigned int *list, int list_len, int *last_cmd) while(1) { + cpu_cycles += gput_line(0); + if(list_position >= list_end) { cmd = -1; goto breakloop; @@ -382,7 +387,6 @@ int do_cmd_list(unsigned int *list, int list_len, int *last_cmd) #ifdef TEST case 0xA0: // sys -> vid { - short *slist = (void *)list; u32 load_width = LE2HOST32(slist[4]); u32 load_height = LE2HOST32(slist[5]); u32 load_size = load_width * load_height; @@ -391,6 +395,35 @@ int do_cmd_list(unsigned int *list, int list_len, int *last_cmd) break; } #endif + + // timing + case 0x02: + cpu_cycles += gput_fill(LE2HOST32(slist[4]) & 0x3ff, + LE2HOST32(slist[5]) & 0x1ff); + break; + case 0x20 ... 0x23: cpu_cycles += gput_poly_base(); break; + case 0x24 ... 0x27: cpu_cycles += gput_poly_base_t(); break; + case 0x28 ... 0x2B: cpu_cycles += gput_quad_base(); break; + case 0x2C ... 0x2F: cpu_cycles += gput_quad_base_t(); break; + case 0x30 ... 0x33: cpu_cycles += gput_poly_base_g(); break; + case 0x34 ... 0x37: cpu_cycles += gput_poly_base_gt(); break; + case 0x38 ... 0x3B: cpu_cycles += gput_quad_base_g(); break; + case 0x3C ... 0x3F: cpu_cycles += gput_quad_base_gt(); break; + case 0x40 ... 0x47: cpu_cycles += gput_line(0); break; + case 0x50 ... 0x57: cpu_cycles += gput_line(0); break; + case 0x60 ... 0x63: + cpu_cycles += gput_sprite(LE2HOST32(slist[4]) & 0x3ff, + LE2HOST32(slist[5]) & 0x1ff); + break; + case 0x64 ... 0x67: + cpu_cycles += gput_sprite(LE2HOST32(slist[6]) & 0x3ff, + LE2HOST32(slist[7]) & 0x1ff); + break; + case 0x68 ... 0x6B: cpu_cycles += gput_sprite(1, 1); break; + case 0x70 ... 0x73: + case 0x74 ... 0x77: cpu_cycles += gput_sprite(8, 8); break; + case 0x78 ... 0x7B: + case 0x7C ... 0x7F: cpu_cycles += gput_sprite(16, 16); break; } } @@ -398,12 +431,21 @@ breakloop: gpu.ex_regs[1] &= ~0x1ff; gpu.ex_regs[1] |= lGPUstatusRet & 0x1ff; + *cpu_cycles_out += cpu_cycles; *last_cmd = cmd; return list - list_start; } -void renderer_sync_ecmds(uint32_t *ecmds) +void renderer_sync_ecmds(uint32_t *ecmds_) { +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + // the funcs below expect LE + uint32_t i, ecmds[8]; + for (i = 1; i <= 6; i++) + ecmds[i] = HTOLE32(ecmds_[i]); +#else + uint32_t *ecmds = ecmds_; +#endif cmdTexturePage((unsigned char *)&ecmds[1]); cmdTextureWindow((unsigned char *)&ecmds[2]); cmdDrawAreaStart((unsigned char *)&ecmds[3]); @@ -412,7 +454,7 @@ void renderer_sync_ecmds(uint32_t *ecmds) cmdSTP((unsigned char *)&ecmds[6]); } -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) { } @@ -434,3 +476,5 @@ void renderer_set_config(const struct rearmed_cbs *cbs) cbs->pl_set_gpu_caps(0); set_vram(gpu.vram); } + +// vim:ts=2:shiftwidth=2:expandtab