From patchwork Thu Oct 31 07:59:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 840495 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 089A814F102 for ; Thu, 31 Oct 2024 08:08:39 +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=1730362120; cv=none; b=OiUagLeOneA3kmmQOY+b3y/5vp0EvJddkwArIIse8sOjhPWDcLVyxhP/mySE46frdGbCQ3hMokdw0FJW91OSHEeFBFvLkQvn8+RggJidfuNYS1MQj3oNaV+AELUL2nZ5wSDgOCEFCvWK4l4a01jQXy/KFojd1J0sQugMyCyhd1Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730362120; c=relaxed/simple; bh=A/eRyJ8eBPWhw5IaLbZqK5AXx7PNIWEZK7pFifWLWiU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=u0KysbSwYQPf9CuQA9n2+Bq2dECGLPD8zfy+DbpqaPBZgXWNOFxa90WNoGiffr+S9lqQLy3e8QTx80TXb8efyJsUbfmm56ZJ8SWcWG4VazewPuQ24oLwg+3//TbEkZw44vsdWtM/o3+tdvV6wAqs0WxjuGVLD0hy/NmiQcewMMQ= 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 79BECC4CEC3; Thu, 31 Oct 2024 08:08:38 +0000 (UTC) From: Hans Verkuil To: linux-media@vger.kernel.org Cc: nicolas@ndufresne.ca, Laurent Pinchart , Tomasz Figa Subject: [RFC PATCH 0/2] media: vb2: introduce queue_info Date: Thu, 31 Oct 2024 08:59:25 +0100 Message-ID: X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The vb2 queue_setup function is very confusing since it is used for both VIDIOC_REQBUFS and VIDIOC_CREATE_BUFS. Drivers often implement this incorrectly. This short series adds a new queue_info callback to use as a replacement of queue_setup. The queue_info callback just returns the number of planes and plane sizes of the current format (and optionally the devices to use to allocate each plane). After that vb2 uses that information to deal with everything else. This means that drivers that use queue_info can no longer fiddle with the number of buffers the caller wants to allocate. This is entirely controlled by q->min_queued_buffers and q->min_reqbufs_allocation. It makes both the vb2 code and the driver code much simpler. The first patch makes the vb2 changes, and the second patch converts the vivid driver to the new queue_info. Comments are very welcome. Regards, Hans Hans Verkuil (2): media: vb2: introduce queue_info to replace queue_setup media: vivid: convert queue_setup to queue_info .../media/common/videobuf2/videobuf2-core.c | 82 ++++++++++++++----- .../media/test-drivers/vivid/vivid-meta-cap.c | 17 ++-- .../media/test-drivers/vivid/vivid-meta-out.c | 27 +++--- .../media/test-drivers/vivid/vivid-sdr-cap.c | 16 ++-- .../test-drivers/vivid/vivid-touch-cap.c | 18 ++-- .../media/test-drivers/vivid/vivid-vbi-cap.c | 13 ++- .../media/test-drivers/vivid/vivid-vbi-out.c | 13 ++- .../media/test-drivers/vivid/vivid-vid-cap.c | 39 +++------ .../media/test-drivers/vivid/vivid-vid-out.c | 37 ++------- include/media/videobuf2-core.h | 10 +++ 10 files changed, 126 insertions(+), 146 deletions(-)