public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Petri Latvala <petri.latvala@intel.com>
To: Kunal Joshi <kunal1.joshi@intel.com>
Cc: igt-dev@lists.freedesktop.org, daniel.vetter@intel.com,
	ville.syrjala@intel.com
Subject: Re: [igt-dev] [PATCH i-g-t v3 2/3] lib/igt_color Moved kms_color functions to lib/igt_color to git avoid code duplication
Date: Tue, 21 Jan 2020 15:42:34 +0200	[thread overview]
Message-ID: <20200121134234.GD25209@platvala-desk.ger.corp.intel.com> (raw)
In-Reply-To: <1579586055-27583-3-git-send-email-kunal1.joshi@intel.com>

On Tue, Jan 21, 2020 at 11:24:14AM +0530, Kunal Joshi wrote:
> kms_color and kms_color_chamelium shared common functions.
> Moved them to lib/igt_color to avoid code duplication.
> 
> Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
> Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
> Suggested-by: Uma Shankar <uma.shankar@intel.com>
> ---
>  lib/Makefile.sources |   2 +
>  lib/igt_color.c      | 386 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  lib/igt_color.h      | 105 ++++++++++++++
>  3 files changed, 493 insertions(+)
>  create mode 100644 lib/igt_color.c
>  create mode 100644 lib/igt_color.h

Meson changes are missing.

The removal of those functions from tests/kms_color.c should be in this commit too.


> diff --git a/lib/igt_color.c b/lib/igt_color.c
> +
> +#include "igt_color.h"
> +
> +void paint_gradient_rectangles(data_t *data,
> +			       drmModeModeInfo *mode,
> +			       color_t *colors,
> +			       struct igt_fb *fb)


You can't just blindly copy the functions over. data_t is a name tests
use for their test-specific structures, library code shouldn't have
such a name. This function for example just uses drm_fd from data, so
the function should take int fd instead.


> +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 *lut;
> +	int i, lut_size = gamma->size;
> +	uint32_t max_value = (1 << 16) - 1;
> +	uint32_t mask;
> +
> +	if (is_i915_device(data->drm_fd))
> +		mask = ((1 << color_depth) - 1) << 8;
> +	else
> +		mask = max_value;
> +
> +	lut = malloc(sizeof(struct drm_color_lut) * lut_size);
> +
> +	if (IS_CHERRYVIEW(data->devid))

Another example why you can't just copy over functions from a test:
Nothing in this patch fills in the devid field.

Some documentation for new lib functions would also be very nice.


-- 
Petri Latvala
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2020-01-21 13:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-21  5:54 [igt-dev] [PATCH i-g-t v3 0/3] validate color tests using chamelium Kunal Joshi
2020-01-21  5:54 ` [igt-dev] [PATCH i-g-t v3 1/3] lib/igt_chamelium Added chamelium_frame_match_or_dump which returns bool that the captured frame matches Kunal Joshi
2020-01-21 13:29   ` Petri Latvala
2020-01-22  3:01     ` Kunal Joshi
2020-01-22 10:34       ` Petri Latvala
2020-01-21  5:54 ` [igt-dev] [PATCH i-g-t v3 3/3] tests/kms_color_chamelium: add subtests to validate color Kunal Joshi
2020-01-21 13:51   ` Petri Latvala
2020-01-23  7:00     ` Kunal Joshi
     [not found] ` <1579586055-27583-3-git-send-email-kunal1.joshi@intel.com>
2020-01-21 13:42   ` Petri Latvala [this message]
2020-01-21 13:43 ` [igt-dev] ✓ Fi.CI.BAT: success for validate color tests using chamelium. (rev3) Patchwork
2020-01-22 12:10 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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=20200121134234.GD25209@platvala-desk.ger.corp.intel.com \
    --to=petri.latvala@intel.com \
    --cc=daniel.vetter@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kunal1.joshi@intel.com \
    --cc=ville.syrjala@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox