All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Cawa Cheng <cawa.cheng@mediatek.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	linux-mediatek@lists.infradead.org,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Yingjoe Chen <yingjoe.chen@mediatek.com>,
	Mao Huang <littlecvr@chromium.org>,
	Sascha Hauer <kernel@pengutronix.de>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v4 3/4] drm/mediatek: Add gamma correction.
Date: Thu, 11 Aug 2016 10:51:05 +0200	[thread overview]
Message-ID: <20160811085105.GI6232@phenom.ffwll.local> (raw)
In-Reply-To: <20160811080227.GH4329@intel.com>

On Thu, Aug 11, 2016 at 11:02:27AM +0300, Ville Syrjälä wrote:
> On Thu, Aug 11, 2016 at 09:51:16AM +0200, Philipp Zabel wrote:
> > Am Donnerstag, den 11.08.2016, 10:44 +0300 schrieb Ville Syrjälä:
> > > On Thu, Aug 11, 2016 at 09:32:59AM +0200, Philipp Zabel wrote:
> > > > Am Donnerstag, den 28.07.2016, 10:22 +0800 schrieb Bibby Hsieh:
> > > > > Add gamma set function to correct brightness values.
> > > > > It applies arbitrary mapping curve to compensate the
> > > > > incorrect transfer function of the panel.
> > > > > 
> > > > > Signed-off-by: Bibby Hsieh <bibby.hsieh@mediatek.com>
> > > > > ---
> > > > >  drivers/gpu/drm/mediatek/mtk_drm_crtc.c     |    8 ++++++-
> > > > >  drivers/gpu/drm/mediatek/mtk_drm_crtc.h     |    1 +
> > > > >  drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c |   31 +++++++++++++++++++++++++++
> > > > >  drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h |   10 +++++++++
> > > > >  4 files changed, 49 insertions(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > > > > index 24aa3ba..cbb460a5 100644
> > > > > --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > > > > +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > > > > @@ -409,6 +409,9 @@ static void mtk_drm_crtc_atomic_flush(struct drm_crtc *crtc,
> > > > >  	}
> > > > >  	if (pending_planes)
> > > > >  		mtk_crtc->pending_planes = true;
> > > > > +	if (crtc->state->color_mgmt_changed)
> > > > > +		for (i = 0; i < mtk_crtc->ddp_comp_nr; i++)
> > > > > +			mtk_ddp_gamma_set(mtk_crtc->ddp_comp[i], crtc->state);
> > > > >  }
> > > > >  
> > > > >  static const struct drm_crtc_funcs mtk_crtc_funcs = {
> > > > > @@ -418,6 +421,7 @@ static const struct drm_crtc_funcs mtk_crtc_funcs = {
> > > > >  	.reset			= mtk_drm_crtc_reset,
> > > > >  	.atomic_duplicate_state	= mtk_drm_crtc_duplicate_state,
> > > > >  	.atomic_destroy_state	= mtk_drm_crtc_destroy_state,
> > > > > +	.gamma_set		= drm_atomic_helper_legacy_gamma_set,
> > > > >  };
> > > > >  
> > > > >  static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = {
> > > > > @@ -568,7 +572,9 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
> > > > >  				&mtk_crtc->planes[1].base, pipe);
> > > > >  	if (ret < 0)
> > > > >  		goto unprepare;
> > > > > -
> > > > > +	drm_mode_crtc_set_gamma_size(&mtk_crtc->base, MTK_LUT_SIZE);
> > > > > +	drm_helper_crtc_enable_color_mgmt(&mtk_crtc->base, MTK_LUT_SIZE,
> > > > > +					  MTK_LUT_SIZE);
> > > > 
> > > > I have applied all four patches and rebased onto v4.8-rc1, replacing
> > > > drm_helper_crtc_enable_color_mgmt with:
> > > > 
> > > > 	drm_crtc_enable_color_mgmt(&mtk_crtc->base, MTK_LUT_SIZE,
> > > > 				   true, MTK_LUT_SIZE);
> > > 
> > > BTW that looks wrong (already in the original). AFAICS the patch just
> > > handled the gamma_lut, not the degamma_lut, so telling you have both
> > > is not right.
> > 
> > Thanks, so should that be
> >        drm_crtc_enable_color_mgmt(&mtk_crtc->base, 0, false,
> >                                   MTK_LUT_SIZE);
> > instead, since we only handle gamma?
> 
> Hmm. Yeah, that looks correct since you didn't seem to have "ctm" either.

Yup, that's how this is meant to be used.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
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: daniel@ffwll.ch (Daniel Vetter)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 3/4] drm/mediatek: Add gamma correction.
Date: Thu, 11 Aug 2016 10:51:05 +0200	[thread overview]
Message-ID: <20160811085105.GI6232@phenom.ffwll.local> (raw)
In-Reply-To: <20160811080227.GH4329@intel.com>

On Thu, Aug 11, 2016 at 11:02:27AM +0300, Ville Syrj?l? wrote:
> On Thu, Aug 11, 2016 at 09:51:16AM +0200, Philipp Zabel wrote:
> > Am Donnerstag, den 11.08.2016, 10:44 +0300 schrieb Ville Syrj?l?:
> > > On Thu, Aug 11, 2016 at 09:32:59AM +0200, Philipp Zabel wrote:
> > > > Am Donnerstag, den 28.07.2016, 10:22 +0800 schrieb Bibby Hsieh:
> > > > > Add gamma set function to correct brightness values.
> > > > > It applies arbitrary mapping curve to compensate the
> > > > > incorrect transfer function of the panel.
> > > > > 
> > > > > Signed-off-by: Bibby Hsieh <bibby.hsieh@mediatek.com>
> > > > > ---
> > > > >  drivers/gpu/drm/mediatek/mtk_drm_crtc.c     |    8 ++++++-
> > > > >  drivers/gpu/drm/mediatek/mtk_drm_crtc.h     |    1 +
> > > > >  drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c |   31 +++++++++++++++++++++++++++
> > > > >  drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h |   10 +++++++++
> > > > >  4 files changed, 49 insertions(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > > > > index 24aa3ba..cbb460a5 100644
> > > > > --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > > > > +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > > > > @@ -409,6 +409,9 @@ static void mtk_drm_crtc_atomic_flush(struct drm_crtc *crtc,
> > > > >  	}
> > > > >  	if (pending_planes)
> > > > >  		mtk_crtc->pending_planes = true;
> > > > > +	if (crtc->state->color_mgmt_changed)
> > > > > +		for (i = 0; i < mtk_crtc->ddp_comp_nr; i++)
> > > > > +			mtk_ddp_gamma_set(mtk_crtc->ddp_comp[i], crtc->state);
> > > > >  }
> > > > >  
> > > > >  static const struct drm_crtc_funcs mtk_crtc_funcs = {
> > > > > @@ -418,6 +421,7 @@ static const struct drm_crtc_funcs mtk_crtc_funcs = {
> > > > >  	.reset			= mtk_drm_crtc_reset,
> > > > >  	.atomic_duplicate_state	= mtk_drm_crtc_duplicate_state,
> > > > >  	.atomic_destroy_state	= mtk_drm_crtc_destroy_state,
> > > > > +	.gamma_set		= drm_atomic_helper_legacy_gamma_set,
> > > > >  };
> > > > >  
> > > > >  static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = {
> > > > > @@ -568,7 +572,9 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
> > > > >  				&mtk_crtc->planes[1].base, pipe);
> > > > >  	if (ret < 0)
> > > > >  		goto unprepare;
> > > > > -
> > > > > +	drm_mode_crtc_set_gamma_size(&mtk_crtc->base, MTK_LUT_SIZE);
> > > > > +	drm_helper_crtc_enable_color_mgmt(&mtk_crtc->base, MTK_LUT_SIZE,
> > > > > +					  MTK_LUT_SIZE);
> > > > 
> > > > I have applied all four patches and rebased onto v4.8-rc1, replacing
> > > > drm_helper_crtc_enable_color_mgmt with:
> > > > 
> > > > 	drm_crtc_enable_color_mgmt(&mtk_crtc->base, MTK_LUT_SIZE,
> > > > 				   true, MTK_LUT_SIZE);
> > > 
> > > BTW that looks wrong (already in the original). AFAICS the patch just
> > > handled the gamma_lut, not the degamma_lut, so telling you have both
> > > is not right.
> > 
> > Thanks, so should that be
> >        drm_crtc_enable_color_mgmt(&mtk_crtc->base, 0, false,
> >                                   MTK_LUT_SIZE);
> > instead, since we only handle gamma?
> 
> Hmm. Yeah, that looks correct since you didn't seem to have "ctm" either.

Yup, that's how this is meant to be used.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

WARNING: multiple messages have this Message-ID (diff)
From: Daniel Vetter <daniel@ffwll.ch>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>,
	Bibby Hsieh <bibby.hsieh@mediatek.com>,
	linux-kernel@vger.kernel.org,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Cawa Cheng <cawa.cheng@mediatek.com>,
	dri-devel@lists.freedesktop.org,
	Mao Huang <littlecvr@chromium.org>,
	linux-mediatek@lists.infradead.org,
	Sascha Hauer <kernel@pengutronix.de>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Yingjoe Chen <yingjoe.chen@mediatek.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v4 3/4] drm/mediatek: Add gamma correction.
Date: Thu, 11 Aug 2016 10:51:05 +0200	[thread overview]
Message-ID: <20160811085105.GI6232@phenom.ffwll.local> (raw)
In-Reply-To: <20160811080227.GH4329@intel.com>

On Thu, Aug 11, 2016 at 11:02:27AM +0300, Ville Syrjälä wrote:
> On Thu, Aug 11, 2016 at 09:51:16AM +0200, Philipp Zabel wrote:
> > Am Donnerstag, den 11.08.2016, 10:44 +0300 schrieb Ville Syrjälä:
> > > On Thu, Aug 11, 2016 at 09:32:59AM +0200, Philipp Zabel wrote:
> > > > Am Donnerstag, den 28.07.2016, 10:22 +0800 schrieb Bibby Hsieh:
> > > > > Add gamma set function to correct brightness values.
> > > > > It applies arbitrary mapping curve to compensate the
> > > > > incorrect transfer function of the panel.
> > > > > 
> > > > > Signed-off-by: Bibby Hsieh <bibby.hsieh@mediatek.com>
> > > > > ---
> > > > >  drivers/gpu/drm/mediatek/mtk_drm_crtc.c     |    8 ++++++-
> > > > >  drivers/gpu/drm/mediatek/mtk_drm_crtc.h     |    1 +
> > > > >  drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c |   31 +++++++++++++++++++++++++++
> > > > >  drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h |   10 +++++++++
> > > > >  4 files changed, 49 insertions(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > > > > index 24aa3ba..cbb460a5 100644
> > > > > --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > > > > +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > > > > @@ -409,6 +409,9 @@ static void mtk_drm_crtc_atomic_flush(struct drm_crtc *crtc,
> > > > >  	}
> > > > >  	if (pending_planes)
> > > > >  		mtk_crtc->pending_planes = true;
> > > > > +	if (crtc->state->color_mgmt_changed)
> > > > > +		for (i = 0; i < mtk_crtc->ddp_comp_nr; i++)
> > > > > +			mtk_ddp_gamma_set(mtk_crtc->ddp_comp[i], crtc->state);
> > > > >  }
> > > > >  
> > > > >  static const struct drm_crtc_funcs mtk_crtc_funcs = {
> > > > > @@ -418,6 +421,7 @@ static const struct drm_crtc_funcs mtk_crtc_funcs = {
> > > > >  	.reset			= mtk_drm_crtc_reset,
> > > > >  	.atomic_duplicate_state	= mtk_drm_crtc_duplicate_state,
> > > > >  	.atomic_destroy_state	= mtk_drm_crtc_destroy_state,
> > > > > +	.gamma_set		= drm_atomic_helper_legacy_gamma_set,
> > > > >  };
> > > > >  
> > > > >  static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = {
> > > > > @@ -568,7 +572,9 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
> > > > >  				&mtk_crtc->planes[1].base, pipe);
> > > > >  	if (ret < 0)
> > > > >  		goto unprepare;
> > > > > -
> > > > > +	drm_mode_crtc_set_gamma_size(&mtk_crtc->base, MTK_LUT_SIZE);
> > > > > +	drm_helper_crtc_enable_color_mgmt(&mtk_crtc->base, MTK_LUT_SIZE,
> > > > > +					  MTK_LUT_SIZE);
> > > > 
> > > > I have applied all four patches and rebased onto v4.8-rc1, replacing
> > > > drm_helper_crtc_enable_color_mgmt with:
> > > > 
> > > > 	drm_crtc_enable_color_mgmt(&mtk_crtc->base, MTK_LUT_SIZE,
> > > > 				   true, MTK_LUT_SIZE);
> > > 
> > > BTW that looks wrong (already in the original). AFAICS the patch just
> > > handled the gamma_lut, not the degamma_lut, so telling you have both
> > > is not right.
> > 
> > Thanks, so should that be
> >        drm_crtc_enable_color_mgmt(&mtk_crtc->base, 0, false,
> >                                   MTK_LUT_SIZE);
> > instead, since we only handle gamma?
> 
> Hmm. Yeah, that looks correct since you didn't seem to have "ctm" either.

Yup, that's how this is meant to be used.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  reply	other threads:[~2016-08-11  8:51 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-28  2:22 [PATCH v4 0/4] drm/mediatek: MT8173 gamma & dither support Bibby Hsieh
2016-07-28  2:22 ` Bibby Hsieh
2016-07-28  2:22 ` Bibby Hsieh
2016-07-28  2:22 ` [PATCH v4 1/4] drm/mediatek: Add AAL engine basic function Bibby Hsieh
2016-07-28  2:22   ` Bibby Hsieh
2016-07-28  2:22   ` Bibby Hsieh
2016-07-28  2:22 ` [PATCH v4 2/4] drm/mediatek: Add GAMMA " Bibby Hsieh
2016-07-28  2:22   ` Bibby Hsieh
2016-07-28  2:22   ` Bibby Hsieh
2016-07-28  2:22 ` [PATCH v4 3/4] drm/mediatek: Add gamma correction Bibby Hsieh
2016-07-28  2:22   ` Bibby Hsieh
2016-07-28  2:22   ` Bibby Hsieh
2016-08-11  7:32   ` Philipp Zabel
2016-08-11  7:32     ` Philipp Zabel
2016-08-11  7:32     ` Philipp Zabel
2016-08-11  7:44     ` Ville Syrjälä
2016-08-11  7:44       ` Ville Syrjälä
2016-08-11  7:44       ` Ville Syrjälä
2016-08-11  7:51       ` Philipp Zabel
2016-08-11  7:51         ` Philipp Zabel
2016-08-11  7:51         ` Philipp Zabel
2016-08-11  8:02         ` Ville Syrjälä
2016-08-11  8:02           ` Ville Syrjälä
2016-08-11  8:02           ` Ville Syrjälä
2016-08-11  8:51           ` Daniel Vetter [this message]
2016-08-11  8:51             ` Daniel Vetter
2016-08-11  8:51             ` Daniel Vetter
2016-08-11  9:11   ` [PATCH v4.5 " Philipp Zabel
2016-08-11  9:11     ` Philipp Zabel
2016-08-11  9:11     ` Philipp Zabel
2016-07-28  2:22 ` [PATCH v4 4/4] drm/mediatek: set mt8173 dithering function Bibby Hsieh
2016-07-28  2:22   ` Bibby Hsieh
2016-07-28  2:22   ` Bibby Hsieh

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=20160811085105.GI6232@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=cawa.cheng@mediatek.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=littlecvr@chromium.org \
    --cc=matthias.bgg@gmail.com \
    --cc=ville.syrjala@linux.intel.com \
    --cc=yingjoe.chen@mediatek.com \
    /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.