Author Topic: placing ML into shoot memory  (Read 16323 times)


  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: placing ML into shoot memory
« Reply #26 on: April 07, 2013, 05:57:28 PM »
Wow, doesn't look good. There is a 1.3mb free area at top in 5d3, not useable?


  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: placing ML into shoot memory
« Reply #28 on: April 07, 2013, 06:45:23 PM »
maybe resize the memory of one of the sections? Like take 1/2 away from the player?


  • Administrator
  • Hero Member
  • *****
  • Posts: 10018
  • 5D Mark Free
Re: placing ML into shoot memory
« Reply #30 on: May 08, 2016, 06:06:13 PM »
Some graphs for RscMgr memory map, from sMemShowFix logs (this is the function g3gg0 investigated earlier in this thread):

You may ask - why I'm still investigating this?

The small allocators are sometimes too small for our needs, for example when loading too many modules, or when loading some memory-intensive ones. On small cameras like 1100D, you don't even need to do that.

Okay, but we have two large allocators (shoot_malloc and SRM), right?

Yes, but these have some restrictions:
- you can't keep them allocated forever:
    - srm_malloc: you can no longer take pictures if anything is allocated from there (so it's useless as general-purpose memory)
    - shoot_malloc: Canon code expects it to be completely free when doing certain things (for example, in-camera raw development, or enabling certain noise reduction modes, or - on 60D - simply switching between photo and movie mode). It works most of the time, but those rarely-used actions will fail (ERR70 or camera lockup).
- you can't allocate too many blocks from there (about 1000 from shoot_malloc, or a very small number from SRM).
- for this reason, the memory backend tries to avoid them - until the small allocators get full

In particular, Lua is memory-intensive, allocating thousands of small blocks using realloc. Our current allocators are not ready for that - loading many scripts gives ERR70, even if you have plenty of memory available, because of fragmentation.

I managed to get better results here, by pre-allocating a fairly large block (512K) and managing it with a custom allocator optimized for small blocks. However, that large block may end up in shoot_malloc, which I prefer to avoid.

Other reasons for investigating the RscMgr:

On 70D, the RscMgr "allocates" (with hardcoded address) memory for IMGPLAY overlapping the first raw buffer right after a still photo was captured (which interferes with raw overlays). For that case, I'm seriously thinking to change the memory map somehow, so these two buffers no longer overlap. (discussion)

Finally, some cameras still have memory that cannot be allocated by shoot+SRM. For example, 5D3 can allocate 438MB outside LiveView, but only 284MB in LiveView. I kinda doubt the LiveView actually uses 150MB. On 60D, the numbers are 436 outside LV, and 374 in LV - a little better. That extra memory could be useful for raw recording, but unfortunately it's not visible on these maps.

From the memory maps above, on 60D on the maps above, you can see a 7MB block at the end that appears unused (similar to the one g3gg0 found on 7D). Currently, autoexec.bin is loaded there, but it has some side effects - you cannot run the dm-spy-experiments branch, and not all this memory is available for ML. I'm thinking to move autoexec.bin to AllocateMemory, and use the 7MB block as general-purpose memory for ML, using some custom allocator (maybe Canon's).

I've got logs from 5D3, 60D, and also from 70D (nikfreak). For other cameras, I'd like you to get the log output for sMemShowFix, so I can generate similar graphs. To do that:
- find the stub (tutorial here; look here for strings to look for)
- compile the dm-spy-experiments branch, with CONFIG_DEBUG_INTERCEPT=y in Makefile.user
- put this in don't click me (example for 70D):
Code: [Select]
    void debug_intercept();
    void (*smemShowFix)(void) = 0xFF202DE8;
- run this code and upload dm.log from your card

Thanks in advance.


  • Developer
  • Hero Member
  • *****
  • Posts: 959
Re: placing ML into shoot memory
« Reply #31 on: May 08, 2016, 09:35:19 PM »
Tried it additionally on 50D.109:

Code: [Select]

  run_test:ff8297d8:80:16: --- Common Top ----
  run_test:ff829800:80:16: IMGPLAY_WORK            0x40D00000 0x00E00000 14680064
  run_test:ff829828:80:16: IMGVRAM1                0x41B00000 0x00410000 4259840
  run_test:ff829854:80:16: DEVELOP_WORK            0x41F10000 0x00040000 262144
  run_test:ff829880:80:16: FENCING_WORK            0x41F50000 0x00010000 65536
  run_test:ff8298b0:80:16: EXMEM3_AREA             0x42000000 0x01D00000 30408704
  run_test:ff8298dc:80:16: FILE_HEADER             0x43D00000 0x00200000 2097152
  run_test:ff829908:80:16: BMPVRAM1                0x43F00000 0x00080000 524288
  run_test:ff829934:80:16: BMPVRAM2                0x43F80000 0x00080000 524288
  run_test:ff829944:80:16: --- Usually Mode ----
  run_test:ff829970:80:16: MEMORY_MGR              0x44000000 0x18000000 402653184
  run_test:ff829980:80:16: ---    NR Mode   ----
  run_test:ff8299ac:80:16: NR_MEMORY_MGR           0x44000000 0x14000000 335544320
  run_test:ff8299dc:80:16: COMPOSITION_WORK_TOP    0x591A4A00 0x00E5B600 15054336
  run_test:ff829a08:80:16: COMPOSITION_WORK_BOTTOM 0x5A000000 0x01600000 23068672
  run_test:ff829a18:80:16: ---    DP Mode   ----
  run_test:ff829a44:80:16: DP_MULTI                0x44000000 0x08000000 134217728
  run_test:ff829d18:80:16: DP_SINGLE               0x4C000000 0x10000000 268435456
  run_test:ff829d28:80:16: --- Common Bottom ----
  run_test:ff829d54:80:16: IMGVRAM2                0x5C000000 0x00410000 4259840
  run_test:ff829d84:80:16: DCFNO                   0x5C410000 0x00004000 16384
  run_test:ff829db4:80:16: LV_WORK2                0x5C414000 0x00200000 2097152
  run_test:ff829de4:80:16: ENGINE_MIRROR           0x5C614000 0x00080000 524288
  run_test:ff829e14:80:16: VSHADING_COMP_WORK      0x5C694000 0x00080000 524288
  run_test:ff829e44:80:16: BATHTUB_COMP_WORK       0x5C714000 0x00010000 65536
  run_test:ff829e70:80:16: AVERAGE_WORK_TOP        0x5D1A4A00 0x00E5B600 15054336
  run_test:ff829e9c:80:16: AVERAGE_WORK_BOTTOM     0x5E000000 0x01600000 23068672
  run_test:ff829ecc:80:16: IMGVRAM3                0x5F600000 0x00410000 4259840
  run_test:ff829efc:80:16: LV_WORK                 0x5FA10000 0x00480000 4718592
70D.112 & 100D.101


  • Developer
  • Hero Member
  • *****
  • Posts: 959
Re: placing ML into shoot memory
« Reply #32 on: May 08, 2016, 10:11:50 PM »
And here is 100D:

Code: [Select]
  run_test:ff214510:80:16: --- Common Top ----
  run_test:ff21452c:80:16: [TOP1]                  0x40C3C000
  run_test:ff214550:80:16: SSS_DEVELOP_WORK        0x40C3C000 0x00038000 229376
  run_test:ff214578:80:16: SDS_DEVELOP_WORK        0x40C74000 0x00038000 229376
  run_test:ff2145a0:80:16: DARKCUR_COMP_WORK       0x40CAC000 0x00020000 131072
  run_test:ff2145c8:80:16: FENCING_WORK            0x40CCC000 0x00010000 65536
  run_test:ff2145f0:80:16: DCFNO                   0x40CDC000 0x00004000 16384
  run_test:ff214618:80:16: LVMARGE_P_DEF_DATA_1    0x40CE0000 0x0000A000 40960
  run_test:ff214640:80:16: LVMARGE_P_DEF_DATA_2    0x40CEA000 0x0000A000 40960
  run_test:ff214668:80:16: LVMARGE_P_DEF_DATA_ZOOM 0x40CF4000 0x0000C000 49152
  run_test:ff214690:80:16: FILE_HEADER             0x40D00000 0x00240000 2359296
  run_test:ff2146b8:80:16: CAPTURE_WORK1           0x40F40000 0x00240000 2359296
  run_test:ff2146e4:80:16: BMPVRAM1                0x41180000 0x00080000 524288
  run_test:ff214710:80:16: BMPVRAM2                0x41200000 0x00080000 524288
  run_test:ff21473c:80:16: ENGINE_MIRROR           0x41280000 0x00044000 278528
  run_test:ff214768:80:16: VSHADING_COMP_WORK      0x412C4000 0x000DC000 901120
  run_test:ff214788:80:16: STILL SCAR              0x413A0000 0x00075B00 482048
  run_test:ff2147a8:80:16: TUNEDATA                0x41415B00 0x00140000 1310720
  run_test:ff2147c8:80:16: TUNEDATA2               0x41555B00 0x00140000 1310720
  run_test:ff214b00:80:16: FIXDATA                 0x41695B00 0x00340000 3407872
  run_test:ff214b20:80:16: LVMARGE_P_DEF_DATA_CROP 0x419D5B00 0x0000C000 49152
  run_test:ff214b40:80:16: EEKO                    0x41E00000 0x001E0000 1966080
  run_test:ff214b60:80:16: SHOOTING_CREATIVEFILTER 0x41FE0000 0x00010000 65536
  run_test:ff214b80:80:16: SAF WORK                0x42000000 0x00200000 2097152
  run_test:ff214b90:80:16: --- Usually Mode ----
  run_test:ff214bb0:80:16: ONLY MEM1 1             0x48000000 0x02000000 33554432
  run_test:ff214bd0:80:16: ONLY MEM1 2             0x0 0x02000000 33554432
  run_test:ff214bf4:80:16: EXMEM3_AREA_2           0x42200000 0x01E00000 31457280
  run_test:ff214c14:80:16: MEMORY_MGR              0x44000000 0x04000000 67108864
  run_test:ff214c34:80:16: EXMEM3_AREA_1           0x4A000000 0x019C0000 27000832
  run_test:ff214c54:80:16: SS_DEVELOP1             0x4B9C0000 0x02000000 33554432
  run_test:ff214c74:80:16: IMGVRAM1                0x4B9D0000 0x00410000 4259840
  run_test:ff214c98:80:16: IMGVRAM2                0x4BDE0000 0x00410000 4259840
  run_test:ff214cbc:80:16: IMGVRAM3                0x4C1F0000 0x00410000 4259840
  run_test:ff214ce0:80:16: IMGPLAY_WORK            0x4C600000 0x00A00000 10485760
  run_test:ff214d00:80:16: IMGPLAY_WORK2           0x4D000000 0x00400000 4194304
  run_test:ff214d20:80:16: SS_DEVELOP_OTHER_WORK   0x4D9C0000 0x00400000 4194304
  run_test:ff214d44:80:16: EXMEM3_AREA_3           0x4DDC0000 0x0222C000 35831808
  run_test:ff214d64:80:16: AVERAGE_WORK_TOP        0x4DDC0000 0x01116000 17915904
  run_test:ff214d80:80:16: AVERAGE_WORK_BOTTOM     0x4EED6000 0x01116000 17915904
  run_test:ff214d90:80:16: ---   GIS Mode   ----
  run_test:ff214db0:80:16: TEMPMEM1                0x48200000 0x02000000 33554432
  run_test:ff214dd0:80:16: SLIDE_SHOW_WORK         0x48200000 0x00800000 8388608
  run_test:ff2151b8:80:16: MOVIE_PLAY_WORK         0x4A600000 0x00126000 1204224
  run_test:ff2151d8:80:16: IMGVRAM1                0x4B9D0000 0x00410000 4259840
  run_test:ff2151f8:80:16: IMGVRAM2                0x4BDE0000 0x00410000 4259840
  run_test:ff215218:80:16: IMGVRAM3                0x4C1F0000 0x00410000 4259840
  run_test:ff215238:80:16: IMGPLAY_WORK            0x4C600000 0x00A00000 10485760
  run_test:ff215258:80:16: IMGPLAY_WORK2           0x4D000000 0x00400000 4194304
  run_test:ff21527c:80:16: MOVIE_REC_WORK          0x4D800000 0x01400000 20971520
  run_test:ff2152a0:80:16: MOVIE_STREAM            0x4EC00000 0x01400000 20971520
  run_test:ff2152c0:80:16: WORK                    0x4A200000 0x05E00000 98566144
  run_test:ff2152dc:80:16: EXMEM3_1_AREA           0x0 0x00000000 0
  run_test:ff2152fc:80:16: EXMEM3_2_AREA           0x42200000 0x06000000 100663296
  run_test:ff21530c:80:16: ---   HDR Mode   ----
  run_test:ff21532c:80:16: TEMPMEM1                0x48200000 0x02000000 33554432
  run_test:ff21534c:80:16: SLIDE_SHOW_WORK         0x48200000 0x00800000 8388608
  run_test:ff21536c:80:16: MOVIE_PLAY_WORK         0x4A600000 0x00126000 1204224
  run_test:ff21538c:80:16: IMGVRAM1                0x4B9D0000 0x00410000 4259840
  run_test:ff2153ac:80:16: IMGVRAM2                0x4BDE0000 0x00410000 4259840
  run_test:ff2153cc:80:16: IMGVRAM3                0x4C1F0000 0x00410000 4259840
  run_test:ff2153ec:80:16: IMGPLAY_WORK            0x4C600000 0x00A00000 10485760
  run_test:ff21540c:80:16: IMGPLAY_WORK2           0x4D000000 0x00400000 4194304
  run_test:ff21542c:80:16: MOVIE_REC_WORK          0x4D800000 0x01400000 20971520
  run_test:ff21544c:80:16: MOVIE_STREAM            0x4EC00000 0x01400000 20971520
  run_test:ff21546c:80:16: WORK                    0x48200000 0x07E00000 132120576
  run_test:ff215488:80:16: EXMEM3_1_AREA           0x0 0x00000000 0
  run_test:ff2154a8:80:16: EXMEM3_2_AREA           0x42200000 0x06000000 100663296
  run_test:ff2154b8:80:16: ---    NR Mode   ----
  run_test:ff2154d8:80:16: NR_MEMORY_MGR           0x44000000 0x08000000 134217728
  run_test:ff2154f4:80:16: COMPOSITION_WORK_TOP    0x0 0x00000000 0
  run_test:ff215510:80:16: COMPOSITION_WORK_BOTTOM 0x0 0x00000000 0
  run_test:ff215520:80:16: ---    DP Mode   ----
  run_test:ff215540:80:16: DP_MULTI                0x47E00000 0x02E00000 48234496
  run_test:ff215740:80:16: DP_SINGLE               0x42200000 0x05C00000 96468992
  run_test:ff215750:80:16: --- Indev Mode ----
  run_test:ff215764:80:16: [INDVMGR]               0x49000000
  run_test:ff215780:80:16: YUV                     0x4DDC0000 0x0222C000 35831808
  run_test:ff21579c:80:16: YUV_OUT                 0x42200000 0x0222C000 35831808
  run_test:ff2157b8:80:16: INDV_WORK               0x0 0x00000000 0
70D.112 & 100D.101


  • Administrator
  • Hero Member
  • *****
  • Posts: 10018
  • 5D Mark Free
Re: placing ML into shoot memory
« Reply #33 on: May 08, 2016, 10:23:51 PM »

50D: looks like we might have found a 10MB block. This camera has enough RAM for the current needs, so enabling it will not give obvious benefits - maybe only under very heavy workloads, with lots of Lua scripts loaded. Or maybe it could be used to buffer 2 or 3 extra frames while recording.

SRM figures are here - looks like there is potential to squeeze a little more memory for raw recording, if the two "AVERAGE_WORK" blocks are unused in LiveView (about 47 MB, which might be noticeable).

100D: Nothing obvious, unfortunately.


  • Developer
  • Hero Member
  • *****
  • Posts: 959
Re: placing ML into shoot memory
« Reply #34 on: May 08, 2016, 10:25:45 PM »
To speed up things for other cams one can modify the code from a1ex's post to the values below:

6D.116: 0xFF20D140
7D.203: 0xFF0E1388
650D.104: 0xFF223604
700D.114: 0xFF225C34
EOSM.202: 0xFF223A94
70D.112 & 100D.101


  • Hero Member
  • *****
  • Posts: 505
  • M
Re: placing ML into shoot memory
« Reply #35 on: May 09, 2016, 09:46:37 AM »
To speed up things for other cams one can modify the code from a1ex's post to the values below:
EOSM.202: 0xFF223A94

EOS-M log:


  • Administrator
  • Hero Member
  • *****
  • Posts: 10018
  • 5D Mark Free
Re: placing ML into shoot memory
« Reply #36 on: May 09, 2016, 09:59:02 AM »

There are some overlaps (also in 100D) not yet handled in the current graphs (solved). For example:

Code: [Select]
0x4a000000 ... 0x4a9fffff : IMGPLAY_WORK              (10.0 MB)
0x4a000000 ... 0x4adfffff : SS_DEVELOP1               (14.0 MB)
0x4aa00000 ... 0x4adfffff : IMGPLAY_WORK2             (4.0 MB)

so Canon code probably assumes IMGPLAY and SS_DEVELOP1 will never be used both at the same time.


  • Hero Member
  • *****
  • Posts: 775
Re: placing ML into shoot memory
« Reply #37 on: May 09, 2016, 10:38:01 AM »
Thanks nikfreak!

Sorry guys, mothers day had to come first, but after all the times alex helped me, I will return favor when I can.


Code: [Select]
  run_test:ff225c64:80:16: --- Common Top ----
  run_test:ff225c80:80:16: [TOP1]                  0x40D3C000
  run_test:ff225ca4:80:16: SSS_DEVELOP_WORK        0x40D3C000 0x00038000 229376
  run_test:ff225ccc:80:16: SDS_DEVELOP_WORK        0x40D74000 0x00038000 229376
  run_test:ff225cf4:80:16: DARKCUR_COMP_WORK       0x40DAC000 0x00020000 131072
  run_test:ff225d1c:80:16: FENCING_WORK            0x40DCC000 0x00010000 65536
  run_test:ff225d44:80:16: DCFNO                   0x40DDC000 0x00004000 16384
  run_test:ff225d6c:80:16: LVMARGE_P_DEF_DATA_1    0x40DE0000 0x0000A000 40960
  run_test:ff225d94:80:16: LVMARGE_P_DEF_DATA_2    0x40DEA000 0x0000A000 40960
  run_test:ff225db4:80:16: LVMARGE_P_DEF_DATA_3    0x41FD0000 0x0000A000 40960
  run_test:ff225ddc:80:16: LVMARGE_P_DEF_DATA_ZOOM 0x40DF4000 0x0000C000 49152
  run_test:ff225e04:80:16: FILE_HEADER             0x40E00000 0x00280000 2621440
  run_test:ff225e2c:80:16: CAPTURE_WORK1           0x41080000 0x00280000 2621440
  run_test:ff225e58:80:16: BMPVRAM1                0x41300000 0x00080000 524288
  run_test:ff225e84:80:16: BMPVRAM2                0x41380000 0x00080000 524288
  run_test:ff225eb0:80:16: ENGINE_MIRROR           0x41400000 0x00044000 278528
  run_test:ff225edc:80:16: VSHADING_COMP_WORK      0x41444000 0x000DC000 901120
  run_test:ff225efc:80:16: STILL SCAR              0x41520000 0x00075B00 482048
  run_test:ff225f1c:80:16: SAF WORK                0x41595B00 0x00100000 1048576
  run_test:ff226258:80:16: SAF RAW                 0x41695B00 0x0035D540 3528000
  run_test:ff226278:80:16: LVMARGE_P_DEF_DATA_CROP 0x419F3040 0x0000C000 49152
  run_test:ff226298:80:16: EEKO                    0x41E00000 0x001C0000 1835008
  run_test:ff2262b8:80:16: SHOOTING_CREATIVEFILTER 0x41FC0000 0x00010000 65536
  run_test:ff2262d8:80:16: TUNEDATA                0x42000000 0x00030D40 200000
  run_test:ff2262e8:80:16: --- Usually Mode ----
  run_test:ff226304:80:16: ONLY MEM1 1             0x0 0x00000000 0
  run_test:ff226320:80:16: ONLY MEM1 2             0x0 0x00000000 0
  run_test:ff226344:80:16: EXMEM3_AREA_2           0x42200000 0x01E00000 31457280
  run_test:ff226364:80:16: MEMORY_MGR              0x44000000 0x06000000 100663296
  run_test:ff226384:80:16: EXMEM3_AREA_1           0x4A000000 0x019C0000 27000832
  run_test:ff2263a4:80:16: SS_DEVELOP1             0x4B9C0000 0x02000000 33554432
  run_test:ff2263c4:80:16: IMGVRAM1                0x4B9D0000 0x00410000 4259840
  run_test:ff2263e8:80:16: IMGVRAM2                0x4BDE0000 0x00410000 4259840
  run_test:ff22640c:80:16: IMGVRAM3                0x4C1F0000 0x00410000 4259840
  run_test:ff226430:80:16: IMGPLAY_WORK            0x4C600000 0x00A00000 10485760
  run_test:ff226450:80:16: IMGPLAY_WORK2           0x4D000000 0x00400000 4194304
  run_test:ff226470:80:16: SS_DEVELOP_OTHER_WORK   0x4D9C0000 0x00400000 4194304
  run_test:ff226494:80:16: EXMEM3_AREA_3           0x4DDC0000 0x0222C000 35831808
  run_test:ff2264b4:80:16: AVERAGE_WORK_TOP        0x4DDC0000 0x01116000 17915904
  run_test:ff2264d0:80:16: AVERAGE_WORK_BOTTOM     0x4EED6000 0x01116000 17915904
  run_test:ff2264e0:80:16: ---   GIS Mode   ----
  run_test:ff226500:80:16: TEMPMEM1                0x48200000 0x02000000 33554432
  run_test:ff2268c4:80:16: SLIDE_SHOW_WORK         0x48200000 0x00800000 8388608
  run_test:ff2268e4:80:16: MOVIE_PLAY_WORK         0x4A600000 0x00126000 1204224
  run_test:ff226904:80:16: IMGVRAM1                0x4B9D0000 0x00410000 4259840
  run_test:ff226924:80:16: IMGVRAM2                0x4BDE0000 0x00410000 4259840
  run_test:ff226944:80:16: IMGVRAM3                0x4C1F0000 0x00410000 4259840
  run_test:ff226964:80:16: IMGPLAY_WORK            0x4C600000 0x00A00000 10485760
  run_test:ff226984:80:16: IMGPLAY_WORK2           0x4D000000 0x00400000 4194304
  run_test:ff2269a8:80:16: MOVIE_REC_WORK          0x4D800000 0x01400000 20971520
  run_test:ff2269cc:80:16: MOVIE_STREAM            0x4EC00000 0x01400000 20971520
  run_test:ff2269ec:80:16: WORK                    0x4A200000 0x05E00000 98566144
   CtrlSrv:ff52d698:83:01: DlgLiveView.c LOCAL_OLC_BLINK
   CtrlSrv:ff52b784:83:01: StartOlcBlinkTimer
  run_test:ff226a08:80:16: EXMEM3_1_AREA           0x0 0x00000000 0
  run_test:ff226a28:80:16: EXMEM3_2_AREA           0x42200000 0x06000000 100663296
  run_test:ff226a38:80:16: ---   HDR Mode   ----
  run_test:ff226a58:80:16: TEMPMEM1                0x48200000 0x02000000 33554432
  run_test:ff226a78:80:16: SLIDE_SHOW_WORK         0x48200000 0x00800000 8388608
  run_test:ff226a98:80:16: MOVIE_PLAY_WORK         0x4A600000 0x00126000 1204224
  run_test:ff226ab8:80:16: IMGVRAM1                0x4B9D0000 0x00410000 4259840
  run_test:ff226ad8:80:16: IMGVRAM2                0x4BDE0000 0x00410000 4259840
  run_test:ff226af8:80:16: IMGVRAM3                0x4C1F0000 0x00410000 4259840
  run_test:ff226b18:80:16: IMGPLAY_WORK            0x4C600000 0x00A00000 10485760
  run_test:ff226b38:80:16: IMGPLAY_WORK2           0x4D000000 0x00400000 4194304
  run_test:ff226b58:80:16: MOVIE_REC_WORK          0x4D800000 0x01400000 20971520
  run_test:ff226b78:80:16: MOVIE_STREAM            0x4EC00000 0x01400000 20971520
  run_test:ff226b98:80:16: WORK                    0x48200000 0x07E00000 132120576
  run_test:ff226bb4:80:16: EXMEM3_1_AREA           0x0 0x00000000 0
  run_test:ff226bd4:80:16: EXMEM3_2_AREA           0x42200000 0x06000000 100663296
  run_test:ff226be4:80:16: ---    NR Mode   ----
  run_test:ff226c04:80:16: NR_MEMORY_MGR           0x44000000 0x08000000 134217728
  run_test:ff226c20:80:16: COMPOSITION_WORK_TOP    0x0 0x00000000 0
  run_test:ff226c3c:80:16: COMPOSITION_WORK_BOTTOM 0x0 0x00000000 0
  run_test:ff226c4c:80:16: ---    DP Mode   ----
  run_test:ff226e4c:80:16: DP_MULTI                0x47E00000 0x02E00000 48234496
  run_test:ff226e6c:80:16: DP_SINGLE               0x42200000 0x05C00000 96468992
  run_test:ff226e7c:80:16: --- Indev Mode ----
  run_test:ff226e90:80:16: [INDVMGR]               0x0
  run_test:ff226eac:80:16: YUV                     0x4DDC0000 0x0222C000 35831808
  run_test:ff226ec8:80:16: YUV_OUT                 0x42200000 0x0222C000 35831808
  run_test:ff226ee4:80:16: INDV_WORK               0x0 0x00000000 0
500D/T1i  550D/T2i  600D/T3i  700D/T5i


  • Administrator
  • Hero Member
  • *****
  • Posts: 10018
  • 5D Mark Free
Re: placing ML into shoot memory
« Reply #38 on: May 09, 2016, 01:16:20 PM »

Looks like we have a 4MB free block. Nice!

(I've also rebuilt all other graphs to show overlaps)


  • Developer
  • Hero Member
  • *****
  • Posts: 2993
Re: placing ML into shoot memory
« Reply #39 on: May 09, 2016, 10:05:19 PM »
Code: [Select]

  run_test:ff0e13b8:80:16: --- Common Top ----
  run_test:ff0e13e0:80:16: IMGPLAY_WORK            0x40D00000 0x00E00000 14680064
  run_test:ff0e1408:80:16: IMGVRAM1                0x41B00000 0x00410000 4259840
  run_test:ff0e1434:80:16: DEVELOP_WORK            0x41F10000 0x00040000 262144
  run_test:ff0e1460:80:16: FENCING_WORK            0x41F50000 0x00010000 65536
  run_test:ff0e148c:80:16: LV_QUARK1               0x41F60000 0x00062780 403328
  run_test:ff0e14c8:80:16: FREE1                   0x41FC2780 0x0003D880 252032
  run_test:ff0e14f4:80:16: EXMEM3_AREA             0x42000000 0x01B00000 28311552
  run_test:ff0e1520:80:16: FILE_HEADER             0x43B00000 0x00400000 4194304
  run_test:ff0e154c:80:16: BMPVRAM1                0x43F00000 0x00080000 524288
  run_test:ff0e1578:80:16: BMPVRAM2                0x43F80000 0x00080000 524288
  run_test:ff0e1588:80:16: --- Usually Mode ----
  run_test:ff0e15b4:80:16: MEMORY_MGR              0x44000000 0x18000000 402653184
  run_test:ff0e15c4:80:16: ---    NR Mode   ----
  run_test:ff0e15f0:80:16: NR_MEMORY_MGR           0x44000000 0x16000000 369098752
  run_test:ff0e161c:80:16: COMPOSITION_WORK_TOP    0x5A000000 0x01116000 17915904
  run_test:ff0e1648:80:16: COMPOSITION_WORK_BOTTOM 0x5B116000 0x01116000 17915904
  run_test:ff0e1658:80:16: ---    DP Mode   ----
  run_test:ff0e1684:80:16: DP_MULTI                0x44000000 0x08000000 134217728
  run_test:ff0e1998:80:16: DP_SINGLE               0x4C000000 0x10000000 268435456
  run_test:ff0e19a8:80:16: --- Common Bottom ----
  run_test:ff0e19d8:80:16: IMGVRAM2                0x5C300000 0x00410000 4259840
  run_test:ff0e1a08:80:16: DCFNO                   0x5C710000 0x00004000 16384
  run_test:ff0e1a38:80:16: LV_WB                   0x5C714000 0x0002BC00 179200
  run_test:ff0e1a68:80:16: LV_FACEYUV              0x5C73FC00 0x000E1080 921728
  run_test:ff0e1a98:80:16: LV_HIST                 0x5C820C80 0x00001880 6272
  run_test:ff0e1ac8:80:16: LV_ANGEL                0x5C822500 0x00002080 8320
  run_test:ff0e1af8:80:16: LV_FENCING              0x5C824580 0x00020C80 134272
  run_test:ff0e1b28:80:16: ENGINE_MIRROR           0x5C845200 0x00080000 524288
  run_test:ff0e1b58:80:16: VSHADING_COMP_WORK      0x5C8C5200 0x000DC000 901120
  run_test:ff0e1b88:80:16: DARKCUR_COMP_WORK       0x5C9A1200 0x00020000 131072
  run_test:ff0e1bb4:80:16: LV_QUARK2               0x5C9C1200 0x00062780 403328
  run_test:ff0e1be4:80:16: CAPTURE_WORK1           0x5CA23980 0x001B0000 1769472
  run_test:ff0e1c14:80:16: FREE2                   0x5CBD3980 0x00316680 3237504
  run_test:ff0e1c40:80:16: AVERAGE_WORK_TOP        0x5CEEA000 0x01116000 17915904
  run_test:ff0e1c68:80:16: AVERAGE_WORK_BOTTOM     0x5E000000 0x01116000 17915904
  run_test:ff0e1c98:80:16: IMGVRAM3                0x5F116000 0x00410000 4259840
  run_test:ff0e1cc4:80:16: LV_QUARK3               0x5F526000 0x00062780 403328
  run_test:ff0e1cf4:80:16: CAPTURE_WORK2           0x5F588780 0x001B0000 1769472
  run_test:ff0e1d24:80:16: LV_MARGE_PDEF1          0x5F738780 0x00010000 65536
  run_test:ff0e20d4:80:16: LV_MARGE_PDEF2          0x5F748780 0x00010000 65536
  run_test:ff0e2110:80:16: FREE3                   0x5F758780 0x008A7880 9074816


  • Administrator
  • Hero Member
  • *****
  • Posts: 10018
  • 5D Mark Free
Re: placing ML into shoot memory
« Reply #40 on: May 09, 2016, 10:12:54 PM »

Looks pretty similar to 50D.


  • Member
  • ***
  • Posts: 207
Re: placing ML into shoot memory
« Reply #41 on: May 11, 2016, 05:27:14 PM »
I have found the stubs for 500D:

Code: [Select]
/** Low-level allocators */

NSTUB(0xFF06A4CC, init_memory_pool)
NSTUB(0xFF06AB44, allocate_memory_from_pool)
NSTUB(0xFF06ADB0, free_memory_to_pool)
NSTUB(0xFF06A970, get_max_region_of_pool)

I will try to run the test later, but I don't know which value should I put on the sample code that a1ex has posted for 70D.  500D is not included in the list with values that Nikfreak has provided for several cameras. Is the same value of init_memory_pool ?


  • Administrator
  • Hero Member
  • *****
  • Posts: 10018
  • 5D Mark Free
Re: placing ML into shoot memory
« Reply #42 on: May 11, 2016, 05:38:46 PM »
Look for the function that prints strings similar to those in the above logs.


  • Member
  • ***
  • Posts: 207
Re: placing ML into shoot memory
« Reply #43 on: May 11, 2016, 06:22:33 PM »
Ok, for 500D is 0xFF0BC2BC

I will run the test later.


  • Member
  • ***
  • Posts: 207
Re: placing ML into shoot memory
« Reply #44 on: May 11, 2016, 08:18:02 PM »
Sorry for the dumb question: which is the file where I have to insert the code for the "Don't click me" test? I have been looking everywhere in ML source tree and I still don't find it ...   :-[  It's "debug.c" file?

Edit:     I found it,  is the "run_test()" function in "debug.c"


  • Member
  • ***
  • Posts: 207
Re: placing ML into shoot memory
« Reply #45 on: May 11, 2016, 09:30:05 PM »
Here is the log, for 500D:

Code: [Select]
  run_test:ff0bc2e4:80:16: --- Common Top ----
  run_test:ff0bc30c:80:16: IMGPLAY_WORK            0x40D00000 0x00E00000 14680064
  run_test:ff0bc334:80:16: IMGVRAM1                0x41B00000 0x00410000 4259840
  run_test:ff0bc360:80:16: DEVELOP_WORK            0x41F90000 0x00040000 262144
  run_test:ff0bc38c:80:16: FENCING_WORK            0x41FD0000 0x00010000 65536
  run_test:ff0bc3b8:80:16: LV_MARGE_PDEFDATA       0x41FE0000 0x00010000 65536
  run_test:ff0bc3e4:80:16: LV_MARGE_PDEFDATA2      0x41FF0000 0x00010000 65536
  run_test:ff0bc414:80:16: EXMEM3_AREA             0x42000000 0x01431000 21172224
  run_test:ff0bc444:80:16: FILE_HEADER             0x43431000 0x00200000 2097152
  run_test:ff0bc474:80:16: BMPVRAM1                0x43631000 0x00080000 524288
  run_test:ff0bc4a4:80:16: BMPVRAM2                0x436B1000 0x00080000 524288
  run_test:ff0bc4b4:80:16: --- Usually Mode ----
  run_test:ff0bc4e0:80:16: MEMORY_MGR              0x44000000 0x0A000000 167772160
  run_test:ff0bc4f0:80:16: ---    NR Mode   ----
  run_test:ff0bc51c:80:16: NR_MEMORY_MGR           0x44000000 0x08000000 134217728
  run_test:ff0bc548:80:16: COMPOSITION_WORK_TOP    0x4C000000 0x00E5B600 15054336
  run_test:ff0bc574:80:16: COMPOSITION_WORK_BOTTOM 0x4CE5B600 0x00E5B600 15054336
  run_test:ff0bc584:80:16: ---    DP Mode   ----
  run_test:ff0bc5b0:80:16: DP_MULTI                0x44000000 0x04000000 67108864
  run_test:ff0bc8c4:80:16: DP_SINGLE               0x48000000 0x06000000 100663296
  run_test:ff0bc8d4:80:16: --- Common Bottom ----
  run_test:ff0bc904:80:16: IMGVRAM2                0x43731000 0x00410000 4259840
  run_test:ff0bc934:80:16: DCFNO                   0x4FFEAC00 0x00004000 16384
  run_test:ff0bc964:80:16: LV_WORK2                0x4FCB6C00 0x002A4000 2768896
  run_test:ff0bc994:80:16: ENGINE_MIRROR           0x4FF5AC00 0x00080000 524288
  run_test:ff0bc9c0:80:16: VSHADING_COMP_WORK      0x41F10000 0x00080000 524288
  run_test:ff0bc9f0:80:16: BATHTUB_COMP_WORK       0x4FFDAC00 0x00010000 65536
  run_test:ff0bca18:80:16: AVERAGE_WORK_TOP        0x4E000000 0x00E5B600 15054336
  run_test:ff0bca44:80:16: AVERAGE_WORK_BOTTOM     0x4EE5B600 0x00E5B600 15054336
  run_test:ff0bca74:80:16: IMGVRAM3                0x43B41000 0x00410000 4259840
  run_test:ff0bcaa4:80:16: LV_WORK                 0x43F51000 0x000AF000 716800


  • Administrator
  • Hero Member
  • *****
  • Posts: 10018
  • 5D Mark Free
Re: placing ML into shoot memory
« Reply #46 on: May 11, 2016, 10:23:18 PM »

Not much interesting here...

The good part is that 500D doesn't have issues with the general-purpose memory, so it's fine the way it is.


  • Member
  • ***
  • Posts: 207
Re: placing ML into shoot memory
« Reply #47 on: May 12, 2016, 09:27:51 AM »
Not much interesting here...

The good part is that 500D doesn't have issues with the general-purpose memory, so it's fine the way it is.

Yes, ML works perfectly on my little old 500D, no issues at all. And it is a nice, lighweight camera for stills work, very capable, thanks to ML  ;)

Are the "Low-level allocators" stubs useful for your investigation ? Do you need them for other cameras?.  I could search them for 50D or EOS-M.


  • Administrator
  • Hero Member
  • *****
  • Posts: 10018
  • 5D Mark Free
Re: placing ML into shoot memory
« Reply #48 on: May 12, 2016, 09:37:30 AM »
Could be interesting for 50D, since there appears to be a large free block. The 50D doesn't have memory problems either, so it would be more like future-proofing it.


  • Member
  • ***
  • Posts: 207
Re: placing ML into shoot memory
« Reply #49 on: May 12, 2016, 09:32:12 PM »
I have found the stubs for 50D. But there is something in this cam that does not happen in 60D and 500D. The stubs for 50D are duplicated, they can be found in two different places, with a fixed offset of 0x800000  (8MB block?).

These stubs are valid, keeping untouched all the previously used memory related stubs:

Code: [Select]
/** Memory allocation **/
NSTUB(0xFF8680C8,  GetMemoryInformation)
NSTUB(0xFF868074,  GetSizeOfMaxRegion)
NSTUB(0xFF867B54, _AllocateMemory)                          // thanks Alex
NSTUB(0xFF867D18, _FreeMemory)                              // release_mem in Indy's IDC
NSTUB(0xFF991018, _alloc_dma_memory)
NSTUB(0xFF818DC8, _free)
NSTUB(0xFF99104C, _free_dma_memory)
NSTUB(0xFF818CF4, _malloc)                                  // maybe it's better to use Allocate/Free?

/** Low-level allocators */

NSTUB(0xFF86755C, init_memory_pool)   // used to init the AllocateMemory pool and others
NSTUB(0xFF8679E4, allocate_memory_from_pool) // called from AllocateMemory
NSTUB(0xFF867B84, free_memory_to_pool) // called from FreeMemory
NSTUB(0xFF867FE0, get_max_region_of_pool) // called from GetSizeOfMaxRegion

But also this will be possible:

Code: [Select]
NSTUB(0xFF068074,  GetSizeOfMaxRegion)
NSTUB(0xFF067B54, _AllocateMemory)                       
NSTUB(0xFF067D18, _FreeMemory)                                                           

/** Low-level allocators */

NSTUB(0xFF06755C, init_memory_pool)   // used to init the AllocateMemory pool and others
NSTUB(0xFF0679E4, allocate_memory_from_pool) // called from AllocateMemory
NSTUB(0xFF067B84, free_memory_to_pool) // called from FreeMemory
NSTUB(0xFF067FE0, get_max_region_of_pool) // called from GetSizeOfMaxRegion

The functions are identical in both cases.

So a1ex, you will see which option is better. I suppose the second option could require changing the addresses of other stubs ...