From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Peter Rosin <peda@axentia.se>
Cc: linux-kernel@vger.kernel.org, David Airlie <airlied@linux.ie>,
dri-devel@lists.freedesktop.org,
Alexandre Belloni <alexandre.belloni@free-electrons.com>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: Re: [PATCH] drm: atmel-hlcdc: use a default gamma ramp if none is specified
Date: Mon, 3 Jul 2017 14:02:35 +0200 [thread overview]
Message-ID: <20170703140235.53329a09@bbrezillon> (raw)
In-Reply-To: <b8ed51f9-89b5-fbe4-309e-3c9e7f4a89ed@axentia.se>
On Mon, 3 Jul 2017 13:53:28 +0200
Peter Rosin <peda@axentia.se> wrote:
> On 2017-07-03 13:31, Boris Brezillon wrote:
> > On Mon, 3 Jul 2017 11:42:10 +0200
> > Peter Rosin <peda@axentia.se> wrote:
> >
> >> At init and if the gamma_lut property is ever removed, the clut
> >> registers must be programmed with a default gamma ramp instead of
> >> being left in some unknown state.
> >>
> >> Fixes: 364a7bf574eb ("drm: atmel-hlcdc: add support for 8-bit color lookup table mode")
> >> Signed-off-by: Peter Rosin <peda@axentia.se>
> >> ---
> >> drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 17 ++++++++++++++++-
> >> 1 file changed, 16 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> >> index b5bd9b0..0ccd93c 100644
> >> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> >> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> >> @@ -429,6 +429,14 @@ static void atmel_hlcdc_plane_update_format(struct atmel_hlcdc_plane *plane,
> >> ATMEL_HLCDC_LAYER_FORMAT_CFG, cfg);
> >> }
> >>
> >> +static void atmel_hlcdc_default_gamma_ramp(struct atmel_hlcdc_layer *layer)
> >> +{
> >> + int idx;
> >> +
> >> + for (idx = 0; idx < ATMEL_HLCDC_CLUT_SIZE; idx++)
> >> + atmel_hlcdc_layer_write_clut(layer, idx, idx * 0x10101);
> >> +}
> >> +
> >> static void atmel_hlcdc_plane_update_clut(struct atmel_hlcdc_plane *plane)
> >> {
> >> struct drm_crtc *crtc = plane->base.crtc;
> >> @@ -438,9 +446,14 @@ static void atmel_hlcdc_plane_update_clut(struct atmel_hlcdc_plane *plane)
> >> if (!crtc || !crtc->state)
> >> return;
> >>
> >> - if (!crtc->state->color_mgmt_changed || !crtc->state->gamma_lut)
> >> + if (!crtc->state->color_mgmt_changed)
> >> return;
> >>
> >> + if (!crtc->state->gamma_lut) {
> >> + atmel_hlcdc_default_gamma_ramp(&plane->layer);
> >
> > Hm, I'd prefer to have state->gamma_lut properly initialized in
> > atmel_hlcdc_crtc_reset(), this way you don't have to do that in the
> > update path.
>
> The gamma_lut property can be removed, so you have to handle it here anyway. No?
Hm, what do you mean by removed? AFAICT, a property, once attached to
a DRM object, exists until the DRM object is destroyed. The data
attached to this property (here, the gamma_lut array) can be NULL, but
once you have allocated the data container, it will be duplicated (and
possibly updated) every time an atomic operation is triggered.
By initializing this field in crtc->reset(), you enforce the
default/reset state, which IIUC, is what you want here.
next prev parent reply other threads:[~2017-07-03 12:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-03 9:42 [PATCH] drm: atmel-hlcdc: use a default gamma ramp if none is specified Peter Rosin
2017-07-03 11:31 ` Boris Brezillon
2017-07-03 11:53 ` Peter Rosin
2017-07-03 12:02 ` Boris Brezillon [this message]
2017-07-03 20:59 ` Peter Rosin
2017-07-03 21:15 ` Boris Brezillon
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=20170703140235.53329a09@bbrezillon \
--to=boris.brezillon@free-electrons.com \
--cc=airlied@linux.ie \
--cc=alexandre.belloni@free-electrons.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=peda@axentia.se \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox