Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp374879rdb; Thu, 15 Feb 2024 03:00:00 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVNIOYf9FV6lISQggbMF3WUXQ0dGejEKnoMyFQdDxe6dSdswWzX6hAvTNOa3MveSHT39tWA5cSh4peehYmU0H1zA0BCdYtRkDZ0ZpBTfA== X-Google-Smtp-Source: AGHT+IGVyIr2sJIcNGHo3b0fNNEqrZolp3qJpL2t69vNqH5u1sYDJS/Z1lkbq2/vaSsNR45N7UqO X-Received: by 2002:a17:902:bb8b:b0:1d7:88de:cff1 with SMTP id m11-20020a170902bb8b00b001d788decff1mr1121589pls.53.1707994800125; Thu, 15 Feb 2024 03:00:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707994800; cv=pass; d=google.com; s=arc-20160816; b=iGkL4KGcJY625MmDULmWNdVfMEI92X6xBiOFfISy+sMsfRL6f+0AKrpAtPNapiBH9n rghzs4B4/Rhzwz4PCItSbavQCkm0KD+zZ1NTfELfLxBLCKfrcquMLruwuUBeXOIoUB7m lykApXy2u0L8e2I2/91vPYu9ZcYN0x7Yl58nacCb1ZKRWIMN+1A9+55siHu8cn8I9agf 7JhjPkIJDMQZaoem3ruirMX+Y6Yv97l5NHjyGiLWuw6k6DBXb8pbJ2iBzdqIOzo1GkqY Km6QQP/0qorznCweVrbpx4DQbwjk5jzgiWkik4IifUOP0VRh+my9YK9274E92woDiOob l9NQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Hty8fMY2fRkvJZ1hghMZGvuPAF13HnxYZlBmxKjHPMA=; fh=PWpMUFySz/+abNBcZMGAF+1x8Vi76p56GtPU1dgQSG4=; b=dyM3b9CJyRgZQhd/ni8WAFmONXIlLtryxTsRxq3uXJi6PO7wIjdxpLSzaoEYxjOVSN MRNbTsuWDpUmVMZn72Ap6kCxCtrlwHSmU9xRdcNbr8JuMYjXfyKa596xkiK1lJPPxEQ7 ezhp1DbsqTXGHZ9OZYJ+vHt4LZ5Na5qEIKZzntj6at36a0lbnK/VFgs5nPEOSQz4fUlD 8JwDSe/ul8O5cnZV4Pzi39NfOsaSmyPmUExiAvQLJy5hJfV3Lr+MBPXxL5yUZcwv96ip VLOiPdy382mvj/aPSsJTAjyhpOttU0cbbzDsMKFZxpPkSUoHcFdKnSG0FuVcJesg6qOC 1/0g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=rrb3skZS; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-66606-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66606-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id t6-20020a170902bc4600b001d724cd0d18si913830plz.323.2024.02.15.02.59.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 03:00:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66606-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=rrb3skZS; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-66606-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66606-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 64FE5B2A665 for ; Thu, 15 Feb 2024 10:14:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 65E6473173; Thu, 15 Feb 2024 10:11:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="rrb3skZS" Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 501A369D3F for ; Thu, 15 Feb 2024 10:11:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=60.244.123.138 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707991893; cv=none; b=pWJVARbSwwBb7gLXGhmh8ai+RqC7FognBKZKzg1vRD0UOroP7J3//emIqFc+SdhY4B/59r6P/r0FcZSq7bkObuv9ay4/A2W/Jye/xtH047VItj3595NehTdWO0GfFzoHcpZygLqWmduAykbKe+QsA23eSdT6qCPUiqsIVH0kikc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707991893; c=relaxed/simple; bh=HE4AO80dn1GzXOVkPAGJMVjBwlYrgt78vkVsU98Rfok=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TtBgTFpmJ4HnwZ/Zb2H/kYAtTrGW5ynuB0FYJvBdQ6h5PkQcGlLXhgTl4eQIEX6lkeUjyXbVSBzKAlYZhmlL6IV+bmBIs9ZFxgdTqMaJBJQYT2f9AZ66ViI55i0jDXXf/UaKpYSQZGAvTOYASJb7eTZnZwgq1tb32Y6eqWPZs+Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=rrb3skZS; arc=none smtp.client-ip=60.244.123.138 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com X-UUID: 926db2d8cbea11ee9e680517dc993faa-20240215 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=Hty8fMY2fRkvJZ1hghMZGvuPAF13HnxYZlBmxKjHPMA=; b=rrb3skZSdt2nPpXfn8hutMjd308y8gIqdvA54Ijfg8SnX74GcildtJMhztJIt3G0sIQDjrUZSOiz2q9Vxll99+0JtzNgo/lvvLA+OxhijyFRDndI+QDqz58pbxwjt5z+lLpUPX2SZpGSLOZbm8/GLwhR8udlxmsEpqaQREspBBQ=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.37,REQID:6cea29ea-8548-41aa-a914-d3eb26e1f2d7,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6f543d0,CLOUDID:c54d528f-e2c0-40b0-a8fe-7c7e47299109,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES :1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_ULN X-UUID: 926db2d8cbea11ee9e680517dc993faa-20240215 Received: from mtkmbs14n2.mediatek.inc [(172.21.101.76)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1397122509; Thu, 15 Feb 2024 18:11:23 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Thu, 15 Feb 2024 18:11:23 +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.26 via Frontend Transport; Thu, 15 Feb 2024 18:11:23 +0800 From: Hsiao Chien Sung To: AngeloGioacchino Del Regno , Chun-Kuang Hu CC: Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , Bibby Hsieh , CK Hu , Sean Paul , Fei Shao , Jason Chen , "Nancy . Lin" , , , , , Hsiao Chien Sung Subject: [PATCH v5 10/13] drm/mediatek: Support CRC in display driver Date: Thu, 15 Feb 2024 18:11:16 +0800 Message-ID: <20240215101119.12629-11-shawn.sung@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20240215101119.12629-1-shawn.sung@mediatek.com> References: <20240215101119.12629-1-shawn.sung@mediatek.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Register CRC related function pointers to support CRC retrieval. Signed-off-by: Hsiao Chien Sung --- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 239 ++++++++++++++++++++ drivers/gpu/drm/mediatek/mtk_drm_crtc.h | 39 ++++ drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 3 + 3 files changed, 281 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c index 14cf75fa217f9..6cb1ed419dee7 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c @@ -68,6 +68,9 @@ struct mtk_drm_crtc { /* lock for display hardware access */ struct mutex hw_lock; bool config_updating; + + struct mtk_ddp_comp *crc_provider; + unsigned int frames; }; struct mtk_crtc_state { @@ -635,6 +638,14 @@ static void mtk_crtc_ddp_irq(void *data) struct drm_crtc *crtc = data; struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc); struct mtk_drm_private *priv = crtc->dev->dev_private; + struct mtk_ddp_comp *comp = mtk_crtc->crc_provider; + + /* + * crc providers should make sure the crc is always correct + * by resetting it in .crc_read() + */ + if (crtc->crc.opened) + comp->funcs->crc_read(comp->dev); #if IS_REACHABLE(CONFIG_MTK_CMDQ) if (!priv->data->shadow_register && !mtk_crtc->cmdq_client.chan) @@ -646,6 +657,24 @@ static void mtk_crtc_ddp_irq(void *data) if (!priv->data->shadow_register) mtk_crtc_ddp_config(crtc, NULL); #endif + + /* + * drm_crtc_add_crc_entry() could take more than 50ms to finish + * put it at the end of the isr + */ + if (crtc->crc.opened) { + /* + * skip the first crc because the first frame is configured by + * mtk_crtc_ddp_hw_init() when atomic enable + */ + if (++mtk_crtc->frames > 1) { + drm_crtc_add_crc_entry(crtc, true, + drm_crtc_vblank_count(crtc), + comp->funcs->crc_entry(comp->dev)); + } + } else { + mtk_crtc->frames = 0; + } mtk_drm_finish_page_flip(mtk_crtc); } @@ -704,6 +733,40 @@ static void mtk_drm_crtc_update_output(struct drm_crtc *crtc, } } +static int mtk_drm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src) +{ + if (src && strcmp(src, "auto") != 0) { + DRM_ERROR("%s(crtc-%d): unknown source '%s'\n", + __func__, drm_crtc_index(crtc), src); + return -EINVAL; + } + return 0; +} + +static int mtk_drm_crtc_verify_crc_source(struct drm_crtc *crtc, + const char *src, + size_t *cnt) +{ + struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc); + struct mtk_ddp_comp *comp = mtk_crtc->crc_provider; + + if (!comp) { + DRM_ERROR("%s(crtc-%d): no crc provider\n", + __func__, drm_crtc_index(crtc)); + return -ENOENT; + } + + if (src && strcmp(src, "auto") != 0) { + DRM_ERROR("%s(crtc-%d): unknown source '%s'\n", + __func__, drm_crtc_index(crtc), src); + return -EINVAL; + } + + *cnt = comp->funcs->crc_cnt(comp->dev); + + return 0; +} + int mtk_drm_crtc_plane_check(struct drm_crtc *crtc, struct drm_plane *plane, struct mtk_plane_state *state) { @@ -841,6 +904,8 @@ static const struct drm_crtc_funcs mtk_crtc_funcs = { .atomic_destroy_state = mtk_drm_crtc_destroy_state, .enable_vblank = mtk_drm_crtc_enable_vblank, .disable_vblank = mtk_drm_crtc_disable_vblank, + .set_crc_source = mtk_drm_crtc_set_crc_source, + .verify_crc_source = mtk_drm_crtc_verify_crc_source, }; static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = { @@ -1033,6 +1098,11 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev, if (comp->funcs->ctm_set) has_ctm = true; + + if (comp->funcs->crc_cnt && + comp->funcs->crc_entry && + comp->funcs->crc_read) + mtk_crtc->crc_provider = comp; } mtk_ddp_comp_register_vblank_cb(comp, mtk_crtc_ddp_irq, @@ -1137,3 +1207,172 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev, return 0; } + +void mtk_drm_crc_init(struct mtk_drm_crc *crc, + const u32 *crc_offset_table, size_t crc_count, + u32 reset_offset, u32 reset_mask) +{ + crc->ofs = crc_offset_table; + crc->cnt = crc_count; + crc->rst_ofs = reset_offset; + crc->rst_msk = reset_mask; + crc->va = kcalloc(crc->cnt, sizeof(*crc->va), GFP_KERNEL); + if (!crc->va) { + DRM_ERROR("failed to allocate memory for crc\n"); + crc->cnt = 0; + } +} + +void mtk_drm_crc_read(struct mtk_drm_crc *crc, void __iomem *reg) +{ + if (!crc->cnt || !crc->ofs || !crc->va) + return; + +#if IS_REACHABLE(CONFIG_MTK_CMDQ) + /* sync to see the most up-to-date copy of the DMA buffer */ + dma_sync_single_for_cpu(crc->cmdq_client.chan->mbox->dev, + crc->pa, crc->cnt * sizeof(*crc->va), + DMA_FROM_DEVICE); +#else + /* read crc with cpu for the platforms without cmdq */ + { + u32 n; + + for (n = 0; n < crc->cnt; n++) + crc->va[n] = readl(reg + crc->ofs[n]); + + n = readl(reg + crc->rst_ofs); + + /* pull reset bit */ + n |= crc->rst_msk; + writel(n, reg + crc->rst_ofs); + + /* release reset bit */ + n &= ~crc->rst_msk; + writel(n, reg + crc->rst_ofs); + } +#endif +} + +void mtk_drm_crc_destroy(struct mtk_drm_crc *crc) +{ + if (!crc->cnt) + return; + +#if IS_REACHABLE(CONFIG_MTK_CMDQ) + if (crc->pa) { + dma_unmap_single(crc->cmdq_client.chan->mbox->dev, + crc->pa, crc->cnt * sizeof(*crc->va), + DMA_TO_DEVICE); + crc->pa = 0; + } + if (crc->cmdq_client.chan) { + mtk_drm_cmdq_pkt_destroy(&crc->cmdq_handle); + mbox_free_channel(crc->cmdq_client.chan); + crc->cmdq_client.chan = NULL; + } +#endif + kfree(crc->va); + crc->va = NULL; + crc->cnt = 0; +} + +#if IS_REACHABLE(CONFIG_MTK_CMDQ) +void mtk_drm_crc_cmdq_create(struct device *dev, struct mtk_drm_crc *crc) +{ + int i; + + if (!crc->cnt) { + dev_warn(dev, "%s: not support\n", __func__); + goto cleanup; + } + + if (!crc->ofs) { + dev_warn(dev, "%s: not defined\n", __func__); + goto cleanup; + } + + crc->cmdq_client.client.dev = dev; + crc->cmdq_client.client.tx_block = false; + crc->cmdq_client.client.knows_txdone = true; + crc->cmdq_client.client.rx_callback = NULL; + crc->cmdq_client.chan = mbox_request_channel(&crc->cmdq_client.client, 0); + if (IS_ERR(crc->cmdq_client.chan)) { + dev_warn(dev, "%s: failed to create mailbox client\n", __func__); + crc->cmdq_client.chan = NULL; + goto cleanup; + } + + if (mtk_drm_cmdq_pkt_create(&crc->cmdq_client, &crc->cmdq_handle, PAGE_SIZE)) { + dev_warn(dev, "%s: failed to create cmdq packet\n", __func__); + goto cleanup; + } + + if (!crc->va) { + dev_warn(dev, "%s: no memory\n", __func__); + goto cleanup; + } + + /* map the entry to get a dma address for cmdq to store the crc */ + crc->pa = dma_map_single(crc->cmdq_client.chan->mbox->dev, + crc->va, crc->cnt * sizeof(*crc->va), + DMA_FROM_DEVICE); + + if (dma_mapping_error(crc->cmdq_client.chan->mbox->dev, crc->pa)) { + dev_err(dev, "%s: failed to map dma\n", __func__); + goto cleanup; + } + + if (crc->cmdq_event) + cmdq_pkt_wfe(&crc->cmdq_handle, crc->cmdq_event, true); + + for (i = 0; i < crc->cnt; i++) { + /* put crc to spr1 register */ + cmdq_pkt_read_s(&crc->cmdq_handle, crc->cmdq_reg->subsys, + crc->cmdq_reg->offset + crc->ofs[i], + CMDQ_THR_SPR_IDX1); + + /* copy spr1 register to physical address of the crc */ + cmdq_pkt_assign(&crc->cmdq_handle, CMDQ_THR_SPR_IDX0, + CMDQ_ADDR_HIGH(crc->pa + i * sizeof(*crc->va))); + cmdq_pkt_write_s(&crc->cmdq_handle, CMDQ_THR_SPR_IDX0, + CMDQ_ADDR_LOW(crc->pa + i * sizeof(*crc->va)), + CMDQ_THR_SPR_IDX1); + } + /* reset crc */ + mtk_ddp_write_mask(&crc->cmdq_handle, ~0, crc->cmdq_reg, 0, + crc->rst_ofs, crc->rst_msk); + + /* clear reset bit */ + mtk_ddp_write_mask(&crc->cmdq_handle, 0, crc->cmdq_reg, 0, + crc->rst_ofs, crc->rst_msk); + + /* jump to head of the cmdq packet */ + cmdq_pkt_jump(&crc->cmdq_handle, crc->cmdq_handle.pa_base); + + return; +cleanup: + mtk_drm_crc_destroy(crc); +} + +void mtk_drm_crc_cmdq_start(struct mtk_drm_crc *crc) +{ + if (!crc->cmdq_client.chan) + return; + + dma_sync_single_for_device(crc->cmdq_client.chan->mbox->dev, + crc->cmdq_handle.pa_base, + crc->cmdq_handle.cmd_buf_size, + DMA_TO_DEVICE); + mbox_send_message(crc->cmdq_client.chan, &crc->cmdq_handle); + mbox_client_txdone(crc->cmdq_client.chan, 0); +} + +void mtk_drm_crc_cmdq_stop(struct mtk_drm_crc *crc) +{ + if (!crc->cmdq_client.chan) + return; + + mbox_flush(crc->cmdq_client.chan, 2000); +} +#endif diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.h b/drivers/gpu/drm/mediatek/mtk_drm_crtc.h index 3c224595fa714..0683ec4bc26f6 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.h @@ -15,6 +15,45 @@ #define MTK_MAX_BPC 10 #define MTK_MIN_BPC 3 +/** + * struct mtk_drm_crc - crc related information + * @ofs: register offset of crc + * @rst_ofs: register offset of crc reset + * @rst_msk: register mask of crc reset + * @cnt: count of crc + * @va: pointer to the start of crc array + * @pa: physical address of the crc for gce to access + * @cmdq_event: the event to trigger the cmdq + * @cmdq_reg: address of the register that cmdq is going to access + * @cmdq_client: handler to control cmdq (mbox channel, thread ...etc.) + * @cmdq_handle: cmdq packet to store the commands + */ +struct mtk_drm_crc { + const u32 *ofs; + u32 rst_ofs; + u32 rst_msk; + size_t cnt; + u32 *va; +#if IS_REACHABLE(CONFIG_MTK_CMDQ) + dma_addr_t pa; + u32 cmdq_event; + struct cmdq_client_reg *cmdq_reg; + struct cmdq_client cmdq_client; + struct cmdq_pkt cmdq_handle; +#endif +}; + +void mtk_drm_crc_init(struct mtk_drm_crc *crc, + const u32 *crc_offset_table, size_t crc_count, + u32 reset_offset, u32 reset_mask); +void mtk_drm_crc_read(struct mtk_drm_crc *crc, void __iomem *reg); +void mtk_drm_crc_destroy(struct mtk_drm_crc *crc); +#if IS_REACHABLE(CONFIG_MTK_CMDQ) +void mtk_drm_crc_cmdq_create(struct device *dev, struct mtk_drm_crc *crc); +void mtk_drm_crc_cmdq_start(struct mtk_drm_crc *crc); +void mtk_drm_crc_cmdq_stop(struct mtk_drm_crc *crc); +#endif + void mtk_drm_crtc_commit(struct drm_crtc *crtc); int mtk_drm_crtc_create(struct drm_device *drm_dev, const unsigned int *path, diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h index 215b7234ff13c..231017470607e 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h @@ -87,6 +87,9 @@ struct mtk_ddp_comp_funcs { void (*remove)(struct device *dev, struct mtk_mutex *mutex); unsigned int (*encoder_index)(struct device *dev); enum drm_mode_status (*mode_valid)(struct device *dev, const struct drm_display_mode *mode); + size_t (*crc_cnt)(struct device *dev); + u32 *(*crc_entry)(struct device *dev); + void (*crc_read)(struct device *dev); }; struct mtk_ddp_comp { -- 2.18.0