Commits

a1ex committed ef03ea7

Small performance tweaks for LiveView tools - always use CACHEABLE image buffers. Not yet benchmarked, but Magic Zoom seems completely flicker-free :)

  • Participants
  • Parent commits 536acd9

Comments (0)

Files changed (3)

File src/tweaks.c

     uint32_t* dst_buf;
     display_filter_get_buffers(&src_buf, &dst_buf);
     if (DEFISH_HD) src_buf = get_yuv422_hd_vram()->vram;
+    
+    // small speedup (26fps with cacheable vs 20 without)
+    src_buf = CACHEABLE(src_buf);
+    dst_buf = CACHEABLE(dst_buf);
+    
     //~ memcpy(dst_buf, src_buf, buf_size/2);
     //~ return;
         
     switch (YUV422_LV_BUFFER_DMA_ADDR)
     {
         case YUV422_LV_BUFFER_1:
-            return (void*)YUV422_LV_BUFFER_1;
+            return (void*)CACHEABLE(YUV422_LV_BUFFER_1);
         case YUV422_LV_BUFFER_2:
-            return (void*)YUV422_LV_BUFFER_2;
+            return (void*)CACHEABLE(YUV422_LV_BUFFER_2);
         case YUV422_LV_BUFFER_3:
-            return (void*)YUV422_LV_BUFFER_3;
+            return (void*)CACHEABLE(YUV422_LV_BUFFER_3);
     }
-    return (void*)YUV422_LV_BUFFER_1; // fall back to default
+    return (void*)CACHEABLE(YUV422_LV_BUFFER_1); // fall back to default
 }
 
 static int fastrefresh_direction = 0;
         switch (YUV422_LV_BUFFER_DMA_ADDR)
         {
             case YUV422_LV_BUFFER_1:
-                return (void*)YUV422_LV_BUFFER_2;
+                return (void*)CACHEABLE(YUV422_LV_BUFFER_2);
             case YUV422_LV_BUFFER_2:
-                return (void*)YUV422_LV_BUFFER_3;
+                return (void*)CACHEABLE(YUV422_LV_BUFFER_3);
             case YUV422_LV_BUFFER_3:
-                return (void*)YUV422_LV_BUFFER_1;
+                return (void*)CACHEABLE(YUV422_LV_BUFFER_1);
         }
-        return (void*)YUV422_LV_BUFFER_1; // fall back to default
+        return (void*)CACHEABLE(YUV422_LV_BUFFER_1); // fall back to default
     } else {
         switch (YUV422_LV_BUFFER_DMA_ADDR)
         {
             case YUV422_LV_BUFFER_1:
-                return (void*)YUV422_LV_BUFFER_3;
+                return (void*)CACHEABLE(YUV422_LV_BUFFER_3);
             case YUV422_LV_BUFFER_2:
-                return (void*)YUV422_LV_BUFFER_1;
+                return (void*)CACHEABLE(YUV422_LV_BUFFER_1);
             case YUV422_LV_BUFFER_3:
-                return (void*)YUV422_LV_BUFFER_2;
+                return (void*)CACHEABLE(YUV422_LV_BUFFER_2);
         }
-        return (void*)YUV422_LV_BUFFER_1; // fall back to default
+        return (void*)CACHEABLE(YUV422_LV_BUFFER_1); // fall back to default
 
     }
 }
 {
 #ifdef CONFIG_550D
     if (lv && is_movie_mode() && !recording && video_mode_resolution > 0) // 720p exception
-        return (void*)UNCACHEABLE(shamem_read(0xc0f04008)); // RAM address not updated properly, read it from the DIGIC
+        return (void*)CACHEABLE(shamem_read(0xc0f04008)); // RAM address not updated properly, read it from the DIGIC
 #endif
 
 // single-buffered HD buffer
     failsafe -= 28;
     #endif
 
-    return (void *) (IS_HD_BUFFER(hd) ? hd : failsafe);
+    return (void *) CACHEABLE(IS_HD_BUFFER(hd) ? hd : failsafe);
 
 #else // double-buffered HD buffer (might work better for silent pics)
 
         }
     }
     
-    return (void*)idle_buf;
+    return (void*)CACHEABLE(idle_buf);
 #endif
 }
 
     
     if (first_video_clip)
     {
-        vram_lv.vram = get_lcd_422_buf();
+        vram_lv.vram = CACHEABLE(get_lcd_422_buf());
         return &vram_lv;
     }
     #endif
 
     extern int lv_paused;
     if (gui_state == GUISTATE_PLAYMENU || lv_paused || QR_MODE)
-        vram_lv.vram = get_lcd_422_buf();
+        vram_lv.vram = CACHEABLE(get_lcd_422_buf());
     else
-        vram_lv.vram = get_fastrefresh_422_buf();
+        vram_lv.vram = CACHEABLE(get_fastrefresh_422_buf());
     return &vram_lv;
 }
 
     if (!lv) // play/quickreview, HD buffer not active => use LV instead
         return get_yuv422_vram();
 
-    vram_hd.vram = get_422_hd_idle_buf();
+    vram_hd.vram = CACHEABLE(get_422_hd_idle_buf());
     return &vram_hd;
 }
 
         }
         
         uint8_t * lvram = get_yuv422_vram()->vram;
-        lvram = (void*)YUV422_LV_BUFFER_DMA_ADDR; // this one is not updating right now, but it's a bit behind
+        lvram = (void*)CACHEABLE(YUV422_LV_BUFFER_DMA_ADDR); // this one is not updating right now, but it's a bit behind
 
         // draw zebra in 16:9 frame
         // y is in BM coords
         dirty_pixels_num = 0;
         
         struct vram_info *hd_vram = get_yuv422_hd_vram();
-        uint32_t hdvram = (uint32_t)CACHEABLE(hd_vram->vram);
+        uint32_t hdvram = (uint32_t)hd_vram->vram;
         
         int yStart = os.y0 + os.off_169 + 8;
         int yEnd = os.y_max - os.off_169 - 8;
 #ifndef CONFIG_5DC
     menu_add( "Overlay", zebra_menus, COUNT(zebra_menus) );
 #endif
-    //~ menu_add( "Debug", livev_dbg_menus, COUNT(livev_dbg_menus) );
+    menu_add( "Debug", livev_dbg_menus, COUNT(livev_dbg_menus) );
     //~ menu_add( "Movie", movie_menus, COUNT(movie_menus) );
     //~ menu_add( "Config", cfg_menus, COUNT(cfg_menus) );
 #ifndef CONFIG_5DC