All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: tiwai@suse.de
Cc: alsa-devel@alsa-project.org
Subject: [PATCH alsa-lib v2 0/6] pcm: hw: optimization for v2.0.14 of PCM protocol/interface
Date: Fri, 30 Jun 2017 20:37:23 +0900	[thread overview]
Message-ID: <20170630113729.13656-1-o-takashi@sakamocchi.jp> (raw)

Hi,

This patchset is a revised version of my previous one:

[PATCH alsa-lib 00/12] pcm: hw: optimization for v2.0.14 of PCM protocol/interface  
http://mailman.alsa-project.org/pipermail/alsa-devel/2017-June/122392.html 

Changes:
 - add a helper function, 'query_status_and_control_data()' to update appl_ptr
   in user space.
 - rename 'query_state()' to 'query_status_data()'
 - reduce two patches.
 - aggregate some patches for querying control data.

I did quick mesurement by execute aplay on x86 machine with.

1. With Intel HDA driver with usual configuration.
```
poll([{fd=4, events=POLLOUT|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=4, revents=POLLOUT}])
ioctl(4, SNDRV_PCM_IOCTL_HWSYNC, 0)     = 0
read(3, "a\23IH\205\177z\257\276]\346\237\313\220L\5\337V\363\351\216\17\346s\22\245-yb\312\37D"..., 16384) = 16384
ioctl(4, SNDRV_PCM_IOCTL_HWSYNC, 0)     = 0
poll([{fd=4, events=POLLOUT|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=4, revents=POLLOUT}])
```

2. With Intel HDA driver with 'sync_ptr_ioctl' option to hw PCM plugin.
```
poll([{fd=4, events=POLLOUT|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=4, revents=POLLOUT}])
ioctl(4, SNDRV_PCM_IOCTL_SYNC_PTR, 0x55fe03539f80) = 0
ioctl(4, SNDRV_PCM_IOCTL_SYNC_PTR, 0x55fe03539f80) = 0
ioctl(4, SNDRV_PCM_IOCTL_SYNC_PTR, 0x55fe03539f80) = 0
ioctl(4, SNDRV_PCM_IOCTL_SYNC_PTR, 0x55fe03539f80) = 0
read(3, "Rz\vB\v|A\275\356`\201)\335i3\r}\21Q^\30\324'\r'\375l\235&\3330\2"..., 16384) = 16384
ioctl(4, SNDRV_PCM_IOCTL_SYNC_PTR, 0x55fe03539f80) = 0
ioctl(4, SNDRV_PCM_IOCTL_SYNC_PTR, 0x55fe03539f80) = 0
ioctl(4, SNDRV_PCM_IOCTL_SYNC_PTR, 0x55fe03539f80) = 0
poll([{fd=4, events=POLLOUT|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=4, revents=POLLOUT}])
```

3. With Fireworks driver with a patch for snd-firewire-lib to add
   SNDRV_PCM_INFO_SYNC_APPLPTR  support[1].
```
poll([{fd=4, events=POLLOUT|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=4, revents=POLLOUT}])
ioctl(4, SNDRV_PCM_IOCTL_HWSYNC, 0)     = 0
ioctl(4, SNDRV_PCM_IOCTL_SYNC_PTR, 0x55b647ec9c00) = 0
read(3, "|\n*\336\322\252*&\377\312\372&\276\333.\207\21\343\362\3\5\363\201\266\3421lZ;\\\22*"..., 24576) = 24576
ioctl(4, SNDRV_PCM_IOCTL_HWSYNC, 0)     = 0
poll([{fd=4, events=POLLOUT|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=4, revents=POLLOUT}])
```

We can see this optimization reduces some ioctl calls in case 3. This is
due to status data mapping.

[1] Below.
diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
index f8c2765..04fb3df 100644
--- a/sound/firewire/amdtp-stream.c
+++ b/sound/firewire/amdtp-stream.c
@@ -160,7 +160,8 @@ int amdtp_stream_add_pcm_hw_constraints(struct amdtp_stream *s,
                   SNDRV_PCM_INFO_INTERLEAVED |
                   SNDRV_PCM_INFO_JOINT_DUPLEX |
                   SNDRV_PCM_INFO_MMAP |
-                  SNDRV_PCM_INFO_MMAP_VALID;
+                  SNDRV_PCM_INFO_MMAP_VALID |
+                  SNDRV_PCM_INFO_SYNC_APPLPTR;
 
        /* SNDRV_PCM_INFO_BATCH */
        hw->periods_min = 2;

Takashi Sakamoto (6):
  pcm: hw: add a helper function to query status/control data
  pcm: hw: add a helper function just to query status data
  pcm: hw: add a helper function to request hwsync without side-effects
  pcm: hw: add a helper function to issue appl_ptr without side-effects
  pcm: hw: add a helper function to issue avail_min without side-effects
  pcm: hw: remove superfluous code to call of SNDRV_PCM_IOCTL_SYNC_PTR
    in snd_pcm_hw_forward()

 src/pcm/pcm_hw.c | 116 +++++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 86 insertions(+), 30 deletions(-)

-- 
2.11.0

             reply	other threads:[~2017-06-30 11:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-30 11:37 Takashi Sakamoto [this message]
2017-06-30 11:37 ` [PATCH alsa-lib v2 1/6] pcm: hw: add a helper function to query status/control data Takashi Sakamoto
2017-06-30 11:37 ` [PATCH alsa-lib v2 2/6] pcm: hw: add a helper function just to query status data Takashi Sakamoto
2017-06-30 11:37 ` [PATCH alsa-lib v2 3/6] pcm: hw: add a helper function to request hwsync without side-effects Takashi Sakamoto
2017-06-30 11:37 ` [PATCH alsa-lib v2 4/6] pcm: hw: add a helper function to issue appl_ptr " Takashi Sakamoto
2017-06-30 11:37 ` [PATCH alsa-lib v2 5/6] pcm: hw: add a helper function to issue avail_min " Takashi Sakamoto
2017-06-30 11:37 ` [PATCH alsa-lib v2 6/6] pcm: hw: remove superfluous code to call of SNDRV_PCM_IOCTL_SYNC_PTR in snd_pcm_hw_forward() Takashi Sakamoto
2017-06-30 14:43 ` [PATCH alsa-lib v2 0/6] pcm: hw: optimization for v2.0.14 of PCM protocol/interface Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170630113729.13656-1-o-takashi@sakamocchi.jp \
    --to=o-takashi@sakamocchi.jp \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.