Skip to content

cadence codecs: update stream params - #4139

Closed
dbaluta wants to merge 1 commit into
thesofproject:mainfrom
dbaluta:update_param
Closed

dbaluta wants to merge 1 commit into
thesofproject:mainfrom
dbaluta:update_param

Conversation

@dbaluta

@dbaluta dbaluta commented May 5, 2021

Copy link
Copy Markdown
Collaborator

This patch takes care of the update of stream
parameters during runtime. It is important to
start stream base on its runtime params and not
those read from the topology which may not match
those of stream.

For now we only take care of sample rate, sample width and number of
channels.

Notice that Cadence API has the following particularities:
* each codec has its own set of parameters IDs (e.g sample rate
ID for AAC might be different for sample rate ID for MP3).
* setting parameters is not always valid and can return a fatal
error.

This patch only takes care of updating the parameters for wildcard codec
id (which is used by Intel).

Signed-off-by: Marcin Rajwa marcin.rajwa@linux.intel.com
Signed-off-by: Daniel Baluta daniel.baluta@nxp.com

This patch takes care of the update of stream
parameters during runtime. It is important to
start stream base on its runtime params and not
those read from the topology which may not match
those of stream.

For now we only take care of sample rate, sample width and number of
channels.

Notice that Cadence API has the following particularities:
	* each codec has its own set of parameters IDs (e.g sample rate
	  ID for AAC might be different for sample rate ID for MP3).
	* setting parameters is not always valid and can return a fatal
	  error.

This patch only takes care of updating the parameters for wildcard codec
id (which is used by Intel).

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
xa_codec_func_t *api;
};

enum default_stream_params_ids {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If this is for a single or group of specific Cadence codec then we should say in the comments as users may try and use it for any Cadence codec. Can be incrementally fixed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@lgirdwood i need a clarification from @mrajwa. I think this default parameters IDS are actually for CODEC_WRAPPER which for Intel is the DAP algorithm.

@lgirdwood

Copy link
Copy Markdown
Member

@dbaluta @mrajwa are you guys expecting a PR_CODEC failure ?
@kkarask @zrombel @wszypelt this PR is not changing the codec Kconfig but it could break CI if CI is relying on the codec params always coming from the topology ?

@dbaluta

dbaluta commented May 5, 2021

Copy link
Copy Markdown
Collaborator Author

@lgirdwood there shouldn't be any codec failure. This patch does exactly what #4008 did, but without the aac/mp3 problems.

@zrombel

zrombel commented May 5, 2021

Copy link
Copy Markdown

This PR requires tests script changes. I will test it manually and give feedback. And again merge needs to be synchronized with QB update.

@dbaluta

dbaluta commented May 5, 2021

Copy link
Copy Markdown
Collaborator Author

@zrombel thanks! We should also test to see if #3965 is fixed.

@lgirdwood

Copy link
Copy Markdown
Member

@zrombel thanks again, once good we can merge and tag v1.8-rc1

@zrombel

zrombel commented May 5, 2021

Copy link
Copy Markdown

While manual testing I run into some problems.
I thought that only changes to Processor Creation values are necessary:

...
SofGenericProcessorConfig, {
                        "codec_id": CODEC_ID,
                        "reserved": 0,
                        "sample_rate": 1,
                        "sample_width": 2,
                        "channels": 4,
...

But with or without changes DSP panics

@dbaluta @mrajwa could you please take a look at logs and see if there is any thing to be fixed on FW side or any other tests changes are needed ?

25_00_TestGenericProcessorSimplePlb48000Hz32b32b4ch_panic.zip

@dbaluta

dbaluta commented May 5, 2021

Copy link
Copy Markdown
Collaborator Author

@zrombel what is the value of CODEC id in "codec_id": CODEC_ID,

@dbaluta

dbaluta commented May 5, 2021

Copy link
Copy Markdown
Collaborator Author

@zrombel also if you can run the test and provide the logs with the following change added

--- a/src/audio/codec_adapter/codec/cadence.c
+++ b/src/audio/codec_adapter/codec/cadence.c
@@ -178,7 +178,7 @@ static int update_stream_sample_rate(struct comp_dev *dev)
        API_CALL(cd, XA_API_CMD_SET_CONFIG_PARAM, sample_rate_id, &stream->rate, ret);
        if (LIB_IS_FATAL_ERROR(ret)) {
                comp_err(dev, "update_stream_sample_params(): failed to set sample rate.");
-               return ret;
+               return 0;
        }
 
        return 0;
@@ -206,7 +206,7 @@ static int update_stream_sample_width(struct comp_dev *dev)
        API_CALL(cd, XA_API_CMD_SET_CONFIG_PARAM, sample_width_id, &sample_width, ret);
        if (LIB_IS_FATAL_ERROR(ret)) {
                comp_err(dev, "update_stream_sample_width(): failed to set sample width.");
-               return ret;
+               return 0;
        }
 
        return 0;
@@ -233,7 +233,7 @@ static int update_stream_channels(struct comp_dev *dev)
        API_CALL(cd, XA_API_CMD_SET_CONFIG_PARAM, sample_channels_id, &stream->channels, ret);
        if (LIB_IS_FATAL_ERROR(ret)) {
                comp_err(dev, "update_stream_channels(): failed to set channels");
-               return ret;
+               return 0;
        }

@lgirdwood

Copy link
Copy Markdown
Member

@dbaluta I'm assuming this is the only PR now that's blocking the v1.8-rc1 tag ?

@dbaluta

dbaluta commented May 5, 2021 •

Copy link
Copy Markdown
Collaborator Author

@lgirdwood I guess so, but didn't we decide to move it to RC2. See #4008

@lgirdwood

Copy link
Copy Markdown
Member

@dbaluta ok, so good to tag rc1 ?

@dbaluta

dbaluta commented May 5, 2021

Copy link
Copy Markdown
Collaborator Author

@lgirdwood fine with me! Fingers crossed! :)

@lgirdwood

Copy link
Copy Markdown
Member

@lgirdwood fine with me! Fingers crossed! :)

Now tagged v1.8-rc1, we can fork a stable v1.8 branch now.

@zrombel

zrombel commented May 5, 2021

Copy link
Copy Markdown

@dbaluta:
CODEC_ID is const 0xCADE0101

No luck with fixes you provided. DSP Panics and logs look pretty much the same.

25_00_TestGenericProcessorSimplePlb48000Hz32b32b4ch_ret_fix.zip

@dbaluta

dbaluta commented May 5, 2021

Copy link
Copy Markdown
Collaborator Author

@lgirdwood excellent! Thanks I will create our own IMX: imx-stable-v1.8 branch that will closely follow stable-v1.8 but we have some small custom stuff.

@lgirdwood

Copy link
Copy Markdown
Member

@lgirdwood excellent! Thanks I will create our own IMX: imx-stable-v1.8 branch that will closely follow stable-v1.8 but we have some small custom stuff.

ok, can we make sure we merge in any non custom imx-stable fixes to stable-v1.8 ? I'm assuming the custom changes will be stuff that has to be reworked prior to upstreaming in say v1.9 etc

@dbaluta

dbaluta commented May 5, 2021

Copy link
Copy Markdown
Collaborator Author

@lgirdwood yes, that's my plan. All non-custom stuff should first go to main (if applicable) then to sof-stable-1.8 then to imx-stable-1.8

@sys-pt1s

Copy link
Copy Markdown

Can one of the admins verify this patch?

@dbaluta

dbaluta commented Apr 20, 2022

Copy link
Copy Markdown
Collaborator Author

no longer relevant. we are introducing new way of updating the runtime params.

@dbaluta dbaluta closed this Apr 20, 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.

5 participants