Skip to contentSkip to conversation

lib/igt_kms: Rewrite property handling to better match atomic.

PATCH In review Maarten Lankhorst 5 participants 42 messages Oct 12, 2017 – Mar 6, 2018 Library code Page 2 of 2

lore
Share & tools
lore
#36 lore raw

Re: [PATCH i-g-t v2] tests/kms_atomic: Convert/rewrite tests to use igt_kms framework, v2.

In reply to Maarten Lankhorst
Quoted 1,511 lines · Maarten Lankhorst

Op 20-10-17 om 12:02 schreef Mika Kahola:

Quoted 1,502 lines · Maarten Lankhorst
Quoted 1,500 lines

Now that we can set individual properties through the igt_kms api,
we no longer need to duplicate functionality from igt_kms. Set invalid
properties directly, and rewrite kms_atomic.c to use igt_display. This will allow us to remove a lot of code in kms_atomic.c, and benefit from how igt_kms can set up a valid configuration, instead of having to inherit it from fbcon.

Changes since v1:
- Fix test failure when atomic_invalid_params is run standalone.

om>
Cc: Daniel Stone <[email protected]>
---
 tests/kms_atomic.c | 1668 ++++++++++++++++--------------------
----
------------

 1 file changed, 512 insertions(+), 1156 deletions(-)
tests/kms_atomic.c +0 -0
index 042a7c263aab..e0fc324eab61 100644
@@ -46,10 +46,6 @@
  #include "igt_aux.h"
  #include "sw_sync.h"

tests/kms_atomic.c +0 -4
-#ifndef DRM_CLIENT_CAP_ATOMIC
-#define DRM_CLIENT_CAP_ATOMIC 3
-#endif
-

 #ifndef DRM_CAP_CURSOR_WIDTH
 #define DRM_CAP_CURSOR_WIDTH 0x8
 #endif

tests/kms_atomic.c +0 -0
@@ -58,23 +54,6 @@
  #define DRM_CAP_CURSOR_HEIGHT 0x9
  #endif

tests/kms_atomic.c +0 -17
-#ifndef DRM_MODE_ATOMIC_TEST_ONLY
-#define DRM_MODE_ATOMIC_TEST_ONLY 0x0100
-#define DRM_MODE_ATOMIC_NONBLOCK 0x0200
-#define DRM_MODE_ATOMIC_ALLOW_MODESET 0x0400
-
-struct drm_mode_atomic {
-	__u32 flags;
-	__u32 count_objs;
-	__u64 objs_ptr;
-	__u64 count_props_ptr;
-	__u64 props_ptr;
-	__u64 prop_values_ptr;
-	__u64 reserved;
-	__u64 user_data;
-};
-#endif
-

 IGT_TEST_DESCRIPTION("Test atomic modesetting API");
 enum kms_atomic_check_relax {

tests/kms_atomic.c +0 -0
@@ -83,1259 +62,652 @@ enum kms_atomic_check_relax {
  	PLANE_RELAX_FB = (1 << 1)
  };


-/**
- * KMS plane type enum
- *
- * KMS plane types are represented by enums, which do not have stable numeric
- * values, but must be looked up by their string value each time.
- *
- * To make the code more simple, we define a plane_type enum which
maps to
- * each KMS enum value. These values must be looked up through the
map, and
- * cannot be passed directly to KMS functions.
- */

tests/kms_atomic.c +0 -8
-enum plane_type {
-	PLANE_TYPE_PRIMARY = 0,
-	PLANE_TYPE_OVERLAY,
-	PLANE_TYPE_CURSOR,
-	NUM_PLANE_TYPE_PROPS
-};
-
-static const char *plane_type_prop_names[NUM_PLANE_TYPE_PROPS] =

{

tests/kms_atomic.c +0 -25
-	"Primary",
-	"Overlay",
-	"Cursor"
-};
-
-struct kms_atomic_blob {
-	uint32_t id; /* 0 if not already allocated */
-	size_t len;
-	void *data;
-};
-
-struct kms_atomic_connector_state {
-	struct kms_atomic_state *state;
-	uint32_t obj;
-	uint32_t crtc_id;
-};
-
-struct kms_atomic_plane_state {
-	struct kms_atomic_state *state;
-	uint32_t obj;
-	enum plane_type type;
-	uint32_t crtc_mask;
-	uint32_t crtc_id; /* 0 to disable */
-	uint32_t fb_id; /* 0 to disable */
-	uint32_t src_x, src_y, src_w, src_h; /* 16.16 fixed-

point */

tests/kms_atomic.c +0 -1
-	uint32_t crtc_x, crtc_y, crtc_w, crtc_h; /* normal

integers
*/

tests/kms_atomic.c +1 -31
-	int32_t fence_fd;
-};
-
-struct kms_atomic_crtc_state {
-	struct kms_atomic_state *state;
-	uint32_t obj;
-	int idx;
-	bool active;
-	int32_t *out_fence_ptr;
-	struct kms_atomic_blob mode;
-};
-
-struct kms_atomic_state {
-	struct kms_atomic_connector_state *connectors;
-	int num_connectors;
-	struct kms_atomic_crtc_state *crtcs;
-	int num_crtcs;
-	struct kms_atomic_plane_state *planes;
-	int num_planes;
-	struct kms_atomic_desc *desc;
-};
-
-struct kms_atomic_desc {
-	int fd;
-	uint32_t props_connector[IGT_NUM_CONNECTOR_PROPS];
-	uint32_t props_crtc[IGT_NUM_CRTC_PROPS];
-	uint32_t props_plane[IGT_NUM_PLANE_PROPS];
-	uint64_t props_plane_type[NUM_PLANE_TYPE_PROPS];
-};
-
-static uint32_t blob_duplicate(int fd, uint32_t id_orig)
+static bool plane_filter(enum igt_atomic_plane_properties prop)

 {

tests/kms_atomic.c +0 -1
-	drmModePropertyBlobPtr orig = drmModeGetPropertyBlob(fd,

id_orig);

tests/kms_atomic.c +0 -4
-	uint32_t id_new;
-
-	igt_assert(orig);
-	do_or_die(drmModeCreatePropertyBlob(fd, orig->data,

orig-

Quoted 2 lines

length,

tests/kms_atomic.c +2 -2
-					    &id_new));
-	drmModeFreePropertyBlob(orig);
+	if ((1 << prop) & IGT_PLANE_COORD_CHANGED_MASK)
+		return false;

tests/kms_atomic.c +0 -5
-	return id_new;
-}
-
-#define crtc_set_prop(req, crtc, prop, value) \
-	igt_assert_lt(0, drmModeAtomicAddProperty(req, crtc-
Quoted 1 line

obj, \

tests/kms_atomic.c +0 -1
-						  crtc->state-
Quoted 3 lines

desc-

props_crtc[prop], \

tests/kms_atomic.c +0 -4
-						  value));
-
-#define plane_set_prop(req, plane, prop, value) \
-	igt_assert_lt(0, drmModeAtomicAddProperty(req, plane-
Quoted 1 line

obj, \

tests/kms_atomic.c +0 -1
-						  plane->state-
Quoted 2 lines

desc->props_plane[prop], \

tests/kms_atomic.c +1 -4
-						  value));
-
-#define do_atomic_commit(fd, req, flags) \
-	do_or_die(drmModeAtomicCommit(fd, req, flags, NULL));
+	if (prop == IGT_PLANE_CRTC_ID || prop ==

IGT_PLANE_FB_ID)

tests/kms_atomic.c +1 -0
+		return false;

tests/kms_atomic.c +0 -2
-#define do_atomic_commit_err(fd, req, flags, err) { \
-	igt_assert_neq(drmModeAtomicCommit(fd, req, flags,

NULL),
0); \

tests/kms_atomic.c +2 -13
-	igt_assert_eq(errno, err); \
-}
-
-#define crtc_commit_atomic(crtc, plane, req, relax, flags) { \
-	drmModeAtomicSetCursor(req, 0); \
-	crtc_populate_req(crtc, req); \
-	plane_populate_req(plane, req); \
-	do_atomic_commit((crtc)->state->desc->fd, req, flags); \
-	if (!(flags & DRM_MODE_ATOMIC_TEST_ONLY)) { \
-		crtc_check_current_state(crtc, plane, relax); \
-		plane_check_current_state(plane, relax); \
-	} \
-}
+	if (prop == IGT_PLANE_IN_FENCE_FD)
+		return false;


-#define crtc_commit_atomic_err(crtc, plane, crtc_old, plane_old, req, flags, relax, e) { \

tests/kms_atomic.c +0 -4
-	drmModeAtomicSetCursor(req, 0); \
-	crtc_populate_req(crtc, req); \
-	plane_populate_req(plane, req); \
-	do_atomic_commit_err((crtc)->state->desc->fd, req,

flags,
e); \

tests/kms_atomic.c +2 -2
-	crtc_check_current_state(crtc_old, plane_old, relax); \
-	plane_check_current_state(plane_old, relax); \
+	/* Don't care about other properties */
+	return true;

 }

tests/kms_atomic.c +0 -8
-#define plane_commit_atomic(plane, req, relax) { \
-	drmModeAtomicSetCursor(req, 0); \
-	plane_populate_req(plane, req); \
-	do_atomic_commit((plane)->state->desc->fd, req, 0); \
-	plane_check_current_state(plane, relax); \
-}
-
-#define plane_commit_atomic_err(plane, plane_old, req, relax, e)

{ \

tests/kms_atomic.c +0 -3
-	drmModeAtomicSetCursor(req, 0); \
-	plane_populate_req(plane, req); \
-	do_atomic_commit_err((plane)->state->desc->fd, req, 0,

e); \

tests/kms_atomic.c +0 -5
-	plane_check_current_state(plane_old, relax); \
-}
-
-static void
-connector_get_current_state(struct kms_atomic_connector_state

*connector)

tests/kms_atomic.c +0 -5
-{
-	drmModeObjectPropertiesPtr props;
-	int i;
-
-	props = drmModeObjectGetProperties(connector->state-
Quoted 3 lines

desc-

fd,

tests/kms_atomic.c +0 -2
-					   connector->obj,
-					   DRM_MODE_OBJECT_CONNE

CTOR
);

tests/kms_atomic.c +0 -4
-	igt_assert(props);
-
-	for (i = 0; i < props->count_props; i++) {
-		uint32_t *prop_ids = connector->state->desc-
Quoted 2 lines

props_connector;

tests/kms_atomic.c +0 -2
-
-		if (props->props[i] ==

prop_ids[IGT_CONNECTOR_CRTC_ID])

tests/kms_atomic.c +0 -1
-			connector->crtc_id = props-
Quoted 1 line

prop_values[i];

tests/kms_atomic.c +0 -6
-	}
-	drmModeFreeObjectProperties(props);
-}
-
-#if 0
-/* XXX: Checking this repeatedly actually hangs the GPU. I have

literally no
- *      idea why. */

tests/kms_atomic.c +0 -2
-static void
-connector_check_current_state(struct kms_atomic_connector_state

*connector)

tests/kms_atomic.c +0 -6
-{
-	struct kms_atomic_connector_state connector_kernel;
-	drmModeConnectorPtr legacy;
-	uint32_t crtc_id;
-
-	legacy = drmModeGetConnectorCurrent(connector->state-
Quoted 3 lines

desc-

fd,

tests/kms_atomic.c +0 -7
-					    connector->obj);
-	igt_assert(legacy);
-
-	if (legacy->encoder_id) {
-		drmModeEncoderPtr legacy_enc;
-
-		legacy_enc = drmModeGetEncoder(connector->state-
Quoted 2 lines

desc->fd,

tests/kms_atomic.c +0 -1
-					       legacy-
Quoted 1 line

encoder_id);

tests/kms_atomic.c +0 -11
-		igt_assert(legacy_enc);
-
-		crtc_id = legacy_enc->crtc_id;
-		drmModeFreeEncoder(legacy_enc);
-	} else {
-		crtc_id = 0;
-	}
-
-	igt_assert_eq_u32(crtc_id, connector->crtc_id);
-
-	memcpy(&connector_kernel, connector,

sizeof(connector_kernel));

tests/kms_atomic.c +1 -11
-	connector_get_current_state(&connector_kernel);
-	do_or_die(memcmp(&connector_kernel, connector,
-			 sizeof(connector_kernel)));
-
-	drmModeFreeConnector(legacy);
-}
-#endif
-
-static struct kms_atomic_connector_state *
-find_connector(struct kms_atomic_state *state,
-	       struct kms_atomic_crtc_state *crtc)
+static void plane_get_current_state(igt_plane_t *plane, uint64_t

*values)
 {
  int i;

tests/kms_atomic.c +3 -5
-	for (i = 0; i < state->num_connectors; i++) {
-		struct kms_atomic_connector_state *connector =
-			&state->connectors[i];
-
-		if (!connector->obj)
+	for (i = 0; i < IGT_NUM_PLANE_PROPS; i++) {
+		if (plane_filter(i)) {
+			values[i] = 0;

  continue;

tests/kms_atomic.c +0 -10
-		if (crtc && connector->crtc_id != crtc->obj)
-			continue;
-
-		return connector;
-	}
-
-	return NULL;
-}
-
-static void plane_populate_req(struct kms_atomic_plane_state

*plane,

tests/kms_atomic.c +0 -4
-			       drmModeAtomicReq *req)
-{
-	if (plane->fence_fd)
-		plane_set_prop(req, plane,

IGT_PLANE_IN_FENCE_FD,
plane->fence_fd);

tests/kms_atomic.c +0 -2
-
-	plane_set_prop(req, plane, IGT_PLANE_CRTC_ID, plane-
Quoted 2 lines

crtc_id);

tests/kms_atomic.c +0 -1
-	plane_set_prop(req, plane, IGT_PLANE_FB_ID, plane-
Quoted 1 line

fb_id);

tests/kms_atomic.c +0 -1
-	plane_set_prop(req, plane, IGT_PLANE_SRC_X, plane-
Quoted 1 line

src_x);

tests/kms_atomic.c +0 -1
-	plane_set_prop(req, plane, IGT_PLANE_SRC_Y, plane-
Quoted 1 line

src_y);

tests/kms_atomic.c +0 -1
-	plane_set_prop(req, plane, IGT_PLANE_SRC_W, plane-
Quoted 1 line

src_w);

tests/kms_atomic.c +0 -1
-	plane_set_prop(req, plane, IGT_PLANE_SRC_H, plane-
Quoted 1 line

src_h);

tests/kms_atomic.c +0 -1
-	plane_set_prop(req, plane, IGT_PLANE_CRTC_X, plane-
Quoted 1 line

crtc_x);

tests/kms_atomic.c +0 -1
-	plane_set_prop(req, plane, IGT_PLANE_CRTC_Y, plane-
Quoted 1 line

crtc_y);

tests/kms_atomic.c +0 -1
-	plane_set_prop(req, plane, IGT_PLANE_CRTC_W, plane-
Quoted 1 line

crtc_w);

tests/kms_atomic.c +0 -1
-	plane_set_prop(req, plane, IGT_PLANE_CRTC_H, plane-
Quoted 1 line

crtc_h);

tests/kms_atomic.c +0 -3
-}
-
-static void plane_get_current_state(struct

kms_atomic_plane_state
*plane)

tests/kms_atomic.c +0 -7
-{
-	struct kms_atomic_desc *desc = plane->state->desc;
-	drmModeObjectPropertiesPtr props;
-	int i;
-
-	props = drmModeObjectGetProperties(desc->fd, plane->obj,
-					   DRM_MODE_OBJECT_PLANE

);

tests/kms_atomic.c +0 -6
-	igt_assert(props);
-
-	for (i = 0; i < props->count_props; i++) {
-		uint32_t *prop_ids = desc->props_plane;
-
-		if (props->props[i] ==

prop_ids[IGT_PLANE_CRTC_ID])

tests/kms_atomic.c +0 -2
-			plane->crtc_id = props->prop_values[i];
-		else if (props->props[i] ==

prop_ids[IGT_PLANE_FB_ID])

tests/kms_atomic.c +0 -2
-			plane->fb_id = props->prop_values[i];
-		else if (props->props[i] ==

prop_ids[IGT_PLANE_CRTC_X])

tests/kms_atomic.c +0 -2
-			plane->crtc_x = props->prop_values[i];
-		else if (props->props[i] ==

prop_ids[IGT_PLANE_CRTC_Y])

tests/kms_atomic.c +0 -2
-			plane->crtc_y = props->prop_values[i];
-		else if (props->props[i] ==

prop_ids[IGT_PLANE_CRTC_W])

tests/kms_atomic.c +0 -2
-			plane->crtc_w = props->prop_values[i];
-		else if (props->props[i] ==

prop_ids[IGT_PLANE_CRTC_H])

tests/kms_atomic.c +0 -2
-			plane->crtc_h = props->prop_values[i];
-		else if (props->props[i] ==

prop_ids[IGT_PLANE_SRC_X])

tests/kms_atomic.c +0 -2
-			plane->src_x = props->prop_values[i];
-		else if (props->props[i] ==

prop_ids[IGT_PLANE_SRC_Y])

tests/kms_atomic.c +0 -2
-			plane->src_y = props->prop_values[i];
-		else if (props->props[i] ==

prop_ids[IGT_PLANE_SRC_W])

tests/kms_atomic.c +0 -2
-			plane->src_w = props->prop_values[i];
-		else if (props->props[i] ==

prop_ids[IGT_PLANE_SRC_H])

tests/kms_atomic.c +0 -2
-			plane->src_h = props->prop_values[i];
-		else if (props->props[i] ==

prop_ids[IGT_PLANE_TYPE]) {

tests/kms_atomic.c +0 -3
-			int j;
-
-			for (j = 0; j < ARRAY_SIZE(desc-
Quoted 2 lines

props_plane_type); j++) {

tests/kms_atomic.c +0 -1
-				if (props->prop_values[i] ==

desc-

Quoted 2 lines

props_plane_type[j]) {

tests/kms_atomic.c +0 -4
-					plane->type = j;
-					break;
-				}
-			}

  }

tests/kms_atomic.c +0 -1
-	}

tests/kms_atomic.c +2 -1
-	drmModeFreeObjectProperties(props);
+		values[i] = igt_plane_get_prop(plane, i);
+	}

 }

-static void plane_check_current_state(struct kms_atomic_plane_state
*plane,
+static void plane_check_current_state(igt_plane_t *plane, const uint64_t *values,
        enum kms_atomic_check_relax
relax)
 {
  drmModePlanePtr legacy;

tests/kms_atomic.c +2 -1
-	struct kms_atomic_plane_state plane_kernel;
+	uint64_t current_values[IGT_NUM_PLANE_PROPS];
+	int i;

tests/kms_atomic.c +0 -1
-	legacy = drmModeGetPlane(plane->state->desc->fd, plane-
Quoted 2 lines

obj);

tests/kms_atomic.c +1 -0
+	legacy = drmModeGetPlane(plane->pipe->display->drm_fd,

plane->drm_plane->plane_id);
  igt_assert(legacy);

tests/kms_atomic.c +1 -1
-	igt_assert_eq_u32(legacy->crtc_id, plane->crtc_id);
+	igt_assert_eq_u32(legacy->crtc_id,

values[IGT_PLANE_CRTC_ID]);

  if (!(relax & PLANE_RELAX_FB))

tests/kms_atomic.c +1 -1
-		igt_assert_eq_u32(legacy->fb_id, plane->fb_id);
+		igt_assert_eq_u32(legacy->fb_id,

values[IGT_PLANE_FB_ID]);

tests/kms_atomic.c +1 -2
-	memcpy(&plane_kernel, plane, sizeof(plane_kernel));
-	plane_get_current_state(&plane_kernel);
+	plane_get_current_state(plane, current_values);


  /* Legacy cursor ioctls create their own, unknowable, internal
   * framebuffer which we can't reason about. */ if (relax & PLANE_RELAX_FB)

tests/kms_atomic.c +0 -2
-		plane_kernel.fb_id = plane->fb_id;
-	do_or_die(memcmp(&plane_kernel, plane,

sizeof(plane_kernel)));

tests/kms_atomic.c +1 -0
+		current_values[IGT_PLANE_FB_ID] =

values[IGT_PLANE_FB_ID];

tests/kms_atomic.c +4 -0
+
+	for (i = 0; i < IGT_NUM_PLANE_PROPS; i++)
+		if (!plane_filter(i))
+			igt_assert_eq_u64(current_values[i],

values[i]);

  drmModeFreePlane(legacy);
 }

-static void plane_commit_legacy(struct kms_atomic_plane_state *plane,
+static void plane_commit(igt_plane_t *plane, enum igt_commit_style
s,
                                 enum kms_atomic_check_relax relax)
 {

tests/kms_atomic.c +0 -1
-	do_or_die(drmModeSetPlane(plane->state->desc->fd, plane-
Quoted 2 lines

obj,

tests/kms_atomic.c +2 -7
-				  plane->crtc_id,
-				  plane->fb_id, 0,
-				  plane->crtc_x, plane->crtc_y,
-				  plane->crtc_w, plane->crtc_h,
-				  plane->src_x, plane->src_y,
-				  plane->src_w, plane->src_h));
-	plane_check_current_state(plane, relax);
+	igt_display_commit2(plane->pipe->display, s);
+	plane_check_current_state(plane, plane->values, relax);

 }

tests/kms_atomic.c +2 -3
-static struct kms_atomic_plane_state *
-find_plane(struct kms_atomic_state *state, enum plane_type type,
-	   struct kms_atomic_crtc_state *crtc)
+static void plane_commit_atomic_err(igt_plane_t *plane,
+				    enum kms_atomic_check_relax

relax,

tests/kms_atomic.c +1 -0
+				    int err)

 {

tests/kms_atomic.c +0 -5
-	struct kms_atomic_plane_state *ret = NULL;
-	int i;
-
-	for (i = 0; i < state->num_planes; i++) {
-		struct kms_atomic_plane_state *plane = &state-
Quoted 2 lines

planes[i];

tests/kms_atomic.c +0 -4
-
-		if (!plane->obj)
-			continue;
-		if (type != NUM_PLANE_TYPE_PROPS && plane->type

!=
type)

tests/kms_atomic.c +0 -2
-			continue;
-		if (crtc && !(plane->crtc_mask & (1 << crtc-
Quoted 1 line

idx)))

tests/kms_atomic.c +1 -1
-			continue;
+	uint64_t current_values[IGT_NUM_PLANE_PROPS];

tests/kms_atomic.c +1 -1
-		plane_get_current_state(plane);
+	plane_get_current_state(plane, current_values);

tests/kms_atomic.c +0 -1
-		/* Try to find a plane that's already on this

CRTC.
In

tests/kms_atomic.c +0 -1
-		 * particular, this ensures that for special

(primary/cursor)

tests/kms_atomic.c +0 -1
-		 * planes that can be on multiple CRTCs, we find

the
same

tests/kms_atomic.c +1 -6
-		 * one that the legacy ioctls will. */
-		if (!crtc || plane->crtc_id == crtc->obj)
-			return plane;
-
-		ret = plane;
-	}
+	igt_assert_eq(-err, igt_display_try_commit2(plane->pipe-
Quoted 2 lines

display, COMMIT_ATOMIC));

tests/kms_atomic.c +1 -1
-	return ret;
+	plane_check_current_state(plane, current_values, relax);

 }

-static void crtc_populate_req(struct kms_atomic_crtc_state *crtc,

tests/kms_atomic.c +1 -1
-			      drmModeAtomicReq *req)
+static bool crtc_filter(enum igt_atomic_crtc_properties prop)

 {

tests/kms_atomic.c +0 -3
-	if (crtc->out_fence_ptr)
-		crtc_set_prop(req, crtc, IGT_CRTC_OUT_FENCE_PTR,
-			      to_user_pointer(crtc-
Quoted 1 line

out_fence_ptr));

tests/kms_atomic.c +2 -0
+	if (prop == IGT_CRTC_MODE_ID || prop == IGT_CRTC_ACTIVE)
+		return false;

tests/kms_atomic.c +0 -1
-	crtc_set_prop(req, crtc, IGT_CRTC_MODE_ID, crtc-
Quoted 1 line

mode.id);

tests/kms_atomic.c +1 -1
-	crtc_set_prop(req, crtc, IGT_CRTC_ACTIVE, crtc->active);
+	return true;

 }

-static void crtc_get_current_state(struct kms_atomic_crtc_state *crtc)
+static void crtc_get_current_state(igt_pipe_t *pipe, uint64_t *values)
 {

tests/kms_atomic.c +0 -1
-	drmModeObjectPropertiesPtr props;

  int i;

tests/kms_atomic.c +0 -1
-	props = drmModeObjectGetProperties(crtc->state->desc-
Quoted 1 line

fd,

crtc->obj,

tests/kms_atomic.c +0 -1
-					   DRM_MODE_OBJECT_CRTC)

;

tests/kms_atomic.c +0 -4
-	igt_assert(props);
-
-	for (i = 0; i < props->count_props; i++) {
-		uint32_t *prop_ids = crtc->state->desc-
Quoted 1 line

props_crtc;

tests/kms_atomic.c +0 -2
-
-		if (props->props[i] ==

prop_ids[IGT_CRTC_MODE_ID]) {

tests/kms_atomic.c +0 -9
-			drmModePropertyBlobPtr blob;
-
-			crtc->mode.id = props->prop_values[i];
-			if (!crtc->mode.id) {
-				crtc->mode.len = 0;
-				continue;
-			}
-
-			blob = drmModeGetPropertyBlob(crtc-
Quoted 3 lines

state-

desc->fd,

tests/kms_atomic.c +0 -1
-						      crtc-
Quoted 2 lines

mode.id);

tests/kms_atomic.c +0 -3
-			igt_assert(blob);
-			igt_assert_eq_u32(blob->length,
-					  sizeof(struct

drm_mode_modeinfo));

tests/kms_atomic.c +0 -3
-
-			if (!crtc->mode.data ||
-			    memcmp(crtc->mode.data, blob->data,

blob->length) != 0)

tests/kms_atomic.c +0 -4
-				crtc->mode.data = blob->data;
-			crtc->mode.len = blob->length;
-		}
-		else if (props->props[i] ==

prop_ids[IGT_CRTC_ACTIVE]) {

tests/kms_atomic.c +4 -1
-			crtc->active = props->prop_values[i];
+	for (i = 0; i < IGT_NUM_CRTC_PROPS; i++) {
+		if (crtc_filter(i)) {
+			values[i] = 0;
+			continue;

  }

tests/kms_atomic.c +0 -1
-	}

tests/kms_atomic.c +2 -1
-	drmModeFreeObjectProperties(props);
+		values[i] = igt_pipe_obj_get_prop(pipe, i);
+	}

 }

-static void crtc_check_current_state(struct
kms_atomic_crtc_state
*crtc,

tests/kms_atomic.c +0 -1
-				     struct

kms_atomic_plane_state
*primary,

tests/kms_atomic.c +2 -0
+static void crtc_check_current_state(igt_pipe_t *pipe,
+				     const uint64_t

*pipe_values,

tests/kms_atomic.c +1 -0
+				     const uint64_t

*primary_values,
       enum kms_atomic_check_relax relax)
 {

tests/kms_atomic.c +1 -1
-	struct kms_atomic_crtc_state crtc_kernel;
+	uint64_t current_pipe_values[IGT_NUM_CRTC_PROPS];

  drmModeCrtcPtr legacy;

tests/kms_atomic.c +2 -0
+	drmModePropertyBlobRes *mode_prop = NULL;
+	struct drm_mode_modeinfo *mode = NULL;

tests/kms_atomic.c +0 -1
-	legacy = drmModeGetCrtc(crtc->state->desc->fd, crtc-
Quoted 1 line

obj);

tests/kms_atomic.c +0 -8
-	igt_assert(legacy);
-
-	igt_assert_eq_u32(legacy->crtc_id, crtc->obj);
-	igt_assert_eq_u32(legacy->x, primary->src_x >> 16);
-	igt_assert_eq_u32(legacy->y, primary->src_y >> 16);
-
-	if (crtc->active)
-		igt_assert_eq_u32(legacy->buffer_id, primary-
Quoted 2 lines

fb_id);

tests/kms_atomic.c +2 -2
-	else
-		igt_assert_eq_u32(legacy->buffer_id, 0);
+	if (pipe_values[IGT_CRTC_MODE_ID]) {
+		mode_prop = drmModeGetPropertyBlob(pipe-
Quoted 3 lines

display-

drm_fd,

tests/kms_atomic.c +1 -0
+						   pipe_values[I

GT_C
RTC_MODE_ID]);

tests/kms_atomic.c +0 -7
-	if (legacy->mode_valid) {
-		igt_assert_neq(legacy->mode_valid, 0);
-		igt_assert_eq(crtc->mode.len,
-		              sizeof(struct drm_mode_modeinfo));
-		do_or_die(memcmp(&legacy->mode, crtc->mode.data,
-		                 crtc->mode.len));
-		igt_assert_eq(legacy->width, legacy-
Quoted 1 line

mode.hdisplay);

tests/kms_atomic.c +0 -1
-		igt_assert_eq(legacy->height, legacy-
Quoted 2 lines

mode.vdisplay);

tests/kms_atomic.c +1 -3
-	} else {
-		igt_assert_eq(legacy->mode_valid, 0);
-	}
+		igt_assert(mode_prop);

tests/kms_atomic.c +1 -5
-	memcpy(&crtc_kernel, crtc, sizeof(crtc_kernel));
-	crtc_get_current_state(&crtc_kernel);
-
-	if (crtc_kernel.mode.id != 0)
-		igt_assert_eq(crtc_kernel.mode.len,
+		igt_assert_eq(mode_prop->length,

                sizeof(struct drm_mode_modeinfo));

tests/kms_atomic.c +0 -2
-
-	/* Optionally relax the check for MODE_ID: using the

legacy
SetCrtc

tests/kms_atomic.c +0 -1
-	 * API can potentially change MODE_ID even if the mode

itself remains

tests/kms_atomic.c +0 -11
-	 * unchanged. */
-	if (((relax & CRTC_RELAX_MODE) &&
-	    (crtc_kernel.mode.id != crtc->mode.id &&
-	     crtc_kernel.mode.id != 0 && crtc->mode.id != 0)) &&
-	    memcmp(crtc_kernel.mode.data, crtc->mode.data,
-		   sizeof(struct drm_mode_modeinfo)) == 0) {
-		crtc_kernel.mode.id = crtc->mode.id;
-		crtc_kernel.mode.data = crtc->mode.data;
-	}
-
-	do_or_die(memcmp(&crtc_kernel, crtc,

sizeof(crtc_kernel)));

tests/kms_atomic.c +0 -5
-
-	drmModeFreeCrtc(legacy);
-}
-
-static void crtc_commit_legacy(struct kms_atomic_crtc_state

*crtc,

tests/kms_atomic.c +0 -1
-			       struct kms_atomic_plane_state

*plane,

tests/kms_atomic.c +0 -1
-			       enum kms_atomic_check_relax

relax)

tests/kms_atomic.c +0 -9
-{
-	drmModeObjectPropertiesPtr props;
-	uint32_t *connectors;
-	int num_connectors = 0;
-	int i;
-
-	if (!crtc->active) {
-		do_or_die(drmModeSetCrtc(crtc->state->desc->fd,
-					 crtc->obj, 0, 0, 0,

NULL,
0, NULL));

tests/kms_atomic.c +1 -17
-		return;
-	}
-
-	connectors = calloc(crtc->state->num_connectors,
-			    sizeof(*connectors));
-	igt_assert(connectors);
-
-	igt_assert_neq_u32(crtc->mode.id, 0);
-
-	for (i = 0; i < crtc->state->num_connectors; i++) {
-		struct kms_atomic_connector_state *connector =
-			&crtc->state->connectors[i];
-
-		if (connector->crtc_id != crtc->obj)
-			continue;
-
-		connectors[num_connectors++] = connector->obj;
+		mode = mode_prop->data;

  }

tests/kms_atomic.c +0 -1
-	do_or_die(drmModeSetCrtc(crtc->state->desc->fd, crtc-
Quoted 1 line

obj,

tests/kms_atomic.c +0 -2
-	                         plane->fb_id,
-				 plane->src_x >> 16, plane-
Quoted 1 line

src_y >>

16,

tests/kms_atomic.c +0 -1
-				 (num_connectors) ? connectors :

NULL,

tests/kms_atomic.c +0 -3
-				 num_connectors,
-				 crtc->mode.data));
-	/* When doing a legacy commit, the core may update

MODE_ID
to be a new

tests/kms_atomic.c +0 -1
-	 * blob implicitly created by the legacy request. Hence

we
backfill

tests/kms_atomic.c +0 -1
-	 * the value in the state object to ensure they match.

*/

tests/kms_atomic.c +0 -1
-	props = drmModeObjectGetProperties(crtc->state->desc-
Quoted 1 line

fd,

crtc->obj,

tests/kms_atomic.c +0 -1
-					   DRM_MODE_OBJECT_CRTC)

;

tests/kms_atomic.c +0 -5
-	igt_assert(props);
-
-	for (i = 0; i < props->count_props; i++) {
-		if (props->props[i] !=
-		    crtc->state->desc-
Quoted 1 line

props_crtc[IGT_CRTC_MODE_ID])

tests/kms_atomic.c +1 -4
-			continue;
-		crtc->mode.id = props->prop_values[i];
-		break;
-	}
+	legacy = drmModeGetCrtc(pipe->display->drm_fd, pipe-
Quoted 2 lines

crtc_id);

tests/kms_atomic.c +1 -0
+	igt_assert(legacy);

tests/kms_atomic.c +2 -1
-	drmModeFreeObjectProperties(props);
+	igt_assert_eq_u32(legacy->crtc_id, pipe->crtc_id);
+	igt_assert_eq_u32(legacy->x,

primary_values[IGT_PLANE_SRC_X]

Quoted 3 lines
Quoted 3 lines

16);

tests/kms_atomic.c +1 -0
+	igt_assert_eq_u32(legacy->y,

primary_values[IGT_PLANE_SRC_Y]

Quoted 3 lines
Quoted 3 lines

16);

tests/kms_atomic.c +1 -3
-	crtc_check_current_state(crtc, plane, relax);
-	plane_check_current_state(plane, relax);
-}
+	igt_assert_eq_u32(legacy->buffer_id,

primary_values[IGT_PLANE_FB_ID]);

-static struct kms_atomic_crtc_state *find_crtc(struct kms_atomic_state *state,

tests/kms_atomic.c +0 -1
-					       bool

must_be_enabled)

tests/kms_atomic.c +2 -2
-{
-	int i;
+	if (legacy->mode_valid) {
+		igt_assert(mode_prop);

tests/kms_atomic.c +0 -2
-	for (i = 0; i < state->num_crtcs; i++) {
-		struct kms_atomic_crtc_state *crtc = &state-
Quoted 2 lines

crtcs[i];

tests/kms_atomic.c +1 -0
+		do_or_die(memcmp(&legacy->mode, mode,

sizeof(*mode)));

tests/kms_atomic.c +1 -4
-		if (!crtc->obj)
-			continue;
-		if (must_be_enabled && !crtc->active)
-			continue;
+		igt_assert_eq(legacy->width, legacy-
Quoted 1 line

mode.hdisplay);

tests/kms_atomic.c +1 -0
+		igt_assert_eq(legacy->height, legacy-
Quoted 2 lines

mode.vdisplay);

tests/kms_atomic.c +1 -2
-		crtc_get_current_state(crtc);
-		return crtc;
+		igt_assert_neq(pipe_values[IGT_CRTC_MODE_ID],

0);

tests/kms_atomic.c +2 -0
+	} else {
+		igt_assert(!mode_prop);

  }

tests/kms_atomic.c +1 -2
-	return NULL;
-}
+	crtc_get_current_state(pipe, current_pipe_values);


-static void fill_obj_props(int fd, uint32_t id, int type, int num_props,

tests/kms_atomic.c +0 -1
-			   const char **prop_names, uint32_t

*prop_ids)

tests/kms_atomic.c +1 -6
-{
-	drmModeObjectPropertiesPtr props;
-	int i, j;
-
-	props = drmModeObjectGetProperties(fd, id, type);
-	igt_assert(props);
+	/* Optionally relax the check for MODE_ID: using the

legacy
SetCrtc

tests/kms_atomic.c +1 -0
+	 * API can potentially change MODE_ID even if the mode

itself remains

tests/kms_atomic.c +2 -0
+	 * unchanged. */
+	if (relax & CRTC_RELAX_MODE && mode &&

current_pipe_values[IGT_CRTC_MODE_ID] &&

tests/kms_atomic.c +1 -0
+	    current_pipe_values[IGT_CRTC_MODE_ID] !=

pipe_values[IGT_CRTC_MODE_ID]) {

tests/kms_atomic.c +2 -0
+		drmModePropertyBlobRes *cur_prop =
+			drmModeGetPropertyBlob(pipe->display-
Quoted 2 lines

drm_fd,

tests/kms_atomic.c +1 -0
+					       current_pipe_valu

es[I
GT_CRTC_MODE_ID]);

tests/kms_atomic.c +2 -3
-	for (i = 0; i < props->count_props; i++) {
-		drmModePropertyPtr prop =
-			drmModeGetProperty(fd, props->props[i]);
+		igt_assert(cur_prop);
+		igt_assert_eq(cur_prop->length, sizeof(struct

drm_mode_modeinfo));

tests/kms_atomic.c +0 -2
-		for (j = 0; j < num_props; j++) {
-			if (strcmp(prop->name, prop_names[j]) !=

0)

tests/kms_atomic.c +1 -4
-				continue;
-			prop_ids[j] = props->props[i];
-			break;
-		}
+		if (!memcmp(cur_prop->data, mode,

sizeof(*mode)))

tests/kms_atomic.c +1 -0
+			current_pipe_values[IGT_CRTC_MODE_ID] =

pipe_values[IGT_CRTC_MODE_ID];

tests/kms_atomic.c +1 -1
-		drmModeFreeProperty(prop);
+		drmModeFreePropertyBlob(cur_prop);

  }

tests/kms_atomic.c +1 -2
-	drmModeFreeObjectProperties(props);
-}
+	do_or_die(memcmp(pipe_values, current_pipe_values,

sizeof(current_pipe_values)));

-static void fill_obj_prop_map(int fd, uint32_t id, int type, const
char *name,

tests/kms_atomic.c +0 -1
-			      int num_enums, const char

**enum_names,

tests/kms_atomic.c +0 -21
-			      uint64_t *enum_ids)
-{
-	drmModeObjectPropertiesPtr props;
-	int i, j, k;
-
-	props = drmModeObjectGetProperties(fd, id, type);
-	igt_assert(props);
-
-	for (i = 0; i < props->count_props; i++) {
-		drmModePropertyPtr prop =
-			drmModeGetProperty(fd, props->props[i]);
-
-		igt_assert(prop);
-
-		if (strcmp(prop->name, name) != 0) {
-			drmModeFreeProperty(prop);
-			continue;
-		}
-
-		for (j = 0; j < prop->count_enums; j++) {
-			struct drm_mode_property_enum *e =

&prop-

Quoted 2 lines

enums[j];

tests/kms_atomic.c +0 -3
-
-			for (k = 0; k < num_enums; k++) {
-				if (strcmp(e->name,

enum_names[k])
!= 0)

tests/kms_atomic.c +2 -9
-					continue;
-
-				enum_ids[k] = e->value;
-				break;
-			}
-		}
-
-		drmModeFreeProperty(prop);
-	}
+	drmModeFreeCrtc(legacy);
+	drmModeFreePropertyBlob(mode_prop);

 }

tests/kms_atomic.c +3 -1
-static void atomic_setup(struct kms_atomic_state *state)
+static void crtc_commit(igt_pipe_t *pipe, igt_plane_t *plane,
+			enum igt_commit_style s,
+			enum kms_atomic_check_relax relax)

 {

tests/kms_atomic.c +0 -9
-	struct kms_atomic_desc *desc = state->desc;
-	drmModeResPtr res;
-	drmModePlaneResPtr res_plane;
-	int i;
-
-	desc->fd = drm_open_driver_master(DRIVER_ANY);
-	igt_assert_fd(desc->fd);
-
-	igt_skip_on(drmSetClientCap(desc->fd,

DRM_CLIENT_CAP_ATOMIC,
1));

tests/kms_atomic.c +0 -9
-
-	res = drmModeGetResources(desc->fd);
-	res_plane = drmModeGetPlaneResources(desc->fd);
-	igt_assert(res);
-	igt_assert(res_plane);
-
-	igt_assert_lt(0, res->count_crtcs);
-	state->num_crtcs = res->count_crtcs;
-	state->crtcs = calloc(state->num_crtcs, sizeof(*state-
Quoted 2 lines

crtcs));

tests/kms_atomic.c +0 -5
-	igt_assert(state->crtcs);
-
-	igt_assert_lt(0, res_plane->count_planes);
-	state->num_planes = res_plane->count_planes;
-	state->planes = calloc(state->num_planes, sizeof(*state-
Quoted 2 lines

planes));

tests/kms_atomic.c +0 -14
-	igt_assert(state->planes);
-
-	igt_assert_lt(0, res->count_connectors);
-	state->num_connectors = res->count_connectors;
-	state->connectors = calloc(state->num_connectors,
-				   sizeof(*state->connectors));
-	igt_assert(state->connectors);
-
-	fill_obj_props(desc->fd, res->crtcs[0],
-		       DRM_MODE_OBJECT_CRTC, IGT_NUM_CRTC_PROPS,
-		       igt_crtc_prop_names, desc->props_crtc);
-
-	fill_obj_props(desc->fd, res_plane->planes[0],
-		       DRM_MODE_OBJECT_PLANE,

IGT_NUM_PLANE_PROPS,

tests/kms_atomic.c +0 -4
-		       igt_plane_prop_names, desc->props_plane);
-	fill_obj_prop_map(desc->fd, res_plane->planes[0],
-			  DRM_MODE_OBJECT_PLANE, "type",
-			  NUM_PLANE_TYPE_PROPS,

plane_type_prop_names,

tests/kms_atomic.c +0 -4
-			  desc->props_plane_type);
-
-	fill_obj_props(desc->fd, res->connectors[0],
-		       DRM_MODE_OBJECT_CONNECTOR,

IGT_NUM_CONNECTOR_PROPS,

tests/kms_atomic.c +0 -1
-		       igt_connector_prop_names, desc-
Quoted 2 lines

props_connector);

tests/kms_atomic.c +0 -3
-
-	for (i = 0; i < state->num_crtcs; i++) {
-		struct kms_atomic_crtc_state *crtc = &state-
Quoted 2 lines

crtcs[i];

tests/kms_atomic.c +0 -7
-
-		crtc->state = state;
-		crtc->obj = res->crtcs[i];
-		crtc->idx = i;
-		crtc_get_current_state(crtc);
-
-		/* The blob pointed to by MODE_ID could well be

transient,

tests/kms_atomic.c +0 -1
-		 * and lose its last reference as we switch away

from it.

tests/kms_atomic.c +0 -1
-		 * Duplicate the blob here so we have a

reference we
know we

tests/kms_atomic.c +0 -3
-		 * own. */
-		if (crtc->mode.id != 0)
-		    crtc->mode.id = blob_duplicate(desc->fd,

crtc-

Quoted 2 lines

mode.id);

tests/kms_atomic.c +1 -1
-	}
+	igt_display_commit2(pipe->display, s);

tests/kms_atomic.c +0 -3
-	for (i = 0; i < state->num_planes; i++) {
-		drmModePlanePtr plane =
-			drmModeGetPlane(desc->fd, res_plane-
Quoted 2 lines

planes[i]);

tests/kms_atomic.c +0 -5
-		igt_assert(plane);
-
-		state->planes[i].state = state;
-		state->planes[i].obj = res_plane->planes[i];
-		state->planes[i].crtc_mask = plane-
Quoted 1 line

possible_crtcs;

tests/kms_atomic.c +0 -7
-		plane_get_current_state(&state->planes[i]);
-	}
-
-	for (i = 0; i < state->num_connectors; i++) {
-		state->connectors[i].state = state;
-		state->connectors[i].obj = res->connectors[i];
-		connector_get_current_state(&state-
Quoted 1 line

connectors[i]);

tests/kms_atomic.c +1 -4
-	}
-
-	drmModeFreePlaneResources(res_plane);
-	drmModeFreeResources(res);
+	crtc_check_current_state(pipe, pipe->values, plane-
Quoted 1 line

values,

relax);

tests/kms_atomic.c +1 -0
+	plane_check_current_state(plane, plane->values, relax);

 }

tests/kms_atomic.c +1 -2
-static struct kms_atomic_state *
-atomic_state_dup(const struct kms_atomic_state *state)
+static void crtc_commit_atomic_flags_err(igt_pipe_t *pipe,

igt_plane_t *plane,

tests/kms_atomic.c +2 -0
+					 unsigned flags,
+					 enum

kms_atomic_check_relax
relax,

tests/kms_atomic.c +1 -0
+					 int err)

 {

tests/kms_atomic.c +2 -4
-	struct kms_atomic_state *ret = calloc(1, sizeof(*ret));
-
-	igt_assert(ret);
-	*ret = *state;
+	uint64_t current_pipe_values[IGT_NUM_CRTC_PROPS];
+	uint64_t current_plane_values[IGT_NUM_PLANE_PROPS];

tests/kms_atomic.c +0 -1
-	ret->crtcs = calloc(ret->num_crtcs, sizeof(*ret-
Quoted 1 line

crtcs));

tests/kms_atomic.c +0 -2
-	igt_assert(ret->crtcs);
-	memcpy(ret->crtcs, state->crtcs, ret->num_crtcs *

sizeof(*ret->crtcs));

tests/kms_atomic.c +2 -0
+	crtc_get_current_state(pipe, current_pipe_values);
+	plane_get_current_state(plane, current_plane_values);

tests/kms_atomic.c +0 -1
-	ret->planes = calloc(ret->num_planes, sizeof(*ret-
Quoted 1 line

planes));

tests/kms_atomic.c +1 -3
-	igt_assert(ret->planes);
-	memcpy(ret->planes, state->planes,
-	       ret->num_planes * sizeof(*ret->planes));
+	igt_assert_eq(-err, igt_display_try_commit_atomic(pipe-
Quoted 2 lines

display, flags, NULL));

tests/kms_atomic.c +0 -1
-	ret->connectors = calloc(ret->num_connectors,

sizeof(*ret-

Quoted 2 lines

connectors));

tests/kms_atomic.c +1 -5
-	igt_assert(ret->connectors);
-	memcpy(ret->connectors, state->connectors,
-	       ret->num_connectors * sizeof(*ret->connectors));
-
-	return ret;
+	crtc_check_current_state(pipe, current_pipe_values,

current_plane_values, relax);

tests/kms_atomic.c +1 -0
+	plane_check_current_state(plane, current_plane_values,

relax);
 }

tests/kms_atomic.c +2 -7
-static void atomic_state_free(struct kms_atomic_state *state)
-{
-	free(state->crtcs);
-	free(state->planes);
-	free(state->connectors);
-	free(state);
-}
+#define crtc_commit_atomic_err(pipe, plane, relax, err) \
+	crtc_commit_atomic_flags_err(pipe, plane,

DRM_MODE_ATOMIC_ALLOW_MODESET, relax, err)

-static uint32_t plane_get_igt_format(struct kms_atomic_plane_state
*plane)
+static uint32_t plane_get_igt_format(igt_plane_t *plane) {
  drmModePlanePtr plane_kms;
  const uint32_t *igt_formats;

tests/kms_atomic.c +0 -1
-	uint32_t ret = 0;

  int num_igt_formats;
  int i;

tests/kms_atomic.c +0 -1
-	plane_kms = drmModeGetPlane(plane->state->desc->fd,

plane-

Quoted 2 lines

obj);

tests/kms_atomic.c +1 -1
-	igt_assert(plane_kms);
+	plane_kms = plane->drm_plane;


  igt_get_all_cairo_formats(&igt_formats, &num_igt_formats);
  for (i = 0; i < num_igt_formats; i++) {
  int j;

  for (j = 0; j < plane_kms->count_formats; j++) {

tests/kms_atomic.c +0 -1
-			if (plane_kms->formats[j] ==

igt_formats[i])
{

tests/kms_atomic.c +1 -3
-				ret = plane_kms->formats[j];
-				break;
-			}
+			if (plane_kms->formats[j] ==

igt_formats[i])

tests/kms_atomic.c +1 -0
+				return plane_kms->formats[j];

  }
  }

tests/kms_atomic.c +1 -2
-	drmModeFreePlane(plane_kms);
-	return ret;
+	return 0;

 }

 static void

tests/kms_atomic.c +1 -1
-set_dpms(int fd, int mode)
+set_dpms(igt_output_t *output, int mode)

 {

tests/kms_atomic.c +1 -14
-	int i;
-	drmModeConnector *connector;
-	uint32_t id;
-	drmModeRes *resources = drmModeGetResources(fd);
-
-	for (i = 0; i < resources->count_connectors; i++) {
-		id = resources->connectors[i];
-
-		connector = drmModeGetConnectorCurrent(fd, id);
-
-		kmstest_set_connector_dpms(fd, connector, mode);
-
-		drmModeFreeConnector(connector);
-	}
+	do_or_die(drmModeConnectorSetProperty(output->display-
Quoted 2 lines

drm_fd, output->id,

tests/kms_atomic.c +1 -0
+					      output-
Quoted 2 lines

props[IGT_CONNECTOR_DPMS], mode));

 }

tests/kms_atomic.c +0 -2
-static void plane_overlay(struct kms_atomic_crtc_state *crtc,
-			  struct kms_atomic_plane_state

*plane_old)
+static void plane_overlay(igt_pipe_t *pipe, igt_output_t *output,
igt_plane_t *plane)
 {

tests/kms_atomic.c +2 -4
-	struct drm_mode_modeinfo *mode = crtc->mode.data;
-	struct kms_atomic_plane_state plane = *plane_old;
-	uint32_t format = plane_get_igt_format(&plane);
-	drmModeAtomicReq *req = drmModeAtomicAlloc();
+	drmModeModeInfo *mode = igt_output_get_mode(output);
+	uint32_t format = plane_get_igt_format(plane);

  struct igt_fb fb;

tests/kms_atomic.c +2 -0
+	uint32_t w = mode->hdisplay / 2;
+	uint32_t h = mode->vdisplay / 2;

tests/kms_atomic.c +0 -1
-	igt_require(req);

  igt_require(format != 0);

tests/kms_atomic.c +0 -10
-	plane.src_x = 0;
-	plane.src_y = 0;
-	plane.src_w = (mode->hdisplay / 2) << 16;
-	plane.src_h = (mode->vdisplay / 2) << 16;
-	plane.crtc_x = mode->hdisplay / 4;
-	plane.crtc_y = mode->vdisplay / 4;
-	plane.crtc_w = mode->hdisplay / 2;
-	plane.crtc_h = mode->vdisplay / 2;
-	plane.crtc_id = crtc->obj;
-	plane.fb_id = igt_create_pattern_fb(plane.state->desc-
Quoted 1 line

fd,

tests/kms_atomic.c +0 -1
-					    plane.crtc_w,

plane.crtc_h,

tests/kms_atomic.c +0 -1
-					    format,

I915_TILING_NONE, &fb);

tests/kms_atomic.c +5 -0
+	igt_create_pattern_fb(pipe->display->drm_fd, w, h,
+			      format, I915_TILING_NONE, &fb);
+
+	igt_plane_set_fb(plane, &fb);
+	igt_plane_set_position(plane, w/2, h/2);


  /* Enable the overlay plane using the atomic API, and double-check
   * state is what we think it should be. */

tests/kms_atomic.c +1 -1
-	plane_commit_atomic(&plane, req, ATOMIC_RELAX_NONE);
+	plane_commit(plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);


  /* Disable the plane and check the state matches the old. */

tests/kms_atomic.c +3 -1
-	plane_commit_atomic(plane_old, req, ATOMIC_RELAX_NONE);
+	igt_plane_set_fb(plane, NULL);
+	igt_plane_set_position(plane, 0, 0);
+	plane_commit(plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);


  /* Re-enable the plane through the legacy plane API, and verify through
   * atomic. */

tests/kms_atomic.c +3 -1
-	plane_commit_legacy(&plane, ATOMIC_RELAX_NONE);
+	igt_plane_set_fb(plane, &fb);
+	igt_plane_set_position(plane, w/2, h/2);
+	plane_commit(plane, COMMIT_LEGACY, ATOMIC_RELAX_NONE);


  /* Restore the plane to its original settings through the
legacy plane
   * API, and verify through atomic. */

tests/kms_atomic.c +3 -1
-	plane_commit_legacy(plane_old, ATOMIC_RELAX_NONE);
+	igt_plane_set_fb(plane, NULL);
+	igt_plane_set_position(plane, 0, 0);
+	plane_commit(plane, COMMIT_LEGACY, ATOMIC_RELAX_NONE);

tests/kms_atomic.c +1 -1
-	drmModeAtomicFree(req);
+	igt_remove_fb(pipe->display->drm_fd, &fb);

 }

tests/kms_atomic.c +0 -2
-static void plane_primary(struct kms_atomic_crtc_state *crtc,
-			  struct kms_atomic_plane_state

*plane_old)
+static void plane_primary(igt_pipe_t *pipe, igt_plane_t *plane, struct igt_fb *fb)
 {

tests/kms_atomic.c +1 -9
-	struct drm_mode_modeinfo *mode = crtc->mode.data;
-	struct kms_atomic_plane_state plane = *plane_old;
-	uint32_t format = plane_get_igt_format(&plane);
-	drmModeAtomicReq *req = drmModeAtomicAlloc();
-	struct igt_fb fb;
-	uint32_t flags = 0;
-	int ret;
-
-	igt_require(format != 0);
+	struct igt_fb fb2;

tests/kms_atomic.c +0 -10
-	plane.src_x = 0;
-	plane.src_y = 0;
-	plane.src_w = mode->hdisplay << 16;
-	plane.src_h = mode->vdisplay << 16;
-	plane.crtc_x = 0;
-	plane.crtc_y = 0;
-	plane.crtc_w = mode->hdisplay;
-	plane.crtc_h = mode->vdisplay;
-	plane.crtc_id = crtc->obj;
-	plane.fb_id = igt_create_pattern_fb(plane.state->desc-
Quoted 1 line

fd,

tests/kms_atomic.c +0 -1
-					    plane.crtc_w,

plane.crtc_h,

tests/kms_atomic.c +0 -1
-					    format,

I915_TILING_NONE, &fb);

tests/kms_atomic.c +0 -6
-
-	drmModeAtomicSetCursor(req, 0);
-	crtc_populate_req(crtc, req);
-	plane_populate_req(&plane, req);
-	ret = drmModeAtomicCommit(crtc->state->desc->fd, req,
-				  DRM_MODE_ATOMIC_TEST_ONLY,

NULL);

tests/kms_atomic.c +0 -1
-	/* Try harder in case the failure is caused by

disallowing
modeset. */

tests/kms_atomic.c +3 -2
-	if (ret == -EINVAL)
-		flags |= DRM_MODE_ATOMIC_ALLOW_MODESET;
+	igt_create_color_pattern_fb(pipe->display->drm_fd,
+				    fb->width, fb->height,
+				    fb->drm_format,

I915_TILING_NONE,

tests/kms_atomic.c +1 -0
+				    0.2, 0.2, 0.2, &fb2);


  /* Flip the primary plane using the atomic API, and double-
check
   * state is what we think it should be. */

tests/kms_atomic.c +0 -1
-	crtc_commit_atomic(crtc, &plane, req, ATOMIC_RELAX_NONE,

flags);

tests/kms_atomic.c +2 -0
+	igt_plane_set_fb(plane, &fb2);
+	crtc_commit(pipe, plane, COMMIT_ATOMIC,

ATOMIC_RELAX_NONE);

  /* Restore the primary plane and check the state matches the
old. */

tests/kms_atomic.c +0 -1
-	crtc_commit_atomic(crtc, plane_old, req,

ATOMIC_RELAX_NONE,
flags);

tests/kms_atomic.c +2 -0
+	igt_plane_set_fb(plane, fb);
+	crtc_commit(pipe, plane, COMMIT_ATOMIC,

ATOMIC_RELAX_NONE);

tests/kms_atomic.c +0 -1
-	/* Re-enable the plane through the legacy CRTC/primary-

plane
API, and

tests/kms_atomic.c +1 -0
+	/* Set the plane through the legacy CRTC/primary-plane

API,
and
   * verify through atomic. */

tests/kms_atomic.c +2 -1
-	crtc_commit_legacy(crtc, &plane, CRTC_RELAX_MODE);
+	igt_plane_set_fb(plane, &fb2);
+	crtc_commit(pipe, plane, COMMIT_LEGACY,

CRTC_RELAX_MODE);

  /* Restore the plane to its original settings through the
legacy CRTC
   * API, and verify through atomic. */

tests/kms_atomic.c +0 -4
-	crtc_commit_legacy(crtc, plane_old, CRTC_RELAX_MODE);
-
-	/* Finally, restore to the original state. */
-	crtc_commit_atomic(crtc, plane_old, req,

ATOMIC_RELAX_NONE,
flags);

tests/kms_atomic.c +2 -0
+	igt_plane_set_fb(plane, fb);
+	crtc_commit(pipe, plane, COMMIT_LEGACY,

CRTC_RELAX_MODE);

tests/kms_atomic.c +4 -1
-	drmModeAtomicFree(req);
+	/* Set the plane through the universal setplane API, and
+	 * verify through atomic. */
+	igt_plane_set_fb(plane, &fb2);
+	plane_commit(plane, COMMIT_UNIVERSAL,

ATOMIC_RELAX_NONE);
 }

 /* test to ensure that DRM_MODE_ATOMIC_TEST_ONLY really only touches
the
  * free-standing state objects and nothing else. */

tests/kms_atomic.c +3 -2
-static void test_only(struct kms_atomic_crtc_state *crtc,
-		      struct kms_atomic_plane_state *plane_old)
+static void test_only(igt_pipe_t *pipe_obj,
+		      igt_plane_t *primary,
+		      igt_output_t *output)

 {

tests/kms_atomic.c +2 -4
-	struct drm_mode_modeinfo *mode = crtc->mode.data;
-	struct kms_atomic_plane_state plane = *plane_old;
-	uint32_t format = plane_get_igt_format(&plane);
-	drmModeAtomicReq *req = drmModeAtomicAlloc();
+	drmModeModeInfo *mode = igt_output_get_mode(output);
+	uint32_t format = plane_get_igt_format(primary);

  struct igt_fb fb;

tests/kms_atomic.c +1 -1
-	int ret;
+	uint64_t old_plane_values[IGT_NUM_PLANE_PROPS],

old_crtc_values[IGT_NUM_CRTC_PROPS];

  igt_require(format != 0);

tests/kms_atomic.c +0 -10
-	plane.src_x = 0;
-	plane.src_y = 0;
-	plane.src_w = mode->hdisplay << 16;
-	plane.src_h = mode->vdisplay << 16;
-	plane.crtc_x = 0;
-	plane.crtc_y = 0;
-	plane.crtc_w = mode->hdisplay;
-	plane.crtc_h = mode->vdisplay;
-	plane.crtc_id = crtc->obj;
-	plane.fb_id = igt_create_pattern_fb(plane.state->desc-
Quoted 1 line

fd,

tests/kms_atomic.c +0 -1
-					    plane.crtc_w,

plane.crtc_h,

tests/kms_atomic.c +0 -1
-					    format,

I915_TILING_NONE, &fb);

tests/kms_atomic.c +0 -6
-
-	drmModeAtomicSetCursor(req, 0);
-	crtc_populate_req(crtc, req);
-	plane_populate_req(&plane, req);
-	ret = drmModeAtomicCommit(crtc->state->desc->fd, req,
-				  DRM_MODE_ATOMIC_TEST_ONLY,

NULL);

tests/kms_atomic.c +0 -9
-
-	igt_assert_eq(ret, 0);
-
-	/* go through dpms off/on cycle */
-	set_dpms(crtc->state->desc->fd, DRM_MODE_DPMS_OFF);
-	set_dpms(crtc->state->desc->fd, DRM_MODE_DPMS_ON);
-
-	/* check the state */
-	crtc_check_current_state(crtc, plane_old,

ATOMIC_RELAX_NONE);

tests/kms_atomic.c +0 -3
-	plane_check_current_state(plane_old, ATOMIC_RELAX_NONE);
-
-	/* Re-enable the plane through the legacy CRTC/primary-

plane
API, and

tests/kms_atomic.c +12 -2
-	 * verify through atomic. */
-	crtc_commit_legacy(crtc, plane_old, CRTC_RELAX_MODE);
+	plane_get_current_state(primary, old_plane_values);
+	crtc_get_current_state(pipe_obj, old_crtc_values);
+
+	igt_assert(!old_crtc_values[IGT_CRTC_MODE_ID]);
+
+	igt_create_pattern_fb(pipe_obj->display->drm_fd,
+			     mode->hdisplay, mode->vdisplay,
+			     format, I915_TILING_NONE, &fb);
+	igt_plane_set_fb(primary, &fb);
+	igt_output_set_pipe(output, pipe_obj->pipe);
+
+	igt_display_commit_atomic(pipe_obj->display,

DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);

tests/kms_atomic.c +3 -0
+
+	/* check the state, should still be old state */
+	crtc_check_current_state(pipe_obj, old_crtc_values,

old_plane_values, ATOMIC_RELAX_NONE);

tests/kms_atomic.c +1 -0
+	plane_check_current_state(primary, old_plane_values,

ATOMIC_RELAX_NONE);

tests/kms_atomic.c +3 -0
+
+	/*
+	 * Enable the plane through the legacy CRTC/primary-

plane
API, and

tests/kms_atomic.c +3 -0
+	 * verify through atomic.
+	 */
+	crtc_commit(pipe_obj, primary, COMMIT_LEGACY,

CRTC_RELAX_MODE);

tests/kms_atomic.c +9 -0
+
+	/* Same for disable.. */
+	plane_get_current_state(primary, old_plane_values);
+	crtc_get_current_state(pipe_obj, old_crtc_values);
+
+	igt_plane_set_fb(primary, NULL);
+	igt_output_set_pipe(output, PIPE_NONE);
+
+	igt_display_commit_atomic(pipe_obj->display,

DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);

Quoted 8 lines

tests/kms_atomic.c enum kms_atomic_check_relax { · line 415

Quoted 5 lines

tests/kms_atomic.c +3 -1
-	drmModeAtomicFree(req);
+	/* for extra stress, go through dpms off/on cycle */
+	set_dpms(output, DRM_MODE_DPMS_OFF);
+	set_dpms(output, DRM_MODE_DPMS_ON);

There is this library function 'kmstest_set_connector_dpms()'. Could we
utilize this function here instead?

Quoted 6 lines

Sure, I never understood what the dpms call was supposed to expose though..

Want me to resend or is replacing the call with kmstest_set_connector_dpms(s, output->config.connector, DRM_MODE_DPMS_OFF); enough?

Well, my point of view is that we should use library functions as much as possible. I guess that's the reason why we have the libraries in the first place. So a vote for a replacement.

Signature · 6 lines
Mika Kahola - Intel OTC

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#37 lore raw

Re: [PATCH i-g-t v2] tests/kms_atomic: Convert/rewrite tests to use igt_kms framework, v2.

Op 20-10-17 om 12:16 schreef Mika Kahola:

Quoted 1,479 lines · Maarten Lankhorst
Quoted 1,478 lines

Op 20-10-17 om 12:02 schreef Mika Kahola:

Quoted 1,466 lines · Maarten Lankhorst
Quoted 1,465 lines

Now that we can set individual properties through the igt_kms api,
we no longer need to duplicate functionality from igt_kms. Set invalid
properties directly, and rewrite kms_atomic.c to use igt_display. This will allow us to remove a lot of code in kms_atomic.c, and benefit from how igt_kms can set up a valid configuration, instead of having to inherit it from fbcon.

Changes since v1:
- Fix test failure when atomic_invalid_params is run standalone.

om>
Cc: Daniel Stone <[email protected]>
---
 tests/kms_atomic.c | 1668 ++++++++++++++++--------------------
----
------------

 1 file changed, 512 insertions(+), 1156 deletions(-)
tests/kms_atomic.c +0 -0
index 042a7c263aab..e0fc324eab61 100644
@@ -46,10 +46,6 @@
  #include "igt_aux.h"
  #include "sw_sync.h"

tests/kms_atomic.c +0 -4
-#ifndef DRM_CLIENT_CAP_ATOMIC
-#define DRM_CLIENT_CAP_ATOMIC 3
-#endif
-

 #ifndef DRM_CAP_CURSOR_WIDTH
 #define DRM_CAP_CURSOR_WIDTH 0x8
 #endif

tests/kms_atomic.c +0 -0
@@ -58,23 +54,6 @@
  #define DRM_CAP_CURSOR_HEIGHT 0x9
  #endif

tests/kms_atomic.c +0 -17
-#ifndef DRM_MODE_ATOMIC_TEST_ONLY
-#define DRM_MODE_ATOMIC_TEST_ONLY 0x0100
-#define DRM_MODE_ATOMIC_NONBLOCK 0x0200
-#define DRM_MODE_ATOMIC_ALLOW_MODESET 0x0400
-
-struct drm_mode_atomic {
-	__u32 flags;
-	__u32 count_objs;
-	__u64 objs_ptr;
-	__u64 count_props_ptr;
-	__u64 props_ptr;
-	__u64 prop_values_ptr;
-	__u64 reserved;
-	__u64 user_data;
-};
-#endif
-

 IGT_TEST_DESCRIPTION("Test atomic modesetting API");
 enum kms_atomic_check_relax {

tests/kms_atomic.c +0 -0
@@ -83,1259 +62,652 @@ enum kms_atomic_check_relax {
  	PLANE_RELAX_FB = (1 << 1)
  };


-/**
- * KMS plane type enum
- *
- * KMS plane types are represented by enums, which do not have stable numeric
- * values, but must be looked up by their string value each time.
- *
- * To make the code more simple, we define a plane_type enum which
maps to
- * each KMS enum value. These values must be looked up through the
map, and
- * cannot be passed directly to KMS functions.
- */

tests/kms_atomic.c +0 -8
-enum plane_type {
-	PLANE_TYPE_PRIMARY = 0,
-	PLANE_TYPE_OVERLAY,
-	PLANE_TYPE_CURSOR,
-	NUM_PLANE_TYPE_PROPS
-};
-
-static const char *plane_type_prop_names[NUM_PLANE_TYPE_PROPS] =

{

tests/kms_atomic.c +0 -25
-	"Primary",
-	"Overlay",
-	"Cursor"
-};
-
-struct kms_atomic_blob {
-	uint32_t id; /* 0 if not already allocated */
-	size_t len;
-	void *data;
-};
-
-struct kms_atomic_connector_state {
-	struct kms_atomic_state *state;
-	uint32_t obj;
-	uint32_t crtc_id;
-};
-
-struct kms_atomic_plane_state {
-	struct kms_atomic_state *state;
-	uint32_t obj;
-	enum plane_type type;
-	uint32_t crtc_mask;
-	uint32_t crtc_id; /* 0 to disable */
-	uint32_t fb_id; /* 0 to disable */
-	uint32_t src_x, src_y, src_w, src_h; /* 16.16 fixed-

point */

tests/kms_atomic.c +0 -1
-	uint32_t crtc_x, crtc_y, crtc_w, crtc_h; /* normal

integers
*/

tests/kms_atomic.c +1 -31
-	int32_t fence_fd;
-};
-
-struct kms_atomic_crtc_state {
-	struct kms_atomic_state *state;
-	uint32_t obj;
-	int idx;
-	bool active;
-	int32_t *out_fence_ptr;
-	struct kms_atomic_blob mode;
-};
-
-struct kms_atomic_state {
-	struct kms_atomic_connector_state *connectors;
-	int num_connectors;
-	struct kms_atomic_crtc_state *crtcs;
-	int num_crtcs;
-	struct kms_atomic_plane_state *planes;
-	int num_planes;
-	struct kms_atomic_desc *desc;
-};
-
-struct kms_atomic_desc {
-	int fd;
-	uint32_t props_connector[IGT_NUM_CONNECTOR_PROPS];
-	uint32_t props_crtc[IGT_NUM_CRTC_PROPS];
-	uint32_t props_plane[IGT_NUM_PLANE_PROPS];
-	uint64_t props_plane_type[NUM_PLANE_TYPE_PROPS];
-};
-
-static uint32_t blob_duplicate(int fd, uint32_t id_orig)
+static bool plane_filter(enum igt_atomic_plane_properties prop)

 {

tests/kms_atomic.c +0 -1
-	drmModePropertyBlobPtr orig = drmModeGetPropertyBlob(fd,

id_orig);

tests/kms_atomic.c +0 -4
-	uint32_t id_new;
-
-	igt_assert(orig);
-	do_or_die(drmModeCreatePropertyBlob(fd, orig->data,

orig-

Quoted 1 line

length,

tests/kms_atomic.c +2 -2
-					    &id_new));
-	drmModeFreePropertyBlob(orig);
+	if ((1 << prop) & IGT_PLANE_COORD_CHANGED_MASK)
+		return false;

tests/kms_atomic.c +0 -5
-	return id_new;
-}
-
-#define crtc_set_prop(req, crtc, prop, value) \
-	igt_assert_lt(0, drmModeAtomicAddProperty(req, crtc-
Quoted 1 line

obj, \

tests/kms_atomic.c +0 -1
-						  crtc->state-
Quoted 3 lines

desc-

props_crtc[prop], \

tests/kms_atomic.c +0 -4
-						  value));
-
-#define plane_set_prop(req, plane, prop, value) \
-	igt_assert_lt(0, drmModeAtomicAddProperty(req, plane-
Quoted 1 line

obj, \

tests/kms_atomic.c +0 -1
-						  plane->state-
Quoted 1 line

desc->props_plane[prop], \

tests/kms_atomic.c +1 -4
-						  value));
-
-#define do_atomic_commit(fd, req, flags) \
-	do_or_die(drmModeAtomicCommit(fd, req, flags, NULL));
+	if (prop == IGT_PLANE_CRTC_ID || prop ==

IGT_PLANE_FB_ID)

tests/kms_atomic.c +1 -0
+		return false;

tests/kms_atomic.c +0 -2
-#define do_atomic_commit_err(fd, req, flags, err) { \
-	igt_assert_neq(drmModeAtomicCommit(fd, req, flags,

NULL),
0); \

tests/kms_atomic.c +2 -13
-	igt_assert_eq(errno, err); \
-}
-
-#define crtc_commit_atomic(crtc, plane, req, relax, flags) { \
-	drmModeAtomicSetCursor(req, 0); \
-	crtc_populate_req(crtc, req); \
-	plane_populate_req(plane, req); \
-	do_atomic_commit((crtc)->state->desc->fd, req, flags); \
-	if (!(flags & DRM_MODE_ATOMIC_TEST_ONLY)) { \
-		crtc_check_current_state(crtc, plane, relax); \
-		plane_check_current_state(plane, relax); \
-	} \
-}
+	if (prop == IGT_PLANE_IN_FENCE_FD)
+		return false;


-#define crtc_commit_atomic_err(crtc, plane, crtc_old, plane_old, req, flags, relax, e) { \

tests/kms_atomic.c +0 -4
-	drmModeAtomicSetCursor(req, 0); \
-	crtc_populate_req(crtc, req); \
-	plane_populate_req(plane, req); \
-	do_atomic_commit_err((crtc)->state->desc->fd, req,

flags,
e); \

tests/kms_atomic.c +2 -2
-	crtc_check_current_state(crtc_old, plane_old, relax); \
-	plane_check_current_state(plane_old, relax); \
+	/* Don't care about other properties */
+	return true;

 }

tests/kms_atomic.c +0 -8
-#define plane_commit_atomic(plane, req, relax) { \
-	drmModeAtomicSetCursor(req, 0); \
-	plane_populate_req(plane, req); \
-	do_atomic_commit((plane)->state->desc->fd, req, 0); \
-	plane_check_current_state(plane, relax); \
-}
-
-#define plane_commit_atomic_err(plane, plane_old, req, relax, e)

{ \

tests/kms_atomic.c +0 -3
-	drmModeAtomicSetCursor(req, 0); \
-	plane_populate_req(plane, req); \
-	do_atomic_commit_err((plane)->state->desc->fd, req, 0,

e); \

tests/kms_atomic.c +0 -5
-	plane_check_current_state(plane_old, relax); \
-}
-
-static void
-connector_get_current_state(struct kms_atomic_connector_state

*connector)

tests/kms_atomic.c +0 -5
-{
-	drmModeObjectPropertiesPtr props;
-	int i;
-
-	props = drmModeObjectGetProperties(connector->state-
Quoted 3 lines

desc-

fd,

tests/kms_atomic.c +0 -2
-					   connector->obj,
-					   DRM_MODE_OBJECT_CONNE

CTOR
);

tests/kms_atomic.c +0 -4
-	igt_assert(props);
-
-	for (i = 0; i < props->count_props; i++) {
-		uint32_t *prop_ids = connector->state->desc-
Quoted 1 line

props_connector;

tests/kms_atomic.c +0 -2
-
-		if (props->props[i] ==

prop_ids[IGT_CONNECTOR_CRTC_ID])

tests/kms_atomic.c +0 -1
-			connector->crtc_id = props-
Quoted 1 line

prop_values[i];

tests/kms_atomic.c +0 -6
-	}
-	drmModeFreeObjectProperties(props);
-}
-
-#if 0
-/* XXX: Checking this repeatedly actually hangs the GPU. I have

literally no
- *      idea why. */

tests/kms_atomic.c +0 -2
-static void
-connector_check_current_state(struct kms_atomic_connector_state

*connector)

tests/kms_atomic.c +0 -6
-{
-	struct kms_atomic_connector_state connector_kernel;
-	drmModeConnectorPtr legacy;
-	uint32_t crtc_id;
-
-	legacy = drmModeGetConnectorCurrent(connector->state-
Quoted 3 lines

desc-

fd,

tests/kms_atomic.c +0 -7
-					    connector->obj);
-	igt_assert(legacy);
-
-	if (legacy->encoder_id) {
-		drmModeEncoderPtr legacy_enc;
-
-		legacy_enc = drmModeGetEncoder(connector->state-
Quoted 1 line

desc->fd,

tests/kms_atomic.c +0 -1
-					       legacy-
Quoted 1 line

encoder_id);

tests/kms_atomic.c +0 -11
-		igt_assert(legacy_enc);
-
-		crtc_id = legacy_enc->crtc_id;
-		drmModeFreeEncoder(legacy_enc);
-	} else {
-		crtc_id = 0;
-	}
-
-	igt_assert_eq_u32(crtc_id, connector->crtc_id);
-
-	memcpy(&connector_kernel, connector,

sizeof(connector_kernel));

tests/kms_atomic.c +1 -11
-	connector_get_current_state(&connector_kernel);
-	do_or_die(memcmp(&connector_kernel, connector,
-			 sizeof(connector_kernel)));
-
-	drmModeFreeConnector(legacy);
-}
-#endif
-
-static struct kms_atomic_connector_state *
-find_connector(struct kms_atomic_state *state,
-	       struct kms_atomic_crtc_state *crtc)
+static void plane_get_current_state(igt_plane_t *plane, uint64_t

*values)
 {
  int i;

tests/kms_atomic.c +3 -5
-	for (i = 0; i < state->num_connectors; i++) {
-		struct kms_atomic_connector_state *connector =
-			&state->connectors[i];
-
-		if (!connector->obj)
+	for (i = 0; i < IGT_NUM_PLANE_PROPS; i++) {
+		if (plane_filter(i)) {
+			values[i] = 0;

  continue;

tests/kms_atomic.c +0 -10
-		if (crtc && connector->crtc_id != crtc->obj)
-			continue;
-
-		return connector;
-	}
-
-	return NULL;
-}
-
-static void plane_populate_req(struct kms_atomic_plane_state

*plane,

tests/kms_atomic.c +0 -4
-			       drmModeAtomicReq *req)
-{
-	if (plane->fence_fd)
-		plane_set_prop(req, plane,

IGT_PLANE_IN_FENCE_FD,
plane->fence_fd);

tests/kms_atomic.c +0 -2
-
-	plane_set_prop(req, plane, IGT_PLANE_CRTC_ID, plane-
Quoted 1 line

crtc_id);

tests/kms_atomic.c +0 -1
-	plane_set_prop(req, plane, IGT_PLANE_FB_ID, plane-
Quoted 1 line

fb_id);

tests/kms_atomic.c +0 -1
-	plane_set_prop(req, plane, IGT_PLANE_SRC_X, plane-
Quoted 1 line

src_x);

tests/kms_atomic.c +0 -1
-	plane_set_prop(req, plane, IGT_PLANE_SRC_Y, plane-
Quoted 1 line

src_y);

tests/kms_atomic.c +0 -1
-	plane_set_prop(req, plane, IGT_PLANE_SRC_W, plane-
Quoted 1 line

src_w);

tests/kms_atomic.c +0 -1
-	plane_set_prop(req, plane, IGT_PLANE_SRC_H, plane-
Quoted 1 line

src_h);

tests/kms_atomic.c +0 -1
-	plane_set_prop(req, plane, IGT_PLANE_CRTC_X, plane-
Quoted 1 line

crtc_x);

tests/kms_atomic.c +0 -1
-	plane_set_prop(req, plane, IGT_PLANE_CRTC_Y, plane-
Quoted 1 line

crtc_y);

tests/kms_atomic.c +0 -1
-	plane_set_prop(req, plane, IGT_PLANE_CRTC_W, plane-
Quoted 1 line

crtc_w);

tests/kms_atomic.c +0 -1
-	plane_set_prop(req, plane, IGT_PLANE_CRTC_H, plane-
Quoted 1 line

crtc_h);

tests/kms_atomic.c +0 -3
-}
-
-static void plane_get_current_state(struct

kms_atomic_plane_state
*plane)

tests/kms_atomic.c +0 -7
-{
-	struct kms_atomic_desc *desc = plane->state->desc;
-	drmModeObjectPropertiesPtr props;
-	int i;
-
-	props = drmModeObjectGetProperties(desc->fd, plane->obj,
-					   DRM_MODE_OBJECT_PLANE

);

tests/kms_atomic.c +0 -6
-	igt_assert(props);
-
-	for (i = 0; i < props->count_props; i++) {
-		uint32_t *prop_ids = desc->props_plane;
-
-		if (props->props[i] ==

prop_ids[IGT_PLANE_CRTC_ID])

tests/kms_atomic.c +0 -2
-			plane->crtc_id = props->prop_values[i];
-		else if (props->props[i] ==

prop_ids[IGT_PLANE_FB_ID])

tests/kms_atomic.c +0 -2
-			plane->fb_id = props->prop_values[i];
-		else if (props->props[i] ==

prop_ids[IGT_PLANE_CRTC_X])

tests/kms_atomic.c +0 -2
-			plane->crtc_x = props->prop_values[i];
-		else if (props->props[i] ==

prop_ids[IGT_PLANE_CRTC_Y])

tests/kms_atomic.c +0 -2
-			plane->crtc_y = props->prop_values[i];
-		else if (props->props[i] ==

prop_ids[IGT_PLANE_CRTC_W])

tests/kms_atomic.c +0 -2
-			plane->crtc_w = props->prop_values[i];
-		else if (props->props[i] ==

prop_ids[IGT_PLANE_CRTC_H])

tests/kms_atomic.c +0 -2
-			plane->crtc_h = props->prop_values[i];
-		else if (props->props[i] ==

prop_ids[IGT_PLANE_SRC_X])

tests/kms_atomic.c +0 -2
-			plane->src_x = props->prop_values[i];
-		else if (props->props[i] ==

prop_ids[IGT_PLANE_SRC_Y])

tests/kms_atomic.c +0 -2
-			plane->src_y = props->prop_values[i];
-		else if (props->props[i] ==

prop_ids[IGT_PLANE_SRC_W])

tests/kms_atomic.c +0 -2
-			plane->src_w = props->prop_values[i];
-		else if (props->props[i] ==

prop_ids[IGT_PLANE_SRC_H])

tests/kms_atomic.c +0 -2
-			plane->src_h = props->prop_values[i];
-		else if (props->props[i] ==

prop_ids[IGT_PLANE_TYPE]) {

tests/kms_atomic.c +0 -3
-			int j;
-
-			for (j = 0; j < ARRAY_SIZE(desc-
Quoted 1 line

props_plane_type); j++) {

tests/kms_atomic.c +0 -1
-				if (props->prop_values[i] ==

desc-

Quoted 1 line

props_plane_type[j]) {

tests/kms_atomic.c +0 -4
-					plane->type = j;
-					break;
-				}
-			}

  }

tests/kms_atomic.c +0 -1
-	}

tests/kms_atomic.c +2 -1
-	drmModeFreeObjectProperties(props);
+		values[i] = igt_plane_get_prop(plane, i);
+	}

 }

-static void plane_check_current_state(struct kms_atomic_plane_state
*plane,
+static void plane_check_current_state(igt_plane_t *plane, const uint64_t *values,
        enum kms_atomic_check_relax
relax)
 {
  drmModePlanePtr legacy;

tests/kms_atomic.c +2 -1
-	struct kms_atomic_plane_state plane_kernel;
+	uint64_t current_values[IGT_NUM_PLANE_PROPS];
+	int i;

tests/kms_atomic.c +0 -1
-	legacy = drmModeGetPlane(plane->state->desc->fd, plane-
Quoted 1 line

obj);

tests/kms_atomic.c +1 -0
+	legacy = drmModeGetPlane(plane->pipe->display->drm_fd,

plane->drm_plane->plane_id);
  igt_assert(legacy);

tests/kms_atomic.c +1 -1
-	igt_assert_eq_u32(legacy->crtc_id, plane->crtc_id);
+	igt_assert_eq_u32(legacy->crtc_id,

values[IGT_PLANE_CRTC_ID]);

  if (!(relax & PLANE_RELAX_FB))

tests/kms_atomic.c +1 -1
-		igt_assert_eq_u32(legacy->fb_id, plane->fb_id);
+		igt_assert_eq_u32(legacy->fb_id,

values[IGT_PLANE_FB_ID]);

tests/kms_atomic.c +1 -2
-	memcpy(&plane_kernel, plane, sizeof(plane_kernel));
-	plane_get_current_state(&plane_kernel);
+	plane_get_current_state(plane, current_values);


  /* Legacy cursor ioctls create their own, unknowable, internal
   * framebuffer which we can't reason about. */ if (relax & PLANE_RELAX_FB)

tests/kms_atomic.c +0 -2
-		plane_kernel.fb_id = plane->fb_id;
-	do_or_die(memcmp(&plane_kernel, plane,

sizeof(plane_kernel)));

tests/kms_atomic.c +1 -0
+		current_values[IGT_PLANE_FB_ID] =

values[IGT_PLANE_FB_ID];

tests/kms_atomic.c +4 -0
+
+	for (i = 0; i < IGT_NUM_PLANE_PROPS; i++)
+		if (!plane_filter(i))
+			igt_assert_eq_u64(current_values[i],

values[i]);

  drmModeFreePlane(legacy);
 }

-static void plane_commit_legacy(struct kms_atomic_plane_state *plane,
+static void plane_commit(igt_plane_t *plane, enum igt_commit_style
s,
                                 enum kms_atomic_check_relax relax)
 {

tests/kms_atomic.c +0 -1
-	do_or_die(drmModeSetPlane(plane->state->desc->fd, plane-
Quoted 1 line

obj,

tests/kms_atomic.c +2 -7
-				  plane->crtc_id,
-				  plane->fb_id, 0,
-				  plane->crtc_x, plane->crtc_y,
-				  plane->crtc_w, plane->crtc_h,
-				  plane->src_x, plane->src_y,
-				  plane->src_w, plane->src_h));
-	plane_check_current_state(plane, relax);
+	igt_display_commit2(plane->pipe->display, s);
+	plane_check_current_state(plane, plane->values, relax);

 }

tests/kms_atomic.c +2 -3
-static struct kms_atomic_plane_state *
-find_plane(struct kms_atomic_state *state, enum plane_type type,
-	   struct kms_atomic_crtc_state *crtc)
+static void plane_commit_atomic_err(igt_plane_t *plane,
+				    enum kms_atomic_check_relax

relax,

tests/kms_atomic.c +1 -0
+				    int err)

 {

tests/kms_atomic.c +0 -5
-	struct kms_atomic_plane_state *ret = NULL;
-	int i;
-
-	for (i = 0; i < state->num_planes; i++) {
-		struct kms_atomic_plane_state *plane = &state-
Quoted 1 line

planes[i];

tests/kms_atomic.c +0 -4
-
-		if (!plane->obj)
-			continue;
-		if (type != NUM_PLANE_TYPE_PROPS && plane->type

!=
type)

tests/kms_atomic.c +0 -2
-			continue;
-		if (crtc && !(plane->crtc_mask & (1 << crtc-
Quoted 1 line

idx)))

tests/kms_atomic.c +1 -1
-			continue;
+	uint64_t current_values[IGT_NUM_PLANE_PROPS];

tests/kms_atomic.c +1 -1
-		plane_get_current_state(plane);
+	plane_get_current_state(plane, current_values);

tests/kms_atomic.c +0 -1
-		/* Try to find a plane that's already on this

CRTC.
In

tests/kms_atomic.c +0 -1
-		 * particular, this ensures that for special

(primary/cursor)

tests/kms_atomic.c +0 -1
-		 * planes that can be on multiple CRTCs, we find

the
same

tests/kms_atomic.c +1 -6
-		 * one that the legacy ioctls will. */
-		if (!crtc || plane->crtc_id == crtc->obj)
-			return plane;
-
-		ret = plane;
-	}
+	igt_assert_eq(-err, igt_display_try_commit2(plane->pipe-
Quoted 1 line

display, COMMIT_ATOMIC));

tests/kms_atomic.c +1 -1
-	return ret;
+	plane_check_current_state(plane, current_values, relax);

 }

-static void crtc_populate_req(struct kms_atomic_crtc_state *crtc,

tests/kms_atomic.c +1 -1
-			      drmModeAtomicReq *req)
+static bool crtc_filter(enum igt_atomic_crtc_properties prop)

 {

tests/kms_atomic.c +0 -3
-	if (crtc->out_fence_ptr)
-		crtc_set_prop(req, crtc, IGT_CRTC_OUT_FENCE_PTR,
-			      to_user_pointer(crtc-
Quoted 1 line

out_fence_ptr));

tests/kms_atomic.c +2 -0
+	if (prop == IGT_CRTC_MODE_ID || prop == IGT_CRTC_ACTIVE)
+		return false;

tests/kms_atomic.c +0 -1
-	crtc_set_prop(req, crtc, IGT_CRTC_MODE_ID, crtc-
Quoted 1 line

mode.id);

tests/kms_atomic.c +1 -1
-	crtc_set_prop(req, crtc, IGT_CRTC_ACTIVE, crtc->active);
+	return true;

 }

-static void crtc_get_current_state(struct kms_atomic_crtc_state *crtc)
+static void crtc_get_current_state(igt_pipe_t *pipe, uint64_t *values)
 {

tests/kms_atomic.c +0 -1
-	drmModeObjectPropertiesPtr props;

  int i;

tests/kms_atomic.c +0 -1
-	props = drmModeObjectGetProperties(crtc->state->desc-
Quoted 1 line

fd,

crtc->obj,

tests/kms_atomic.c +0 -1
-					   DRM_MODE_OBJECT_CRTC)

;

tests/kms_atomic.c +0 -4
-	igt_assert(props);
-
-	for (i = 0; i < props->count_props; i++) {
-		uint32_t *prop_ids = crtc->state->desc-
Quoted 1 line

props_crtc;

tests/kms_atomic.c +0 -2
-
-		if (props->props[i] ==

prop_ids[IGT_CRTC_MODE_ID]) {

tests/kms_atomic.c +0 -9
-			drmModePropertyBlobPtr blob;
-
-			crtc->mode.id = props->prop_values[i];
-			if (!crtc->mode.id) {
-				crtc->mode.len = 0;
-				continue;
-			}
-
-			blob = drmModeGetPropertyBlob(crtc-
Quoted 3 lines

state-

desc->fd,

tests/kms_atomic.c +0 -1
-						      crtc-
Quoted 1 line

mode.id);

tests/kms_atomic.c +0 -3
-			igt_assert(blob);
-			igt_assert_eq_u32(blob->length,
-					  sizeof(struct

drm_mode_modeinfo));

tests/kms_atomic.c +0 -3
-
-			if (!crtc->mode.data ||
-			    memcmp(crtc->mode.data, blob->data,

blob->length) != 0)

tests/kms_atomic.c +0 -4
-				crtc->mode.data = blob->data;
-			crtc->mode.len = blob->length;
-		}
-		else if (props->props[i] ==

prop_ids[IGT_CRTC_ACTIVE]) {

tests/kms_atomic.c +4 -1
-			crtc->active = props->prop_values[i];
+	for (i = 0; i < IGT_NUM_CRTC_PROPS; i++) {
+		if (crtc_filter(i)) {
+			values[i] = 0;
+			continue;

  }

tests/kms_atomic.c +0 -1
-	}

tests/kms_atomic.c +2 -1
-	drmModeFreeObjectProperties(props);
+		values[i] = igt_pipe_obj_get_prop(pipe, i);
+	}

 }

-static void crtc_check_current_state(struct
kms_atomic_crtc_state
*crtc,

tests/kms_atomic.c +0 -1
-				     struct

kms_atomic_plane_state
*primary,

tests/kms_atomic.c +2 -0
+static void crtc_check_current_state(igt_pipe_t *pipe,
+				     const uint64_t

*pipe_values,

tests/kms_atomic.c +1 -0
+				     const uint64_t

*primary_values,
       enum kms_atomic_check_relax relax)
 {

tests/kms_atomic.c +1 -1
-	struct kms_atomic_crtc_state crtc_kernel;
+	uint64_t current_pipe_values[IGT_NUM_CRTC_PROPS];

  drmModeCrtcPtr legacy;

tests/kms_atomic.c +2 -0
+	drmModePropertyBlobRes *mode_prop = NULL;
+	struct drm_mode_modeinfo *mode = NULL;

tests/kms_atomic.c +0 -1
-	legacy = drmModeGetCrtc(crtc->state->desc->fd, crtc-
Quoted 1 line

obj);

tests/kms_atomic.c +0 -8
-	igt_assert(legacy);
-
-	igt_assert_eq_u32(legacy->crtc_id, crtc->obj);
-	igt_assert_eq_u32(legacy->x, primary->src_x >> 16);
-	igt_assert_eq_u32(legacy->y, primary->src_y >> 16);
-
-	if (crtc->active)
-		igt_assert_eq_u32(legacy->buffer_id, primary-
Quoted 1 line

fb_id);

tests/kms_atomic.c +2 -2
-	else
-		igt_assert_eq_u32(legacy->buffer_id, 0);
+	if (pipe_values[IGT_CRTC_MODE_ID]) {
+		mode_prop = drmModeGetPropertyBlob(pipe-
Quoted 3 lines

display-

drm_fd,

tests/kms_atomic.c +1 -0
+						   pipe_values[I

GT_C
RTC_MODE_ID]);

tests/kms_atomic.c +0 -7
-	if (legacy->mode_valid) {
-		igt_assert_neq(legacy->mode_valid, 0);
-		igt_assert_eq(crtc->mode.len,
-		              sizeof(struct drm_mode_modeinfo));
-		do_or_die(memcmp(&legacy->mode, crtc->mode.data,
-		                 crtc->mode.len));
-		igt_assert_eq(legacy->width, legacy-
Quoted 1 line

mode.hdisplay);

tests/kms_atomic.c +0 -1
-		igt_assert_eq(legacy->height, legacy-
Quoted 1 line

mode.vdisplay);

tests/kms_atomic.c +1 -3
-	} else {
-		igt_assert_eq(legacy->mode_valid, 0);
-	}
+		igt_assert(mode_prop);

tests/kms_atomic.c +1 -5
-	memcpy(&crtc_kernel, crtc, sizeof(crtc_kernel));
-	crtc_get_current_state(&crtc_kernel);
-
-	if (crtc_kernel.mode.id != 0)
-		igt_assert_eq(crtc_kernel.mode.len,
+		igt_assert_eq(mode_prop->length,

                sizeof(struct drm_mode_modeinfo));

tests/kms_atomic.c +0 -2
-
-	/* Optionally relax the check for MODE_ID: using the

legacy
SetCrtc

tests/kms_atomic.c +0 -1
-	 * API can potentially change MODE_ID even if the mode

itself remains

tests/kms_atomic.c +0 -11
-	 * unchanged. */
-	if (((relax & CRTC_RELAX_MODE) &&
-	    (crtc_kernel.mode.id != crtc->mode.id &&
-	     crtc_kernel.mode.id != 0 && crtc->mode.id != 0)) &&
-	    memcmp(crtc_kernel.mode.data, crtc->mode.data,
-		   sizeof(struct drm_mode_modeinfo)) == 0) {
-		crtc_kernel.mode.id = crtc->mode.id;
-		crtc_kernel.mode.data = crtc->mode.data;
-	}
-
-	do_or_die(memcmp(&crtc_kernel, crtc,

sizeof(crtc_kernel)));

tests/kms_atomic.c +0 -5
-
-	drmModeFreeCrtc(legacy);
-}
-
-static void crtc_commit_legacy(struct kms_atomic_crtc_state

*crtc,

tests/kms_atomic.c +0 -1
-			       struct kms_atomic_plane_state

*plane,

tests/kms_atomic.c +0 -1
-			       enum kms_atomic_check_relax

relax)

tests/kms_atomic.c +0 -9
-{
-	drmModeObjectPropertiesPtr props;
-	uint32_t *connectors;
-	int num_connectors = 0;
-	int i;
-
-	if (!crtc->active) {
-		do_or_die(drmModeSetCrtc(crtc->state->desc->fd,
-					 crtc->obj, 0, 0, 0,

NULL,
0, NULL));

tests/kms_atomic.c +1 -17
-		return;
-	}
-
-	connectors = calloc(crtc->state->num_connectors,
-			    sizeof(*connectors));
-	igt_assert(connectors);
-
-	igt_assert_neq_u32(crtc->mode.id, 0);
-
-	for (i = 0; i < crtc->state->num_connectors; i++) {
-		struct kms_atomic_connector_state *connector =
-			&crtc->state->connectors[i];
-
-		if (connector->crtc_id != crtc->obj)
-			continue;
-
-		connectors[num_connectors++] = connector->obj;
+		mode = mode_prop->data;

  }

tests/kms_atomic.c +0 -1
-	do_or_die(drmModeSetCrtc(crtc->state->desc->fd, crtc-
Quoted 1 line

obj,

tests/kms_atomic.c +0 -2
-	                         plane->fb_id,
-				 plane->src_x >> 16, plane-
Quoted 1 line

src_y >>

16,

tests/kms_atomic.c +0 -1
-				 (num_connectors) ? connectors :

NULL,

tests/kms_atomic.c +0 -3
-				 num_connectors,
-				 crtc->mode.data));
-	/* When doing a legacy commit, the core may update

MODE_ID
to be a new

tests/kms_atomic.c +0 -1
-	 * blob implicitly created by the legacy request. Hence

we
backfill

tests/kms_atomic.c +0 -1
-	 * the value in the state object to ensure they match.

*/

tests/kms_atomic.c +0 -1
-	props = drmModeObjectGetProperties(crtc->state->desc-
Quoted 1 line

fd,

crtc->obj,

tests/kms_atomic.c +0 -1
-					   DRM_MODE_OBJECT_CRTC)

;

tests/kms_atomic.c +0 -5
-	igt_assert(props);
-
-	for (i = 0; i < props->count_props; i++) {
-		if (props->props[i] !=
-		    crtc->state->desc-
Quoted 1 line

props_crtc[IGT_CRTC_MODE_ID])

tests/kms_atomic.c +1 -4
-			continue;
-		crtc->mode.id = props->prop_values[i];
-		break;
-	}
+	legacy = drmModeGetCrtc(pipe->display->drm_fd, pipe-
Quoted 1 line

crtc_id);

tests/kms_atomic.c +1 -0
+	igt_assert(legacy);

tests/kms_atomic.c +2 -1
-	drmModeFreeObjectProperties(props);
+	igt_assert_eq_u32(legacy->crtc_id, pipe->crtc_id);
+	igt_assert_eq_u32(legacy->x,

primary_values[IGT_PLANE_SRC_X]

Quoted 1 line
Quoted 1 line

16);

tests/kms_atomic.c +1 -0
+	igt_assert_eq_u32(legacy->y,

primary_values[IGT_PLANE_SRC_Y]

Quoted 1 line
Quoted 1 line

16);

tests/kms_atomic.c +1 -3
-	crtc_check_current_state(crtc, plane, relax);
-	plane_check_current_state(plane, relax);
-}
+	igt_assert_eq_u32(legacy->buffer_id,

primary_values[IGT_PLANE_FB_ID]);

-static struct kms_atomic_crtc_state *find_crtc(struct kms_atomic_state *state,

tests/kms_atomic.c +0 -1
-					       bool

must_be_enabled)

tests/kms_atomic.c +2 -2
-{
-	int i;
+	if (legacy->mode_valid) {
+		igt_assert(mode_prop);

tests/kms_atomic.c +0 -2
-	for (i = 0; i < state->num_crtcs; i++) {
-		struct kms_atomic_crtc_state *crtc = &state-
Quoted 1 line

crtcs[i];

tests/kms_atomic.c +1 -0
+		do_or_die(memcmp(&legacy->mode, mode,

sizeof(*mode)));

tests/kms_atomic.c +1 -4
-		if (!crtc->obj)
-			continue;
-		if (must_be_enabled && !crtc->active)
-			continue;
+		igt_assert_eq(legacy->width, legacy-
Quoted 1 line

mode.hdisplay);

tests/kms_atomic.c +1 -0
+		igt_assert_eq(legacy->height, legacy-
Quoted 1 line

mode.vdisplay);

tests/kms_atomic.c +1 -2
-		crtc_get_current_state(crtc);
-		return crtc;
+		igt_assert_neq(pipe_values[IGT_CRTC_MODE_ID],

0);

tests/kms_atomic.c +2 -0
+	} else {
+		igt_assert(!mode_prop);

  }

tests/kms_atomic.c +1 -2
-	return NULL;
-}
+	crtc_get_current_state(pipe, current_pipe_values);


-static void fill_obj_props(int fd, uint32_t id, int type, int num_props,

tests/kms_atomic.c +0 -1
-			   const char **prop_names, uint32_t

*prop_ids)

tests/kms_atomic.c +1 -6
-{
-	drmModeObjectPropertiesPtr props;
-	int i, j;
-
-	props = drmModeObjectGetProperties(fd, id, type);
-	igt_assert(props);
+	/* Optionally relax the check for MODE_ID: using the

legacy
SetCrtc

tests/kms_atomic.c +1 -0
+	 * API can potentially change MODE_ID even if the mode

itself remains

tests/kms_atomic.c +2 -0
+	 * unchanged. */
+	if (relax & CRTC_RELAX_MODE && mode &&

current_pipe_values[IGT_CRTC_MODE_ID] &&

tests/kms_atomic.c +1 -0
+	    current_pipe_values[IGT_CRTC_MODE_ID] !=

pipe_values[IGT_CRTC_MODE_ID]) {

tests/kms_atomic.c +2 -0
+		drmModePropertyBlobRes *cur_prop =
+			drmModeGetPropertyBlob(pipe->display-
Quoted 1 line

drm_fd,

tests/kms_atomic.c +1 -0
+					       current_pipe_valu

es[I
GT_CRTC_MODE_ID]);

tests/kms_atomic.c +2 -3
-	for (i = 0; i < props->count_props; i++) {
-		drmModePropertyPtr prop =
-			drmModeGetProperty(fd, props->props[i]);
+		igt_assert(cur_prop);
+		igt_assert_eq(cur_prop->length, sizeof(struct

drm_mode_modeinfo));

tests/kms_atomic.c +0 -2
-		for (j = 0; j < num_props; j++) {
-			if (strcmp(prop->name, prop_names[j]) !=

0)

tests/kms_atomic.c +1 -4
-				continue;
-			prop_ids[j] = props->props[i];
-			break;
-		}
+		if (!memcmp(cur_prop->data, mode,

sizeof(*mode)))

tests/kms_atomic.c +1 -0
+			current_pipe_values[IGT_CRTC_MODE_ID] =

pipe_values[IGT_CRTC_MODE_ID];

tests/kms_atomic.c +1 -1
-		drmModeFreeProperty(prop);
+		drmModeFreePropertyBlob(cur_prop);

  }

tests/kms_atomic.c +1 -2
-	drmModeFreeObjectProperties(props);
-}
+	do_or_die(memcmp(pipe_values, current_pipe_values,

sizeof(current_pipe_values)));

-static void fill_obj_prop_map(int fd, uint32_t id, int type, const
char *name,

tests/kms_atomic.c +0 -1
-			      int num_enums, const char

**enum_names,

tests/kms_atomic.c +0 -21
-			      uint64_t *enum_ids)
-{
-	drmModeObjectPropertiesPtr props;
-	int i, j, k;
-
-	props = drmModeObjectGetProperties(fd, id, type);
-	igt_assert(props);
-
-	for (i = 0; i < props->count_props; i++) {
-		drmModePropertyPtr prop =
-			drmModeGetProperty(fd, props->props[i]);
-
-		igt_assert(prop);
-
-		if (strcmp(prop->name, name) != 0) {
-			drmModeFreeProperty(prop);
-			continue;
-		}
-
-		for (j = 0; j < prop->count_enums; j++) {
-			struct drm_mode_property_enum *e =

&prop-

Quoted 1 line

enums[j];

tests/kms_atomic.c +0 -3
-
-			for (k = 0; k < num_enums; k++) {
-				if (strcmp(e->name,

enum_names[k])
!= 0)

tests/kms_atomic.c +2 -9
-					continue;
-
-				enum_ids[k] = e->value;
-				break;
-			}
-		}
-
-		drmModeFreeProperty(prop);
-	}
+	drmModeFreeCrtc(legacy);
+	drmModeFreePropertyBlob(mode_prop);

 }

tests/kms_atomic.c +3 -1
-static void atomic_setup(struct kms_atomic_state *state)
+static void crtc_commit(igt_pipe_t *pipe, igt_plane_t *plane,
+			enum igt_commit_style s,
+			enum kms_atomic_check_relax relax)

 {

tests/kms_atomic.c +0 -9
-	struct kms_atomic_desc *desc = state->desc;
-	drmModeResPtr res;
-	drmModePlaneResPtr res_plane;
-	int i;
-
-	desc->fd = drm_open_driver_master(DRIVER_ANY);
-	igt_assert_fd(desc->fd);
-
-	igt_skip_on(drmSetClientCap(desc->fd,

DRM_CLIENT_CAP_ATOMIC,
1));

tests/kms_atomic.c +0 -9
-
-	res = drmModeGetResources(desc->fd);
-	res_plane = drmModeGetPlaneResources(desc->fd);
-	igt_assert(res);
-	igt_assert(res_plane);
-
-	igt_assert_lt(0, res->count_crtcs);
-	state->num_crtcs = res->count_crtcs;
-	state->crtcs = calloc(state->num_crtcs, sizeof(*state-
Quoted 1 line

crtcs));

tests/kms_atomic.c +0 -5
-	igt_assert(state->crtcs);
-
-	igt_assert_lt(0, res_plane->count_planes);
-	state->num_planes = res_plane->count_planes;
-	state->planes = calloc(state->num_planes, sizeof(*state-
Quoted 1 line

planes));

tests/kms_atomic.c +0 -14
-	igt_assert(state->planes);
-
-	igt_assert_lt(0, res->count_connectors);
-	state->num_connectors = res->count_connectors;
-	state->connectors = calloc(state->num_connectors,
-				   sizeof(*state->connectors));
-	igt_assert(state->connectors);
-
-	fill_obj_props(desc->fd, res->crtcs[0],
-		       DRM_MODE_OBJECT_CRTC, IGT_NUM_CRTC_PROPS,
-		       igt_crtc_prop_names, desc->props_crtc);
-
-	fill_obj_props(desc->fd, res_plane->planes[0],
-		       DRM_MODE_OBJECT_PLANE,

IGT_NUM_PLANE_PROPS,

tests/kms_atomic.c +0 -4
-		       igt_plane_prop_names, desc->props_plane);
-	fill_obj_prop_map(desc->fd, res_plane->planes[0],
-			  DRM_MODE_OBJECT_PLANE, "type",
-			  NUM_PLANE_TYPE_PROPS,

plane_type_prop_names,

tests/kms_atomic.c +0 -4
-			  desc->props_plane_type);
-
-	fill_obj_props(desc->fd, res->connectors[0],
-		       DRM_MODE_OBJECT_CONNECTOR,

IGT_NUM_CONNECTOR_PROPS,

tests/kms_atomic.c +0 -1
-		       igt_connector_prop_names, desc-
Quoted 1 line

props_connector);

tests/kms_atomic.c +0 -3
-
-	for (i = 0; i < state->num_crtcs; i++) {
-		struct kms_atomic_crtc_state *crtc = &state-
Quoted 1 line

crtcs[i];

tests/kms_atomic.c +0 -7
-
-		crtc->state = state;
-		crtc->obj = res->crtcs[i];
-		crtc->idx = i;
-		crtc_get_current_state(crtc);
-
-		/* The blob pointed to by MODE_ID could well be

transient,

tests/kms_atomic.c +0 -1
-		 * and lose its last reference as we switch away

from it.

tests/kms_atomic.c +0 -1
-		 * Duplicate the blob here so we have a

reference we
know we

tests/kms_atomic.c +0 -3
-		 * own. */
-		if (crtc->mode.id != 0)
-		    crtc->mode.id = blob_duplicate(desc->fd,

crtc-

Quoted 1 line

mode.id);

tests/kms_atomic.c +1 -1
-	}
+	igt_display_commit2(pipe->display, s);

tests/kms_atomic.c +0 -3
-	for (i = 0; i < state->num_planes; i++) {
-		drmModePlanePtr plane =
-			drmModeGetPlane(desc->fd, res_plane-
Quoted 1 line

planes[i]);

tests/kms_atomic.c +0 -5
-		igt_assert(plane);
-
-		state->planes[i].state = state;
-		state->planes[i].obj = res_plane->planes[i];
-		state->planes[i].crtc_mask = plane-
Quoted 1 line

possible_crtcs;

tests/kms_atomic.c +0 -7
-		plane_get_current_state(&state->planes[i]);
-	}
-
-	for (i = 0; i < state->num_connectors; i++) {
-		state->connectors[i].state = state;
-		state->connectors[i].obj = res->connectors[i];
-		connector_get_current_state(&state-
Quoted 1 line

connectors[i]);

tests/kms_atomic.c +1 -4
-	}
-
-	drmModeFreePlaneResources(res_plane);
-	drmModeFreeResources(res);
+	crtc_check_current_state(pipe, pipe->values, plane-
Quoted 1 line

values,

relax);

tests/kms_atomic.c +1 -0
+	plane_check_current_state(plane, plane->values, relax);

 }

tests/kms_atomic.c +1 -2
-static struct kms_atomic_state *
-atomic_state_dup(const struct kms_atomic_state *state)
+static void crtc_commit_atomic_flags_err(igt_pipe_t *pipe,

igt_plane_t *plane,

tests/kms_atomic.c +2 -0
+					 unsigned flags,
+					 enum

kms_atomic_check_relax
relax,

tests/kms_atomic.c +1 -0
+					 int err)

 {

tests/kms_atomic.c +2 -4
-	struct kms_atomic_state *ret = calloc(1, sizeof(*ret));
-
-	igt_assert(ret);
-	*ret = *state;
+	uint64_t current_pipe_values[IGT_NUM_CRTC_PROPS];
+	uint64_t current_plane_values[IGT_NUM_PLANE_PROPS];

tests/kms_atomic.c +0 -1
-	ret->crtcs = calloc(ret->num_crtcs, sizeof(*ret-
Quoted 1 line

crtcs));

tests/kms_atomic.c +0 -2
-	igt_assert(ret->crtcs);
-	memcpy(ret->crtcs, state->crtcs, ret->num_crtcs *

sizeof(*ret->crtcs));

tests/kms_atomic.c +2 -0
+	crtc_get_current_state(pipe, current_pipe_values);
+	plane_get_current_state(plane, current_plane_values);

tests/kms_atomic.c +0 -1
-	ret->planes = calloc(ret->num_planes, sizeof(*ret-
Quoted 1 line

planes));

tests/kms_atomic.c +1 -3
-	igt_assert(ret->planes);
-	memcpy(ret->planes, state->planes,
-	       ret->num_planes * sizeof(*ret->planes));
+	igt_assert_eq(-err, igt_display_try_commit_atomic(pipe-
Quoted 1 line

display, flags, NULL));

tests/kms_atomic.c +0 -1
-	ret->connectors = calloc(ret->num_connectors,

sizeof(*ret-

Quoted 1 line

connectors));

tests/kms_atomic.c +1 -5
-	igt_assert(ret->connectors);
-	memcpy(ret->connectors, state->connectors,
-	       ret->num_connectors * sizeof(*ret->connectors));
-
-	return ret;
+	crtc_check_current_state(pipe, current_pipe_values,

current_plane_values, relax);

tests/kms_atomic.c +1 -0
+	plane_check_current_state(plane, current_plane_values,

relax);
 }

tests/kms_atomic.c +2 -7
-static void atomic_state_free(struct kms_atomic_state *state)
-{
-	free(state->crtcs);
-	free(state->planes);
-	free(state->connectors);
-	free(state);
-}
+#define crtc_commit_atomic_err(pipe, plane, relax, err) \
+	crtc_commit_atomic_flags_err(pipe, plane,

DRM_MODE_ATOMIC_ALLOW_MODESET, relax, err)

-static uint32_t plane_get_igt_format(struct kms_atomic_plane_state
*plane)
+static uint32_t plane_get_igt_format(igt_plane_t *plane) {
  drmModePlanePtr plane_kms;
  const uint32_t *igt_formats;

tests/kms_atomic.c +0 -1
-	uint32_t ret = 0;

  int num_igt_formats;
  int i;

tests/kms_atomic.c +0 -1
-	plane_kms = drmModeGetPlane(plane->state->desc->fd,

plane-

Quoted 1 line

obj);

tests/kms_atomic.c +1 -1
-	igt_assert(plane_kms);
+	plane_kms = plane->drm_plane;


  igt_get_all_cairo_formats(&igt_formats, &num_igt_formats);
  for (i = 0; i < num_igt_formats; i++) {
  int j;

  for (j = 0; j < plane_kms->count_formats; j++) {

tests/kms_atomic.c +0 -1
-			if (plane_kms->formats[j] ==

igt_formats[i])
{

tests/kms_atomic.c +1 -3
-				ret = plane_kms->formats[j];
-				break;
-			}
+			if (plane_kms->formats[j] ==

igt_formats[i])

tests/kms_atomic.c +1 -0
+				return plane_kms->formats[j];

  }
  }

tests/kms_atomic.c +1 -2
-	drmModeFreePlane(plane_kms);
-	return ret;
+	return 0;

 }

 static void

tests/kms_atomic.c +1 -1
-set_dpms(int fd, int mode)
+set_dpms(igt_output_t *output, int mode)

 {

tests/kms_atomic.c +1 -14
-	int i;
-	drmModeConnector *connector;
-	uint32_t id;
-	drmModeRes *resources = drmModeGetResources(fd);
-
-	for (i = 0; i < resources->count_connectors; i++) {
-		id = resources->connectors[i];
-
-		connector = drmModeGetConnectorCurrent(fd, id);
-
-		kmstest_set_connector_dpms(fd, connector, mode);
-
-		drmModeFreeConnector(connector);
-	}
+	do_or_die(drmModeConnectorSetProperty(output->display-
Quoted 1 line

drm_fd, output->id,

tests/kms_atomic.c +1 -0
+					      output-
Quoted 1 line

props[IGT_CONNECTOR_DPMS], mode));

 }

tests/kms_atomic.c +0 -2
-static void plane_overlay(struct kms_atomic_crtc_state *crtc,
-			  struct kms_atomic_plane_state

*plane_old)
+static void plane_overlay(igt_pipe_t *pipe, igt_output_t *output,
igt_plane_t *plane)
 {

tests/kms_atomic.c +2 -4
-	struct drm_mode_modeinfo *mode = crtc->mode.data;
-	struct kms_atomic_plane_state plane = *plane_old;
-	uint32_t format = plane_get_igt_format(&plane);
-	drmModeAtomicReq *req = drmModeAtomicAlloc();
+	drmModeModeInfo *mode = igt_output_get_mode(output);
+	uint32_t format = plane_get_igt_format(plane);

  struct igt_fb fb;

tests/kms_atomic.c +2 -0
+	uint32_t w = mode->hdisplay / 2;
+	uint32_t h = mode->vdisplay / 2;

tests/kms_atomic.c +0 -1
-	igt_require(req);

  igt_require(format != 0);

tests/kms_atomic.c +0 -10
-	plane.src_x = 0;
-	plane.src_y = 0;
-	plane.src_w = (mode->hdisplay / 2) << 16;
-	plane.src_h = (mode->vdisplay / 2) << 16;
-	plane.crtc_x = mode->hdisplay / 4;
-	plane.crtc_y = mode->vdisplay / 4;
-	plane.crtc_w = mode->hdisplay / 2;
-	plane.crtc_h = mode->vdisplay / 2;
-	plane.crtc_id = crtc->obj;
-	plane.fb_id = igt_create_pattern_fb(plane.state->desc-
Quoted 1 line

fd,

tests/kms_atomic.c +0 -1
-					    plane.crtc_w,

plane.crtc_h,

tests/kms_atomic.c +0 -1
-					    format,

I915_TILING_NONE, &fb);

tests/kms_atomic.c +5 -0
+	igt_create_pattern_fb(pipe->display->drm_fd, w, h,
+			      format, I915_TILING_NONE, &fb);
+
+	igt_plane_set_fb(plane, &fb);
+	igt_plane_set_position(plane, w/2, h/2);


  /* Enable the overlay plane using the atomic API, and double-check
   * state is what we think it should be. */

tests/kms_atomic.c +1 -1
-	plane_commit_atomic(&plane, req, ATOMIC_RELAX_NONE);
+	plane_commit(plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);


  /* Disable the plane and check the state matches the old. */

tests/kms_atomic.c +3 -1
-	plane_commit_atomic(plane_old, req, ATOMIC_RELAX_NONE);
+	igt_plane_set_fb(plane, NULL);
+	igt_plane_set_position(plane, 0, 0);
+	plane_commit(plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);


  /* Re-enable the plane through the legacy plane API, and verify through
   * atomic. */

tests/kms_atomic.c +3 -1
-	plane_commit_legacy(&plane, ATOMIC_RELAX_NONE);
+	igt_plane_set_fb(plane, &fb);
+	igt_plane_set_position(plane, w/2, h/2);
+	plane_commit(plane, COMMIT_LEGACY, ATOMIC_RELAX_NONE);


  /* Restore the plane to its original settings through the
legacy plane
   * API, and verify through atomic. */

tests/kms_atomic.c +3 -1
-	plane_commit_legacy(plane_old, ATOMIC_RELAX_NONE);
+	igt_plane_set_fb(plane, NULL);
+	igt_plane_set_position(plane, 0, 0);
+	plane_commit(plane, COMMIT_LEGACY, ATOMIC_RELAX_NONE);

tests/kms_atomic.c +1 -1
-	drmModeAtomicFree(req);
+	igt_remove_fb(pipe->display->drm_fd, &fb);

 }

tests/kms_atomic.c +0 -2
-static void plane_primary(struct kms_atomic_crtc_state *crtc,
-			  struct kms_atomic_plane_state

*plane_old)
+static void plane_primary(igt_pipe_t *pipe, igt_plane_t *plane, struct igt_fb *fb)
 {

tests/kms_atomic.c +1 -9
-	struct drm_mode_modeinfo *mode = crtc->mode.data;
-	struct kms_atomic_plane_state plane = *plane_old;
-	uint32_t format = plane_get_igt_format(&plane);
-	drmModeAtomicReq *req = drmModeAtomicAlloc();
-	struct igt_fb fb;
-	uint32_t flags = 0;
-	int ret;
-
-	igt_require(format != 0);
+	struct igt_fb fb2;

tests/kms_atomic.c +0 -10
-	plane.src_x = 0;
-	plane.src_y = 0;
-	plane.src_w = mode->hdisplay << 16;
-	plane.src_h = mode->vdisplay << 16;
-	plane.crtc_x = 0;
-	plane.crtc_y = 0;
-	plane.crtc_w = mode->hdisplay;
-	plane.crtc_h = mode->vdisplay;
-	plane.crtc_id = crtc->obj;
-	plane.fb_id = igt_create_pattern_fb(plane.state->desc-
Quoted 1 line

fd,

tests/kms_atomic.c +0 -1
-					    plane.crtc_w,

plane.crtc_h,

tests/kms_atomic.c +0 -1
-					    format,

I915_TILING_NONE, &fb);

tests/kms_atomic.c +0 -6
-
-	drmModeAtomicSetCursor(req, 0);
-	crtc_populate_req(crtc, req);
-	plane_populate_req(&plane, req);
-	ret = drmModeAtomicCommit(crtc->state->desc->fd, req,
-				  DRM_MODE_ATOMIC_TEST_ONLY,

NULL);

tests/kms_atomic.c +0 -1
-	/* Try harder in case the failure is caused by

disallowing
modeset. */

tests/kms_atomic.c +3 -2
-	if (ret == -EINVAL)
-		flags |= DRM_MODE_ATOMIC_ALLOW_MODESET;
+	igt_create_color_pattern_fb(pipe->display->drm_fd,
+				    fb->width, fb->height,
+				    fb->drm_format,

I915_TILING_NONE,

tests/kms_atomic.c +1 -0
+				    0.2, 0.2, 0.2, &fb2);


  /* Flip the primary plane using the atomic API, and double-
check
   * state is what we think it should be. */

tests/kms_atomic.c +0 -1
-	crtc_commit_atomic(crtc, &plane, req, ATOMIC_RELAX_NONE,

flags);

tests/kms_atomic.c +2 -0
+	igt_plane_set_fb(plane, &fb2);
+	crtc_commit(pipe, plane, COMMIT_ATOMIC,

ATOMIC_RELAX_NONE);

  /* Restore the primary plane and check the state matches the
old. */

tests/kms_atomic.c +0 -1
-	crtc_commit_atomic(crtc, plane_old, req,

ATOMIC_RELAX_NONE,
flags);

tests/kms_atomic.c +2 -0
+	igt_plane_set_fb(plane, fb);
+	crtc_commit(pipe, plane, COMMIT_ATOMIC,

ATOMIC_RELAX_NONE);

tests/kms_atomic.c +0 -1
-	/* Re-enable the plane through the legacy CRTC/primary-

plane
API, and

tests/kms_atomic.c +1 -0
+	/* Set the plane through the legacy CRTC/primary-plane

API,
and
   * verify through atomic. */

tests/kms_atomic.c +2 -1
-	crtc_commit_legacy(crtc, &plane, CRTC_RELAX_MODE);
+	igt_plane_set_fb(plane, &fb2);
+	crtc_commit(pipe, plane, COMMIT_LEGACY,

CRTC_RELAX_MODE);

  /* Restore the plane to its original settings through the
legacy CRTC
   * API, and verify through atomic. */

tests/kms_atomic.c +0 -4
-	crtc_commit_legacy(crtc, plane_old, CRTC_RELAX_MODE);
-
-	/* Finally, restore to the original state. */
-	crtc_commit_atomic(crtc, plane_old, req,

ATOMIC_RELAX_NONE,
flags);

tests/kms_atomic.c +2 -0
+	igt_plane_set_fb(plane, fb);
+	crtc_commit(pipe, plane, COMMIT_LEGACY,

CRTC_RELAX_MODE);

tests/kms_atomic.c +4 -1
-	drmModeAtomicFree(req);
+	/* Set the plane through the universal setplane API, and
+	 * verify through atomic. */
+	igt_plane_set_fb(plane, &fb2);
+	plane_commit(plane, COMMIT_UNIVERSAL,

ATOMIC_RELAX_NONE);
 }

 /* test to ensure that DRM_MODE_ATOMIC_TEST_ONLY really only touches
the
  * free-standing state objects and nothing else. */

tests/kms_atomic.c +3 -2
-static void test_only(struct kms_atomic_crtc_state *crtc,
-		      struct kms_atomic_plane_state *plane_old)
+static void test_only(igt_pipe_t *pipe_obj,
+		      igt_plane_t *primary,
+		      igt_output_t *output)

 {

tests/kms_atomic.c +2 -4
-	struct drm_mode_modeinfo *mode = crtc->mode.data;
-	struct kms_atomic_plane_state plane = *plane_old;
-	uint32_t format = plane_get_igt_format(&plane);
-	drmModeAtomicReq *req = drmModeAtomicAlloc();
+	drmModeModeInfo *mode = igt_output_get_mode(output);
+	uint32_t format = plane_get_igt_format(primary);

  struct igt_fb fb;

tests/kms_atomic.c +1 -1
-	int ret;
+	uint64_t old_plane_values[IGT_NUM_PLANE_PROPS],

old_crtc_values[IGT_NUM_CRTC_PROPS];

  igt_require(format != 0);

tests/kms_atomic.c +0 -10
-	plane.src_x = 0;
-	plane.src_y = 0;
-	plane.src_w = mode->hdisplay << 16;
-	plane.src_h = mode->vdisplay << 16;
-	plane.crtc_x = 0;
-	plane.crtc_y = 0;
-	plane.crtc_w = mode->hdisplay;
-	plane.crtc_h = mode->vdisplay;
-	plane.crtc_id = crtc->obj;
-	plane.fb_id = igt_create_pattern_fb(plane.state->desc-
Quoted 1 line

fd,

tests/kms_atomic.c +0 -1
-					    plane.crtc_w,

plane.crtc_h,

tests/kms_atomic.c +0 -1
-					    format,

I915_TILING_NONE, &fb);

tests/kms_atomic.c +0 -6
-
-	drmModeAtomicSetCursor(req, 0);
-	crtc_populate_req(crtc, req);
-	plane_populate_req(&plane, req);
-	ret = drmModeAtomicCommit(crtc->state->desc->fd, req,
-				  DRM_MODE_ATOMIC_TEST_ONLY,

NULL);

tests/kms_atomic.c +0 -9
-
-	igt_assert_eq(ret, 0);
-
-	/* go through dpms off/on cycle */
-	set_dpms(crtc->state->desc->fd, DRM_MODE_DPMS_OFF);
-	set_dpms(crtc->state->desc->fd, DRM_MODE_DPMS_ON);
-
-	/* check the state */
-	crtc_check_current_state(crtc, plane_old,

ATOMIC_RELAX_NONE);

tests/kms_atomic.c +0 -3
-	plane_check_current_state(plane_old, ATOMIC_RELAX_NONE);
-
-	/* Re-enable the plane through the legacy CRTC/primary-

plane
API, and

tests/kms_atomic.c +12 -2
-	 * verify through atomic. */
-	crtc_commit_legacy(crtc, plane_old, CRTC_RELAX_MODE);
+	plane_get_current_state(primary, old_plane_values);
+	crtc_get_current_state(pipe_obj, old_crtc_values);
+
+	igt_assert(!old_crtc_values[IGT_CRTC_MODE_ID]);
+
+	igt_create_pattern_fb(pipe_obj->display->drm_fd,
+			     mode->hdisplay, mode->vdisplay,
+			     format, I915_TILING_NONE, &fb);
+	igt_plane_set_fb(primary, &fb);
+	igt_output_set_pipe(output, pipe_obj->pipe);
+
+	igt_display_commit_atomic(pipe_obj->display,

DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);

tests/kms_atomic.c +3 -0
+
+	/* check the state, should still be old state */
+	crtc_check_current_state(pipe_obj, old_crtc_values,

old_plane_values, ATOMIC_RELAX_NONE);

tests/kms_atomic.c +1 -0
+	plane_check_current_state(primary, old_plane_values,

ATOMIC_RELAX_NONE);

tests/kms_atomic.c +3 -0
+
+	/*
+	 * Enable the plane through the legacy CRTC/primary-

plane
API, and

tests/kms_atomic.c +3 -0
+	 * verify through atomic.
+	 */
+	crtc_commit(pipe_obj, primary, COMMIT_LEGACY,

CRTC_RELAX_MODE);

tests/kms_atomic.c +9 -0
+
+	/* Same for disable.. */
+	plane_get_current_state(primary, old_plane_values);
+	crtc_get_current_state(pipe_obj, old_crtc_values);
+
+	igt_plane_set_fb(primary, NULL);
+	igt_output_set_pipe(output, PIPE_NONE);
+
+	igt_display_commit_atomic(pipe_obj->display,

DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);

Quoted 8 lines

tests/kms_atomic.c enum kms_atomic_check_relax { · line 415

Quoted 5 lines

tests/kms_atomic.c +3 -1
-	drmModeAtomicFree(req);
+	/* for extra stress, go through dpms off/on cycle */
+	set_dpms(output, DRM_MODE_DPMS_OFF);
+	set_dpms(output, DRM_MODE_DPMS_ON);

There is this library function 'kmstest_set_connector_dpms()'. Could we
utilize this function here instead?

Sure, I never understood what the dpms call was supposed to expose though..

Quoted 7 lines
Quoted 3 lines

Want me to resend or is replacing the call with kmstest_set_connector_dpms(s, output->config.connector, DRM_MODE_DPMS_OFF); enough?

Well, my point of view is that we should use library functions as much as possible. I guess that's the reason why we have the libraries in the first place. So a vote for a replacement.

Thanks for review and irc r-b with fixes, pushed. :)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#38 lore raw

✓ Fi.CI.BAT: success for lib/igt_kms: Rewrite property handling to better match atomic. (rev4)

In reply to Maarten Lankhorst
== Series Details ==

== Series Details ==

Series: lib/igt_kms: Rewrite property handling to better match atomic. (rev4)
URL : https://patchwork.freedesktop.org/series/31733/
State : success

== Summary ==

IGT patchset tested on top of latest successful build f0bfbad1cf1d01e65112310e95ba5ecba15133d1 benchmark/gem_busy: Compare polling with syncobj_wait

with latest DRM-Tip kernel build CI_DRM_3222
a869721e93a5 drm-tip: 2017y-10m-12d-08h-30m-31s UTC integration manifest

No testlist changes.

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:451s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:475s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:398s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:575s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:290s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:526s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:525s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:541s
fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:526s
fi-cfl-s         total:289  pass:253  dwarn:4   dfail:0   fail:0   skip:32  time:567s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:429s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:277s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:595s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:438s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:461s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:504s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:477s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:505s
fi-kbl-7567u     total:289  pass:265  dwarn:4   dfail:0   fail:0   skip:20  time:495s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:590s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:664s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:468s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:662s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:533s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:512s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:473s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:582s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:440s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_337/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#39 lore raw

✗ Fi.CI.IGT: failure for lib/igt_kms: Rewrite property handling to better match atomic. (rev4)

In reply to Maarten Lankhorst
== Series Details ==

== Series Details ==

Series: lib/igt_kms: Rewrite property handling to better match atomic. (rev4)
URL : https://patchwork.freedesktop.org/series/31733/
State : failure

== Summary ==

Test perf:

        Subgroup polling:
                pass       -> FAIL       (shard-hsw) fdo#102252
Test prime_self_import:
        Subgroup reimport-vs-gem_close-race:
                fail       -> PASS       (shard-hsw) fdo#102655
Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-rte:
                pass       -> SKIP       (shard-hsw)
        Subgroup fbc-farfromfence:
                pass       -> SKIP       (shard-hsw)
        Subgroup fbc-1p-primscrn-indfb-msflip-blt:
                pass       -> SKIP       (shard-hsw)
        Subgroup fbc-1p-offscren-pri-shrfb-draw-mmap-wc:
                dmesg-warn -> PASS       (shard-hsw) fdo#102614
Test kms_universal_plane:
        Subgroup cursor-fb-leak-pipe-A:
                pass       -> SKIP       (shard-hsw)
Test kms_crtc_background_color:
                skip       -> FAIL       (shard-hsw)
Test kms_atomic:
        Subgroup atomic_invalid_params:
                pass       -> FAIL       (shard-hsw)

fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#102655 https://bugs.freedesktop.org/show_bug.cgi?id=102655
fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614

shard-hsw total:2551 pass:1434 dwarn:0 dfail:0 fail:11 skip:1106 time:9555s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_337/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#40 lore raw

✓ Fi.CI.BAT: success for lib/igt_kms: Rewrite property handling to better match atomic. (rev6)

In reply to Maarten Lankhorst
== Series Details ==

== Series Details ==

Series: lib/igt_kms: Rewrite property handling to better match atomic. (rev6)
URL : https://patchwork.freedesktop.org/series/31733/
State : success

== Summary ==

IGT patchset tested on top of latest successful build
69fbd44e269bd5e7e751a34e4d846e6cf3fa3eb3 tests/pm_backlight: Enable connected output to allow tests to succeed, v4.

with latest DRM-Tip kernel build CI_DRM_3223
e8024950de9e drm-tip: 2017y-10m-12d-15h-17m-52s UTC integration manifest

No testlist changes.

Test gem_exec_reloc:

        Subgroup basic-cpu-gtt-active:
                fail       -> PASS       (fi-gdg-551) fdo#102582

fdo#102582 https://bugs.freedesktop.org/show_bug.cgi?id=102582

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:453s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:471s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:391s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:577s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:288s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:526s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:525s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:547s
fi-cfl-s         total:289  pass:253  dwarn:4   dfail:0   fail:0   skip:32  time:565s
fi-cnl-y         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:634s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:440s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:276s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:602s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:441s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:461s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:508s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:480s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:509s
fi-kbl-7567u     total:289  pass:265  dwarn:4   dfail:0   fail:0   skip:20  time:489s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:598s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:662s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:478s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:668s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:536s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:520s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:472s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:590s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:439s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_340/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#41 lore raw

✗ Fi.CI.IGT: failure for lib/igt_kms: Rewrite property handling to better match atomic. (rev6)

In reply to Maarten Lankhorst
== Series Details ==

== Series Details ==

Series: lib/igt_kms: Rewrite property handling to better match atomic. (rev6)
URL : https://patchwork.freedesktop.org/series/31733/
State : failure

== Summary ==

Test kms_atomic:

        Subgroup test_only:
                skip       -> PASS       (shard-hsw)
Test perf:
        Subgroup polling:
                fail       -> PASS       (shard-hsw) fdo#102252
        Subgroup oa-exponents:
                pass       -> FAIL       (shard-hsw)
Test kms_busy:
        Subgroup extended-modeset-hang-oldfb-with-reset-render-C:
                dmesg-warn -> PASS       (shard-hsw)
Test prime_self_import:
        Subgroup export-vs-gem_close-race:
                fail       -> PASS       (shard-hsw)

fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252

shard-hsw total:2552 pass:1439 dwarn:0 dfail:0 fail:10 skip:1103 time:9639s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_340/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx