[alsa-devel] [PATCH 2/2] ASoC: dapm: Add cache to speed up adding of routes

Lars-Peter Clausen lars at metafoo.de
Thu May 7 16:53:34 CEST 2015


On 05/07/2015 02:48 PM, Mark Brown wrote:
[...]
>> +skip_search:
>> +	if (cache) {
>> +		cache->sink = wsink;
>> +		cache->source = wsource;
>> +	}
>> +
>
> Putting this into a store hit function would be good.
>
>>   	mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);
>>   	for (i = 0; i < num; i++) {
>> -		r = snd_soc_dapm_add_route(dapm, route);
>> +		r = snd_soc_dapm_add_route(dapm, route, &cache);
>
> Should we just have the cache in the dapm context or the card instead of
> locally?  It's only two pointers at the minute so there doesn't seem to
> be much cost from keeping it around and it might generate somme more
> hits for some use cases.  Or to put it another way why is the cache
> optional and created and re-created here like this?

I don't think the cache will produce hits anywhere else other then adding 
routes from the same route table. That's the only place were the same widget 
or widgets close to each other are accessed sequentially. I'd prefer to keep 
it locally.



More information about the Alsa-devel mailing list