]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Overlay optimization, don't update if RTG and overlay does not change.
authorToni Wilen <twilen@winuae.net>
Sat, 16 Feb 2019 15:57:26 +0000 (17:57 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 16 Feb 2019 15:57:26 +0000 (17:57 +0200)
od-win32/picasso96_win.cpp

index 036a3dcd8e3bb5e04f69e5ff7696d27d7e3b938e..d9302c2c471ca174d428e8483cf8e7761f31452b 100644 (file)
@@ -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);
                }