Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp539406imm; Mon, 21 May 2018 10:01:59 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqhSWiQkSs+E9v2Ahwu68KLQlb32/3YocSBdXhuSfE51x8AVdGA/eOoFGdrdoLMB7cU2sEy X-Received: by 2002:a65:60d1:: with SMTP id r17-v6mr16672277pgv.410.1526922119195; Mon, 21 May 2018 10:01:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526922119; cv=none; d=google.com; s=arc-20160816; b=OwmQ1SAUvJ5lwv/WwDtpSeHPoigCgFAfaGYYq4tqiB453YedyWkkqjuKK0U0+o5J0H oPavIbBp7xDUiCZJf9klS8D3RPcYos8lkpdBq+q6XKlAjCwsSupGipZIUV9uHdowJ04/ vIw9xqCZMuQOx5e+O6qsuAgNOiCFO0K7FFNydQab7nql9YDyrDionzi89dyh1qnauPbC eZVPulAvKnybqZxunegrAu7s4GRYe0LxgS4973JZBVoYb2s6lSukNjXDi3v/pmt3CI0B V3MOM27exLxryNRfj6p0sXwCSVVfjyrEhn0I+zoaUIVy4fR9Ybgkkd0SgTCumoRvtZn4 yIhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=rSZ1Dbdz+Xt3Ctxx+/XNonCzV4fGza4oM+Hz2kyKs0k=; b=ckle4zl9mNycpmHI/W+c8V0XWoIQ2wQli0xHsBeZUCo/mr5Gm6wqUSOD04grwwh0Lr YX17wEDXcMz24QaZC5EVZ4tbbLq8voy3f3uy83NkoB/ajdw2dA+fW2oVmfL0jqxEp2RW yKGyVUOIKxQHR6Pw9iRkbzCzv01XdJQh6WRFvsCzV6n6aXOx8kfxwVVG9MX5yu1ZoCUG Lb/UndWc5T0EWAxpLRMvhZ+pOiJnU6vy+0ldI9+MNV8MlF4WkrUC7JYFK0wqbTKFXAUE IOQTYw5A7isQaLbLn/NjdWrCtiCBUUKVNraR2DqI/HL5lifM7kRr7RdO3T9mqn43vQ13 uLcw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f184-v6si11383873pgc.309.2018.05.21.10.01.44; Mon, 21 May 2018 10:01:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753261AbeEURBd (ORCPT + 99 others); Mon, 21 May 2018 13:01:33 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:44268 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753065AbeEURBa (ORCPT ); Mon, 21 May 2018 13:01:30 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: ezequiel) with ESMTPSA id 55E972730E1 From: Ezequiel Garcia To: linux-media@vger.kernel.org Cc: kernel@collabora.com, Hans Verkuil , Mauro Carvalho Chehab , Shuah Khan , Pawel Osciak , Alexandre Courbot , Sakari Ailus , Brian Starkey , linux-kernel@vger.kernel.org, Gustavo Padovan , Ezequiel Garcia Subject: [PATCH v10 00/16] V4L2 Explicit Synchronization Date: Mon, 21 May 2018 13:59:30 -0300 Message-Id: <20180521165946.11778-1-ezequiel@collabora.com> X-Mailer: git-send-email 2.16.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, The most relevant change for this round is that all the work done in the fence callback is now moved to a workqueue, that runs with the queue lock held. Although this introduces some latency, it is however needed to take the vb2_queue mutex and safely call vb2 ops. Given the fence callback can be called fully asynchronously, and given it needs to be associated with a vb2_buffer, we now need to refcount vb2_buffer. This allows to safely "attach" the vb2_buffer to the fence callback. To prevent annoying deadlocks, and because the fence callback is called with the fence spinlock, it's best to avoid calling dma_fence_put in the fence callback itself. So the fence is now put in the DQBUF operation (or in cancel paths). Hopefully, I took care of all the feedback provided by Hans and Brian on v9. Please let me know if you guys catch anything else. Thanks! Changes from v9: * Move fence callback to workqueue, and call vb2_start_streaming if needed. * Refcount vb2_buffer. * Check return of get_unused_fd. * Increase seqno for out-fences that reuse the context. * Go back to is_unordered callback. * Mark unordered formats in cobalt driver. * Improve CAP_FENCES check. * Minor documentation changes. Ezequiel Garcia (1): videobuf2: Make struct vb2_buffer refcounted Gustavo Padovan (15): xilinx: regroup caps on querycap hackrf: group device capabilities omap3isp: group device capabilities vb2: move vb2_ops functions to videobuf2-core.[ch] vb2: add is_unordered callback for drivers v4l: add unordered flag to format description ioctl v4l: mark unordered formats cobalt: add .is_unordered() for cobalt vb2: mark codec drivers as unordered vb2: add explicit fence user API vb2: add in-fence support to QBUF vb2: add out-fence support to QBUF v4l: introduce the fences capability v4l: Add V4L2_CAP_FENCES to drivers v4l: Document explicit synchronization behavior Documentation/media/uapi/v4l/buffer.rst | 48 ++- Documentation/media/uapi/v4l/vidioc-enum-fmt.rst | 7 + Documentation/media/uapi/v4l/vidioc-qbuf.rst | 53 ++- Documentation/media/uapi/v4l/vidioc-querybuf.rst | 12 +- Documentation/media/uapi/v4l/vidioc-querycap.rst | 3 + drivers/media/common/videobuf2/Kconfig | 1 + drivers/media/common/videobuf2/videobuf2-core.c | 376 ++++++++++++++++++--- drivers/media/common/videobuf2/videobuf2-v4l2.c | 65 +++- drivers/media/dvb-core/dvb_vb2.c | 2 +- drivers/media/pci/cobalt/cobalt-v4l2.c | 4 + drivers/media/platform/coda/coda-common.c | 1 + drivers/media/platform/exynos-gsc/gsc-m2m.c | 3 +- drivers/media/platform/m2m-deinterlace.c | 3 +- drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c | 3 +- drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c | 1 + .../media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c | 2 +- drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 1 + .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 3 +- drivers/media/platform/mx2_emmaprp.c | 3 +- drivers/media/platform/omap3isp/ispvideo.c | 10 +- drivers/media/platform/qcom/venus/vdec.c | 4 +- drivers/media/platform/qcom/venus/venc.c | 4 +- drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 1 + drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 1 + drivers/media/platform/sh_veu.c | 3 +- drivers/media/platform/xilinx/xilinx-dma.c | 10 +- drivers/media/usb/hackrf/hackrf.c | 11 +- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 4 +- drivers/media/v4l2-core/v4l2-ioctl.c | 98 +++++- include/media/videobuf2-core.h | 76 ++++- include/media/videobuf2-v4l2.h | 18 - include/uapi/linux/videodev2.h | 10 +- 32 files changed, 708 insertions(+), 133 deletions(-) -- 2.16.3