Received: by 10.213.65.68 with SMTP id h4csp256596imn; Tue, 13 Mar 2018 03:25:55 -0700 (PDT) X-Google-Smtp-Source: AG47ELvsGO1LeYJMzS8HQdfBGQmEh3WPPVvSMt8yWeURlDW4Xj2I9ZuOT5Fh9w6UGFUKFQSBRfy5 X-Received: by 10.98.165.4 with SMTP id v4mr70395pfm.51.1520936755789; Tue, 13 Mar 2018 03:25:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520936755; cv=none; d=google.com; s=arc-20160816; b=KXyR/gj/5mKsjKYPYqFrOWqmCmVyvgpPRaWNx0Qt50aPoPoD5rQ3NlU+Mp8xa0fnet gKeAvDqYndj/i3jLsrSTCYgXAtoWpbOJWU2Ya6dSGK+Mu+r6hxQX3fL1XcwXeXtF90kL a1pBfmjpUlvFMZfoC6oYZ4FBeSk5vQxFgURkHBjqKDdHknlC1XWXFs7N5MPEkL1ikLA0 u7rdvuPcZO11yXrx+yMUNGej3jinO3Qq92vpTQ7my3wPzC94pxk8hGS8sRO0Eoqsm2RQ iBNWalP3CSoyZHIIlgvS9A5C02NreL3UV46JYMACmSUbk8lvlb4Vu8V+T6W9lLvJ+Kq8 AWcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=SZ7/DsfX5vowJ0V/+qnByR3e2fDuEuADcL03LCEiNug=; b=mvUWIx6oieerR/bAo8wcY/c+oQ7B1yhjFbKEY0xiq9my5qL6PJxUcTI8+uN061Wr6R itfs4gZU/JpZd38FRRl+58Uv0vEz6a2VJyZdQ9MqOp6bNcuPUmae68tjGj6UOLnZZ//5 PnWQPE/HsI/411B7QQgmHCC7igD+mxs0LLuouvtc+EQ+vQsPvxrn9x7jw4xRNGE5JQZV RG8ce+kpec6xhSSJ6fbwQas7Vd2bMLEpLNEVkz9gcwXfVSTSGI1q1J3KWzXaQjSUIpY6 BEe2pHeq/ohip2W3Emo4y9jb5/0XVXyzi6mpCLsWiNTSeTRWlALfMMl1uZr7cTLQaPTd bgDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=nfQYFLDX; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t66si18495pgc.606.2018.03.13.03.25.41; Tue, 13 Mar 2018 03:25:55 -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; dkim=pass header.i=@chromium.org header.s=google header.b=nfQYFLDX; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932715AbeCMKYd (ORCPT + 99 others); Tue, 13 Mar 2018 06:24:33 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:45775 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932704AbeCMKY3 (ORCPT ); Tue, 13 Mar 2018 06:24:29 -0400 Received: by mail-io0-f193.google.com with SMTP id m22so15077581iob.12 for ; Tue, 13 Mar 2018 03:24:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=SZ7/DsfX5vowJ0V/+qnByR3e2fDuEuADcL03LCEiNug=; b=nfQYFLDXZnpqBJoAeyof7MOL4fnodXJy0Jaa7osJjdH/e6gwrM1VlsmlI5rPEoNayj Q/6O6bbe6wQYd5xHRgwPXk3VUEA3rB3+wrUJ8d7CpU/kQWIKzrCf/M6ojJnBns0yiR9F ymGzAYnBdag70tevMjpHck62wzsXItm/D+VuM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=SZ7/DsfX5vowJ0V/+qnByR3e2fDuEuADcL03LCEiNug=; b=OgOgIPLOrDTIow4aiKKFvb2KkQ51+GVN4ZVHxaEqo6ygYeAowrH4HDZcBkPd77Y/mO vqwxFz7cEZBf/gCPCQkPZR70suXsGRb1B4bP41Y5PFdo14yRiU/58U76wdFo1gl1VwZY vGk8Kd7ncw3xoViqodwtWwEJpo27EJfMxG0rhV7d1asFe+ryZVZVK0f9D3dLfJRRWxhh 8utX57IpTiaaUsvCu8Bf7Du8rUTNm1Y48eDWRNiSJDFvZ96lwhsqa3pWeXsKBSiJ+8Ev aTH2AoVpvQfZpvhL5x7X0RwfnGhfnyx7MGuXAeYnYRbdIqyMRTzCMbSW7HXt+4dZ4rqO ZUoQ== X-Gm-Message-State: AElRT7GnZ7qMn2dfLl34X93TGNKN4tc08eLRw+iXap14BG08qLBwEGZ+ U0y4cjZsCjxtHdYRRPz7NU68KsTibVY= X-Received: by 10.107.27.147 with SMTP id b141mr40768iob.205.1520936668217; Tue, 13 Mar 2018 03:24:28 -0700 (PDT) Received: from mail-io0-f179.google.com (mail-io0-f179.google.com. [209.85.223.179]) by smtp.gmail.com with ESMTPSA id u129sm291467itb.5.2018.03.13.03.24.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Mar 2018 03:24:26 -0700 (PDT) Received: by mail-io0-f179.google.com with SMTP id k21so11163838ioc.2 for ; Tue, 13 Mar 2018 03:24:26 -0700 (PDT) X-Received: by 10.107.141.194 with SMTP id p185mr74562iod.204.1520936665690; Tue, 13 Mar 2018 03:24:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.26.65 with HTTP; Tue, 13 Mar 2018 03:24:05 -0700 (PDT) In-Reply-To: <1520606128.15946.22.camel@bootlin.com> References: <20180220044425.169493-20-acourbot@chromium.org> <1520440654.1092.15.camel@bootlin.com> <1520606128.15946.22.camel@bootlin.com> From: Alexandre Courbot Date: Tue, 13 Mar 2018 19:24:05 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFCv4,19/21] media: vim2m: add request support To: Paul Kocialkowski Cc: Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Pawel Osciak , Marek Szyprowski , Tomasz Figa , Sakari Ailus , Gustavo Padovan , Linux Media Mailing List , LKML , Maxime Ripard Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 9, 2018 at 11:35 PM, Paul Kocialkowski wrote: > Hi, > > On Thu, 2018-03-08 at 22:48 +0900, Alexandre Courbot wrote: >> Hi Paul! >> >> Thanks a lot for taking the time to try this! I am also working on >> getting it to work with an actual driver, but you apparently found >> rough edges that I missed. >> >> On Thu, Mar 8, 2018 at 1:37 AM, Paul Kocialkowski >> wrote: >> > Hi, >> > >> > First off, I'd like to take the occasion to say thank-you for your >> > work. >> > This is a major piece of plumbing that is required for me to add >> > support >> > for the Allwinner CedarX VPU hardware in upstream Linux. Other >> > drivers, >> > such as tegra-vde (that was recently merged in staging) are also >> > badly >> > in need of this API. >> > >> > I have a few comments based on my experience integrating this >> > request >> > API with the Cedrus VPU driver (and the associated libva backend), >> > that >> > also concern the vim2m driver. >> > >> > On Tue, 2018-02-20 at 13:44 +0900, Alexandre Courbot wrote: >> > > Set the necessary ops for supporting requests in vim2m. >> > > >> > > Signed-off-by: Alexandre Courbot >> > > --- >> > > drivers/media/platform/Kconfig | 1 + >> > > drivers/media/platform/vim2m.c | 75 >> > > ++++++++++++++++++++++++++++++++++ >> > > 2 files changed, 76 insertions(+) >> > > >> > > diff --git a/drivers/media/platform/Kconfig >> > > b/drivers/media/platform/Kconfig >> > > index 614fbef08ddc..09be0b5f9afe 100644 >> > > --- a/drivers/media/platform/Kconfig >> > > +++ b/drivers/media/platform/Kconfig >> > >> > [...] >> > >> > > +static int vim2m_request_submit(struct media_request *req, >> > > + struct media_request_entity_data >> > > *_data) >> > > +{ >> > > + struct v4l2_request_entity_data *data; >> > > + >> > > + data = to_v4l2_entity_data(_data); >> > >> > We need to call v4l2_m2m_try_schedule here so that m2m scheduling >> > can >> > happen when only 2 buffers were queued and no other action was taken >> > from usespace. In that scenario, m2m scheduling currently doesn't >> > happen. >> >> I don't think I understand the sequence of events that results in >> v4l2_m2m_try_schedule() not being called. Do you mean something like: >> >> * >> * QBUF on output queue with request set >> * QBUF on capture queue >> * SUBMIT_REQUEST >> >> ? >> >> The call to vb2_request_submit() right after should trigger >> v4l2_m2m_try_schedule(), since the buffers associated to the request >> will enter the vb2 queue and be passed to the m2m framework, which >> will then call v4l2_m2m_try_schedule(). Or maybe you are thinking >> about a different sequence of events? > > This is indeed the sequence of events that I'm seeing, but the > scheduling call simply did not happen on vb2_request_submit. I suppose I will need to investigate some more to find out exactly why. > > IIRC, the m2m qbuf function is called (and fails to schedule) when the > ioctl happens, not when the task is submitted. > > This issue is seen with vim2m as well as the rencently-submitted sunxi- > cedrus driver (with the in-driver calls to v4l2_m2m_try_schedule > removed, obviously). If needs be, I could provide a standalone test > program to reproduce it. If you have a standalone program that can reproduce this on vim2m, then I would like to see it indeed, if only to understand what I have missed. Thanks, Alex.