Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp2316860ima; Mon, 22 Oct 2018 07:52:19 -0700 (PDT) X-Google-Smtp-Source: AJdET5dk9JFYBLnGnmtlnm6rLaH6jB58WsACc6PBcGpMjAmMvSlKkXrc+S5d5dsq42kV5sz1GOEM X-Received: by 2002:a63:2045:: with SMTP id r5-v6mr7971070pgm.328.1540219939927; Mon, 22 Oct 2018 07:52:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540219939; cv=none; d=google.com; s=arc-20160816; b=sS/iKA8A4mNuX4hSlgt6zoNMbSlcfmXcSOyI6DlC1IApPRzB7Tl/TFRY0HtwQvb5fw ZQ5gASb20BKtCGIZZFbJRkxo4RPBnW9pSPlXqykrEv9OJ0lZY8FVw5ET0bgs4SRpSvc6 jHb4gdHXaNO1ZjTmqmWanwCu+s2+sgxD+zJ/MIXvi5I4J2sTH7rZmZ7+J1adHP5Q7rax gv9Vv8E805LQFqJBQg5rhoOpR8fxEEVADYCPB7V3al8RiAocqimNGRwxYZtec8nFRoNZ 9yxGSpFjD8ioeZv+6sM+wnH/fOYAqXu5TFiY5LyKeUxxT2myjWolixQXohe3z5GHhMot eVjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=+1KZXHHhqgavw6jNVFM3//RcnjVG71f4baEma6XtfFs=; b=K+svRcZN8O0UjtWbmpfeHpPo6j4BJzlTYu6R48TuipSP8NFZXFPNdoZ1Wj+Fzp/Q5x DReeeSKaJwb9Xf5OU/wdA6rS50bUZWKc1vZCKUzv89pNuDMxqk81hPSKYAjA13e+QXHr 150etp4e2c1N/8yJHrvg8/A1fvBLwZwjJaCqYhmcFgANMnQjg43R2q0ved1SlSfpLc/k y4jldPQWDR0FCKuwz+H6+OVqgq8hUiJjPoW6t6AeZL3q8am42O6UHdRKGdYCiKuG37xF Z+696nueitgsj4j2aRUUubJtFZlYW2g57kOkptoe3uqBCHCPBh9K8EFmjVfuMJvLpG9b zgKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hZybMC2L; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d3-v6si11049537pla.426.2018.10.22.07.52.04; Mon, 22 Oct 2018 07:52:19 -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=@chromium.org header.s=google header.b=hZybMC2L; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728375AbeJVXIE (ORCPT + 99 others); Mon, 22 Oct 2018 19:08:04 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:42021 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727857AbeJVXIE (ORCPT ); Mon, 22 Oct 2018 19:08:04 -0400 Received: by mail-pl1-f194.google.com with SMTP id c8-v6so19165364plo.9 for ; Mon, 22 Oct 2018 07:49:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+1KZXHHhqgavw6jNVFM3//RcnjVG71f4baEma6XtfFs=; b=hZybMC2LMgJucbEzD0FSUvnym7PMzsVnvjzB+1Q9B+lafUFxNV2t09ZdG0g8MqN5LD 4vbPBY60EQa80BLnwD6cjqMSmX6SVfnHe6Kqb4xKutFDiCRMi2LS6AqUpkdrdqxOjCaL B90OQoNFLvMJOLtmi3ClN/uN1kV8GmiM+37is= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+1KZXHHhqgavw6jNVFM3//RcnjVG71f4baEma6XtfFs=; b=Ev1uTNlICK/ybIil0d7cVuqllcadb2/6Ta7qnjak5Ab1ogPiIkxpuI9fn8eIIUW2ll K8kBZlIpw51taw2b12TLBQA98Y2jaM9TMO45VfNUMVnFLqO0G/0djlSUH2CocWmx2WrL GJkXPtHFCgW/bDUAEE5J3Qgt3SV2FvtYWVBQNvgF4HDLf9O0nxWSChvEaqwl0gF52p0M +JkUZKuS5teNwA2MwhETpN9AM2vt3l/UmxhMpKyypeCMHcp1iddv7hrgtzWeOS/DweM6 3MNeSh6DIg3XNI2OBPXxdtUJEZDWcTVYEsYwgYBZeuix4YhcDTumhnu6CCjLqLryOE9l nHKQ== X-Gm-Message-State: ABuFfohVc/VoYOfDKAXvmlsSqQQ47419BXBTePogJM3PaBcQVoEQnxud pJzPLa8X7k+WRmLFRrzBIAEtlw== X-Received: by 2002:a17:902:1c3:: with SMTP id b61-v6mr32102828plb.65.1540219752537; Mon, 22 Oct 2018 07:49:12 -0700 (PDT) Received: from tfiga.tok.corp.google.com ([2401:fa00:4:4:5b21:5966:1198:d1e9]) by smtp.gmail.com with ESMTPSA id s80-v6sm42245429pfa.114.2018.10.22.07.49.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Oct 2018 07:49:11 -0700 (PDT) From: Tomasz Figa To: linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Mauro Carvalho Chehab , Hans Verkuil , =?UTF-8?q?Pawe=C5=82=20O=C5=9Bciak?= , Alexandre Courbot , Kamil Debski , Andrzej Hajda , Kyungmin Park , Jeongtae Park , Philipp Zabel , Tiffany Lin , Andrew-CT Chen , Stanimir Varbanov , Todor Tomov , Nicolas Dufresne , Paul Kocialkowski , Laurent Pinchart , dave.stevenson@raspberrypi.org, Ezequiel Garcia , Maxime Jourdan , Tomasz Figa Subject: [PATCH v2 0/2] Document memory-to-memory video codec interfaces Date: Mon, 22 Oct 2018 23:48:58 +0900 Message-Id: <20181022144901.113852-1-tfiga@chromium.org> X-Mailer: git-send-email 2.19.1.568.g152ad8e336-goog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It's been a while, but here is the v2 of the stateful mem2mem codec interfaces documentation. Sorry for taking so long time to respin. This series attempts to add the documentation of what was discussed during Media Workshops at LinuxCon Europe 2012 in Barcelona and then later Embedded Linux Conference Europe 2014 in Düsseldorf and then eventually written down by Pawel Osciak and tweaked a bit by Chrome OS video team (but mostly in a cosmetic way or making the document more precise), during the several years of Chrome OS using the APIs in production. Note that most, if not all, of the API is already implemented in existing mainline drivers, such as s5p-mfc or mtk-vcodec. Intention of this series is just to formalize what we already have. Thanks everyone for the huge amount of useful comments for the RFC and v1. Much of the credits should go to Pawel Osciak too, for writing most of the original text of the initial RFC. Changes since v1: (https://lore.kernel.org/patchwork/project/lkml/list/?series=360520) Decoder: - Removed a note about querying all combinations of OUTPUT and CAPTURE frame sizes, since it would conflict with scaling/composiion support to be added later. - Removed the source change event after setting non-zero width and height on OUTPUT queue, since the change happens as a direct result of a client action. - Moved all the setup steps for CAPTURE queue out of Initialization and Dynamic resolution change into a common sequence called Capture setup, since they were mostly duplicate of each other. - Described steps to allocate buffers for higher resolution than the stream to prepare for future resolution changes. - Described a way to skip the initial header parsing and speculatively configure the CAPTURE queue (for gstreamer/ffmpeg compatibility). - Reordered CAPTURE setup steps so that all the driver queries are done first and only then a reconfiguration may be attempted or skipped. - Described VIDIOC_CREATE_BUFS as another way of allocating buffers. - Made the decoder signal the source change event as soon as the change is detected, to reduce pipeline stalls in case of buffers already good to continue decoding. - Stressed out the fact that a source change may happen even without a change in the coded resolution. - Described querying pixel aspect ratio using VIDIOC_CROPCAP. - Extended documentation of VIDIOC_DECODER_CMD and VIDIOC_G/S/TRY_FMT to more precisely describe the behavior of mem2mem decoders. - Clarified that 0 width and height are allowed for OUTPUT side of mem2mem decoders in the documentation of the v4l2_pix_fmt struct. Encoder: - Removed width and height from CAPTURE (coded) format, since the coded resolution of the stream is an internal detail of the encoded stream. - Made the VIDIOC_S_FMT on OUTPUT mandatory, since the default format normally does not make sense (even if technically valid). - Changed the V4L2_SEL_TGT_CROP_BOUNDS and V4L2_SEL_TGT_CROP_DEFAULT selection targets to be equal to the full source frame to simplify internal handling in drivers for simple hardware. - Changed the V4L2_SEL_TGT_COMPOSE_DEFAULT selection target to be equal to |crop width|x|crop height|@(0,0) to simplify internal handling in drivers for simple hardware. - Removed V4L2_SEL_TGT_COMPOSE_PADDED, since the encoder does not write to the raw buffers. - Extended documentation of VIDIOC_ENCODER_CMD to more precisely describe the behavior of mem2mem encoders. - Clarified that 0 width and height are allowed for CAPTURE side of mem2mem encoders in the documentation of the v4l2_pix_fmt struct. General: - Clarified that the Drain sequence valid only if both queues are streaming and stopping any of the queues would abort it, since there is nothing to drain, if OUTPUT is stopped and there is no way to signal the completion if CAPTURE is stopped. - Clarified that VIDIOC_STREAMON on any of the queues would resume the codec from stopped state, to be consistent with the documentation of VIDIOC_ENCODER/DECODER_CMD. - Documented the relation between timestamps of OUTPUT and CAPTURE buffers and how special cases of non-1:1 relation are handled. - Added missing sizeimage to bitstream format operations and removed the mistaken mentions from descriptions of respective REQBUFS calls. - Removed the Pause sections, since there is no notion of pause for mem2mem devices. - Added state machine diagrams. - Merged both glossaries into one in the decoder document and a reference to it in the encoder document. - Added missing terms to the glossary. - Added "Stateful" to the interface names. - Reworded the text to be more userspace-centric. - A number of other readability improvements suggested in review comments. For changes since RFC see the v1: https://lore.kernel.org/patchwork/project/lkml/list/?series=360520 Tomasz Figa (2): media: docs-rst: Document memory-to-memory video decoder interface media: docs-rst: Document memory-to-memory video encoder interface Documentation/media/uapi/v4l/dev-decoder.rst | 1082 +++++++++++++++++ Documentation/media/uapi/v4l/dev-encoder.rst | 579 +++++++++ Documentation/media/uapi/v4l/devices.rst | 2 + Documentation/media/uapi/v4l/pixfmt-v4l2.rst | 10 + Documentation/media/uapi/v4l/v4l2.rst | 12 +- .../media/uapi/v4l/vidioc-decoder-cmd.rst | 40 +- .../media/uapi/v4l/vidioc-encoder-cmd.rst | 38 +- Documentation/media/uapi/v4l/vidioc-g-fmt.rst | 14 + 8 files changed, 1747 insertions(+), 30 deletions(-) create mode 100644 Documentation/media/uapi/v4l/dev-decoder.rst create mode 100644 Documentation/media/uapi/v4l/dev-encoder.rst -- 2.19.1.568.g152ad8e336-goog