Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp2783027imw; Wed, 6 Jul 2022 11:39:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sWdMQhimuctxb74nK7z30t/iw8jeQFjmPuLRc+ftQEV9AIM8UMVTdnnB7MTYwsM00cE+0q X-Received: by 2002:a17:907:869e:b0:72a:a008:82fc with SMTP id qa30-20020a170907869e00b0072aa00882fcmr26061131ejc.549.1657132792496; Wed, 06 Jul 2022 11:39:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657132792; cv=none; d=google.com; s=arc-20160816; b=DYBp+Itbkox/Ubyxq1BpEAnecsKJ73S7SGwnajVZbf33ofuqXHwUn+jJxbtRjQN4tb OhPBXSRQrfOxPwqYgUADVnhnWgyQCd4YP1RcKXbqUQ/tV38y8cgtZcS3GjstU/4TMASX sI0RQJWRzb1txV2adONbpVzH8qSw6MsvnRFY02Mha8T3JT8VeEew+9O1tlzDHEYW49cY 1ny7aXgvXDYuMqKTP3pVR2jgO6MnRg2kDrwsDpHFQTo/E8RTeDZ+H4EK5mF0mAdV3xyD eQKf4XjS1PTVbdeB+/w13AYUa5EbrhRQ0s9JlYkn2g67OGfL6OEO/QUGwKfu4sGKWD77 MbdQ== 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; bh=5IdTe03T4AbQW3cQ+frSJyoDxiG9eWKIQ4uCqO8KXZ4=; b=sGRVWCr+Pi42Lew0IM+t+WoZyjTbaxFvt2CRvqi4aoOTLOd6LJHz5Kaj7Nezld1juL uA3ZrPMcjfSF0vM2uEFhu9djM6698aXb85QkSSAlW+Mk4+Rmbej1BmTNyLSczKjJ5M7g xp09nqWzPLfzootBv4A8u22A5n3AlIpxMkXOPwWAIhQCmj6jzIVGv+333Vd8tKKXE5+1 xBpbiO92AhKIaSVIFOGELvR6+nXoRHVwvWz8Nvq9deMMjv15G4/gMlCJSZI3iOgqHrEy QTiCzqT3gdlC5YaMJL3xXS3kgT0JAI5C2B05aASNOY+RsDqg3QhpvBcTgxS/oHGgLZpK 1BuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@vanguardiasur-com-ar.20210112.gappssmtp.com header.s=20210112 header.b=a44ubRV5; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb6-20020a170907960600b0072ab4036c21si18637631ejc.664.2022.07.06.11.39.26; Wed, 06 Jul 2022 11:39:52 -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=@vanguardiasur-com-ar.20210112.gappssmtp.com header.s=20210112 header.b=a44ubRV5; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233644AbiGFS1T (ORCPT + 99 others); Wed, 6 Jul 2022 14:27:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234022AbiGFS1S (ORCPT ); Wed, 6 Jul 2022 14:27:18 -0400 Received: from mail-ua1-x936.google.com (mail-ua1-x936.google.com [IPv6:2607:f8b0:4864:20::936]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70B641155 for ; Wed, 6 Jul 2022 11:27:16 -0700 (PDT) Received: by mail-ua1-x936.google.com with SMTP id l7so6154374ual.9 for ; Wed, 06 Jul 2022 11:27:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vanguardiasur-com-ar.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5IdTe03T4AbQW3cQ+frSJyoDxiG9eWKIQ4uCqO8KXZ4=; b=a44ubRV55zQ1AZtYKCbVMinunDOe4rwc2pZvSauSYy5diqTxZLw4LVdSpi/sCWmxt1 QFkHr6JdsWo+xDl7rtVC5oEBYvpgvQFSp9padrA/TJLthCjvZ2QmRM4+jCrssNtDReNn sCKs9n0NEKjtPrEdrlpBT4AazVTbw4+e3URQc7B0YRVrL71UkORan40s5NR4ykw8mrz7 WaTse9b6Kt2wg/EP+ApZ6kt8zi2WKtzcnzxxxAt1ZMWpu82NyCdwSFOPpS00gI14vlb9 ut4neTFBBpdMKuG9VlA6OrFWLdf2t5iiZ3Q7KQd29FTta2nuF4ADtcVjmwLKpvPeRUvs 957w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5IdTe03T4AbQW3cQ+frSJyoDxiG9eWKIQ4uCqO8KXZ4=; b=eN4j8YuJUereH8NyMLHKhEX5ZsPOWm+iOI4N7Ng/pOebENP6yr/bv96wEZwCGGzPFH szaa9JhGh6Xn0751CRZ+oj5P2V5FMmDK4aCNP0mPctLRJ1nZsVH+rilfjJVWsSHUKJsP v4E0UTloskrhj+hzz10XwAh+RiWsU0dAVOtBktLT6eV5Lip79XtrRgDS4SiwembVTwPD 91MmlhWdTVQCVrO2wpli9VaOgWgRW3Pom/+0qvUpHuPsVXUaXFae4uyr2m/WxBWSPwoa Y1+l+DknZvn6L9i1r6XOKuYmbhnmcoRYUh7KtWniC6MIKQTDkH+NqlpBeSxP+51HicKO Pl8A== X-Gm-Message-State: AJIora+AkiReJuhcEzJCJtL1VDRn7dfy5rcsWlwJr+n0NrlxxWEyGSky 4kZyS16xXt086Lh4Tda6Sc/vJA== X-Received: by 2002:a9f:35ef:0:b0:37f:18d2:4578 with SMTP id u44-20020a9f35ef000000b0037f18d24578mr20821637uad.65.1657132035461; Wed, 06 Jul 2022 11:27:15 -0700 (PDT) Received: from zeta-build.. ([190.190.187.68]) by smtp.gmail.com with ESMTPSA id bl9-20020a056102508900b003563680212asm7445539vsb.27.2022.07.06.11.27.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 11:27:15 -0700 (PDT) From: Ezequiel Garcia To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Hans Verkuil , Tomasz Figa , Marek Szyprowski , Ezequiel Garcia Subject: [PATCH 1/8] videobuf2: Introduce vb2_find_buffer() Date: Wed, 6 Jul 2022 15:26:50 -0300 Message-Id: <20220706182657.210650-2-ezequiel@vanguardiasur.com.ar> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20220706182657.210650-1-ezequiel@vanguardiasur.com.ar> References: <20220706182657.210650-1-ezequiel@vanguardiasur.com.ar> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 From: Ezequiel Garcia All users of vb2_find_timestamp() combine it with vb2_get_buffer() to retrieve a videobuf2 buffer, given a u64 timestamp. Introduce an API for this use-case. Users will be converted to the new API as follow-up commits. Signed-off-by: Ezequiel Garcia --- include/media/videobuf2-v4l2.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/media/videobuf2-v4l2.h b/include/media/videobuf2-v4l2.h index d818d9707695..7f9ae5b39b78 100644 --- a/include/media/videobuf2-v4l2.h +++ b/include/media/videobuf2-v4l2.h @@ -78,6 +78,24 @@ struct vb2_v4l2_buffer { int vb2_find_timestamp(const struct vb2_queue *q, u64 timestamp, unsigned int start_idx); +/** + * vb2_find_buffer() - Find a buffer with given timestamp + * + * @q: pointer to &struct vb2_queue with videobuf2 queue. + * @timestamp: the timestamp to find. + * + * Returns the buffer with the given @timestamp, or NULL if not found. + */ +static inline struct vb2_buffer *vb2_find_buffer(struct vb2_queue *q, + u64 timestamp) +{ + int index = vb2_find_timestamp(q, timestamp, 0); + + if (index < 0) + return NULL; + return vb2_get_buffer(q, index); +} + int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer *b); /** -- 2.34.3