Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp2782836imw; Wed, 6 Jul 2022 11:39:34 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s8qAB7l7/bNTsPUG9+jVM92fFO+nZf4VltZ5RTkFKGjmNzIK4BqGg7raAJhkVYHfgpIZ0y X-Received: by 2002:a17:906:8301:b0:6e4:896d:59b1 with SMTP id j1-20020a170906830100b006e4896d59b1mr40778836ejx.396.1657132774701; Wed, 06 Jul 2022 11:39:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657132774; cv=none; d=google.com; s=arc-20160816; b=1Dvkejyiaia8qLkurbJQhcQ9lAQPifGCHhHYtHZy4YyUZe0O3X7WeZ6Zys1PTBTOA1 hFf7oH1c/bXOLRbIQKBSR9Pu1ZtrjDGXEQGFZBnMwuvXwqfYrjYe5RvmZvddv8MPAF3j U0AbUmd/+S3BRwzME06noRZDc8Yfo9ixn7JeWJxNjr+unKNOXW7vg/mlff30YulhvAsi VUdGy/Opp0IcF2wIYo3SA9Kd4hA/M5/wxB4ZpL6aX4tih4k/ZwALrN7hYh3aTS9Aodqe hfCWlStasnvrOqKRJvHcm3FIUSw+nze6NVUHa9y7wH4ZgasUaOjs2HkWRRoIpzOrj9Mt 2qVw== 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=gwI3B/pNe57ukV/bZE0Q4gbpZ46EhYOPKwpHR+DMozk=; b=x0q4B/usSWsYnmYl3IQF0bum3mfbrMOLp60Hm7IpxHrqp2f7IJG3g1dTetTg3PSeZe hERjMlFIXYhrJRius9mv7YU0fXEUCDyxssubI8VA5UhOtHqNH1KsdGBIWpXTpqlEY9+9 IF5NqG5dOI1VtqlpSCeB+TzuH+imhLuUIjiuBMjjZ6+hu7lzmQZyGqkztMKED1OZST1C gHBuoRNQ0hhweaioy8XqfE3ybjn6HAzNaS6nip5Snw33yDTHiGeDxCEw3gLPHmNpT8rl FOUmtOuuAVAFH+2c1OSaIQTzhnUCvdJQE6cWXw8tEpAqUgdlBvPjy2PFmA3NLem3FGht nMQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@vanguardiasur-com-ar.20210112.gappssmtp.com header.s=20210112 header.b=3rvLnDYj; 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 p7-20020a170906498700b0072677faec75si5567464eju.872.2022.07.06.11.39.02; Wed, 06 Jul 2022 11:39:34 -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=3rvLnDYj; 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 S234286AbiGFS1j (ORCPT + 99 others); Wed, 6 Jul 2022 14:27:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234185AbiGFS1g (ORCPT ); Wed, 6 Jul 2022 14:27:36 -0400 Received: from mail-vk1-xa2b.google.com (mail-vk1-xa2b.google.com [IPv6:2607:f8b0:4864:20::a2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC3F217ABB for ; Wed, 6 Jul 2022 11:27:34 -0700 (PDT) Received: by mail-vk1-xa2b.google.com with SMTP id 15so7780658vko.13 for ; Wed, 06 Jul 2022 11:27:34 -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=gwI3B/pNe57ukV/bZE0Q4gbpZ46EhYOPKwpHR+DMozk=; b=3rvLnDYjlDgAD6tjeHhgDfzll8/87learjvs4vwZzZikbMzP5g45wL3sG3r9IjFxQo S7RxwQzGjMBsNt9zx5YODv4VurfvXp5AbuTQiTrAf+PaAaalad6KvP1vCbhbT39bsaK4 eRid6zFuGSoCBzephrUkmOB6HPTzgz1R5XAtcc9iNIp7Sm/Jrz7Nfzq3UMZi5zIyhwrQ rM1MEq87lsdW3FrFfDQ19DkE4eoVTrZijFQOyIFNMrRlw5XedpF8dZNHIid3LVnL+e4G 7QDQ8z0rXNmRz1+CpPQ6/qagXfdMfJN4VuyfH0XtJ88JhGlacyAw3N7FIgHGrjuYYxna FJ3g== 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=gwI3B/pNe57ukV/bZE0Q4gbpZ46EhYOPKwpHR+DMozk=; b=XaKkU481wmQwfwgpgsaufWQlct1/NbNV8ENndRDdRmUFaHwRLW1xdCzVM/i7Zzz8nw 3DzlIJZsAC+hd9kWLBZJztOIobqjIT60RLamaSvOzUqFu/S5J0ukCuSklRxVxjdffgVV zVydqxJG009m4hqLRuet+CYpuwr690qlkwyovtR60sHa+/dDMeAavyVEFEZbZc+9sjXb MW0XQmxxR/MEfM5ghVS2nRZWAklwxxqK7nz6JHg9zhxep55VAKU4llxdGZkoP//YrA51 f98w4CmVfn4wQKJPOCfdCEf9yuakfE6x/T2oENtWpsU/ZMG1+k8pt7ucfClk4sf3iYw8 lHIw== X-Gm-Message-State: AJIora9yxq/4SqASH6UjipFoSgY6qPuk2bxhIV74bbv9IEvl+WYfe1+E 9i5cLKukyaxNtuoprdIGdFPSGeLfbVESAgYV X-Received: by 2002:a1f:3296:0:b0:374:19b8:1df5 with SMTP id y144-20020a1f3296000000b0037419b81df5mr5446639vky.7.1657132054008; Wed, 06 Jul 2022 11:27:34 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 11:27:33 -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 4/8] vicodec: Use vb2_find_buffer Date: Wed, 6 Jul 2022 15:26:53 -0300 Message-Id: <20220706182657.210650-5-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 Use the newly introduced vb2_find_buffer API to get a vb2_buffer given a buffer timestamp. Cc: Hans Verkuil Signed-off-by: Ezequiel Garcia --- drivers/media/test-drivers/vicodec/vicodec-core.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/media/test-drivers/vicodec/vicodec-core.c b/drivers/media/test-drivers/vicodec/vicodec-core.c index be43f7d32df9..1d1bee111732 100644 --- a/drivers/media/test-drivers/vicodec/vicodec-core.c +++ b/drivers/media/test-drivers/vicodec/vicodec-core.c @@ -280,17 +280,13 @@ static int device_process(struct vicodec_ctx *ctx, */ if (!(ntohl(ctx->state.header.flags) & V4L2_FWHT_FL_I_FRAME)) { struct vb2_buffer *ref_vb2_buf; - int ref_buf_idx; struct vb2_queue *vq_cap = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); - ref_buf_idx = vb2_find_timestamp(vq_cap, - ctx->state.ref_frame_ts, 0); - if (ref_buf_idx < 0) + ref_vb2_buf = vb2_find_buffer(vq_cap, ctx->state.ref_frame_ts); + if (!ref_vb2_buf) return -EINVAL; - - ref_vb2_buf = vq_cap->bufs[ref_buf_idx]; if (ref_vb2_buf->state == VB2_BUF_STATE_ERROR) ret = -EINVAL; ctx->state.ref_frame.buf = -- 2.34.3