From patchwork Tue Oct 25 09:01:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jammy Huang X-Patchwork-Id: 10638 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp893455wru; Tue, 25 Oct 2022 02:11:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4w2NflKG1vHjP/M2fZ3KvnRHB/UGl/YDmIG1XL3XhjJ/hW6Dm2kyYUFqvEDFBiaIMH1jhE X-Received: by 2002:a63:d845:0:b0:44b:d074:97d with SMTP id k5-20020a63d845000000b0044bd074097dmr32449775pgj.32.1666689100314; Tue, 25 Oct 2022 02:11:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666689100; cv=none; d=google.com; s=arc-20160816; b=cHArGjZa+bIn244JdZ+OxpCysw2HZ5Iv25gMxZTcAYg3Z294z3pR50zVk0plgQLB0Y DiwFhDYsFrbd6/TMTRqJ3FV/aDHIqTwkJ9TUgPZgThceALSVCs6h8ZIQdSU1BWTW/Qeh U9xaua3YkPfFhQ0ylCyfvhWxjFidkbCgnaJuzhoqPBtSXVzgp7iOF/CPjN/ch2RWpXCw ibL432HyQ+PDzy9STgjJqfY6Ck8cwPmqFDyEYmbN4efdY59eTgQtxOjRf1E1g7NMb6fm DdIS7y7S+9Hvr4cNuloZY04pzLzN87x/L/Nc7QX9pdW3vPz4g+YFcGbK6NLapZyCGgsm lUtg== 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:to:from; bh=0JP8eRkB8GTxfIfImUvMF2rtmjiTsUXt7mZJyHdae18=; b=dXmD/ehntjeyxVVcxCG8L0TN/bhreumxuw5jRyRNdJv0rJ/IqSZ2Vj6QfaW4ef8+Ki BYrI3+8cT4Lo1WpwnLd40EBUfj5dHxVglFbxluL4TIdq9Kb4nOh/cwRPWWl0qJYeVEFG EMZGSImYCJP6N6FNWKBqWeIB5mmEdSyuH0UItIFPMuFt4wubTuLVxclXumry7v7EI4BH 8+SZNlb0L3rE9XQC+xXi1q4g0wsT5SBGswSn2jHagu3Dv8jTz6QuOHN+XGWn9BP6bzyO M1PfmksYWJf1RX8MIUJR8mP574R7C0I6khUvf8Su4nxQpM4s41VugjTZ5u8T1GcR19wR p4mQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n5-20020a170902d2c500b0017a0a2e40e6si2592884plc.159.2022.10.25.02.11.26; Tue, 25 Oct 2022 02:11:40 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232359AbiJYJLF (ORCPT + 99 others); Tue, 25 Oct 2022 05:11:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231640AbiJYJKC (ORCPT ); Tue, 25 Oct 2022 05:10:02 -0400 Received: from twspam01.aspeedtech.com (twspam01.aspeedtech.com [211.20.114.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88054160226; Tue, 25 Oct 2022 02:05:15 -0700 (PDT) Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 29P8dHbt031240; Tue, 25 Oct 2022 16:39:17 +0800 (GMT-8) (envelope-from jammy_huang@aspeedtech.com) Received: from JammyHuang-PC.aspeed.com (192.168.2.115) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 25 Oct 2022 17:02:03 +0800 From: Jammy Huang To: , , , , , , , , , , , , , , , , , Subject: [PATCH v10 1/5] media: v4l: Add definition for the Aspeed JPEG format Date: Tue, 25 Oct 2022 17:01:59 +0800 Message-ID: <20221025090203.5623-2-jammy_huang@aspeedtech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221025090203.5623-1-jammy_huang@aspeedtech.com> References: <20221025090203.5623-1-jammy_huang@aspeedtech.com> MIME-Version: 1.0 X-Originating-IP: [192.168.2.115] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-DNSRBL: X-MAIL: twspam01.aspeedtech.com 29P8dHbt031240 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747650190447599084?= X-GMAIL-MSGID: =?utf-8?q?1747650190447599084?= This introduces support for the Aspeed JPEG format, where the new frame can refer to previous frame to reduce the amount of compressed data. The concept is similar to I/P frame of video compression. It will compare the new frame with previous one to decide which macroblock's data is changed, and only the changed macroblocks will be compressed. This Aspeed JPEG format is used by the video engine on Aspeed platforms, which is generally adapted for remote KVM. Signed-off-by: Jammy Huang --- v10: - no update v9: - Rebase on new kernel v8: - Add decoder information for aspeed-jpeg v7: - Add more information for aspeed-jpeg v6: - Update description for new format, aspeed-jpeg, in Documentation. v5: - no update v4: - new --- .../userspace-api/media/v4l/pixfmt-reserved.rst | 17 +++++++++++++++++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 3 files changed, 19 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst b/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst index 0ff68cd8cf62..73cd99828010 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst @@ -258,6 +258,23 @@ please make a proposal on the linux-media mailing list. and it is used by various multimedia hardware blocks like GPU, display controllers, ISP and video accelerators. It contains four planes for progressive video. + * .. _V4L2-PIX-FMT-AJPG: + + - ``V4L2_PIX_FMT_AJPG`` + - 'AJPG' + - ASPEED JPEG format used by the aspeed-video driver on Aspeed platforms, + which is generally adapted for remote KVM. + On each frame compression, I will compare the new frame with previous + one to decide which macroblock's data is changed, and only the changed + macroblocks will be compressed. + + The implementation is based on AST2600 A3 datasheet, revision 0.9, which + is not publicly available. Or you can reference Video stream data format + – ASPEED mode compression of SDK_User_Guide which available on + AspeedTech-BMC/openbmc/releases. + + Decoder's implementation can be found here, + `aspeed_codec `__ .. raw:: latex \normalsize diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index fddba75d9074..8cb4b976064e 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1497,6 +1497,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_MT21C: descr = "Mediatek Compressed Format"; break; case V4L2_PIX_FMT_QC08C: descr = "QCOM Compressed 8-bit Format"; break; case V4L2_PIX_FMT_QC10C: descr = "QCOM Compressed 10-bit Format"; break; + case V4L2_PIX_FMT_AJPG: descr = "Aspeed JPEG"; break; default: if (fmt->description[0]) return; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 86cae23cc446..870a7e5ef8ca 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -775,6 +775,7 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* BTTV 8-bit dithered RGB */ #define V4L2_PIX_FMT_QC08C v4l2_fourcc('Q', '0', '8', 'C') /* Qualcomm 8-bit compressed */ #define V4L2_PIX_FMT_QC10C v4l2_fourcc('Q', '1', '0', 'C') /* Qualcomm 10-bit compressed */ +#define V4L2_PIX_FMT_AJPG v4l2_fourcc('A', 'J', 'P', 'G') /* Aspeed JPEG */ /* 10bit raw packed, 32 bytes for every 25 pixels, last LSB 6 bits unused */ #define V4L2_PIX_FMT_IPU3_SBGGR10 v4l2_fourcc('i', 'p', '3', 'b') /* IPU3 packed 10-bit BGGR bayer */