All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ander Conselvan De Oliveira <conselvan2@gmail.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH i-g-t v2 07/15] igt_kms: Handle atomic pipe properties better.
Date: Thu, 21 Jul 2016 13:07:31 +0300	[thread overview]
Message-ID: <1469095651.2625.5.camel@gmail.com> (raw)
In-Reply-To: <1467798955-7324-8-git-send-email-maarten.lankhorst@linux.intel.com>

On Wed, 2016-07-06 at 11:55 +0200, Maarten Lankhorst wrote:
> Move properties to the pipe, they don't belong in the output
> and make atomic commit use the pipes for crtc properties.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>

> ---
>  lib/igt_kms.c | 98 +++++++++++++++++++++++++++++-----------------------------
> -
>  lib/igt_kms.h | 12 +++++---
>  2 files changed, 55 insertions(+), 55 deletions(-)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 88cae7d51787..8c7598a88a69 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -213,8 +213,7 @@ igt_atomic_fill_plane_props(igt_display_t *display,
> igt_plane_t *plane,
>   * config->atomic_props_crtc and config->atomic_props_connector.
>   */
>  static void
> -igt_atomic_fill_props(igt_display_t *display, igt_output_t *output,
> -			int num_crtc_props, const char **crtc_prop_names,
> +igt_atomic_fill_connector_props(igt_display_t *display, igt_output_t *output,
>  			int num_connector_props, const char
> **conn_prop_names)
>  {
>  	drmModeObjectPropertiesPtr props;
> @@ -222,18 +221,18 @@ igt_atomic_fill_props(igt_display_t *display,
> igt_output_t *output,
>  
>  	fd = display->drm_fd;
>  
> -	props = drmModeObjectGetProperties(fd, output->config.crtc->crtc_id,
> DRM_MODE_OBJECT_CRTC);
> +	props = drmModeObjectGetProperties(fd, output->config.connector-
> >connector_id, DRM_MODE_OBJECT_CONNECTOR);
>  	igt_assert(props);
>  
>  	for (i = 0; i < props->count_props; i++) {
>  		drmModePropertyPtr prop =
>  			drmModeGetProperty(fd, props->props[i]);
>  
> -		for (j = 0; j < num_crtc_props; j++) {
> -			if (strcmp(prop->name, crtc_prop_names[j]) != 0)
> +		for (j = 0; j < num_connector_props; j++) {
> +			if (strcmp(prop->name, conn_prop_names[j]) != 0)
>  				continue;
>  
> -			output->config.atomic_props_crtc[j] = props-
> >props[i];
> +			output->config.atomic_props_connector[j] = props-
> >props[i];
>  			break;
>  		}
>  
> @@ -241,19 +240,29 @@ igt_atomic_fill_props(igt_display_t *display,
> igt_output_t *output,
>  	}
>  
>  	drmModeFreeObjectProperties(props);
> -	props = NULL;
> -	props = drmModeObjectGetProperties(fd, output->config.connector-
> >connector_id, DRM_MODE_OBJECT_CONNECTOR);
> +}
> +
> +static void
> +igt_atomic_fill_pipe_props(igt_display_t *display, igt_pipe_t *pipe,
> +			int num_crtc_props, const char **crtc_prop_names)
> +{
> +	drmModeObjectPropertiesPtr props;
> +	int i, j, fd;
> +
> +	fd = display->drm_fd;
> +
> +	props = drmModeObjectGetProperties(fd, pipe->crtc_id,
> DRM_MODE_OBJECT_CRTC);
>  	igt_assert(props);
>  
>  	for (i = 0; i < props->count_props; i++) {
>  		drmModePropertyPtr prop =
>  			drmModeGetProperty(fd, props->props[i]);
>  
> -		for (j = 0; j < num_connector_props; j++) {
> -			if (strcmp(prop->name, conn_prop_names[j]) != 0)
> +		for (j = 0; j < num_crtc_props; j++) {
> +			if (strcmp(prop->name, crtc_prop_names[j]) != 0)
>  				continue;
>  
> -			output->config.atomic_props_connector[j] = props-
> >props[i];
> +			pipe->atomic_props_crtc[j] = props->props[i];
>  			break;
>  		}
>  
> @@ -261,7 +270,6 @@ igt_atomic_fill_props(igt_display_t *display, igt_output_t
> *output,
>  	}
>  
>  	drmModeFreeObjectProperties(props);
> -
>  }
>  
>  const unsigned char* igt_kms_get_alt_edid(void)
> @@ -1222,6 +1230,9 @@ static void igt_output_refresh(igt_output_t *output)
>  			       -1);
>  	}
>  
> +	igt_atomic_fill_connector_props(display, output,
> +		IGT_NUM_CONNECTOR_PROPS, igt_connector_prop_names);
> +
>  	if (!output->valid)
>  		return;
>  
> @@ -1232,8 +1243,6 @@ static void igt_output_refresh(igt_output_t *output)
>  	    kmstest_pipe_name(output->config.pipe));
>  
>  	display->pipes_in_use |= 1 << output->config.pipe;
> -	igt_atomic_fill_props(display, output, IGT_NUM_CRTC_PROPS,
> igt_crtc_prop_names,
> -		IGT_NUM_CONNECTOR_PROPS, igt_connector_prop_names);
>  }
>  
>  static bool
> @@ -1359,6 +1368,8 @@ void igt_display_init(igt_display_t *display, int
> drm_fd)
>  				  NULL,
>  				  NULL);
>  
> +		igt_atomic_fill_pipe_props(display, pipe, IGT_NUM_CRTC_PROPS,
> igt_crtc_prop_names);
> +
>  		/* add the planes that can be used with that pipe */
>  		for (j = 0; j < plane_resources->count_planes; j++) {
>  			drmModePlane *drm_plane;
> @@ -1660,11 +1671,10 @@ static uint32_t
> igt_plane_get_fb_gem_handle(igt_plane_t *plane)
>   * Add position and fb changes of a plane to the atomic property set
>   */
>  static void
> -igt_atomic_prepare_plane_commit(igt_plane_t *plane, igt_output_t *output,
> +igt_atomic_prepare_plane_commit(igt_plane_t *plane, igt_pipe_t *pipe,
>  	drmModeAtomicReq *req)
>  {
> -
> -	igt_display_t *display = output->display;
> +	igt_display_t *display = pipe->display;
>  	uint32_t fb_id, crtc_id;
>  
>  	igt_assert(plane->drm_plane);
> @@ -1674,12 +1684,11 @@ igt_atomic_prepare_plane_commit(igt_plane_t *plane,
> igt_output_t *output,
>  			!plane->rotation_changed);
>  
>  	fb_id = igt_plane_get_fb_id(plane);
> -	crtc_id = output->config.crtc->crtc_id;
> +	crtc_id = pipe->crtc_id;
>  
>  	LOG(display,
> -	    "%s: populating plane data: %s.%d, fb %u\n",
> -	    igt_output_name(output),
> -	    kmstest_pipe_name(output->config.pipe),
> +	    "populating plane data: %s.%d, fb %u\n",
> +	    kmstest_pipe_name(pipe->pipe),
>  	    plane->index,
>  	    fb_id);
>  
> @@ -2040,21 +2049,15 @@ static int igt_pipe_commit(igt_pipe_t *pipe,
>  /*
>   * Add crtc property changes to the atomic property set
>   */
> -static void igt_atomic_prepare_crtc_commit(igt_output_t *output,
> drmModeAtomicReq *req)
> +static void igt_atomic_prepare_crtc_commit(igt_pipe_t *pipe_obj,
> drmModeAtomicReq *req)
>  {
> -
> -	igt_pipe_t *pipe_obj = igt_output_get_driving_pipe(output);
> -
> -	if (!pipe_obj)
> -		return;
> -
>  	if (pipe_obj->background_changed)
> -		igt_atomic_populate_crtc_req(req, output,
> IGT_CRTC_BACKGROUND, pipe_obj->background);
> +		igt_atomic_populate_crtc_req(req, pipe_obj,
> IGT_CRTC_BACKGROUND, pipe_obj->background);
>  
>  	if (pipe_obj->color_mgmt_changed) {
> -		igt_atomic_populate_crtc_req(req, output,
> IGT_CRTC_DEGAMMA_LUT, pipe_obj->degamma_blob);
> -		igt_atomic_populate_crtc_req(req, output, IGT_CRTC_CTM,
> pipe_obj->ctm_blob);
> -		igt_atomic_populate_crtc_req(req, output, IGT_CRTC_GAMMA_LUT,
> pipe_obj->gamma_blob);
> +		igt_atomic_populate_crtc_req(req, pipe_obj,
> IGT_CRTC_DEGAMMA_LUT, pipe_obj->degamma_blob);
> +		igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_CTM,
> pipe_obj->ctm_blob);
> +		igt_atomic_populate_crtc_req(req, pipe_obj,
> IGT_CRTC_GAMMA_LUT, pipe_obj->gamma_blob);
>  	}
>  
>  	/*
> @@ -2088,42 +2091,37 @@ static void
> igt_atomic_prepare_connector_commit(igt_output_t *output, drmModeAto
>  static int igt_atomic_commit(igt_display_t *display)
>  {
>  
> -	int ret = 0;
> +	int ret = 0, i;
> +	enum pipe pipe;
>  	drmModeAtomicReq *req;
>  	igt_output_t *output;
> +
>  	if (display->is_atomic != 1)
>  		return -1;
>  	req = drmModeAtomicAlloc();
>  	drmModeAtomicSetCursor(req, 0);
>  
> -	for_each_connected_output(display, output) {
> -		igt_pipe_t *pipe_obj;
> +	for_each_pipe(display, pipe) {
> +		igt_pipe_t *pipe_obj = &display->pipes[pipe];
>  		igt_plane_t *plane;
> -		enum pipe pipe;
>  
>  		/*
>  		 * Add CRTC Properties to the property set
>  		 */
> -		igt_atomic_prepare_crtc_commit(output, req);
> -
> -		/*
> -		 * Add Connector Properties to the property set
> -		 */
> -		igt_atomic_prepare_connector_commit(output, req);
> -
> -
> -		pipe_obj = igt_output_get_driving_pipe(output);
> -		if (!pipe_obj)
> -			continue;
> -
> -		pipe = pipe_obj->pipe;
> +		igt_atomic_prepare_crtc_commit(pipe_obj, req);
>  
>  		for_each_plane_on_pipe(display, pipe, plane) {
> -			igt_atomic_prepare_plane_commit(plane, output, req);
> +			igt_atomic_prepare_plane_commit(plane, pipe_obj,
> req);
>  		}
>  
>  	}
>  
> +	for (i = 0; i < display->n_outputs; i++) {
> +		output = &display->outputs[i];
> +
> +		igt_atomic_prepare_connector_commit(output, req);
> +	}
> +
>  	ret = drmModeAtomicCommit(display->drm_fd, req, 0, NULL);
>  	drmModeAtomicFree(req);
>  	return ret;
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 3531dc20b6e0..b9e8d344ed8c 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -117,7 +117,6 @@ struct kmstest_connector_config {
>  	bool connector_scaling_mode_changed;
>  	uint64_t connector_dpms;
>  	bool connector_dpms_changed;
> -	uint32_t atomic_props_crtc[IGT_NUM_CRTC_PROPS];
>  	uint32_t atomic_props_connector[IGT_NUM_CONNECTOR_PROPS];
>  	int pipe;
>  	unsigned valid_crtc_idx_mask;
> @@ -257,6 +256,9 @@ struct igt_pipe {
>  	bool enabled;
>  	int n_planes;
>  	igt_plane_t planes[IGT_MAX_PLANES];
> +
> +	uint32_t atomic_props_crtc[IGT_NUM_CRTC_PROPS];
> +
>  	uint64_t background; /* Background color MSB BGR 16bpc LSB */
>  	uint32_t background_changed : 1;
>  	uint32_t background_property;
> @@ -395,13 +397,13 @@ static inline bool igt_pipe_connector_valid(enum pipe
> pipe,
>  /**
>   * igt_atomic_populate_crtc_req:
>   * @req: A pointer to drmModeAtomicReq
> - * @output: A pointer igt_output_t
> + * @pipe: A pointer igt_pipe_t
>   * @prop: one of igt_atomic_crtc_properties
>   * @value: the value to add
>   */
> -#define igt_atomic_populate_crtc_req(req, output, prop, value) \
> -	igt_assert_lt(0, drmModeAtomicAddProperty(req, output->config.crtc-
> >crtc_id,\
> -						  output-
> >config.atomic_props_crtc[prop], value))
> +#define igt_atomic_populate_crtc_req(req, pipe, prop, value) \
> +	igt_assert_lt(0, drmModeAtomicAddProperty(req, pipe->crtc_id,\
> +						  pipe-
> >atomic_props_crtc[prop], value))
>  /**
>   * igt_atomic_populate_connector_req:
>   * @req: A pointer to drmModeAtomicReq
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-07-21 10:07 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-06  9:55 [PATCH i-g-t v2 00/15] Add support for atomic modeset to IGT Maarten Lankhorst
2016-07-06  9:55 ` [PATCH i-g-t v2 01/15] igt_kms: Remove kmstest_connector_config.crtc_idx Maarten Lankhorst
2016-07-13 12:13   ` Daniel Vetter
2016-07-19 12:52     ` Maarten Lankhorst
2016-07-06  9:55 ` [PATCH i-g-t v2 02/15] igt_kms: Find optimal encoder only after selecting pipe Maarten Lankhorst
2016-07-15 11:14   ` Ander Conselvan De Oliveira
2016-07-06  9:55 ` [PATCH i-g-t v2 03/15] kms_psr_sink_crc: Use for_each_pipe_with_valid_output to find a valid config Maarten Lankhorst
2016-07-15 11:15   ` Ander Conselvan De Oliveira
2016-07-19 13:58     ` Ander Conselvan De Oliveira
2016-07-20  7:53       ` Maarten Lankhorst
2016-07-20 12:17         ` Ander Conselvan De Oliveira
2016-07-06  9:55 ` [PATCH i-g-t v2 04/15] igt_kms: Make PIPE_ANY a alias for PIPE_NONE Maarten Lankhorst
2016-07-06  9:55 ` [PATCH i-g-t v2 05/15] tests/kms: Clean up more users of unassigned pipes Maarten Lankhorst
2016-07-20 12:56   ` Ander Conselvan De Oliveira
2016-07-21  9:21     ` Maarten Lankhorst
2016-07-25 13:04     ` Maarten Lankhorst
2016-07-06  9:55 ` [PATCH i-g-t v2 06/15] igt_kms: Change PIPE_ANY behavior to mean unassigned Maarten Lankhorst
2016-07-21  9:23   ` Ander Conselvan De Oliveira
2016-07-06  9:55 ` [PATCH i-g-t v2 07/15] igt_kms: Handle atomic pipe properties better Maarten Lankhorst
2016-07-21 10:07   ` Ander Conselvan De Oliveira [this message]
2016-07-06  9:55 ` [PATCH i-g-t v2 08/15] igt_kms: Remove pan members from igt_plane, v2 Maarten Lankhorst
2016-07-21 11:42   ` Ander Conselvan De Oliveira
2016-07-21 12:37     ` Maarten Lankhorst
2016-07-06  9:55 ` [PATCH i-g-t v2 09/15] igt_kms: Clear all _changed members centrally Maarten Lankhorst
2016-07-21 12:13   ` Ander Conselvan De Oliveira
2016-07-21 12:43     ` Maarten Lankhorst
2016-07-06  9:55 ` [PATCH i-g-t v2 10/15] igt_kms: Add modeset support to atomic commits Maarten Lankhorst
2016-07-06  9:55 ` [PATCH i-g-t v2 11/15] tests: Add kms_rmfb test Maarten Lankhorst
2016-07-06  9:55 ` [PATCH i-g-t v2 12/15] tests: Add kms_atomic_transition Maarten Lankhorst
2016-07-06  9:55 ` [PATCH i-g-t v2 13/15] igt_kms: Add more apis for panel fitting test Maarten Lankhorst
2016-07-06  9:55 ` [PATCH i-g-t v2 14/15] igt_kms: Allow disabling previous override mode Maarten Lankhorst
2016-07-06  9:55 ` [PATCH i-g-t v2 15/15] kms_panel_fitting: Add tests for fastboot Maarten Lankhorst

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=1469095651.2625.5.camel@gmail.com \
    --to=conselvan2@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.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.