[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20191015085512.GA1624@jamwan02-TSP300>
Date: Tue, 15 Oct 2019 08:55:19 +0000
From: "james qian wang (Arm Technology China)" <james.qian.wang@....com>
To: Brian Starkey <Brian.Starkey@....com>
CC: Liviu Dudau <Liviu.Dudau@....com>,
"airlied@...ux.ie" <airlied@...ux.ie>,
"maarten.lankhorst@...ux.intel.com"
<maarten.lankhorst@...ux.intel.com>,
"sean@...rly.run" <sean@...rly.run>,
"imirkin@...m.mit.edu" <imirkin@...m.mit.edu>,
"Jonathan Chai (Arm Technology China)" <Jonathan.Chai@....com>,
"Julien Yin (Arm Technology China)" <Julien.Yin@....com>,
"Thomas Sun (Arm Technology China)" <thomas.Sun@....com>,
"Lowry Li (Arm Technology China)" <Lowry.Li@....com>,
Ayan Halder <Ayan.Halder@....com>,
"Tiannan Zhu (Arm Technology China)" <Tiannan.Zhu@....com>,
"Yiqi Kang (Arm Technology China)" <Yiqi.Kang@....com>,
nd <nd@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
Ben Davis <Ben.Davis@....com>,
"Oscar Zhang (Arm Technology China)" <Oscar.Zhang@....com>,
"Channing Chen (Arm Technology China)" <Channing.Chen@....com>,
Mihail Atanassov <Mihail.Atanassov@....com>
Subject: Re: [PATCH v4 2/4] drm/komeda: Add drm_lut_to_fgamma_coeffs()
On Tue, Oct 15, 2019 at 08:29:52AM +0000, Brian Starkey wrote:
> Hi James,
>
> On Tue, Oct 15, 2019 at 02:10:53AM +0000, james qian wang (Arm Technology China) wrote:
> > This function is used to convert drm 3dlut to komeda HW required 1d curve
>
> This is a 1D LUT, not a 3D LUT
>
Thank you Brian will correct it in the next version.
James
> Cheers,
> -Brian
>
> > coeffs values.
> >
> > Signed-off-by: james qian wang (Arm Technology China) <james.qian.wang@....com>
> > Reviewed-by: Mihail Atanassov <mihail.atanassov@....com>
> > ---
> > .../arm/display/komeda/komeda_color_mgmt.c | 52 +++++++++++++++++++
> > .../arm/display/komeda/komeda_color_mgmt.h | 9 +++-
> > 2 files changed, 60 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.c b/drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.c
> > index 9d14a92dbb17..c180ce70c26c 100644
> > --- a/drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.c
> > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.c
> > @@ -65,3 +65,55 @@ const s32 *komeda_select_yuv2rgb_coeffs(u32 color_encoding, u32 color_range)
> >
> > return coeffs;
> > }
> > +
> > +struct gamma_curve_sector {
> > + u32 boundary_start;
> > + u32 num_of_segments;
> > + u32 segment_width;
> > +};
> > +
> > +struct gamma_curve_segment {
> > + u32 start;
> > + u32 end;
> > +};
> > +
> > +static struct gamma_curve_sector sector_tbl[] = {
> > + { 0, 4, 4 },
> > + { 16, 4, 4 },
> > + { 32, 4, 8 },
> > + { 64, 4, 16 },
> > + { 128, 4, 32 },
> > + { 256, 4, 64 },
> > + { 512, 16, 32 },
> > + { 1024, 24, 128 },
> > +};
> > +
> > +static void
> > +drm_lut_to_coeffs(struct drm_property_blob *lut_blob, u32 *coeffs,
> > + struct gamma_curve_sector *sector_tbl, u32 num_sectors)
> > +{
> > + struct drm_color_lut *lut;
> > + u32 i, j, in, num = 0;
> > +
> > + if (!lut_blob)
> > + return;
> > +
> > + lut = lut_blob->data;
> > +
> > + for (i = 0; i < num_sectors; i++) {
> > + for (j = 0; j < sector_tbl[i].num_of_segments; j++) {
> > + in = sector_tbl[i].boundary_start +
> > + j * sector_tbl[i].segment_width;
> > +
> > + coeffs[num++] = drm_color_lut_extract(lut[in].red,
> > + KOMEDA_COLOR_PRECISION);
> > + }
> > + }
> > +
> > + coeffs[num] = BIT(KOMEDA_COLOR_PRECISION);
> > +}
> > +
> > +void drm_lut_to_fgamma_coeffs(struct drm_property_blob *lut_blob, u32 *coeffs)
> > +{
> > + drm_lut_to_coeffs(lut_blob, coeffs, sector_tbl, ARRAY_SIZE(sector_tbl));
> > +}
> > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.h b/drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.h
> > index a2df218f58e7..08ab69281648 100644
> > --- a/drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.h
> > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.h
> > @@ -11,7 +11,14 @@
> > #include <drm/drm_color_mgmt.h>
> >
> > #define KOMEDA_N_YUV2RGB_COEFFS 12
> > +#define KOMEDA_N_RGB2YUV_COEFFS 12
> > +#define KOMEDA_COLOR_PRECISION 12
> > +#define KOMEDA_N_GAMMA_COEFFS 65
> > +#define KOMEDA_COLOR_LUT_SIZE BIT(KOMEDA_COLOR_PRECISION)
> > +#define KOMEDA_N_CTM_COEFFS 9
> > +
> > +void drm_lut_to_fgamma_coeffs(struct drm_property_blob *lut_blob, u32 *coeffs);
> >
> > const s32 *komeda_select_yuv2rgb_coeffs(u32 color_encoding, u32 color_range);
> >
> > -#endif
> > +#endif /*_KOMEDA_COLOR_MGMT_H_*/
> > --
> > 2.20.1
> >
Powered by blists - more mailing lists