From patchwork Wed Nov 15 17:10:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 10059895 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 68C0660231 for ; Wed, 15 Nov 2017 17:11:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5765429FDD for ; Wed, 15 Nov 2017 17:11:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4BE2A29FE1; Wed, 15 Nov 2017 17:11:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14C3429FDD for ; Wed, 15 Nov 2017 17:11:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933308AbdKORLh (ORCPT ); Wed, 15 Nov 2017 12:11:37 -0500 Received: from mail-qt0-f194.google.com ([209.85.216.194]:45845 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933277AbdKORLT (ORCPT ); Wed, 15 Nov 2017 12:11:19 -0500 Received: by mail-qt0-f194.google.com with SMTP id n32so19829274qtb.2; Wed, 15 Nov 2017 09:11:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PBN4ZokPmMOV0MGqZ6LAu1ll6C0oLRHnFLFPX+ntdSY=; b=M9kpP8LcWMD6dcwlicOqhX8nr2tRr5rkGXOEqRO3lUDUyVJ6qWeCOcQyZJq/5lUNkP e1NN/LCFyS1b9l31P8ebMkxpWrgtP8wGuP0r5X7BPJpss7j1Xa1+bNT5nf0SzT/dEvTC a+WHIP0DgJ3pp0j1KNWYbkXouxbd800YqE3r+uaXGs5Ag/Z/rIpvYVx+K/98dxplYEHT SvPahBMNu7LbGrFuFsngpJl2o1Kg35SV3jodF+hLHbB3lL3m3IYFEGYoEr33ao0g3j8P EgxaUE94CGQuQUh8Iu6eOmTNBSxwJSCVmI0VH1lgHdbYwOgBmukv/QJ0nuuQqO+PJJc6 /uAg== X-Gm-Message-State: AJaThX4LGN40e5z68gtcYq3ggsFVFpWvV3V7U1YlieI7eQVTyX56ULHj H3mrGX72aGRICJZKM6plC/nyRuY/ X-Google-Smtp-Source: AGs4zMa8w/u4jXny9gFOOHM+fX5arnJXJF0qBHyL7HCup9Ohu0ymUlqQJ1MoZrlxIhHmgXn4wr650w== X-Received: by 10.55.51.73 with SMTP id z70mr24441728qkz.338.1510765877740; Wed, 15 Nov 2017 09:11:17 -0800 (PST) Received: from localhost.localdomain ([179.110.36.75]) by smtp.gmail.com with ESMTPSA id p85sm15211633qkp.94.2017.11.15.09.11.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Nov 2017 09:11:17 -0800 (PST) From: Gustavo Padovan To: linux-media@vger.kernel.org Cc: Hans Verkuil , Mauro Carvalho Chehab , Shuah Khan , Pawel Osciak , Alexandre Courbot , Sakari Ailus , Brian Starkey , Thierry Escande , linux-kernel@vger.kernel.org, Gustavo Padovan Subject: [RFC v5 03/11] [media] vb2: add 'ordered_in_driver' property to queues Date: Wed, 15 Nov 2017 15:10:49 -0200 Message-Id: <20171115171057.17340-4-gustavo@padovan.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171115171057.17340-1-gustavo@padovan.org> References: <20171115171057.17340-1-gustavo@padovan.org> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Gustavo Padovan We use ordered_in_driver property to optimize for the case where the driver can deliver the buffers in an ordered fashion. When it is ordered we can use the same fence context for all fences, but when it is not we need to a new context for each out-fence. So the ordered_in_driver flag will help us with identifying the queues that can be optimized and use the same fence context. v4: make the property a vector for optimization and not a mandatory thing that drivers need to set if they want to use explicit synchronization. v3: improve doc (Hans Verkuil) v2: rename property to 'ordered_in_driver' to avoid confusion Signed-off-by: Gustavo Padovan --- include/media/videobuf2-core.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index ef9b64398c8c..38b9c8dd42c6 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h @@ -440,6 +440,12 @@ struct vb2_buf_ops { * @fileio_read_once: report EOF after reading the first buffer * @fileio_write_immediately: queue buffer after each write() call * @allow_zero_bytesused: allow bytesused == 0 to be passed to the driver + * @ordered_in_driver: if the driver can guarantee that the queue will be + * ordered or not, i.e., the buffers are dequeued from the driver + * in the same order they are queued to the driver. The default + * is not ordered unless the driver sets this flag. Setting it + * when ordering can be guaranted helps to optimize explicit + * fences. * @quirk_poll_must_check_waiting_for_buffers: Return POLLERR at poll when QBUF * has not been called. This is a vb1 idiom that has been adopted * also by vb2. @@ -510,6 +516,7 @@ struct vb2_queue { unsigned fileio_read_once:1; unsigned fileio_write_immediately:1; unsigned allow_zero_bytesused:1; + unsigned ordered_in_driver:1; unsigned quirk_poll_must_check_waiting_for_buffers:1; struct mutex *lock;