linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
To: "yunfei.dong@mediatek.com" <yunfei.dong@mediatek.com>,
	Alexandre Courbot <acourbot@chromium.org>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Tzung-Bi Shih <tzungbi@chromium.org>,
	Tiffany Lin <tiffany.lin@mediatek.com>,
	Andrew-CT Chen <andrew-ct.chen@mediatek.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Tomasz Figa <tfiga@google.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Daniel Vetter <daniel@ffwll.ch>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Hsin-Yi Wang <hsinyi@chromium.org>,
	Fritz Koenig <frkoenig@chromium.org>,
	Irui Wang <irui.wang@mediatek.com>,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	srv_heupstream@mediatek.com, linux-mediatek@lists.infradead.org,
	Project_Global_Chrome_Upstream_Group@mediatek.com
Subject: Re: [PATCH v6, 15/15] media: mtk-vcodec: Use codec type to separate different hardware
Date: Fri, 3 Sep 2021 14:42:12 +0200	[thread overview]
Message-ID: <0100e846-7ab0-347e-c737-aa6d86fde4af@collabora.com> (raw)
In-Reply-To: <5d53649c1fe2d6d6942e1dd31cdf7a0def46acab.camel@mediatek.com>



On 02.09.21 08:05, yunfei.dong@mediatek.com wrote:
> On Wed, 2021-09-01 at 14:17 +0200, Dafna Hirschfeld wrote:
> Hi Dafna,
> 
> Thanks for your suggestion.
>> Hi
>>
>> On 01.09.21 10:32, Yunfei Dong wrote:
>>> There are just one core thread, in order to separeate different
>>> hardware, using codec type to separeate it in scp driver.
>>
>> this code seems to relate to the vpu driver not the scp driver.
>> Is there a corresponding code added to the vpu driver that test the
>> codec_type?
>>
> Vpu is video processor unit, used to connect with micro processor.
> In mt8173: vdec_vpu_if.c -> mtk_vpu.c -> micro processor
> In mt8192/mt8183: vdec_vpu_if.c -> mtk_scp.c ->micro processor
> 
> This init/dec start/dec_end interfaces are the same for vpu and scp.
>>>
>>> Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
>>> ---
>>>    .../media/platform/mtk-vcodec/vdec_ipi_msg.h  | 12 ++++---
>>>    .../media/platform/mtk-vcodec/vdec_vpu_if.c   | 34
>>> ++++++++++++++++---
>>>    .../media/platform/mtk-vcodec/vdec_vpu_if.h   |  4 +++
>>>    3 files changed, 41 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/drivers/media/platform/mtk-vcodec/vdec_ipi_msg.h
>>> b/drivers/media/platform/mtk-vcodec/vdec_ipi_msg.h
>>> index 9d8079c4f976..c488f0c40190 100644
>>> --- a/drivers/media/platform/mtk-vcodec/vdec_ipi_msg.h
>>> +++ b/drivers/media/platform/mtk-vcodec/vdec_ipi_msg.h
>>> @@ -35,6 +35,8 @@ enum vdec_ipi_msgid {
>>>     * @msg_id	: vdec_ipi_msgid
>>>     * @vpu_inst_addr : VPU decoder instance address. Used if ABI
>>> version < 2.
>>>     * @inst_id     : instance ID. Used if the ABI version >= 2.
>>> + * @codec_type	: Codec fourcc
>>> + * @reserved	: reserved param
>>>     */
>>>    struct vdec_ap_ipi_cmd {
>>>    	uint32_t msg_id;
>>> @@ -42,6 +44,8 @@ struct vdec_ap_ipi_cmd {
>>>    		uint32_t vpu_inst_addr;
>>>    		uint32_t inst_id;
>>>    	};
>>> +	uint32_t codec_type;
>>> +	uint32_t reserved;
>>>    };
>>>    
>>>    /**
>>> @@ -59,12 +63,12 @@ struct vdec_vpu_ipi_ack {
>>>    /**
>>>     * struct vdec_ap_ipi_init - for AP_IPIMSG_DEC_INIT
>>>     * @msg_id	: AP_IPIMSG_DEC_INIT
>>> - * @reserved	: Reserved field
>>> + * @codec_type	: Codec fourcc
>>>     * @ap_inst_addr	: AP video decoder instance address
>>>     */
>>>    struct vdec_ap_ipi_init {
>>>    	uint32_t msg_id;
>>> -	uint32_t reserved;
>>> +	uint32_t codec_type;
>>>    	uint64_t ap_inst_addr;
>>>    };
>>>    
>>> @@ -77,7 +81,7 @@ struct vdec_ap_ipi_init {
>>>     *	H264 decoder [0]:buf_sz [1]:nal_start
>>>     *	VP8 decoder  [0]:width/height
>>>     *	VP9 decoder  [0]:profile, [1][2] width/height
>>> - * @reserved	: Reserved field
>>> + * @codec_type	: Codec fourcc
>>>     */
>>>    struct vdec_ap_ipi_dec_start {
>>>    	uint32_t msg_id;
>>> @@ -86,7 +90,7 @@ struct vdec_ap_ipi_dec_start {
>>>    		uint32_t inst_id;
>>>    	};
>>>    	uint32_t data[3];
>>> -	uint32_t reserved;
>>> +	uint32_t codec_type;
>>>    };
>>>    
>>>    /**
>>> diff --git a/drivers/media/platform/mtk-vcodec/vdec_vpu_if.c
>>> b/drivers/media/platform/mtk-vcodec/vdec_vpu_if.c
>>> index bfd8e87dceff..c84fac52fe26 100644
>>> --- a/drivers/media/platform/mtk-vcodec/vdec_vpu_if.c
>>> +++ b/drivers/media/platform/mtk-vcodec/vdec_vpu_if.c
>>> @@ -100,18 +100,29 @@ static void vpu_dec_ipi_handler(void *data,
>>> unsigned int len, void *priv)
>>>    
>>>    static int vcodec_vpu_send_msg(struct vdec_vpu_inst *vpu, void
>>> *msg, int len)
>>>    {
>>> -	int err;
>>> +	int err, id, msgid;
>>>    
>>> -	mtk_vcodec_debug(vpu, "id=%X", *(uint32_t *)msg);
>>> +	msgid = *(uint32_t *)msg;
>>> +	mtk_vcodec_debug(vpu, "id=%X", msgid);
>>>    
>>>    	vpu->failure = 0;
>>>    	vpu->signaled = 0;
>>>    
>>> -	err = mtk_vcodec_fw_ipi_send(vpu->ctx->dev->fw_handler, vpu-
>>>> id, msg,
>>> +	if (vpu->ctx->dev->vdec_pdata->hw_arch ==
>>> MTK_VDEC_LAT_SINGLE_CORE) {
>>> +		if (msgid == AP_IPIMSG_DEC_CORE ||
>>> +			msgid == AP_IPIMSG_DEC_CORE_END)
>>> +			id = vpu->core_id;
>>> +		else
>>> +			id = vpu->id;
>>> +	} else {
>>> +		id = vpu->id;
>>> +	}
>>> +
>>> +	err = mtk_vcodec_fw_ipi_send(vpu->ctx->dev->fw_handler, id,
>>> msg,
>>>    				     len, 2000);
>>
>> so
>>>    	if (err) {
>>>    		mtk_vcodec_err(vpu, "send fail vpu_id=%d msg_id=%X
>>> status=%d",
>>> -			       vpu->id, *(uint32_t *)msg, err);
>>> +			       id, msgid, err);
>>>    		return err;
>>>    	}
>>>    
>>> @@ -131,6 +142,7 @@ static int vcodec_send_ap_ipi(struct
>>> vdec_vpu_inst *vpu, unsigned int msg_id)
>>>    		msg.vpu_inst_addr = vpu->inst_addr;
>>>    	else
>>>    		msg.inst_id = vpu->inst_id;
>>> +	msg.codec_type = vpu->codec_type;
>>>    
>>>    	err = vcodec_vpu_send_msg(vpu, &msg, sizeof(msg));
>>>    	mtk_vcodec_debug(vpu, "- id=%X ret=%d", msg_id, err);
>>> @@ -149,14 +161,25 @@ int vpu_dec_init(struct vdec_vpu_inst *vpu)
>>>    
>>>    	err = mtk_vcodec_fw_ipi_register(vpu->ctx->dev->fw_handler,
>>> vpu->id,
>>>    					 vpu->handler, "vdec", NULL);
>>> -	if (err != 0) {
>>> +	if (err) {
>>
>> could be nice to send a patch with other such fixes,
>> anyway it is better to send unrelated fixes in a separate patch
>>
> will fix in next patch.
>>>    		mtk_vcodec_err(vpu, "vpu_ipi_register fail status=%d",
>>> err);
>>>    		return err;
>>>    	}
>>>    
>>> +	if (vpu->ctx->dev->vdec_pdata->hw_arch ==
>>> MTK_VDEC_LAT_SINGLE_CORE) {
>>> +		err = mtk_vcodec_fw_ipi_register(vpu->ctx->dev-
>>>> fw_handler,
>>> +					 vpu->core_id, vpu->handler,
>>> +					 "vdec", NULL);
>>> +		if (err) {
>>> +			mtk_vcodec_err(vpu, "vpu_ipi_register core fail
>>> status=%d", err);
>>> +			return err;
>>> +		}
>>> +	}
>>> +
>>>    	memset(&msg, 0, sizeof(msg));
>>>    	msg.msg_id = AP_IPIMSG_DEC_INIT;
>>>    	msg.ap_inst_addr = (unsigned long)vpu;
>>> +	msg.codec_type = vpu->codec_type;
>>>    
>>>    	mtk_vcodec_debug(vpu, "vdec_inst=%p", vpu);
>>>    
>>> @@ -187,6 +210,7 @@ int vpu_dec_start(struct vdec_vpu_inst *vpu,
>>> uint32_t *data, unsigned int len)
>>>    
>>>    	for (i = 0; i < len; i++)
>>>    		msg.data[i] = data[i];
>>> +	msg.codec_type = vpu->codec_type;
>>
>> I don't see where is the vpu->codec_type initialzied
>>
> This patch just add interface to support core hardware decode, in next
> serial patches based on these will used codec type to separate after
> these base patches are stable.

Then why not send it on the same series?

Thanks,
Dafna

>> Thanks,
>> Dafna
>>
> Thanks
> Yunfei Dong
>>>    
>>>    	err = vcodec_vpu_send_msg(vpu, (void *)&msg, sizeof(msg));
>>>    	mtk_vcodec_debug(vpu, "- ret=%d", err);
>>> diff --git a/drivers/media/platform/mtk-vcodec/vdec_vpu_if.h
>>> b/drivers/media/platform/mtk-vcodec/vdec_vpu_if.h
>>> index ae24b75d1649..802660770a87 100644
>>> --- a/drivers/media/platform/mtk-vcodec/vdec_vpu_if.h
>>> +++ b/drivers/media/platform/mtk-vcodec/vdec_vpu_if.h
>>> @@ -14,6 +14,7 @@ struct mtk_vcodec_ctx;
>>>    /**
>>>     * struct vdec_vpu_inst - VPU instance for video codec
>>>     * @id          : ipi msg id for each decoder
>>> + * @core_id     : core id used to separate different hardware
>>>     * @vsi         : driver structure allocated by VPU side and
>>> shared to AP side
>>>     *                for control and info share
>>>     * @failure     : VPU execution result status, 0: success,
>>> others: fail
>>> @@ -26,9 +27,11 @@ struct mtk_vcodec_ctx;
>>>     * @dev		: platform device of VPU
>>>     * @wq          : wait queue to wait VPU message ack
>>>     * @handler     : ipi handler for each decoder
>>> + * @codec_type     : used codec type to separate different codecs
>>>     */
>>>    struct vdec_vpu_inst {
>>>    	int id;
>>> +	int core_id;
>>>    	void *vsi;
>>>    	int32_t failure;
>>>    	uint32_t inst_addr;
>>> @@ -38,6 +41,7 @@ struct vdec_vpu_inst {
>>>    	struct mtk_vcodec_ctx *ctx;
>>>    	wait_queue_head_t wq;
>>>    	mtk_vcodec_ipi_handler handler;
>>> +	unsigned int codec_type;
>>>    };
>>>    
>>>    /**
>>>

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

  reply	other threads:[~2021-09-03 12:42 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01  8:32 [PATCH v6, 00/15] Using component framework to support multi hardware decode Yunfei Dong
2021-09-01  8:32 ` [PATCH v6, 01/15] media: mtk-vcodec: Get numbers of register bases from DT Yunfei Dong
2021-09-01  8:32 ` [PATCH v6, 02/15] media: mtk-vcodec: Align vcodec wake up interrupt interface Yunfei Dong
2021-09-01  8:32 ` [PATCH v6, 03/15] media: mtk-vcodec: Refactor vcodec pm interface Yunfei Dong
2021-09-01  8:32 ` [PATCH v6, 04/15] media: mtk-vcodec: Use component framework to manage each hardware information Yunfei Dong
2021-09-01  8:32 ` [PATCH v6, 05/15] dt-bindings: media: mtk-vcodec: Separate video encoder and decoder dt-bindings Yunfei Dong
2021-09-01  8:32 ` [PATCH v6, 06/15] media: mtk-vcodec: Use pure single core for MT8183 Yunfei Dong
2021-09-01  8:32 ` [PATCH v6, 07/15] media: mtk-vcodec: Add irq interface for multi hardware Yunfei Dong
2021-09-01  8:32 ` [PATCH v6, 08/15] media: mtk-vcodec: Add msg queue feature for lat and core architecture Yunfei Dong
2021-09-01  8:32 ` [PATCH v6, 09/15] media: mtk-vcodec: Generalize power and clock on/off interfaces Yunfei Dong
2021-09-01  8:32 ` [PATCH v6, 10/15] media: mtk-vcodec: Add new interface to lock different hardware Yunfei Dong
2021-09-01  8:32 ` [PATCH v6, 11/15] media: mtk-vcodec: Add core thread Yunfei Dong
2021-09-01  8:32 ` [PATCH v6, 12/15] media: mtk-vcodec: Support 34bits dma address for vdec Yunfei Dong
2021-10-07 11:37   ` Benjamin Gaignard
2021-10-11  5:42     ` yunfei.dong
2021-09-01  8:32 ` [PATCH v6, 13/15] dt-bindings: media: mtk-vcodec: Adds decoder dt-bindings for mt8192 Yunfei Dong
2021-09-02 12:03   ` Rob Herring
2021-09-01  8:32 ` [PATCH v6, 14/15] media: mtk-vcodec: Add core dec and dec end ipi msg Yunfei Dong
2021-09-01  8:32 ` [PATCH v6, 15/15] media: mtk-vcodec: Use codec type to separate different hardware Yunfei Dong
2021-09-01 12:17   ` Dafna Hirschfeld
2021-09-02  6:05     ` yunfei.dong
2021-09-03 12:42       ` Dafna Hirschfeld [this message]
2021-09-04  3:00         ` yunfei.dong
2021-09-02 16:30 ` [PATCH v6, 00/15] Using component framework to support multi hardware decode Ezequiel Garcia
2021-09-03  3:08   ` yunfei.dong
2021-09-14 12:16     ` yunfei.dong
2021-09-26  8:27       ` yunfei.dong
2021-09-26 14:51         ` Ezequiel Garcia
2021-09-27 17:02           ` Steve Cho
2021-10-05  6:13             ` Tomasz Figa
2021-10-13  1:17           ` yunfei.dong
2021-10-14 12:38             ` Ezequiel Garcia
2021-09-03  4:09   ` Chen-Yu Tsai
2021-09-27 16:56 ` Steve Cho
2021-09-27 17:31   ` Steve Cho

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=0100e846-7ab0-347e-c737-aa6d86fde4af@collabora.com \
    --to=dafna.hirschfeld@collabora.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=acourbot@chromium.org \
    --cc=andrew-ct.chen@mediatek.com \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=frkoenig@chromium.org \
    --cc=hsinyi@chromium.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=irui.wang@mediatek.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=srv_heupstream@mediatek.com \
    --cc=tfiga@google.com \
    --cc=tiffany.lin@mediatek.com \
    --cc=tzungbi@chromium.org \
    --cc=yunfei.dong@mediatek.com \
    /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;
as well as URLs for NNTP newsgroup(s).