Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp6074039ybp; Tue, 8 Oct 2019 12:37:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqx0gJctingPqkGeOpHKwDoD1KhxtFXN+CL8DepCqMPC/cZrDmZXvQsC2PNrxIP2U3jIajG0 X-Received: by 2002:a17:906:5382:: with SMTP id g2mr4194975ejo.203.1570563455913; Tue, 08 Oct 2019 12:37:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570563455; cv=none; d=google.com; s=arc-20160816; b=et/BG7IjNWCAK1sE3vN60PkPGrNNhbr7/j2S6t28Hlga6WhcBEhnxMtzWqDDFrOSmG i4JcBQpZCrMVDPPWTxcTTgsvi5rRf72V3Mntw4Xn1YOpLTjVj4IxLh9DtUylmjXXQalS X8NA1yLCMyR74hjpwL17u/GDni4sfrjX2Ft5yvvr+U2R5oR6q/SryEvjN3anuZNKaGAZ Y8eecfITQpmqktNeb19PuLLrFkkSpHyXoURyLDCg711Eznsq+fLt2QqwG+P48qIwoptW k9KmqihMNwAPGFFNV5sQpizNBB9QXz7yjaCNWzSxKUZmg9mtRrLBzZkEKi/BNc3lnBGf 5dnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:organization:references:in-reply-to:date:cc:to:from :subject:message-id; bh=NzWDowFxqU9oX6OYbO3N+aarnVsD2VsPAXZ1WuQ04sM=; b=mvbcBtj2QqTy3z6ZlZEcP+VX6N9i5bZz3vUOq/dWTYIjHdNrOnD1J18xqSPcjkx1IP zOsxoCOQAvFkghtvfR8yymFHQmB7YcYZM5wtl+eHRga/iOM7KOgGKV9CJPfZtQlwkIoe V8lwIXcHv/IGYEY0Oxncy9CL2LckgHyDEP5QGN7ZPa02MrJX3my99TUD5yZLAFF8EmA2 9c4bt8Jpwjk8Mwpzc4n0gFsWh8BnXSoZUW0QZ4syPQxOjKUvAHQxdR01y56yxlDslfh0 pK2oHfbqWu5hPqEcU6lKVrGFXz2rNkeBfA3lIX+QeJsHaMyuioc5SvWVI5/oXNacXlOc zPQQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rh9si9281031ejb.102.2019.10.08.12.37.09; Tue, 08 Oct 2019 12:37:35 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730218AbfJHTds (ORCPT + 99 others); Tue, 8 Oct 2019 15:33:48 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:50234 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727336AbfJHTdr (ORCPT ); Tue, 8 Oct 2019 15:33:47 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: ezequiel) with ESMTPSA id B055128EB3B Message-ID: <9cdd23c20ed91d4c4654aaae27d8c3addfd9af3f.camel@collabora.com> Subject: Re: [PATCH v3 3/5] drm/rockchip: Add optional support for CRTC gamma LUT From: Ezequiel Garcia To: Sean Paul Cc: dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, Heiko =?ISO-8859-1?Q?St=FCbner?= , Sandy Huang , kernel@collabora.com, Sean Paul , Boris Brezillon , Douglas Anderson , Jacopo Mondi , Ilia Mirkin , Rob Herring , Mark Rutland , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Jacopo Mondi Date: Tue, 08 Oct 2019 16:33:35 -0300 In-Reply-To: References: <20190930222802.32088-1-ezequiel@collabora.com> <20190930222802.32088-4-ezequiel@collabora.com> <20191007185432.GG126146@art_vandelay> Organization: Collabora Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2019-10-08 at 16:23 -0300, Ezequiel Garcia wrote: > Hello Sean, > > On Mon, 2019-10-07 at 14:54 -0400, Sean Paul wrote: > > On Mon, Sep 30, 2019 at 07:28:00PM -0300, Ezequiel Garcia wrote: > > > Add an optional CRTC gamma LUT support, and enable it on RK3288. > > > This is currently enabled via a separate address resource, > > > which needs to be specified in the devicetree. > > > > > > The address resource is required because on some SoCs, such as > > > RK3288, the LUT address is after the MMU address, and the latter > > > is supported by a different driver. This prevents the DRM driver > > > from requesting an entire register space. > > > > > > The current implementation works for RGB 10-bit tables, as that > > > is what seems to work on RK3288. > > > > > > Signed-off-by: Ezequiel Garcia > > > Reviewed-by: Douglas Anderson > > > Reviewed-by: Jacopo Mondi > > > --- > > > Changes from v2: > > > * None. > > > > > > Changes from v1: > > > * drop explicit linear LUT after finding a proper > > > way to disable gamma correction. > > > * avoid setting gamma is the CRTC is not active. > > > * s/int/unsigned int as suggested by Jacopo. > > > * only enable color management and set gamma size > > > if gamma LUT is supported, suggested by Doug. > > > * drop the reg-names usage, and instead just use indexed reg > > > specifiers, suggested by Doug. > > > > > > Changes from RFC: > > > * Request (an optional) address resource for the LUT. > > > * Drop support for RK3399, which doesn't seem to work > > > out of the box and needs more research. > > > * Support pass-thru setting when GAMMA_LUT is NULL. > > > * Add a check for the gamma size, as suggested by Ilia. > > > * Move gamma setting to atomic_commit_tail, as pointed > > > out by Jacopo/Laurent, is the correct way. > > > --- > > > drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 3 + > > > drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 114 ++++++++++++++++++++ > > > drivers/gpu/drm/rockchip/rockchip_drm_vop.h | 7 ++ > > > drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 2 + > > > 4 files changed, 126 insertions(+) > > > > > > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c > > > index dba352ec0ee3..fd1d987698ab 100644 > > > --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c > > > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c > > > @@ -17,6 +17,7 @@ > > > #include "rockchip_drm_drv.h" > > > #include "rockchip_drm_fb.h" > > > #include "rockchip_drm_gem.h" > > > +#include "rockchip_drm_vop.h" > > > > > > static const struct drm_framebuffer_funcs rockchip_drm_fb_funcs = { > > > .destroy = drm_gem_fb_destroy, > > > @@ -112,6 +113,8 @@ rockchip_atomic_helper_commit_tail_rpm(struct drm_atomic_state *old_state) > > > > > > drm_atomic_helper_commit_modeset_disables(dev, old_state); > > > > > > + rockchip_drm_vop_gamma_set(old_state); > > > + > > > > Instead of duplicating the commit_tail helper, could you just implement > > .atomic_begin() and call this from there? I think the only hitch is if you > > need this to be completed before crtc->atomic_enable(), at which point you > > might need to call it from vop_crtc_atomic_enable() and then detect that in > > atomic_begin() > > > > I think moving this to .atomic_begin might be enough. Let me send a new > series and we can see how that goes. > Oh, before going forward, pleaste note that the first iteration of this patch (as noted in the changelog) was applying the gamma lut on .atomic_flush. However, Laurent and Jacopo pointed out that it might add some tearing to do so, and that's why it was moved to commit_tail. I have to admit I'm not too sure about the difference between applying this gamma LUT on atomic_begin or atomic_flush, perhaps you can clarify that? Thanks! Ezequiel