From patchwork Fri Dec 14 15:43:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 10731365 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0B3636C5 for ; Fri, 14 Dec 2018 15:43:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2BEF2873A for ; Fri, 14 Dec 2018 15:43:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A6F3A2879C; Fri, 14 Dec 2018 15:43:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2ABA72D6A5 for ; Fri, 14 Dec 2018 15:43:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728998AbeLNPnf (ORCPT ); Fri, 14 Dec 2018 10:43:35 -0500 Received: from lb3-smtp-cloud7.xs4all.net ([194.109.24.31]:58683 "EHLO lb3-smtp-cloud7.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726520AbeLNPnf (ORCPT ); Fri, 14 Dec 2018 10:43:35 -0500 Received: from test-nl.fritz.box ([80.101.105.217]) by smtp-cloud7.xs4all.net with ESMTPA id XpcSgqK2FdllcXpcTgJJAC; Fri, 14 Dec 2018 16:43:33 +0100 From: hverkuil-cisco@xs4all.nl To: linux-media@vger.kernel.org Cc: Tomasz Figa , Ezequiel Garcia , Philipp Zabel Subject: [PATCH 0/2] v4l2-mem2mem: add job_write() to support encoders Date: Fri, 14 Dec 2018 16:43:14 +0100 Message-Id: <20181214154316.62011-1-hverkuil-cisco@xs4all.nl> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-CMAE-Envelope: MS4wfE2gd1jVKlCvESmiEaleHmfcQkPS1Y+WCzIGqEPxfP1Dvz3AEIleISlttyV3C9tAlKxNeMeUh7zF5CWbtvS5qdQstEl+EqB0ltW7BhlE2I29OpS9ZHoo sSTH4FL+lhmIZMhqtD8LxD+nODtUwTLtuC8DHgpIxUBFR46b5Up8DE/tmL6PQMYwbwPL/smtglIdBmjanqqCTmHN340tVkAMubaKIBd3kmTlIJM+WaeSMVLl 895mSFr4tirjeq2kJ2oVm3xESK8pPijQv8KTYyipU+P+JjWEzGLRVl6wpu+0gG/o Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hans Verkuil The m2m framework is not quite symmetrical: decoders can process multiple output buffers in job_ready until enough buffers have arrived so a frame can be decoded. However, encoders do not have an equivalent where multiple capture buffers can be used to write the compressed frame. They expect that the provided capture buffer is always large enough to contain the full compressed frame. This patch adds a job_write() callback and a v4l2_m2m_job_writing() function to tell the m2m framework that the job isn't finished but that it is waiting for more capture buffers so it can write the remaining compressed data to the buffers. The first patch adds the support for this to the m2m framework, the second patch adapts vicodec to use it. Let me know if there are any comments! It would be even better if this could be tested in a real stateful encoder. Regards, Hans Hans Verkuil (2): v4l2-mem2mem: add job_write callback vicodec: add encoder support to write to multiple buffers drivers/media/platform/vicodec/vicodec-core.c | 91 +++++++++++++++---- drivers/media/v4l2-core/v4l2-mem2mem.c | 61 +++++++++++-- include/media/v4l2-mem2mem.h | 27 +++++- 3 files changed, 152 insertions(+), 27 deletions(-)