aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/dfxvideo/draw_pl.c45
-rw-r--r--plugins/dfxvideo/gpu.c2
-rw-r--r--plugins/dfxvideo/gpulib_if.c2
-rw-r--r--plugins/gpu-gles/gpulib_if.c2
-rw-r--r--plugins/gpu_neon/psx_gpu_if.c7
-rw-r--r--plugins/gpu_unai/gpu.cpp69
-rw-r--r--plugins/gpulib/gpu.h2
-rw-r--r--plugins/gpulib/vout_pl.c91
8 files changed, 48 insertions, 172 deletions
diff --git a/plugins/dfxvideo/draw_pl.c b/plugins/dfxvideo/draw_pl.c
index dffd52b..06a635d 100644
--- a/plugins/dfxvideo/draw_pl.c
+++ b/plugins/dfxvideo/draw_pl.c
@@ -19,56 +19,26 @@ BOOL bCheckMask = FALSE;
unsigned short sSetMask;
unsigned long lSetMask;
-static void blit(void *vout_buf)
+static void blit(void)
{
int px = PSXDisplay.DisplayPosition.x & ~1; // XXX: align needed by bgr*_to_...
int py = PSXDisplay.DisplayPosition.y;
int w = PreviousPSXDisplay.Range.x1;
int h = PreviousPSXDisplay.DisplayMode.y;
- int pitch = PreviousPSXDisplay.DisplayMode.x;
unsigned short *srcs = psxVuw + py * 1024 + px;
- unsigned char *dest = vout_buf;
if (w <= 0)
return;
- pitch *= (PSXDisplay.RGB24 && !rcbs->only_16bpp) ? 3 : 2;
-
// account for centering
h -= PreviousPSXDisplay.Range.y0;
- dest += PreviousPSXDisplay.Range.y0 / 2 * pitch;
- dest += (PreviousPSXDisplay.Range.x0 & ~3) * 2; // must align here too..
-
- if (PSXDisplay.RGB24)
- {
- if (!rcbs->only_16bpp)
- {
- for (; h-- > 0; dest += pitch, srcs += 1024)
- {
- bgr888_to_rgb888(dest, srcs, w * 3);
- }
- }
- else
- {
- for (; h-- > 0; dest += pitch, srcs += 1024)
- {
- bgr888_to_rgb565(dest, srcs, w * 3);
- }
- }
- }
- else
- {
- for (; h-- > 0; dest += pitch, srcs += 1024)
- {
- bgr555_to_rgb565(dest, srcs, w * 2);
- }
- }
+
+ rcbs->pl_vout_flip(srcs, 1024, PSXDisplay.RGB24, w, h);
}
void DoBufferSwap(void)
{
static int fbw, fbh, fb24bpp;
- static void *vout_buf;
if (PreviousPSXDisplay.DisplayMode.x == 0 || PreviousPSXDisplay.DisplayMode.y == 0)
return;
@@ -80,17 +50,12 @@ void DoBufferSwap(void)
fbw = PreviousPSXDisplay.DisplayMode.x;
fbh = PreviousPSXDisplay.DisplayMode.y;
fb24bpp = PSXDisplay.RGB24;
- vout_buf = rcbs->pl_vout_set_mode(fbw, fbh, fb24bpp ? 24 : 16);
+ rcbs->pl_vout_set_mode(fbw, fbh, fb24bpp ? 24 : 16);
}
pcnt_start(PCNT_BLIT);
- if (rcbs->pl_vout_raw_flip != NULL)
- rcbs->pl_vout_raw_flip(PSXDisplay.DisplayPosition.x, PSXDisplay.DisplayPosition.y);
- else
- blit(vout_buf);
+ blit();
pcnt_end(PCNT_BLIT);
-
- vout_buf = rcbs->pl_vout_flip();
}
void DoClearScreenBuffer(void)
diff --git a/plugins/dfxvideo/gpu.c b/plugins/dfxvideo/gpu.c
index 9fa08fe..3d20dfa 100644
--- a/plugins/dfxvideo/gpu.c
+++ b/plugins/dfxvideo/gpu.c
@@ -1143,6 +1143,8 @@ void GPUrearmedCallbacks(const struct rearmed_cbs *cbs)
dwFrameRateTicks = cbs->gpu_peops.dwFrameRateTicks;
if (cbs->pl_vout_set_raw_vram)
cbs->pl_vout_set_raw_vram(psxVub);
+ if (cbs->pl_set_gpu_caps)
+ cbs->pl_set_gpu_caps(0);
skip_advice = &cbs->fskip_advice;
fps_skip = 100.0f;
diff --git a/plugins/dfxvideo/gpulib_if.c b/plugins/dfxvideo/gpulib_if.c
index 50130f6..d98520c 100644
--- a/plugins/dfxvideo/gpulib_if.c
+++ b/plugins/dfxvideo/gpulib_if.c
@@ -421,5 +421,7 @@ void renderer_set_config(const struct rearmed_cbs *cbs)
{
iUseDither = cbs->gpu_peops.iUseDither;
dwActFixes = cbs->gpu_peops.dwActFixes;
+ if (cbs->pl_set_gpu_caps)
+ cbs->pl_set_gpu_caps(0);
set_vram(gpu.vram);
}
diff --git a/plugins/gpu-gles/gpulib_if.c b/plugins/gpu-gles/gpulib_if.c
index d245c44..068dc41 100644
--- a/plugins/gpu-gles/gpulib_if.c
+++ b/plugins/gpu-gles/gpulib_if.c
@@ -715,6 +715,8 @@ void renderer_set_config(const struct rearmed_cbs *cbs_)
bUseFastMdec = cbs->gpu_peopsgl.bUseFastMdec;
iTexGarbageCollection = cbs->gpu_peopsgl.iTexGarbageCollection;
iVRamSize = cbs->gpu_peopsgl.iVRamSize;
+ if (cbs->pl_set_gpu_caps)
+ cbs->pl_set_gpu_caps(GPU_CAP_OWNS_DISPLAY);
set_vram(gpu.vram);
}
diff --git a/plugins/gpu_neon/psx_gpu_if.c b/plugins/gpu_neon/psx_gpu_if.c
index 3ce9c1c..8900d4e 100644
--- a/plugins/gpu_neon/psx_gpu_if.c
+++ b/plugins/gpu_neon/psx_gpu_if.c
@@ -44,7 +44,7 @@ int do_cmd_list(uint32_t *list, int count, int *last_cmd)
#define ENHANCEMENT_BUF_SIZE (1024 * 1024 * 2 * 4 + 4096 * 2)
static uint16_t *get_enhancement_bufer(int *x, int *y, int *w, int *h,
- int *stride, int *mask)
+ int *vram_h)
{
uint16_t *ret = select_enhancement_buf_ptr(&egpu, *x);
@@ -52,8 +52,7 @@ static uint16_t *get_enhancement_bufer(int *x, int *y, int *w, int *h,
*y *= 2;
*w = *w * 2;
*h = *h * 2;
- *stride *= 2;
- *mask = 1024 * 1024 - 1;
+ *vram_h = 1024;
return ret;
}
@@ -183,4 +182,6 @@ void renderer_set_config(const struct rearmed_cbs *cbs)
if (gpu.mmap != NULL && egpu.enhancement_buf_ptr == NULL)
map_enhancement_buffer();
+ if (cbs->pl_set_gpu_caps)
+ cbs->pl_set_gpu_caps(GPU_CAP_SUPPORTS_2X);
}
diff --git a/plugins/gpu_unai/gpu.cpp b/plugins/gpu_unai/gpu.cpp
index 46552ac..c111d78 100644
--- a/plugins/gpu_unai/gpu.cpp
+++ b/plugins/gpu_unai/gpu.cpp
@@ -824,7 +824,6 @@ void GPU_updateLace(void)
extern "C" {
static const struct rearmed_cbs *cbs;
-static void *screen_buf;
static s16 old_res_horz, old_res_vert, old_rgb24;
static void blit(void)
@@ -832,12 +831,10 @@ static void blit(void)
u16 *base = (u16 *)GPU_FrameBuffer;
s16 isRGB24 = (GPU_GP1 & 0x00200000) ? 1 : 0;
s16 h0, x0, y0, w0, h1;
- u32 fb_offs;
- u8 *dest;
x0 = DisplayArea[0] & ~1; // alignment needed by blitter
y0 = DisplayArea[1];
- fb_offs = FRAME_OFFSET(x0, y0);
+ base += FRAME_OFFSET(x0, y0);
w0 = DisplayArea[2];
h0 = DisplayArea[3]; // video mode
@@ -853,62 +850,10 @@ static void blit(void)
old_res_horz = w0;
old_res_vert = h1;
old_rgb24 = (s16)isRGB24;
- screen_buf = cbs->pl_vout_set_mode(w0, h1, isRGB24 ? 24 : 16);
+ cbs->pl_vout_set_mode(w0, h1, isRGB24 ? 24 : 16);
}
- dest = (u8 *)screen_buf;
- if (isRGB24)
- {
- if (!cbs->only_16bpp)
- {
- for (; h1-- > 0; dest += w0 * 3, fb_offs += 1024)
- {
- fb_offs &= 1024*512-1;
- bgr888_to_rgb888(dest, base + fb_offs, w0 * 3);
- }
- }
- else
- {
- for (; h1-- > 0; dest += w0 * 2, fb_offs += 1024)
- {
- fb_offs &= 1024*512-1;
- bgr888_to_rgb565(dest, base + fb_offs, w0 * 3);
- }
- }
- }
- else
- {
- for (; h1-- > 0; dest += w0 * 2, fb_offs += 1024)
- {
- fb_offs &= 1024*512-1;
- bgr555_to_rgb565(dest, base + fb_offs, w0 * 2);
- }
- }
-
- screen_buf = cbs->pl_vout_flip();
-}
-
-static void blit_raw(void)
-{
- s16 isRGB24 = (GPU_GP1 & 0x00200000) ? 1 : 0;
- s16 h0, w0, h1;
-
- w0 = DisplayArea[2];
- h0 = DisplayArea[3]; // video mode
- h1 = DisplayArea[5] - DisplayArea[4]; // display needed
- if (h0 == 480) h1 = Min2(h1*2,480);
-
- if (h1 <= 0)
- return;
-
- if (w0 != old_res_horz || h1 != old_res_vert || isRGB24 != old_rgb24)
- {
- old_res_horz = w0;
- old_res_vert = h1;
- old_rgb24 = (s16)isRGB24;
- screen_buf = cbs->pl_vout_set_mode(w0, h1, isRGB24 ? 24 : 16);
- }
- cbs->pl_vout_raw_flip(DisplayArea[0], DisplayArea[1]);
+ cbs->pl_vout_flip(base, 1024, isRGB24, w0, h1);
}
void GPU_updateLace(void)
@@ -920,10 +865,7 @@ void GPU_updateLace(void)
return;
if (!wasSkip) {
- if (cbs->pl_vout_raw_flip != NULL)
- blit_raw();
- else
- blit();
+ blit();
fb_dirty = false;
skCount = 0;
}
@@ -939,7 +881,6 @@ void GPU_updateLace(void)
long GPUopen(unsigned long *, char *, char *)
{
cbs->pl_vout_open();
- screen_buf = cbs->pl_vout_flip();
return 0;
}
@@ -966,6 +907,8 @@ void GPUrearmedCallbacks(const struct rearmed_cbs *cbs_)
cbs_->pl_vout_set_raw_vram((void *)GPU_FrameBuffer);
cbs = cbs_;
+ if (cbs->pl_set_gpu_caps)
+ cbs->pl_set_gpu_caps(0);
}
} /* extern "C" */
diff --git a/plugins/gpulib/gpu.h b/plugins/gpulib/gpu.h
index ea5051e..d11f991 100644
--- a/plugins/gpulib/gpu.h
+++ b/plugins/gpulib/gpu.h
@@ -89,7 +89,7 @@ struct psx_gpu {
uint32_t pending_fill[3];
} frameskip;
uint16_t *(*get_enhancement_bufer)
- (int *x, int *y, int *w, int *h, int *stride, int *mask);
+ (int *x, int *y, int *w, int *h, int *vram_h);
void *(*mmap)(unsigned int size);
void (*munmap)(void *ptr, unsigned int size);
};
diff --git a/plugins/gpulib/vout_pl.c b/plugins/gpulib/vout_pl.c
index 9a84432..11307e2 100644
--- a/plugins/gpulib/vout_pl.c
+++ b/plugins/gpulib/vout_pl.c
@@ -15,7 +15,6 @@
#include "../../frontend/plugin_lib.h"
static const struct rearmed_cbs *cbs;
-static void *screen_buf;
int vout_init(void)
{
@@ -27,7 +26,7 @@ int vout_finish(void)
return 0;
}
-static void check_mode_change(void)
+static void check_mode_change(int force)
{
static uint32_t old_status;
static int old_h;
@@ -44,95 +43,57 @@ static void check_mode_change(void)
}
// width|rgb24 change?
- if ((gpu.status.reg ^ old_status) & ((7<<16)|(1<<21)) || h != old_h)
+ if (force || (gpu.status.reg ^ old_status) & ((7<<16)|(1<<21)) || h != old_h)
{
old_status = gpu.status.reg;
old_h = h;
- screen_buf = cbs->pl_vout_set_mode(w, h,
+ cbs->pl_vout_set_mode(w, h,
(gpu.status.rgb24 && !cbs->only_16bpp) ? 24 : 16);
}
}
-static void blit(void)
+void vout_update(void)
{
int x = gpu.screen.x & ~1; // alignment needed by blitter
int y = gpu.screen.y;
int w = gpu.screen.w;
int h = gpu.screen.h;
uint16_t *vram = gpu.vram;
- int stride = gpu.screen.hres;
- int vram_stride = 1024;
- int vram_mask = 1024 * 512 - 1;
- int fb_offs, doffs;
- uint8_t *dest;
-
- dest = (uint8_t *)screen_buf;
- if (dest == NULL || w == 0 || stride == 0)
+ int vram_h = 512;
+
+ if (w == 0 || h == 0)
return;
+ check_mode_change(0);
if (gpu.state.enhancement_active)
- vram = gpu.get_enhancement_bufer(&x, &y, &w, &h, &stride, &vram_mask);
-
- fb_offs = y * vram_stride + x;
+ vram = gpu.get_enhancement_bufer(&x, &y, &w, &h, &vram_h);
- // only do centering, at least for now
- doffs = (stride - w) / 2 & ~1;
-
- if (gpu.status.rgb24)
- {
- if (cbs->only_16bpp) {
- dest += doffs * 2;
- for (; h-- > 0; dest += stride * 2, fb_offs += vram_stride)
- {
- fb_offs &= vram_mask;
- bgr888_to_rgb565(dest, vram + fb_offs, w * 3);
- }
- }
- else {
- dest += (doffs / 8) * 24;
- for (; h-- > 0; dest += stride * 3, fb_offs += vram_stride)
- {
- fb_offs &= vram_mask;
- bgr888_to_rgb888(dest, vram + fb_offs, w * 3);
- }
- }
- }
- else
- {
- dest += doffs * 2;
- for (; h-- > 0; dest += stride * 2, fb_offs += vram_stride)
- {
- fb_offs &= vram_mask;
- bgr555_to_rgb565(dest, vram + fb_offs, w * 2);
+ if (y + h > vram_h) {
+ if (y + h - vram_h > h / 2) {
+ // wrap
+ y = 0;
+ h -= vram_h - y;
}
+ else
+ // clip
+ h = vram_h - y;
}
- screen_buf = cbs->pl_vout_flip();
-}
+ vram += y * 1024 + x;
-void vout_update(void)
-{
- check_mode_change();
- if (cbs->pl_vout_raw_flip)
- cbs->pl_vout_raw_flip(gpu.screen.x, gpu.screen.y);
- else
- blit();
+ cbs->pl_vout_flip(vram, 1024, gpu.status.rgb24, w, h);
}
void vout_blank(void)
{
- if (cbs->pl_vout_raw_flip == NULL) {
- int w = gpu.screen.hres;
- int h = gpu.screen.h;
- int bytespp = gpu.status.rgb24 ? 3 : 2;
- if (gpu.state.enhancement_active) {
- w *= 2;
- h *= 2;
- }
- memset(screen_buf, 0, w * h * bytespp);
- screen_buf = cbs->pl_vout_flip();
+ int w = gpu.screen.hres;
+ int h = gpu.screen.h;
+ if (gpu.state.enhancement_active) {
+ w *= 2;
+ h *= 2;
}
+ cbs->pl_vout_flip(NULL, 1024, gpu.status.rgb24, w, h);
}
long GPUopen(void **unused)
@@ -141,7 +102,7 @@ long GPUopen(void **unused)
gpu.frameskip.frame_ready = 1;
cbs->pl_vout_open();
- screen_buf = cbs->pl_vout_flip();
+ check_mode_change(1);
return 0;
}