Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4192797imm; Mon, 17 Sep 2018 09:37:17 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZNOFHz6uXlHsZodG/Pw5KRrC5ShNn8diZvE4EKHGk9hfDH9ngQYmiRMpJ0pbNy0WYsPb7x X-Received: by 2002:a63:ad07:: with SMTP id g7-v6mr24233291pgf.19.1537202237013; Mon, 17 Sep 2018 09:37:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537202236; cv=none; d=google.com; s=arc-20160816; b=gy6WF+afLS3GZ5PJz0Ndxm5y/EEPunj4cSQW/64VaVQv7pNSK9rDl9lkta9LRjXpdF uD62u7bQq+57u36yBselVaFBetIP4/odrW+UPbHf/nZVEq3x88DK8lZSYAH8ZH6Szs8S g75slClQvpepQfWeBI+YpskQujO8g0F300XW1EghD4XLZmYxDqB8nf1dN65ImEtPvLDW uJFi9EvnWg0uEOd/hzp8UTQw0ZJA9H6Rz3wyFxbw+zR5ksJZdtp1wEaIA7oWfU2EdeRi b6fWt6xbCxUuri4OCN9Gh5iaCPTBB1hl5IRjR8xnNhMW21rkfu+hzLxmP2E4HU+oDLpB ivuQ== 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; bh=AByq2AhHXWnJDosROY6yaJ3l5HETmewYU/Jp+CoJNlI=; b=aTqTklOvoMzOMpSwcqNRHq/tvlSjBsEY5F6skWGTHmt/72g2Iau3g4+8rA4oM+19ou +VeuoawaNkZTfFnJWqZYjS0eF+s+0zXgQ23CfzBWF1eTtH/9lKZdAeIv0B2Ui/TzKBz2 3rMptj/HQ2eJLZLcF6/f5u+sNmBUNFQNbmdzhdqHGPxBsfbjQwTkrQno4LpbyHiWtJZI WENXrUbC4W6yEBhrizSjSugL8M8/Ew/L7iCE41ricwtSx5a1hSNZZWhgd9FlvYKROWbO MZRydX/YqTMCZxJa/G0hhq7JYX2KLzneVKkhLzxa6hfkcKuA2IO1SdgEtD4Evx2mjuRi MadQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=iX8hUhNO; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k64-v6si14553151pge.129.2018.09.17.09.36.49; Mon, 17 Sep 2018 09:37:16 -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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=iX8hUhNO; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728829AbeIQWEo (ORCPT + 99 others); Mon, 17 Sep 2018 18:04:44 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:38782 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728808AbeIQWEn (ORCPT ); Mon, 17 Sep 2018 18:04:43 -0400 Received: by mail-wr1-f68.google.com with SMTP id w11-v6so18016623wrc.5 for ; Mon, 17 Sep 2018 09:36:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=AByq2AhHXWnJDosROY6yaJ3l5HETmewYU/Jp+CoJNlI=; b=iX8hUhNOzDgPiAHzEV4qB6SYq/1dINNyxvsLBJ9kzC0gHTAYIPaFvXcm4rU4Tt1nfU hh/yWUL+GrGaDs7RMCuxInkt3y2Q+EBGPO629gxArXfSTA2+RkA1NkyWya9CGYWRFIlk HfHQ7lMMPWGUYQsdwaoATEpX0UXgGPQVdpueLKwWN9v9SoPa6sGbdRNge1Im40496QQt vJxm0KZLzbiBULeJuY06lzQFc5T70hFsgf6MoGUVkK5M938mhbNv66UZQQDyHpbfLugv e+gUFDYmySiGgJmxOFamcaKOdnEHUMxKBrcVaLzgwokRnzmuOQWPTNVwo6Ndp4kIeAIg zC0w== 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=AByq2AhHXWnJDosROY6yaJ3l5HETmewYU/Jp+CoJNlI=; b=qwE6LVaFdMlEsGKwg0s2ICfKtudLzce50/Y9qf/lzDGLLHgaCZs53/Uu5fmlTbYVFu xMBdrkGOCv4nrvmpBIh/+yHK0j//Pjtrm2hU8EUbOFmJEg/RNjXD+VUQbm/glGDvpVSk aba/xvdsrcoXOvM75WYP2zalZHkeNA6LH9phRG1qlnMCKPNvfwEBq7rQC1/yrR4aMLrs psWrrQtToAXHuVxTqj64+1EF1kr1dADBIJ+JwZbDv9fpy3h9WbYikY5/aAVpA8D/z31A dsgUvcmiAxZ0+/R8yqFLd1Mc1Ql0N2ZGSIAxPtbLKOia+g5B8Tryd+5uK9SF1wMWZ9co cdcw== X-Gm-Message-State: APzg51B2JmmqhjHSXSTrck1p/30y2Cky1o4KpPwvrY0a6oxydwu50enb ktEOTR7hSm+4DuB7i+JUqZ8FzzwVsdiPoJoLdlhf/A== X-Received: by 2002:a5d:528f:: with SMTP id c15-v6mr20179228wrv.102.1537202194685; Mon, 17 Sep 2018 09:36:34 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a1c:686:0:0:0:0:0 with HTTP; Mon, 17 Sep 2018 09:36:33 -0700 (PDT) In-Reply-To: <9c33c57e-2ce2-8752-b851-f85c03a7d761@xs4all.nl> References: <20180911150938.3844-1-mjourdan@baylibre.com> <9c33c57e-2ce2-8752-b851-f85c03a7d761@xs4all.nl> From: Maxime Jourdan Date: Mon, 17 Sep 2018 18:36:33 +0200 Message-ID: Subject: Re: [PATCH v2 0/3] Add Amlogic video decoder driver To: Hans Verkuil Cc: Mauro Carvalho Chehab , Hans Verkuil , Kevin Hilman , Jerome Brunet , Neil Armstrong , Martin Blumenstingl , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org 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 2018-09-17 16:51 GMT+02:00 Hans Verkuil : > On 09/11/2018 05:09 PM, Maxime Jourdan wrote: >> - Moved the single instance check (returning -EBUSY) to start/stop streaming >> The check was previously in queue_setup but there was no great location to >> clear it except for .close(). > > Actually, you can clear it by called VIDIOC_REQBUFS with count set to 0. That > freed all buffers and clears this. > > Now, the difference between queue_setup and start/stop streaming is that if you > do this in queue_setup you'll know early on that the device is busy. It is > reasonable to assume that you only allocate buffers when you also want to start > streaming, so that it a good place to know this quickly. > > Whereas with start_streaming you won't know until you call STREAMON, or even later > if you start streaming with no buffers queued, since start_streaming won't > be called until you have at least 'min_buffers_needed' buffers queued (1 for this > driver). So in that case EBUSY won't be returned until the first VIDIOC_QBUF. > > My preference is to check this in queue_setup, but it is up to you to decide. > Just be aware of the difference between the two options. > > Regards, > > Hans I could for instance keep track of which queue(s) have been called with queue_setup, catch calls to VIDIOC_REQBUFS with count set to 0, and clear the current session once both queues have been reset ? You leverage another issue with min_buffers_needed. It's indeed set to 1 but this value is wrong for the CAPTURE queue. The problem is that this value changes depending on the codec and the amount of CAPTURE buffers requested by userspace. Ultimately I want it set to the total amount of CAPTURE buffers, because the hardware needs the full buffer list before starting a decode job. Am I free to change this queue parameter later, or is m2m_queue_init the only place to do it ? Thanks, Maxime