Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp490624ybe; Fri, 6 Sep 2019 02:39:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqyb24gUDNpoOUsBDnuxAT6vPTKgb5C8zvl0Y7nIhd2r2Fv6nCS2XjYRezQFhC4CCnsL7BrS X-Received: by 2002:a63:a66:: with SMTP id z38mr7390532pgk.247.1567762746542; Fri, 06 Sep 2019 02:39:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567762746; cv=none; d=google.com; s=arc-20160816; b=j9pIjl+onNy+sFyTsvm3Xc7B4miVF6TJtEfJnZaCqMbCO1KJcLNKUI9v4W1TFnVjPL fgDMNbO0YYsgdxB+AZgvmxQclq5YZYg/LwdHpnAgc5tKsmHt7/syvApMAA44djwBE88l V3x9awQh5NRJucpTCAA7irtMHiaNs0nBt8u8XqJmBZlDE0GY/egRfRzv5xoN+lKyeMiD Pp5pb5GWHSJOth1Sdfz7tGrXqnd/uUkHfo/1SNSfN54AGiAZhxZvgT7UEqu8YJrkQglO zz6pgU20nt0Jy1U+HM8183L9IMpxqZOYuiSYmZDl8AeHprJvIwXLdGnTp3W+zTee400H ZhSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Mt9CnpWDYE9AuIn/hMdu40hiJSofbzdMOkAcHsCIv0A=; b=sSqVzrgcZoip7GTU7+KyLLgfhBPOns69FPISZIcABXmwNKhWhREVf5oZnj0ek45KB8 HNOomFhxDgvNTSHbNT0is70eJ+1JFNJAVaFAJW1yl5wUQWnt/EGhJBkhIawbfFYW9egQ 8sWYz4Q1MjmpQIVZ5xyAlkO1J4NTpnpqw9wF64SouuCNMbcaQ9T4SvLFBIw0cRKL959y jwKsjU7sd4AGJ29IRC0WWyo8KppmKEjMm8Q6MT5tx6RYSX4v5b8yIuBmhirqcHJj40yX 2O8DefJKntRWV+5OfgHHkB/1TuOMJ2HltorZr1LAWilwAnRJBpqTtivcIZj54m/MfoQe U1gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Vydhvi9x; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v185si4033194pgd.340.2019.09.06.02.38.50; Fri, 06 Sep 2019 02:39:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Vydhvi9x; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731734AbfIEWuM (ORCPT + 99 others); Thu, 5 Sep 2019 18:50:12 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:34154 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727115AbfIEWuM (ORCPT ); Thu, 5 Sep 2019 18:50:12 -0400 Received: by mail-qt1-f196.google.com with SMTP id a13so4941358qtj.1 for ; Thu, 05 Sep 2019 15:50:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Mt9CnpWDYE9AuIn/hMdu40hiJSofbzdMOkAcHsCIv0A=; b=Vydhvi9xtxhqe5HoBNZPhdiSWovcw1HFQTA8soQuoeVMc6pIcQ5l37oQ3SalYjcgjm TrbR2gyQ0J8Z5UPkHYElYPnXXieZeIn8ra2Lk7QRG5pG5hbOY9DVaX9uLAGALyg85Txg Es6trlS030XfryZ7vU/40X/oGNBbzuCH/ebqU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Mt9CnpWDYE9AuIn/hMdu40hiJSofbzdMOkAcHsCIv0A=; b=lDuwbLtWUSpyUbKXUKaunu5CbfFQ44LwGXgGJlpyb5ZI+OWKUggX/aRw0x9Zt+IoNZ F3mafTB1DjbU1TLq5SVbuYYHJkt30KrsnWbOFjGnbMR1tYSl9psTHFTtMHSyVokOtQk2 qgwodI8bHRpE/xLNpxGEcA9Xf50cnW/CASmXUYOHVh9q48KgeLzndJBINbsYeNX+3Onp RyVRuTbx+0FAUvShuqCglBxZ98ONq/Fmip28SQMphPBeJoPMW9n+coVBV2OIDOKyqjyc TxJ6+pFyA62GomxdJ+Axk4izGr6N2Lx5kFHi5Gu0hZS0Yl0cmqIr/KF5OM8iyK2iTL0C 6K3A== X-Gm-Message-State: APjAAAVIOzYOceWSkIk47wlnQVLkvOnr5WMLB3FOMWLt2PQnCUE+irvX oJsufP1k9xI7F8T1GFwdhblF/Of45USXn6iR9sK87w== X-Received: by 2002:ac8:434e:: with SMTP id a14mr6318575qtn.278.1567723810989; Thu, 05 Sep 2019 15:50:10 -0700 (PDT) MIME-Version: 1.0 References: <20190830074103.16671-1-bibby.hsieh@mediatek.com> <20190830074103.16671-2-bibby.hsieh@mediatek.com> In-Reply-To: <20190830074103.16671-2-bibby.hsieh@mediatek.com> From: Nicolas Boichat Date: Fri, 6 Sep 2019 06:49:59 +0800 Message-ID: Subject: Re: [PATCH 1/2] drm/mediatek: Support CMDQ interface in ddp component To: Bibby Hsieh Cc: David Airlie , Matthias Brugger , Daniel Vetter , dri-devel@lists.freedesktop.org, "moderated list:ARM/Mediatek SoC support" , Philipp Zabel , YT Shen , Thierry Reding , CK Hu , linux-arm Mailing List , Tomasz Figa , lkml , Yongqiang Niu , Guenter Roeck Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 30, 2019 at 3:41 PM Bibby Hsieh wrote: > > The CMDQ (Command Queue) in MT8183 is used to help > update all relevant display controller registers > with critical time limation. > This patch add cmdq interface in ddp_comp interface, > let all ddp_comp interface can support cpu/cmdq function > at the same time. > > Signed-off-by: YT Shen > Signed-off-by: CK Hu > Signed-off-by: Philipp Zabel > Signed-off-by: Bibby Hsieh > Signed-off-by: Yongqiang Niu > --- [snip] > static void mtk_gamma_set(struct mtk_ddp_comp *comp, > - struct drm_crtc_state *state) > + struct drm_crtc_state *state, > + struct cmdq_pkt *cmdq_pkt) > { > - unsigned int i, reg; > + unsigned int i; > struct drm_color_lut *lut; > void __iomem *lut_base; > u32 word; > > if (state->gamma_lut) { > - reg = readl(comp->regs + DISP_GAMMA_CFG); > - reg = reg | GAMMA_LUT_EN; > - writel(reg, comp->regs + DISP_GAMMA_CFG); > + mtk_ddp_write_mask(cmdq_pkt, GAMMA_LUT_EN, comp, > + DISP_GAMMA_CFG, GAMMA_LUT_EN); > lut_base = comp->regs + DISP_GAMMA_LUT; > lut = (struct drm_color_lut *)state->gamma_lut->data; > for (i = 0; i < MTK_LUT_SIZE; i++) { > word = (((lut[i].red >> 6) & LUT_10BIT_MASK) << 20) + > (((lut[i].green >> 6) & LUT_10BIT_MASK) << 10) + > ((lut[i].blue >> 6) & LUT_10BIT_MASK); > - writel(word, (lut_base + i * 4)); > + mtk_ddp_write(cmdq_pkt, word, comp, > + (unsigned int)(lut_base + i * 4)); Guenter pointed out that this looks quite wrong. We should have: unsigned int lut_base; lut_base = DISP_GAMMA_LUT; mtk_ddp_write(cmdq_pkt, word, comp, lut_base + i * 4); Or more simply: mtk_ddp_write(cmdq_pkt, word, comp, DISP_GAMMA_LUT + i * 4); > } > }