From patchwork Fri Jul 2 02:01:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Almeida X-Patchwork-Id: 469686 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95957C11F67 for ; Fri, 2 Jul 2021 02:01:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6936E6140C for ; Fri, 2 Jul 2021 02:01:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234644AbhGBCEM (ORCPT ); Thu, 1 Jul 2021 22:04:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234596AbhGBCEM (ORCPT ); Thu, 1 Jul 2021 22:04:12 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C01F3C061762 for ; Thu, 1 Jul 2021 19:01:40 -0700 (PDT) Received: from localhost.localdomain (unknown [IPv6:2804:14d:72b1:a2ff:e85c:7833:5d85:73d6]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dwlsalmeida) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 5945A1F446E3; Fri, 2 Jul 2021 03:01:36 +0100 (BST) From: daniel.almeida@collabora.com To: hverkuil@xs4all.nl, jernej.skrabec@gmail.com, ezequiel@collabora.com, paul.kocialkowski@bootlin.com, mripard@kernel.org Cc: kernel@collabora.com, linux-media@vger.kernel.org, Daniel Almeida Subject: [RFC, WIP PATCH 0/2] cedrus: h264: add support for dynamically allocated ctrl arrays Date: Thu, 1 Jul 2021 23:01:27 -0300 Message-Id: <20210702020129.470720-1-daniel.almeida@collabora.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Daniel Almeida So far the Cedrus driver is able to decode a slice at a time in slice mode. Use the new flag "V4L2_CTRL_FLAG_DYNAMIC_ARRAY" and the new h264 slice array decode mode to support passing an array with all the slices at once from userspace. The device will process all slices in this array before calling v4l2_m2m_buf_done_and_job_finish, significantly reducing the amount of back and forth of data. This is marked as WIP because currently only the first slice will decode, all subsequent slices in the same frame will return CEDRUS_IRQ_ERROR. Also I haven't quite polished this yet. It is marked as RFC because I am not sure whether adding a new entry in v4l2_stateless_h264_decode_mode was the right call. Also, apparently only the slice offset is needed for subsequent slices (i.e. slice->header_bit_size), so I am a bit unsure whether userspace has to fill all fields for slices 2..n Daniel Almeida (2): media: cedrus: fix double free Cedrus: add support for dynamic arrays in H264 drivers/media/v4l2-core/v4l2-ctrls-defs.c | 1 + drivers/staging/media/sunxi/cedrus/cedrus.c | 35 ++++++++++++-- drivers/staging/media/sunxi/cedrus/cedrus.h | 18 ++++++++ .../staging/media/sunxi/cedrus/cedrus_dec.c | 33 +++++++++++++ .../staging/media/sunxi/cedrus/cedrus_h264.c | 46 ++++++++++++++++--- .../staging/media/sunxi/cedrus/cedrus_hw.c | 35 +++++++++++++- include/uapi/linux/v4l2-controls.h | 7 +++ 7 files changed, 163 insertions(+), 12 deletions(-)