Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp2051047rwo; Thu, 3 Aug 2023 04:06:54 -0700 (PDT) X-Google-Smtp-Source: APBJJlGujn1vIv4Ys4PU/tFJg6024TnhY62viu1zvploMsi3l355713JFJPmXGTVQPs6M0ZRKe4H X-Received: by 2002:a17:902:e812:b0:1bc:2c79:c6b6 with SMTP id u18-20020a170902e81200b001bc2c79c6b6mr6444823plg.28.1691060813729; Thu, 03 Aug 2023 04:06:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691060813; cv=none; d=google.com; s=arc-20160816; b=UyLY/OY5gdatPn2PL76IiURmdH3kLH3mogQp1wYAvZ+vO8rqDGlpzaSQEM0TvNla39 qEPsKCJ4UrNm/ZsKHFJ0irPcC5Z3xOuvGQvm7skDel46zN7hyUuddcG9r2cuLVOR/Af8 62b/PTXGJElVxYw515vLXGpW7d09o2EZSusAVtqPSjwi6xEt+ZDSwxHhIBwFHmDh6Eg/ fT6ZfSZNQS/1oXfcE/DDFPIXLAeGRwIP5hjGnz00bePWZeZxL9X3918mUvOAWfS3CiBx ZbGwvkprKfVSpE/YEHrNaN+HlIwdSPHvath6Sgom5ym8ylCkpCdq1AZAMsB6MojeezZK Bluw== 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:dkim-signature; bh=ZAm1Vs4scNLzGU5vzBEC9YvK51IbNu4cZKqIaOZl7jQ=; fh=MFpJh8z6gILffQ1GtdFq//9EE2zxx18uoNXgIiIyA2s=; b=va+7xOkRiEh3N5atr/1/Md6jB+6hOwNNzMSMbT35m6wFXfTishJRRaHJXxu2bsSq3t M5P7KL54TyqxLrB8+73XNKQkBL3QIEGJaNV7PqPIWa0fRjcz2Bqb1FvlFNkxdtjyiG2d E+UVDq41qSFI9sZZreWAbUtSPYYE4MScEJgXSetrU451CxGGB0XhNOM2CKDyWZUo8GSK xRplz22vj1v0Dvpazz5EZmxwqs9vbQu2ZJDUlQqd2r3GZHT5LSYe2I10MNTQWNDFQIR2 35CPnIx/dl50N5pBY70SpZfDshgYy8XNnSwwchb9D9tL7f2OYSMSxYLyS79QIRDj5FNd ndPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=JzmgDeex; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ks14-20020a170903084e00b001bb9f190bafsi12217087plb.526.2023.08.03.04.06.40; Thu, 03 Aug 2023 04:06:53 -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; dkim=pass header.i=@collabora.com header.s=mail header.b=JzmgDeex; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234541AbjHCI26 (ORCPT + 99 others); Thu, 3 Aug 2023 04:28:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234531AbjHCI2c (ORCPT ); Thu, 3 Aug 2023 04:28:32 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6810049DD for ; Thu, 3 Aug 2023 01:25:40 -0700 (PDT) Received: from [192.168.1.100] (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id A224D6607194; Thu, 3 Aug 2023 09:25:38 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1691051139; bh=TEhHelHWy/G+e1WHAuobmA5sOxMF1G+L/ocUHcpV8Uw=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=JzmgDeexKk7+ChgXJTlAFfgSa8DcLuBv+UCS4JaQr7/y80olrmrhg3iJ5EInnBzrM DJFHO0xueB67fkHRQdbD01NNvWXht+9KH3bccgoMmQnsvaAtjDoC47LdIq2NIVTXUW BpfQM5RQ4TfbAohVhWHyGRwSKDhNpOKiJcvZLvLlE9Ylou88KnG7e/v8abwK02lOm2 gwpsLoii/Y3juNAeyoy/xAtjnafTRlMPE+cnpV24SPK9skhqjh5VTB1MLEGWX5YAkT Tmgmfp0pa4l89ino81B5X7fz1aqAsWsuV9D1tUtBOh1uQ8qMDsdqkQXQmRjUFbpsQI FIdj3Ae0nU2Nw== Message-ID: Date: Thu, 3 Aug 2023 10:25:36 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH 1/3] drm/mediatek: Dynamically allocate CMDQ and use helper functions Content-Language: en-US To: =?UTF-8?B?Q0sgSHUgKOiDoeS/iuWFiSk=?= , "chunkuang.hu@kernel.org" Cc: "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" , "linux-mediatek@lists.infradead.org" , "linux-arm-kernel@lists.infradead.org" , "kernel@collabora.com" , "matthias.bgg@gmail.com" , "wenst@chromium.org" References: <20230623094931.117918-1-angelogioacchino.delregno@collabora.com> <20230623094931.117918-2-angelogioacchino.delregno@collabora.com> <0acd286d-d4f4-97b2-c296-b2860a00def6@collabora.com> From: AngeloGioacchino Del Regno In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,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 Il 03/08/23 08:28, CK Hu (胡俊光) ha scritto: > Hi, Angelo: > > On Wed, 2023-08-02 at 12:41 +0200, AngeloGioacchino Del Regno wrote: >> Il 02/08/23 08:24, CK Hu (胡俊光) ha scritto: >>> Hi, Angelo: >>> >>> On Fri, 2023-06-23 at 11:49 +0200, AngeloGioacchino Del Regno >>> wrote: >>>> >>>> External email : Please do not click links or open attachments >>>> until >>>> you have verified the sender or the content. >>>> Instead of stack allocating the cmdq_client and cmdq_handle >>>> structures >>>> switch them to pointers, allowing us to migrate this driver to >>>> use >>>> the >>>> common functions provided by mtk-cmdq-helper. >>>> In order to do this, it was also necessary to add a `priv` >>>> pointer to >>>> struct cmdq_client, as that's used to pass (in this case) a >>>> mtk_crtc >>>> handle to the ddp_cmdq_cb() mailbox RX callback function. >>>> >>>> Signed-off-by: AngeloGioacchino Del Regno < >>>> angelogioacchino.delregno@collabora.com> >>>> --- >>>> drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 107 +++++++-------- >>>> ------- >>>> -- >>>> include/linux/soc/mediatek/mtk-cmdq.h | 1 + >>>> 2 files changed, 32 insertions(+), 76 deletions(-) >>>> >>>> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c >>>> b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c >>>> index 0df62b076f49..b63289ab6787 100644 >>>> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c >>>> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c >>>> @@ -50,8 +50,8 @@ struct mtk_drm_crtc { >>>> bool pending_async_planes; >>>> >>>> #if IS_REACHABLE(CONFIG_MTK_CMDQ) >>>> - struct cmdq_client cmdq_client; >>>> - struct cmdq_pkt cmdq_handle; >>>> + struct cmdq_client *cmdq_client; >>>> + struct cmdq_pkt *cmdq_handle; >>>> u32 cmdq_event; >>>> u32 cmdq_vblank_cnt; >>>> wait_queue_head_t cb_blocking_queue; >>>> @@ -108,47 +108,6 @@ static void mtk_drm_finish_page_flip(struct >>>> mtk_drm_crtc *mtk_crtc) >>>> } >>>> } >>>> >>>> -#if IS_REACHABLE(CONFIG_MTK_CMDQ) >>>> -static int mtk_drm_cmdq_pkt_create(struct cmdq_client *client, >>>> struct cmdq_pkt *pkt, >>>> - size_t size) >>>> -{ >>>> - struct device *dev; >>>> - dma_addr_t dma_addr; >>>> - >>>> - pkt->va_base = kzalloc(size, GFP_KERNEL); >>>> - if (!pkt->va_base) { >>>> - kfree(pkt); >>>> - return -ENOMEM; >>>> - } >>>> - pkt->buf_size = size; >>>> - pkt->cl = (void *)client; >>> >>> I have a plan to remove cl in struct cmdq_pkt. But this >>> modification >>> would make this plan more difficult. So I would pending this patch >>> until cl is removed from struct cmdq_pkt. >>> >> >> I think that this ifdef cleanup is more urgent than the removal of >> `cl` from >> struct cmdq_pkt, as those ifdefs shouldn't have reached upstream in >> the first >> place, don't you agree? > > I think removing ifdefs and using helper function are different things. > You could remove ifdefs and keep mtk_drm_cmdq_pkt_create(). > I chose to do it like that because this function would otherwise be a 100% duplicate of the related cmdq helper :-) > Regards, > CK > >> >> Regards, >> Angelo >>