From 337a95f9b0784f4341d24ff481d86e4549fee69d Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sat, 16 Feb 2019 17:57:26 +0200 Subject: [PATCH] Overlay optimization, don't update if RTG and overlay does not change. --- od-win32/picasso96_win.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/od-win32/picasso96_win.cpp b/od-win32/picasso96_win.cpp index 036a3dcd..d9302c2c 100644 --- a/od-win32/picasso96_win.cpp +++ b/od-win32/picasso96_win.cpp @@ -4938,7 +4938,6 @@ static void picasso_flushoverlay(int index, uae_u8 *src, int scr_offset, uae_u8 overlay_convert, p96_rgbx16_ovl); y += my; } - vidinfo->full_refresh = 1; } void fb_copyrow(int monid, uae_u8 *src, uae_u8 *dst, int x, int y, int width, int srcpixbytes, int dy) @@ -5072,11 +5071,12 @@ static void picasso_flushpixels(int index, uae_u8 *src, int off, bool render) int miny = pheight - 1; int flushlines = 0, matchcount = 0; struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[monid]; + bool overlay_updated = false; src_start = src + (off & ~gwwpagemask[index]); src_end = src + ((off + state->BytesPerRow * pheight + gwwpagesize[index] - 1) & ~gwwpagemask[index]); #if 0 - write_log (_T("%dx%d %dx%d %dx%d (%dx%d)\n"), state->Width, state->Width, + write_log(_T("%dx%d %dx%d %dx%d (%dx%d)\n"), state->Width, state->Width, state->VirtualWidth, state->VirtualHeight, picasso_vidinfo.width, picasso_vidinfo.height, pwidth, pheight); @@ -5096,11 +5096,20 @@ static void picasso_flushpixels(int index, uae_u8 *src, int off, bool render) gwwcnt = 0; - if (doskip () && p96skipmode == 1) { + if (doskip() && p96skipmode == 1) { break; } - if (vidinfo->full_refresh < 0) { + if (!index && overlay_vram && overlay_active) { + ULONG ps; + gwwcnt = gwwbufsize[index]; + uae_u8 *ovr_start = src + (overlay_vram_offset & ~gwwpagemask[index]); + uae_u8 *ovr_end = src + ((overlay_vram_offset + overlay_src_width * overlay_src_height * overlay_pix + gwwpagesize[index] - 1) & ~gwwpagemask[index]); + mman_GetWriteWatch(ovr_start, ovr_end - ovr_start, gwwbuf[index], &gwwcnt, &ps); + overlay_updated = gwwcnt > 0; + } + + if (vidinfo->full_refresh < 0 || overlay_updated) { gwwcnt = (src_end - src_start) / gwwpagesize[index] + 1; vidinfo->full_refresh = 1; for (int i = 0; i < gwwcnt; i++) @@ -5108,7 +5117,7 @@ static void picasso_flushpixels(int index, uae_u8 *src, int off, bool render) } else { ULONG ps; gwwcnt = gwwbufsize[index]; - if (mman_GetWriteWatch (src_start, src_end - src_start, gwwbuf[index], &gwwcnt, &ps)) + if (mman_GetWriteWatch(src_start, src_end - src_start, gwwbuf[index], &gwwcnt, &ps)) break; } @@ -5126,7 +5135,7 @@ static void picasso_flushpixels(int index, uae_u8 *src, int off, bool render) break; dst += vidinfo->offset; - if (doskip () && p96skipmode == 2) { + if (doskip() && p96skipmode == 2) { break; } @@ -5195,7 +5204,7 @@ static void picasso_flushpixels(int index, uae_u8 *src, int off, bool render) break; } - if (!index && overlay_vram && overlay_active) { + if (!index && overlay_vram && overlay_active && (flushlines || overlay_updated)) { if (dst == NULL) { dst = gfx_lock_picasso(monid, false, false); } -- 2.47.3