Reduce init device latency |
||||||
Issue descriptionWhen a device is being used, CRAS calls init_device if it is not opened yet. For output device, the init_device first calls cras_iodev_set_format() and then calls cras_iodev_open() to open the device. - cras_iodev_set_format() calls update_channel_layout(), which involves a call to snd_pcm_hw_params() - cras_iodev_open() calls open_dev(), which also involves a call to snd_pcm_hw_params() To init a device, 2 snd_pcm_hw_params() calls are invoked with similar params. The snd_pcm_hw_params() call is one of the most expensive snd operations (takes 16 ms to open Elm speaker) So if we could reduce the snd_pcm_hw_params() call to only 1 time, that could help reduce device open latency (about 30-35% reduction)
,
May 12 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/third_party/adhd/+/3615ecbae09a43a52ddc716a0c038729fe24f5fd commit 3615ecbae09a43a52ddc716a0c038729fe24f5fd Author: Chinyue Chen <chinyue@google.com> Date: Fri May 12 10:25:35 2017 CRAS: iodev - Skip update_channel_layout for 2-channel output. If the requested channel count when opening an output device <= 2 then we can skip the update channel layout call and reduce the time spent to init a device. BUG= chromium:719812 TEST=Tested on reef. Change-Id: I46cba552751440a2043b0778b8b22a51a6113e3e Reviewed-on: https://chromium-review.googlesource.com/499910 Commit-Ready: Chinyue Chen <chinyue@chromium.org> Tested-by: Chinyue Chen <chinyue@chromium.org> Reviewed-by: Hsinyu Chao <hychao@chromium.org> [modify] https://crrev.com/3615ecbae09a43a52ddc716a0c038729fe24f5fd/cras/src/server/cras_iodev.c
,
May 22 2017
The following CLs are also merged: https://chromium-review.googlesource.com/#/c/503947/ https://chromium-review.googlesource.com/#/c/505974/ The time it takes to open speakers on reef is now 42ms (was 122ms before the reduction CLs)
,
May 23 2017
Hi Chinyue https://chromium-review.googlesource.com/c/505974/ broke the external mic on cyan and celes. This was found in https://wmatrix.googleplex.com/platform/unfiltered?platforms=celes&suites=chameleon_audio_perbuild&days_back=20&releases=60&hide_missing=True and https://wmatrix.googleplex.com/platform/unfiltered?platforms=celes&suites=chameleon_audio_perbuild&days_back=20&releases=60&hide_missing=True Could you please revert it first ? Moja and I will be in MTV this week and we are trying to make test lab as stable as possible. Thanks!
,
May 23 2017
For example, on celes R60-9576.0.0 localhost ~ # cras_test_client --capture_f /tmp/c Stream error -107 cras_test_client: cras_client: error removing stream from server And see /var/log/messages: 2017-05-23T01:56:34.320333+00:00 ERR cras_server[24008]: No chmap queried! 2017-05-23T01:56:34.321449+00:00 ERR cras_server[24008]: hw_params: Invalid argument: rate: 48000, ret_rate: 48000, channel: 2, format: 2 2017-05-23T01:56:34.339102+00:00 ERR cras_server[24008]: Init chtrt5650: :1,0 failed, rc = -22 2017-05-23T01:56:35.362590+00:00 ERR cras_server[24008]: No chmap queried! 2017-05-23T01:56:35.363791+00:00 ERR cras_server[24008]: hw_params: Invalid argument: rate: 48000, ret_rate: 48000, channel: 2, format: 2 2017-05-23T01:56:35.381754+00:00 ERR cras_server[24008]: Enable chtrt5650: :1,0 failed, rc = -22 2017-05-23T01:56:35.381775+00:00 ERR cras_server[24008]: Init device retry failed
,
May 23 2017
,
May 23 2017
I'll try it on cyan and fix it, sorry for the inconvenience!
,
May 24 2017
Thanks! The test start passing from 9581.
,
May 29 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/third_party/adhd/+/85e70ffda3f2b47a6665adca0fd4e885ab032a9c commit 85e70ffda3f2b47a6665adca0fd4e885ab032a9c Author: Chinyue Chen <chinyue@google.com> Date: Mon May 29 03:58:46 2017 CRAS: iodev - Skip update_channel_layout for 2-channel output. If the requested channel count when opening an output device <= 2 then we can skip the update channel layout call and reduce the time spent to init a device. BUG= chromium:719812 TEST=Tested on reef. Change-Id: I46cba552751440a2043b0778b8b22a51a6113e3e Reviewed-on: https://chromium-review.googlesource.com/499910 Commit-Ready: Chinyue Chen <chinyue@chromium.org> Tested-by: Chinyue Chen <chinyue@chromium.org> Reviewed-by: Hsinyu Chao <hychao@chromium.org> (cherry picked from commit 3615ecbae09a43a52ddc716a0c038729fe24f5fd) Reviewed-on: https://chromium-review.googlesource.com/517464 Reviewed-by: Chinyue Chen <chinyue@chromium.org> Commit-Queue: Chinyue Chen <chinyue@chromium.org> [modify] https://crrev.com/85e70ffda3f2b47a6665adca0fd4e885ab032a9c/cras/src/server/cras_iodev.c
,
Oct 31 2017
The deduplicate CL has been re-laneded: https://chromium-review.googlesource.com/572447
,
Jan 22 2018
,
Jan 23 2018
|
||||||
►
Sign in to add a comment |
||||||
Comment 1 by chinyue@chromium.org
, May 10 2017