Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fast mode task config + vendor config set #8005

Merged
merged 2 commits into from
Sep 20, 2023
Merged

Conversation

tobonex
Copy link
Contributor

@tobonex tobonex commented Aug 2, 2023

First PR here, open to heavy criticism.

Adding vendor config set and fmt(fast mode task) config as first steps to fmt implementation. Fixes IPC error on fmt config due to no fmt implementation.

@sofci
Copy link
Collaborator

sofci commented Aug 2, 2023

Can one of the admins verify this patch?

reply test this please to run this test once

@gkbldcig
Copy link
Collaborator

gkbldcig commented Aug 2, 2023

Can one of the admins verify this patch?

@tobonex tobonex changed the title Fast mode task config + vendor config task Fast mode task config + vendor config set Aug 4, 2023
Copy link
Contributor

@btian1 btian1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix CI issues first

Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs more decription in the commit messages to explain feature and changes.

src/audio/kpb.c Outdated Show resolved Hide resolved
src/include/ipc4/module.h Outdated Show resolved Hide resolved
src/audio/kpb.c Outdated Show resolved Hide resolved
src/audio/kpb.c Outdated Show resolved Hide resolved
src/include/ipc4/kpb.h Show resolved Hide resolved
src/include/sof/audio/kpb.h Outdated Show resolved Hide resolved
src/include/sof/audio/kpb.h Outdated Show resolved Hide resolved
@tobonex tobonex force-pushed the fmt branch 4 times, most recently from 45d2bf6 to ca3c6c3 Compare August 8, 2023 12:27
@tobonex tobonex marked this pull request as ready for review August 9, 2023 08:50
@tobonex tobonex requested review from btian1 and lgirdwood August 9, 2023 13:55
src/include/ipc4/module.h Outdated Show resolved Hide resolved
src/audio/kpb.c Outdated Show resolved Hide resolved
src/audio/kpb.c Outdated Show resolved Hide resolved
src/ipc/ipc4/handler.c Outdated Show resolved Hide resolved
@tmleman tmleman dismissed their stale review August 11, 2023 13:22

I am out of office in ww33 and ww34. Therefore, I'm dismissing my review, I do not want to block this PR for two weeks. But I still expect my comments to be addressed.

Copy link
Collaborator

@lyakh lyakh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a complete review, let's fix these issues first. Maybe this should be a draft PR for now

src/ipc/ipc4/handler.c Outdated Show resolved Hide resolved
src/ipc/ipc4/handler.c Outdated Show resolved Hide resolved
src/ipc/ipc4/handler.c Outdated Show resolved Hide resolved
src/ipc/ipc4/handler.c Outdated Show resolved Hide resolved
src/ipc/ipc4/handler.c Outdated Show resolved Hide resolved
src/audio/kpb.c Outdated Show resolved Hide resolved
src/audio/kpb.c Outdated Show resolved Hide resolved
src/audio/kpb.c Outdated Show resolved Hide resolved
src/audio/kpb.c Outdated Show resolved Hide resolved
src/audio/kpb.c Outdated Show resolved Hide resolved
@lgirdwood
Copy link
Member

@lyakh update good for you now ?

Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly minor style issue. I understand this is based on code with C++ background, so some of the conversion artifacts can be omitted, but I did find at least one odd case of error handling.

As for functionality, I don't know kpb well enough to really do meaningful commentary and would welcome a review round by someone more familiar with kpb.

src/ipc/ipc4/handler.c Show resolved Hide resolved
src/ipc/ipc4/handler.c Outdated Show resolved Hide resolved
src/audio/kpb.c Outdated Show resolved Hide resolved
src/audio/kpb.c Outdated Show resolved Hide resolved
src/audio/kpb.c Outdated Show resolved Hide resolved
src/audio/kpb.c Outdated Show resolved Hide resolved
src/ipc/ipc4/handler.c Outdated Show resolved Hide resolved
src/ipc/ipc4/handler.c Outdated Show resolved Hide resolved
src/ipc/ipc4/handler.c Outdated Show resolved Hide resolved
src/include/ipc4/module.h Outdated Show resolved Hide resolved
src/ipc/ipc4/handler.c Outdated Show resolved Hide resolved
src/audio/kpb.c Outdated Show resolved Hide resolved
src/audio/kpb.c Outdated Show resolved Hide resolved
src/audio/kpb.c Outdated Show resolved Hide resolved
src/audio/kpb.c Outdated Show resolved Hide resolved
src/audio/kpb.c Outdated Show resolved Hide resolved
src/include/sof/audio/kpb.h Show resolved Hide resolved
}
ret = drv->ops.set_large_config(dev, param_id, init_block,
final_block, data_off_size, (uint8_t *)(&array));
return ret;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return drv->ops.set_large_config(dev, param_id, init_block,
final_block, data_off_size, (uint8_t *)(&array));
ret can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed this, but ret is still used elsewhere.

/* Mic selector for client - sets microphone id for real time sink mic selector
* IPC4-compatible ID - please do not change the number
*/
KP_BUF_CLIENT_MIC_SELECT = 11,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about 101? left more extend for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is defined as 11 in reference FW. There are some IPC commands in-between those two that are not defined in sof yet.

Comment on lines 875 to 877
/* Align up to a multiple of 4 */
tlv = (struct sof_tlv *)((const uint8_t *)tlv +
TLV_DATA_OFFSET + ALIGN_UP(tlv->length, 4));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't you use tlv_next?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this tlv_next looks convenient, but...
is does not have the ALIGN_UP. Reference FW aligned it up, so I guess that we also need it here. I do not know all of the possible IPC cases so I'm not sure if it's actually necessary or not.

src/audio/kpb.c Outdated Show resolved Hide resolved
src/audio/kpb.c Outdated Show resolved Hide resolved
@kv2019i
Copy link
Collaborator

kv2019i commented Sep 12, 2023

@tobonex CI is failing on build, can you check:

https://github.com/thesofproject/sof/actions/runs/6151677351/job/16692249787?pr=8005

zep_workspace/sof/src/ipc/ipc4/handler.c: In function 'ipc4_set_large_config_module_instance':
/zep_workspace/sof/src/ipc/ipc4/handler.c:1032:67: error: passing argument 8 of 'ipc4_set_vendor_config_module_instance' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]

Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few C++'ism, but I can live with those. The CI fail needs to be fixed before merge, and I'd appreciate some comment on why FMT is needed by KPB. Otherwise looks good to go, thanks @tobonex !

src/audio/kpb.c Show resolved Hide resolved
src/audio/kpb.c Outdated Show resolved Hide resolved
src/audio/kpb.c Outdated Show resolved Hide resolved
src/audio/kpb.c Outdated Show resolved Hide resolved
@tobonex
Copy link
Contributor Author

tobonex commented Sep 12, 2023

Refactored some of the code so that it makes more sense:

  • removed struct byte_array_simple that I previously added - managed without it
  • removed some duplicated checks
  • configure_fast_mode_task function no longer accepts null in cfg argument as it made error checking messy

src/audio/kpb.c Show resolved Hide resolved
src/audio/kpb.c Outdated Show resolved Hide resolved
src/audio/kpb.c Show resolved Hide resolved
@tobonex
Copy link
Contributor Author

tobonex commented Sep 14, 2023

A few C++'ism, but I can live with those. The CI fail needs to be fixed before merge, and I'd appreciate some comment on why FMT is needed by KPB. Otherwise looks good to go, thanks @tobonex !

Originally, in case if WoV event, KPB used FMT to drain history buffer and send this data to Host ASAP. Normal tasks were too slow. We still need it for the same reason.

@kv2019i
Copy link
Collaborator

kv2019i commented Sep 15, 2023

@tobonex wrote:

Originally, in case if WoV event, KPB used FMT to drain history buffer and send this data to Host ASAP. Normal tasks were too slow. We still need it for the same reason.

Ack, thanks, this is a sufficient description.
UPDATE: please add this two-sentence-explanation to the second git commit message, thanks!

Add Vendor Config Set, a special case of Large Config Set. Large Config Set
handling now checks for this case and extracts extended param_id from ipc
payload as param_id and handles the rest of the payload as usual. KPB now
uses extended param_id. Necessary for fast mode task configuration in KPB.

Signed-off-by: Tobiasz Dryjanski <[email protected]>
This patch implements handling of the configuration IPC for FMT in KPB
module. KPB now saves the list of module instances to be processed by
FMT. This is the first step for implementing FMT functionality. In case
of WoV event, FMT is needed for KPB to drain history buffer and send
this data to Host ASAP, as normal tasks are too slow.

Signed-off-by: Tobiasz Dryjanski <[email protected]>
Copy link
Collaborator

@lyakh lyakh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments have been addressed, thanks! Haven't checked what exactly changed from previous versions, but at least locations, that I commented on, look better now

* |
* fmt.device_list(device_list*)
*
*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 empty lines above and below the description should be removed IMHO

* dev_list.device_list(comp_dev**)
* ^
* |
* fmt.device_list(device_list*)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what this structure means. Are these elements of the struct device_list::devs[] array above? Maybe we can find some easier (at least for me) representation. If this is an array, maybe arrange entries in lines

array[]
    +-------> element 1
    +-------> element 2
    +...
    +-------> element N

or something similar. The above looks to me like things pointing to each other, or calling each other, or similar

@kv2019i kv2019i merged commit f070135 into thesofproject:main Sep 20, 2023
40 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants