Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp743259rwb; Wed, 14 Dec 2022 02:06:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf4nQY1cSL/Qn/SOvklRDAQDKdQ6mDK94PwWMCR+AM/kG/lLXSdl01U5QVa63OwMHX2t7mOH X-Received: by 2002:a17:90a:e00a:b0:221:6db6:9660 with SMTP id u10-20020a17090ae00a00b002216db69660mr8869242pjy.11.1671012414322; Wed, 14 Dec 2022 02:06:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671012414; cv=none; d=google.com; s=arc-20160816; b=Iuryz7JuU0xueSTIERsIKyBDNO0blFuMEji5l3OhMr9Zr5VblJjMdfl/YD4RE8nW1e KV5n8TzyfOyUDRblE8OAJXrDelP53YYBw0mpN/0YNhDjzYyvkkrehpQS7H+/eistjyxP uePMRz+4PULKybssVzPPuBRJ7ryrX8ATL7bnSrNOHOKV+tx8A0hqIl+w4cjqbX2iLPCQ 4O5i1k9KZnNU4MYE9Pgp6YjA/Zo8k3cncPhqit69vvof6ka8ICBZvwv4WtwwWPj2l9Ih ZNxJYILOVyE8xF0wmMNPeNmOCGLHq3iEomO08X51Vj3DYeqp0CAYciG4k1HxL0NbJvZ7 jfKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=i3swy6qz7DvZvAluAP+tU7pAgPPOXXX+hPPdHMPIYTg=; b=PDEfXA780hdhteKv90e36oCCd1tXQIghO03cPnH2Pu1ic5lSra8g0OYvkQWHsw6mJQ al2C+4tvaIeQ/y+A29vVMA11xMWCUM9IDsHkvJW7iA09R6qtaieVzqoJnpgMDH8ELkXz /C7BPFEIjO+mAtzdP/xhgbg2pYiA59gUR20HHmRhjUSEGl7rU7Mr5BPEEpe1AhaL8I2W p03NcbwlspaK3af62uMX0nel9t/BSIZCaqYWdPJVUFVHgrvKSRwUJ2PccgMmOjD3uur4 IW25Ro//yc/lbRRQ86GHDlWJAIKXzUHfsTDDHBk4VKU1LqMX54tk1vSVOC2i1DEoIyuN fJAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=TMY8qMQ4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pt15-20020a17090b3d0f00b002193189259csi1565144pjb.36.2022.12.14.02.06.45; Wed, 14 Dec 2022 02:06:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=TMY8qMQ4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237998AbiLNJ2b (ORCPT + 70 others); Wed, 14 Dec 2022 04:28:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237781AbiLNJ1m (ORCPT ); Wed, 14 Dec 2022 04:27:42 -0500 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B0EB26C1; Wed, 14 Dec 2022 01:27:40 -0800 (PST) Received: by mail-pf1-x42d.google.com with SMTP id n3so4010901pfq.10; Wed, 14 Dec 2022 01:27:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=i3swy6qz7DvZvAluAP+tU7pAgPPOXXX+hPPdHMPIYTg=; b=TMY8qMQ41o0UKNmoR7w3ak/SW3CrXcIgoKdNfhVSPyrHEpCTX+r60lg+35CduOEPo0 EaxBu4Md+y1cyMv9cjROfOcs5JnNypGG8ehHXz2+xqx7HCWKY4ICC/JvxdNpaIehEonB YsVA6vdoUSBwo1n3hhIsvCdWlABUq3oHZtj3tGbOz1hp6vzps7910OslDNc0NAphoeT1 evvCNc4/3vh2czzmSR8DtCk3W2IP9yhbJ/j/h/Z1vIOvf3Q+JT8U15OSyCrIczUndYaO 43hVJlknTCritcgwiphKMsrZvP9jdnaF5kqd/o8k7171CoJ1Lho9NBC4vLGQLrXnaHgs D9ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=i3swy6qz7DvZvAluAP+tU7pAgPPOXXX+hPPdHMPIYTg=; b=fhYypsyesWpUfokIgk2+KaiR8gJi9GyX6H7NiMwFujnAx8B0xdueDsCNCq4TXQrhIG 2gxXadXggx0YbXqE5TPXH1tEgijzxtENVFg268vG4JZ7FLbhOzy+D+ZbDT4wPLys6HV/ IePIZTYSmCpyYaRStmE7CwMJqEdj8b3QQLnoDvJo7hZypvgzH9Ibcv+OH4TAyXC1+QAt EtXd2OXRiHCKTGlFehonPviKPNKOE66TbOabIuSvez9/ismikWwz2CewK6HLvUS7koXU SWdCB8LO5gYr4E+pDXUK9DIntQL6NVN6rcB2M591C+OPsiR95+8qvORQiJ504TcWjV2z Dpwg== X-Gm-Message-State: ANoB5plxWvkufrIZOjablfDugvitbOgnFi4b4AHG4Guh8+VYhcBJbgzT ZOkuJ4FfE3ZS3KnmEkvo8tE= X-Received: by 2002:a05:6a00:26cc:b0:577:b52:4ec3 with SMTP id p12-20020a056a0026cc00b005770b524ec3mr21660543pfw.22.1671010059876; Wed, 14 Dec 2022 01:27:39 -0800 (PST) Received: from hcdev-d520mt2.. (60-250-192-107.hinet-ip.hinet.net. [60.250.192.107]) by smtp.gmail.com with ESMTPSA id t123-20020a628181000000b00576145a9bd0sm9003312pfd.127.2022.12.14.01.27.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Dec 2022 01:27:39 -0800 (PST) From: Marvin Lin To: mchehab@kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: openbmc@lists.ozlabs.org, avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, venture@google.com, yuenn@google.com, benjaminfair@google.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, kwliu@nuvoton.com, kflin@nuvoton.com, Marvin Lin Subject: [PATCH v8 6/7] media: uapi: Add controls for NPCM video driver Date: Wed, 14 Dec 2022 17:26:35 +0800 Message-Id: <20221214092636.810883-7-milkfafa@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221214092636.810883-1-milkfafa@gmail.com> References: <20221214092636.810883-1-milkfafa@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Create controls for Nuvoton NPCM video driver to support setting capture mode of Video Capture/Differentiation (VCD) engine and getting the count of HEXTILE rectangles that is compressed by Encoding Compression Engine (ECE). Signed-off-by: Marvin Lin --- .../userspace-api/media/drivers/index.rst | 1 + .../media/drivers/npcm-video.rst | 67 +++++++++++++++++++ include/uapi/linux/npcm-video.h | 41 ++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 Documentation/userspace-api/media/drivers/npcm-video.rst create mode 100644 include/uapi/linux/npcm-video.h diff --git a/Documentation/userspace-api/media/drivers/index.rst b/Documentation/userspace-api/media/drivers/index.rst index 915dbf0f4db5..97d2ce8da6b3 100644 --- a/Documentation/userspace-api/media/drivers/index.rst +++ b/Documentation/userspace-api/media/drivers/index.rst @@ -38,6 +38,7 @@ For more details see the file COPYING in the source distribution of Linux. imx-uapi max2175 meye-uapi + npcm-video omap3isp-uapi st-vgxy61 uvcvideo diff --git a/Documentation/userspace-api/media/drivers/npcm-video.rst b/Documentation/userspace-api/media/drivers/npcm-video.rst new file mode 100644 index 000000000000..abe9aac8fd34 --- /dev/null +++ b/Documentation/userspace-api/media/drivers/npcm-video.rst @@ -0,0 +1,67 @@ +.. SPDX-License-Identifier: GPL-2.0 + +.. include:: + +NPCM video driver +================= + +This driver is used to control the Video Capture/Differentiation (VCD) engine +and Encoding Compression Engine (ECE) present on Nuvoton NPCM SoCs. The VCD can +capture and differentiate video data from digital or analog sources, then the +ECE will compress the data into HEXTILE format. + +Driver-specific Controls +------------------------ + +V4L2_CID_NPCM_CAPTURE_MODE +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The VCD engine supports two modes: + +- COMPLETE mode: + + Capture the next complete frame into memory. + +- DIFF mode: + + Compare the incoming frame with the frame stored in memory, and updates the + differentiated frame in memory. + +Application can use ``V4L2_CID_NPCM_CAPTURE_MODE`` control to set the VCD mode +with different control values (enum v4l2_npcm_capture_mode): + +- ``V4L2_NPCM_CAPTURE_MODE_COMPLETE``: will set VCD to COMPLETE mode. +- ``V4L2_NPCM_CAPTURE_MODE_DIFF``: will set VCD to DIFF mode. + +V4L2_CID_NPCM_RECT_COUNT +~~~~~~~~~~~~~~~~~~~~~~~~ + +After frame data is captured, the ECE will compress the data into HEXTILE format +and store these HEXTILE rectangles data in V4L2 video buffer with the layout +defined in Remote Framebuffer Protocol: +:: + + (RFC 6143, https://www.rfc-editor.org/rfc/rfc6143.html#section-7.6.1) + + +--------------+--------------+-------------------+ + | No. of bytes | Type [Value] | Description | + +--------------+--------------+-------------------+ + | 2 | U16 | x-position | + | 2 | U16 | y-position | + | 2 | U16 | width | + | 2 | U16 | height | + | 4 | S32 | encoding-type (5) | + +--------------+--------------+-------------------+ + | HEXTILE rectangle data | + +-------------------------------------------------+ + +Application can get these video buffers through V4L2 interfaces and use +``V4L2_CID_NPCM_RECT_COUNT`` control to get the count of compressed HEXTILE +rectangles that can be put in the field number-of-rectangles of +FramebufferUpdate header. + +References +---------- +include/uapi/linux/npcm-video.h + +**Copyright** |copy| 2022 Nuvoton Technologies diff --git a/include/uapi/linux/npcm-video.h b/include/uapi/linux/npcm-video.h new file mode 100644 index 000000000000..1d39f6f38c96 --- /dev/null +++ b/include/uapi/linux/npcm-video.h @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ +/* + * Controls header for NPCM video driver + * + * Copyright (C) 2022 Nuvoton Technologies + */ + +#ifndef _UAPI_LINUX_NPCM_VIDEO_H +#define _UAPI_LINUX_NPCM_VIDEO_H + +#include + +/* + * Check Documentation/userspace-api/media/drivers/npcm-video.rst for control + * details. + */ + +/* + * This control is meant to set the mode of NPCM Video Capture/Differentiation + * (VCD) engine. + * + * The VCD engine supports two modes: + * COMPLETE - Capture the next complete frame into memory. + * DIFF - Compare the incoming frame with the frame stored in memory, and + * updates the differentiated frame in memory. + */ +#define V4L2_CID_NPCM_CAPTURE_MODE (V4L2_CID_USER_NPCM_BASE + 0) + +enum v4l2_npcm_capture_mode { + V4L2_NPCM_CAPTURE_MODE_COMPLETE = 0, /* COMPLETE mode */ + V4L2_NPCM_CAPTURE_MODE_DIFF = 1, /* DIFF mode */ +}; + +/* + * This control is meant to get the count of compressed HEXTILE rectangles which + * is relevant to the number of differentiated frames if VCD is in DIFF mode. + * And the count will always be 1 if VCD is in COMPLETE mode. + */ +#define V4L2_CID_NPCM_RECT_COUNT (V4L2_CID_USER_NPCM_BASE + 1) + +#endif /* _UAPI_LINUX_NPCM_VIDEO_H */ -- 2.34.1