Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2906714rdb; Tue, 6 Feb 2024 01:00:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IELnS81mvRghxTUBgN5KsUL6/e1kJ/gT/SFWxReX0q6lo5fvfkKzeuu1cYCO/BdWFTNKCFC X-Received: by 2002:a17:90a:55c8:b0:295:aaaa:74fe with SMTP id o8-20020a17090a55c800b00295aaaa74femr3117040pjm.14.1707210028459; Tue, 06 Feb 2024 01:00:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707210028; cv=pass; d=google.com; s=arc-20160816; b=Y6UsawxBEM1fqrnueQQD6psJlQnsU42yTR0xJdzlqS5DRJAeUYpPLJ/fm/xBQ5Ehmg qF9RXeaDNZUG3AQyhtIQ/qcgJkra9Xfnx0TThq+HhtsadVwzP12gapH9jhXk/OOiYm+c t0N8rZMXbbsD3XeDsDsavxXI+IyKgPRBtCpztqY5H8MNVI2EnIC7yCHQxVt53G+nzlZl PLFccfpjOqZZKSaXAIp6gqH9GT5fSUCCsxgp5rzU2xmJcyxgICvgXg2ZKhCZR2z7hceh FzDqqnfV3RrEQQxOLnVUsc9gruYWRC9MgGSCGSo8k83zgk5MKXqutYZJ5ODc6aQTO+X8 2cRQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id; bh=ufT2BGfjkExbRzg8S7Omvad8MFZd2RXiGq+R06aHdPw=; fh=7tgagxvPT2UzSmvWRAU9/ulXnTQqLRA0IoDdqHonM5A=; b=o7Wxg3Iyx5+QVKhOR399vqAaiZsqITgIH6DsGbJBGPICCrEb3jk7iqck98I2Bql6EP SBd2kc/ulRCiQ1xOkkYY5i3+SBdkuTxQwOsE9COWfSK5RUZS0xCGfjdROqcyG0NrQ0nV WY7C2aQZ/LfYZrQOHDHFVwP1B3+KR6xmjNz5V10wz0fc+N6kEbX83Kzw8LzW+FeeIUEG 6Jj4PxjBR2JZk64hV6IVV+1yjRRUKUZwlvGzZIFLurGpYSTRrE1IFUP+e5UD+8DHWh4T YZut7lsv/xEn5Tii7rvlI5pqOQq71xfKSiRNnIxlisK4zskpqMh8NJMynTNeWJ2XAOHh 36dQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-54540-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54540-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl X-Forwarded-Encrypted: i=1; AJvYcCUHpJ3xn5yegq84fwWw4Ce+Z95jzwP39To+Jy4XDZG5Tz9oFt/gn3gxxIT3L/vmX3dInwfNUlnl/0hRHznbbTzSfKTIaMm339tWqs8KLw== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id t9-20020a17090a0d0900b002960eb26889si791198pja.185.2024.02.06.01.00.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:00:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54540-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-54540-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54540-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B04F528213E for ; Tue, 6 Feb 2024 08:58:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CF43212C802; Tue, 6 Feb 2024 08:58:43 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1ACDD2E3F0; Tue, 6 Feb 2024 08:58:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707209923; cv=none; b=o5t9rnUgKayh0Jhoi5HJ04dk4O4VfZ2HRmRP2YiFp2tumRAtFlD3ZHI0k7759SI0Ju4OJ3L/qTDL/0Su+Oz4HZoaDeRMuXkFxj4rsCsa7/AY5i+ihuNb4MRTEojqElsGQAALTjRXF2KWv0R1neZagLpx+fU6zY2oVkouXLzHj9w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707209923; c=relaxed/simple; bh=sJ7EBJB4uoeIeAIXUMQKztMwMKSsEWc3v2/UXm//ccg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=oChYGXOguSls3Pgn07yfw8QIbs89UQLbfYbOFvC278JeTHEbGvBUfA1AzFtv4H+M/owZQapN4YIuXkVjWadg3Q8E1walxWWNeZNNqnRhQruyuphvSml/w00b56Ibu7qFIIgi2HeYv+L409ZQdA+bVlZN28mjQrXqqY/xY8lWkWo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2E5FC433C7; Tue, 6 Feb 2024 08:58:41 +0000 (UTC) Message-ID: Date: Tue, 6 Feb 2024 09:58:40 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v19 0/9] Add DELETE_BUF ioctl Content-Language: en-US, nl To: Benjamin Gaignard , mchehab@kernel.org Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, kernel@collabora.com References: <20240206080219.11951-1-benjamin.gaignard@collabora.com> From: Hans Verkuil Autocrypt: addr=hverkuil@xs4all.nl; keydata= xsFNBFQ84W0BEAC7EF1iL4s3tY8cRTVkJT/297h0Hz0ypA+ByVM4CdU9sN6ua/YoFlr9k0K4 BFUlg7JzJoUuRbKxkYb8mmqOe722j7N3HO8+ofnio5cAP5W0WwDpM0kM84BeHU0aPSTsWiGR yw55SOK2JBSq7hueotWLfJLobMWhQii0Zd83hGT9SIt9uHaHjgwmtTH7MSTIiaY6N14nw2Ud C6Uykc1va0Wqqc2ov5ihgk/2k2SKa02ookQI3e79laOrbZl5BOXNKR9LguuOZdX4XYR3Zi6/ BsJ7pVCK9xkiVf8svlEl94IHb+sa1KrlgGv3fn5xgzDw8Z222TfFceDL/2EzUyTdWc4GaPMC E/c1B4UOle6ZHg02+I8tZicjzj5+yffv1lB5A1btG+AmoZrgf0X2O1B96fqgHx8w9PIpVERN YsmkfxvhfP3MO3oHh8UY1OLKdlKamMneCLk2up1Zlli347KMjHAVjBAiy8qOguKF9k7HOjif JCLYTkggrRiEiE1xg4tblBNj8WGyKH+u/hwwwBqCd/Px2HvhAsJQ7DwuuB3vBAp845BJYUU3 06kRihFqbO0vEt4QmcQDcbWINeZ2zX5TK7QQ91ldHdqJn6MhXulPKcM8tCkdD8YNXXKyKqNl UVqXnarz8m2JCbHgjEkUlAJCNd6m3pfESLZwSWsLYL49R5yxIwARAQABzSFIYW5zIFZlcmt1 aWwgPGh2ZXJ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R0SFat sflovhDxKyhFwXOP0Rv8H378/+14TaykknRBIKEc0+lcr+EMOSUR5eg4aURb8Gc3Uc7fgQ6q UssTXzHPyj1hAyDpfu8DzAwlh4kKFTodxSsKAjI45SLjadSc94/5Gy8645Y1KgBzBPTH7Q== In-Reply-To: <20240206080219.11951-1-benjamin.gaignard@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 06/02/2024 09:02, Benjamin Gaignard wrote: > Unlike when resolution change on keyframes, dynamic resolution change > on inter frames doesn't allow to do a stream off/on sequence because > it is need to keep all previous references alive to decode inter frames. > This constraint have two main problems: > - more memory consumption. > - more buffers in use. > To solve these issue this series introduce DELETE_BUFS ioctl and remove > the 32 buffers limit per queue. This v19 looks good. There are three outstanding issues that I need to take a look at: 1) Can we still signal support for DELETE_BUFS in the V4L2_BUF_CAP_ caps? It would be nice to have, but I'm not sure if and how that can be done. 2) I want to take another look at providing a next version of the VIDIOC_CREATE_BUFS ioctl and how that would possibly influence the design of DELETE_BUFS. Just to make sure we're not blocking anything or making life harder. 3) Review the v4l2-compliance tests. I haven't spend much time on that, so I need to take a look at v7 and see if I can come up with more tests. I'll try to make time for this either tomorrow or next week. Regards, Hans > > VP9 conformance tests using fluster give a score of 210/305. > The 23 of the 24 resize inter tests (vp90-2-21-resize_inter_* files) are ok > but require to use postprocessor. > > Kernel branch is available here: > https://gitlab.collabora.com/benjamin.gaignard/for-upstream/-/commits/remove_vb2_queue_limit_v19 > > GStreamer branch to use DELETE_BUF ioctl and testing dynamic resolution > change is here: > https://gitlab.freedesktop.org/benjamin.gaignard1/gstreamer/-/commits/VP9_drc > > changes in version 19: > - Fix typo in commit message. > - Fix ioctl domentation > - Rework q->is_busy patch following Hans's comments > - Change where DELETE_BUFS is enabled > > changes in version 18: > - rebased on top of: > https://patchwork.linuxtv.org/project/linux-media/patch/20240118121452.29151-1-benjamin.gaignard@collabora.com/ > https://patchwork.linuxtv.org/project/linux-media/patch/92975c06-d6e1-4ba6-8d03-b2ef0b199c21@xs4all.nl/ > - Add a patch to update vb2_is_busy() logic. > - fix __vb2_queue_alloc() parameters descriptions. > - rework bitmap free range finding loop > - remove per queue capability flag. > - rework v4l_delete_bufs() to check if VIDIOC_CREATE_BUFS is enabled > and if vidioc_delete_bufs pointer is valid. > - update documentation. > - Direclty use vb2_core_delete_bufs() in v4l2_m2m_ioctl_delete_bufs(). > Remove useless static functions. > > changes in version 17: > - rebased on top of: > https://patchwork.linuxtv.org/project/linux-media/patch/20240118121452.29151-1-benjamin.gaignard@collabora.com/ > https://patchwork.linuxtv.org/project/linux-media/patch/92975c06-d6e1-4ba6-8d03-b2ef0b199c21@xs4all.nl/ > - rewrite min_reqbufs_allocation field documentation. > - rewrite vb2_core_create_bufs() first_index parameter documentation. > - rework bitmap allocation usage in __vb2_queue_alloc(). > - remove useless i < q->max_num_buffers checks. > - rework DELETE_BUFS documentation. > - change split between patch 7 and patch 8 > - v4l2_m2m_delete_bufs() is now a static function. > > > Benjamin Gaignard (9): > media: videobuf2: Update vb2_is_busy() logic > videobuf2: Add min_reqbufs_allocation field to vb2_queue structure > media: test-drivers: Set REQBUFS minimum number of buffers > media: core: Rework how create_buf index returned value is computed > media: core: Add bitmap manage bufs array entries > media: core: Free range of buffers > media: v4l2: Add DELETE_BUFS ioctl > media: v4l2: Add mem2mem helpers for DELETE_BUFS ioctl > media: verisilicon: Support deleting buffers on capture queue > > .../userspace-api/media/v4l/user-func.rst | 1 + > .../media/v4l/vidioc-delete-bufs.rst | 79 +++++++ > .../media/common/videobuf2/videobuf2-core.c | 223 ++++++++++++------ > .../media/common/videobuf2/videobuf2-v4l2.c | 26 +- > .../media/platform/verisilicon/hantro_v4l2.c | 1 + > .../media/test-drivers/vicodec/vicodec-core.c | 1 + > drivers/media/test-drivers/vim2m.c | 1 + > .../media/test-drivers/vimc/vimc-capture.c | 3 +- > drivers/media/test-drivers/visl/visl-video.c | 1 + > drivers/media/test-drivers/vivid/vivid-core.c | 5 +- > drivers/media/v4l2-core/v4l2-dev.c | 3 + > drivers/media/v4l2-core/v4l2-ioctl.c | 24 ++ > drivers/media/v4l2-core/v4l2-mem2mem.c | 10 + > include/media/v4l2-ioctl.h | 4 + > include/media/v4l2-mem2mem.h | 2 + > include/media/videobuf2-core.h | 52 +++- > include/media/videobuf2-v4l2.h | 2 + > include/uapi/linux/videodev2.h | 16 ++ > 18 files changed, 369 insertions(+), 85 deletions(-) > create mode 100644 Documentation/userspace-api/media/v4l/vidioc-delete-bufs.rst >