Repository navigation
KWD: merge with release branch - #1462
Conversation
keyonjie
left a comment
There was a problem hiding this comment.
Basically looks good to me, several comments inside the commits.
There was a problem hiding this comment.
Can we rename this to sth easier to be understood? It is actually real-time copy(do in kpb_copy(), not in draining), not "draining" at all?
There was a problem hiding this comment.
@keyonjie, I think it is now understandable and according to cAVS naming convention:
KPB_STATE_BUFFERING -> kpb is buffering incoming data into history buffer
KPB_STATE_DRAINING -> kpb is draining data out of internal history buffer to host (no buffering or any other copy is performed in this state)
KPB_STATE_DRAINING_ON_DEMAND -> kpb copies incoming, real time data directly to host (no buffering)
There was a problem hiding this comment.
@mrajwa I assume that this change replaces #1435? I must agree with @keyonjie. KPB_STATE_DRAINING_ON_DEMAND sounds like some kind of different type of draining. KPB_STATE_COPYING makes much more sense. Also I'm not sure how are we addressing the problem with potential loss of data between start and end of draining. @lbetlej Was it agreed to fix it in the future PRs?
There was a problem hiding this comment.
KPB_STATE_DRAINING_ON_DEMANDsounds like some kind of different type of draining
According to cAVS documentation it is another version of draining. Guys I just wanted to code according to that document so we are consistent across platforms. However since you feel like this is not very clear we can change KPB_STATE_DRAINING_ON_DEMAND to KPB_STATE_HOST_COPY would it be OK for you?
PS: I assume all other KPB state are fine for you and we only disscuss the KPB_STATE_DRAINING_ON_DEMAND ?
There was a problem hiding this comment.
Here the naming "keyphrase_length" sounds more reasonable to me. :P
There was a problem hiding this comment.
Here the naming "keyphrase_length" sounds more reasonable to me. :P
Hah really? To me "keyphrase length" is just confusing. It suggest how much buffered data we want to get which is what history_depth does. preamble_time however clearly says "After what time detection shall be activated?"
@lgirdwood what do you think?
There was a problem hiding this comment.
@mrajwa do you mean that those data before preamble_time will be ignored and dropped?
There was a problem hiding this comment.
@keyonjie, they are ignored but not dropped - they will always be stored in history buffer inside KPB but detector won't trigger detection before preamble time is over.
There was a problem hiding this comment.
Here you are adding more and more dependencies to kpb? @slawblauciak what do you think about this?
There was a problem hiding this comment.
We could discuss if it is good or bad however I decided to set this default preamble to 0 as this seems to be more natural. By default you expect KWD to be active from start, right?
There was a problem hiding this comment.
How shall we handle it once we are running with 24bit captured data? better to get it from fmt?
There was a problem hiding this comment.
The support for more sampling options will be provided as separate patch.
jajanusz
left a comment
There was a problem hiding this comment.
Code itself looks ok, but do we have change for uapi/* headers in kernel?
@jajanusz, no we don't have to update kernel side. |
lgirdwood
left a comment
There was a problem hiding this comment.
Some commits still missing a commit message. Memory commit needs removed.
|
@lgirdwood, this PR has been updated. Please review and lets merge it as it is the base for further 24 bit support. |
There was a problem hiding this comment.
@mrajwa I assume that this change replaces #1435? I must agree with @keyonjie. KPB_STATE_DRAINING_ON_DEMAND sounds like some kind of different type of draining. KPB_STATE_COPYING makes much more sense. Also I'm not sure how are we addressing the problem with potential loss of data between start and end of draining. @lbetlej Was it agreed to fix it in the future PRs?
There was a problem hiding this comment.
It is highly desirable to use buffer_write_frag API here to handle potential buffer wrap-ups.
There was a problem hiding this comment.
Yes I agree, added function which do care about it. Once this PR is merged I will create some container which keeps different copy function for different format and they will be selected by looking up cd->config.sampling_width
There was a problem hiding this comment.
Could we change function names to be aligned with the rest of processing components?
Also I don't think we need to specify number of channels, since your functions are universal.
kpb_copy_s16
kpb_drain_s16
There was a problem hiding this comment.
I have yet another idea, lets call them kpb_copy_samples and kpb_drain_samples and inside these function decide what buffer_read/write API to choose by format. Although for this PR selecting different samples format is out of scope as it is will be covered in different PR.
There was a problem hiding this comment.
Is this really needed? I thought we are returning PPL_STATUS_PATH_STOP on draining. I would really like to avoid setting component's state internally without kernel's knowledge. I guess detect pipeline should be stopped explicitly by the host on received notification? @lbetlej Any thoughts?
There was a problem hiding this comment.
I agree this setting here is redundant as well as kernel taking care of it. The only concern I have is timing. I mean when we get FW notification about detection we can stop further copy imediately inside FW. Kernel on the other hand first need to wait for IPC about notification, then send another one aimed to stop some pipeline.
|
@lgirdwood @plbossart uapi/user/detect_test.h is changed, so it looks like ABI should be incremented, but I'm a little bit confused. Kernel apparently doesn't use uapi/user/* headers at all, so from kernel's perspective it is backward compatible. However any user client using this won't be, so do we need another ABI? |
|
@tlauda we use same ABI for usespace, that way it can check if both kernel and FW support the feature. Likewise FW and kernel can check userspace for ABI feature alignment based on the same data. |
|
@tlauda, I am bit confused why would you like to introduce another ABI? The new field used in |
|
@mrajwa Because now you need to create PR for kernel just to increase ABI number, which will look totally weird. |
|
@lgirdwood @tlauda @mrajwa But I don't know if having 2 versions is better. |
|
So, what should I do next, to me opening a PR in kernel repository which only update ABI version doesn't sound reasonable. @lgirdwood, @plbossart, what do you think? |
|
@mrajwa no need to update kernel if this is user only. I've assigned MINOR 8. Not need to bump ABI as there are other PRs pending for MINOR 8 (last PR merged will bump) |
This patch adds new state KPB_STATE_DRAINING. In this state kpb drains data from internal history buffer to host sink bypassig any other component. In the same time internal buffering is turned off. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Detector was using keyphrase_length to: 1. delay detection 2. to calculate the amount of data that shall be drained from history buffer. This was confusing people, therefore we use two separate variables name with better naming. 1. history_depth -> to define default draining request. (in bytes) 2. preamble_time -> to define delay after which detection should be active. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This patch provides default parameters for newly added detect_preamble and history_depth. Both by default are set to max buffering time of KPB. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Remove history_begin and history_end members from kpb as they are not used anywhere. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This patch adds two new trace messages into draining task - the amount of drained data and time needed to drain them in milliseconds. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Remove unnecessary check of preamble time. Previously it was allowing preamble time smaller than kpb buffering time. There is no reason for such a constrain. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
With this patch default preamble is set to zero meaning KWD is activated from start, no delay. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
|
@lgirdwood @tlauda can we merge this PR? This week we have another KWD release and this is prerequisite. |
tlauda
left a comment
There was a problem hiding this comment.
Ready for approval after update of function descriptions.
memcpy function doesn't care about "wrap-ups" and sample sizes which are crucial in copy of audio signals. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Kpb rt_sink is confusing and was replaced with sel_sink which stands for selector sink - the component to which KPB copies during BUFFERING state. Likewise the cli_sink was replaced to host_sink clearly stating that we copy out of DSP. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
After detection of keyword we shall stop further copy to selector pipeline. We do this in regular copy() function so there is no need to do it also in init_draining() function. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
|
@tlauda, I have just updated. |
The CLK_CPU macro is undefined for imx8 platform therefore shall be added. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
|
@mrajwa UT failing. |
KPB source code started to use timer related features therefore cmocka tests need to include these dependencies. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
|
@lgirdwood, updated. |
This PR adds latest patches from KWD release branch glk-012-stable-branch into SoF master.
The functionality is tested and works properly. Sporadically we still observe #1406 issue.
Signed-off-by: Marcin Rajwa marcin.rajwa@linux.intel.com