From owner-freebsd-bugs@freebsd.org Tue May 5 01:42:48 2020 Return-Path: Delivered-To: freebsd-bugs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E58D32CA23E for ; Tue, 5 May 2020 01:42:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 49GMtJ5qYQz4606 for ; Tue, 5 May 2020 01:42:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.nyi.freebsd.org (Postfix) id C7F8B2CA23D; Tue, 5 May 2020 01:42:48 +0000 (UTC) Delivered-To: bugs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C7BE02CA23C for ; Tue, 5 May 2020 01:42:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49GMtJ4y9Dz4605 for ; Tue, 5 May 2020 01:42:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A59DC5F1F for ; Tue, 5 May 2020 01:42:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 0451gmDR079139 for ; Tue, 5 May 2020 01:42:48 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 0451gmtw079136 for bugs@FreeBSD.org; Tue, 5 May 2020 01:42:48 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 246206] dev/sound: SNDCTL_SYSINFO does not report PCM_CAP_VIRTUAL Date: Tue, 05 May 2020 01:42:48 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 12.1-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: kevinz5000@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.mimetype attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 May 2020 01:42:49 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D246206 Bug ID: 246206 Summary: dev/sound: SNDCTL_SYSINFO does not report PCM_CAP_VIRTUAL Product: Base System Version: 12.1-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: kevinz5000@gmail.com Attachment #214136 text/plain mime type: Created attachment 214136 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D214136&action= =3Dedit Demonstration of issue In sys/soundcard.h, PCM_CAP_VIRTUAL is documented as "Virtual device": # define PCM_CAP_VIRTUAL 0x00040000 /* Virtual device */ When SNDCTL_AUDIOINFO is called on /dev/mixer, no virtual devices have have PCM_CAP_VIRTUAL set. This means, apart from being smart, consumers of the O= SS4 API can't tell virtual devices from real devices. This leads to a confusing choice in, say, audio programs that allow selection of vchans. A short example program that demonstrates the issue is attached. Example ou= tput on my computer is: $ clang vpctest.c -o vpctest $ ./vpctest dev /dev/dsp0.p0 virtual 0 dev /dev/dsp0.vp0 virtual 0 dev /dev/dsp0.vp1 virtual 0 dev /dev/dsp0.r0 virtual 0 dev /dev/dsp0.vr0 virtual 0 dev /dev/dsp0.vr1 virtual 0 The vp* and vr* devices are virtual, but PCM_CAP_VIRTUAL is not set. The root cause of this issue appears to be in dev/sound/pcm/dsp.c: ai->caps =3D PCM_CAP_REALTIME | PCM_CAP_MMAP | PCM_CAP_TRIGGER | CHANNEL_GETCAPS(ch) ((ch->direction =3D=3D PCMDIR_PLAY) ? PCM_CAP_OUTPUT : PCM_CAP_INPUT); Most notably, PCM_CAP_VIRTUAL is never set. Further, the channel capabiliti= es queried earlier: caps =3D chn_getcaps(ch); Do not appear to be used, either. I suggest that virtual channels return PCM_CAP_VIRTUAL in vchan_getcaps() (dev/sound/pcm/vchan.c), and then channel capabilities get OR'ed into ai->c= aps. --=20 You are receiving this mail because: You are the assignee for the bug.=