-
Notifications
You must be signed in to change notification settings - Fork 349
[RFC] make codec adapter stand in layer #3980
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
Conversation
In order to act as a stand in layer for codecs going forward we need to not log using our comp_driver as that will be removed in the future. Instead we need to log using the context of comp_dev. This commit also reduces the verbosity of a lot of the traces and increases a few. Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
not sure why this was added. There are very few cases where a static declaration in a header makes sense but this does not appear to be one of them. Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
This commit strips the codec adapter as it is more of a library/layer for codecs to simplify their interface against rather than a component in and of itself. This gives each codec its own UUID solving the ID problem while opening an opertunity to register codecs directly for future multiplexing capabilities. Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
| .free = passthrough_codec_free | ||
| }; | ||
|
|
||
| DECLARE_CODEC_ADAPTER(passthrough_interface, passthrough_uuid, passthrough_tr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You will need a semicolon here, otherwise this won't compile. I am also looking at this. Let me know if you want me to take this over and send the next PR.
I have tested cadence codec adapter with the previous version of your PR and it works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah that is what is missing, thanks i was struggling with that. I will update this once we figure out the corruption issues in the adapter. I don't want to land anything until those are fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cujomalainey btw, how do you generate the UUID?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dbaluta I think the simple "uuidgen" tool is used, should work well enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i mean, these are not cryptographically secure, you could use a webtool if desired
| uint32_t buff_size; /* size of local buffer */ | ||
|
|
||
| comp_info(dev, "codec_adapter_prepare() start"); | ||
| comp_dbg(dev, "codec_adapter_prepare() start"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we really want these not very frequent logs to be dbg? I would keep it as it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for keeping functions that are called very rarely with comp_info(). Of course we wont add comp_info to copy() function for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cujomalainey Indeed, it looks like there is no clear rule when to use _info vs _dbg. I've noticed this in several components.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am personally fine with all callbacks except prepare,copy and reset being of level info. I think those three should remain dbg. That is just my 2cents
| #endif | ||
|
|
||
| #define CADENCE_ID 0xCADE01 | ||
| #define DUMMY_ID 0xD03311 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we also get rid of CADENCE_ID and WAVES_ID ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mrajwa will do this but gradually. This commit only deals with Dummy passthrough codec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will add the rest, this patch is still WIP, currently debugging fmt and corruption bugs
|
|
||
| int passthrough_codec_init(struct comp_dev *dev) | ||
| /* 0495ef10-254b-473d-8cbf-3d2292945c24 */ | ||
| DECLARE_SOF_RT_UUID("passthrough_codec", passthrough_uuid, 0x0495ef10, 0x254b, 0x473d, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the passthru name here, I would stick to the adapter name as passthru suggest literally no processing. Also I miss the general picture, how are we going to approach the scenario where codecs are dynamically binded with the adapter base on their UUID?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mrajwa adapter base is now just some sort of library helper functions. Each codec will create their own component based on UUID. The binding you mentioned is created statically inside the code like this:
static const struct comp_driver comp_codec_adapter = { \
.type = SOF_COMP_NONE, \
.uid = SOF_RT_UUID(uuid), \
.tctx = &tr, \
.ops = { \
.create = adapter_shim_new, \
.prepare = codec_adapter_prepare, \
.params = codec_adapter_params, \
.copy = codec_adapter_copy, \
.cmd = codec_adapter_cmd, \
.trigger = codec_adapter_trigger, \
.reset = codec_adapter_reset, \
.free = codec_adapter_free, \
}, \
}; \
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The codec adapter interface is more open to change than the component interface, therefore we can register that later in my macro and then use that to dynamically switch based on information we add into the interface. This is just a step toward using only UUIDs as identification.
| * \return integer representing either: | ||
| * 0 -> success | ||
| * negative value -> failure. | ||
| */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cujomalainey is this function just moved around? Because the diff looks odd.
|
@cujomalainey I continued your work here. https://github.com/dbaluta/sof/tree/refactor_ca Rebased your PR on latest origin/master and made the code to work for passthrough codec. Tommorrow will finish the other two codecs and sent a PR if that's OK with you. |
@dbaluta thanks, just discovered the core issue, am blocked internally and wont have time to finish this |
continuation of #3881
Essentially these steps