set raw buffer cached by default? - General Discussion and Assistance - CHDK Forum supplierdeeply

set raw buffer cached by default?

  • 3 Replies
  • 3392 Views
*

Offline reyalp

  • ******
  • 14082
set raw buffer cached by default?
« on: 02 / March / 2013, 17:30:12 »
Advertisements
This is something I've been meaning to do for a while, but thought I should ask if anyone thinks it's a bad idea.

I've never heard of raw buffer cached causing any problem, and on some cameras it substantially speeds up DNG. So it seems like it should be on by default.

To be more strictly correct, we could do something like the attached patch to make sure the swapped values are written out to uncached memory after each swap. I didn't see any performance hit or other problems doing this, but I'm not sure if this is worth it. Technically, I guess we should also flush the cache before starting (to ensure we don't have old cached values in the raw address space) but in practice a doubt such values could sit around between shots.

The attached csv file has some measurements. One thing that stands out is the first shot after boot up is often significantly longer than the following ones. I've also noticed (not included in this csv) that there are occasional outliers.
Don't forget what the H stands for.

*

Offline srsa_4c

  • ******
  • 4451
Re: set raw buffer cached by default?
« Reply #1 on: 02 / March / 2013, 19:30:12 »
I've never heard of raw buffer cached causing any problem,
Me neither. The data cache is only 8k, that's at most a few rows in RAW, which usually has some unusable border anyway. The RAW buffer is at fixed addresses, and I doubt that the ARM core does anything with that data in vanilla firmware (I might be wrong).
Quote
and on some cameras it substantially speeds up DNG. So it seems like it should be on by default.
+1

I've been meaning to ask about dcache_clean_all() for a while:
It's a relatively larger function (compared to icache_flush_all() ), which operates on the cache. Is this safe to do without disabling interrupts?

*

Offline reyalp

  • ******
  • 14082
Re: set raw buffer cached by default?
« Reply #2 on: 02 / March / 2013, 19:47:21 »
and I doubt that the ARM core does anything with that data in vanilla firmware (I might be wrong)
I very much doubt it does anything through the cached address.

Quote
I've been meaning to ask about dcache_clean_all() for a while:
It's a relatively larger function (compared to icache_flush_all() ), which operates on the cache. Is this safe to do without disabling interrupts?
I'm not sure. The ARM documentation doesn't seem to require that interrupts be disabled, so I expect it's safe in terms of not being illegal. It's probably "unsafe" in the sense that an interrupt could change memory in cache so not everything would really be "cleaned" when the operation completes, but in the cases where we use it this probably doesn't matter.

I actually played with disabling IRQs when I was testing the patch, because I was getting a weird hanging problem, but it turned the problem was not uploading the right diskboot.bin :)
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14082
Re: set raw buffer cached by default?
« Reply #3 on: 09 / March / 2013, 20:03:22 »
I have checked this in on the trunk in changesets 2622  and 2623.

I included the cache stuff because it's theoretically more correct and doesn't seem to cause any harm. I also removed the code that would reset raw buffer cached if you moved the cfg between cameras.

Note that this will only take effect if CHDK creates a new cfg, it will not change by itself if you have an existing cfg.
Don't forget what the H stands for.


 

Related Topics