aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authornotaz2011-06-18 01:33:50 +0300
committernotaz2011-08-13 00:57:32 +0300
commitfc84f6188a55f2548956356c0eda64945183cafc (patch)
tree0fb3bd20d6038c6a53a2ca53287a52a798e1ed72 /plugins
parent8dd855cd6cdab41d1e38637a020681137eceb457 (diff)
downloadpcsx_rearmed-fc84f6188a55f2548956356c0eda64945183cafc.tar.gz
pcsx_rearmed-fc84f6188a55f2548956356c0eda64945183cafc.tar.bz2
pcsx_rearmed-fc84f6188a55f2548956356c0eda64945183cafc.zip
gpu_neon: basic frameskip, change check, minor stuff
Diffstat (limited to 'plugins')
-rw-r--r--plugins/gpu_neon/Makefile3
-rw-r--r--plugins/gpu_neon/gpu.c40
-rw-r--r--plugins/gpu_neon/gpu.h9
-rw-r--r--plugins/gpu_neon/vout_fb.c13
4 files changed, 58 insertions, 7 deletions
diff --git a/plugins/gpu_neon/Makefile b/plugins/gpu_neon/Makefile
index 974ac1a..556d884 100644
--- a/plugins/gpu_neon/Makefile
+++ b/plugins/gpu_neon/Makefile
@@ -4,13 +4,14 @@ ARCH = $(shell $(CC) -v 2>&1 | grep -i 'target:' | awk '{print $$2}' | awk -F '-
CFLAGS += -ggdb -Wall -fPIC -O2
-TARGET = gpu_neon.so
LDFLAGS += -shared -Wl,-soname,$(TARGET)
SRC += gpu.c
ifeq "$(ARCH)" "arm"
+TARGET = gpu_neon.so
CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
SRC += vout_fb.c ../../frontend/arm_utils.s
else
+TARGET = gpu_neon.so.x86
CFLAGS += `sdl-config --cflags` -m32
LDFLAGS += `sdl-config --libs`
SRC += vout_sdl.c
diff --git a/plugins/gpu_neon/gpu.c b/plugins/gpu_neon/gpu.c
index c43fd31..91a1738 100644
--- a/plugins/gpu_neon/gpu.c
+++ b/plugins/gpu_neon/gpu.c
@@ -26,6 +26,10 @@ long GPUinit(void)
{
int ret = vout_init();
gpu.status.reg = 0x14802000;
+ gpu.status.blanking = 1;
+ gpu.regs[3] = 1;
+ gpu.screen.hres = gpu.screen.w = 320;
+ gpu.screen.vres = gpu.screen.h = 240;
gpu.lcf_hc = &gpu.zero;
return ret;
}
@@ -56,14 +60,29 @@ static noinline void update_height(void)
gpu.screen.h = sh;
}
+static noinline void decide_frameskip(void)
+{
+ gpu.frameskip.frame_ready = !gpu.frameskip.active;
+
+ if (!gpu.frameskip.active && *gpu.frameskip.advice)
+ gpu.frameskip.active = 1;
+ else
+ gpu.frameskip.active = 0;
+}
+
void GPUwriteStatus(uint32_t data)
{
static const short hres[8] = { 256, 368, 320, 384, 512, 512, 640, 640 };
static const short vres[4] = { 240, 480, 256, 480 };
uint32_t cmd = data >> 24;
- if (cmd < ARRAY_SIZE(gpu.regs))
+ if (cmd < ARRAY_SIZE(gpu.regs)) {
+ if (cmd != 0 && gpu.regs[cmd] == data)
+ return;
gpu.regs[cmd] = data;
+ }
+
+ gpu.state.fb_dirty = 1;
switch (cmd) {
case 0x00:
@@ -79,6 +98,8 @@ void GPUwriteStatus(uint32_t data)
case 0x05:
gpu.screen.x = data & 0x3ff;
gpu.screen.y = (data >> 10) & 0x3ff;
+ if (gpu.frameskip.enabled)
+ decide_frameskip();
break;
case 0x06:
gpu.screen.x1 = data & 0xfff;
@@ -198,6 +219,7 @@ static void start_vram_transfer(uint32_t pos_word, uint32_t size_word, int is_re
static int check_cmd(uint32_t *data, int count)
{
int len, cmd, start, pos;
+ int vram_dirty = 0;
// process buffer
for (start = pos = 0; pos < count; )
@@ -240,6 +262,8 @@ static int check_cmd(uint32_t *data, int count)
gpu.status.reg |= (list[0] & 3) << 11;
break;
}
+ if (2 <= cmd && cmd < 0xc0)
+ vram_dirty = 1;
if (pos + len > count) {
cmd = -1;
@@ -251,7 +275,8 @@ static int check_cmd(uint32_t *data, int count)
}
if (pos - start > 0) {
- do_cmd_list(data + start, pos - start);
+ if (!gpu.frameskip.active)
+ do_cmd_list(data + start, pos - start);
start = pos;
}
@@ -265,6 +290,8 @@ static int check_cmd(uint32_t *data, int count)
break;
}
+ gpu.state.fb_dirty |= vram_dirty;
+
return count - pos;
}
@@ -390,6 +417,8 @@ typedef struct GPUFREEZETAG
long GPUfreeze(uint32_t type, GPUFreeze_t *freeze)
{
+ int i;
+
switch (type) {
case 1: // save
if (gpu.cmd_len > 0)
@@ -402,9 +431,10 @@ long GPUfreeze(uint32_t type, GPUFreeze_t *freeze)
memcpy(gpu.vram, freeze->psxVRam, sizeof(gpu.vram));
memcpy(gpu.regs, freeze->ulControl, sizeof(gpu.regs));
gpu.status.reg = freeze->ulStatus;
- GPUwriteStatus((5 << 24) | gpu.regs[5]);
- GPUwriteStatus((7 << 24) | gpu.regs[7]);
- GPUwriteStatus((8 << 24) | gpu.regs[8]);
+ for (i = 8; i > 0; i--) {
+ gpu.regs[i] ^= 1; // avoid reg change detection
+ GPUwriteStatus((i << 24) | (gpu.regs[i] ^ 1));
+ }
break;
}
diff --git a/plugins/gpu_neon/gpu.h b/plugins/gpu_neon/gpu.h
index 8813a44..bb2d6f6 100644
--- a/plugins/gpu_neon/gpu.h
+++ b/plugins/gpu_neon/gpu.h
@@ -57,6 +57,15 @@ struct psx_gpu {
int cmd_len;
const uint32_t *lcf_hc;
uint32_t zero;
+ struct {
+ uint32_t fb_dirty:1;
+ } state;
+ struct {
+ uint32_t enabled:1;
+ uint32_t active:1;
+ uint32_t frame_ready:1;
+ const int *advice;
+ } frameskip;
};
extern struct psx_gpu gpu;
diff --git a/plugins/gpu_neon/vout_fb.c b/plugins/gpu_neon/vout_fb.c
index fdcfd51..f80a29f 100644
--- a/plugins/gpu_neon/vout_fb.c
+++ b/plugins/gpu_neon/vout_fb.c
@@ -81,12 +81,20 @@ static void blit(void)
void GPUupdateLace(void)
{
- if (!gpu.status.blanking)
+ if (gpu.frameskip.enabled && !gpu.frameskip.frame_ready)
+ return;
+
+ if (!gpu.status.blanking && gpu.state.fb_dirty) {
blit();
+ gpu.state.fb_dirty = 0;
+ }
}
long GPUopen(void)
{
+ gpu.frameskip.enabled = cbs->frameskip;
+ gpu.frameskip.advice = &cbs->fskip_advice;
+
cbs->pl_fbdev_open();
screen_buf = cbs->pl_fbdev_flip();
return 0;
@@ -101,6 +109,9 @@ long GPUclose(void)
void GPUrearmedCallbacks(const struct rearmed_cbs *cbs_)
{
cbs = cbs_;
+ gpu.frameskip.enabled = cbs->frameskip;
+ gpu.frameskip.advice = &cbs->fskip_advice;
+ gpu.frameskip.active = gpu.frameskip.frame_ready = 0;
}
// vim:shiftwidth=2:expandtab