Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp290245rwb; Thu, 18 Aug 2022 04:04:27 -0700 (PDT) X-Google-Smtp-Source: AA6agR7D+xWOcLb1g35nG0Q+eBljaNtsY1y5LneDbO3SF8FWoN4T9WTc+41nyXoLKWJjaQr5VFl2 X-Received: by 2002:a17:90b:1a92:b0:1f5:5d4d:2eb1 with SMTP id ng18-20020a17090b1a9200b001f55d4d2eb1mr8255265pjb.213.1660820667721; Thu, 18 Aug 2022 04:04:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660820667; cv=none; d=google.com; s=arc-20160816; b=HU3lhmhHMuUG2A7dFU8RqUeX+bWvmn+SKmY63njoGJMoR6nGGqgvSs9opIyU/wJmTn nnBKWVaxanY4CKJSaNElrzz4G4nA1j9nJjZOEHfbrUA5olxW4R3GbkplNQ8deNzBCh3y CQbU2HCiXwA7xoRQNu6+7R1YpvcYXAYjoUZ3klnN+fPuIeZYa9z+PfO14uHaymhQzWOL oZdP0ei7N/WCGyphcVj/0ZzNK+6eqm+ytjJSGcG734Bx23ccs0FQzepqgZevrqib89hj aJrFwT1sJPaHXyi2E2BS/vlO9Syko6LyTXKFRAafq40ziAf/iiHlV2pAg1t+UT+w/AM6 Dkyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=al5GHWwhCTpOiprZMy9QpziXfUbyTxU9Hp/ahf5SI2E=; b=tu6MJDV9PigdAGTmDCTmSarnymdapgw1ECADi+BsmtsnKG+Fcj1vzpo/v9ZyXZfZAj BgrJEOdvEliBSUUIsDzwXkP7UfvkQ+EtpvjwP7/nyn/oKx0jOV5aeKywKpDKV6p1RNlS BJjJ/1pwyTkwVHjBp4ZAxbbSo6zAAbTFr5poI/bAZAMY/olwA0M2p03lriop7tAnVLNc /jSdTRztLZ3n8z9xxY+5jXuJHxtSWtGoPJKx6etDhEcVPzC0itEuFHOMDd47UaDMcNQM rQClsn6kHJhz7CyfMHsSHqSWOS4Qrpo2DBxhSFTBaVZWwxw/dBgborIAV4BJmxGH9q7U ewBw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y13-20020a63180d000000b0041ccf0b2e64si1150355pgl.12.2022.08.18.04.04.15; Thu, 18 Aug 2022 04:04:27 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244193AbiHRKzh (ORCPT + 99 others); Thu, 18 Aug 2022 06:55:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244196AbiHRKz0 (ORCPT ); Thu, 18 Aug 2022 06:55:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48D6C8D3D9; Thu, 18 Aug 2022 03:55:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 73568B81DEB; Thu, 18 Aug 2022 10:55:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3CC0C433C1; Thu, 18 Aug 2022 10:55:17 +0000 (UTC) Message-ID: Date: Thu, 18 Aug 2022 12:55:15 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH v25 4/4] media: platform: mtk-mdp3: add MediaTek MDP3 driver Content-Language: en-US To: Moudy Ho , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger , Krzysztof Kozlowski Cc: Chun-Kuang Hu , Rob Landley , Laurent Pinchart , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Alexandre Courbot , tfiga@chromium.org, drinkcat@chromium.org, pihsun@chromium.org, hsinyi@google.com, Benjamin Gaignard , AngeloGioacchino Del Regno , Project_Global_Chrome_Upstream_Group@mediatek.com, cellopoint.kai@gmail.com, Ping-Hsun Wu , daoyuan huang References: <20220817095629.29911-1-moudy.ho@mediatek.com> <20220817095629.29911-5-moudy.ho@mediatek.com> From: Hans Verkuil In-Reply-To: <20220817095629.29911-5-moudy.ho@mediatek.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Hi Moudy, Just two nitpicks: On 17/08/2022 11:56, Moudy Ho wrote: > This patch adds driver for MediaTek's Media Data Path ver.3 (MDP3). > It provides the following functions: > color transform, format conversion, resize, crop, rotate, flip > and additional image quality enhancement. > > The MDP3 driver is mainly used for Google Chromebook products to > import the new architecture to set the HW settings as shown below: > User -> V4L2 framework > -> MDP3 driver -> SCP (setting calculations) > -> MDP3 driver -> CMDQ (GCE driver) -> HW > > Each modules' related operation control is sited in mtk-mdp3-comp.c > Each modules' register table is defined in file with "mdp_reg_" prefix > GCE related API, operation control sited in mtk-mdp3-cmdq.c > V4L2 m2m device functions are implemented in mtk-mdp3-m2m.c > Probe, power, suspend/resume, system level functions are defined in > mtk-mdp3-core.c > diff --git a/drivers/media/platform/mediatek/mdp3/Kconfig b/drivers/media/platform/mediatek/mdp3/Kconfig > new file mode 100644 > index 000000000000..e8c593c1eb69 > --- /dev/null > +++ b/drivers/media/platform/mediatek/mdp3/Kconfig > @@ -0,0 +1,20 @@ > +# SPDX-License-Identifier: GPL-2.0-only > +config VIDEO_MEDIATEK_MDP3 > + tristate "MediaTek MDP v3 driver" > + depends on MTK_IOMMU || COMPILE_TEST > + depends on VIDEO_DEV > + depends on ARCH_MEDIATEK || COMPILE_TEST > + depends on MTK_MMSYS This needs to be MTK_MMSYS || COMPILE_TEST. > + depends on HAS_DMA > + select VIDEOBUF2_DMA_CONTIG > + select V4L2_MEM2MEM_DEV > + select VIDEO_MEDIATEK_VPU > + select MTK_CMDQ > + select MTK_SCP > + default n > + help > + It is a v4l2 driver and present in MediaTek MT8183 SoC. > + The driver supports scaling and color space conversion. > + > + To compile this driver as a module, choose M here: the > + module will be called mtk-mdp3. > diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c > new file mode 100644 > index 000000000000..0c1675c6dce2 > --- /dev/null > +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c > @@ -0,0 +1,724 @@ > +static int mdp_m2m_s_selection(struct file *file, void *fh, > + struct v4l2_selection *s) > +{ > + struct mdp_m2m_ctx *ctx = fh_to_ctx(fh); > + struct mdp_frame *frame = ctx_get_frame(ctx, s->type); > + struct mdp_frame *capture; > + struct v4l2_rect r; > + struct device *dev = &ctx->mdp_dev->pdev->dev; > + bool valid = false; > + int ret; > + > + if (s->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) > + valid = (s->target == V4L2_SEL_TGT_CROP); > + else if (s->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) > + valid = (s->target == V4L2_SEL_TGT_COMPOSE); > + > + if (!valid) { > + dev_err(dev, "[%s:%d] invalid type:%u target:%u", __func__, > + ctx->id, s->type, s->target); This needs to be dev_dbg: you don't want to spam the kernel log for userspace errors. > + return -EINVAL; > + } > + > + ret = mdp_try_crop(ctx, &r, s, frame); > + if (ret) > + return ret; > + capture = ctx_get_frame(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); > + > + if (mdp_target_is_crop(s->target)) > + capture->crop.c = r; > + else > + capture->compose = r; > + > + s->r = r; > + > + return 0; > +} I can modify these two changes myself if you are OK with that. Just let me know. If you prefer to post a v26 that's OK too. Regards, Hans