aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornotaz2012-04-29 19:18:49 +0300
committernotaz2012-04-29 19:32:08 +0300
commit4ea7de6a1495abfbc49c54fd2a90e902fdfa13d9 (patch)
treef062e83f543a583e75ca58e88511f79057464a93
parentb07c18e8645a17be916266820ae564e0d320cc1a (diff)
downloadpcsx_rearmed-4ea7de6a1495abfbc49c54fd2a90e902fdfa13d9.tar.gz
pcsx_rearmed-4ea7de6a1495abfbc49c54fd2a90e902fdfa13d9.tar.bz2
pcsx_rearmed-4ea7de6a1495abfbc49c54fd2a90e902fdfa13d9.zip
gpu plugins: always support 16bpp blit
use this for generic sdl and maemo
-rw-r--r--frontend/plat_sdl.c1
-rw-r--r--frontend/plugin_lib.h1
-rw-r--r--maemo/hildon.c2
-rw-r--r--plugins/dfxvideo/draw_pl.c22
-rw-r--r--plugins/gpu_unai/gpu.cpp21
-rw-r--r--plugins/gpulib/cspace.c28
-rw-r--r--plugins/gpulib/vout_pl.c31
7 files changed, 70 insertions, 36 deletions
diff --git a/frontend/plat_sdl.c b/frontend/plat_sdl.c
index 19d7ac0..b9a27c3 100644
--- a/frontend/plat_sdl.c
+++ b/frontend/plat_sdl.c
@@ -80,6 +80,7 @@ void plat_init(void)
in_sdl_init(in_sdl_defbinds);
in_probe();
+ pl_rearmed_cbs.only_16bpp = 1;
return;
fail:
diff --git a/frontend/plugin_lib.h b/frontend/plugin_lib.h
index 8645385..bcf74ac 100644
--- a/frontend/plugin_lib.h
+++ b/frontend/plugin_lib.h
@@ -57,6 +57,7 @@ struct rearmed_cbs {
unsigned int *gpu_hcnt;
unsigned int flip_cnt; // increment manually if not using pl_vout_flip
unsigned int screen_w, screen_h; // gles plugin wants this
+ unsigned int only_16bpp; // platform is 16bpp-only
struct {
int allow_interlace; // 0 off, 1 on, 2 guess
} gpu_neon;
diff --git a/maemo/hildon.c b/maemo/hildon.c
index 8948c3b..8e7635a 100644
--- a/maemo/hildon.c
+++ b/maemo/hildon.c
@@ -182,6 +182,8 @@ void maemo_init(int *argc, char ***argv)
g_layer_x = (X_RES - D_WIDTH) / 2;
g_layer_y = (Y_RES - D_HEIGHT) / 2;
g_layer_w = D_WIDTH, g_layer_h = D_HEIGHT;
+
+ pl_rearmed_cbs.only_16bpp = 1;
}
void menu_loop(void)
diff --git a/plugins/dfxvideo/draw_pl.c b/plugins/dfxvideo/draw_pl.c
index 22351a4..dffd52b 100644
--- a/plugins/dfxvideo/draw_pl.c
+++ b/plugins/dfxvideo/draw_pl.c
@@ -32,13 +32,7 @@ static void blit(void *vout_buf)
if (w <= 0)
return;
-#ifndef MAEMO
- pitch *= PSXDisplay.RGB24 ? 3 : 2;
-#else
- // n900 doesn't do rgb24 for some reason
- pitch *= 2;
- #define bgr888_to_rgb888 bgr888_to_rgb565
-#endif
+ pitch *= (PSXDisplay.RGB24 && !rcbs->only_16bpp) ? 3 : 2;
// account for centering
h -= PreviousPSXDisplay.Range.y0;
@@ -47,9 +41,19 @@ static void blit(void *vout_buf)
if (PSXDisplay.RGB24)
{
- for (; h-- > 0; dest += pitch, srcs += 1024)
+ if (!rcbs->only_16bpp)
+ {
+ for (; h-- > 0; dest += pitch, srcs += 1024)
+ {
+ bgr888_to_rgb888(dest, srcs, w * 3);
+ }
+ }
+ else
{
- bgr888_to_rgb888(dest, srcs, w * 3);
+ for (; h-- > 0; dest += pitch, srcs += 1024)
+ {
+ bgr888_to_rgb565(dest, srcs, w * 3);
+ }
}
}
else
diff --git a/plugins/gpu_unai/gpu.cpp b/plugins/gpu_unai/gpu.cpp
index 5a0ad2c..3c30ffa 100644
--- a/plugins/gpu_unai/gpu.cpp
+++ b/plugins/gpu_unai/gpu.cpp
@@ -861,19 +861,22 @@ static void blit(void)
if (isRGB24)
{
-#ifndef MAEMO
- for (; h1-- > 0; dest += w0 * 3, fb_offs += 1024)
+ if (!cbs->only_16bpp)
{
- fb_offs &= 1024*512-1;
- bgr888_to_rgb888(dest, base + fb_offs, w0 * 3);
+ 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)
+ else
{
- fb_offs &= 1024*512-1;
- bgr888_to_rgb565(dest, base + fb_offs, w0 * 3);
+ for (; h1-- > 0; dest += w0 * 2, fb_offs += 1024)
+ {
+ fb_offs &= 1024*512-1;
+ bgr888_to_rgb565(dest, base + fb_offs, w0 * 3);
+ }
}
-#endif
}
else
{
diff --git a/plugins/gpulib/cspace.c b/plugins/gpulib/cspace.c
index eee56ce..408211f 100644
--- a/plugins/gpulib/cspace.c
+++ b/plugins/gpulib/cspace.c
@@ -1,9 +1,14 @@
#include "cspace.h"
+/*
+ * note: these are intended for testing and should be avoided
+ * in favor of NEON version or platform-specific conversion
+ */
+
void bgr555_to_rgb565(void *dst_, const void *src_, int bytes)
{
- unsigned int *src = (unsigned int *)src_;
- unsigned int *dst = (unsigned int *)dst_;
+ const unsigned int *src = src_;
+ unsigned int *dst = dst_;
unsigned int p;
int x;
@@ -15,7 +20,24 @@ void bgr555_to_rgb565(void *dst_, const void *src_, int bytes)
}
}
+void bgr888_to_rgb565(void *dst_, const void *src_, int bytes)
+{
+ const unsigned char *src = src_;
+ unsigned int *dst = dst_;
+ unsigned int r1, g1, b1, r2, g2, b2;
+
+ for (; bytes >= 6; bytes -= 6, src += 6, dst++) {
+ r1 = src[0] & 0xf8;
+ g1 = src[1] & 0xfc;
+ b1 = src[2] & 0xf8;
+ r2 = src[3] & 0xf8;
+ g2 = src[4] & 0xfc;
+ b2 = src[5] & 0xf8;
+ *dst = (r2 << 24) | (g2 << 19) | (b2 << 13) |
+ (r1 << 8) | (g1 << 3) | (b1 >> 3);
+ }
+}
+
// TODO?
void bgr888_to_rgb888(void *dst, const void *src, int bytes) {}
-void bgr888_to_rgb565(void *dst, const void *src, int bytes) {}
diff --git a/plugins/gpulib/vout_pl.c b/plugins/gpulib/vout_pl.c
index 91de057..79b6c3e 100644
--- a/plugins/gpulib/vout_pl.c
+++ b/plugins/gpulib/vout_pl.c
@@ -36,8 +36,8 @@ static void check_mode_change(void)
{
old_status = gpu.status.reg;
old_h = gpu.screen.h;
- screen_buf = cbs->pl_vout_set_mode(gpu.screen.hres,
- gpu.screen.h, gpu.status.rgb24 ? 24 : 16);
+ screen_buf = cbs->pl_vout_set_mode(gpu.screen.hres, gpu.screen.h,
+ (gpu.status.rgb24 && !cbs->only_16bpp) ? 24 : 16);
}
}
@@ -60,21 +60,22 @@ static void blit(void)
if (gpu.status.rgb24)
{
-#ifndef MAEMO
- dest += (doffs / 8) * 24;
- for (; h-- > 0; dest += stride * 3, fb_offs += 1024)
- {
- fb_offs &= 1024*512-1;
- bgr888_to_rgb888(dest, vram + fb_offs, w * 3);
+ if (cbs->only_16bpp) {
+ dest += doffs * 2;
+ for (; h-- > 0; dest += stride * 2, fb_offs += 1024)
+ {
+ fb_offs &= 1024*512-1;
+ bgr888_to_rgb565(dest, vram + fb_offs, w * 3);
+ }
}
-#else
- dest += doffs * 2;
- for (; h-- > 0; dest += stride * 2, fb_offs += 1024)
- {
- fb_offs &= 1024*512-1;
- bgr888_to_rgb565(dest, vram + fb_offs, w * 3);
+ else {
+ dest += (doffs / 8) * 24;
+ for (; h-- > 0; dest += stride * 3, fb_offs += 1024)
+ {
+ fb_offs &= 1024*512-1;
+ bgr888_to_rgb888(dest, vram + fb_offs, w * 3);
+ }
}
-#endif
}
else
{