From: "Heiko Stübner" <heiko@sntech.de>
To: Ezequiel Garcia <ezequiel@collabora.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
devicetree <devicetree@vger.kernel.org>,
Jacopo Mondi <jacopo@jmondi.org>,
Rob Herring <robh+dt@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
dri-devel <dri-devel@lists.freedesktop.org>,
Douglas Anderson <dianders@chromium.org>,
linux-rockchip@lists.infradead.org,
Boris Brezillon <boris.brezillon@collabora.com>,
Sean Paul <seanpaul@chromium.org>,
kernel@collabora.com
Subject: Re: [PATCH 2/3] drm/rockchip: Add optional support for CRTC gamma LUT
Date: Wed, 19 Jun 2019 00:18:00 +0200 [thread overview]
Message-ID: <31857290.5uKucqQp3M@diego> (raw)
In-Reply-To: <20372cd5e56d67b8e896c2d94b3d0d136cc2886e.camel@collabora.com>
Am Mittwoch, 19. Juni 2019, 00:09:57 CEST schrieb Ezequiel Garcia:
> On Tue, 2019-06-18 at 17:47 -0400, Ilia Mirkin wrote:
> > On Tue, Jun 18, 2019 at 5:43 PM Ezequiel Garcia <ezequiel@collabora.com> 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 <ezequiel@collabora.com>
> > > ---
> > > 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.
> > > ---
> > > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> > > index 12ed5265a90b..5b6edbe2673f 100644
> > > --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> > > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> > > +static void vop_crtc_gamma_set(struct vop *vop, struct drm_crtc *crtc,
> > > + struct drm_crtc_state *old_state)
> > > +{
> > > + int idle, ret, i;
> > > +
> > > + spin_lock(&vop->reg_lock);
> > > + VOP_REG_SET(vop, common, dsp_lut_en, 0);
> > > + vop_cfg_done(vop);
> > > + spin_unlock(&vop->reg_lock);
> > > +
> > > + ret = readx_poll_timeout(vop_dsp_lut_is_enable, vop,
> > > + idle, !idle, 5, 30 * 1000);
> > > + if (ret)
> > > + return;
> > > +
> > > + spin_lock(&vop->reg_lock);
> > > +
> > > + if (crtc->state->gamma_lut) {
> > > + if (!old_state->gamma_lut || (crtc->state->gamma_lut->base.id !=
> > > + old_state->gamma_lut->base.id))
> > > + vop_crtc_write_gamma_lut(vop, crtc);
> > > + } else {
> > > + for (i = 0; i < crtc->gamma_size; i++) {
> > > + u32 word;
> > > +
> > > + word = (i << 20) | (i << 10) | i;
> > > + writel(word, vop->lut_regs + i * 4);
> > > + }
> >
> > Note - I'm not in any way familiar with the hardware, so take with a
> > grain of salt --
> >
> > Could you just leave dsp_lut_en turned off in this case?
> >
>
> That was the first thing I tried :-)
>
> It seems dsp_lut_en is not to enable the CRTC gamma LUT stage,
> but to enable writing the gamma LUT to the internal RAM.
I guess that warants a code comment stating this, so we don't end
up with well-meant cleanup patches in the future :-) .
>
> And the specs list no register to enable/disable the gamma LUT.
>
> Thanks!
> Eze
>
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: "Heiko Stübner" <heiko@sntech.de>
To: Ezequiel Garcia <ezequiel@collabora.com>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>,
dri-devel <dri-devel@lists.freedesktop.org>,
linux-rockchip@lists.infradead.org,
Sandy Huang <hjc@rock-chips.com>,
kernel@collabora.com, Sean Paul <seanpaul@chromium.org>,
Boris Brezillon <boris.brezillon@collabora.com>,
Douglas Anderson <dianders@chromium.org>,
Jacopo Mondi <jacopo@jmondi.org>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
devicetree <devicetree@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] drm/rockchip: Add optional support for CRTC gamma LUT
Date: Wed, 19 Jun 2019 00:18:00 +0200 [thread overview]
Message-ID: <31857290.5uKucqQp3M@diego> (raw)
In-Reply-To: <20372cd5e56d67b8e896c2d94b3d0d136cc2886e.camel@collabora.com>
Am Mittwoch, 19. Juni 2019, 00:09:57 CEST schrieb Ezequiel Garcia:
> On Tue, 2019-06-18 at 17:47 -0400, Ilia Mirkin wrote:
> > On Tue, Jun 18, 2019 at 5:43 PM Ezequiel Garcia <ezequiel@collabora.com> 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 <ezequiel@collabora.com>
> > > ---
> > > 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.
> > > ---
> > > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> > > index 12ed5265a90b..5b6edbe2673f 100644
> > > --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> > > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> > > +static void vop_crtc_gamma_set(struct vop *vop, struct drm_crtc *crtc,
> > > + struct drm_crtc_state *old_state)
> > > +{
> > > + int idle, ret, i;
> > > +
> > > + spin_lock(&vop->reg_lock);
> > > + VOP_REG_SET(vop, common, dsp_lut_en, 0);
> > > + vop_cfg_done(vop);
> > > + spin_unlock(&vop->reg_lock);
> > > +
> > > + ret = readx_poll_timeout(vop_dsp_lut_is_enable, vop,
> > > + idle, !idle, 5, 30 * 1000);
> > > + if (ret)
> > > + return;
> > > +
> > > + spin_lock(&vop->reg_lock);
> > > +
> > > + if (crtc->state->gamma_lut) {
> > > + if (!old_state->gamma_lut || (crtc->state->gamma_lut->base.id !=
> > > + old_state->gamma_lut->base.id))
> > > + vop_crtc_write_gamma_lut(vop, crtc);
> > > + } else {
> > > + for (i = 0; i < crtc->gamma_size; i++) {
> > > + u32 word;
> > > +
> > > + word = (i << 20) | (i << 10) | i;
> > > + writel(word, vop->lut_regs + i * 4);
> > > + }
> >
> > Note - I'm not in any way familiar with the hardware, so take with a
> > grain of salt --
> >
> > Could you just leave dsp_lut_en turned off in this case?
> >
>
> That was the first thing I tried :-)
>
> It seems dsp_lut_en is not to enable the CRTC gamma LUT stage,
> but to enable writing the gamma LUT to the internal RAM.
I guess that warants a code comment stating this, so we don't end
up with well-meant cleanup patches in the future :-) .
>
> And the specs list no register to enable/disable the gamma LUT.
>
> Thanks!
> Eze
>
>
next prev parent reply other threads:[~2019-06-18 22:18 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-18 21:34 [PATCH 0/3] RK3288 Gamma LUT Ezequiel Garcia
2019-06-18 21:34 ` Ezequiel Garcia
2019-06-18 21:34 ` [PATCH 1/3] dt-bindings: display: rockchip: document VOP gamma LUT address Ezequiel Garcia
2019-06-18 21:34 ` Ezequiel Garcia
2019-06-20 16:43 ` Doug Anderson
2019-06-20 16:56 ` Ezequiel Garcia
2019-06-20 16:56 ` Ezequiel Garcia
2019-06-18 21:34 ` [PATCH 2/3] drm/rockchip: Add optional support for CRTC gamma LUT Ezequiel Garcia
2019-06-18 21:34 ` Ezequiel Garcia
2019-06-18 21:47 ` Ilia Mirkin
2019-06-18 22:09 ` Ezequiel Garcia
2019-06-18 22:18 ` Heiko Stübner [this message]
2019-06-18 22:18 ` Heiko Stübner
2019-06-20 16:02 ` Ezequiel Garcia
2019-06-20 17:25 ` Doug Anderson
2019-06-21 15:52 ` Ezequiel Garcia
2019-06-21 8:22 ` Jacopo Mondi
2019-06-21 8:22 ` Jacopo Mondi
2019-06-21 15:59 ` Ezequiel Garcia
2019-06-21 15:59 ` Ezequiel Garcia
2019-06-18 21:34 ` [PATCH 3/3] ARM: dts: rockchip: Add RK3288 VOP gamma LUT address Ezequiel Garcia
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=31857290.5uKucqQp3M@diego \
--to=heiko@sntech.de \
--cc=boris.brezillon@collabora.com \
--cc=devicetree@vger.kernel.org \
--cc=dianders@chromium.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=ezequiel@collabora.com \
--cc=jacopo@jmondi.org \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
--cc=seanpaul@chromium.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.