All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kahola <mika.kahola@intel.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH i-g-t v2 03/14] lib/igt_kms: Rework pipe properties to be more atomic, v7.
Date: Thu, 19 Oct 2017 13:28:02 +0300	[thread overview]
Message-ID: <1508408882.3274.121.camel@intel.com> (raw)
In-Reply-To: <20171012115435.18880-4-maarten.lankhorst@linux.intel.com>

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

On Thu, 2017-10-12 at 13:54 +0200, Maarten Lankhorst wrote:
> In the future I want to allow tests to commit more properties,
> but for this to work I have to fix all properties to work better
> with atomic commit. Instead of special casing each
> property make a bitmask for all property changed flags, and try to
> commit all properties.
> 
> This has been the most involved one, since legacy pipe commit still
> handles a lot of the properties differently from the rest.
> 
> Changes since v1:
> - Dump all changed properties on commit.
> - Fix bug in igt_pipe_refresh().
> Changes since v2:
> - Set pipe ACTIVE property changed flag on init.
> Changes since v3:
> - Add a missing igt_pipe_refresh() to kms_atomic_interruptible.
> Changes since v4:
> - Perform error handling when setting custom crtc properties.
> Changes since v5:
> - Only attempt to commit changes properties.
> Changes since v6:
> - Clear OUT_FENCE_PTR on succesful commit.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  lib/igt_kms.c                     | 231 ++++++++++++++++++++------
> ------------
>  lib/igt_kms.h                     |  77 +++++--------
>  tests/kms_atomic_interruptible.c  |   8 +-
>  tests/kms_atomic_transition.c     |   2 +-
>  tests/kms_crtc_background_color.c |   2 +-
>  5 files changed, 159 insertions(+), 161 deletions(-)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index e77ae5d696da..02de39b8fc7f 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -259,8 +259,8 @@ igt_atomic_fill_connector_props(igt_display_t
> *display, igt_output_t *output,
>  }
>  
>  static void
> -igt_atomic_fill_pipe_props(igt_display_t *display, igt_pipe_t *pipe,
> -			int num_crtc_props, const char
> **crtc_prop_names)
> +igt_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;
> @@ -278,7 +278,7 @@ igt_atomic_fill_pipe_props(igt_display_t
> *display, igt_pipe_t *pipe,
>  			if (strcmp(prop->name, crtc_prop_names[j])
> != 0)
>  				continue;
>  
> -			pipe->atomic_props_crtc[j] = props-
> >props[i];
> +			pipe->props[j] = props->props[i];
>  			break;
>  		}
>  
> @@ -1620,13 +1620,6 @@ get_crtc_property(int drm_fd, uint32_t
> crtc_id, const char *name,
>  				    name, prop_id, value, prop);
>  }
>  
> -static void
> -igt_crtc_set_property(igt_pipe_t *pipe, uint32_t prop_id, uint64_t
> value)
> -{
> -	drmModeObjectSetProperty(pipe->display->drm_fd,
> -		pipe->crtc_id, DRM_MODE_OBJECT_CRTC, prop_id,
> value);
> -}
> -
>  /*
>   * Walk a plane's property list to determine its type.  If we don't
>   * find a type property, then the kernel doesn't support universal
> @@ -1690,7 +1683,6 @@ void igt_display_init(igt_display_t *display,
> int drm_fd)
>  		int p = 1;
>  		int j, type;
>  		uint8_t last_plane = 0, n_planes = 0;
> -		uint64_t prop_value;
>  
>  		pipe->crtc_id = resources->crtcs[i];
>  		pipe->display = display;
> @@ -1700,29 +1692,16 @@ void igt_display_init(igt_display_t *display,
> int drm_fd)
>  		pipe->planes = NULL;
>  		pipe->out_fence_fd = -1;
>  
> +		igt_fill_pipe_props(display, pipe,
> IGT_NUM_CRTC_PROPS, igt_crtc_prop_names);
> +
> +		/* Force modeset disable on first commit */
> +		igt_pipe_obj_set_prop_changed(pipe,
> IGT_CRTC_MODE_ID);
> +		igt_pipe_obj_set_prop_changed(pipe,
> IGT_CRTC_ACTIVE);
> +
>  		get_crtc_property(display->drm_fd, pipe->crtc_id,
> -				    "background_color",
> -				    &pipe->background_property,
> -				    &prop_value,
> +				    "background_color", NULL,
> +				    &pipe-
> >values[IGT_CRTC_BACKGROUND],
>  				    NULL);
> -		pipe->background = (uint32_t)prop_value;
> -		get_crtc_property(display->drm_fd, pipe->crtc_id,
> -				  "DEGAMMA_LUT",
> -				  &pipe->degamma_property,
> -				  NULL,
> -				  NULL);
> -		get_crtc_property(display->drm_fd, pipe->crtc_id,
> -				  "CTM",
> -				  &pipe->ctm_property,
> -				  NULL,
> -				  NULL);
> -		get_crtc_property(display->drm_fd, pipe->crtc_id,
> -				  "GAMMA_LUT",
> -				  &pipe->gamma_property,
> -				  NULL,
> -				  NULL);
> -
> -		igt_atomic_fill_pipe_props(display, pipe,
> IGT_NUM_CRTC_PROPS, igt_crtc_prop_names);
>  
>  		/* count number of valid planes */
>  		for (j = 0; j < plane_resources->count_planes; j++)
> {
> @@ -1813,8 +1792,6 @@ void igt_display_init(igt_display_t *display,
> int drm_fd)
>  			igt_assert_eq(p, n_planes);
>  
>  		pipe->n_planes = n_planes;
> -
> -		pipe->mode_changed = true;
>  	}
>  
>  	/*
> @@ -2291,7 +2268,7 @@ static int
> igt_primary_plane_commit_legacy(igt_plane_t *primary,
>  
>  	if (!igt_plane_is_prop_changed(primary, IGT_PLANE_FB_ID) &&
>  	    !(primary->changed & IGT_PLANE_COORD_CHANGED_MASK) &&
> -	    !primary->pipe->mode_changed)
> +	    !igt_pipe_obj_is_prop_changed(primary->pipe,
> IGT_CRTC_MODE_ID))
>  		return 0;
>  
>  	crtc_id = pipe->crtc_id;
> @@ -2360,6 +2337,16 @@ static int igt_plane_commit(igt_plane_t
> *plane,
>  	}
>  }
>  
> +static bool is_atomic_prop(enum igt_atomic_crtc_properties prop)
> +{
> +       if (prop == IGT_CRTC_MODE_ID ||
> +	   prop == IGT_CRTC_ACTIVE ||
> +	   prop == IGT_CRTC_OUT_FENCE_PTR)
> +		return true;
> +
> +	return false;
> +}
> +
>  /*
>   * Commit all plane changes to an output.  Note that if @s is
> COMMIT_LEGACY,
>   * enabling/disabling the primary plane will also enable/disable the
> CRTC.
> @@ -2377,19 +2364,17 @@ static int igt_pipe_commit(igt_pipe_t *pipe,
>  	int i;
>  	int ret;
>  
> -	if (pipe->background_changed) {
> -		igt_crtc_set_property(pipe, pipe-
> >background_property,
> -			pipe->background);
> -	}
> +	for (i = 0; i < IGT_NUM_CRTC_PROPS; i++)
> +		if (igt_pipe_obj_is_prop_changed(pipe, i) &&
> +		    !is_atomic_prop(i)) {
> +			igt_assert(pipe->props[i]);
>  
> -	if (pipe->color_mgmt_changed) {
> -		igt_crtc_set_property(pipe, pipe->degamma_property,
> -				      pipe->degamma_blob);
> -		igt_crtc_set_property(pipe, pipe->ctm_property,
> -				      pipe->ctm_blob);
> -		igt_crtc_set_property(pipe, pipe->gamma_property,
> -				      pipe->gamma_blob);
> -	}
> +			ret = drmModeObjectSetProperty(pipe-
> >display->drm_fd,
> +				pipe->crtc_id, DRM_MODE_OBJECT_CRTC,
> +				pipe->props[i], pipe->values[i]);
> +
> +			CHECK_RETURN(ret, fail_on_error);
> +		}
>  
>  	for (i = 0; i < pipe->n_planes; i++) {
>  		igt_plane_t *plane = &pipe->planes[i];
> @@ -2402,9 +2387,10 @@ static int igt_pipe_commit(igt_pipe_t *pipe,
>  }
>  
>  static void
> -igt_pipe_replace_blob(igt_pipe_t *pipe, uint64_t *blob, void *ptr,
> size_t length)
> +igt_pipe_replace_blob(igt_pipe_t *pipe, enum
> igt_atomic_crtc_properties prop, void *ptr, size_t length)
>  {
>  	igt_display_t *display = pipe->display;
> +	uint64_t *blob = &pipe->values[prop];
>  	uint32_t blob_id = 0;
>  
>  	if (*blob != 0)
> @@ -2416,6 +2402,7 @@ igt_pipe_replace_blob(igt_pipe_t *pipe,
> uint64_t *blob, void *ptr, size_t length
>  						     ptr, length,
> &blob_id) == 0);
>  
>  	*blob = blob_id;
> +	igt_pipe_obj_set_prop_changed(pipe, prop);
>  }
>  
>  /*
> @@ -2423,51 +2410,23 @@ igt_pipe_replace_blob(igt_pipe_t *pipe,
> uint64_t *blob, void *ptr, size_t length
>   */
>  static void igt_atomic_prepare_crtc_commit(igt_pipe_t *pipe_obj,
> drmModeAtomicReq *req)
>  {
> -	if (pipe_obj->background_changed)
> -		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, 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);
> -	}
> -
> -	if (pipe_obj->mode_changed) {
> -		igt_output_t *output =
> igt_pipe_get_output(pipe_obj);
> -
> -		if (!output) {
> -			igt_pipe_replace_blob(pipe_obj, &pipe_obj-
> >mode_blob, NULL, 0);
> -
> -			LOG(pipe_obj->display, "%s: Setting NULL
> mode\n",
> -			    kmstest_pipe_name(pipe_obj->pipe));
> -		} else {
> -			drmModeModeInfo *mode =
> igt_output_get_mode(output);
> +	int i;
>  
> -			igt_pipe_replace_blob(pipe_obj, &pipe_obj-
> >mode_blob, mode, sizeof(*mode));
> +	for (i = 0; i < IGT_NUM_CRTC_PROPS; i++) {
> +		if (!igt_pipe_obj_is_prop_changed(pipe_obj, i))
> +			continue;
>  
> -			LOG(pipe_obj->display, "%s: Setting mode %s
> from %s\n",
> -			    kmstest_pipe_name(pipe_obj->pipe),
> -			    mode->name, igt_output_name(output));
> -		}
> +		igt_debug("Pipe %s: Setting property \"%s\" to
> 0x%"PRIx64"/%"PRIi64"\n",
> +			kmstest_pipe_name(pipe_obj->pipe),
> igt_crtc_prop_names[i],
> +			pipe_obj->values[i], pipe_obj->values[i]);
>  
> -		igt_atomic_populate_crtc_req(req, pipe_obj,
> IGT_CRTC_MODE_ID, pipe_obj->mode_blob);
> -		igt_atomic_populate_crtc_req(req, pipe_obj,
> IGT_CRTC_ACTIVE, !!output);
> +		igt_assert_lt(0, drmModeAtomicAddProperty(req,
> pipe_obj->crtc_id, pipe_obj->props[i], pipe_obj->values[i]));
>  	}
>  
>  	if (pipe_obj->out_fence_fd != -1) {
>  		close(pipe_obj->out_fence_fd);
>  		pipe_obj->out_fence_fd = -1;
>  	}
> -
> -	if (pipe_obj->out_fence_requested)
> -	{
> -		igt_atomic_populate_crtc_req(req, pipe_obj,
> IGT_CRTC_OUT_FENCE_PTR,
> -		    (uint64_t)(uintptr_t) &pipe_obj->out_fence_fd);
> -	}
> -
> -	/*
> -	 *	TODO: Add all crtc level properties here
> -	 */
>  }
>  
>  /*
> @@ -2558,15 +2517,22 @@ display_commit_changed(igt_display_t
> *display, enum igt_commit_style s)
>  		igt_pipe_t *pipe_obj = &display->pipes[pipe];
>  		igt_plane_t *plane;
>  
> -		pipe_obj->color_mgmt_changed = false;
> -		pipe_obj->background_changed = false;
> +		if (s == COMMIT_ATOMIC) {
> +			if (igt_pipe_obj_is_prop_changed(pipe_obj,
> IGT_CRTC_OUT_FENCE_PTR))
> +				igt_assert(pipe_obj->out_fence_fd >=
> 0);
>  
> -		if (s != COMMIT_UNIVERSAL)
> -			pipe_obj->mode_changed = false;
> -
> -		if (s == COMMIT_ATOMIC && pipe_obj-
> >out_fence_requested) {
> -			pipe_obj->out_fence_requested = false;
> -			igt_assert(pipe_obj->out_fence_fd >= 0);
> +			pipe_obj->values[IGT_CRTC_OUT_FENCE_PTR] =
> 0;
> +			pipe_obj->changed = 0;
> +		} else {
> +			igt_pipe_obj_clear_prop_changed(pipe_obj,
> IGT_CRTC_BACKGROUND);
> +			igt_pipe_obj_clear_prop_changed(pipe_obj,
> IGT_CRTC_CTM);
> +			igt_pipe_obj_clear_prop_changed(pipe_obj,
> IGT_CRTC_DEGAMMA_LUT);
> +			igt_pipe_obj_clear_prop_changed(pipe_obj,
> IGT_CRTC_GAMMA_LUT);
> +
> +			if (s != COMMIT_UNIVERSAL) {
> +				igt_pipe_obj_clear_prop_changed(pipe
> _obj, IGT_CRTC_MODE_ID);
> +				igt_pipe_obj_clear_prop_changed(pipe
> _obj, IGT_CRTC_ACTIVE);
> +			}
>  		}
>  
>  		for_each_plane_on_pipe(display, pipe, plane) {
> @@ -2820,33 +2786,83 @@ void igt_output_override_mode(igt_output_t
> *output, drmModeModeInfo *mode)
>  
>  	output->use_override_mode = !!mode;
>  
> -	if (pipe)
> -		pipe->mode_changed = true;
> +	if (pipe) {
> +		if (output->display->is_atomic)
> +			igt_pipe_replace_blob(pipe,
> IGT_CRTC_MODE_ID, igt_output_get_mode(output), sizeof(*mode));
> +		else
> +			igt_pipe_obj_set_prop_changed(pipe,
> IGT_CRTC_MODE_ID);
> +	}
>  }
>  
>  void igt_output_set_pipe(igt_output_t *output, enum pipe pipe)
>  {
>  	igt_display_t *display = output->display;
> -	igt_pipe_t *old_pipe;
> +	igt_pipe_t *old_pipe = NULL, *pipe_obj = NULL;;
>  
>  	igt_assert(output->name);
>  
> -	if (output->pending_pipe != PIPE_NONE) {
> +	if (output->pending_pipe != PIPE_NONE)
>  		old_pipe = igt_output_get_driving_pipe(output);
>  
> -		old_pipe->mode_changed = true;
> -	}
> +	if (pipe != PIPE_NONE)
> +		pipe_obj = &display->pipes[pipe];
>  
>  	LOG(display, "%s: set_pipe(%s)\n", igt_output_name(output),
>  	    kmstest_pipe_name(pipe));
>  	output->pending_pipe = pipe;
>  
> -	if (pipe != PIPE_NONE)
> -		display->pipes[pipe].mode_changed = true;
> +	if (old_pipe) {
> +		igt_output_t *old_output;
> +
> +		old_output = igt_pipe_get_output(old_pipe);
> +		if (!old_output) {
> +			if (display->is_atomic)
> +				igt_pipe_replace_blob(old_pipe,
> IGT_CRTC_MODE_ID, NULL, 0);
> +			else
> +				igt_pipe_obj_set_prop_changed(old_pi
> pe, IGT_CRTC_MODE_ID);
> +
> +			igt_pipe_obj_set_prop_value(old_pipe,
> IGT_CRTC_ACTIVE, 0);
> +		}
> +	}
>  
>  	igt_output_set_prop_value(output, IGT_CONNECTOR_CRTC_ID,
> pipe == PIPE_NONE ? 0 : display->pipes[pipe].crtc_id);
>  
>  	igt_output_refresh(output);
> +
> +	if (pipe_obj) {
> +		if (display->is_atomic)
> +			igt_pipe_replace_blob(pipe_obj,
> IGT_CRTC_MODE_ID, igt_output_get_mode(output),
> sizeof(drmModeModeInfo));
> +		else
> +			igt_pipe_obj_set_prop_changed(pipe_obj,
> IGT_CRTC_MODE_ID);
> +
> +		igt_pipe_obj_set_prop_value(pipe_obj,
> IGT_CRTC_ACTIVE, 1);
> +	}
> +}
> +
> +/*
> + * igt_pipe_refresh:
> + * @display: a pointer to an #igt_display_t structure
> + * @pipe: Pipe to refresh
> + * @force: Should be set to true if mode_blob is no longer
> considered
> + * to be valid, for example after doing an atomic commit during fork
> or closing display fd.
> + *
> + * Requests the pipe to be part of the state on next update.
> + * This is useful when state may have been out of sync after
> + * a fork, or we just want to be sure the pipe is included
> + * in the next commit.
> + */
> +void igt_pipe_refresh(igt_display_t *display, enum pipe pipe, bool
> force)
> +{
> +	igt_pipe_t *pipe_obj = &display->pipes[pipe];
> +
> +	if (force && display->is_atomic) {
> +		igt_output_t *output =
> igt_pipe_get_output(pipe_obj);
> +
> +		pipe_obj->values[IGT_CRTC_MODE_ID] = 0;
> +		if (output)
> +			igt_pipe_replace_blob(pipe_obj,
> IGT_CRTC_MODE_ID, igt_output_get_mode(output),
> sizeof(drmModeModeInfo));
> +	} else
> +		igt_pipe_obj_set_prop_changed(pipe_obj,
> IGT_CRTC_MODE_ID);
>  }
>  
>  void igt_output_set_scaling_mode(igt_output_t *output, uint64_t
> scaling_mode)
> @@ -3052,28 +3068,25 @@ void igt_plane_set_rotation(igt_plane_t
> *plane, igt_rotation_t rotation)
>   */
>  void igt_pipe_request_out_fence(igt_pipe_t *pipe)
>  {
> -	pipe->out_fence_requested = true;
> +	igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_OUT_FENCE_PTR,
> (ptrdiff_t)&pipe->out_fence_fd);
>  }
>  
>  void
>  igt_pipe_set_degamma_lut(igt_pipe_t *pipe, void *ptr, size_t length)
>  {
> -	igt_pipe_replace_blob(pipe, &pipe->degamma_blob, ptr,
> length);
> -	pipe->color_mgmt_changed = 1;
> +	igt_pipe_replace_blob(pipe, IGT_CRTC_DEGAMMA_LUT, ptr,
> length);
>  }
>  
>  void
>  igt_pipe_set_ctm_matrix(igt_pipe_t *pipe, void *ptr, size_t length)
>  {
> -	igt_pipe_replace_blob(pipe, &pipe->ctm_blob, ptr, length);
> -	pipe->color_mgmt_changed = 1;
> +	igt_pipe_replace_blob(pipe, IGT_CRTC_CTM, ptr, length);
>  }
>  
>  void
>  igt_pipe_set_gamma_lut(igt_pipe_t *pipe, void *ptr, size_t length)
>  {
> -	igt_pipe_replace_blob(pipe, &pipe->gamma_blob, ptr, length);
> -	pipe->color_mgmt_changed = 1;
> +	igt_pipe_replace_blob(pipe, IGT_CRTC_GAMMA_LUT, ptr,
> length);
>  }
>  
>  /**
> @@ -3094,9 +3107,7 @@ void igt_crtc_set_background(igt_pipe_t *pipe,
> uint64_t background)
>  	    kmstest_pipe_name(pipe->pipe),
>  	    pipe->pipe, background);
>  
> -	pipe->background = background;
> -
> -	pipe->background_changed = true;
> +	igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_BACKGROUND,
> background);
>  }
>  
>  void igt_wait_for_vblank_count(int drm_fd, enum pipe pipe, int
> count)
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index f87f8be31421..b53127ffef5f 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -313,27 +313,13 @@ struct igt_pipe {
>  	int plane_primary;
>  	igt_plane_t *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;
> -
> -	uint64_t degamma_blob;
> -	uint32_t degamma_property;
> -	uint64_t ctm_blob;
> -	uint32_t ctm_property;
> -	uint64_t gamma_blob;
> -	uint32_t gamma_property;
> -	uint32_t color_mgmt_changed : 1;
> +	uint64_t changed;
> +	uint32_t props[IGT_NUM_CRTC_PROPS];
> +	uint64_t values[IGT_NUM_CRTC_PROPS];
>  
>  	uint32_t crtc_id;
>  
> -	uint64_t mode_blob;
> -	bool mode_changed;
> -
>  	int32_t out_fence_fd;
> -	bool out_fence_requested;
>  };
>  
>  typedef struct {
> @@ -527,17 +513,6 @@ static inline bool
> igt_output_is_connected(igt_output_t *output)
>  		igt_plane_set_prop_changed(plane, prop); \
>  	} while (0)
>  
> -/**
> - * igt_atomic_populate_crtc_req:
> - * @req: A pointer to drmModeAtomicReq
> - * @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, pipe, prop, value) \
> -	igt_assert_lt(0, drmModeAtomicAddProperty(req, pipe-
> >crtc_id,\
> -						  pipe-
> >atomic_props_crtc[prop], value))
> -
>  #define igt_output_is_prop_changed(output, prop) \
>  	(!!((output)->changed & (1 << (prop))))
>  #define igt_output_set_prop_changed(output, prop) \
> @@ -552,26 +527,34 @@ static inline bool
> igt_output_is_connected(igt_output_t *output)
>  		igt_output_set_prop_changed(output, prop); \
>  	} while (0)
>  
> -/*
> - * igt_pipe_refresh:
> - * @display: a pointer to an #igt_display_t structure
> - * @pipe: Pipe to refresh
> - * @force: Should be set to true if mode_blob is no longer
> considered
> - * to be valid, for example after doing an atomic commit during fork
> or closing display fd.
> - *
> - * Requests the pipe to be part of the state on next update.
> - * This is useful when state may have been out of sync after
> - * a fork, or we just want to be sure the pipe is included
> - * in the next commit.
> - */
> -static inline void
> -igt_pipe_refresh(igt_display_t *display, enum pipe pipe, bool force)
> -{
> -	if (force)
> -		display->pipes[pipe].mode_blob = 0;
> +#define igt_pipe_obj_is_prop_changed(pipe_obj, prop) \
> +	(!!((pipe_obj)->changed & (1 << (prop))))
>  
> -	display->pipes[pipe].mode_changed = true;
> -}
> +#define igt_pipe_is_prop_changed(display, pipe, prop) \
> +	igt_pipe_obj_is_prop_changed(&(display)->pipes[(pipe)],
> prop)
> +
> +#define igt_pipe_obj_set_prop_changed(pipe_obj, prop) \
> +	(pipe_obj)->changed |= 1 << (prop)
> +
> +#define igt_pipe_set_prop_changed(display, pipe, prop) \
> +	igt_pipe_obj_set_prop_changed(&(display)->pipes[(pipe)],
> prop)
> +
> +#define igt_pipe_obj_clear_prop_changed(pipe_obj, prop) \
> +	(pipe_obj)->changed &= ~(1 << (prop))
> +
> +#define igt_pipe_clear_prop_changed(display, pipe, prop) \
> +	igt_pipe_obj_clear_prop_changed(&(display)->pipes[(pipe)],
> prop)
> +
> +#define igt_pipe_obj_set_prop_value(pipe_obj, prop, value) \
> +	do { \
> +		(pipe_obj)->values[prop] = (value); \
> +		igt_pipe_obj_set_prop_changed(pipe_obj, prop); \
> +	} while (0)
> +
> +#define igt_pipe_set_prop_value(display, pipe, prop, value) \
> +	igt_pipe_obj_set_prop_value(&(display)->pipes[(pipe)], prop,
> value)
> +
> +void igt_pipe_refresh(igt_display_t *display, enum pipe pipe, bool
> force);
>  
>  void igt_enable_connectors(void);
>  void igt_reset_connectors(void);
> diff --git a/tests/kms_atomic_interruptible.c
> b/tests/kms_atomic_interruptible.c
> index 4a2a577412cc..64a005597a21 100644
> --- a/tests/kms_atomic_interruptible.c
> +++ b/tests/kms_atomic_interruptible.c
> @@ -158,8 +158,8 @@ static void run_plane_test(igt_display_t
> *display, enum pipe pipe, igt_output_t
>  				uint32_t count_props[3] = { 2, 1, 6
> };
>  				uint32_t props[] = {
>  					/* crtc: 2 props */
> -					plane->pipe-
> >atomic_props_crtc[IGT_CRTC_MODE_ID],
> -					plane->pipe-
> >atomic_props_crtc[IGT_CRTC_ACTIVE],
> +					plane->pipe-
> >props[IGT_CRTC_MODE_ID],
> +					plane->pipe-
> >props[IGT_CRTC_ACTIVE],
>  					/* connector: 1 prop */
>  					output-
> >props[IGT_CONNECTOR_CRTC_ID],
>  					/* plane: remainder props */
> @@ -255,6 +255,10 @@ static void run_plane_test(igt_display_t
> *display, enum pipe pipe, igt_output_t
>  
>  	igt_waitchildren();
>  
> +	/* The mode is unset by the forked helper, force a refresh
> here */
> +	if (test_type == test_legacy_modeset || test_type ==
> test_atomic_modeset)
> +		igt_pipe_refresh(display, pipe, true);
> +
>  	igt_plane_set_fb(plane, NULL);
>  	igt_plane_set_fb(primary, NULL);
>  	igt_output_set_pipe(output, PIPE_NONE);
> diff --git a/tests/kms_atomic_transition.c
> b/tests/kms_atomic_transition.c
> index 2ae75f2d6630..7ddb65cea183 100644
> --- a/tests/kms_atomic_transition.c
> +++ b/tests/kms_atomic_transition.c
> @@ -633,7 +633,7 @@ static unsigned set_combinations(igt_display_t
> *display, unsigned mask, struct i
>  		drmModeModeInfo *mode = NULL;
>  
>  		if (!(mask & (1 << pipe))) {
> -			if (display->pipes[pipe].mode_blob) {
> +			if (igt_pipe_is_prop_changed(display, pipe,
> IGT_CRTC_ACTIVE)) {
>  				event_mask |= 1 << pipe;
>  				igt_plane_set_fb(plane, NULL);
>  			}
> diff --git a/tests/kms_crtc_background_color.c
> b/tests/kms_crtc_background_color.c
> index e12e163449f8..659a30b90219 100644
> --- a/tests/kms_crtc_background_color.c
> +++ b/tests/kms_crtc_background_color.c
> @@ -137,7 +137,7 @@ static void test_crtc_background(data_t *data)
>  		igt_output_set_pipe(output, pipe);
>  
>  		plane = igt_output_get_plane_type(output,
> DRM_PLANE_TYPE_PRIMARY);
> -		igt_require(plane->pipe->background_property);
> +		igt_require(plane->pipe-
> >props[IGT_CRTC_BACKGROUND]);
>  
>  		prepare_crtc(data, output, pipe, plane, 1, PURPLE,
> BLACK64);
>  
-- 
Mika Kahola - Intel OTC

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-10-19 10:32 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-12 11:54 [PATCH i-g-t v2 00/14] lib/igt_kms: Rewrite property handling to better match atomic Maarten Lankhorst
2017-10-12 11:54 ` [PATCH i-g-t v2 01/14] lib/igt_kms: Rework connector properties to be more atomic, v2 Maarten Lankhorst
2017-10-12 11:54 ` [PATCH i-g-t v2 02/14] lib/igt_kms: Rework plane properties to be more atomic, v5 Maarten Lankhorst
2017-10-19  9:08   ` Mika Kahola
2017-10-19  9:44     ` Maarten Lankhorst
2017-10-20  8:03       ` Mika Kahola
2017-10-12 11:54 ` [PATCH i-g-t v2 03/14] lib/igt_kms: Rework pipe properties to be more atomic, v7 Maarten Lankhorst
2017-10-19 10:28   ` Mika Kahola [this message]
2018-03-05 14:37   ` Maxime Ripard
2018-03-05 14:37     ` [igt-dev] [Intel-gfx] " Maxime Ripard
2018-03-06 13:41     ` Daniel Vetter
2018-03-06 13:41       ` [igt-dev] [Intel-gfx] " Daniel Vetter
2018-03-06 13:47       ` Maarten Lankhorst
2018-03-06 13:47         ` [Intel-gfx] " Maarten Lankhorst
2017-10-12 11:54 ` [PATCH i-g-t v2 04/14] lib/igt_kms: Allow setting any plane property through the universal path Maarten Lankhorst
2017-10-19 11:04   ` Mika Kahola
2017-10-12 11:54 ` [PATCH i-g-t v2 05/14] lib/igt_kms: Allow setting any output property through the !atomic paths Maarten Lankhorst
2017-10-20  9:38   ` Mika Kahola
2017-10-12 11:54 ` [PATCH i-g-t v2 06/14] lib/igt_kms: Export property blob functions for output/pipe/plane, v2 Maarten Lankhorst
2017-10-19 11:24   ` Mika Kahola
2017-10-12 11:54 ` [PATCH i-g-t v2 07/14] lib/igt_kms: Unexport broadcast rgb API Maarten Lankhorst
2017-10-19 11:28   ` Mika Kahola
2017-10-12 11:54 ` [PATCH i-g-t v2 08/14] lib/igt_kms: Add igt_$obj_has_prop functions Maarten Lankhorst
2017-10-12 15:33   ` [PATCH i-g-t v2] lib/igt_kms: Add igt_$obj_has_prop functions, v2 Maarten Lankhorst
2017-10-19 12:06     ` Mika Kahola
2017-10-12 11:54 ` [PATCH i-g-t v2 09/14] lib/igt_kms: Add igt_$obj_get_prop functions Maarten Lankhorst
2017-10-19 12:58   ` Mika Kahola
2017-10-12 11:54 ` [PATCH i-g-t v2 10/14] lib/igt_kms: Remove igt_pipe_get_property Maarten Lankhorst
2017-10-19 13:18   ` Mika Kahola
2017-10-12 11:54 ` [PATCH i-g-t v2 11/14] lib/igt_kms: Remove igt_crtc_set_background() Maarten Lankhorst
2017-10-20  6:33   ` Mika Kahola
2017-10-12 11:54 ` [PATCH i-g-t v2 12/14] tests/kms_color: Rework tests slightly to work better with new atomic api Maarten Lankhorst
2017-10-20  7:14   ` Mika Kahola
2017-10-12 11:54 ` [PATCH i-g-t v2 13/14] tests/chamelium: Remove reliance on output->config.pipe Maarten Lankhorst
2017-10-20  7:15   ` Mika Kahola
2017-10-12 11:54 ` [PATCH i-g-t v2 14/14] tests/kms_atomic: Convert/rewrite tests to use igt_kms framework Maarten Lankhorst
2017-10-12 15:33   ` [PATCH i-g-t v2] tests/kms_atomic: Convert/rewrite tests to use igt_kms framework, v2 Maarten Lankhorst
2017-10-20 10:02     ` Mika Kahola
2017-10-20 10:08       ` Maarten Lankhorst
2017-10-20 10:16         ` Mika Kahola
2017-10-20 11:43           ` Maarten Lankhorst
2017-10-12 12:28 ` ✓ Fi.CI.BAT: success for lib/igt_kms: Rewrite property handling to better match atomic. (rev4) Patchwork
2017-10-12 15:01 ` ✗ Fi.CI.IGT: failure " Patchwork
2017-10-12 16:04 ` ✓ Fi.CI.BAT: success for lib/igt_kms: Rewrite property handling to better match atomic. (rev6) Patchwork
2017-10-12 23:47 ` ✗ Fi.CI.IGT: failure " 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=1508408882.3274.121.camel@intel.com \
    --to=mika.kahola@intel.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.