All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Modem, Bhanuprakash" <bhanuprakash.modem@intel.com>
To: Pekka Paalanen <ppaalanen@gmail.com>
Cc: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
	"Shankar, Uma" <uma.shankar@intel.com>,
	"Kumar,  Mukunda Pramodh" <mukunda.pramodh.kumar@intel.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Subject: RE: [i-g-t 12/14] kms_color_helper: Add helper functions to support logarithmic gamma mode
Date: Mon, 3 Jan 2022 04:07:31 +0000	[thread overview]
Message-ID: <DM8PR11MB5719C85D4637EA40A58FADBC8D499@DM8PR11MB5719.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20211118114511.6488cb38@eldfell>

> From: Pekka Paalanen <ppaalanen@gmail.com>
> Sent: Thursday, November 18, 2021 3:15 PM
> To: Modem, Bhanuprakash <bhanuprakash.modem@intel.com>
> Cc: igt-dev@lists.freedesktop.org; dri-devel@lists.freedesktop.org; Kumar,
> Mukunda Pramodh <mukunda.pramodh.kumar@intel.com>; Juha-Pekka Heikkila
> <juhapekka.heikkila@gmail.com>; Shankar, Uma <uma.shankar@intel.com>
> Subject: Re: [i-g-t 12/14] kms_color_helper: Add helper functions to support
> logarithmic gamma mode
> 
> On Mon, 15 Nov 2021 15:17:57 +0530
> Bhanuprakash Modem <bhanuprakash.modem@intel.com> wrote:
> 
> > From: Mukunda Pramodh Kumar <mukunda.pramodh.kumar@intel.com>
> >
> > Add helper functions to support logarithmic gamma mode
> >
> > Cc: Harry Wentland <harry.wentland@amd.com>
> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> > Cc: Uma Shankar <uma.shankar@intel.com>
> > Signed-off-by: Mukunda Pramodh Kumar <mukunda.pramodh.kumar@intel.com>
> > Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
> > ---
> >  tests/kms_color_helper.c | 127 +++++++++++++++++++++++++++++++++++++++
> >  tests/kms_color_helper.h |  16 +++++
> >  2 files changed, 143 insertions(+)
> >
> > diff --git a/tests/kms_color_helper.c b/tests/kms_color_helper.c
> > index c65b7a0f50..7ea8282df3 100644
> > --- a/tests/kms_color_helper.c
> > +++ b/tests/kms_color_helper.c
> > @@ -190,6 +190,33 @@ struct drm_color_lut *coeffs_to_lut(data_t *data,
> >  	return lut;
> >  }
> >
> > +struct drm_color_lut *coeffs_to_logarithmic_lut(data_t *data,
> > +						const gamma_lut_t *gamma,
> > +						uint32_t color_depth,
> > +						int off)
> > +{
> > +	struct drm_color_lut *lut;
> > +	int i, lut_size = gamma->size;
> > +	/* This is the maximum value due to 16 bit precision in hardware. */
> 
> In whose hardware?
> 
> Are igt tests not supposed to be generic for everything that exposes
> the particular KMS properties?
> 
> This also hints that the UAPI design is lacking, because userspace
> needs to know hardware specific things out of thin air. Display servers
> are not going to have hardware-specific code. They specialise based on
> the existence of KMS properties instead.

Yeah, the comment is misleading and variable names also bit confusing.

As uapi supports U0.16 precision the max supported value would be (1 << 16) - 1
and Intel h/w supports max value of (1 << 24) so we need to scale the values
accordingly.

So, need to drop h/w specific hardcoded stuff and read from uapi & rename the
variables as below:

max_uapi_value = (1 << 16) - 1;
max_hw_value = /* Read from the uapi. */

> 
> > +	uint32_t max_hw_value = (1 << 16) - 1;
> > +	unsigned int max_segment_value = 1 << 24;
> > +
> > +	lut = malloc(sizeof(struct drm_color_lut) * lut_size);
> > +
> > +	for (i = 0; i < lut_size; i++) {
> > +		double scaling_factor = (double)max_hw_value /
> (double)max_segment_value;
> > +		uint32_t r = MIN((gamma->coeffs[i].r * scaling_factor),
> max_hw_value);
> > +		uint32_t g = MIN((gamma->coeffs[i].g * scaling_factor),
> max_hw_value);
> > +		uint32_t b = MIN((gamma->coeffs[i].b * scaling_factor),
> max_hw_value);
> > +
> > +		lut[i].red = r;
> > +		lut[i].green = g;
> > +		lut[i].blue = b;
> > +	}
> > +
> > +	return lut;
> > +}
> > +
> >  void set_degamma(data_t *data,
> >  		 igt_pipe_t *pipe,
> >  		 const gamma_lut_t *gamma)
> > @@ -203,6 +230,15 @@ void set_degamma(data_t *data,
> >  	free(lut);
> >  }
> >
> > +void set_pipe_gamma(igt_pipe_t *pipe,
> > +		    uint64_t value,
> > +		    struct drm_color_lut *lut,
> > +		    uint32_t size)
> > +{
> > +	igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_GAMMA_MODE, value);
> > +	igt_pipe_obj_replace_prop_blob(pipe, IGT_CRTC_GAMMA_LUT, lut, size);
> > +}
> > +
> >  void set_gamma(data_t *data,
> >  	       igt_pipe_t *pipe, const gamma_lut_t *gamma)
> >  {
> > @@ -241,6 +277,51 @@ void disable_prop(igt_pipe_t *pipe, enum
> igt_atomic_crtc_properties prop)
> >  		igt_pipe_obj_replace_prop_blob(pipe, prop, NULL, 0);
> >  }
> >
> > +drmModePropertyPtr get_pipe_gamma_degamma_mode(igt_pipe_t *pipe,
> > +					       enum igt_atomic_crtc_properties prop)
> > +{
> > +	igt_display_t *display = pipe->display;
> > +	uint32_t prop_id = pipe->props[prop];
> > +	drmModePropertyPtr drmProp;
> > +
> > +	igt_assert(prop_id);
> > +
> > +	drmProp = drmModeGetProperty(display->drm_fd, prop_id);
> > +
> > +	igt_assert(drmProp);
> > +	igt_assert(drmProp->count_enums);
> > +
> > +	return drmProp;
> > +}
> > +
> > +gamma_lut_t *pipe_create_linear_lut(segment_data_t *info)
> 
> Identity transformation?
> 
> > +{
> > +	uint32_t segment, entry, index = 0;
> > +	double val;
> > +	int i = 0;
> > +	gamma_lut_t *gamma = alloc_lut(info->entries_count);
> > +
> > +	igt_assert(gamma);
> > +
> > +	gamma->size = info->entries_count;
> > +	for (segment = 0; segment < info->segment_count; segment++) {
> > +		uint32_t entry_count = info->segment_data[segment].count;
> > +		uint32_t start = (segment == 0) ? 0 : (1 << (segment - 1));
> > +		uint32_t end = 1 << segment;
> > +
> > +		for (entry = 0; entry < entry_count; entry++) {
> > +			val = (index == 0) ? /* First entry is Zero. */
> > +				0 : start + entry *
> > +				((end - start) * 1.0 / entry_count);
> > +
> > +			set_rgb(&gamma->coeffs[i++], val);
> > +			index++;
> > +		}
> > +	}
> > +
> > +	return gamma;
> > +}
> > +
> >  drmModePropertyPtr get_plane_gamma_degamma_mode(igt_plane_t *plane,
> >  				enum igt_atomic_plane_properties prop)
> >  {
> > @@ -331,6 +412,7 @@ segment_data_t *get_segment_data(data_t *data,
> >  	info->segment_data = malloc(sizeof(struct drm_color_lut_range) * info-
> >segment_count);
> >  	igt_assert(info->segment_data);
> >
> > +	info->entries_count = 0;
> 
> What's this?
> 
> >  	for (i = 0; i < info->segment_count; i++) {
> >  		info->entries_count += lut_range[i].count;
> >  		info->segment_data[i] = lut_range[i];
> > @@ -341,6 +423,51 @@ segment_data_t *get_segment_data(data_t *data,
> >  	return info;
> >  }
> >
> > +void set_advance_gamma(data_t *data, igt_pipe_t *pipe, enum gamma_type
> type)
> > +{
> > +	igt_display_t *display = &data->display;
> > +	gamma_lut_t *gamma_log;
> > +	drmModePropertyPtr gamma_mode = NULL;
> > +	segment_data_t *segment_info = NULL;
> > +	struct drm_color_lut *lut = NULL;
> > +	int lut_size = 0;
> > +
> > +	drmSetClientCap(data->drm_fd, DRM_CLIENT_CAP_ADVANCE_GAMMA_MODES, 1);
> 
> Is this how we are going to do cross-software DRM-master hand-over or
> switching compatibility in general?
> 
> Add a new client cap for every new KMS property, and if the KMS client
> does not set the property, the kernel will magically reset it to ensure
> the client's expectations are met? Is that how it works?
> 
> Or why does this exist?

Very good point. Need to explore on this.
I think the expectation is: Whoever sets this property should clear before
hand-over or switching the compatibility.

> 
> > +	gamma_mode = get_pipe_gamma_degamma_mode(pipe, IGT_CRTC_GAMMA_MODE);
> > +
> > +	for (int i = 0; i < gamma_mode->count_enums; i++) {
> > +		if (!strcmp(gamma_mode->enums[i].name, "logarithmic gamma")) {
> > +			segment_info = get_segment_data(data,
> > +							gamma_mode->enums[i].value,
> > +							gamma_mode->enums[i].name);
> > +			lut_size = sizeof(struct drm_color_lut) *
> > +					  segment_info->entries_count;
> > +			if (type == LINEAR_GAMMA) {
> > +				gamma_log = pipe_create_linear_lut(segment_info);
> > +				lut = coeffs_to_logarithmic_lut(data,
> > +								gamma_log,
> > +								data->color_depth,
> > +								0);
> > +			} else if (type == MAX_GAMMA) {
> > +				gamma_log = generate_table_max(segment_info-
> >entries_count);
> > +				gamma_log->size = segment_info->entries_count;
> > +				lut = coeffs_to_lut(data, gamma_log,
> > +						    data->color_depth, 0);
> > +			}
> > +			set_pipe_gamma(pipe, gamma_mode->enums[i].value,
> > +				       lut, lut_size);
> > +			igt_display_commit2(display, display->is_atomic
> > +					    ? COMMIT_ATOMIC : COMMIT_LEGACY);
> > +			break;
> > +		}
> > +	}
> > +	drmSetClientCap(data->drm_fd, DRM_CLIENT_CAP_ADVANCE_GAMMA_MODES, 0);
> 
> I've never seen this done before. I did not know client caps could be
> reset.
> 
> > +	free(gamma_log);
> > +	free(lut);
> > +	clear_segment_data(segment_info);
> > +	drmModeFreeProperty(gamma_mode);
> > +}
> 
> 
> Thanks,
> pq
> 
> > +
> >  void set_plane_gamma(igt_plane_t *plane,
> >  		char *mode,
> >  		struct drm_color_lut_ext *lut,
> > diff --git a/tests/kms_color_helper.h b/tests/kms_color_helper.h
> > index 5a35dcaac1..c863874f0c 100644
> > --- a/tests/kms_color_helper.h
> > +++ b/tests/kms_color_helper.h
> > @@ -70,6 +70,11 @@ typedef struct {
> >  	uint32_t entries_count;
> >  } segment_data_t;
> >
> > +enum gamma_type {
> > +	LINEAR_GAMMA,
> > +	MAX_GAMMA
> > +};
> > +
> >  #define MIN(a, b) ((a) < (b) ? (a) : (b))
> >
> >  void paint_gradient_rectangles(data_t *data,
> > @@ -89,6 +94,10 @@ struct drm_color_lut *coeffs_to_lut(data_t *data,
> >  				    const gamma_lut_t *gamma,
> >  				    uint32_t color_depth,
> >  				    int off);
> > +struct drm_color_lut *coeffs_to_logarithmic_lut(data_t *data,
> > +						const gamma_lut_t *gamma,
> > +						uint32_t color_depth,
> > +						int off);
> >  void set_degamma(data_t *data,
> >  		 igt_pipe_t *pipe,
> >  		 const gamma_lut_t *gamma);
> > @@ -98,12 +107,19 @@ void set_gamma(data_t *data,
> >  void set_ctm(igt_pipe_t *pipe, const double *coefficients);
> >  void disable_prop(igt_pipe_t *pipe, enum igt_atomic_crtc_properties prop);
> >
> > +drmModePropertyPtr get_pipe_gamma_degamma_mode(igt_pipe_t *pipe,
> > +					       enum igt_atomic_crtc_properties
> > +					       prop);
> >  drmModePropertyPtr get_plane_gamma_degamma_mode(igt_plane_t *plane,
> >  	enum igt_atomic_plane_properties prop);
> >  void clear_segment_data(segment_data_t *info);
> > +gamma_lut_t *pipe_create_linear_lut(segment_data_t *info);
> >  struct drm_color_lut_ext *create_linear_lut(segment_data_t *info);
> >  struct drm_color_lut_ext *create_max_lut(segment_data_t *info);
> >  segment_data_t *get_segment_data(data_t *data, uint64_t blob_id, char
> *mode);
> > +void set_pipe_gamma(igt_pipe_t *pipe, uint64_t value,
> > +		    struct drm_color_lut *lut, uint32_t size);
> > +void set_advance_gamma(data_t *data, igt_pipe_t *pipe, enum gamma_type
> type);
> >  void set_plane_gamma(igt_plane_t *plane,
> >  	char *mode, struct drm_color_lut_ext *lut, uint32_t size);
> >  void set_plane_degamma(igt_plane_t *plane,


WARNING: multiple messages have this Message-ID (diff)
From: "Modem, Bhanuprakash" <bhanuprakash.modem@intel.com>
To: Pekka Paalanen <ppaalanen@gmail.com>
Cc: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
	"Kumar, Mukunda Pramodh" <mukunda.pramodh.kumar@intel.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Subject: Re: [igt-dev] [i-g-t 12/14] kms_color_helper: Add helper functions to support logarithmic gamma mode
Date: Mon, 3 Jan 2022 04:07:31 +0000	[thread overview]
Message-ID: <DM8PR11MB5719C85D4637EA40A58FADBC8D499@DM8PR11MB5719.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20211118114511.6488cb38@eldfell>

> From: Pekka Paalanen <ppaalanen@gmail.com>
> Sent: Thursday, November 18, 2021 3:15 PM
> To: Modem, Bhanuprakash <bhanuprakash.modem@intel.com>
> Cc: igt-dev@lists.freedesktop.org; dri-devel@lists.freedesktop.org; Kumar,
> Mukunda Pramodh <mukunda.pramodh.kumar@intel.com>; Juha-Pekka Heikkila
> <juhapekka.heikkila@gmail.com>; Shankar, Uma <uma.shankar@intel.com>
> Subject: Re: [i-g-t 12/14] kms_color_helper: Add helper functions to support
> logarithmic gamma mode
> 
> On Mon, 15 Nov 2021 15:17:57 +0530
> Bhanuprakash Modem <bhanuprakash.modem@intel.com> wrote:
> 
> > From: Mukunda Pramodh Kumar <mukunda.pramodh.kumar@intel.com>
> >
> > Add helper functions to support logarithmic gamma mode
> >
> > Cc: Harry Wentland <harry.wentland@amd.com>
> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> > Cc: Uma Shankar <uma.shankar@intel.com>
> > Signed-off-by: Mukunda Pramodh Kumar <mukunda.pramodh.kumar@intel.com>
> > Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
> > ---
> >  tests/kms_color_helper.c | 127 +++++++++++++++++++++++++++++++++++++++
> >  tests/kms_color_helper.h |  16 +++++
> >  2 files changed, 143 insertions(+)
> >
> > diff --git a/tests/kms_color_helper.c b/tests/kms_color_helper.c
> > index c65b7a0f50..7ea8282df3 100644
> > --- a/tests/kms_color_helper.c
> > +++ b/tests/kms_color_helper.c
> > @@ -190,6 +190,33 @@ struct drm_color_lut *coeffs_to_lut(data_t *data,
> >  	return lut;
> >  }
> >
> > +struct drm_color_lut *coeffs_to_logarithmic_lut(data_t *data,
> > +						const gamma_lut_t *gamma,
> > +						uint32_t color_depth,
> > +						int off)
> > +{
> > +	struct drm_color_lut *lut;
> > +	int i, lut_size = gamma->size;
> > +	/* This is the maximum value due to 16 bit precision in hardware. */
> 
> In whose hardware?
> 
> Are igt tests not supposed to be generic for everything that exposes
> the particular KMS properties?
> 
> This also hints that the UAPI design is lacking, because userspace
> needs to know hardware specific things out of thin air. Display servers
> are not going to have hardware-specific code. They specialise based on
> the existence of KMS properties instead.

Yeah, the comment is misleading and variable names also bit confusing.

As uapi supports U0.16 precision the max supported value would be (1 << 16) - 1
and Intel h/w supports max value of (1 << 24) so we need to scale the values
accordingly.

So, need to drop h/w specific hardcoded stuff and read from uapi & rename the
variables as below:

max_uapi_value = (1 << 16) - 1;
max_hw_value = /* Read from the uapi. */

> 
> > +	uint32_t max_hw_value = (1 << 16) - 1;
> > +	unsigned int max_segment_value = 1 << 24;
> > +
> > +	lut = malloc(sizeof(struct drm_color_lut) * lut_size);
> > +
> > +	for (i = 0; i < lut_size; i++) {
> > +		double scaling_factor = (double)max_hw_value /
> (double)max_segment_value;
> > +		uint32_t r = MIN((gamma->coeffs[i].r * scaling_factor),
> max_hw_value);
> > +		uint32_t g = MIN((gamma->coeffs[i].g * scaling_factor),
> max_hw_value);
> > +		uint32_t b = MIN((gamma->coeffs[i].b * scaling_factor),
> max_hw_value);
> > +
> > +		lut[i].red = r;
> > +		lut[i].green = g;
> > +		lut[i].blue = b;
> > +	}
> > +
> > +	return lut;
> > +}
> > +
> >  void set_degamma(data_t *data,
> >  		 igt_pipe_t *pipe,
> >  		 const gamma_lut_t *gamma)
> > @@ -203,6 +230,15 @@ void set_degamma(data_t *data,
> >  	free(lut);
> >  }
> >
> > +void set_pipe_gamma(igt_pipe_t *pipe,
> > +		    uint64_t value,
> > +		    struct drm_color_lut *lut,
> > +		    uint32_t size)
> > +{
> > +	igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_GAMMA_MODE, value);
> > +	igt_pipe_obj_replace_prop_blob(pipe, IGT_CRTC_GAMMA_LUT, lut, size);
> > +}
> > +
> >  void set_gamma(data_t *data,
> >  	       igt_pipe_t *pipe, const gamma_lut_t *gamma)
> >  {
> > @@ -241,6 +277,51 @@ void disable_prop(igt_pipe_t *pipe, enum
> igt_atomic_crtc_properties prop)
> >  		igt_pipe_obj_replace_prop_blob(pipe, prop, NULL, 0);
> >  }
> >
> > +drmModePropertyPtr get_pipe_gamma_degamma_mode(igt_pipe_t *pipe,
> > +					       enum igt_atomic_crtc_properties prop)
> > +{
> > +	igt_display_t *display = pipe->display;
> > +	uint32_t prop_id = pipe->props[prop];
> > +	drmModePropertyPtr drmProp;
> > +
> > +	igt_assert(prop_id);
> > +
> > +	drmProp = drmModeGetProperty(display->drm_fd, prop_id);
> > +
> > +	igt_assert(drmProp);
> > +	igt_assert(drmProp->count_enums);
> > +
> > +	return drmProp;
> > +}
> > +
> > +gamma_lut_t *pipe_create_linear_lut(segment_data_t *info)
> 
> Identity transformation?
> 
> > +{
> > +	uint32_t segment, entry, index = 0;
> > +	double val;
> > +	int i = 0;
> > +	gamma_lut_t *gamma = alloc_lut(info->entries_count);
> > +
> > +	igt_assert(gamma);
> > +
> > +	gamma->size = info->entries_count;
> > +	for (segment = 0; segment < info->segment_count; segment++) {
> > +		uint32_t entry_count = info->segment_data[segment].count;
> > +		uint32_t start = (segment == 0) ? 0 : (1 << (segment - 1));
> > +		uint32_t end = 1 << segment;
> > +
> > +		for (entry = 0; entry < entry_count; entry++) {
> > +			val = (index == 0) ? /* First entry is Zero. */
> > +				0 : start + entry *
> > +				((end - start) * 1.0 / entry_count);
> > +
> > +			set_rgb(&gamma->coeffs[i++], val);
> > +			index++;
> > +		}
> > +	}
> > +
> > +	return gamma;
> > +}
> > +
> >  drmModePropertyPtr get_plane_gamma_degamma_mode(igt_plane_t *plane,
> >  				enum igt_atomic_plane_properties prop)
> >  {
> > @@ -331,6 +412,7 @@ segment_data_t *get_segment_data(data_t *data,
> >  	info->segment_data = malloc(sizeof(struct drm_color_lut_range) * info-
> >segment_count);
> >  	igt_assert(info->segment_data);
> >
> > +	info->entries_count = 0;
> 
> What's this?
> 
> >  	for (i = 0; i < info->segment_count; i++) {
> >  		info->entries_count += lut_range[i].count;
> >  		info->segment_data[i] = lut_range[i];
> > @@ -341,6 +423,51 @@ segment_data_t *get_segment_data(data_t *data,
> >  	return info;
> >  }
> >
> > +void set_advance_gamma(data_t *data, igt_pipe_t *pipe, enum gamma_type
> type)
> > +{
> > +	igt_display_t *display = &data->display;
> > +	gamma_lut_t *gamma_log;
> > +	drmModePropertyPtr gamma_mode = NULL;
> > +	segment_data_t *segment_info = NULL;
> > +	struct drm_color_lut *lut = NULL;
> > +	int lut_size = 0;
> > +
> > +	drmSetClientCap(data->drm_fd, DRM_CLIENT_CAP_ADVANCE_GAMMA_MODES, 1);
> 
> Is this how we are going to do cross-software DRM-master hand-over or
> switching compatibility in general?
> 
> Add a new client cap for every new KMS property, and if the KMS client
> does not set the property, the kernel will magically reset it to ensure
> the client's expectations are met? Is that how it works?
> 
> Or why does this exist?

Very good point. Need to explore on this.
I think the expectation is: Whoever sets this property should clear before
hand-over or switching the compatibility.

> 
> > +	gamma_mode = get_pipe_gamma_degamma_mode(pipe, IGT_CRTC_GAMMA_MODE);
> > +
> > +	for (int i = 0; i < gamma_mode->count_enums; i++) {
> > +		if (!strcmp(gamma_mode->enums[i].name, "logarithmic gamma")) {
> > +			segment_info = get_segment_data(data,
> > +							gamma_mode->enums[i].value,
> > +							gamma_mode->enums[i].name);
> > +			lut_size = sizeof(struct drm_color_lut) *
> > +					  segment_info->entries_count;
> > +			if (type == LINEAR_GAMMA) {
> > +				gamma_log = pipe_create_linear_lut(segment_info);
> > +				lut = coeffs_to_logarithmic_lut(data,
> > +								gamma_log,
> > +								data->color_depth,
> > +								0);
> > +			} else if (type == MAX_GAMMA) {
> > +				gamma_log = generate_table_max(segment_info-
> >entries_count);
> > +				gamma_log->size = segment_info->entries_count;
> > +				lut = coeffs_to_lut(data, gamma_log,
> > +						    data->color_depth, 0);
> > +			}
> > +			set_pipe_gamma(pipe, gamma_mode->enums[i].value,
> > +				       lut, lut_size);
> > +			igt_display_commit2(display, display->is_atomic
> > +					    ? COMMIT_ATOMIC : COMMIT_LEGACY);
> > +			break;
> > +		}
> > +	}
> > +	drmSetClientCap(data->drm_fd, DRM_CLIENT_CAP_ADVANCE_GAMMA_MODES, 0);
> 
> I've never seen this done before. I did not know client caps could be
> reset.
> 
> > +	free(gamma_log);
> > +	free(lut);
> > +	clear_segment_data(segment_info);
> > +	drmModeFreeProperty(gamma_mode);
> > +}
> 
> 
> Thanks,
> pq
> 
> > +
> >  void set_plane_gamma(igt_plane_t *plane,
> >  		char *mode,
> >  		struct drm_color_lut_ext *lut,
> > diff --git a/tests/kms_color_helper.h b/tests/kms_color_helper.h
> > index 5a35dcaac1..c863874f0c 100644
> > --- a/tests/kms_color_helper.h
> > +++ b/tests/kms_color_helper.h
> > @@ -70,6 +70,11 @@ typedef struct {
> >  	uint32_t entries_count;
> >  } segment_data_t;
> >
> > +enum gamma_type {
> > +	LINEAR_GAMMA,
> > +	MAX_GAMMA
> > +};
> > +
> >  #define MIN(a, b) ((a) < (b) ? (a) : (b))
> >
> >  void paint_gradient_rectangles(data_t *data,
> > @@ -89,6 +94,10 @@ struct drm_color_lut *coeffs_to_lut(data_t *data,
> >  				    const gamma_lut_t *gamma,
> >  				    uint32_t color_depth,
> >  				    int off);
> > +struct drm_color_lut *coeffs_to_logarithmic_lut(data_t *data,
> > +						const gamma_lut_t *gamma,
> > +						uint32_t color_depth,
> > +						int off);
> >  void set_degamma(data_t *data,
> >  		 igt_pipe_t *pipe,
> >  		 const gamma_lut_t *gamma);
> > @@ -98,12 +107,19 @@ void set_gamma(data_t *data,
> >  void set_ctm(igt_pipe_t *pipe, const double *coefficients);
> >  void disable_prop(igt_pipe_t *pipe, enum igt_atomic_crtc_properties prop);
> >
> > +drmModePropertyPtr get_pipe_gamma_degamma_mode(igt_pipe_t *pipe,
> > +					       enum igt_atomic_crtc_properties
> > +					       prop);
> >  drmModePropertyPtr get_plane_gamma_degamma_mode(igt_plane_t *plane,
> >  	enum igt_atomic_plane_properties prop);
> >  void clear_segment_data(segment_data_t *info);
> > +gamma_lut_t *pipe_create_linear_lut(segment_data_t *info);
> >  struct drm_color_lut_ext *create_linear_lut(segment_data_t *info);
> >  struct drm_color_lut_ext *create_max_lut(segment_data_t *info);
> >  segment_data_t *get_segment_data(data_t *data, uint64_t blob_id, char
> *mode);
> > +void set_pipe_gamma(igt_pipe_t *pipe, uint64_t value,
> > +		    struct drm_color_lut *lut, uint32_t size);
> > +void set_advance_gamma(data_t *data, igt_pipe_t *pipe, enum gamma_type
> type);
> >  void set_plane_gamma(igt_plane_t *plane,
> >  	char *mode, struct drm_color_lut_ext *lut, uint32_t size);
> >  void set_plane_degamma(igt_plane_t *plane,


  reply	other threads:[~2022-01-03  4:07 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15  9:47 [i-g-t 00/14] Add IGT support for plane color management Bhanuprakash Modem
2021-11-15  9:47 ` [igt-dev] " Bhanuprakash Modem
2021-11-15  9:47 ` [i-g-t 01/14] HAX: Get uapi headers to compile the IGT Bhanuprakash Modem
2021-11-15  9:47 ` [i-g-t 02/14] lib/igt_kms: Add plane color mgmt properties Bhanuprakash Modem
2021-11-15  9:47   ` [igt-dev] " Bhanuprakash Modem
2021-11-15  9:47 ` [i-g-t 03/14] kms_color_helper: Add helper functions for plane color mgmt Bhanuprakash Modem
2021-11-15  9:47   ` [igt-dev] " Bhanuprakash Modem
2021-11-18  8:41   ` Pekka Paalanen
2021-11-18  8:41     ` [igt-dev] " Pekka Paalanen
2022-01-03  4:02     ` Modem, Bhanuprakash
2022-01-03  4:02       ` [igt-dev] " Modem, Bhanuprakash
2021-11-26 16:54   ` Harry Wentland
2021-11-26 16:54     ` [igt-dev] " Harry Wentland
2022-01-03  4:02     ` Modem, Bhanuprakash
2022-01-03  4:02       ` [igt-dev] " Modem, Bhanuprakash
2021-11-15  9:47 ` [i-g-t 04/14] tests/kms_color: New subtests for Plane gamma Bhanuprakash Modem
2021-11-15  9:47   ` [igt-dev] " Bhanuprakash Modem
2021-11-18  9:02   ` Pekka Paalanen
2021-11-18  9:02     ` [igt-dev] " Pekka Paalanen
2022-01-03  4:09     ` Modem, Bhanuprakash
2022-01-03  4:09       ` [igt-dev] " Modem, Bhanuprakash
2021-11-26 16:55   ` Harry Wentland
2021-11-26 16:55     ` [igt-dev] " Harry Wentland
2022-01-03  4:05     ` Modem, Bhanuprakash
2022-01-03  4:05       ` [igt-dev] " Modem, Bhanuprakash
2022-01-04 21:19       ` Harry Wentland
2022-01-05 11:21         ` Modem, Bhanuprakash
2022-01-05 11:21           ` [igt-dev] " Modem, Bhanuprakash
2022-01-05 22:13           ` Harry Wentland
2021-11-15  9:47 ` [i-g-t 05/14] tests/kms_color: New subtests for Plane degamma Bhanuprakash Modem
2021-11-15  9:47   ` [igt-dev] " Bhanuprakash Modem
2021-11-15  9:47 ` [i-g-t 06/14] tests/kms_color: New subtests for Plane CTM Bhanuprakash Modem
2021-11-15  9:47   ` [igt-dev] " Bhanuprakash Modem
2021-11-26 16:55   ` Harry Wentland
2021-11-15  9:47 ` [i-g-t 07/14] tests/kms_color: New negative tests for plane level color mgmt Bhanuprakash Modem
2021-11-15  9:47   ` [igt-dev] " Bhanuprakash Modem
2021-11-18  9:19   ` Pekka Paalanen
2021-11-18  9:19     ` [igt-dev] " Pekka Paalanen
2021-11-29 14:56     ` Harry Wentland
2022-01-03  4:05     ` Modem, Bhanuprakash
2022-01-03  4:05       ` [igt-dev] " Modem, Bhanuprakash
2021-11-15  9:47 ` [i-g-t 08/14] tests/kms_color_chamelium: New subtests for Plane gamma Bhanuprakash Modem
2021-11-15  9:47   ` [igt-dev] " Bhanuprakash Modem
2021-11-18  9:32   ` Pekka Paalanen
2021-11-18  9:32     ` [igt-dev] " Pekka Paalanen
2022-01-03  4:06     ` Modem, Bhanuprakash
2022-01-03  4:06       ` [igt-dev] " Modem, Bhanuprakash
2021-11-15  9:47 ` [i-g-t 09/14] tests/kms_color_chamelium: New subtests for Plane degamma Bhanuprakash Modem
2021-11-15  9:47   ` [igt-dev] " Bhanuprakash Modem
2021-11-15  9:47 ` [i-g-t 10/14] tests/kms_color_chamelium: New subtests for Plane CTM Bhanuprakash Modem
2021-11-15  9:47   ` [igt-dev] " Bhanuprakash Modem
2021-11-15  9:47 ` [i-g-t 11/14] lib/igt_kms: Add pipe color mgmt properties Bhanuprakash Modem
2021-11-15  9:47   ` [igt-dev] " Bhanuprakash Modem
2021-11-18  9:34   ` Pekka Paalanen
2021-11-18  9:34     ` [igt-dev] " Pekka Paalanen
2021-11-15  9:47 ` [i-g-t 12/14] kms_color_helper: Add helper functions to support logarithmic gamma mode Bhanuprakash Modem
2021-11-15  9:47   ` [igt-dev] " Bhanuprakash Modem
2021-11-18  9:45   ` Pekka Paalanen
2021-11-18  9:45     ` [igt-dev] " Pekka Paalanen
2022-01-03  4:07     ` Modem, Bhanuprakash [this message]
2022-01-03  4:07       ` Modem, Bhanuprakash
2021-11-26 16:55   ` Harry Wentland
2021-11-26 16:55     ` [igt-dev] " Harry Wentland
2022-01-03  4:08     ` Modem, Bhanuprakash
2022-01-03  4:08       ` [igt-dev] " Modem, Bhanuprakash
2021-11-15  9:47 ` [i-g-t 13/14] tests/kms_color: Extended IGT tests " Bhanuprakash Modem
2021-11-15  9:47   ` [igt-dev] " Bhanuprakash Modem
2021-11-15  9:47 ` [i-g-t 14/14] tests/kms_color_chamelium: " Bhanuprakash Modem
2021-11-15  9:47   ` [igt-dev] " Bhanuprakash Modem
2021-11-15 11:14 ` [igt-dev] ✓ Fi.CI.BAT: success for Add IGT support for plane color management Patchwork
2021-11-15 13:36 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2021-11-18  9:50 ` [i-g-t 00/14] " Pekka Paalanen
2021-11-18  9:50   ` [igt-dev] " Pekka Paalanen
2021-11-26 16:54   ` Harry Wentland
2021-11-29  9:20     ` Pekka Paalanen
2021-11-29  9:20       ` [igt-dev] " Pekka Paalanen
2021-11-29 15:20       ` Harry Wentland
2022-01-03  4:11         ` Modem, Bhanuprakash
2022-01-03  4:11           ` [igt-dev] " Modem, Bhanuprakash
2022-01-04 22:01           ` Harry Wentland
2022-01-04  7:57 ` [igt-dev] [v2 i-g-t 00/15] " Bhanuprakash Modem
2022-01-04  7:57   ` [igt-dev] [v2 i-g-t 01/15] HAX: Get uapi headers to compile the IGT Bhanuprakash Modem
2022-01-04  7:57   ` [igt-dev] [v2 i-g-t 02/15] lib/igt_kms: Add plane color mgmt properties Bhanuprakash Modem
2022-01-04  7:57   ` [igt-dev] [v2 i-g-t 03/15] kms_color_helper: Add helper functions for plane color mgmt Bhanuprakash Modem
2022-01-04  7:57   ` [igt-dev] [v2 i-g-t 04/15] tests/kms_color: New subtests for Plane gamma Bhanuprakash Modem
2022-01-04  7:57   ` [igt-dev] [v2 i-g-t 05/15] tests/kms_color: New subtests for Plane degamma Bhanuprakash Modem
2022-01-04  7:57   ` [igt-dev] [v2 i-g-t 06/15] tests/kms_color: New subtests for Plane CTM Bhanuprakash Modem
2022-01-04  7:57   ` [igt-dev] [v2 i-g-t 07/15] tests/kms_color: New negative tests for plane level color mgmt Bhanuprakash Modem
2022-01-04  7:57   ` [igt-dev] [v2 i-g-t 08/15] tests/kms_color_chamelium: New subtests for Plane gamma Bhanuprakash Modem
2022-01-04  7:57   ` [igt-dev] [v2 i-g-t 09/15] tests/kms_color_chamelium: New subtests for Plane degamma Bhanuprakash Modem
2022-01-04  7:57   ` [igt-dev] [v2 i-g-t 10/15] tests/kms_color_chamelium: New subtests for Plane CTM Bhanuprakash Modem
2022-01-04  7:57   ` [igt-dev] [v2 i-g-t 11/15] lib/igt_kms: Add pipe color mgmt properties Bhanuprakash Modem
2022-01-04  7:57   ` [igt-dev] [v2 i-g-t 12/15] kms_color_helper: Add helper functions to support logarithmic gamma mode Bhanuprakash Modem
2022-01-04  7:57   ` [igt-dev] [v2 i-g-t 13/15] tests/kms_color: Extended IGT tests " Bhanuprakash Modem
2022-01-04  7:57   ` [igt-dev] [v2 i-g-t 14/15] tests/kms_color_chamelium: " Bhanuprakash Modem
2022-01-04  7:57   ` [igt-dev] [v2 i-g-t 15/15] HAX: Add color mgmt tests to BAT Bhanuprakash Modem

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=DM8PR11MB5719C85D4637EA40A58FADBC8D499@DM8PR11MB5719.namprd11.prod.outlook.com \
    --to=bhanuprakash.modem@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=mukunda.pramodh.kumar@intel.com \
    --cc=ppaalanen@gmail.com \
    --cc=uma.shankar@intel.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.