info->size_y = psx_h * (pl_rearmed_cbs.gpu_neon.enhancement_enable ? 2 : 1) * (4.0f / 3.0f) / 40.0f;
}
-static void vout_flip(const void *vram, int stride, int bgr24,
+static void vout_flip(const void *vram_, int vram_ofs, int bgr24,
int x, int y, int w, int h, int dims_changed)
{
int bytes_pp = (current_fmt == RETRO_PIXEL_FORMAT_XRGB8888) ? 4 : 2;
int bytes_pp_s = bgr24 ? 3 : 2;
bgr_to_fb_func *bgr_to_fb = g_bgr_to_fb;
unsigned char *dest = vout_buf_ptr;
- const unsigned short *src = vram;
+ const unsigned char *vram = vram_;
int dstride = vout_pitch_b, h1 = h;
- int port = 0;
+ int port = 0, hwrapped;
if (vram == NULL || dims_changed || (in_enable_crosshair[0] + in_enable_crosshair[1]) > 0)
{
dest += x * bytes_pp + y * dstride;
- for (; h1-- > 0; dest += dstride, src += stride)
- bgr_to_fb(dest, src, w * bytes_pp_s);
+ for (; h1-- > 0; dest += dstride) {
+ bgr_to_fb(dest, vram + vram_ofs, w * bytes_pp_s);
+ vram_ofs = (vram_ofs + 2048) & 0xfffff;
+ }
+
+ hwrapped = (vram_ofs & 2047) + w * bytes_pp_s - 2048;
+ if (hwrapped > 0) {
+ // this is super-rare so just fix-up
+ vram_ofs = (vram_ofs - h * 2048) & 0xff800;
+ dest -= dstride * h;
+ dest += (w - hwrapped / bytes_pp_s) * bytes_pp;
+ for (h1 = h; h1-- > 0; dest += dstride) {
+ bgr_to_fb(dest, vram + vram_ofs, hwrapped);
+ vram_ofs = (vram_ofs + 2048) & 0xfffff;
+ }
+ }
if (current_fmt == RETRO_PIXEL_FORMAT_RGB565)
for (port = 0; port < 2; port++) {
flip_clear_counter = 2;
}
-static void pl_vout_flip(const void *vram, int stride, int bgr24,
+static void pl_vout_flip(const void *vram_, int vram_ofs, int bgr24,
int x, int y, int w, int h, int dims_changed)
{
unsigned char *dest = pl_vout_buf;
- const unsigned short *src = vram;
+ const unsigned char *vram = vram_;
int dstride = pl_vout_w, h1 = h;
int h_full = pl_vout_h - pl_vout_yoffset;
int xoffs = 0, doffs;
+ int hwrapped;
pcnt_start(PCNT_BLIT);
if (pl_plat_blit)
{
- pl_plat_blit(doffs, src, w, h, stride, bgr24);
+ pl_plat_blit(doffs, vram + vram_ofs, w, h, 1024, bgr24);
goto out_hud;
}
if (bgr24)
{
+ hwrapped = (vram_ofs & 2047) + w * 3 - 2048;
if (pl_rearmed_cbs.only_16bpp) {
- for (; h1-- > 0; dest += dstride * 2, src += stride)
- {
- bgr888_to_rgb565(dest, src, w * 3);
+ for (; h1-- > 0; dest += dstride * 2) {
+ bgr888_to_rgb565(dest, vram + vram_ofs, w * 3);
+ vram_ofs = (vram_ofs + 2048) & 0xfffff;
+ }
+
+ if (hwrapped > 0) {
+ // this is super-rare so just fix-up
+ vram_ofs = (vram_ofs - h * 2048) & 0xff800;
+ dest -= dstride * 2 * h;
+ dest += (w - hwrapped / 3) * 2;
+ for (h1 = h; h1-- > 0; dest += dstride * 2) {
+ bgr888_to_rgb565(dest, vram + vram_ofs, hwrapped);
+ vram_ofs = (vram_ofs + 2048) & 0xfffff;
+ }
}
}
else {
dest -= doffs * 2;
dest += (doffs / 8) * 24;
- for (; h1-- > 0; dest += dstride * 3, src += stride)
- {
- bgr888_to_rgb888(dest, src, w * 3);
+ for (; h1-- > 0; dest += dstride * 3) {
+ bgr888_to_rgb888(dest, vram + vram_ofs, w * 3);
+ vram_ofs = (vram_ofs + 2048) & 0xfffff;
+ }
+
+ if (hwrapped > 0) {
+ vram_ofs = (vram_ofs - h * 2048) & 0xff800;
+ dest -= dstride * 3 * h;
+ dest += w * 3 - hwrapped;
+ for (h1 = h; h1-- > 0; dest += dstride * 3) {
+ bgr888_to_rgb888(dest, vram + vram_ofs, hwrapped);
+ vram_ofs = (vram_ofs + 2048) & 0xfffff;
+ }
}
}
}
#ifdef HAVE_NEON32
else if (soft_filter == SOFT_FILTER_SCALE2X && pl_vout_scale_w == 2)
{
- neon_scale2x_16_16(src, (void *)dest, w,
- stride * 2, dstride * 2, h);
+ neon_scale2x_16_16((const void *)(vram + vram_ofs), (void *)dest, w,
+ 2048, dstride * 2, h);
}
else if (soft_filter == SOFT_FILTER_EAGLE2X && pl_vout_scale_w == 2)
{
- neon_eagle2x_16_16(src, (void *)dest, w,
- stride * 2, dstride * 2, h);
+ neon_eagle2x_16_16((const void *)(vram + vram_ofs), (void *)dest, w,
+ 2048, dstride * 2, h);
}
else if (scanlines != 0 && scanline_level != 100)
{
int h2, l = scanline_level * 2048 / 100;
- int stride_0 = pl_vout_scale_h >= 2 ? 0 : stride;
+ int stride_0 = pl_vout_scale_h >= 2 ? 0 : 2048;
h1 *= pl_vout_scale_h;
while (h1 > 0)
{
for (h2 = scanlines; h2 > 0 && h1 > 0; h2--, h1--) {
- bgr555_to_rgb565(dest, src, w * 2);
- dest += dstride * 2, src += stride_0;
+ bgr555_to_rgb565(dest, vram + vram_ofs, w * 2);
+ vram_ofs = (vram_ofs + stride_0) & 0xfffff;
+ dest += dstride * 2;
}
for (h2 = scanlines; h2 > 0 && h1 > 0; h2--, h1--) {
- bgr555_to_rgb565_b(dest, src, w * 2, l);
- dest += dstride * 2, src += stride;
+ bgr555_to_rgb565_b(dest, vram + vram_ofs, w * 2, l);
+ vram_ofs = (vram_ofs + 2048) & 0xfffff;
+ dest += dstride * 2;
}
}
}
#endif
else
{
- for (; h1-- > 0; dest += dstride * 2, src += stride)
- {
- bgr555_to_rgb565(dest, src, w * 2);
+ for (; h1-- > 0; dest += dstride * 2) {
+ bgr555_to_rgb565(dest, vram + vram_ofs, w * 2);
+ vram_ofs = (vram_ofs + 2048) & 0xfffff;
+ }
+
+ hwrapped = (vram_ofs & 2047) + w * 2 - 2048;
+ if (hwrapped > 0) {
+ vram_ofs = (vram_ofs - h * 2048) & 0xff800;
+ dest -= dstride * 2 * h;
+ dest += w * 2 - hwrapped;
+ for (h1 = h; h1-- > 0; dest += dstride * 2) {
+ bgr555_to_rgb565(dest, vram + vram_ofs, hwrapped);
+ vram_ofs = (vram_ofs + 2048) & 0xfffff;
+ }
}
}
int h = gpu.screen.h;
int vram_h = 512;
int src_x2 = 0;
+ int offset;
#ifdef RAW_FB_DISPLAY
w = (gpu.status & PSX_GPU_STATUS_RGB24) ? 2048/3 : 1024;
h = vram_h - src_y;
}
- vram += (src_y * 1024 + src_x) * 2;
- vram += src_x2 * bpp / 8;
+ offset = (src_y * 1024 + src_x) * 2;
+ offset += src_x2 * bpp / 8;
- cbs->pl_vout_flip(vram, 1024, !!(gpu.status & PSX_GPU_STATUS_RGB24),
+ cbs->pl_vout_flip(vram, offset, !!(gpu.status & PSX_GPU_STATUS_RGB24),
x, y, w, h, gpu.state.dims_changed);
gpu.state.dims_changed = 0;
return 1;
w *= 2;
h *= 2;
}
- cbs->pl_vout_flip(NULL, 1024, !!(gpu.status & PSX_GPU_STATUS_RGB24), 0, 0, w, h, 0);
+ cbs->pl_vout_flip(NULL, 0, !!(gpu.status & PSX_GPU_STATUS_RGB24), 0, 0, w, h, 0);
}
long GPUopen(unsigned long *disp, char *cap, char *cfg)