From patchwork Mon Mar 27 03:13:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TW91ZHkgSG8gKOS9leWul+WOnyk=?= X-Patchwork-Id: 75186 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1246098vqo; Sun, 26 Mar 2023 20:24:05 -0700 (PDT) X-Google-Smtp-Source: AKy350ahcxxMPB2scfdm03Sq1ubsTP9/Hzc7XkygBEvDcfvrpY6+UQNLp391EZdZFOF+Og60lUng X-Received: by 2002:a17:906:6816:b0:92f:abff:b4cc with SMTP id k22-20020a170906681600b0092fabffb4ccmr10512495ejr.77.1679887445660; Sun, 26 Mar 2023 20:24:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679887445; cv=none; d=google.com; s=arc-20160816; b=WZVt6p+r6lwbXzk0ZatNMeKfM1vOWFshUVK3YqBTR28Y3hXR3xBBcyJNka1HeP65C0 gDS6j394afNK8Tpsj4Hud0RYssTuaoBZNxvr+1Rp24Cf8foB6n6j6UMysoB/h+mHgjsD euLJ/2qWlva+NdL1cslSLeQlvWn94spoFZK5gzhTR8UbjcvoWSpuFyyu4sNXUZAiEBxp Yo6SyjskuBfzaebPJKWbxu66LRu1UngdNZVQpHvLSloKubB9bGCoMNnW3Rjx7hDRXGVG O+bmbffWtxNPo2IF0alEMDbkbqR0KAGtshowJ4pHFNqRuvU0A8QepopAWsqieeSGU2h9 eteA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=jSagPzDdp3s9C8kqWieBA8h2cxt7J5Zsd2dAJbKfjEY=; b=fTwFNtTPB4zcjh52UXlOYVIET8o4EmC424OF/ExNmR2Nt6e6O/lvnWBmvvvgNc7e/y qeyJVON7nxA9tdxDJjOazB6dX/s6uYC7Wbkl7XCQuu5wv/fQy4KnINqMlBL5pmRzaRcw lUFfH6q8Pw8JV6g+84KtaIBWmrE8S/T25oPBEmrd9sNpGHQgsmCneq1BvXprwLtxN+Q5 ciMAedsw8kGWuE/hgdFNfUvXEg9I2ZdBapd1O6igRKOQQlRxSsaHx3aUPV9lGrkAoKUI ccdgix267di/fb4hMpO3kluwccxHPH2EOvePcv/zWC+xO0R0kNQJp+xvg9iRbt/wOHVE Ve4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=P1CfO+FB; 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=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sb36-20020a1709076da400b0093d1c4a53aesi11077169ejc.240.2023.03.26.20.23.42; Sun, 26 Mar 2023 20:24:05 -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=@mediatek.com header.s=dk header.b=P1CfO+FB; 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=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232202AbjC0DPL (ORCPT + 99 others); Sun, 26 Mar 2023 23:15:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232318AbjC0DON (ORCPT ); Sun, 26 Mar 2023 23:14:13 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F90449D4; Sun, 26 Mar 2023 20:13:50 -0700 (PDT) X-UUID: 5e9fba8ecc4d11edb6b9f13eb10bd0fe-20230327 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=jSagPzDdp3s9C8kqWieBA8h2cxt7J5Zsd2dAJbKfjEY=; b=P1CfO+FB53j9T7ff70BMPKDtrarcpnZHzbtgbBrhGfvyF6IHkCpNPDaPHz4Qt6o3Bdt2JOr7NXgw6lebdHJK/mo2durZ/Bg2/yU6JWhgNCAYiPZQvi6qWR9MESGmZxOeHe4kExofFVmnWoij2pMNnsk6Q7PsxPeXWy9TEGoBs0c=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:55c96e31-1cf7-41f4-8c74-336666175ecf,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:120426c,CLOUDID:bff870b4-beed-4dfc-bd9c-e1b22fa6ccc4,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-UUID: 5e9fba8ecc4d11edb6b9f13eb10bd0fe-20230327 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1501530321; Mon, 27 Mar 2023 11:13:39 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Mon, 27 Mar 2023 11:13:37 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Mon, 27 Mar 2023 11:13:37 +0800 From: Moudy Ho To: Mauro Carvalho Chehab , Matthias Brugger , Hans Verkuil , Ping-Hsun Wu CC: , , , , , Moudy Ho Subject: [PATCH v7 12/12] media: platform: mtk-mdp3: reconfigure shared memory Date: Mon, 27 Mar 2023 11:13:35 +0800 Message-ID: <20230327031335.9663-13-moudy.ho@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230327031335.9663-1-moudy.ho@mediatek.com> References: <20230327031335.9663-1-moudy.ho@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable 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?1761489658286387117?= X-GMAIL-MSGID: =?utf-8?q?1761489658286387117?= For performance and multi-chip support, use dynamic layout instead of statically configured pools. Divide the shared memory into the 3 64-bit aligned layouts listed below: vpu->param_addr -> +-----------------------------------------+ | | | To SCP : Input frame parameters | | (struct img_ipi_frameparam) | | | +-----------------------------------------+ vpu->work_addr -> +-----------------------------------------+ | | | In SCP : Reserve for SCP calculation | | | +-----------------------------------------+ vpu->config_addr -> +-----------------------------------------+ | | | From SCP : Output component config | | (struct img_config) | | | +-----------------------------------------+ Signed-off-by: Moudy Ho --- .../platform/mediatek/mdp3/mdp_sm_mt8183.h | 4 +- .../platform/mediatek/mdp3/mtk-mdp3-m2m.c | 13 +- .../platform/mediatek/mdp3/mtk-mdp3-m2m.h | 1 - .../platform/mediatek/mdp3/mtk-mdp3-vpu.c | 193 ++++++++---------- .../platform/mediatek/mdp3/mtk-mdp3-vpu.h | 29 +-- 5 files changed, 95 insertions(+), 145 deletions(-) diff --git a/drivers/media/platform/mediatek/mdp3/mdp_sm_mt8183.h b/drivers/media/platform/mediatek/mdp3/mdp_sm_mt8183.h index effc75615af9..85637084520f 100644 --- a/drivers/media/platform/mediatek/mdp3/mdp_sm_mt8183.h +++ b/drivers/media/platform/mediatek/mdp3/mdp_sm_mt8183.h @@ -11,8 +11,8 @@ /* * ISP-MDP generic output information - * MD5 of the target SCP blob: - * 6da52bdcf4bf76a0983b313e1d4745d6 + * MD5 of the target SCP prebuild: + * 2d995ddb5c3b0cf26e96d6a823481886 */ #define IMG_MAX_SUBFRAMES_8183 14 diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c index 27e1b1b8c6b4..a298c1b15b9e 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c @@ -87,14 +87,14 @@ static void mdp_m2m_device_run(void *priv) dst_vb = v4l2_m2m_next_dst_buf(ctx->m2m_ctx); mdp_set_dst_config(¶m.outputs[0], frame, &dst_vb->vb2_buf); - ret = mdp_vpu_process(&ctx->vpu, ¶m); + ret = mdp_vpu_process(&ctx->mdp_dev->vpu, ¶m); if (ret) { dev_err(&ctx->mdp_dev->pdev->dev, "VPU MDP process failed: %d\n", ret); goto worker_end; } - task.config = ctx->vpu.config; + task.config = ctx->mdp_dev->vpu.config; task.param = ¶m; task.composes[0] = &frame->compose; task.cmdq_cb = NULL; @@ -150,11 +150,6 @@ static int mdp_m2m_start_streaming(struct vb2_queue *q, unsigned int count) if (!mdp_m2m_ctx_is_state_set(ctx, MDP_VPU_INIT)) { ret = mdp_vpu_get_locked(ctx->mdp_dev); - if (ret) - return ret; - - ret = mdp_vpu_ctx_init(&ctx->vpu, &ctx->mdp_dev->vpu, - MDP_DEV_M2M); if (ret) { dev_err(&ctx->mdp_dev->pdev->dev, "VPU init failed %d\n", ret); @@ -641,10 +636,8 @@ static int mdp_m2m_release(struct file *file) mutex_lock(&mdp->m2m_lock); v4l2_m2m_ctx_release(ctx->m2m_ctx); - if (mdp_m2m_ctx_is_state_set(ctx, MDP_VPU_INIT)) { - mdp_vpu_ctx_deinit(&ctx->vpu); + if (mdp_m2m_ctx_is_state_set(ctx, MDP_VPU_INIT)) mdp_vpu_put_locked(mdp); - } v4l2_ctrl_handler_free(&ctx->ctrl_handler); v4l2_fh_del(&ctx->fh); diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.h b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.h index 61ddbaf1bf13..dfc59e5b3b87 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.h +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.h @@ -33,7 +33,6 @@ struct mdp_m2m_ctx { struct v4l2_ctrl_handler ctrl_handler; struct mdp_m2m_ctrls ctrls; struct v4l2_m2m_ctx *m2m_ctx; - struct mdp_vpu_ctx vpu; u32 frame_count[MDP_M2M_MAX]; struct mdp_frameparam curr_param; diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-vpu.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-vpu.c index a72bed927bb6..49fc2e9d45dd 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-vpu.c +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-vpu.c @@ -10,7 +10,6 @@ #include "mtk-mdp3-core.h" #define MDP_VPU_MESSAGE_TIMEOUT 500U -#define vpu_alloc_size 0x600000 static inline struct mdp_dev *vpu_to_mdp(struct mdp_vpu_dev *vpu) { @@ -19,23 +18,63 @@ static inline struct mdp_dev *vpu_to_mdp(struct mdp_vpu_dev *vpu) static int mdp_vpu_shared_mem_alloc(struct mdp_vpu_dev *vpu) { - if (vpu->work && vpu->work_addr) - return 0; + struct device *dev; - vpu->work = dma_alloc_coherent(scp_get_device(vpu->scp), vpu_alloc_size, - &vpu->work_addr, GFP_KERNEL); + if (IS_ERR_OR_NULL(vpu)) + goto err_return; - if (!vpu->work) - return -ENOMEM; - else - return 0; + dev = scp_get_device(vpu->scp); + + if (!vpu->param) { + vpu->param = dma_alloc_wc(dev, vpu->param_size, + &vpu->param_addr, GFP_KERNEL); + if (!vpu->param) + goto err_return; + } + + if (!vpu->work) { + vpu->work = dma_alloc_wc(dev, vpu->work_size, + &vpu->work_addr, GFP_KERNEL); + if (!vpu->work) + goto err_free_param; + } + + if (!vpu->config) { + vpu->config = dma_alloc_wc(dev, vpu->config_size, + &vpu->config_addr, GFP_KERNEL); + if (!vpu->config) + goto err_free_work; + } + + return 0; + +err_free_work: + dma_free_wc(dev, vpu->work_size, vpu->work, vpu->work_addr); + vpu->work = NULL; +err_free_param: + dma_free_wc(dev, vpu->param_size, vpu->param, vpu->param_addr); + vpu->param = NULL; +err_return: + return -ENOMEM; } void mdp_vpu_shared_mem_free(struct mdp_vpu_dev *vpu) { + struct device *dev; + + if (IS_ERR_OR_NULL(vpu)) + return; + + dev = scp_get_device(vpu->scp); + + if (vpu->param && vpu->param_addr) + dma_free_wc(dev, vpu->param_size, vpu->param, vpu->param_addr); + if (vpu->work && vpu->work_addr) - dma_free_coherent(scp_get_device(vpu->scp), vpu_alloc_size, - vpu->work, vpu->work_addr); + dma_free_wc(dev, vpu->work_size, vpu->work, vpu->work_addr); + + if (vpu->config && vpu->config_addr) + dma_free_wc(dev, vpu->config_size, vpu->config, vpu->config_addr); } static void mdp_vpu_ipi_handle_init_ack(void *data, unsigned int len, @@ -69,16 +108,16 @@ static void mdp_vpu_ipi_handle_frame_ack(void *data, unsigned int len, struct img_sw_addr *addr = (struct img_sw_addr *)data; struct img_ipi_frameparam *param = (struct img_ipi_frameparam *)(unsigned long)addr->va; - struct mdp_vpu_ctx *ctx = - (struct mdp_vpu_ctx *)(unsigned long)param->drv_data; + struct mdp_vpu_dev *vpu = + (struct mdp_vpu_dev *)(unsigned long)param->drv_data; if (param->state) { - struct mdp_dev *mdp = vpu_to_mdp(ctx->vpu_dev); + struct mdp_dev *mdp = vpu_to_mdp(vpu); dev_err(&mdp->pdev->dev, "VPU MDP failure:%d\n", param->state); } - ctx->vpu_dev->status = param->state; - complete(&ctx->vpu_dev->ipi_acked); + vpu->status = param->state; + complete(&vpu->ipi_acked); } int mdp_vpu_register(struct mdp_dev *mdp) @@ -157,9 +196,6 @@ int mdp_vpu_dev_init(struct mdp_vpu_dev *vpu, struct mtk_scp *scp, struct mdp_ipi_init_msg msg = { .drv_data = (unsigned long)vpu, }; - size_t mem_size; - phys_addr_t pool; - const size_t pool_size = sizeof(struct mdp_config_pool); struct mdp_dev *mdp = vpu_to_mdp(vpu); int err; @@ -172,34 +208,29 @@ int mdp_vpu_dev_init(struct mdp_vpu_dev *vpu, struct mtk_scp *scp, goto err_work_size; /* vpu work_size was set in mdp_vpu_ipi_handle_init_ack */ - mem_size = vpu_alloc_size; + mutex_lock(vpu->lock); + vpu->work_size = ALIGN(vpu->work_size, 64); + vpu->param_size = ALIGN(sizeof(struct img_ipi_frameparam), 64); + vpu->config_size = ALIGN(sizeof(struct img_config), 64); err = mdp_vpu_shared_mem_alloc(vpu); + mutex_unlock(vpu->lock); if (err) { dev_err(&mdp->pdev->dev, "VPU memory alloc fail!"); goto err_mem_alloc; } - pool = ALIGN((uintptr_t)vpu->work + vpu->work_size, 8); - if (pool + pool_size - (uintptr_t)vpu->work > mem_size) { - dev_err(&mdp->pdev->dev, - "VPU memory insufficient: %zx + %zx > %zx", - vpu->work_size, pool_size, mem_size); - err = -ENOMEM; - goto err_mem_size; - } - dev_dbg(&mdp->pdev->dev, - "VPU work:%pK pa:%pad sz:%zx pool:%pa sz:%zx (mem sz:%zx)", + "VPU param:%pK pa:%pad sz:%zx, work:%pK pa:%pad sz:%zx, config:%pK pa:%pad sz:%zx", + vpu->param, &vpu->param_addr, vpu->param_size, vpu->work, &vpu->work_addr, vpu->work_size, - &pool, pool_size, mem_size); - vpu->pool = (struct mdp_config_pool *)(uintptr_t)pool; + vpu->config, &vpu->config_addr, vpu->config_size); + msg.work_addr = vpu->work_addr; msg.work_size = vpu->work_size; err = mdp_vpu_sendmsg(vpu, SCP_IPI_MDP_INIT, &msg, sizeof(msg)); if (err) goto err_work_size; - memset(vpu->pool, 0, sizeof(*vpu->pool)); return 0; err_work_size: @@ -212,7 +243,6 @@ int mdp_vpu_dev_init(struct mdp_vpu_dev *vpu, struct mtk_scp *scp, break; } return err; -err_mem_size: err_mem_alloc: return err; } @@ -227,88 +257,31 @@ int mdp_vpu_dev_deinit(struct mdp_vpu_dev *vpu) return mdp_vpu_sendmsg(vpu, SCP_IPI_MDP_DEINIT, &msg, sizeof(msg)); } -static struct img_config *mdp_config_get(struct mdp_vpu_dev *vpu, - enum mdp_config_id id, uint32_t *addr) +int mdp_vpu_process(struct mdp_vpu_dev *vpu, struct img_ipi_frameparam *param) { - struct img_config *config; - - if (id < 0 || id >= MDP_CONFIG_POOL_SIZE) - return ERR_PTR(-EINVAL); + struct mdp_dev *mdp = vpu_to_mdp(vpu); + struct img_sw_addr addr; mutex_lock(vpu->lock); - vpu->pool->cfg_count[id]++; - config = &vpu->pool->configs[id]; - *addr = vpu->work_addr + ((uintptr_t)config - (uintptr_t)vpu->work); - mutex_unlock(vpu->lock); - - return config; -} - -static int mdp_config_put(struct mdp_vpu_dev *vpu, - enum mdp_config_id id, - const struct img_config *config) -{ - int err = 0; - - if (id < 0 || id >= MDP_CONFIG_POOL_SIZE) - return -EINVAL; - if (vpu->lock) - mutex_lock(vpu->lock); - if (!vpu->pool->cfg_count[id] || config != &vpu->pool->configs[id]) - err = -EINVAL; - else - vpu->pool->cfg_count[id]--; - if (vpu->lock) + if (mdp_vpu_shared_mem_alloc(vpu)) { + dev_err(&mdp->pdev->dev, "VPU memory alloc fail!"); mutex_unlock(vpu->lock); - return err; -} - -int mdp_vpu_ctx_init(struct mdp_vpu_ctx *ctx, struct mdp_vpu_dev *vpu, - enum mdp_config_id id) -{ - ctx->config = mdp_config_get(vpu, id, &ctx->inst_addr); - if (IS_ERR(ctx->config)) { - int err = PTR_ERR(ctx->config); - - ctx->config = NULL; - return err; + return -ENOMEM; } - ctx->config_id = id; - ctx->vpu_dev = vpu; - return 0; -} -int mdp_vpu_ctx_deinit(struct mdp_vpu_ctx *ctx) -{ - int err = mdp_config_put(ctx->vpu_dev, ctx->config_id, ctx->config); + memset(vpu->param, 0, vpu->param_size); + memset(vpu->work, 0, vpu->work_size); + memset(vpu->config, 0, vpu->config_size); - ctx->config_id = 0; - ctx->config = NULL; - ctx->inst_addr = 0; - return err; -} + param->self_data.va = (unsigned long)vpu->work; + param->self_data.pa = vpu->work_addr; + param->config_data.va = (unsigned long)vpu->config; + param->config_data.pa = vpu->config_addr; + param->drv_data = (unsigned long)vpu; + memcpy(vpu->param, param, sizeof(*param)); -int mdp_vpu_process(struct mdp_vpu_ctx *ctx, struct img_ipi_frameparam *param) -{ - struct mdp_vpu_dev *vpu = ctx->vpu_dev; - struct mdp_dev *mdp = vpu_to_mdp(vpu); - struct img_sw_addr addr; - - if (!ctx->vpu_dev->work || !ctx->vpu_dev->work_addr) { - if (mdp_vpu_shared_mem_alloc(vpu)) { - dev_err(&mdp->pdev->dev, "VPU memory alloc fail!"); - return -ENOMEM; - } - } - memset((void *)ctx->vpu_dev->work, 0, ctx->vpu_dev->work_size); - memset(ctx->config, 0, sizeof(*ctx->config)); - param->config_data.va = (unsigned long)ctx->config; - param->config_data.pa = ctx->inst_addr; - param->drv_data = (unsigned long)ctx; - - memcpy((void *)ctx->vpu_dev->work, param, sizeof(*param)); - addr.pa = ctx->vpu_dev->work_addr; - addr.va = (uintptr_t)ctx->vpu_dev->work; - return mdp_vpu_sendmsg(ctx->vpu_dev, SCP_IPI_MDP_FRAME, - &addr, sizeof(addr)); + addr.pa = vpu->param_addr; + addr.va = (unsigned long)vpu->param; + mutex_unlock(vpu->lock); + return mdp_vpu_sendmsg(vpu, SCP_IPI_MDP_FRAME, &addr, sizeof(addr)); } diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-vpu.h b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-vpu.h index 244b3a32d689..ad3551bc0730 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-vpu.h +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-vpu.h @@ -37,42 +37,27 @@ struct mdp_ipi_deinit_msg { u32 work_addr; } __packed; -enum mdp_config_id { - MDP_DEV_M2M = 0, - MDP_CONFIG_POOL_SIZE /* ALWAYS keep at the end */ -}; - -struct mdp_config_pool { - u64 cfg_count[MDP_CONFIG_POOL_SIZE]; - struct img_config configs[MDP_CONFIG_POOL_SIZE]; -}; - struct mdp_vpu_dev { /* synchronization protect for accessing vpu working buffer info */ struct mutex *lock; struct mtk_scp *scp; struct completion ipi_acked; + void *param; + dma_addr_t param_addr; + size_t param_size; void *work; dma_addr_t work_addr; size_t work_size; - struct mdp_config_pool *pool; + void *config; + dma_addr_t config_addr; + size_t config_size; u32 status; }; -struct mdp_vpu_ctx { - struct mdp_vpu_dev *vpu_dev; - u32 config_id; - struct img_config *config; - u32 inst_addr; -}; - void mdp_vpu_shared_mem_free(struct mdp_vpu_dev *vpu); int mdp_vpu_dev_init(struct mdp_vpu_dev *vpu, struct mtk_scp *scp, struct mutex *lock /* for sync */); int mdp_vpu_dev_deinit(struct mdp_vpu_dev *vpu); -int mdp_vpu_ctx_init(struct mdp_vpu_ctx *ctx, struct mdp_vpu_dev *vpu, - enum mdp_config_id id); -int mdp_vpu_ctx_deinit(struct mdp_vpu_ctx *ctx); -int mdp_vpu_process(struct mdp_vpu_ctx *vpu, struct img_ipi_frameparam *param); +int mdp_vpu_process(struct mdp_vpu_dev *vpu, struct img_ipi_frameparam *param); #endif /* __MTK_MDP3_VPU_H__ */