in_sdl_init(in_sdl_defbinds);
in_probe();
+ pl_rearmed_cbs.only_16bpp = 1;
return;
fail:
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;
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)
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;
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
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
{
#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;
}
}
+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) {}
{
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);
}
}
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
{