Message ID | 20170107012109.25744-6-jerome.anand@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 1/6/17 7:21 PM, Jerome Anand wrote: > Use a hw register to calculate sub-period position reports. > This makes PulseAudio happier. From Takashi: There is no big merit to keep this a separate patch. Please fold into the main patch. You can put some comment in the code for explanation. > > Signed-off-by: David Henningsson <david.henningsson@canonical.com> > Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> > Signed-off-by: Jerome Anand <jerome.anand@intel.com> > --- > sound/x86/intel_hdmi_audio.c | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > > diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c > index d7b57658..d2036bc 100644 > --- a/sound/x86/intel_hdmi_audio.c > +++ b/sound/x86/intel_hdmi_audio.c > @@ -1489,6 +1489,8 @@ static snd_pcm_uframes_t snd_intelhad_pcm_pointer( > { > struct snd_intelhad *intelhaddata; > u32 bytes_rendered = 0; > + u32 t; > + int buf_id; > > /* pr_debug("snd_intelhad_pcm_pointer called\n"); */ > > @@ -1499,6 +1501,14 @@ static snd_pcm_uframes_t snd_intelhad_pcm_pointer( > return SNDRV_PCM_POS_XRUN; > } > > + buf_id = intelhaddata->curr_buf % 4; > + had_read_register(AUD_BUF_A_LENGTH + (buf_id * HAD_REG_WIDTH), &t); > + if (t == 0) { > + pr_debug("discovered buffer done for buf %d\n", buf_id); > + /* had_process_buffer_done(intelhaddata); */ > + } > + t = intelhaddata->buf_info[buf_id].buf_size - t; > + > if (intelhaddata->stream_info.buffer_rendered) > div_u64_rem(intelhaddata->stream_info.buffer_rendered, > intelhaddata->stream_info.ring_buf_size, > @@ -1506,7 +1516,7 @@ static snd_pcm_uframes_t snd_intelhad_pcm_pointer( > > intelhaddata->stream_info.buffer_ptr = bytes_to_frames( > substream->runtime, > - bytes_rendered); > + bytes_rendered + t); > return intelhaddata->stream_info.buffer_ptr; > } > >
> -----Original Message----- > From: Pierre-Louis Bossart [mailto:pierre-louis.bossart@linux.intel.com] > Sent: Saturday, January 7, 2017 2:10 AM > To: Anand, Jerome <jerome.anand@intel.com>; intel- > gfx@lists.freedesktop.org; alsa-devel@alsa-project.org > Cc: tiwai@suse.de; broonie@kernel.org; Ughreja, Rakesh A > <rakesh.a.ughreja@intel.com>; ville.syrjala@linux.intel.com > Subject: Re: [alsa-devel] [PATCH V2 5/7] ALSA: x86: hdmi: Improve position > reporting > > On 1/6/17 7:21 PM, Jerome Anand wrote: > > Use a hw register to calculate sub-period position reports. > > This makes PulseAudio happier. > > From Takashi: There is no big merit to keep this a separate patch. > Please fold into the main patch. You can put some comment in the code for > explanation. > Misread the final comments. Thought we will be having it as separate patches only Do you still think we can merge these changes to the main file ? > > > > > > Signed-off-by: David Henningsson <david.henningsson@canonical.com> > > Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> > > Signed-off-by: Jerome Anand <jerome.anand@intel.com> > > --- > > sound/x86/intel_hdmi_audio.c | 12 +++++++++++- > > 1 file changed, 11 insertions(+), 1 deletion(-) > > > > diff --git a/sound/x86/intel_hdmi_audio.c > b/sound/x86/intel_hdmi_audio.c > > index d7b57658..d2036bc 100644 > > --- a/sound/x86/intel_hdmi_audio.c > > +++ b/sound/x86/intel_hdmi_audio.c > > @@ -1489,6 +1489,8 @@ static snd_pcm_uframes_t > snd_intelhad_pcm_pointer( > > { > > struct snd_intelhad *intelhaddata; > > u32 bytes_rendered = 0; > > + u32 t; > > + int buf_id; > > > > /* pr_debug("snd_intelhad_pcm_pointer called\n"); */ > > > > @@ -1499,6 +1501,14 @@ static snd_pcm_uframes_t > snd_intelhad_pcm_pointer( > > return SNDRV_PCM_POS_XRUN; > > } > > > > + buf_id = intelhaddata->curr_buf % 4; > > + had_read_register(AUD_BUF_A_LENGTH + (buf_id * > HAD_REG_WIDTH), &t); > > + if (t == 0) { > > + pr_debug("discovered buffer done for buf %d\n", buf_id); > > + /* had_process_buffer_done(intelhaddata); */ > > + } > > + t = intelhaddata->buf_info[buf_id].buf_size - t; > > + > > if (intelhaddata->stream_info.buffer_rendered) > > div_u64_rem(intelhaddata->stream_info.buffer_rendered, > > intelhaddata->stream_info.ring_buf_size, > > @@ -1506,7 +1516,7 @@ static snd_pcm_uframes_t > snd_intelhad_pcm_pointer( > > > > intelhaddata->stream_info.buffer_ptr = bytes_to_frames( > > substream->runtime, > > - bytes_rendered); > > + bytes_rendered + t); > > return intelhaddata->stream_info.buffer_ptr; > > } > > > >
diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c index d7b57658..d2036bc 100644 --- a/sound/x86/intel_hdmi_audio.c +++ b/sound/x86/intel_hdmi_audio.c @@ -1489,6 +1489,8 @@ static snd_pcm_uframes_t snd_intelhad_pcm_pointer( { struct snd_intelhad *intelhaddata; u32 bytes_rendered = 0; + u32 t; + int buf_id; /* pr_debug("snd_intelhad_pcm_pointer called\n"); */ @@ -1499,6 +1501,14 @@ static snd_pcm_uframes_t snd_intelhad_pcm_pointer( return SNDRV_PCM_POS_XRUN; } + buf_id = intelhaddata->curr_buf % 4; + had_read_register(AUD_BUF_A_LENGTH + (buf_id * HAD_REG_WIDTH), &t); + if (t == 0) { + pr_debug("discovered buffer done for buf %d\n", buf_id); + /* had_process_buffer_done(intelhaddata); */ + } + t = intelhaddata->buf_info[buf_id].buf_size - t; + if (intelhaddata->stream_info.buffer_rendered) div_u64_rem(intelhaddata->stream_info.buffer_rendered, intelhaddata->stream_info.ring_buf_size, @@ -1506,7 +1516,7 @@ static snd_pcm_uframes_t snd_intelhad_pcm_pointer( intelhaddata->stream_info.buffer_ptr = bytes_to_frames( substream->runtime, - bytes_rendered); + bytes_rendered + t); return intelhaddata->stream_info.buffer_ptr; }