From 030af4f5b8c114f8f2e2ee80c10cd326eef3768c Mon Sep 17 00:00:00 2001 From: Keyon Jie Date: Thu, 14 Mar 2019 22:34:17 +0800 Subject: [PATCH 1/3] topology: refine scheduling period and add time domain for pipelines Rename 'deadline' to 'period' to indicate pipeline scheduling period, and add time domain to indicate the pipeline scheduling domain (e.g. DMA interrupt, timer interrupt). Please be noticed that this might introduce an abi change so consequent abi changes in both FW and driver side are needed. Haven't set the flag in topology/sof/sof-xxx.m4 yet, that means it will use io/interrupt scheduling for those topologies/pipelines at the moment, if wanna to change them, please change them specific there. Signed-off-by: Keyon Jie Signed-off-by: Tomasz Lauda --- tools/topology/m4/dai.m4 | 4 ++- tools/topology/m4/pipeline.m4 | 39 ++++++++++++++++--------- tools/topology/sof/pipe-dai-capture.m4 | 2 +- tools/topology/sof/pipe-dai-playback.m4 | 2 +- tools/topology/sof/pipe-detect.m4 | 2 +- tools/topology/sof/pipe-pcm-media.m4 | 2 +- tools/topology/sof/pipe-tone.m4 | 2 +- tools/topology/sof/tokens.m4 | 4 +-- 8 files changed, 36 insertions(+), 21 deletions(-) diff --git a/tools/topology/m4/dai.m4 b/tools/topology/m4/dai.m4 index 4a34744a3d50..d904555b7160 100644 --- a/tools/topology/m4/dai.m4 +++ b/tools/topology/m4/dai.m4 @@ -167,7 +167,7 @@ define(`DAI_CONFIG', dnl DAI_ADD(pipeline, dnl pipe id, dai type, dai_index, dai_be, dnl buffer, periods, format, -dnl frames, deadline, priority, core) +dnl frames, deadline, priority, core, time_domain) define(`DAI_ADD', `undefine(`PIPELINE_ID')' `undefine(`DAI_TYPE')' @@ -180,6 +180,7 @@ define(`DAI_ADD', `undefine(`SCHEDULE_DEADLINE')' `undefine(`SCHEDULE_PRIORITY')' `undefine(`SCHEDULE_CORE')' +`undefine(`SCHEDULE_TIME_DOMAIN')' `define(`PIPELINE_ID', $2)' `define(`DAI_TYPE', STR($3))' `define(`DAI_INDEX', STR($4))' @@ -192,6 +193,7 @@ define(`DAI_ADD', `define(`SCHEDULE_DEADLINE', $10)' `define(`SCHEDULE_PRIORITY', $11)' `define(`SCHEDULE_CORE', $12)' +`define(`SCHEDULE_TIME_DOMAIN', $13)' `include($1)' `DEBUG_DAI($3, $4)' ) diff --git a/tools/topology/m4/pipeline.m4 b/tools/topology/m4/pipeline.m4 index cf45d9dea2d6..833780c02693 100644 --- a/tools/topology/m4/pipeline.m4 +++ b/tools/topology/m4/pipeline.m4 @@ -1,20 +1,24 @@ divert(-1) +# list of generic scheduling time domains +define(`SCHEDULE_TIME_DOMAIN_DMA', 0) +define(`SCHEDULE_TIME_DOMAIN_TIMER', 1) + dnl Define macro for pipeline widget dnl Pipeline name) define(`N_PIPELINE', `PIPELINE.'PIPELINE_ID`.'$1) -dnl W_PIPELINE(stream, deadline, priority, frames, core, timer, platform) +dnl W_PIPELINE(stream, period, priority, frames, core, initiator, platform) define(`W_PIPELINE', `SectionVendorTuples."'N_PIPELINE($1)`_tuples" {' ` tokens "sof_sched_tokens"' ` tuples."word" {' -` SOF_TKN_SCHED_DEADLINE' STR($2) +` SOF_TKN_SCHED_PERIOD' STR($2) ` SOF_TKN_SCHED_PRIORITY' STR($3) ` SOF_TKN_SCHED_CORE' STR($5) ` SOF_TKN_SCHED_FRAMES' STR($4) -` SOF_TKN_SCHED_TIMER' STR($6) +` SOF_TKN_SCHED_TIME_DOMAIN' STR($6) ` }' `}' `SectionData."'N_PIPELINE($1)`_data" {' @@ -33,24 +37,27 @@ define(`W_PIPELINE', dnl PIPELINE_PCM_ADD(pipeline, dnl pipe id, pcm, max channels, format, -dnl frames, deadline, priority, core) +dnl frames, period, priority, core, +dnl time_domain) define(`PIPELINE_PCM_ADD', `undefine(`PCM_ID')' `undefine(`PIPELINE_ID')' `undefine(`PIPELINE_CHANNELS')' `undefine(`PIPELINE_FORMAT')' `undefine(`SCHEDULE_FRAMES')' -`undefine(`SCHEDULE_DEADLINE')' +`undefine(`SCHEDULE_PERIOD')' `undefine(`SCHEDULE_PRIORITY')' `undefine(`SCHEDULE_CORE')' +`undefine(`SCHEDULE_TIME_DOMAIN')' `define(`PIPELINE_ID', $2)' `define(`PCM_ID', $3)' `define(`PIPELINE_CHANNELS', $4)' `define(`PIPELINE_FORMAT', $5)' `define(`SCHEDULE_FRAMES', $6)' -`define(`SCHEDULE_DEADLINE', $7)' +`define(`SCHEDULE_PERIOD', $7)' `define(`SCHEDULE_PRIORITY', $8)' `define(`SCHEDULE_CORE', $9)' +`define(`SCHEDULE_TIME_DOMAIN', $10)' `define(`DAI_FORMAT', $5)' `include($1)' `DEBUG_PCM_ADD($1, $3)' @@ -58,17 +65,19 @@ define(`PIPELINE_PCM_ADD', dnl PIPELINE_PCM_DAI_ADD(pipeline, dnl pipe id, pcm, max channels, format, -dnl frames, deadline, priority, core, -dnl dai type, dai_index, dai format, periods) +dnl frames, period, priority, core, +dnl dai type, dai_index, dai format, +dnl periods, time_domain) define(`PIPELINE_PCM_DAI_ADD', `undefine(`PCM_ID')' `undefine(`PIPELINE_ID')' `undefine(`PIPELINE_CHANNELS')' `undefine(`PIPELINE_FORMAT')' `undefine(`SCHEDULE_FRAMES')' -`undefine(`SCHEDULE_DEADLINE')' +`undefine(`SCHEDULE_PERIOD')' `undefine(`SCHEDULE_PRIORITY')' `undefine(`SCHEDULE_CORE')' +`undefine(`SCHEDULE_TIME_DOMAIN')' `undefine(`DAI_TYPE')' `undefine(`DAI_INDEX')' `undefine(`DAI_FORMAT')' @@ -78,9 +87,10 @@ define(`PIPELINE_PCM_DAI_ADD', `define(`PIPELINE_CHANNELS', $4)' `define(`PIPELINE_FORMAT', $5)' `define(`SCHEDULE_FRAMES', $6)' -`define(`SCHEDULE_DEADLINE', $7)' +`define(`SCHEDULE_PERIOD', $7)' `define(`SCHEDULE_PRIORITY', $8)' `define(`SCHEDULE_CORE', $9)' +`define(`SCHEDULE_TIME_DOMAIN', $14)' `define(`DAI_TYPE', STR($10))' `define(`DAI_INDEX', STR($11))' `define(`DAI_FORMAT', $12)' @@ -91,22 +101,25 @@ define(`PIPELINE_PCM_DAI_ADD', dnl PIPELINE_ADD(pipeline, dnl pipe id, max channels, format, -dnl frames, deadline, priority, core, sched_comp) +dnl frames, period, priority, core, +dnl sched_comp, time_domain) define(`PIPELINE_ADD', `undefine(`PIPELINE_ID')' `undefine(`PIPELINE_CHANNELS')' `undefine(`PIPELINE_FORMAT')' `undefine(`SCHEDULE_FRAMES')' -`undefine(`SCHEDULE_DEADLINE')' +`undefine(`SCHEDULE_PERIOD')' `undefine(`SCHEDULE_PRIORITY')' `undefine(`SCHEDULE_CORE')' +`undefine(`SCHEDULE_TIME_DOMAIN')' `define(`PIPELINE_ID', $2)' `define(`PIPELINE_CHANNELS', $3)' `define(`PIPELINE_FORMAT', $4)' `define(`SCHEDULE_FRAMES', $5)' -`define(`SCHEDULE_DEADLINE', $6)' +`define(`SCHEDULE_PERIOD', $6)' `define(`SCHEDULE_PRIORITY', $7)' `define(`SCHEDULE_CORE', $8)' +`define(`SCHEDULE_TIME_DOMAIN', $10)' `define(`SCHED_COMP', $9)' `include($1)' ) diff --git a/tools/topology/sof/pipe-dai-capture.m4 b/tools/topology/sof/pipe-dai-capture.m4 index 9d1a75bd0488..a28ef58fae88 100644 --- a/tools/topology/sof/pipe-dai-capture.m4 +++ b/tools/topology/sof/pipe-dai-capture.m4 @@ -13,7 +13,7 @@ W_DAI_IN(DAI_TYPE, DAI_INDEX, DAI_BE, DAI_FORMAT, 2, 0, 0) # # DAI pipeline - always use 0 for DAIs # -W_PIPELINE(N_DAI_IN, SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, SCHEDULE_CORE, 0, pipe_dai_schedule_plat) +W_PIPELINE(N_DAI_IN, SCHEDULE_PERIOD, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, SCHEDULE_CORE, SCHEDULE_TIME_DOMAIN, pipe_dai_schedule_plat) # # Graph connections to pipelines diff --git a/tools/topology/sof/pipe-dai-playback.m4 b/tools/topology/sof/pipe-dai-playback.m4 index 804b180eb2ae..fed4b9cba8ae 100644 --- a/tools/topology/sof/pipe-dai-playback.m4 +++ b/tools/topology/sof/pipe-dai-playback.m4 @@ -13,7 +13,7 @@ W_DAI_OUT(DAI_TYPE, DAI_INDEX, DAI_BE, DAI_FORMAT, 0, 2, 2) # # DAI pipeline - always use 0 for DAIs # -W_PIPELINE(N_DAI_OUT, SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, SCHEDULE_CORE, 0, pipe_dai_schedule_plat) +W_PIPELINE(N_DAI_OUT, SCHEDULE_PERIOD, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, SCHEDULE_CORE, SCHEDULE_TIME_DOMAIN, pipe_dai_schedule_plat) # # Graph connections to pipelines diff --git a/tools/topology/sof/pipe-detect.m4 b/tools/topology/sof/pipe-detect.m4 index edc6168947b3..947661b02142 100644 --- a/tools/topology/sof/pipe-detect.m4 +++ b/tools/topology/sof/pipe-detect.m4 @@ -62,7 +62,7 @@ VIRTUAL_WIDGET(DETECT SINK PIPELINE_ID, out_drv, PIPELINE_ID) # Pipeline dnl W_PIPELINE(stream, deadline, priority, frames, core, timer, platform) -W_PIPELINE(SCHED_COMP, SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, SCHEDULE_CORE, 0, pipe_media_schedule_plat) +W_PIPELINE(SCHED_COMP, SCHEDULE_PERIOD, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, SCHEDULE_CORE, SCHEDULE_TIME_DOMAIN, pipe_media_schedule_plat) # # Pipeline Graph diff --git a/tools/topology/sof/pipe-pcm-media.m4 b/tools/topology/sof/pipe-pcm-media.m4 index 94cbd215b09e..5db435f48cf3 100644 --- a/tools/topology/sof/pipe-pcm-media.m4 +++ b/tools/topology/sof/pipe-pcm-media.m4 @@ -86,7 +86,7 @@ indir(`define', concat(`PIPELINE_SOURCE_', PIPELINE_ID), N_BUFFER(2)) # Pipeline Configuration. # -W_PIPELINE(N_SRC(0), SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, SCHEDULE_CORE, 1, pipe_media_schedule_plat) +W_PIPELINE(N_SRC(0), SCHEDULE_PERIOD, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, SCHEDULE_CORE, SCHEDULE_TIME_DOMAIN, pipe_media_schedule_plat) # # PCM Configuration diff --git a/tools/topology/sof/pipe-tone.m4 b/tools/topology/sof/pipe-tone.m4 index 87e7f02a8b71..0192b4c77699 100644 --- a/tools/topology/sof/pipe-tone.m4 +++ b/tools/topology/sof/pipe-tone.m4 @@ -77,4 +77,4 @@ indir(`define', concat(`PIPELINE_SOURCE_', PIPELINE_ID), N_BUFFER(1)) # Pipeline Configuration. # -W_PIPELINE(N_TONE(0), SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, SCHEDULE_CORE, 0, pipe_tone_schedule_plat) +W_PIPELINE(N_TONE(0), SCHEDULE_DEADLINE, SCHEDULE_PERIOD, SCHEDULE_FRAMES, SCHEDULE_CORE, SCHEDULE_TIME_DOMAIN, pipe_tone_schedule_plat) diff --git a/tools/topology/sof/tokens.m4 b/tools/topology/sof/tokens.m4 index acff7b3b99a5..2de5cd66f507 100644 --- a/tools/topology/sof/tokens.m4 +++ b/tools/topology/sof/tokens.m4 @@ -23,12 +23,12 @@ SectionVendorTokens."sof_dai_tokens" { } SectionVendorTokens."sof_sched_tokens" { - SOF_TKN_SCHED_DEADLINE "200" + SOF_TKN_SCHED_PERIOD "200" SOF_TKN_SCHED_PRIORITY "201" SOF_TKN_SCHED_MIPS "202" SOF_TKN_SCHED_CORE "203" SOF_TKN_SCHED_FRAMES "204" - SOF_TKN_SCHED_TIMER "205" + SOF_TKN_SCHED_TIME_DOMAIN "205" } SectionVendorTokens."sof_volume_tokens" { From 0b0b94a02ba89a1abbe150835a9fe8eb36a4608d Mon Sep 17 00:00:00 2001 From: Tomasz Lauda Date: Thu, 14 Mar 2019 17:49:33 +0100 Subject: [PATCH 2/3] topology: update all HDA pipelines to use timer Updates all HDA pipelines in topologies to use timer as a scheduling source. Signed-off-by: Tomasz Lauda --- tools/topology/sof-apl-da7219.m4 | 6 +++--- tools/topology/sof-apl-pcm512x.m4 | 6 +++--- tools/topology/sof-apl-rt298.m4 | 6 +++--- tools/topology/sof-cml-rt5682.m4 | 6 +++--- tools/topology/sof-cml-src-rt5682.m4 | 6 +++--- tools/topology/sof-glk-da7219.m4 | 6 +++--- tools/topology/sof-glk-rt5682.m4 | 6 +++--- tools/topology/sof-hda-generic-idisp.m4 | 6 +++--- tools/topology/sof-hda-generic.m4 | 14 +++++++------- 9 files changed, 31 insertions(+), 31 deletions(-) diff --git a/tools/topology/sof-apl-da7219.m4 b/tools/topology/sof-apl-da7219.m4 index 36f2d327b0e4..011b918b7dd5 100644 --- a/tools/topology/sof-apl-da7219.m4 +++ b/tools/topology/sof-apl-da7219.m4 @@ -112,21 +112,21 @@ DAI_ADD(sof/pipe-dai-capture.m4, DAI_ADD(sof/pipe-dai-playback.m4, 5, HDA, 3, iDisp1, PIPELINE_SOURCE_5, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # playback DAI is iDisp2 using 2 periods # Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-playback.m4, 6, HDA, 4, iDisp2, PIPELINE_SOURCE_6, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # playback DAI is iDisp3 using 2 periods # Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-playback.m4, 7, HDA, 5, iDisp3, PIPELINE_SOURCE_7, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) PCM_PLAYBACK_ADD(Speakers, 0, PIPELINE_PCM_1) PCM_DUPLEX_ADD(Headset, 1, PIPELINE_PCM_2, PIPELINE_PCM_3) diff --git a/tools/topology/sof-apl-pcm512x.m4 b/tools/topology/sof-apl-pcm512x.m4 index 74aa3ad9914a..4068daceeaab 100644 --- a/tools/topology/sof-apl-pcm512x.m4 +++ b/tools/topology/sof-apl-pcm512x.m4 @@ -77,21 +77,21 @@ DAI_ADD(sof/pipe-dai-playback.m4, DAI_ADD(sof/pipe-dai-playback.m4, 2, HDA, 0, iDisp1, PIPELINE_SOURCE_2, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # playback DAI is iDisp2 using 2 periods # Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-playback.m4, 3, HDA, 1, iDisp2, PIPELINE_SOURCE_3, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # playback DAI is iDisp3 using 2 periods # Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-playback.m4, 4, HDA, 2, iDisp3, PIPELINE_SOURCE_4, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # PCM Low Latency, id 0 dnl PCM_PLAYBACK_ADD(name, pcm_id, playback) diff --git a/tools/topology/sof-apl-rt298.m4 b/tools/topology/sof-apl-rt298.m4 index 2bd838cc5f04..4245ee3b29e1 100644 --- a/tools/topology/sof-apl-rt298.m4 +++ b/tools/topology/sof-apl-rt298.m4 @@ -65,21 +65,21 @@ DAI_ADD(sof/pipe-dai-playback.m4, DAI_ADD(sof/pipe-dai-playback.m4, 5, HDA, 3, iDisp1, PIPELINE_SOURCE_5, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # playback DAI is iDisp2 using 2 periods # Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-playback.m4, 6, HDA, 4, iDisp2, PIPELINE_SOURCE_6, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # playback DAI is iDisp3 using 2 periods # Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-playback.m4, 7, HDA, 5, iDisp3, PIPELINE_SOURCE_7, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # PCM Low Latency, id 0 PCM_PLAYBACK_ADD(Port5, 0, PIPELINE_PCM_1) diff --git a/tools/topology/sof-cml-rt5682.m4 b/tools/topology/sof-cml-rt5682.m4 index dcb7412b4e8e..4756ba537d73 100644 --- a/tools/topology/sof-cml-rt5682.m4 +++ b/tools/topology/sof-cml-rt5682.m4 @@ -112,21 +112,21 @@ DAI_ADD(sof/pipe-dai-capture.m4, DAI_ADD(sof/pipe-dai-playback.m4, 4, HDA, 0, iDisp1, PIPELINE_SOURCE_4, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # playback DAI is iDisp2 using 2 periods # Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-playback.m4, 5, HDA, 1, iDisp2, PIPELINE_SOURCE_5, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # playback DAI is iDisp3 using 2 periods # Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-playback.m4, 6, HDA, 2, iDisp3, PIPELINE_SOURCE_6, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # PCM Low Latency, id 0 dnl PCM_PLAYBACK_ADD(name, pcm_id, playback) diff --git a/tools/topology/sof-cml-src-rt5682.m4 b/tools/topology/sof-cml-src-rt5682.m4 index 20f636b9ce55..1144c996d356 100644 --- a/tools/topology/sof-cml-src-rt5682.m4 +++ b/tools/topology/sof-cml-src-rt5682.m4 @@ -106,21 +106,21 @@ DAI_ADD(sof/pipe-dai-capture.m4, DAI_ADD(sof/pipe-dai-playback.m4, 4, HDA, 0, iDisp1, PIPELINE_SOURCE_4, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # playback DAI is iDisp2 using 2 periods # Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-playback.m4, 5, HDA, 1, iDisp2, PIPELINE_SOURCE_5, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # playback DAI is iDisp3 using 2 periods # Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-playback.m4, 6, HDA, 2, iDisp3, PIPELINE_SOURCE_6, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # PCM Low Latency, id 0 dnl PCM_PLAYBACK_ADD(name, pcm_id, playback) diff --git a/tools/topology/sof-glk-da7219.m4 b/tools/topology/sof-glk-da7219.m4 index 8e2c9333c545..2e39a0512422 100644 --- a/tools/topology/sof-glk-da7219.m4 +++ b/tools/topology/sof-glk-da7219.m4 @@ -112,21 +112,21 @@ DAI_ADD(sof/pipe-dai-capture.m4, DAI_ADD(sof/pipe-dai-playback.m4, 5, HDA, 3, iDisp1, PIPELINE_SOURCE_5, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # playback DAI is iDisp2 using 2 periods # Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-playback.m4, 6, HDA, 4, iDisp2, PIPELINE_SOURCE_6, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # playback DAI is iDisp3 using 2 periods # Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-playback.m4, 7, HDA, 5, iDisp3, PIPELINE_SOURCE_7, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) PCM_PLAYBACK_ADD(Speakers, 0, PIPELINE_PCM_1) PCM_DUPLEX_ADD(Headset, 1, PIPELINE_PCM_2, PIPELINE_PCM_3) diff --git a/tools/topology/sof-glk-rt5682.m4 b/tools/topology/sof-glk-rt5682.m4 index afb91c517d4f..8ba71ceca7c8 100644 --- a/tools/topology/sof-glk-rt5682.m4 +++ b/tools/topology/sof-glk-rt5682.m4 @@ -115,21 +115,21 @@ DAI_ADD(sof/pipe-dai-capture.m4, DAI_ADD(sof/pipe-dai-playback.m4, 5, HDA, 3, iDisp1, PIPELINE_SOURCE_5, 2, s16le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # playback DAI is iDisp2 using 2 periods # Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-playback.m4, 6, HDA, 4, iDisp2, PIPELINE_SOURCE_6, 2, s16le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # playback DAI is iDisp3 using 2 periods # Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-playback.m4, 7, HDA, 5, iDisp3, PIPELINE_SOURCE_7, 2, s16le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) PCM_PLAYBACK_ADD(Speakers, 0, PIPELINE_PCM_1) PCM_DUPLEX_ADD(Headset, 1, PIPELINE_PCM_2, PIPELINE_PCM_3) diff --git a/tools/topology/sof-hda-generic-idisp.m4 b/tools/topology/sof-hda-generic-idisp.m4 index a65953925fdc..ceae7a716394 100644 --- a/tools/topology/sof-hda-generic-idisp.m4 +++ b/tools/topology/sof-hda-generic-idisp.m4 @@ -60,21 +60,21 @@ dnl frames, deadline, priority, core) DAI_ADD(sof/pipe-dai-playback.m4, 2, HDA, 0, iDisp1, PIPELINE_SOURCE_2, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # playback DAI is iDisp2 using 2 periods # Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-playback.m4, 3, HDA, 1, iDisp2, PIPELINE_SOURCE_3, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # playback DAI is iDisp3 using 2 periods # Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-playback.m4, 4, HDA, 2, iDisp3, PIPELINE_SOURCE_4, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # PCM Low Latency, id 0 dnl PCM_PLAYBACK_ADD(name, pcm_id, playback) diff --git a/tools/topology/sof-hda-generic.m4 b/tools/topology/sof-hda-generic.m4 index d2c10593f3b8..5c801b556a7f 100644 --- a/tools/topology/sof-hda-generic.m4 +++ b/tools/topology/sof-hda-generic.m4 @@ -77,49 +77,49 @@ PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4, DAI_ADD(sof/pipe-dai-playback.m4, 1, HDA, 0, Analog Playback and Capture, PIPELINE_SOURCE_1, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # capture DAI is HDA Analog using 2 periods # Dai buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-capture.m4, 2, HDA, 1, Analog Playback and Capture, PIPELINE_SINK_2, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # playback DAI is HDA Digital using 2 periods # Dai buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-playback.m4, 3, HDA, 2, Digital Playback and Capture, PIPELINE_SOURCE_3, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # capture DAI is HDA Digital using 2 periods # Dai buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-capture.m4, 4, HDA, 3, Digital Playback and Capture, PIPELINE_SINK_4, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # playback DAI is iDisp1 using 2 periods # Dai buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-playback.m4, 7, HDA, 4, iDisp1, PIPELINE_SOURCE_7, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # playback DAI is iDisp2 using 2 periods # Dai buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-playback.m4, 8, HDA, 5, iDisp2, PIPELINE_SOURCE_8, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # playback DAI is iDisp3 using 2 periods # Dai buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-playback.m4, 9, HDA, 6, iDisp3, PIPELINE_SOURCE_9, 2, s32le, - 48, 1000, 0, 0) + 48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) PCM_DUPLEX_ADD(HDA Analog, 0, PIPELINE_PCM_1, PIPELINE_PCM_2) PCM_DUPLEX_ADD(HDA Digital, 1, PIPELINE_PCM_3, PIPELINE_PCM_4) From 4b5d9831848430e442d4fb755757ac33e4b994f8 Mon Sep 17 00:00:00 2001 From: Tomasz Lauda Date: Tue, 26 Mar 2019 15:19:38 +0100 Subject: [PATCH 3/3] pipeline: update sof_ipc_pipe_new struct Updates sof_ipc_pipe_new struct to better handle different time domains: - Changes "deadline" to "period". - Changes "timer_delay" to "time_domain". Signed-off-by: Tomasz Lauda --- src/audio/pipeline.c | 6 +++--- src/audio/pipeline_static.c | 11 ++++++----- src/host/common_test.c | 4 ++-- src/host/testbench.c | 4 ++-- src/include/host/common_test.h | 2 +- src/include/host/topology.h | 12 ++++++------ src/include/sof/audio/pipeline.h | 2 +- src/include/uapi/ipc/topology.h | 12 ++++++++---- 8 files changed, 29 insertions(+), 24 deletions(-) diff --git a/src/audio/pipeline.c b/src/audio/pipeline.c index 85d4bba24ae4..d6f563fc67b2 100644 --- a/src/audio/pipeline.c +++ b/src/audio/pipeline.c @@ -810,7 +810,7 @@ static int pipeline_xrun_recover(struct pipeline *p) void pipeline_schedule_copy(struct pipeline *p, uint64_t start) { if (p->sched_comp->state == COMP_STATE_ACTIVE) - schedule_task(&p->pipe_task, start, p->ipc_pipe.deadline, 0); + schedule_task(&p->pipe_task, start, p->ipc_pipe.period, 0); } /* notify pipeline that this component requires buffers emptied/filled @@ -819,7 +819,7 @@ void pipeline_schedule_copy(struct pipeline *p, uint64_t start) */ void pipeline_schedule_copy_idle(struct pipeline *p) { - schedule_task(&p->pipe_task, 0, p->ipc_pipe.deadline, + schedule_task(&p->pipe_task, 0, p->ipc_pipe.period, SOF_SCHEDULE_FLAG_IDLE); } @@ -862,5 +862,5 @@ static uint64_t pipeline_task(void *arg) sched: tracev_pipe("pipeline_task() sched"); - return p->ipc_pipe.timer_delay; + return p->ipc_pipe.period; } diff --git a/src/audio/pipeline_static.c b/src/audio/pipeline_static.c index adbbee56082f..be45f8e4ad19 100644 --- a/src/audio/pipeline_static.c +++ b/src/audio/pipeline_static.c @@ -96,8 +96,9 @@ /* * Static Pipeline Convenience Constructor */ -#define SPIPE_PIPE(pid, pcore, pdeadline, ppriority) \ - {.pipeline_id = pid, .core = pcore, .deadline = pdeadline, .priority = ppriority} +#define SPIPE_PIPE(pid, pcore, pperiod, ppriority) \ + {.pipeline_id = pid, .core = pcore, .period = pperiod, \ + .priority = ppriority} #define SPIPE_PIPE_CONNECT(psource, bsource, bid, psink, bsink) \ {.pipeline_source_id = psource, .comp_source_id = bsource, \ .buffer_id = bid, .pipeline_sink_id = psink, .comp_sink_id = bsink} @@ -345,9 +346,9 @@ static struct spipe spipe[] = { /* pipelines */ struct sof_ipc_pipe_new pipeline[] = { - SPIPE_PIPE(0, 0, 1000, SOF_TASK_PRI_HIGH),/* high pri - 1ms deadline */ -// SPIPE_PIPE(1, 0, 4000, SOF_TASK_PRI_MED),/* med pri - 4ms deadline */ -// SPIPE_PIPE(2, 0, 5000, SOF_TASK_PRI_LOW),/* low pri - 5ms deadline */ + SPIPE_PIPE(0, 0, 1000, SOF_TASK_PRI_HIGH),/* high pri - 1ms period */ +// SPIPE_PIPE(1, 0, 4000, SOF_TASK_PRI_MED),/* med pri - 4ms period */ +// SPIPE_PIPE(2, 0, 5000, SOF_TASK_PRI_LOW),/* low pri - 5ms period */ }; int init_static_pipeline(struct ipc *ipc) diff --git a/src/host/common_test.c b/src/host/common_test.c index abd5578bd95b..0b218401348b 100644 --- a/src/host/common_test.c +++ b/src/host/common_test.c @@ -125,11 +125,11 @@ int tb_pipeline_params(struct ipc *ipc, int nch, struct sof_ipc_pcm_params params; char message[DEBUG_MSG_LEN]; int fs_period; - int deadline = ipc_pipe->deadline; + int period = ipc_pipe->period; int ret = 0; /* Compute period from sample rates */ - fs_period = (int)(0.9999 + tp->fs_in * deadline / 1e6); + fs_period = (int)(0.9999 + tp->fs_in * period / 1e6); sprintf(message, "period sample count %d\n", fs_period); debug_print(message); diff --git a/src/host/testbench.c b/src/host/testbench.c index e212a0aa8b48..b5c1d65df57c 100644 --- a/src/host/testbench.c +++ b/src/host/testbench.c @@ -288,10 +288,10 @@ int main(int argc, char **argv) /* input and output sample rate */ if (!tp.fs_in) - tp.fs_in = ipc_pipe->deadline * ipc_pipe->frames_per_sched; + tp.fs_in = ipc_pipe->period * ipc_pipe->frames_per_sched; if (!tp.fs_out) - tp.fs_out = ipc_pipe->deadline * ipc_pipe->frames_per_sched; + tp.fs_out = ipc_pipe->period * ipc_pipe->frames_per_sched; /* set pipeline params and trigger start */ if (tb_pipeline_start(sof.ipc, TESTBENCH_NCH, ipc_pipe, &tp) < 0) { diff --git a/src/include/host/common_test.h b/src/include/host/common_test.h index d8f9fe7697a2..50da63f5bc2b 100644 --- a/src/include/host/common_test.h +++ b/src/include/host/common_test.h @@ -55,7 +55,7 @@ struct testbench_prm { /* * input and output sample rate parameters * By default, these are calculated from pipeline frames_per_sched - * and deadline but they can also be overridden via input arguments + * and period but they can also be overridden via input arguments * to the testbench. */ uint32_t fs_in; diff --git a/src/include/host/topology.h b/src/include/host/topology.h index a7ddb4ba5d8e..2399dd372586 100644 --- a/src/include/host/topology.h +++ b/src/include/host/topology.h @@ -44,12 +44,12 @@ #define SOF_TKN_BUF_CAPS 101 /* scheduling */ -#define SOF_TKN_SCHED_DEADLINE 200 +#define SOF_TKN_SCHED_PERIOD 200 #define SOF_TKN_SCHED_PRIORITY 201 #define SOF_TKN_SCHED_MIPS 202 #define SOF_TKN_SCHED_CORE 203 #define SOF_TKN_SCHED_FRAMES 204 -#define SOF_TKN_SCHED_TIMER 205 +#define SOF_TKN_SCHED_TIME_DOMAIN 205 /* volume */ #define SOF_TKN_VOLUME_RAMP_STEP_TYPE 250 @@ -119,9 +119,9 @@ static const struct sof_topology_token buffer_tokens[] = { /* scheduling */ static const struct sof_topology_token sched_tokens[] = { - {SOF_TKN_SCHED_DEADLINE, SND_SOC_TPLG_TUPLE_TYPE_WORD, + {SOF_TKN_SCHED_PERIOD, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_uint32_t, - offsetof(struct sof_ipc_pipe_new, deadline), 0}, + offsetof(struct sof_ipc_pipe_new, period), 0}, {SOF_TKN_SCHED_PRIORITY, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_uint32_t, offsetof(struct sof_ipc_pipe_new, priority), 0}, @@ -134,9 +134,9 @@ static const struct sof_topology_token sched_tokens[] = { {SOF_TKN_SCHED_FRAMES, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_uint32_t, offsetof(struct sof_ipc_pipe_new, frames_per_sched), 0}, - {SOF_TKN_SCHED_TIMER, SND_SOC_TPLG_TUPLE_TYPE_WORD, + {SOF_TKN_SCHED_TIME_DOMAIN, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_uint32_t, - offsetof(struct sof_ipc_pipe_new, timer_delay), 0}, + offsetof(struct sof_ipc_pipe_new, time_domain), 0}, }; /* volume */ diff --git a/src/include/sof/audio/pipeline.h b/src/include/sof/audio/pipeline.h index 95de7654660e..c2132b1a3c22 100644 --- a/src/include/sof/audio/pipeline.h +++ b/src/include/sof/audio/pipeline.h @@ -129,7 +129,7 @@ static inline bool pipeline_is_preload(struct pipeline *p) /* checks if pipeline is scheduled with timer */ static inline bool pipeline_is_timer_driven(struct pipeline *p) { - return p->ipc_pipe.timer_delay; + return p->ipc_pipe.time_domain == SOF_TIME_DOMAIN_TIMER; } /* pipeline creation and destruction */ diff --git a/src/include/uapi/ipc/topology.h b/src/include/uapi/ipc/topology.h index 65a2eec8a42d..a37da8749fb0 100644 --- a/src/include/uapi/ipc/topology.h +++ b/src/include/uapi/ipc/topology.h @@ -248,6 +248,12 @@ struct sof_ipc_comp_reply { * Pipeline */ +/** \brief Types of pipeline scheduling time domains */ +enum sof_ipc_pipe_sched_time_domain { + SOF_TIME_DOMAIN_DMA = 0, /**< DMA interrupt */ + SOF_TIME_DOMAIN_TIMER, /**< Timer interrupt */ +}; + /* new pipeline - SOF_IPC_TPLG_PIPE_NEW */ struct sof_ipc_pipe_new { struct sof_ipc_cmd_hdr hdr; @@ -255,14 +261,12 @@ struct sof_ipc_pipe_new { uint32_t pipeline_id; /**< pipeline id */ uint32_t sched_id; /**< Scheduling component id */ uint32_t core; /**< core we run on */ - uint32_t deadline; /**< execution completion deadline in us*/ + uint32_t period; /**< execution period in us*/ uint32_t priority; /**< priority level 0 (low) to 10 (max) */ uint32_t period_mips; /**< worst case instruction count per period */ uint32_t frames_per_sched;/**< output frames of pipeline, 0 is variable */ uint32_t xrun_limit_usecs; /**< report xruns greater than limit */ - - /* non zero if timer scheduled, otherwise DAI DMA irq scheduled */ - uint32_t timer_delay; + uint32_t time_domain; /**< scheduling time domain */ } __attribute__((packed)); /* pipeline construction complete - SOF_IPC_TPLG_PIPE_COMPLETE */