From patchwork Fri May 19 09:31:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 96306 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1103421vqo; Fri, 19 May 2023 02:37:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ47o5IxfCZ13kDBEVes/irg0AwwHuLF11mxocOc+KeEbt6kvHHH7khagTMX9TLbr8XtDhrw X-Received: by 2002:a05:6a20:12d3:b0:103:3885:3738 with SMTP id v19-20020a056a2012d300b0010338853738mr2315037pzg.19.1684489065947; Fri, 19 May 2023 02:37:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684489065; cv=none; d=google.com; s=arc-20160816; b=BT5B2q2aOugwe3n9QgtWsIJbMkxLaU51GBDnm/p/cXB18Tcd+a/keRHytMkOvlE1Ws P0mrdMTQrXKT/vjSRe9qHypIdKTv+9dr9Oqedyj7TuxeqyEl34u8KWThIv2jlwm95kLV 6nQh0snmCP5gyGhoftZJHr4lqj5nJLzYpY0ZaGLERZxeUac3+4CvOli4661vCtXSvMQb jcMG9ucyPz8/E6rJY+qOzV3AXdv7Ix2b70a2y9EJi1VIgKBap93vYm0ulPqjdxEojBXl 69rbTzfqGJv/Xr3gNoI1ltce+x/1XvxeSo6sIcJTIRx/1zu7BnmZNRS2Ir9C4SEZ6av4 IHQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=LcWrJIWY+/p8LoxWXI8z182Rbib3A1gSwftREo4N5Mk=; b=Z+1idNXU0dntWEFyftQ22I6runIFYcQwBVDZ41Db3uoE0Ok0yTlU+Lcb0edEXlOOh3 i/+c1k1g6/uFeQXz1E2rZzajNc04YCtJ2eS00mZ9jBp2Llsh3MMCrnY++OfYVdly0g63 q7J5sb+mz+WZcxemDWHsb4wnfCw8WKoRYLY7x3t0b5hudX7DTrt2D/Iv9uaWcPJ3WuK+ 9gg9RIddZ59KU+Wy00sfDoqhctuUi2/YzypgZ+HZ6geiLYiD4t9aM1BcA9fVe3osbPkx 1Spq723esAIUwP020CWFzKPb1ZjUjnqtFelUkB3jfceZfr+GRoSU3yMeBLAIR8Fpw1Xg uDuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=vebHVlZF; dkim=neutral (no key) header.i=@suse.de header.b="yYsKtuG/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j66-20020a636e45000000b0050fbc594e1asi3186288pgc.207.2023.05.19.02.37.30; Fri, 19 May 2023 02:37:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=vebHVlZF; dkim=neutral (no key) header.i=@suse.de header.b="yYsKtuG/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231773AbjESJdT (ORCPT + 99 others); Fri, 19 May 2023 05:33:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231671AbjESJco (ORCPT ); Fri, 19 May 2023 05:32:44 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9667C19AA for ; Fri, 19 May 2023 02:31:49 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id F1F901FE55; Fri, 19 May 2023 09:31:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1684488707; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LcWrJIWY+/p8LoxWXI8z182Rbib3A1gSwftREo4N5Mk=; b=vebHVlZFlC74SCyeyoy5hwzLUXIEjKjwSTN7NskAek7ww1BrHyNxePPknLZjiKqNCVXc/9 4MsOa64PLipYnCZH9xLP3dTBj5WWPIMqccI6qV9f1UDhw+n7a7hhSuq1T6NEuHzX1hvhBR jBjoMYosThgeKMdui2txo9+RfZRRhG4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1684488707; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LcWrJIWY+/p8LoxWXI8z182Rbib3A1gSwftREo4N5Mk=; b=yYsKtuG/vVdxF0SJ5y+EubC4QF+BSmaTQX68JRhIMEp8UpHnmC3lSLiFJF1ErUwuvnGCGX xmJnvGtA2T7AU/CA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C49D713A12; Fri, 19 May 2023 09:31:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id wGL0LgNCZ2RXJAAAMHmgww (envelope-from ); Fri, 19 May 2023 09:31:47 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 30/36] ALSA: seq: Allow suppressing UMP conversions Date: Fri, 19 May 2023 11:31:08 +0200 Message-Id: <20230519093114.28813-31-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230519093114.28813-1-tiwai@suse.de> References: <20230519093114.28813-1-tiwai@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766314806551999625?= X-GMAIL-MSGID: =?utf-8?q?1766314806551999625?= A sequencer client like seq_dummy rather doesn't want to convert UMP events but receives / sends as is. Add a new event filter flag to suppress the automatic UMP conversion and applies accordingly. Signed-off-by: Takashi Iwai --- include/uapi/sound/asequencer.h | 1 + sound/core/seq/seq_clientmgr.c | 18 ++++++++++-------- sound/core/seq/seq_dummy.c | 8 ++++++++ 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/include/uapi/sound/asequencer.h b/include/uapi/sound/asequencer.h index 2470eaa5edc5..c4632bd9d3a0 100644 --- a/include/uapi/sound/asequencer.h +++ b/include/uapi/sound/asequencer.h @@ -347,6 +347,7 @@ typedef int __bitwise snd_seq_client_type_t; #define SNDRV_SEQ_FILTER_BROADCAST (1U<<0) /* accept broadcast messages */ #define SNDRV_SEQ_FILTER_MULTICAST (1U<<1) /* accept multicast messages */ #define SNDRV_SEQ_FILTER_BOUNCE (1U<<2) /* accept bounce event in error */ +#define SNDRV_SEQ_FILTER_NO_CONVERT (1U<<30) /* don't convert UMP events */ #define SNDRV_SEQ_FILTER_USE_EVENT (1U<<31) /* use event filter */ struct snd_seq_client_info { diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index 07b090f76b5f..3b1adcb1ccdd 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c @@ -671,14 +671,16 @@ static int snd_seq_deliver_single_event(struct snd_seq_client *client, dest_port->time_real); #if IS_ENABLED(CONFIG_SND_SEQ_UMP) - if (snd_seq_ev_is_ump(event)) { - result = snd_seq_deliver_from_ump(client, dest, dest_port, - event, atomic, hop); - goto __skip; - } else if (snd_seq_client_is_ump(dest)) { - result = snd_seq_deliver_to_ump(client, dest, dest_port, - event, atomic, hop); - goto __skip; + if (!(dest->filter & SNDRV_SEQ_FILTER_NO_CONVERT)) { + if (snd_seq_ev_is_ump(event)) { + result = snd_seq_deliver_from_ump(client, dest, dest_port, + event, atomic, hop); + goto __skip; + } else if (snd_seq_client_is_ump(dest)) { + result = snd_seq_deliver_to_ump(client, dest, dest_port, + event, atomic, hop); + goto __skip; + } } #endif /* CONFIG_SND_SEQ_UMP */ diff --git a/sound/core/seq/seq_dummy.c b/sound/core/seq/seq_dummy.c index 2e8844ee32ed..9308194b2d9a 100644 --- a/sound/core/seq/seq_dummy.c +++ b/sound/core/seq/seq_dummy.c @@ -152,6 +152,7 @@ static int __init register_client(void) { struct snd_seq_dummy_port *rec1, *rec2; + struct snd_seq_client *client; int i; if (ports < 1) { @@ -165,6 +166,13 @@ register_client(void) if (my_client < 0) return my_client; + /* don't convert events but just pass-through */ + client = snd_seq_kernel_client_get(my_client); + if (!client) + return -EINVAL; + client->filter = SNDRV_SEQ_FILTER_NO_CONVERT; + snd_seq_kernel_client_put(client); + /* create ports */ for (i = 0; i < ports; i++) { rec1 = create_port(i, 0);