Skip to content

Conversation

@ranj063
Copy link
Collaborator

@ranj063 ranj063 commented May 3, 2022

This first 4 commits are from #5872. This PR will need to be rebased once that is merged.

@ranj063 ranj063 force-pushed the fix/volume_new_api branch 4 times, most recently from 5ac90a7 to 213fb98 Compare May 4, 2022 15:38
Copy link
Collaborator

Choose a reason for hiding this comment

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

@ranj063 having a second thought about this I think we shouldn't use config->type but UUID as we agreed with @cujomalainey at some point.

We want to avoid adding new component types in the future.

Copy link
Contributor

Choose a reason for hiding this comment

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

Personally I want to delete that enum, i think its just confusing for newcomers.

Copy link
Contributor

Choose a reason for hiding this comment

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

Pointer *spec points directly to IPC mailbox address. In this code You assume, it maps to following structure:
struct ipc_config_process {
uint32_t size; /< size of bespoke data section in bytes */
uint32_t type; /
< sof_ipc_process_type */
unsigned char *data;
};
I think this is not true for IPC4 protocol, where initial data are passed through IPC4 header extended, and payload starts with beginning of the configuration. The size variable will be wrong here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@jxstelter right the module adapter needs to be adapter for IPC4. My next target is to convert the copier. I will handle this with that change

@ranj063 ranj063 force-pushed the fix/volume_new_api branch 25 times, most recently from b351fa3 to 7c563ed Compare May 26, 2022 19:26
@ranj063 ranj063 force-pushed the fix/volume_new_api branch from 487b141 to eb61ba8 Compare June 3, 2022 16:10
@ranj063
Copy link
Collaborator Author

ranj063 commented Jun 3, 2022

@singalsu @lgirdwood this PR is ready for review now

@ranj063 ranj063 requested review from lyakh and singalsu June 6, 2022 17:44
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.

How does the legacy part work ? i.e how is volume partitioned ?

@ranj063
Copy link
Collaborator Author

ranj063 commented Jun 7, 2022

How does the legacy part work ? i.e how is volume partitioned ?

@lgirdwood I created new functions for the API's needed for the new module interface API and then reused them within the ops for the legacy comp_drv ops. This only difference is that with the comp_drv interface we also need to allocated struct processing_module apart from comp_dev. But this structure is minimally used with no memory allocation for the input/putput buffers

Copy link
Collaborator

Choose a reason for hiding this comment

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

do we do this everywhere? It would be better to use container_of() for these

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

no I switched back to the original definition. so not relevant anymore

Copy link
Collaborator

Choose a reason for hiding this comment

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

memcpy(volume + 1,...)

Copy link
Member

Choose a reason for hiding this comment

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

or better still a convenience macro for UUID copying (since I assume the relative position is calculated the same and the size is const)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

not sure if a macro will be helpful, Liam. The size is actually not constant since it varies based on type of component.

Copy link
Collaborator

Choose a reason for hiding this comment

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

wouldn't it be better to put legacy and new in two different files?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

volume is the only exception for a module that will need to keep the legacy comp_drv. While it might a bit cleaner to separate them out, I think keeping them all in one place might make it easier to read.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is there need to zero the buffer?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

isnt it better to zero the input buffers? WHy leave stale data in?

Copy link
Collaborator

@lyakh lyakh Jun 9, 2022

Choose a reason for hiding this comment

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

is it possible that that stale data ends up being delivered to the user? And this one is on a hot path - executed for each copy, so indeed should be avoided

Copy link
Collaborator

Choose a reason for hiding this comment

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

Clearing the buffer consumes unnecessary MCPS. Please fix this afterwards if not in this version.

Copy link
Collaborator

Choose a reason for hiding this comment

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

VOL_S32_SAMPLES_TO_BYTES() ?

In preparation for comverting the volume component to use the module
interface, add support for parsing the UUID from topology when parsing
the PGA widget in testbench.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
@ranj063 ranj063 force-pushed the fix/volume_new_api branch from eb61ba8 to c7612f0 Compare June 9, 2022 04:10
Copy link
Collaborator

Choose a reason for hiding this comment

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

do I see it correctly, that these source and sink are only used in the simple_copy case below? If so, please move these assignments there

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@lyakh if I move it inside the if, I get an error with these being used uninitialized.

Copy link
Collaborator

@lyakh lyakh Jun 10, 2022

Choose a reason for hiding this comment

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

first of all I think it's only source that the compiler won't be able to figure out. So, yes, we'd have to initialise it to NULL - I think that's better than assigning irrelevant for the non-simple case values here to be overwritten there.

@ranj063 ranj063 force-pushed the fix/volume_new_api branch from c7612f0 to af2a74e Compare June 9, 2022 13:10
@ranj063 ranj063 requested review from lyakh and singalsu June 9, 2022 13:10
Optimize the copy() function for modules that have only 1 source/sink
buffer and produce only period bytes every period. There is no need to
allocate intermediate buffers to hold the processed samples. Also, pass
the buffer stream pointers directly so that there no extra copies.

Introduce a new field, simple_copy in struct processing_module that can
be set by modules that do not need deep buffering and produce exactly
period worth of data in every copy().

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
@ranj063 ranj063 force-pushed the fix/volume_new_api branch from af2a74e to e67347e Compare June 9, 2022 13:18
Copy link
Collaborator

@singalsu singalsu left a comment

Choose a reason for hiding this comment

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

Looks OK, the issues those I commented were from the original code. Please make an improvements PR later for this, e.g. the bzero().

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.

Lets get this under daily testing now and fix the other comments incrementally.
@ranj063 can we also include in the followup PR a Kconfi change that uses the new volume module on say TGL/ADL and the old comp on the other platforms. This will give us more CI/test coverage and make sure we dont see any regressions in the legacy.

@lgirdwood
Copy link
Member

@ranj063 looks like a lot of QB CI failures, I 'm not sure if this is recent.
@wszypelt seeing messages like this

16:03:56.720 ITERATION TestDmicBothFifoSimpleCapture16000hz16b16b2ch.test === 1654783436.720132
16:03:56.720 => TestDmicBothFifoSimpleCapture16000hz16b16b2ch.test
16:03:56.735   => Pre-iteration setup
16:03:56.735     => Tested Audio Format
16:03:56.735     => Create 16000Hz 2ch playback file
16:03:56.735     => Create 16000Hz 2ch playback file
16:03:56.735     => Verify DMIC:
16:03:57.563   => Exception in test.
16:03:57.563     Exception TypeError occurred at 'C:\\work\\tools\\pyexecnetcache\\cavs_scripts-py\\tests\\sof\\fw_05_dmic\\dmic_base.py':111
                 'NoneType' object is not subscriptable

Any clues what Nonetype errors mean ?
I will rerun CI to be sure.

@lgirdwood
Copy link
Member

SOFCI TEST

@ranj063 ranj063 force-pushed the fix/volume_new_api branch from e67347e to 7790c86 Compare June 9, 2022 16:08
@ranj063
Copy link
Collaborator Author

ranj063 commented Jun 9, 2022

Lets get this under daily testing now and fix the other comments incrementally. @ranj063 can we also include in the followup PR a Kconfi change that uses the new volume module on say TGL/ADL and the old comp on the other platforms. This will give us more CI/test coverage and make sure we dont see any regressions in the legacy.

@lgirdwood done. I left the legacy comp drv interface for everything up until CNL

@ranj063 ranj063 force-pushed the fix/volume_new_api branch from 7790c86 to 482a30a Compare June 9, 2022 16:21
Move the volume component inside the module_adapter folder and use the
module interface API instead of the component driver interface. Also fix
the volume cmocka tests to use the modified scale_vol function.

Also, add kconfig option for keeping the legacy comp_drv interface for platforms
that are limited in text region memory size, such as
BYT/CHT/APL/JSL/ICL.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
@ranj063 ranj063 force-pushed the fix/volume_new_api branch from 482a30a to 603cb88 Compare June 9, 2022 17:55
@lgirdwood lgirdwood merged commit f7663de into thesofproject:main Jun 10, 2022
@marc-hb
Copy link
Collaborator

marc-hb commented Jun 10, 2022

In case a git bisect lands you on commit volume: use the new module interface, a make clean may help. It helped me! Kconfig problem.

--- build_apl_gcc_volbroken/generated/.config	2022-06-10 20:50:39.178214458 +0000
+++ build_apl_gcc/generated/.config	2022-06-10 20:58:12.840624754 +0000
@@ -81,6 +81,8 @@
 # Audio components
 #
 CONFIG_COMP_DAI=y
+CONFIG_COMP_DAI_GROUP=y
+CONFIG_COMP_BLOB=y
 CONFIG_COMP_SRC=y
 # CONFIG_COMP_SRC_STD is not set
 CONFIG_COMP_SRC_SMALL=y
@@ -114,8 +116,19 @@
 CONFIG_ASRC_SUPPORT_CONVERSION_48000_TO_32000=y
 CONFIG_ASRC_SUPPORT_CONVERSION_48000_TO_44100=y
 # CONFIG_COMP_TDFB is not set
-# CONFIG_COMP_MODULE_ADAPTER is not set
-# CONFIG_COMP_LEGACY_INTERFACE is not set
+CONFIG_COMP_MODULE_ADAPTER=y
+CONFIG_COMP_LEGACY_INTERFACE=y
+
+#
+# Processing modules
+#
+# CONFIG_CADENCE_CODEC is not set
+CONFIG_COMP_VOLUME=y
+# CONFIG_COMP_VOLUME_WINDOWS_FADE is not set
+CONFIG_COMP_VOLUME_LINEAR_RAMP=y
+# CONFIG_PASSTHROUGH_CODEC is not set
+# CONFIG_WAVES_CODEC is not set
+# CONFIG_DTS_CODEC is not set
 # CONFIG_COMP_IGO_NR is not set
 # CONFIG_COMP_RTNR is not set
 

@marc-hb
Copy link
Collaborator

marc-hb commented Jun 15, 2022

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.

9 participants