mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno  <angelogioacchino.delregno@collabora.com>
To: "CK Hu (胡俊光)" <ck.hu@mediatek.com>,
	"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>
Cc: "dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mediatek@lists.infradead.org" 
	<linux-mediatek@lists.infradead.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"kernel@collabora.com" <kernel@collabora.com>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"wenst@chromium.org" <wenst@chromium.org>
Subject: Re: [PATCH 1/3] drm/mediatek: Dynamically allocate CMDQ and use helper functions
Date: Thu, 3 Aug 2023 10:25:36 +0200	[thread overview]
Message-ID: <d29d342b-37f4-8d7b-ed7d-c441cc928393@collabora.com> (raw)
In-Reply-To: <e8e60556e53ccf319358cbef203bc84c418a352b.camel@mediatek.com>

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
>>



  reply	other threads:[~2023-08-03  8:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-23  9:49 [PATCH 0/3] MediaTek DRM: Clean up CMDQ support and ifdefs AngeloGioacchino Del Regno
2023-06-23  9:49 ` [PATCH 1/3] drm/mediatek: Dynamically allocate CMDQ and use helper functions AngeloGioacchino Del Regno
2023-08-02  6:24   ` CK Hu (胡俊光)
2023-08-02 10:41     ` AngeloGioacchino Del Regno
2023-08-03  6:28       ` CK Hu (胡俊光)
2023-08-03  8:25         ` AngeloGioacchino Del Regno [this message]
2023-08-03  8:37           ` CK Hu (胡俊光)
2024-02-06 13:33             ` AngeloGioacchino Del Regno
2024-02-07  3:49               ` CK Hu (胡俊光)
2023-06-23  9:49 ` [PATCH 2/3] drm/mediatek: Remove all preprocessor ifs for CONFIG_MTK_CMDQ AngeloGioacchino Del Regno
2023-06-23  9:49 ` [PATCH 3/3] drm/mediatek: Move CMDQ setup to mtk_drm_cmdq_init() function AngeloGioacchino Del Regno
2023-06-23 12:49 ` [PATCH 0/3] MediaTek DRM: Clean up CMDQ support and ifdefs Alexandre Mergnat
2023-07-19  7:41   ` AngeloGioacchino Del Regno
2023-07-21 12:03     ` Alexandre Mergnat

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d29d342b-37f4-8d7b-ed7d-c441cc928393@collabora.com \
    --to=angelogioacchino.delregno@collabora.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=ck.hu@mediatek.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=wenst@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®