* [PATCH i-g-t v4 0/7] lib/igt_kms: Convert properties to be more atomic-like.
@ 2017-09-29 9:59 Maarten Lankhorst
2017-09-29 9:59 ` [PATCH i-g-t v4 1/7] tests: Stop looking at plane private members Maarten Lankhorst
` (11 more replies)
0 siblings, 12 replies; 25+ messages in thread
From: Maarten Lankhorst @ 2017-09-29 9:59 UTC (permalink / raw)
To: intel-gfx
Instead of having to special case each property when it's added,
I want to make sure that any test can add arbitrary properties without
having to add too much code. Some of the members I want to expose directly,
and I also add a way to set a blob as property for planes and pipes,
which will be useful for the upcoming plane color management stuff.
With all the feedback from i-g-t applied.
Maarten Lankhorst (7):
tests: Stop looking at plane private members
lib/igt_kms: Change output->pending_crtc_idx_mask to
output->pending_pipe
lib/igt_kms: Commit primary plane when a modeset is forced on a pipe
lib/igt_kms: Rework connector properties to be more atomic, v2.
lib/igt_kms: Rework plane properties to be more atomic, v4.
lib/igt_kms: Rework pipe properties to be more atomic, v4.1.
igt/kms_rotation_crc : Fix flip tests for sprite plane
lib/igt_kms.c | 592 ++++++++++++++++++--------------------
lib/igt_kms.h | 154 +++++-----
tests/kms_atomic_interruptible.c | 24 +-
tests/kms_atomic_transition.c | 123 ++++----
tests/kms_busy.c | 7 +-
tests/kms_concurrent.c | 4 +-
tests/kms_crtc_background_color.c | 2 +-
tests/kms_cursor_legacy.c | 8 +-
tests/kms_fbc_crc.c | 3 +-
tests/kms_panel_fitting.c | 16 +-
tests/kms_plane_lowres.c | 2 +-
tests/kms_plane_scaling.c | 14 +-
tests/kms_rmfb.c | 2 +-
tests/kms_rotation_crc.c | 37 +--
14 files changed, 468 insertions(+), 520 deletions(-)
--
2.14.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH i-g-t v4 1/7] tests: Stop looking at plane private members
2017-09-29 9:59 [PATCH i-g-t v4 0/7] lib/igt_kms: Convert properties to be more atomic-like Maarten Lankhorst
@ 2017-09-29 9:59 ` Maarten Lankhorst
2017-09-29 13:13 ` Mika Kahola
2017-09-29 9:59 ` [PATCH i-g-t v4 2/7] lib/igt_kms: Change output->pending_crtc_idx_mask to output->pending_pipe Maarten Lankhorst
` (10 subsequent siblings)
11 siblings, 1 reply; 25+ messages in thread
From: Maarten Lankhorst @ 2017-09-29 9:59 UTC (permalink / raw)
To: intel-gfx
Most of these tests have no reason to look at those members,
so try other ways of getting the information.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
lib/igt_kms.h | 21 ++++++++
tests/kms_atomic_transition.c | 117 +++++++++++++++++++++---------------------
tests/kms_busy.c | 5 +-
tests/kms_concurrent.c | 4 +-
tests/kms_cursor_legacy.c | 6 +--
tests/kms_fbc_crc.c | 3 +-
tests/kms_panel_fitting.c | 14 +----
tests/kms_plane_scaling.c | 14 +----
tests/kms_rmfb.c | 2 +-
tests/kms_rotation_crc.c | 10 ----
10 files changed, 93 insertions(+), 103 deletions(-)
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 3d1061fa08c8..62197dcfea7b 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -556,6 +556,27 @@ static inline bool igt_output_is_connected(igt_output_t *output)
igt_assert_lt(0, drmModeAtomicAddProperty(req, output->config.connector->connector_id,\
output->config.atomic_props_connector[prop], value))
+/*
+ * igt_pipe_refresh:
+ * @display: a pointer to an #igt_display_t structure
+ * @pipe: Pipe to refresh
+ * @force: Should be set to true if mode_blob is no longer considered
+ * to be valid, for example after doing an atomic commit during fork or closing display fd.
+ *
+ * Requests the pipe to be part of the state on next update.
+ * This is useful when state may have been out of sync after
+ * a fork, or we just want to be sure the pipe is included
+ * in the next commit.
+ */
+static inline void
+igt_pipe_refresh(igt_display_t *display, enum pipe pipe, bool force)
+{
+ if (force)
+ display->pipes[pipe].mode_blob = 0;
+
+ display->pipes[pipe].mode_changed = true;
+}
+
void igt_enable_connectors(void);
void igt_reset_connectors(void);
diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index e22763bdf94b..48823a09aed2 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -46,6 +46,11 @@ struct plane_parms {
#define hweight32 __builtin_popcount
+/* globals for fence support */
+int *timeline;
+pthread_t *thread;
+int *seqno;
+
static void
run_primary_test(igt_display_t *display, enum pipe pipe, igt_output_t *output)
{
@@ -89,9 +94,34 @@ run_primary_test(igt_display_t *display, enum pipe pipe, igt_output_t *output)
igt_remove_fb(display->drm_fd, &fb);
}
+static void *fence_inc_thread(void *arg)
+{
+ int t = *((int *) arg);
+
+ pthread_detach(pthread_self());
+
+ usleep(5000);
+ sw_sync_timeline_inc(t, 1);
+ return NULL;
+}
+
+static void configure_fencing(igt_plane_t *plane)
+{
+ int i, fd, ret;
+
+ i = plane->index;
+
+ seqno[i]++;
+ fd = sw_sync_timeline_create_fence(timeline[i], seqno[i]);
+ igt_plane_set_fence_fd(plane, fd);
+ close(fd);
+ ret = pthread_create(&thread[i], NULL, fence_inc_thread, &timeline[i]);
+ igt_assert_eq(ret, 0);
+}
+
static void
wm_setup_plane(igt_display_t *display, enum pipe pipe,
- uint32_t mask, struct plane_parms *parms)
+ uint32_t mask, struct plane_parms *parms, bool fencing)
{
igt_plane_t *plane;
@@ -108,6 +138,9 @@ wm_setup_plane(igt_display_t *display, enum pipe pipe,
continue;
}
+ if (fencing)
+ configure_fencing(plane);
+
igt_plane_set_fb(plane, parms[i].fb);
igt_fb_set_size(parms[i].fb, plane, parms[i].width, parms[i].height);
igt_plane_set_size(plane, parms[i].width, parms[i].height);
@@ -136,7 +169,7 @@ static bool skip_on_unsupported_nonblocking_modeset(igt_display_t *display)
/* Force the next state to update all crtc's, to synchronize with the nonblocking modeset. */
for_each_pipe(display, pipe)
- display->pipes[pipe].mode_changed = true;
+ igt_pipe_refresh(display, pipe, false);
return false;
}
@@ -183,6 +216,7 @@ static void set_sprite_wh(igt_display_t *display, enum pipe pipe,
static void setup_parms(igt_display_t *display, enum pipe pipe,
const drmModeModeInfo *mode,
+ struct igt_fb *primary_fb,
struct igt_fb *argb_fb,
struct igt_fb *sprite_fb,
struct plane_parms *parms)
@@ -205,7 +239,7 @@ static void setup_parms(igt_display_t *display, enum pipe pipe,
int i = plane->index;
if (plane->type == DRM_PLANE_TYPE_PRIMARY) {
- parms[i].fb = plane->fb;
+ parms[i].fb = primary_fb;
parms[i].width = mode->hdisplay;
parms[i].height = mode->vdisplay;
} else if (plane->type == DRM_PLANE_TYPE_CURSOR) {
@@ -242,7 +276,7 @@ retry:
set_sprite_wh(display, pipe, parms, sprite_fb,
alpha, sprite_width, sprite_height);
- wm_setup_plane(display, pipe, (1 << n_planes) - 1, parms);
+ wm_setup_plane(display, pipe, (1 << n_planes) - 1, parms, false);
ret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
if (ret == -EINVAL) {
@@ -300,10 +334,6 @@ retry:
sprite_width, sprite_height, alpha);
}
-int *timeline;
-pthread_t *thread;
-int *seqno;
-
static void prepare_fencing(igt_display_t *display, enum pipe pipe)
{
igt_plane_t *plane;
@@ -335,44 +365,10 @@ static void unprepare_fencing(igt_display_t *display, enum pipe pipe)
free(seqno);
}
-static void *fence_inc_thread(void *arg)
-{
- int t = *((int *) arg);
-
- pthread_detach(pthread_self());
-
- usleep(5000);
- sw_sync_timeline_inc(t, 1);
- return NULL;
-}
-
-static void configure_fencing(igt_display_t *display, enum pipe pipe)
-{
- igt_plane_t *plane;
- int i, fd, ret;
-
- for_each_plane_on_pipe(display, pipe, plane) {
-
- if (!plane->fb)
- continue;
-
- i = plane->index;
-
- seqno[i]++;
- fd = sw_sync_timeline_create_fence(timeline[i], seqno[i]);
- igt_plane_set_fence_fd(plane, fd);
- close(fd);
- ret = pthread_create(&thread[i], NULL, fence_inc_thread, &timeline[i]);
- igt_assert_eq(ret, 0);
- }
-}
-
static void atomic_commit(igt_display_t *display, enum pipe pipe, unsigned int flags, void *data, bool fencing)
{
- if (fencing) {
- configure_fencing(display, pipe);
+ if (fencing)
igt_pipe_request_out_fence(&display->pipes[pipe]);
- }
igt_display_commit_atomic(display, flags, data);
}
@@ -445,7 +441,7 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
igt_output_set_pipe(output, pipe);
- wm_setup_plane(display, pipe, 0, NULL);
+ wm_setup_plane(display, pipe, 0, NULL, false);
if (flags & DRM_MODE_ATOMIC_ALLOW_MODESET) {
skip_test = nonblocking && skip_on_unsupported_nonblocking_modeset(display);
@@ -461,7 +457,7 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
igt_display_commit2(display, COMMIT_ATOMIC);
- setup_parms(display, pipe, mode, &argb_fb, &sprite_fb, parms);
+ setup_parms(display, pipe, mode, &fb, &argb_fb, &sprite_fb, parms);
/*
* In some configurations the tests may not run to completion with all
@@ -469,7 +465,7 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
* planes to fix this
*/
while (1) {
- wm_setup_plane(display, pipe, iter_max - 1, parms);
+ wm_setup_plane(display, pipe, iter_max - 1, parms, false);
if (fencing)
igt_pipe_request_out_fence(pipe_obj);
@@ -504,7 +500,7 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
if (type == TRANSITION_AFTER_FREE) {
int fence_fd = -1;
- wm_setup_plane(display, pipe, 0, parms);
+ wm_setup_plane(display, pipe, 0, parms, fencing);
atomic_commit(display, pipe, flags, (void *)(unsigned long)0, fencing);
if (fencing) {
@@ -512,8 +508,9 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
pipe_obj->out_fence_fd = -1;
}
+ /* force planes to be part of commit */
for_each_plane_on_pipe(display, pipe, plane)
- plane->fb_changed = true;
+ igt_plane_set_position(plane, 0, 0);
igt_display_commit2(display, COMMIT_ATOMIC);
@@ -530,7 +527,7 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
for (i = 0; i < iter_max; i++) {
igt_output_set_pipe(output, pipe);
- wm_setup_plane(display, pipe, i, parms);
+ wm_setup_plane(display, pipe, i, parms, fencing);
atomic_commit(display, pipe, flags, (void *)(unsigned long)i, fencing);
wait_for_transition(display, pipe, nonblocking, fencing);
@@ -538,7 +535,7 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
if (type == TRANSITION_MODESET_DISABLE) {
igt_output_set_pipe(output, PIPE_NONE);
- wm_setup_plane(display, pipe, 0, parms);
+ wm_setup_plane(display, pipe, 0, parms, fencing);
atomic_commit(display, pipe, flags, (void *) 0UL, fencing);
wait_for_transition(display, pipe, nonblocking, fencing);
@@ -547,7 +544,7 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
/* i -> i+1 will be done when i increases, can be skipped here */
for (j = iter_max - 1; j > i + 1; j--) {
- wm_setup_plane(display, pipe, j, parms);
+ wm_setup_plane(display, pipe, j, parms, fencing);
if (type == TRANSITION_MODESET)
igt_output_override_mode(output, &override_mode);
@@ -555,7 +552,7 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
atomic_commit(display, pipe, flags, (void *)(unsigned long) j, fencing);
wait_for_transition(display, pipe, nonblocking, fencing);
- wm_setup_plane(display, pipe, i, parms);
+ wm_setup_plane(display, pipe, i, parms, fencing);
if (type == TRANSITION_MODESET)
igt_output_override_mode(output, NULL);
@@ -666,15 +663,19 @@ static unsigned set_combinations(igt_display_t *display, unsigned mask, struct i
return event_mask;
}
-static void refresh_primaries(igt_display_t *display)
+static void refresh_primaries(igt_display_t *display, int mask)
{
enum pipe pipe;
igt_plane_t *plane;
- for_each_pipe(display, pipe)
+ for_each_pipe(display, pipe) {
+ if (!((1 << pipe) & mask))
+ continue;
+
for_each_plane_on_pipe(display, pipe, plane)
- if (plane->type == DRM_PLANE_TYPE_PRIMARY && plane->fb)
- plane->fb_changed = true;
+ if (plane->type == DRM_PLANE_TYPE_PRIMARY)
+ igt_plane_set_position(plane, 0, 0);
+ }
}
static void collect_crcs_mask(igt_pipe_crc_t **pipe_crcs, unsigned mask, igt_crc_t *crcs)
@@ -783,7 +784,7 @@ static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblock
collect_crcs_mask(pipe_crcs, j, crcs[1]);
- refresh_primaries(display);
+ refresh_primaries(display, j);
commit_display(display, j, nonblocking);
collect_crcs_mask(pipe_crcs, j, crcs[2]);
@@ -794,7 +795,7 @@ static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblock
commit_display(display, event_mask, nonblocking);
collect_crcs_mask(pipe_crcs, i, crcs[3]);
- refresh_primaries(display);
+ refresh_primaries(display, i);
commit_display(display, i, nonblocking);
collect_crcs_mask(pipe_crcs, i, crcs[4]);
diff --git a/tests/kms_busy.c b/tests/kms_busy.c
index 7e31c2c82dc5..f430beaf7373 100644
--- a/tests/kms_busy.c
+++ b/tests/kms_busy.c
@@ -146,7 +146,10 @@ static void flip_to_fb(igt_display_t *dpy, int pipe,
if (modeset) {
igt_set_module_param_int("enable_hangcheck", 1);
- dpy->pipes[pipe].mode_blob = 0;
+
+ /* Clear old mode blob. */
+ igt_pipe_refresh(dpy, pipe, true);
+
igt_output_set_pipe(output, pipe);
igt_display_commit2(dpy, COMMIT_ATOMIC);
}
diff --git a/tests/kms_concurrent.c b/tests/kms_concurrent.c
index 5d1e0bc5ad19..7f44c596b4c4 100644
--- a/tests/kms_concurrent.c
+++ b/tests/kms_concurrent.c
@@ -91,7 +91,7 @@ static void test_fini(data_t *data, enum pipe pipe, int n_planes,
{
int i;
- data->display.pipes[pipe].mode_blob = 0;
+ igt_pipe_refresh(&data->display, pipe, true);
for (i = 0; i < n_planes; i++) {
igt_plane_t *plane = data->plane[i];
@@ -292,7 +292,7 @@ test_resolution_with_output(data_t *data, enum pipe pipe, igt_output_t *output)
i = 0;
while (i < iterations || loop_forever) {
- data->display.pipes[pipe].mode_blob = 0;
+ igt_pipe_refresh(&data->display, pipe, true);
mode_hi = igt_output_get_mode(output);
mode_lo = get_lowres_mode(data, mode_hi, output);
diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
index ba7c3f51ba21..65a001a9dec0 100644
--- a/tests/kms_cursor_legacy.c
+++ b/tests/kms_cursor_legacy.c
@@ -784,7 +784,7 @@ static bool skip_on_unsupported_nonblocking_modeset(igt_display_t *display)
/* Force the next state to update all crtc's, to synchronize with the nonblocking modeset. */
for_each_pipe(display, pipe)
- display->pipes[pipe].mode_changed = true;
+ igt_pipe_refresh(display, pipe, false);
return false;
}
@@ -971,8 +971,8 @@ static void two_screens_flip_vs_cursor(igt_display_t *display, int nloops, bool
if (modeset) {
/* wait for pending modeset and page flip to complete, to prevent -EBUSY */
- display->pipes[pipe].mode_changed = true;
- display->pipes[pipe2].mode_changed = true;
+ igt_pipe_refresh(display, pipe, false);
+ igt_pipe_refresh(display, pipe2, false);
igt_display_commit2(display, COMMIT_ATOMIC);
}
}
diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c
index 08abb8b4b95e..06234566c232 100644
--- a/tests/kms_fbc_crc.c
+++ b/tests/kms_fbc_crc.c
@@ -461,8 +461,7 @@ static void reset_display(data_t *data)
igt_pipe_t *pipe = &display->pipes[pipe_id];
igt_plane_t *plane = igt_pipe_get_plane_type(pipe, DRM_PLANE_TYPE_PRIMARY);
- if (plane->fb)
- igt_plane_set_fb(plane, NULL);
+ igt_plane_set_fb(plane, NULL);
}
for_each_connected_output(display, data->output)
diff --git a/tests/kms_panel_fitting.c b/tests/kms_panel_fitting.c
index 5266862a70cf..85a231e60ea2 100644
--- a/tests/kms_panel_fitting.c
+++ b/tests/kms_panel_fitting.c
@@ -84,19 +84,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
}
igt_plane_set_fb(plane, &data->fb1);
- if (s == COMMIT_LEGACY) {
- int ret;
- ret = drmModeSetCrtc(data->drm_fd,
- plane->pipe->crtc_id,
- data->fb_id1,
- plane->src_x, plane->src_y,
- &output->id,
- 1,
- mode);
- igt_assert_eq(ret, 0);
- } else {
- igt_display_commit2(display, s);
- }
+ igt_display_commit2(display, s);
}
static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 1457894aaa10..5ed69f35f267 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -93,19 +93,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
}
igt_plane_set_fb(plane, &data->fb1);
- if (s == COMMIT_LEGACY) {
- int ret;
- ret = drmModeSetCrtc(data->drm_fd,
- plane->pipe->crtc_id,
- data->fb_id1,
- plane->src_x, plane->src_y,
- &output->id,
- 1,
- mode);
- igt_assert_eq(ret, 0);
- } else {
- igt_display_commit2(display, s);
- }
+ igt_display_commit2(display, s);
}
static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
diff --git a/tests/kms_rmfb.c b/tests/kms_rmfb.c
index 9f1f564e54aa..c97adceea761 100644
--- a/tests/kms_rmfb.c
+++ b/tests/kms_rmfb.c
@@ -102,7 +102,7 @@ test_rmfb(struct rmfb_data *data, igt_output_t *output, enum pipe pipe, bool reo
drmSetClientCap(data->drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
drmSetClientCap(data->drm_fd, DRM_CLIENT_CAP_ATOMIC, 1);
- data->display.pipes[pipe].mode_blob = 0;
+ igt_pipe_refresh(&data->display, pipe, true);
} else {
igt_remove_fb(data->drm_fd, &fb);
igt_remove_fb(data->drm_fd, &argb_fb);
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 21e264addc09..4d2ef1c184f0 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -465,12 +465,6 @@ static void test_plane_rotation_ytiled_obj(data_t *data,
igt_plane_set_fb(plane, &data->fb);
igt_plane_set_size(plane, h, w);
- if (commit < COMMIT_ATOMIC)
- drmModeObjectSetProperty(fd, plane->drm_plane->plane_id,
- DRM_MODE_OBJECT_PLANE,
- plane->rotation_property,
- plane->rotation);
-
ret = igt_display_try_commit2(display, commit);
igt_output_set_pipe(output, PIPE_NONE);
@@ -562,10 +556,6 @@ static void test_plane_rotation_exhaust_fences(data_t *data,
igt_plane_set_rotation(plane, IGT_ROTATION_90);
igt_plane_set_size(plane, h, w);
- drmModeObjectSetProperty(fd, plane->drm_plane->plane_id,
- DRM_MODE_OBJECT_PLANE,
- plane->rotation_property,
- plane->rotation);
igt_display_commit2(display, commit);
if (ret) {
igt_warn("failed to commit hardware rotated fb: %i\n", ret);
--
2.14.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH i-g-t v4 2/7] lib/igt_kms: Change output->pending_crtc_idx_mask to output->pending_pipe
2017-09-29 9:59 [PATCH i-g-t v4 0/7] lib/igt_kms: Convert properties to be more atomic-like Maarten Lankhorst
2017-09-29 9:59 ` [PATCH i-g-t v4 1/7] tests: Stop looking at plane private members Maarten Lankhorst
@ 2017-09-29 9:59 ` Maarten Lankhorst
2017-10-02 10:19 ` Mika Kahola
2017-09-29 9:59 ` [PATCH i-g-t v4 3/7] lib/igt_kms: Commit primary plane when a modeset is forced on a pipe Maarten Lankhorst
` (9 subsequent siblings)
11 siblings, 1 reply; 25+ messages in thread
From: Maarten Lankhorst @ 2017-09-29 9:59 UTC (permalink / raw)
To: intel-gfx
igt_output_set_pipe with PIPE_ANY used to mean that we bind the output
to any pipe, but this is now a deprecated alias for PIPE_NONE, and
means the output will be unbound.
Because of this it's better to change output->pending_crtc_idx_mask to
an enum pipe, because only a single choice may be given for a pipe.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
lib/igt_kms.c | 46 ++++++++++++++++++++-----------------------
lib/igt_kms.h | 2 +-
tests/kms_atomic_transition.c | 4 ++--
tests/kms_busy.c | 2 +-
tests/kms_cursor_legacy.c | 2 +-
5 files changed, 26 insertions(+), 30 deletions(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 7bcafc072f70..a5db6bc493c2 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1561,9 +1561,10 @@ static void igt_display_log_shift(igt_display_t *display, int shift)
static void igt_output_refresh(igt_output_t *output)
{
igt_display_t *display = output->display;
- unsigned long crtc_idx_mask;
+ unsigned long crtc_idx_mask = 0;
- crtc_idx_mask = output->pending_crtc_idx_mask;
+ if (output->pending_pipe != PIPE_NONE)
+ crtc_idx_mask = 1 << output->pending_pipe;
kmstest_free_connector_config(&output->config);
@@ -1587,11 +1588,8 @@ static void igt_output_refresh(igt_output_t *output)
BROADCAST_RGB_FULL);
}
- if (output->config.pipe == PIPE_NONE)
- return;
-
LOG(display, "%s: Selecting pipe %s\n", output->name,
- kmstest_pipe_name(output->config.pipe));
+ kmstest_pipe_name(output->pending_pipe));
}
static bool
@@ -1830,7 +1828,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)
* a pipe is set with igt_output_set_pipe().
*/
output->force_reprobe = true;
- output->pending_crtc_idx_mask = 0;
+ output->pending_pipe = PIPE_NONE;
output->id = resources->connectors[i];
output->display = display;
@@ -1960,10 +1958,12 @@ static void igt_display_refresh(igt_display_t *display)
for (i = 0; i < display->n_outputs; i++) {
output = &display->outputs[i];
- if (pipes_in_use & output->pending_crtc_idx_mask)
- goto report_dup;
+ if (output->pending_pipe != PIPE_NONE) {
+ if (pipes_in_use & (1 << output->pending_pipe))
+ goto report_dup;
- pipes_in_use |= output->pending_crtc_idx_mask;
+ pipes_in_use |= 1 << output->pending_pipe;
+ }
if (output->force_reprobe)
igt_output_refresh(output);
@@ -1975,11 +1975,11 @@ report_dup:
for (; i > 0; i--) {
igt_output_t *b = &display->outputs[i - 1];
- igt_assert_f(output->pending_crtc_idx_mask !=
- b->pending_crtc_idx_mask,
+ igt_assert_f(output->pending_pipe !=
+ b->pending_pipe,
"%s and %s are both trying to use pipe %s\n",
igt_output_name(output), igt_output_name(b),
- kmstest_pipe_name(ffs(b->pending_crtc_idx_mask) - 1));
+ kmstest_pipe_name(output->pending_pipe));
}
}
@@ -1988,7 +1988,7 @@ static igt_pipe_t *igt_output_get_driving_pipe(igt_output_t *output)
igt_display_t *display = output->display;
enum pipe pipe;
- if (!output->pending_crtc_idx_mask) {
+ if (output->pending_pipe == PIPE_NONE) {
/*
* The user hasn't specified a pipe to use, return none.
*/
@@ -1998,7 +1998,7 @@ static igt_pipe_t *igt_output_get_driving_pipe(igt_output_t *output)
* Otherwise, return the pending pipe (ie the pipe that should
* drive this output after the commit()
*/
- pipe = ffs(output->pending_crtc_idx_mask) - 1;
+ pipe = output->pending_pipe;
}
igt_assert(pipe >= 0 && pipe < display->n_pipes);
@@ -2051,7 +2051,7 @@ static igt_output_t *igt_pipe_get_output(igt_pipe_t *pipe)
for (i = 0; i < display->n_outputs; i++) {
igt_output_t *output = &display->outputs[i];
- if (output->pending_crtc_idx_mask == (1 << pipe->pipe))
+ if (output->pending_pipe == pipe->pipe)
return output;
}
@@ -2860,22 +2860,18 @@ void igt_output_set_pipe(igt_output_t *output, enum pipe pipe)
igt_assert(output->name);
- if (output->pending_crtc_idx_mask) {
+ if (output->pending_pipe != PIPE_NONE) {
old_pipe = igt_output_get_driving_pipe(output);
old_pipe->mode_changed = true;
}
- if (pipe == PIPE_NONE) {
- LOG(display, "%s: set_pipe(any)\n", igt_output_name(output));
- output->pending_crtc_idx_mask = 0;
- } else {
- LOG(display, "%s: set_pipe(%s)\n", igt_output_name(output),
- kmstest_pipe_name(pipe));
- output->pending_crtc_idx_mask = 1 << pipe;
+ LOG(display, "%s: set_pipe(%s)\n", igt_output_name(output),
+ kmstest_pipe_name(pipe));
+ output->pending_pipe = pipe;
+ if (pipe != PIPE_NONE)
display->pipes[pipe].mode_changed = true;
- }
output->config.pipe_changed = true;
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 62197dcfea7b..8dc118c961b7 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -361,7 +361,7 @@ typedef struct {
struct kmstest_connector_config config;
char *name;
bool force_reprobe;
- unsigned long pending_crtc_idx_mask;
+ enum pipe pending_pipe;
bool use_override_mode;
drmModeModeInfo override_mode;
} igt_output_t;
diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 48823a09aed2..2ae75f2d6630 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -644,7 +644,7 @@ static unsigned set_combinations(igt_display_t *display, unsigned mask, struct i
event_mask |= 1 << pipe;
for_each_valid_output_on_pipe(display, pipe, output) {
- if (output->pending_crtc_idx_mask)
+ if (output->pending_pipe != PIPE_NONE)
continue;
mode = igt_output_get_mode(output);
@@ -726,7 +726,7 @@ static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblock
pipe_crcs[i] = igt_pipe_crc_new(display->drm_fd, i, INTEL_PIPE_CRC_SOURCE_AUTO);
for_each_valid_output_on_pipe(display, i, output) {
- if (output->pending_crtc_idx_mask)
+ if (output->pending_pipe != PIPE_NONE)
continue;
igt_output_set_pipe(output, i);
diff --git a/tests/kms_busy.c b/tests/kms_busy.c
index f430beaf7373..0828a8b38a06 100644
--- a/tests/kms_busy.c
+++ b/tests/kms_busy.c
@@ -41,7 +41,7 @@ set_fb_on_crtc(igt_display_t *dpy, int pipe, struct igt_fb *fb)
drmModeModeInfoPtr mode;
igt_plane_t *primary;
- if (output->pending_crtc_idx_mask)
+ if (output->pending_pipe != PIPE_NONE)
continue;
igt_output_set_pipe(output, pipe);
diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
index 65a001a9dec0..fc7526833673 100644
--- a/tests/kms_cursor_legacy.c
+++ b/tests/kms_cursor_legacy.c
@@ -155,7 +155,7 @@ static igt_output_t *set_fb_on_crtc(igt_display_t *display, enum pipe pipe, stru
drmModeModeInfoPtr mode;
igt_plane_t *primary;
- if (output->pending_crtc_idx_mask)
+ if (output->pending_pipe != PIPE_NONE)
continue;
igt_output_set_pipe(output, pipe);
--
2.14.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH i-g-t v4 3/7] lib/igt_kms: Commit primary plane when a modeset is forced on a pipe
2017-09-29 9:59 [PATCH i-g-t v4 0/7] lib/igt_kms: Convert properties to be more atomic-like Maarten Lankhorst
2017-09-29 9:59 ` [PATCH i-g-t v4 1/7] tests: Stop looking at plane private members Maarten Lankhorst
2017-09-29 9:59 ` [PATCH i-g-t v4 2/7] lib/igt_kms: Change output->pending_crtc_idx_mask to output->pending_pipe Maarten Lankhorst
@ 2017-09-29 9:59 ` Maarten Lankhorst
2017-10-02 11:02 ` Mika Kahola
2017-09-29 9:59 ` [PATCH i-g-t v4 4/7] lib/igt_kms: Rework connector properties to be more atomic, v2 Maarten Lankhorst
` (8 subsequent siblings)
11 siblings, 1 reply; 25+ messages in thread
From: Maarten Lankhorst @ 2017-09-29 9:59 UTC (permalink / raw)
To: intel-gfx
In between tests, some tests can do the following sequence:
(pipe C configured with FB)
igt_plane_set_fb(primary (pipe C), NULL);
/* Clear rotation property first */
igt_display_commit2(display, COMMIT_UNIVERSAL);
/* disable pipe */
igt_display_commit2(display, COMMIT_LEGACY);
This would result in PIPE_C not being properly disabled, which
will cause an error on the next mode. This can be seen when running
the full kms_rotation_crc testcase without --subtest, it will fail
on exhaust-fences because the bad-tiling subtest wasn't able to
disable pipe C correctly.
Testcase: kms_rotation_crc
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
lib/igt_kms.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index a5db6bc493c2..d25090b05c70 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -2332,7 +2332,7 @@ static int igt_primary_plane_commit_legacy(igt_plane_t *primary,
igt_assert(!primary->rotation_changed);
if (!primary->fb_changed && !primary->position_changed &&
- !primary->size_changed)
+ !primary->size_changed && !primary->pipe->mode_changed)
return 0;
crtc_id = pipe->crtc_id;
--
2.14.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH i-g-t v4 4/7] lib/igt_kms: Rework connector properties to be more atomic, v2.
2017-09-29 9:59 [PATCH i-g-t v4 0/7] lib/igt_kms: Convert properties to be more atomic-like Maarten Lankhorst
` (2 preceding siblings ...)
2017-09-29 9:59 ` [PATCH i-g-t v4 3/7] lib/igt_kms: Commit primary plane when a modeset is forced on a pipe Maarten Lankhorst
@ 2017-09-29 9:59 ` Maarten Lankhorst
2017-10-02 12:22 ` Mika Kahola
2017-09-29 9:59 ` [PATCH i-g-t v4 5/7] lib/igt_kms: Rework plane properties to be more atomic, v4 Maarten Lankhorst
` (7 subsequent siblings)
11 siblings, 1 reply; 25+ messages in thread
From: Maarten Lankhorst @ 2017-09-29 9:59 UTC (permalink / raw)
To: intel-gfx
In the future I want to allow tests to commit more properties,
but for this to work I have to fix all properties to work better
with atomic commit. Instead of special casing each
property make a bitmask for all property changed flags, and try to
commit all properties.
Changs since v1:
- Mention which properties we set to what.
- Assert the property to be set is valid.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
lib/igt_kms.c | 44 +++++++++++++++++++---------------------
lib/igt_kms.h | 35 +++++++++++++++++++-------------
tests/kms_atomic_interruptible.c | 4 ++--
tests/kms_panel_fitting.c | 2 +-
4 files changed, 45 insertions(+), 40 deletions(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index d25090b05c70..07d2074c2b1a 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -248,7 +248,7 @@ igt_atomic_fill_connector_props(igt_display_t *display, igt_output_t *output,
if (strcmp(prop->name, conn_prop_names[j]) != 0)
continue;
- output->config.atomic_props_connector[j] = props->props[i];
+ output->props[j] = props->props[i];
break;
}
@@ -1834,7 +1834,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)
igt_output_refresh(output);
- output->config.pipe_changed = true;
+ igt_output_set_prop_changed(output, IGT_CONNECTOR_CRTC_ID);
}
drmModeFreePlaneResources(plane_resources);
@@ -2514,23 +2514,24 @@ static void igt_atomic_prepare_crtc_commit(igt_pipe_t *pipe_obj, drmModeAtomicRe
static void igt_atomic_prepare_connector_commit(igt_output_t *output, drmModeAtomicReq *req)
{
- struct kmstest_connector_config *config = &output->config;
+ int i;
- if (config->connector_scaling_mode_changed)
- igt_atomic_populate_connector_req(req, output, IGT_CONNECTOR_SCALING_MODE, config->connector_scaling_mode);
+ for (i = 0; i < IGT_NUM_CONNECTOR_PROPS; i++) {
+ if (!igt_output_is_prop_changed(output, i))
+ continue;
- if (config->pipe_changed) {
- uint32_t crtc_id = 0;
+ /* it's an error to try an unsupported feature */
+ igt_assert(output->props[i]);
- if (output->config.pipe != PIPE_NONE)
- crtc_id = output->config.crtc->crtc_id;
+ igt_debug("%s: Setting property \"%s\" to 0x%"PRIx64"/%"PRIi64"\n",
+ igt_output_name(output), igt_connector_prop_names[i],
+ output->values[i], output->values[i]);
- igt_atomic_populate_connector_req(req, output, IGT_CONNECTOR_CRTC_ID, crtc_id);
+ igt_assert_lt(0, drmModeAtomicAddProperty(req,
+ output->config.connector->connector_id,
+ output->props[i],
+ output->values[i]));
}
- /*
- * TODO: Add all other connector level properties here
- */
-
}
/*
@@ -2625,11 +2626,10 @@ display_commit_changed(igt_display_t *display, enum igt_commit_style s)
for (i = 0; i < display->n_outputs; i++) {
igt_output_t *output = &display->outputs[i];
- if (s != COMMIT_UNIVERSAL)
- output->config.pipe_changed = false;
-
if (s == COMMIT_ATOMIC)
- output->config.connector_scaling_mode_changed = false;
+ output->changed = 0;
+ else if (s != COMMIT_UNIVERSAL)
+ igt_output_clear_prop_changed(output, IGT_CONNECTOR_CRTC_ID);
}
}
@@ -2873,18 +2873,16 @@ void igt_output_set_pipe(igt_output_t *output, enum pipe pipe)
if (pipe != PIPE_NONE)
display->pipes[pipe].mode_changed = true;
- output->config.pipe_changed = true;
+ igt_output_set_prop_value(output, IGT_CONNECTOR_CRTC_ID, pipe == PIPE_NONE ? 0 : display->pipes[pipe].crtc_id);
igt_output_refresh(output);
}
void igt_output_set_scaling_mode(igt_output_t *output, uint64_t scaling_mode)
{
- output->config.connector_scaling_mode_changed = true;
-
- output->config.connector_scaling_mode = scaling_mode;
+ igt_output_set_prop_value(output, IGT_CONNECTOR_SCALING_MODE, scaling_mode);
- igt_require(output->config.atomic_props_connector[IGT_CONNECTOR_SCALING_MODE]);
+ igt_require(output->props[IGT_CONNECTOR_SCALING_MODE]);
}
igt_plane_t *igt_output_get_plane(igt_output_t *output, int plane_idx)
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 8dc118c961b7..1ef10e7d525c 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -131,10 +131,7 @@ struct kmstest_connector_config {
drmModeConnector *connector;
drmModeEncoder *encoder;
drmModeModeInfo default_mode;
- uint64_t connector_scaling_mode;
- bool connector_scaling_mode_changed;
- bool pipe_changed;
- uint32_t atomic_props_connector[IGT_NUM_CONNECTOR_PROPS];
+
int pipe;
unsigned valid_crtc_idx_mask;
};
@@ -364,6 +361,12 @@ typedef struct {
enum pipe pending_pipe;
bool use_override_mode;
drmModeModeInfo override_mode;
+
+ /* bitmask of changed properties */
+ uint64_t changed;
+
+ uint32_t props[IGT_NUM_CONNECTOR_PROPS];
+ uint64_t values[IGT_NUM_CONNECTOR_PROPS];
} igt_output_t;
struct igt_display {
@@ -545,16 +548,20 @@ static inline bool igt_output_is_connected(igt_output_t *output)
#define igt_atomic_populate_crtc_req(req, pipe, prop, value) \
igt_assert_lt(0, drmModeAtomicAddProperty(req, pipe->crtc_id,\
pipe->atomic_props_crtc[prop], value))
-/**
- * igt_atomic_populate_connector_req:
- * @req: A pointer to drmModeAtomicReq
- * @output: A pointer igt_output_t
- * @prop: one of igt_atomic_connector_properties
- * @value: the value to add
- */
-#define igt_atomic_populate_connector_req(req, output, prop, value) \
- igt_assert_lt(0, drmModeAtomicAddProperty(req, output->config.connector->connector_id,\
- output->config.atomic_props_connector[prop], value))
+
+#define igt_output_is_prop_changed(output, prop) \
+ (!!((output)->changed & (1 << (prop))))
+#define igt_output_set_prop_changed(output, prop) \
+ (output)->changed |= 1 << (prop)
+
+#define igt_output_clear_prop_changed(output, prop) \
+ (output)->changed &= ~(1 << (prop))
+
+#define igt_output_set_prop_value(output, prop, value) \
+ do { \
+ (output)->values[prop] = (value); \
+ igt_output_set_prop_changed(output, prop); \
+ } while (0)
/*
* igt_pipe_refresh:
diff --git a/tests/kms_atomic_interruptible.c b/tests/kms_atomic_interruptible.c
index 4e06ee4e2d6b..2d19fe967809 100644
--- a/tests/kms_atomic_interruptible.c
+++ b/tests/kms_atomic_interruptible.c
@@ -159,7 +159,7 @@ static void run_plane_test(igt_display_t *display, enum pipe pipe, igt_output_t
plane->pipe->atomic_props_crtc[IGT_CRTC_MODE_ID],
plane->pipe->atomic_props_crtc[IGT_CRTC_ACTIVE],
/* connector: 1 prop */
- output->config.atomic_props_connector[IGT_CONNECTOR_CRTC_ID],
+ output->props[IGT_CONNECTOR_CRTC_ID],
/* plane: remainder props */
plane->atomic_props_plane[IGT_PLANE_CRTC_ID],
plane->atomic_props_plane[IGT_PLANE_FB_ID],
@@ -204,7 +204,7 @@ static void run_plane_test(igt_display_t *display, enum pipe pipe, igt_output_t
case test_legacy_dpms: {
struct drm_mode_connector_set_property prop = {
.value = DRM_MODE_DPMS_OFF,
- .prop_id = output->config.atomic_props_connector[IGT_CONNECTOR_DPMS],
+ .prop_id = output->props[IGT_CONNECTOR_DPMS],
.connector_id = output->id,
};
diff --git a/tests/kms_panel_fitting.c b/tests/kms_panel_fitting.c
index 85a231e60ea2..e4ea355611c3 100644
--- a/tests/kms_panel_fitting.c
+++ b/tests/kms_panel_fitting.c
@@ -275,7 +275,7 @@ static void test_atomic_fastset(igt_display_t *display)
igt_require(intel_gen(intel_get_drm_devid(display->drm_fd)) >= 5);
for_each_pipe_with_valid_output(display, pipe, output) {
- if (!output->config.atomic_props_connector[IGT_CONNECTOR_SCALING_MODE])
+ if (!output->props[IGT_CONNECTOR_SCALING_MODE])
continue;
test_panel_fitting_fastset(display, pipe, output);
--
2.14.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH i-g-t v4 5/7] lib/igt_kms: Rework plane properties to be more atomic, v4.
2017-09-29 9:59 [PATCH i-g-t v4 0/7] lib/igt_kms: Convert properties to be more atomic-like Maarten Lankhorst
` (3 preceding siblings ...)
2017-09-29 9:59 ` [PATCH i-g-t v4 4/7] lib/igt_kms: Rework connector properties to be more atomic, v2 Maarten Lankhorst
@ 2017-09-29 9:59 ` Maarten Lankhorst
2017-10-03 12:05 ` Mika Kahola
2017-09-29 9:59 ` [PATCH i-g-t v4 6/7] lib/igt_kms: Rework pipe properties to be more atomic, v4.1 Maarten Lankhorst
` (6 subsequent siblings)
11 siblings, 1 reply; 25+ messages in thread
From: Maarten Lankhorst @ 2017-09-29 9:59 UTC (permalink / raw)
To: intel-gfx
In the future I want to allow tests to commit more properties,
but for this to work I have to fix all properties to work better
with atomic commit. Instead of special casing each
property make a bitmask for all property changed flags, and try to
commit all properties.
Changes since v1:
- Remove special dumping of src and crtc coordinates.
- Dump all modified coordinates.
Changes since v2:
- Move igt_plane_set_prop_changed up slightly.
Changes since v3:
- Fix wrong ordering of set_position in kms_plane_lowres causing a test failure.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
lib/igt_kms.c | 293 +++++++++++++++++----------------------
lib/igt_kms.h | 59 ++++----
tests/kms_atomic_interruptible.c | 12 +-
tests/kms_plane_lowres.c | 2 +-
tests/kms_rotation_crc.c | 4 +-
5 files changed, 160 insertions(+), 210 deletions(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 07d2074c2b1a..6e0052ebe7a7 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -192,11 +192,11 @@ const char *igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = {
/*
* Retrieve all the properies specified in props_name and store them into
- * plane->atomic_props_plane.
+ * plane->props.
*/
static void
-igt_atomic_fill_plane_props(igt_display_t *display, igt_plane_t *plane,
- int num_props, const char **prop_names)
+igt_fill_plane_props(igt_display_t *display, igt_plane_t *plane,
+ int num_props, const char **prop_names)
{
drmModeObjectPropertiesPtr props;
int i, j, fd;
@@ -214,7 +214,7 @@ igt_atomic_fill_plane_props(igt_display_t *display, igt_plane_t *plane,
if (strcmp(prop->name, prop_names[j]) != 0)
continue;
- plane->atomic_props_plane[j] = props->props[i];
+ plane->props[j] = props->props[i];
break;
}
@@ -1659,7 +1659,6 @@ void igt_display_init(igt_display_t *display, int drm_fd)
drmModeRes *resources;
drmModePlaneRes *plane_resources;
int i;
- int is_atomic = 0;
memset(display, 0, sizeof(igt_display_t));
@@ -1679,7 +1678,9 @@ void igt_display_init(igt_display_t *display, int drm_fd)
igt_assert_f(display->pipes, "Failed to allocate memory for %d pipes\n", display->n_pipes);
drmSetClientCap(drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
- is_atomic = drmSetClientCap(drm_fd, DRM_CLIENT_CAP_ATOMIC, 1);
+ if (drmSetClientCap(drm_fd, DRM_CLIENT_CAP_ATOMIC, 1) == 0)
+ display->is_atomic = 1;
+
plane_resources = drmModeGetPlaneResources(display->drm_fd);
igt_assert(plane_resources);
@@ -1776,19 +1777,19 @@ void igt_display_init(igt_display_t *display, int drm_fd)
plane->type = type;
plane->pipe = pipe;
plane->drm_plane = drm_plane;
- plane->fence_fd = -1;
+ plane->values[IGT_PLANE_IN_FENCE_FD] = ~0ULL;
- if (is_atomic == 0) {
- display->is_atomic = 1;
- igt_atomic_fill_plane_props(display, plane, IGT_NUM_PLANE_PROPS, igt_plane_prop_names);
- }
+ igt_fill_plane_props(display, plane, IGT_NUM_PLANE_PROPS, igt_plane_prop_names);
get_plane_property(display->drm_fd, drm_plane->plane_id,
"rotation",
- &plane->rotation_property,
- &prop_value,
+ &plane->props[IGT_PLANE_ROTATION],
+ &plane->values[IGT_PLANE_ROTATION],
NULL);
- plane->rotation = (igt_rotation_t)prop_value;
+
+ /* Clear any residual framebuffer on first commit. */
+ igt_plane_set_prop_changed(plane, IGT_PLANE_FB_ID);
+ igt_plane_set_prop_changed(plane, IGT_PLANE_CRTC_ID);
}
/*
@@ -1805,9 +1806,6 @@ void igt_display_init(igt_display_t *display, int drm_fd)
pipe->n_planes = n_planes;
- for_each_plane_on_pipe(display, i, plane)
- plane->fb_changed = true;
-
pipe->mode_changed = true;
}
@@ -2070,18 +2068,7 @@ bool igt_pipe_get_property(igt_pipe_t *pipe, const char *name,
static uint32_t igt_plane_get_fb_id(igt_plane_t *plane)
{
- if (plane->fb)
- return plane->fb->fb_id;
- else
- return 0;
-}
-
-static uint32_t igt_plane_get_fb_gem_handle(igt_plane_t *plane)
-{
- if (plane->fb)
- return plane->fb->gem_handle;
- else
- return 0;
+ return plane->values[IGT_PLANE_FB_ID];
}
#define CHECK_RETURN(r, fail) { \
@@ -2090,9 +2077,6 @@ static uint32_t igt_plane_get_fb_gem_handle(igt_plane_t *plane)
igt_assert_eq(r, 0); \
}
-
-
-
/*
* Add position and fb changes of a plane to the atomic property set
*/
@@ -2101,63 +2085,31 @@ igt_atomic_prepare_plane_commit(igt_plane_t *plane, igt_pipe_t *pipe,
drmModeAtomicReq *req)
{
igt_display_t *display = pipe->display;
- uint32_t fb_id, crtc_id;
+ int i;
igt_assert(plane->drm_plane);
- /* it's an error to try an unsupported feature */
- igt_assert(igt_plane_supports_rotation(plane) ||
- !plane->rotation_changed);
-
- fb_id = igt_plane_get_fb_id(plane);
- crtc_id = pipe->crtc_id;
-
LOG(display,
"populating plane data: %s.%d, fb %u\n",
kmstest_pipe_name(pipe->pipe),
plane->index,
- fb_id);
-
- if (plane->fence_fd >= 0) {
- uint64_t fence_fd = (int64_t) plane->fence_fd;
- igt_atomic_populate_plane_req(req, plane, IGT_PLANE_IN_FENCE_FD, fence_fd);
- }
+ igt_plane_get_fb_id(plane));
- if (plane->fb_changed) {
- igt_atomic_populate_plane_req(req, plane, IGT_PLANE_CRTC_ID, fb_id ? crtc_id : 0);
- igt_atomic_populate_plane_req(req, plane, IGT_PLANE_FB_ID, fb_id);
- }
-
- if (plane->position_changed || plane->size_changed) {
- uint32_t src_x = IGT_FIXED(plane->src_x, 0); /* src_x */
- uint32_t src_y = IGT_FIXED(plane->src_y, 0); /* src_y */
- uint32_t src_w = IGT_FIXED(plane->src_w, 0); /* src_w */
- uint32_t src_h = IGT_FIXED(plane->src_h, 0); /* src_h */
- int32_t crtc_x = plane->crtc_x;
- int32_t crtc_y = plane->crtc_y;
- uint32_t crtc_w = plane->crtc_w;
- uint32_t crtc_h = plane->crtc_h;
+ for (i = 0; i < IGT_NUM_PLANE_PROPS; i++) {
+ if (!igt_plane_is_prop_changed(plane, i))
+ continue;
- LOG(display,
- "src = (%d, %d) %u x %u "
- "dst = (%d, %d) %u x %u\n",
- src_x >> 16, src_y >> 16, src_w >> 16, src_h >> 16,
- crtc_x, crtc_y, crtc_w, crtc_h);
+ /* it's an error to try an unsupported feature */
+ igt_assert(plane->props[i]);
- igt_atomic_populate_plane_req(req, plane, IGT_PLANE_SRC_X, src_x);
- igt_atomic_populate_plane_req(req, plane, IGT_PLANE_SRC_Y, src_y);
- igt_atomic_populate_plane_req(req, plane, IGT_PLANE_SRC_W, src_w);
- igt_atomic_populate_plane_req(req, plane, IGT_PLANE_SRC_H, src_h);
+ igt_debug("plane %s.%d: Setting property \"%s\" to 0x%"PRIx64"/%"PRIi64"\n",
+ kmstest_pipe_name(pipe->pipe), plane->index, igt_plane_prop_names[i],
+ plane->values[i], plane->values[i]);
- igt_atomic_populate_plane_req(req, plane, IGT_PLANE_CRTC_X, crtc_x);
- igt_atomic_populate_plane_req(req, plane, IGT_PLANE_CRTC_Y, crtc_y);
- igt_atomic_populate_plane_req(req, plane, IGT_PLANE_CRTC_W, crtc_w);
- igt_atomic_populate_plane_req(req, plane, IGT_PLANE_CRTC_H, crtc_h);
+ igt_assert_lt(0, drmModeAtomicAddProperty(req, plane->drm_plane->plane_id,
+ plane->props[i],
+ plane->values[i]));
}
-
- if (plane->rotation_changed)
- igt_atomic_populate_plane_req(req, plane,
- IGT_PLANE_ROTATION, plane->rotation);
}
@@ -2183,17 +2135,20 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
int32_t crtc_y;
uint32_t crtc_w;
uint32_t crtc_h;
+ bool setplane =
+ igt_plane_is_prop_changed(plane, IGT_PLANE_FB_ID) ||
+ plane->changed & IGT_PLANE_COORD_CHANGED_MASK;
igt_assert(plane->drm_plane);
/* it's an error to try an unsupported feature */
igt_assert(igt_plane_supports_rotation(plane) ||
- !plane->rotation_changed);
+ !igt_plane_is_prop_changed(plane, IGT_PLANE_ROTATION));
fb_id = igt_plane_get_fb_id(plane);
crtc_id = pipe->crtc_id;
- if ((plane->fb_changed || plane->size_changed) && fb_id == 0) {
+ if (setplane && fb_id == 0) {
LOG(display,
"SetPlane pipe %s, plane %d, disabling\n",
kmstest_pipe_name(pipe->pipe),
@@ -2212,16 +2167,15 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
IGT_FIXED(0,0) /* src_h */);
CHECK_RETURN(ret, fail_on_error);
- } else if (plane->fb_changed || plane->position_changed ||
- plane->size_changed) {
- src_x = IGT_FIXED(plane->src_x,0); /* src_x */
- src_y = IGT_FIXED(plane->src_y,0); /* src_y */
- src_w = IGT_FIXED(plane->src_w,0); /* src_w */
- src_h = IGT_FIXED(plane->src_h,0); /* src_h */
- crtc_x = plane->crtc_x;
- crtc_y = plane->crtc_y;
- crtc_w = plane->crtc_w;
- crtc_h = plane->crtc_h;
+ } else if (setplane) {
+ src_x = plane->values[IGT_PLANE_SRC_X];
+ src_y = plane->values[IGT_PLANE_SRC_Y];
+ src_w = plane->values[IGT_PLANE_SRC_W];
+ src_h = plane->values[IGT_PLANE_SRC_H];
+ crtc_x = plane->values[IGT_PLANE_CRTC_X];
+ crtc_y = plane->values[IGT_PLANE_CRTC_Y];
+ crtc_w = plane->values[IGT_PLANE_CRTC_W];
+ crtc_h = plane->values[IGT_PLANE_CRTC_H];
LOG(display,
"SetPlane %s.%d, fb %u, src = (%d, %d) "
@@ -2245,9 +2199,10 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
CHECK_RETURN(ret, fail_on_error);
}
- if (plane->rotation_changed) {
- ret = igt_plane_set_property(plane, plane->rotation_property,
- plane->rotation);
+ if (igt_plane_is_prop_changed(plane, IGT_PLANE_ROTATION)) {
+ ret = igt_plane_set_property(plane,
+ plane->props[IGT_PLANE_ROTATION],
+ plane->values[IGT_PLANE_ROTATION]);
CHECK_RETURN(ret, fail_on_error);
}
@@ -2269,35 +2224,30 @@ static int igt_cursor_commit_legacy(igt_plane_t *cursor,
uint32_t crtc_id = pipe->crtc_id;
int ret;
- if (cursor->fb_changed) {
- uint32_t gem_handle = igt_plane_get_fb_gem_handle(cursor);
-
- if (gem_handle) {
+ if (igt_plane_is_prop_changed(cursor, IGT_PLANE_FB_ID)) {
+ if (cursor->gem_handle)
LOG(display,
"SetCursor pipe %s, fb %u %dx%d\n",
kmstest_pipe_name(pipe->pipe),
- gem_handle,
- cursor->crtc_w, cursor->crtc_h);
-
- ret = drmModeSetCursor(display->drm_fd, crtc_id,
- gem_handle,
- cursor->crtc_w,
- cursor->crtc_h);
- } else {
+ cursor->gem_handle,
+ (unsigned)cursor->values[IGT_PLANE_CRTC_W],
+ (unsigned)cursor->values[IGT_PLANE_CRTC_H]);
+ else
LOG(display,
"SetCursor pipe %s, disabling\n",
kmstest_pipe_name(pipe->pipe));
- ret = drmModeSetCursor(display->drm_fd, crtc_id,
- 0, 0, 0);
- }
-
+ ret = drmModeSetCursor(display->drm_fd, crtc_id,
+ cursor->gem_handle,
+ cursor->values[IGT_PLANE_CRTC_W],
+ cursor->values[IGT_PLANE_CRTC_H]);
CHECK_RETURN(ret, fail_on_error);
}
- if (cursor->position_changed) {
- int x = cursor->crtc_x;
- int y = cursor->crtc_y;
+ if (igt_plane_is_prop_changed(cursor, IGT_PLANE_CRTC_X) ||
+ igt_plane_is_prop_changed(cursor, IGT_PLANE_CRTC_Y)) {
+ int x = cursor->values[IGT_PLANE_CRTC_X];
+ int y = cursor->values[IGT_PLANE_CRTC_Y];
LOG(display,
"MoveCursor pipe %s, (%d, %d)\n",
@@ -2326,13 +2276,14 @@ static int igt_primary_plane_commit_legacy(igt_plane_t *primary,
int ret;
/* Primary planes can't be windowed when using a legacy commit */
- igt_assert((primary->crtc_x == 0 && primary->crtc_y == 0));
+ igt_assert((primary->values[IGT_PLANE_CRTC_X] == 0 && primary->values[IGT_PLANE_CRTC_Y] == 0));
/* nor rotated */
- igt_assert(!primary->rotation_changed);
+ igt_assert(!igt_plane_is_prop_changed(primary, IGT_PLANE_ROTATION));
- if (!primary->fb_changed && !primary->position_changed &&
- !primary->size_changed && !primary->pipe->mode_changed)
+ if (!igt_plane_is_prop_changed(primary, IGT_PLANE_FB_ID) &&
+ !(primary->changed & IGT_PLANE_COORD_CHANGED_MASK) &&
+ !primary->pipe->mode_changed)
return 0;
crtc_id = pipe->crtc_id;
@@ -2343,19 +2294,22 @@ static int igt_primary_plane_commit_legacy(igt_plane_t *primary,
mode = NULL;
if (fb_id) {
+ uint32_t src_x = primary->values[IGT_PLANE_SRC_X] >> 16;
+ uint32_t src_y = primary->values[IGT_PLANE_SRC_Y] >> 16;
+
LOG(display,
"%s: SetCrtc pipe %s, fb %u, src (%d, %d), "
"mode %dx%d\n",
igt_output_name(output),
kmstest_pipe_name(pipe->pipe),
fb_id,
- primary->src_x, primary->src_y,
+ src_x, src_y,
mode->hdisplay, mode->vdisplay);
ret = drmModeSetCrtc(display->drm_fd,
crtc_id,
fb_id,
- primary->src_x, primary->src_y,
+ src_x, src_y,
&output->id,
1,
mode);
@@ -2608,18 +2562,27 @@ display_commit_changed(igt_display_t *display, enum igt_commit_style s)
}
for_each_plane_on_pipe(display, pipe, plane) {
- plane->fb_changed = false;
- plane->position_changed = false;
- plane->size_changed = false;
+ if (s == COMMIT_ATOMIC) {
+ int fd;
+ plane->changed = 0;
- if (s != COMMIT_LEGACY ||
- !(plane->type == DRM_PLANE_TYPE_PRIMARY ||
- plane->type == DRM_PLANE_TYPE_CURSOR))
- plane->rotation_changed = false;
+ fd = plane->values[IGT_PLANE_IN_FENCE_FD];
+ if (fd != -1)
+ close(fd);
- if (s == COMMIT_ATOMIC)
/* reset fence_fd to prevent it from being set for the next commit */
- igt_plane_set_fence_fd(plane, -1);
+ plane->values[IGT_PLANE_IN_FENCE_FD] = -1;
+ } else {
+ plane->changed &= ~IGT_PLANE_COORD_CHANGED_MASK;
+
+ igt_plane_clear_prop_changed(plane, IGT_PLANE_CRTC_ID);
+ igt_plane_clear_prop_changed(plane, IGT_PLANE_FB_ID);
+
+ if (s != COMMIT_LEGACY ||
+ !(plane->type == DRM_PLANE_TYPE_PRIMARY ||
+ plane->type == DRM_PLANE_TYPE_CURSOR))
+ igt_plane_clear_prop_changed(plane, IGT_PLANE_ROTATION);
+ }
}
}
@@ -2913,30 +2876,31 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)
LOG(display, "%s.%d: plane_set_fb(%d)\n", kmstest_pipe_name(pipe->pipe),
plane->index, fb ? fb->fb_id : 0);
- plane->fb = fb;
+ igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_ID, fb ? pipe->crtc_id : 0);
+ igt_plane_set_prop_value(plane, IGT_PLANE_FB_ID, fb ? fb->fb_id : 0);
+
+ if (plane->type == DRM_PLANE_TYPE_CURSOR && fb)
+ plane->gem_handle = fb->gem_handle;
+ else
+ plane->gem_handle = 0;
+
/* hack to keep tests working that don't call igt_plane_set_size() */
if (fb) {
/* set default plane size as fb size */
- plane->crtc_w = fb->width;
- plane->crtc_h = fb->height;
+ igt_plane_set_position(plane, 0, 0);
+ igt_plane_set_size(plane, fb->width, fb->height);
/* set default src pos/size as fb size */
- plane->src_x = 0;
- plane->src_y = 0;
- plane->src_w = fb->width;
- plane->src_h = fb->height;
+ igt_fb_set_position(fb, plane, 0, 0);
+ igt_fb_set_size(fb, plane, fb->width, fb->height);
} else {
- plane->src_x = 0;
- plane->src_y = 0;
- plane->src_w = 0;
- plane->src_h = 0;
+ igt_plane_set_position(plane, 0, 0);
+ igt_plane_set_size(plane, 0, 0);
- plane->crtc_w = 0;
- plane->crtc_h = 0;
+ /* set default src pos/size as fb size */
+ igt_fb_set_position(fb, plane, 0, 0);
+ igt_fb_set_size(fb, plane, 0, 0);
}
-
- plane->fb_changed = true;
- plane->size_changed = true;
}
/**
@@ -2949,12 +2913,19 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)
*/
void igt_plane_set_fence_fd(igt_plane_t *plane, int fence_fd)
{
- close(plane->fence_fd);
+ int64_t fd;
- if (fcntl(fence_fd, F_GETFD) != -1)
- plane->fence_fd = dup(fence_fd);
- else
- plane->fence_fd = -1;
+ fd = plane->values[IGT_PLANE_IN_FENCE_FD];
+ if (fd != -1)
+ close(fd);
+
+ if (fence_fd != -1) {
+ fd = dup(fence_fd);
+ igt_fail_on(fd == -1);
+ } else
+ fd = -1;
+
+ igt_plane_set_prop_value(plane, IGT_PLANE_IN_FENCE_FD, fd);
}
void igt_plane_set_position(igt_plane_t *plane, int x, int y)
@@ -2965,10 +2936,8 @@ void igt_plane_set_position(igt_plane_t *plane, int x, int y)
LOG(display, "%s.%d: plane_set_position(%d,%d)\n",
kmstest_pipe_name(pipe->pipe), plane->index, x, y);
- plane->crtc_x = x;
- plane->crtc_y = y;
-
- plane->position_changed = true;
+ igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_X, x);
+ igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_Y, y);
}
/**
@@ -2989,10 +2958,8 @@ void igt_plane_set_size(igt_plane_t *plane, int w, int h)
LOG(display, "%s.%d: plane_set_size (%dx%d)\n",
kmstest_pipe_name(pipe->pipe), plane->index, w, h);
- plane->crtc_w = w;
- plane->crtc_h = h;
-
- plane->size_changed = true;
+ igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_W, w);
+ igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_H, h);
}
/**
@@ -3014,10 +2981,8 @@ void igt_fb_set_position(struct igt_fb *fb, igt_plane_t *plane,
LOG(display, "%s.%d: fb_set_position(%d,%d)\n",
kmstest_pipe_name(pipe->pipe), plane->index, x, y);
- plane->src_x = x;
- plane->src_y = y;
-
- plane->fb_changed = true;
+ igt_plane_set_prop_value(plane, IGT_PLANE_SRC_X, IGT_FIXED(x, 0));
+ igt_plane_set_prop_value(plane, IGT_PLANE_SRC_Y, IGT_FIXED(y, 0));
}
/**
@@ -3040,10 +3005,8 @@ void igt_fb_set_size(struct igt_fb *fb, igt_plane_t *plane,
LOG(display, "%s.%d: fb_set_size(%dx%d)\n",
kmstest_pipe_name(pipe->pipe), plane->index, w, h);
- plane->src_w = w;
- plane->src_h = h;
-
- plane->fb_changed = true;
+ igt_plane_set_prop_value(plane, IGT_PLANE_SRC_W, IGT_FIXED(w, 0));
+ igt_plane_set_prop_value(plane, IGT_PLANE_SRC_H, IGT_FIXED(h, 0));
}
static const char *rotation_name(igt_rotation_t rotation)
@@ -3071,9 +3034,7 @@ void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation)
kmstest_pipe_name(pipe->pipe),
plane->index, rotation_name(rotation));
- plane->rotation = rotation;
-
- plane->rotation_changed = true;
+ igt_plane_set_prop_value(plane, IGT_PLANE_ROTATION, rotation);
}
/**
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 1ef10e7d525c..f87f8be31421 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -252,6 +252,9 @@ enum igt_atomic_plane_properties {
IGT_PLANE_CRTC_W,
IGT_PLANE_CRTC_H,
+/* Append new properties after IGT_PLANE_COORD_CHANGED_MASK */
+#define IGT_PLANE_COORD_CHANGED_MASK 0xff
+
IGT_PLANE_FB_ID,
IGT_PLANE_CRTC_ID,
IGT_PLANE_IN_FENCE_FD,
@@ -286,37 +289,19 @@ typedef struct {
int index;
/* capabilities */
int type;
- /* state tracking */
- unsigned int fb_changed : 1;
- unsigned int position_changed : 1;
- unsigned int rotation_changed : 1;
- unsigned int size_changed : 1;
+
/*
* drm_plane can be NULL for primary and cursor planes (when not
* using the atomic modeset API)
*/
drmModePlane *drm_plane;
- struct igt_fb *fb;
-
- uint32_t rotation_property;
-
- /* position within pipe_src_w x pipe_src_h */
- int crtc_x, crtc_y;
- /* size within pipe_src_w x pipe_src_h */
- int crtc_w, crtc_h;
- /* position within the framebuffer */
- uint32_t src_x;
- uint32_t src_y;
- /* size within the framebuffer*/
- uint32_t src_w;
- uint32_t src_h;
+ /* gem handle for fb */
+ uint32_t gem_handle;
- igt_rotation_t rotation;
-
- /* in fence fd */
- int fence_fd;
- uint32_t atomic_props_plane[IGT_NUM_PLANE_PROPS];
+ uint64_t changed;
+ uint32_t props[IGT_NUM_PLANE_PROPS];
+ uint64_t values[IGT_NUM_PLANE_PROPS];
} igt_plane_t;
struct igt_pipe {
@@ -407,7 +392,7 @@ bool igt_pipe_get_property(igt_pipe_t *pipe, const char *name,
static inline bool igt_plane_supports_rotation(igt_plane_t *plane)
{
- return plane->rotation_property != 0;
+ return plane->props[IGT_PLANE_ROTATION] != 0;
}
void igt_pipe_request_out_fence(igt_pipe_t *pipe);
void igt_pipe_set_degamma_lut(igt_pipe_t *pipe, void *ptr, size_t length);
@@ -527,16 +512,20 @@ static inline bool igt_output_is_connected(igt_output_t *output)
#define IGT_FIXED(i,f) ((i) << 16 | (f))
-/**
- * igt_atomic_populate_plane_req:
- * @req: A pointer to drmModeAtomicReq
- * @plane: A pointer igt_plane_t
- * @prop: one of igt_atomic_plane_properties
- * @value: the value to add
- */
-#define igt_atomic_populate_plane_req(req, plane, prop, value) \
- igt_assert_lt(0, drmModeAtomicAddProperty(req, plane->drm_plane->plane_id,\
- plane->atomic_props_plane[prop], value))
+#define igt_plane_is_prop_changed(plane, prop) \
+ (!!((plane)->changed & (1 << (prop))))
+
+#define igt_plane_set_prop_changed(plane, prop) \
+ (plane)->changed |= 1 << (prop)
+
+#define igt_plane_clear_prop_changed(plane, prop) \
+ (plane)->changed &= ~(1 << (prop))
+
+#define igt_plane_set_prop_value(plane, prop, value) \
+ do { \
+ plane->values[prop] = value; \
+ igt_plane_set_prop_changed(plane, prop); \
+ } while (0)
/**
* igt_atomic_populate_crtc_req:
diff --git a/tests/kms_atomic_interruptible.c b/tests/kms_atomic_interruptible.c
index 2d19fe967809..5570854390ea 100644
--- a/tests/kms_atomic_interruptible.c
+++ b/tests/kms_atomic_interruptible.c
@@ -161,12 +161,12 @@ static void run_plane_test(igt_display_t *display, enum pipe pipe, igt_output_t
/* connector: 1 prop */
output->props[IGT_CONNECTOR_CRTC_ID],
/* plane: remainder props */
- plane->atomic_props_plane[IGT_PLANE_CRTC_ID],
- plane->atomic_props_plane[IGT_PLANE_FB_ID],
- plane->atomic_props_plane[IGT_PLANE_SRC_W],
- plane->atomic_props_plane[IGT_PLANE_SRC_H],
- plane->atomic_props_plane[IGT_PLANE_CRTC_W],
- plane->atomic_props_plane[IGT_PLANE_CRTC_H]
+ plane->props[IGT_PLANE_CRTC_ID],
+ plane->props[IGT_PLANE_FB_ID],
+ plane->props[IGT_PLANE_SRC_W],
+ plane->props[IGT_PLANE_SRC_H],
+ plane->props[IGT_PLANE_CRTC_W],
+ plane->props[IGT_PLANE_CRTC_H]
};
uint64_t prop_vals[] = {
/* crtc */
diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c
index b16c8cd433b2..613f68899601 100644
--- a/tests/kms_plane_lowres.c
+++ b/tests/kms_plane_lowres.c
@@ -227,8 +227,8 @@ test_setup(data_t *data, enum pipe pipe, uint64_t modifier, int flags,
1.0, 1.0, 0.0,
&data->fb[i]);
- igt_plane_set_position(data->plane[i], x, y);
igt_plane_set_fb(data->plane[i], &data->fb[i]);
+ igt_plane_set_position(data->plane[i], x, y);
}
return mode;
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 4d2ef1c184f0..4932a0d44410 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -122,11 +122,11 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
igt_plane_set_fb(primary, &data->fb_modeset);
if (commit < COMMIT_ATOMIC) {
- primary->rotation_changed = false;
+ igt_plane_clear_prop_changed(primary, IGT_PLANE_ROTATION);
igt_display_commit(display);
if (plane->type == DRM_PLANE_TYPE_PRIMARY)
- primary->rotation_changed = true;
+ igt_plane_set_prop_changed(primary, IGT_PLANE_ROTATION);
}
igt_plane_set_fb(plane, NULL);
--
2.14.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH i-g-t v4 6/7] lib/igt_kms: Rework pipe properties to be more atomic, v4.1.
2017-09-29 9:59 [PATCH i-g-t v4 0/7] lib/igt_kms: Convert properties to be more atomic-like Maarten Lankhorst
` (4 preceding siblings ...)
2017-09-29 9:59 ` [PATCH i-g-t v4 5/7] lib/igt_kms: Rework plane properties to be more atomic, v4 Maarten Lankhorst
@ 2017-09-29 9:59 ` Maarten Lankhorst
2017-10-03 7:45 ` [PATCH i-g-t] lib/igt_kms: Rework pipe properties to be more atomic, v5 Maarten Lankhorst
2017-09-29 9:59 ` [PATCH i-g-t v4 7/7] igt/kms_rotation_crc : Fix flip tests for sprite plane Maarten Lankhorst
` (5 subsequent siblings)
11 siblings, 1 reply; 25+ messages in thread
From: Maarten Lankhorst @ 2017-09-29 9:59 UTC (permalink / raw)
To: intel-gfx
In the future I want to allow tests to commit more properties,
but for this to work I have to fix all properties to work better
with atomic commit. Instead of special casing each
property make a bitmask for all property changed flags, and try to
commit all properties.
This has been the most involved one, since legacy pipe commit still
handles a lot of the properties differently from the rest.
Changes since v1:
- Dump all changed properties on commit.
- Fix bug in igt_pipe_refresh().
Changes since v2:
- Set pipe ACTIVE property changed flag on init.
Changes since v3:
- Add a missing igt_pipe_refresh() to kms_atomic_interruptible.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
lib/igt_kms.c | 217 ++++++++++++++++++++------------------
lib/igt_kms.h | 77 ++++++--------
tests/kms_atomic_interruptible.c | 8 +-
tests/kms_atomic_transition.c | 2 +-
tests/kms_crtc_background_color.c | 2 +-
5 files changed, 151 insertions(+), 155 deletions(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 6e0052ebe7a7..a81d7998433a 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -259,8 +259,8 @@ igt_atomic_fill_connector_props(igt_display_t *display, igt_output_t *output,
}
static void
-igt_atomic_fill_pipe_props(igt_display_t *display, igt_pipe_t *pipe,
- int num_crtc_props, const char **crtc_prop_names)
+igt_fill_pipe_props(igt_display_t *display, igt_pipe_t *pipe,
+ int num_crtc_props, const char **crtc_prop_names)
{
drmModeObjectPropertiesPtr props;
int i, j, fd;
@@ -278,7 +278,7 @@ igt_atomic_fill_pipe_props(igt_display_t *display, igt_pipe_t *pipe,
if (strcmp(prop->name, crtc_prop_names[j]) != 0)
continue;
- pipe->atomic_props_crtc[j] = props->props[i];
+ pipe->props[j] = props->props[i];
break;
}
@@ -1690,7 +1690,6 @@ void igt_display_init(igt_display_t *display, int drm_fd)
int p = 1;
int j, type;
uint8_t last_plane = 0, n_planes = 0;
- uint64_t prop_value;
pipe->crtc_id = resources->crtcs[i];
pipe->display = display;
@@ -1700,29 +1699,16 @@ void igt_display_init(igt_display_t *display, int drm_fd)
pipe->planes = NULL;
pipe->out_fence_fd = -1;
+ igt_fill_pipe_props(display, pipe, IGT_NUM_CRTC_PROPS, igt_crtc_prop_names);
+
+ /* Force modeset disable on first commit */
+ igt_pipe_obj_set_prop_changed(pipe, IGT_CRTC_MODE_ID);
+ igt_pipe_obj_set_prop_changed(pipe, IGT_CRTC_ACTIVE);
+
get_crtc_property(display->drm_fd, pipe->crtc_id,
- "background_color",
- &pipe->background_property,
- &prop_value,
+ "background_color", NULL,
+ &pipe->values[IGT_CRTC_BACKGROUND],
NULL);
- pipe->background = (uint32_t)prop_value;
- get_crtc_property(display->drm_fd, pipe->crtc_id,
- "DEGAMMA_LUT",
- &pipe->degamma_property,
- NULL,
- NULL);
- get_crtc_property(display->drm_fd, pipe->crtc_id,
- "CTM",
- &pipe->ctm_property,
- NULL,
- NULL);
- get_crtc_property(display->drm_fd, pipe->crtc_id,
- "GAMMA_LUT",
- &pipe->gamma_property,
- NULL,
- NULL);
-
- igt_atomic_fill_pipe_props(display, pipe, IGT_NUM_CRTC_PROPS, igt_crtc_prop_names);
/* count number of valid planes */
for (j = 0; j < plane_resources->count_planes; j++) {
@@ -1805,8 +1791,6 @@ void igt_display_init(igt_display_t *display, int drm_fd)
igt_assert_eq(p, n_planes);
pipe->n_planes = n_planes;
-
- pipe->mode_changed = true;
}
/*
@@ -2283,7 +2267,7 @@ static int igt_primary_plane_commit_legacy(igt_plane_t *primary,
if (!igt_plane_is_prop_changed(primary, IGT_PLANE_FB_ID) &&
!(primary->changed & IGT_PLANE_COORD_CHANGED_MASK) &&
- !primary->pipe->mode_changed)
+ !igt_pipe_obj_is_prop_changed(primary->pipe, IGT_CRTC_MODE_ID))
return 0;
crtc_id = pipe->crtc_id;
@@ -2352,6 +2336,16 @@ static int igt_plane_commit(igt_plane_t *plane,
}
}
+static bool is_atomic_prop(enum igt_atomic_crtc_properties prop)
+{
+ if (prop == IGT_CRTC_MODE_ID ||
+ prop == IGT_CRTC_ACTIVE ||
+ prop == IGT_CRTC_OUT_FENCE_PTR)
+ return true;
+
+ return false;
+}
+
/*
* Commit all plane changes to an output. Note that if @s is COMMIT_LEGACY,
* enabling/disabling the primary plane will also enable/disable the CRTC.
@@ -2369,19 +2363,9 @@ static int igt_pipe_commit(igt_pipe_t *pipe,
int i;
int ret;
- if (pipe->background_changed) {
- igt_crtc_set_property(pipe, pipe->background_property,
- pipe->background);
- }
-
- if (pipe->color_mgmt_changed) {
- igt_crtc_set_property(pipe, pipe->degamma_property,
- pipe->degamma_blob);
- igt_crtc_set_property(pipe, pipe->ctm_property,
- pipe->ctm_blob);
- igt_crtc_set_property(pipe, pipe->gamma_property,
- pipe->gamma_blob);
- }
+ for (i = 0; i < IGT_NUM_CRTC_PROPS; i++)
+ if (!is_atomic_prop(i))
+ igt_crtc_set_property(pipe, pipe->props[i], pipe->values[i]);
for (i = 0; i < pipe->n_planes; i++) {
igt_plane_t *plane = &pipe->planes[i];
@@ -2394,9 +2378,10 @@ static int igt_pipe_commit(igt_pipe_t *pipe,
}
static void
-igt_pipe_replace_blob(igt_pipe_t *pipe, uint64_t *blob, void *ptr, size_t length)
+igt_pipe_replace_blob(igt_pipe_t *pipe, enum igt_atomic_crtc_properties prop, void *ptr, size_t length)
{
igt_display_t *display = pipe->display;
+ uint64_t *blob = &pipe->values[prop];
uint32_t blob_id = 0;
if (*blob != 0)
@@ -2408,6 +2393,7 @@ igt_pipe_replace_blob(igt_pipe_t *pipe, uint64_t *blob, void *ptr, size_t length
ptr, length, &blob_id) == 0);
*blob = blob_id;
+ igt_pipe_obj_set_prop_changed(pipe, prop);
}
/*
@@ -2415,51 +2401,23 @@ igt_pipe_replace_blob(igt_pipe_t *pipe, uint64_t *blob, void *ptr, size_t length
*/
static void igt_atomic_prepare_crtc_commit(igt_pipe_t *pipe_obj, drmModeAtomicReq *req)
{
- if (pipe_obj->background_changed)
- igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_BACKGROUND, pipe_obj->background);
-
- if (pipe_obj->color_mgmt_changed) {
- igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_DEGAMMA_LUT, pipe_obj->degamma_blob);
- igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_CTM, pipe_obj->ctm_blob);
- igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_GAMMA_LUT, pipe_obj->gamma_blob);
- }
-
- if (pipe_obj->mode_changed) {
- igt_output_t *output = igt_pipe_get_output(pipe_obj);
-
- if (!output) {
- igt_pipe_replace_blob(pipe_obj, &pipe_obj->mode_blob, NULL, 0);
-
- LOG(pipe_obj->display, "%s: Setting NULL mode\n",
- kmstest_pipe_name(pipe_obj->pipe));
- } else {
- drmModeModeInfo *mode = igt_output_get_mode(output);
+ int i;
- igt_pipe_replace_blob(pipe_obj, &pipe_obj->mode_blob, mode, sizeof(*mode));
+ for (i = 0; i < IGT_NUM_CRTC_PROPS; i++) {
+ if (!igt_pipe_obj_is_prop_changed(pipe_obj, i))
+ continue;
- LOG(pipe_obj->display, "%s: Setting mode %s from %s\n",
- kmstest_pipe_name(pipe_obj->pipe),
- mode->name, igt_output_name(output));
- }
+ igt_debug("Pipe %s: Setting property \"%s\" to 0x%"PRIx64"/%"PRIi64"\n",
+ kmstest_pipe_name(pipe_obj->pipe), igt_crtc_prop_names[i],
+ pipe_obj->values[i], pipe_obj->values[i]);
- igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_MODE_ID, pipe_obj->mode_blob);
- igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_ACTIVE, !!output);
+ igt_assert_lt(0, drmModeAtomicAddProperty(req, pipe_obj->crtc_id, pipe_obj->props[i], pipe_obj->values[i]));
}
if (pipe_obj->out_fence_fd != -1) {
close(pipe_obj->out_fence_fd);
pipe_obj->out_fence_fd = -1;
}
-
- if (pipe_obj->out_fence_requested)
- {
- igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_OUT_FENCE_PTR,
- (uint64_t)(uintptr_t) &pipe_obj->out_fence_fd);
- }
-
- /*
- * TODO: Add all crtc level properties here
- */
}
/*
@@ -2550,15 +2508,21 @@ display_commit_changed(igt_display_t *display, enum igt_commit_style s)
igt_pipe_t *pipe_obj = &display->pipes[pipe];
igt_plane_t *plane;
- pipe_obj->color_mgmt_changed = false;
- pipe_obj->background_changed = false;
+ if (s == COMMIT_ATOMIC) {
+ if (igt_pipe_obj_is_prop_changed(pipe_obj, IGT_CRTC_OUT_FENCE_PTR))
+ igt_assert(pipe_obj->out_fence_fd >= 0);
- if (s != COMMIT_UNIVERSAL)
- pipe_obj->mode_changed = false;
-
- if (s == COMMIT_ATOMIC && pipe_obj->out_fence_requested) {
- pipe_obj->out_fence_requested = false;
- igt_assert(pipe_obj->out_fence_fd >= 0);
+ pipe_obj->changed = 0;
+ } else {
+ igt_pipe_obj_clear_prop_changed(pipe_obj, IGT_CRTC_BACKGROUND);
+ igt_pipe_obj_clear_prop_changed(pipe_obj, IGT_CRTC_CTM);
+ igt_pipe_obj_clear_prop_changed(pipe_obj, IGT_CRTC_DEGAMMA_LUT);
+ igt_pipe_obj_clear_prop_changed(pipe_obj, IGT_CRTC_GAMMA_LUT);
+
+ if (s != COMMIT_UNIVERSAL) {
+ igt_pipe_obj_clear_prop_changed(pipe_obj, IGT_CRTC_MODE_ID);
+ igt_pipe_obj_clear_prop_changed(pipe_obj, IGT_CRTC_ACTIVE);
+ }
}
for_each_plane_on_pipe(display, pipe, plane) {
@@ -2812,33 +2776,83 @@ void igt_output_override_mode(igt_output_t *output, drmModeModeInfo *mode)
output->use_override_mode = !!mode;
- if (pipe)
- pipe->mode_changed = true;
+ if (pipe) {
+ if (output->display->is_atomic)
+ igt_pipe_replace_blob(pipe, IGT_CRTC_MODE_ID, igt_output_get_mode(output), sizeof(*mode));
+ else
+ igt_pipe_obj_set_prop_changed(pipe, IGT_CRTC_MODE_ID);
+ }
}
void igt_output_set_pipe(igt_output_t *output, enum pipe pipe)
{
igt_display_t *display = output->display;
- igt_pipe_t *old_pipe;
+ igt_pipe_t *old_pipe = NULL, *pipe_obj = NULL;;
igt_assert(output->name);
- if (output->pending_pipe != PIPE_NONE) {
+ if (output->pending_pipe != PIPE_NONE)
old_pipe = igt_output_get_driving_pipe(output);
- old_pipe->mode_changed = true;
- }
+ if (pipe != PIPE_NONE)
+ pipe_obj = &display->pipes[pipe];
LOG(display, "%s: set_pipe(%s)\n", igt_output_name(output),
kmstest_pipe_name(pipe));
output->pending_pipe = pipe;
- if (pipe != PIPE_NONE)
- display->pipes[pipe].mode_changed = true;
+ if (old_pipe) {
+ igt_output_t *old_output;
+
+ old_output = igt_pipe_get_output(old_pipe);
+ if (!old_output) {
+ if (display->is_atomic)
+ igt_pipe_replace_blob(old_pipe, IGT_CRTC_MODE_ID, NULL, 0);
+ else
+ igt_pipe_obj_set_prop_changed(old_pipe, IGT_CRTC_MODE_ID);
+
+ igt_pipe_obj_set_prop_value(old_pipe, IGT_CRTC_ACTIVE, 0);
+ }
+ }
igt_output_set_prop_value(output, IGT_CONNECTOR_CRTC_ID, pipe == PIPE_NONE ? 0 : display->pipes[pipe].crtc_id);
igt_output_refresh(output);
+
+ if (pipe_obj) {
+ if (display->is_atomic)
+ igt_pipe_replace_blob(pipe_obj, IGT_CRTC_MODE_ID, igt_output_get_mode(output), sizeof(drmModeModeInfo));
+ else
+ igt_pipe_obj_set_prop_changed(pipe_obj, IGT_CRTC_MODE_ID);
+
+ igt_pipe_obj_set_prop_value(pipe_obj, IGT_CRTC_ACTIVE, 1);
+ }
+}
+
+/*
+ * igt_pipe_refresh:
+ * @display: a pointer to an #igt_display_t structure
+ * @pipe: Pipe to refresh
+ * @force: Should be set to true if mode_blob is no longer considered
+ * to be valid, for example after doing an atomic commit during fork or closing display fd.
+ *
+ * Requests the pipe to be part of the state on next update.
+ * This is useful when state may have been out of sync after
+ * a fork, or we just want to be sure the pipe is included
+ * in the next commit.
+ */
+void igt_pipe_refresh(igt_display_t *display, enum pipe pipe, bool force)
+{
+ igt_pipe_t *pipe_obj = &display->pipes[pipe];
+
+ if (force && display->is_atomic) {
+ igt_output_t *output = igt_pipe_get_output(pipe_obj);
+
+ pipe_obj->values[IGT_CRTC_MODE_ID] = 0;
+ if (output)
+ igt_pipe_replace_blob(pipe_obj, IGT_CRTC_MODE_ID, igt_output_get_mode(output), sizeof(drmModeModeInfo));
+ } else
+ igt_pipe_obj_set_prop_changed(pipe_obj, IGT_CRTC_MODE_ID);
}
void igt_output_set_scaling_mode(igt_output_t *output, uint64_t scaling_mode)
@@ -3046,28 +3060,25 @@ void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation)
*/
void igt_pipe_request_out_fence(igt_pipe_t *pipe)
{
- pipe->out_fence_requested = true;
+ igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_OUT_FENCE_PTR, (ptrdiff_t)&pipe->out_fence_fd);
}
void
igt_pipe_set_degamma_lut(igt_pipe_t *pipe, void *ptr, size_t length)
{
- igt_pipe_replace_blob(pipe, &pipe->degamma_blob, ptr, length);
- pipe->color_mgmt_changed = 1;
+ igt_pipe_replace_blob(pipe, IGT_CRTC_DEGAMMA_LUT, ptr, length);
}
void
igt_pipe_set_ctm_matrix(igt_pipe_t *pipe, void *ptr, size_t length)
{
- igt_pipe_replace_blob(pipe, &pipe->ctm_blob, ptr, length);
- pipe->color_mgmt_changed = 1;
+ igt_pipe_replace_blob(pipe, IGT_CRTC_CTM, ptr, length);
}
void
igt_pipe_set_gamma_lut(igt_pipe_t *pipe, void *ptr, size_t length)
{
- igt_pipe_replace_blob(pipe, &pipe->gamma_blob, ptr, length);
- pipe->color_mgmt_changed = 1;
+ igt_pipe_replace_blob(pipe, IGT_CRTC_GAMMA_LUT, ptr, length);
}
/**
@@ -3088,9 +3099,7 @@ void igt_crtc_set_background(igt_pipe_t *pipe, uint64_t background)
kmstest_pipe_name(pipe->pipe),
pipe->pipe, background);
- pipe->background = background;
-
- pipe->background_changed = true;
+ igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_BACKGROUND, background);
}
void igt_wait_for_vblank_count(int drm_fd, enum pipe pipe, int count)
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index f87f8be31421..b53127ffef5f 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -313,27 +313,13 @@ struct igt_pipe {
int plane_primary;
igt_plane_t *planes;
- uint32_t atomic_props_crtc[IGT_NUM_CRTC_PROPS];
-
- uint64_t background; /* Background color MSB BGR 16bpc LSB */
- uint32_t background_changed : 1;
- uint32_t background_property;
-
- uint64_t degamma_blob;
- uint32_t degamma_property;
- uint64_t ctm_blob;
- uint32_t ctm_property;
- uint64_t gamma_blob;
- uint32_t gamma_property;
- uint32_t color_mgmt_changed : 1;
+ uint64_t changed;
+ uint32_t props[IGT_NUM_CRTC_PROPS];
+ uint64_t values[IGT_NUM_CRTC_PROPS];
uint32_t crtc_id;
- uint64_t mode_blob;
- bool mode_changed;
-
int32_t out_fence_fd;
- bool out_fence_requested;
};
typedef struct {
@@ -527,17 +513,6 @@ static inline bool igt_output_is_connected(igt_output_t *output)
igt_plane_set_prop_changed(plane, prop); \
} while (0)
-/**
- * igt_atomic_populate_crtc_req:
- * @req: A pointer to drmModeAtomicReq
- * @pipe: A pointer igt_pipe_t
- * @prop: one of igt_atomic_crtc_properties
- * @value: the value to add
- */
-#define igt_atomic_populate_crtc_req(req, pipe, prop, value) \
- igt_assert_lt(0, drmModeAtomicAddProperty(req, pipe->crtc_id,\
- pipe->atomic_props_crtc[prop], value))
-
#define igt_output_is_prop_changed(output, prop) \
(!!((output)->changed & (1 << (prop))))
#define igt_output_set_prop_changed(output, prop) \
@@ -552,26 +527,34 @@ static inline bool igt_output_is_connected(igt_output_t *output)
igt_output_set_prop_changed(output, prop); \
} while (0)
-/*
- * igt_pipe_refresh:
- * @display: a pointer to an #igt_display_t structure
- * @pipe: Pipe to refresh
- * @force: Should be set to true if mode_blob is no longer considered
- * to be valid, for example after doing an atomic commit during fork or closing display fd.
- *
- * Requests the pipe to be part of the state on next update.
- * This is useful when state may have been out of sync after
- * a fork, or we just want to be sure the pipe is included
- * in the next commit.
- */
-static inline void
-igt_pipe_refresh(igt_display_t *display, enum pipe pipe, bool force)
-{
- if (force)
- display->pipes[pipe].mode_blob = 0;
+#define igt_pipe_obj_is_prop_changed(pipe_obj, prop) \
+ (!!((pipe_obj)->changed & (1 << (prop))))
- display->pipes[pipe].mode_changed = true;
-}
+#define igt_pipe_is_prop_changed(display, pipe, prop) \
+ igt_pipe_obj_is_prop_changed(&(display)->pipes[(pipe)], prop)
+
+#define igt_pipe_obj_set_prop_changed(pipe_obj, prop) \
+ (pipe_obj)->changed |= 1 << (prop)
+
+#define igt_pipe_set_prop_changed(display, pipe, prop) \
+ igt_pipe_obj_set_prop_changed(&(display)->pipes[(pipe)], prop)
+
+#define igt_pipe_obj_clear_prop_changed(pipe_obj, prop) \
+ (pipe_obj)->changed &= ~(1 << (prop))
+
+#define igt_pipe_clear_prop_changed(display, pipe, prop) \
+ igt_pipe_obj_clear_prop_changed(&(display)->pipes[(pipe)], prop)
+
+#define igt_pipe_obj_set_prop_value(pipe_obj, prop, value) \
+ do { \
+ (pipe_obj)->values[prop] = (value); \
+ igt_pipe_obj_set_prop_changed(pipe_obj, prop); \
+ } while (0)
+
+#define igt_pipe_set_prop_value(display, pipe, prop, value) \
+ igt_pipe_obj_set_prop_value(&(display)->pipes[(pipe)], prop, value)
+
+void igt_pipe_refresh(igt_display_t *display, enum pipe pipe, bool force);
void igt_enable_connectors(void);
void igt_reset_connectors(void);
diff --git a/tests/kms_atomic_interruptible.c b/tests/kms_atomic_interruptible.c
index 5570854390ea..0270c8f870bf 100644
--- a/tests/kms_atomic_interruptible.c
+++ b/tests/kms_atomic_interruptible.c
@@ -156,8 +156,8 @@ static void run_plane_test(igt_display_t *display, enum pipe pipe, igt_output_t
uint32_t count_props[3] = { 2, 1, 6 };
uint32_t props[] = {
/* crtc: 2 props */
- plane->pipe->atomic_props_crtc[IGT_CRTC_MODE_ID],
- plane->pipe->atomic_props_crtc[IGT_CRTC_ACTIVE],
+ plane->pipe->props[IGT_CRTC_MODE_ID],
+ plane->pipe->props[IGT_CRTC_ACTIVE],
/* connector: 1 prop */
output->props[IGT_CONNECTOR_CRTC_ID],
/* plane: remainder props */
@@ -253,6 +253,10 @@ static void run_plane_test(igt_display_t *display, enum pipe pipe, igt_output_t
igt_waitchildren();
+ /* The mode is unset by the forked helper, force a refresh here */
+ if (test_type == test_legacy_modeset || test_type == test_atomic_modeset)
+ igt_pipe_refresh(display, pipe, true);
+
igt_plane_set_fb(plane, NULL);
igt_plane_set_fb(primary, NULL);
igt_output_set_pipe(output, PIPE_NONE);
diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 2ae75f2d6630..7ddb65cea183 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -633,7 +633,7 @@ static unsigned set_combinations(igt_display_t *display, unsigned mask, struct i
drmModeModeInfo *mode = NULL;
if (!(mask & (1 << pipe))) {
- if (display->pipes[pipe].mode_blob) {
+ if (igt_pipe_is_prop_changed(display, pipe, IGT_CRTC_ACTIVE)) {
event_mask |= 1 << pipe;
igt_plane_set_fb(plane, NULL);
}
diff --git a/tests/kms_crtc_background_color.c b/tests/kms_crtc_background_color.c
index e12e163449f8..659a30b90219 100644
--- a/tests/kms_crtc_background_color.c
+++ b/tests/kms_crtc_background_color.c
@@ -137,7 +137,7 @@ static void test_crtc_background(data_t *data)
igt_output_set_pipe(output, pipe);
plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
- igt_require(plane->pipe->background_property);
+ igt_require(plane->pipe->props[IGT_CRTC_BACKGROUND]);
prepare_crtc(data, output, pipe, plane, 1, PURPLE, BLACK64);
--
2.14.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH i-g-t v4 7/7] igt/kms_rotation_crc : Fix flip tests for sprite plane
2017-09-29 9:59 [PATCH i-g-t v4 0/7] lib/igt_kms: Convert properties to be more atomic-like Maarten Lankhorst
` (5 preceding siblings ...)
2017-09-29 9:59 ` [PATCH i-g-t v4 6/7] lib/igt_kms: Rework pipe properties to be more atomic, v4.1 Maarten Lankhorst
@ 2017-09-29 9:59 ` Maarten Lankhorst
2017-09-29 10:58 ` Mika Kahola
2017-09-29 11:03 ` ✓ Fi.CI.BAT: success for lib/igt_kms: Convert properties to be more atomic-like. (rev8) Patchwork
` (4 subsequent siblings)
11 siblings, 1 reply; 25+ messages in thread
From: Maarten Lankhorst @ 2017-09-29 9:59 UTC (permalink / raw)
To: intel-gfx
This test was flipping the primary plane instead of the sprite plane.
Flip the correct plane to make the test pass properly.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102691
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
tests/kms_rotation_crc.c | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 4932a0d44410..b8327dfa0d83 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -332,6 +332,9 @@ static void test_plane_rotation(data_t *data, int plane_type)
enum igt_commit_style commit = COMMIT_LEGACY;
int ret;
+ if (data->flips && plane_type != DRM_PLANE_TYPE_PRIMARY)
+ igt_require(data->display.is_atomic);
+
if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type == DRM_PLANE_TYPE_CURSOR)
commit = COMMIT_UNIVERSAL;
@@ -390,12 +393,20 @@ static void test_plane_rotation(data_t *data, int plane_type)
* check CRC against that one as well.
*/
if (data->flips) {
- ret = drmModePageFlip(data->gfx_fd,
- output->config.crtc->crtc_id,
- data->fb_flip.fb_id,
- DRM_MODE_PAGE_FLIP_EVENT,
- NULL);
- igt_assert_eq(ret, 0);
+ igt_plane_set_fb(plane, &data->fb_flip);
+ if (data->rotation == IGT_ROTATION_90 || data->rotation == IGT_ROTATION_270)
+ igt_plane_set_size(plane, data->fb.height, data->fb.width);
+
+ if (plane_type != DRM_PLANE_TYPE_PRIMARY) {
+ igt_display_commit_atomic(display, DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK, NULL);
+ } else {
+ ret = drmModePageFlip(data->gfx_fd,
+ output->config.crtc->crtc_id,
+ data->fb_flip.fb_id,
+ DRM_MODE_PAGE_FLIP_EVENT,
+ NULL);
+ igt_assert_eq(ret, 0);
+ }
wait_for_pageflip(data->gfx_fd);
igt_pipe_crc_collect_crc(data->pipe_crc,
&crc_output);
--
2.14.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCH i-g-t v4 7/7] igt/kms_rotation_crc : Fix flip tests for sprite plane
2017-09-29 9:59 ` [PATCH i-g-t v4 7/7] igt/kms_rotation_crc : Fix flip tests for sprite plane Maarten Lankhorst
@ 2017-09-29 10:58 ` Mika Kahola
0 siblings, 0 replies; 25+ messages in thread
From: Mika Kahola @ 2017-09-29 10:58 UTC (permalink / raw)
To: Maarten Lankhorst, intel-gfx
On Fri, 2017-09-29 at 11:59 +0200, Maarten Lankhorst wrote:
> This test was flipping the primary plane instead of the sprite plane.
> Flip the correct plane to make the test pass properly.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102691
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
> ---
> tests/kms_rotation_crc.c | 23 +++++++++++++++++------
> 1 file changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> index 4932a0d44410..b8327dfa0d83 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -332,6 +332,9 @@ static void test_plane_rotation(data_t *data, int
> plane_type)
> enum igt_commit_style commit = COMMIT_LEGACY;
> int ret;
>
> + if (data->flips && plane_type != DRM_PLANE_TYPE_PRIMARY)
> + igt_require(data->display.is_atomic);
> +
> if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type ==
> DRM_PLANE_TYPE_CURSOR)
> commit = COMMIT_UNIVERSAL;
>
> @@ -390,12 +393,20 @@ static void test_plane_rotation(data_t *data,
> int plane_type)
> * check CRC against that one as well.
> */
> if (data->flips) {
> - ret = drmModePageFlip(data->gfx_fd,
> - output-
> >config.crtc->crtc_id,
> - data-
> >fb_flip.fb_id,
> - DRM_MODE_PAGE_
> FLIP_EVENT,
> - NULL);
> - igt_assert_eq(ret, 0);
> + igt_plane_set_fb(plane, &data-
> >fb_flip);
> + if (data->rotation ==
> IGT_ROTATION_90 || data->rotation == IGT_ROTATION_270)
> + igt_plane_set_size(plane,
> data->fb.height, data->fb.width);
> +
> + if (plane_type !=
> DRM_PLANE_TYPE_PRIMARY) {
> + igt_display_commit_atomic(di
> splay, DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK, NULL);
> + } else {
> + ret = drmModePageFlip(data-
> >gfx_fd,
> + output-
> >config.crtc->crtc_id,
> + data-
> >fb_flip.fb_id,
> + DRM_MODE_PAG
> E_FLIP_EVENT,
> + NULL);
> + igt_assert_eq(ret, 0);
> + }
> wait_for_pageflip(data->gfx_fd);
> igt_pipe_crc_collect_crc(data-
> >pipe_crc,
> &crc_output
> );
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 25+ messages in thread
* ✓ Fi.CI.BAT: success for lib/igt_kms: Convert properties to be more atomic-like. (rev8)
2017-09-29 9:59 [PATCH i-g-t v4 0/7] lib/igt_kms: Convert properties to be more atomic-like Maarten Lankhorst
` (6 preceding siblings ...)
2017-09-29 9:59 ` [PATCH i-g-t v4 7/7] igt/kms_rotation_crc : Fix flip tests for sprite plane Maarten Lankhorst
@ 2017-09-29 11:03 ` Patchwork
2017-09-29 12:13 ` ✗ Fi.CI.IGT: failure " Patchwork
` (3 subsequent siblings)
11 siblings, 0 replies; 25+ messages in thread
From: Patchwork @ 2017-09-29 11:03 UTC (permalink / raw)
To: Maarten Lankhorst; +Cc: intel-gfx
== Series Details ==
Series: lib/igt_kms: Convert properties to be more atomic-like. (rev8)
URL : https://patchwork.freedesktop.org/series/30903/
State : success
== Summary ==
IGT patchset tested on top of latest successful build
cf3e683a3650c18c89a3322c4171e1db94b5b9f8 igt/gem_exec_nop: Measure high-priority throughput over a bg load
with latest DRM-Tip kernel build CI_DRM_3155
2131a7ba0b2b drm-tip: 2017y-09m-29d-08h-01m-09s UTC integration manifest
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:446s
fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:470s
fi-blb-e6850 total:289 pass:224 dwarn:1 dfail:0 fail:0 skip:64 time:418s
fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:537s
fi-bwr-2160 total:289 pass:184 dwarn:0 dfail:0 fail:0 skip:105 time:281s
fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:505s
fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:511s
fi-byt-j1900 total:289 pass:254 dwarn:1 dfail:0 fail:0 skip:34 time:502s
fi-byt-n2820 total:289 pass:250 dwarn:1 dfail:0 fail:0 skip:38 time:494s
fi-cfl-s total:289 pass:256 dwarn:1 dfail:0 fail:0 skip:32 time:565s
fi-cnl-y total:118 pass:97 dwarn:0 dfail:0 fail:0 skip:20
fi-elk-e7500 total:289 pass:230 dwarn:0 dfail:0 fail:0 skip:59 time:419s
fi-glk-1 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:570s
fi-hsw-4770 total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:431s
fi-hsw-4770r total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:407s
fi-ivb-3520m total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:491s
fi-ivb-3770 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:469s
fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:469s
fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:577s
fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:599s
fi-pnv-d510 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:544s
fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:457s
fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:760s
fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:499s
fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:479s
fi-snb-2520m total:289 pass:251 dwarn:0 dfail:0 fail:0 skip:38 time:571s
fi-snb-2600 total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:415s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_274/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 25+ messages in thread
* ✗ Fi.CI.IGT: failure for lib/igt_kms: Convert properties to be more atomic-like. (rev8)
2017-09-29 9:59 [PATCH i-g-t v4 0/7] lib/igt_kms: Convert properties to be more atomic-like Maarten Lankhorst
` (7 preceding siblings ...)
2017-09-29 11:03 ` ✓ Fi.CI.BAT: success for lib/igt_kms: Convert properties to be more atomic-like. (rev8) Patchwork
@ 2017-09-29 12:13 ` Patchwork
2017-10-03 9:08 ` ✗ Fi.CI.BAT: failure for lib/igt_kms: Convert properties to be more atomic-like. (rev9) Patchwork
` (2 subsequent siblings)
11 siblings, 0 replies; 25+ messages in thread
From: Patchwork @ 2017-09-29 12:13 UTC (permalink / raw)
To: Maarten Lankhorst; +Cc: intel-gfx
== Series Details ==
Series: lib/igt_kms: Convert properties to be more atomic-like. (rev8)
URL : https://patchwork.freedesktop.org/series/30903/
State : failure
== Summary ==
Test kms_rotation_crc:
Subgroup sprite-rotation-180-flip:
fail -> PASS (shard-hsw) fdo#102691
Test gem_eio:
Subgroup in-flight-external:
dmesg-warn -> PASS (shard-hsw) fdo#102886 +2
Test kms_busy:
Subgroup extended-modeset-hang-newfb-with-reset-render-B:
dmesg-warn -> PASS (shard-hsw)
Test kms_flip:
Subgroup wf_vblank-vs-modeset:
dmesg-warn -> PASS (shard-hsw) fdo#102614
Test kms_setmode:
Subgroup basic:
fail -> PASS (shard-hsw) fdo#99912
Test gem_exec_store:
Subgroup pages-default:
pass -> FAIL (shard-hsw)
Test perf:
Subgroup polling:
fail -> PASS (shard-hsw) fdo#102252
fdo#102691 https://bugs.freedesktop.org/show_bug.cgi?id=102691
fdo#102886 https://bugs.freedesktop.org/show_bug.cgi?id=102886
fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
shard-hsw total:2429 pass:1334 dwarn:3 dfail:0 fail:9 skip:1083 time:9942s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_274/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH i-g-t v4 1/7] tests: Stop looking at plane private members
2017-09-29 9:59 ` [PATCH i-g-t v4 1/7] tests: Stop looking at plane private members Maarten Lankhorst
@ 2017-09-29 13:13 ` Mika Kahola
2017-10-02 9:31 ` Maarten Lankhorst
0 siblings, 1 reply; 25+ messages in thread
From: Mika Kahola @ 2017-09-29 13:13 UTC (permalink / raw)
To: Maarten Lankhorst, intel-gfx
On Fri, 2017-09-29 at 11:59 +0200, Maarten Lankhorst wrote:
> Most of these tests have no reason to look at those members,
> so try other ways of getting the information.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
> ---
> lib/igt_kms.h | 21 ++++++++
> tests/kms_atomic_transition.c | 117 +++++++++++++++++++++-----------
> ----------
> tests/kms_busy.c | 5 +-
> tests/kms_concurrent.c | 4 +-
> tests/kms_cursor_legacy.c | 6 +--
> tests/kms_fbc_crc.c | 3 +-
> tests/kms_panel_fitting.c | 14 +----
> tests/kms_plane_scaling.c | 14 +----
> tests/kms_rmfb.c | 2 +-
> tests/kms_rotation_crc.c | 10 ----
> 10 files changed, 93 insertions(+), 103 deletions(-)
>
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 3d1061fa08c8..62197dcfea7b 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -556,6 +556,27 @@ static inline bool
> igt_output_is_connected(igt_output_t *output)
> igt_assert_lt(0, drmModeAtomicAddProperty(req, output-
> >config.connector->connector_id,\
> output-
> >config.atomic_props_connector[prop], value))
>
> +/*
> + * igt_pipe_refresh:
> + * @display: a pointer to an #igt_display_t structure
> + * @pipe: Pipe to refresh
> + * @force: Should be set to true if mode_blob is no longer
> considered
> + * to be valid, for example after doing an atomic commit during fork
> or closing display fd.
> + *
> + * Requests the pipe to be part of the state on next update.
> + * This is useful when state may have been out of sync after
> + * a fork, or we just want to be sure the pipe is included
> + * in the next commit.
> + */
> +static inline void
> +igt_pipe_refresh(igt_display_t *display, enum pipe pipe, bool force)
> +{
> + if (force)
> + display->pipes[pipe].mode_blob = 0;
> +
> + display->pipes[pipe].mode_changed = true;
> +}
> +
> void igt_enable_connectors(void);
> void igt_reset_connectors(void);
>
> diff --git a/tests/kms_atomic_transition.c
> b/tests/kms_atomic_transition.c
> index e22763bdf94b..48823a09aed2 100644
> --- a/tests/kms_atomic_transition.c
> +++ b/tests/kms_atomic_transition.c
> @@ -46,6 +46,11 @@ struct plane_parms {
>
> #define hweight32 __builtin_popcount
>
> +/* globals for fence support */
> +int *timeline;
> +pthread_t *thread;
> +int *seqno;
> +
> static void
> run_primary_test(igt_display_t *display, enum pipe pipe,
> igt_output_t *output)
> {
> @@ -89,9 +94,34 @@ run_primary_test(igt_display_t *display, enum pipe
> pipe, igt_output_t *output)
> igt_remove_fb(display->drm_fd, &fb);
> }
>
> +static void *fence_inc_thread(void *arg)
> +{
> + int t = *((int *) arg);
> +
> + pthread_detach(pthread_self());
> +
> + usleep(5000);
> + sw_sync_timeline_inc(t, 1);
> + return NULL;
> +}
> +
> +static void configure_fencing(igt_plane_t *plane)
> +{
> + int i, fd, ret;
> +
> + i = plane->index;
> +
> + seqno[i]++;
> + fd = sw_sync_timeline_create_fence(timeline[i], seqno[i]);
> + igt_plane_set_fence_fd(plane, fd);
> + close(fd);
> + ret = pthread_create(&thread[i], NULL, fence_inc_thread,
> &timeline[i]);
> + igt_assert_eq(ret, 0);
> +}
> +
> static void
> wm_setup_plane(igt_display_t *display, enum pipe pipe,
> - uint32_t mask, struct plane_parms *parms)
> + uint32_t mask, struct plane_parms *parms, bool
> fencing)
> {
> igt_plane_t *plane;
>
> @@ -108,6 +138,9 @@ wm_setup_plane(igt_display_t *display, enum pipe
> pipe,
> continue;
> }
>
> + if (fencing)
> + configure_fencing(plane);
> +
> igt_plane_set_fb(plane, parms[i].fb);
> igt_fb_set_size(parms[i].fb, plane, parms[i].width,
> parms[i].height);
> igt_plane_set_size(plane, parms[i].width,
> parms[i].height);
> @@ -136,7 +169,7 @@ static bool
> skip_on_unsupported_nonblocking_modeset(igt_display_t *display)
>
> /* Force the next state to update all crtc's, to synchronize
> with the nonblocking modeset. */
> for_each_pipe(display, pipe)
> - display->pipes[pipe].mode_changed = true;
> + igt_pipe_refresh(display, pipe, false);
>
> return false;
> }
> @@ -183,6 +216,7 @@ static void set_sprite_wh(igt_display_t *display,
> enum pipe pipe,
>
> static void setup_parms(igt_display_t *display, enum pipe pipe,
> const drmModeModeInfo *mode,
> + struct igt_fb *primary_fb,
> struct igt_fb *argb_fb,
> struct igt_fb *sprite_fb,
> struct plane_parms *parms)
> @@ -205,7 +239,7 @@ static void setup_parms(igt_display_t *display,
> enum pipe pipe,
> int i = plane->index;
>
> if (plane->type == DRM_PLANE_TYPE_PRIMARY) {
> - parms[i].fb = plane->fb;
> + parms[i].fb = primary_fb;
> parms[i].width = mode->hdisplay;
> parms[i].height = mode->vdisplay;
> } else if (plane->type == DRM_PLANE_TYPE_CURSOR) {
> @@ -242,7 +276,7 @@ retry:
> set_sprite_wh(display, pipe, parms, sprite_fb,
> alpha, sprite_width, sprite_height);
>
> - wm_setup_plane(display, pipe, (1 << n_planes) - 1,
> parms);
> + wm_setup_plane(display, pipe, (1 << n_planes) - 1,
> parms, false);
> ret = igt_display_try_commit_atomic(display,
> DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
>
> if (ret == -EINVAL) {
> @@ -300,10 +334,6 @@ retry:
> sprite_width, sprite_height, alpha);
> }
>
> -int *timeline;
> -pthread_t *thread;
> -int *seqno;
> -
> static void prepare_fencing(igt_display_t *display, enum pipe pipe)
> {
> igt_plane_t *plane;
> @@ -335,44 +365,10 @@ static void unprepare_fencing(igt_display_t
> *display, enum pipe pipe)
> free(seqno);
> }
>
> -static void *fence_inc_thread(void *arg)
> -{
> - int t = *((int *) arg);
> -
> - pthread_detach(pthread_self());
> -
> - usleep(5000);
> - sw_sync_timeline_inc(t, 1);
> - return NULL;
> -}
> -
> -static void configure_fencing(igt_display_t *display, enum pipe
> pipe)
> -{
> - igt_plane_t *plane;
> - int i, fd, ret;
> -
> - for_each_plane_on_pipe(display, pipe, plane) {
> -
> - if (!plane->fb)
> - continue;
> -
> - i = plane->index;
> -
> - seqno[i]++;
> - fd = sw_sync_timeline_create_fence(timeline[i],
> seqno[i]);
> - igt_plane_set_fence_fd(plane, fd);
> - close(fd);
> - ret = pthread_create(&thread[i], NULL,
> fence_inc_thread, &timeline[i]);
> - igt_assert_eq(ret, 0);
> - }
> -}
> -
> static void atomic_commit(igt_display_t *display, enum pipe pipe,
> unsigned int flags, void *data, bool fencing)
> {
> - if (fencing) {
> - configure_fencing(display, pipe);
> + if (fencing)
> igt_pipe_request_out_fence(&display->pipes[pipe]);
> - }
>
> igt_display_commit_atomic(display, flags, data);
> }
> @@ -445,7 +441,7 @@ run_transition_test(igt_display_t *display, enum
> pipe pipe, igt_output_t *output
>
> igt_output_set_pipe(output, pipe);
>
> - wm_setup_plane(display, pipe, 0, NULL);
> + wm_setup_plane(display, pipe, 0, NULL, false);
>
> if (flags & DRM_MODE_ATOMIC_ALLOW_MODESET) {
> skip_test = nonblocking &&
> skip_on_unsupported_nonblocking_modeset(display);
> @@ -461,7 +457,7 @@ run_transition_test(igt_display_t *display, enum
> pipe pipe, igt_output_t *output
>
> igt_display_commit2(display, COMMIT_ATOMIC);
>
> - setup_parms(display, pipe, mode, &argb_fb, &sprite_fb,
> parms);
> + setup_parms(display, pipe, mode, &fb, &argb_fb, &sprite_fb,
> parms);
>
> /*
> * In some configurations the tests may not run to
> completion with all
> @@ -469,7 +465,7 @@ run_transition_test(igt_display_t *display, enum
> pipe pipe, igt_output_t *output
> * planes to fix this
> */
> while (1) {
> - wm_setup_plane(display, pipe, iter_max - 1, parms);
> + wm_setup_plane(display, pipe, iter_max - 1, parms,
> false);
>
> if (fencing)
> igt_pipe_request_out_fence(pipe_obj);
> @@ -504,7 +500,7 @@ run_transition_test(igt_display_t *display, enum
> pipe pipe, igt_output_t *output
> if (type == TRANSITION_AFTER_FREE) {
> int fence_fd = -1;
>
> - wm_setup_plane(display, pipe, 0, parms);
> + wm_setup_plane(display, pipe, 0, parms, fencing);
>
> atomic_commit(display, pipe, flags, (void
> *)(unsigned long)0, fencing);
> if (fencing) {
> @@ -512,8 +508,9 @@ run_transition_test(igt_display_t *display, enum
> pipe pipe, igt_output_t *output
> pipe_obj->out_fence_fd = -1;
> }
>
> + /* force planes to be part of commit */
> for_each_plane_on_pipe(display, pipe, plane)
> - plane->fb_changed = true;
> + igt_plane_set_position(plane, 0, 0);
>
> igt_display_commit2(display, COMMIT_ATOMIC);
>
> @@ -530,7 +527,7 @@ run_transition_test(igt_display_t *display, enum
> pipe pipe, igt_output_t *output
> for (i = 0; i < iter_max; i++) {
> igt_output_set_pipe(output, pipe);
>
> - wm_setup_plane(display, pipe, i, parms);
> + wm_setup_plane(display, pipe, i, parms, fencing);
>
> atomic_commit(display, pipe, flags, (void
> *)(unsigned long)i, fencing);
> wait_for_transition(display, pipe, nonblocking,
> fencing);
> @@ -538,7 +535,7 @@ run_transition_test(igt_display_t *display, enum
> pipe pipe, igt_output_t *output
> if (type == TRANSITION_MODESET_DISABLE) {
> igt_output_set_pipe(output, PIPE_NONE);
>
> - wm_setup_plane(display, pipe, 0, parms);
> + wm_setup_plane(display, pipe, 0, parms,
> fencing);
>
> atomic_commit(display, pipe, flags, (void *)
> 0UL, fencing);
> wait_for_transition(display, pipe,
> nonblocking, fencing);
> @@ -547,7 +544,7 @@ run_transition_test(igt_display_t *display, enum
> pipe pipe, igt_output_t *output
>
> /* i -> i+1 will be done when i increases,
> can be skipped here */
> for (j = iter_max - 1; j > i + 1; j--) {
> - wm_setup_plane(display, pipe, j,
> parms);
> + wm_setup_plane(display, pipe, j,
> parms, fencing);
>
> if (type == TRANSITION_MODESET)
> igt_output_override_mode(out
> put, &override_mode);
> @@ -555,7 +552,7 @@ run_transition_test(igt_display_t *display, enum
> pipe pipe, igt_output_t *output
> atomic_commit(display, pipe, flags,
> (void *)(unsigned long) j, fencing);
> wait_for_transition(display, pipe,
> nonblocking, fencing);
>
> - wm_setup_plane(display, pipe, i,
> parms);
> + wm_setup_plane(display, pipe, i,
> parms, fencing);
> if (type == TRANSITION_MODESET)
> igt_output_override_mode(out
> put, NULL);
>
> @@ -666,15 +663,19 @@ static unsigned set_combinations(igt_display_t
> *display, unsigned mask, struct i
> return event_mask;
> }
>
> -static void refresh_primaries(igt_display_t *display)
> +static void refresh_primaries(igt_display_t *display, int mask)
> {
> enum pipe pipe;
> igt_plane_t *plane;
>
> - for_each_pipe(display, pipe)
> + for_each_pipe(display, pipe) {
> + if (!((1 << pipe) & mask))
> + continue;
> +
> for_each_plane_on_pipe(display, pipe, plane)
> - if (plane->type == DRM_PLANE_TYPE_PRIMARY &&
> plane->fb)
> - plane->fb_changed = true;
> + if (plane->type == DRM_PLANE_TYPE_PRIMARY)
> + igt_plane_set_position(plane, 0, 0);
> + }
> }
>
> static void collect_crcs_mask(igt_pipe_crc_t **pipe_crcs, unsigned
> mask, igt_crc_t *crcs)
> @@ -783,7 +784,7 @@ static void run_modeset_tests(igt_display_t
> *display, int howmany, bool nonblock
>
> collect_crcs_mask(pipe_crcs, j, crcs[1]);
>
> - refresh_primaries(display);
> + refresh_primaries(display, j);
> commit_display(display, j, nonblocking);
> collect_crcs_mask(pipe_crcs, j, crcs[2]);
>
> @@ -794,7 +795,7 @@ static void run_modeset_tests(igt_display_t
> *display, int howmany, bool nonblock
> commit_display(display, event_mask,
> nonblocking);
> collect_crcs_mask(pipe_crcs, i, crcs[3]);
>
> - refresh_primaries(display);
> + refresh_primaries(display, i);
> commit_display(display, i, nonblocking);
> collect_crcs_mask(pipe_crcs, i, crcs[4]);
>
> diff --git a/tests/kms_busy.c b/tests/kms_busy.c
> index 7e31c2c82dc5..f430beaf7373 100644
> --- a/tests/kms_busy.c
> +++ b/tests/kms_busy.c
> @@ -146,7 +146,10 @@ static void flip_to_fb(igt_display_t *dpy, int
> pipe,
>
> if (modeset) {
> igt_set_module_param_int("enable_hangcheck", 1);
> - dpy->pipes[pipe].mode_blob = 0;
> +
> + /* Clear old mode blob. */
> + igt_pipe_refresh(dpy, pipe, true);
> +
> igt_output_set_pipe(output, pipe);
> igt_display_commit2(dpy, COMMIT_ATOMIC);
> }
> diff --git a/tests/kms_concurrent.c b/tests/kms_concurrent.c
> index 5d1e0bc5ad19..7f44c596b4c4 100644
> --- a/tests/kms_concurrent.c
> +++ b/tests/kms_concurrent.c
> @@ -91,7 +91,7 @@ static void test_fini(data_t *data, enum pipe pipe,
> int n_planes,
> {
> int i;
>
> - data->display.pipes[pipe].mode_blob = 0;
> + igt_pipe_refresh(&data->display, pipe, true);
>
> for (i = 0; i < n_planes; i++) {
> igt_plane_t *plane = data->plane[i];
> @@ -292,7 +292,7 @@ test_resolution_with_output(data_t *data, enum
> pipe pipe, igt_output_t *output)
>
> i = 0;
> while (i < iterations || loop_forever) {
> - data->display.pipes[pipe].mode_blob = 0;
> + igt_pipe_refresh(&data->display, pipe, true);
>
> mode_hi = igt_output_get_mode(output);
> mode_lo = get_lowres_mode(data, mode_hi, output);
> diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
> index ba7c3f51ba21..65a001a9dec0 100644
> --- a/tests/kms_cursor_legacy.c
> +++ b/tests/kms_cursor_legacy.c
> @@ -784,7 +784,7 @@ static bool
> skip_on_unsupported_nonblocking_modeset(igt_display_t *display)
>
> /* Force the next state to update all crtc's, to synchronize
> with the nonblocking modeset. */
> for_each_pipe(display, pipe)
> - display->pipes[pipe].mode_changed = true;
> + igt_pipe_refresh(display, pipe, false);
>
> return false;
> }
> @@ -971,8 +971,8 @@ static void
> two_screens_flip_vs_cursor(igt_display_t *display, int nloops, bool
>
> if (modeset) {
> /* wait for pending modeset and page flip to
> complete, to prevent -EBUSY */
> - display->pipes[pipe].mode_changed = true;
> - display->pipes[pipe2].mode_changed = true;
> + igt_pipe_refresh(display, pipe, false);
> + igt_pipe_refresh(display, pipe2, false);
> igt_display_commit2(display, COMMIT_ATOMIC);
> }
> }
> diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c
> index 08abb8b4b95e..06234566c232 100644
> --- a/tests/kms_fbc_crc.c
> +++ b/tests/kms_fbc_crc.c
> @@ -461,8 +461,7 @@ static void reset_display(data_t *data)
> igt_pipe_t *pipe = &display->pipes[pipe_id];
> igt_plane_t *plane = igt_pipe_get_plane_type(pipe,
> DRM_PLANE_TYPE_PRIMARY);
>
> - if (plane->fb)
> - igt_plane_set_fb(plane, NULL);
> + igt_plane_set_fb(plane, NULL);
> }
>
> for_each_connected_output(display, data->output)
> diff --git a/tests/kms_panel_fitting.c b/tests/kms_panel_fitting.c
> index 5266862a70cf..85a231e60ea2 100644
> --- a/tests/kms_panel_fitting.c
> +++ b/tests/kms_panel_fitting.c
> @@ -84,19 +84,7 @@ static void prepare_crtc(data_t *data,
> igt_output_t *output, enum pipe pipe,
> }
>
> igt_plane_set_fb(plane, &data->fb1);
> - if (s == COMMIT_LEGACY) {
> - int ret;
> - ret = drmModeSetCrtc(data->drm_fd,
> - plane->pipe->crtc_id,
> - data->fb_id1,
> - plane->src_x, plane->src_y,
> - &output->id,
> - 1,
> - mode);
> - igt_assert_eq(ret, 0);
> - } else {
> - igt_display_commit2(display, s);
> - }
> + igt_display_commit2(display, s);
> }
>
> static void cleanup_crtc(data_t *data, igt_output_t *output,
> igt_plane_t *plane)
> diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
> index 1457894aaa10..5ed69f35f267 100644
> --- a/tests/kms_plane_scaling.c
> +++ b/tests/kms_plane_scaling.c
> @@ -93,19 +93,7 @@ static void prepare_crtc(data_t *data,
> igt_output_t *output, enum pipe pipe,
> }
>
> igt_plane_set_fb(plane, &data->fb1);
> - if (s == COMMIT_LEGACY) {
> - int ret;
> - ret = drmModeSetCrtc(data->drm_fd,
> - plane->pipe->crtc_id,
> - data->fb_id1,
> - plane->src_x, plane->src_y,
> - &output->id,
> - 1,
> - mode);
> - igt_assert_eq(ret, 0);
> - } else {
> - igt_display_commit2(display, s);
> - }
> + igt_display_commit2(display, s);
> }
>
> static void cleanup_crtc(data_t *data, igt_output_t *output,
> igt_plane_t *plane)
> diff --git a/tests/kms_rmfb.c b/tests/kms_rmfb.c
> index 9f1f564e54aa..c97adceea761 100644
> --- a/tests/kms_rmfb.c
> +++ b/tests/kms_rmfb.c
> @@ -102,7 +102,7 @@ test_rmfb(struct rmfb_data *data, igt_output_t
> *output, enum pipe pipe, bool reo
> drmSetClientCap(data->drm_fd,
> DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
> drmSetClientCap(data->drm_fd, DRM_CLIENT_CAP_ATOMIC,
> 1);
>
> - data->display.pipes[pipe].mode_blob = 0;
> + igt_pipe_refresh(&data->display, pipe, true);
> } else {
> igt_remove_fb(data->drm_fd, &fb);
> igt_remove_fb(data->drm_fd, &argb_fb);
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> index 21e264addc09..4d2ef1c184f0 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -465,12 +465,6 @@ static void
> test_plane_rotation_ytiled_obj(data_t *data,
> igt_plane_set_fb(plane, &data->fb);
> igt_plane_set_size(plane, h, w);
>
> - if (commit < COMMIT_ATOMIC)
> - drmModeObjectSetProperty(fd, plane->drm_plane-
> >plane_id,
> - DRM_MODE_OBJECT_PLANE,
> - plane->rotation_property,
> - plane->rotation);
> -
> ret = igt_display_try_commit2(display, commit);
>
> igt_output_set_pipe(output, PIPE_NONE);
> @@ -562,10 +556,6 @@ static void
> test_plane_rotation_exhaust_fences(data_t *data,
> igt_plane_set_rotation(plane, IGT_ROTATION_90);
> igt_plane_set_size(plane, h, w);
>
> - drmModeObjectSetProperty(fd, plane->drm_plane-
> >plane_id,
> - DRM_MODE_OBJECT_PLANE,
> - plane->rotation_property,
> - plane->rotation);
> igt_display_commit2(display, commit);
> if (ret) {
> igt_warn("failed to commit hardware rotated
> fb: %i\n", ret);
--
Mika Kahola - Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH i-g-t v4 1/7] tests: Stop looking at plane private members
2017-09-29 13:13 ` Mika Kahola
@ 2017-10-02 9:31 ` Maarten Lankhorst
0 siblings, 0 replies; 25+ messages in thread
From: Maarten Lankhorst @ 2017-10-02 9:31 UTC (permalink / raw)
To: mika.kahola, intel-gfx
Op 29-09-17 om 15:13 schreef Mika Kahola:
> On Fri, 2017-09-29 at 11:59 +0200, Maarten Lankhorst wrote:
>> Most of these tests have no reason to look at those members,
>> so try other ways of getting the information.
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Reviewed-by: Mika Kahola <mika.kahola@intel.com>
Thanks, patch 1 & 7 pushed. :)
~Maarten
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH i-g-t v4 2/7] lib/igt_kms: Change output->pending_crtc_idx_mask to output->pending_pipe
2017-09-29 9:59 ` [PATCH i-g-t v4 2/7] lib/igt_kms: Change output->pending_crtc_idx_mask to output->pending_pipe Maarten Lankhorst
@ 2017-10-02 10:19 ` Mika Kahola
0 siblings, 0 replies; 25+ messages in thread
From: Mika Kahola @ 2017-10-02 10:19 UTC (permalink / raw)
To: Maarten Lankhorst, intel-gfx
On Fri, 2017-09-29 at 11:59 +0200, Maarten Lankhorst wrote:
> igt_output_set_pipe with PIPE_ANY used to mean that we bind the
> output
> to any pipe, but this is now a deprecated alias for PIPE_NONE, and
> means the output will be unbound.
>
> Because of this it's better to change output->pending_crtc_idx_mask
> to
> an enum pipe, because only a single choice may be given for a pipe.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
> ---
> lib/igt_kms.c | 46 ++++++++++++++++++++-------------
> ----------
> lib/igt_kms.h | 2 +-
> tests/kms_atomic_transition.c | 4 ++--
> tests/kms_busy.c | 2 +-
> tests/kms_cursor_legacy.c | 2 +-
> 5 files changed, 26 insertions(+), 30 deletions(-)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 7bcafc072f70..a5db6bc493c2 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -1561,9 +1561,10 @@ static void
> igt_display_log_shift(igt_display_t *display, int shift)
> static void igt_output_refresh(igt_output_t *output)
> {
> igt_display_t *display = output->display;
> - unsigned long crtc_idx_mask;
> + unsigned long crtc_idx_mask = 0;
>
> - crtc_idx_mask = output->pending_crtc_idx_mask;
> + if (output->pending_pipe != PIPE_NONE)
> + crtc_idx_mask = 1 << output->pending_pipe;
>
> kmstest_free_connector_config(&output->config);
>
> @@ -1587,11 +1588,8 @@ static void igt_output_refresh(igt_output_t
> *output)
> BROADCAST_RGB_FU
> LL);
> }
>
> - if (output->config.pipe == PIPE_NONE)
> - return;
> -
> LOG(display, "%s: Selecting pipe %s\n", output->name,
> - kmstest_pipe_name(output->config.pipe));
> + kmstest_pipe_name(output->pending_pipe));
> }
>
> static bool
> @@ -1830,7 +1828,7 @@ void igt_display_init(igt_display_t *display,
> int drm_fd)
> * a pipe is set with igt_output_set_pipe().
> */
> output->force_reprobe = true;
> - output->pending_crtc_idx_mask = 0;
> + output->pending_pipe = PIPE_NONE;
> output->id = resources->connectors[i];
> output->display = display;
>
> @@ -1960,10 +1958,12 @@ static void igt_display_refresh(igt_display_t
> *display)
> for (i = 0; i < display->n_outputs; i++) {
> output = &display->outputs[i];
>
> - if (pipes_in_use & output->pending_crtc_idx_mask)
> - goto report_dup;
> + if (output->pending_pipe != PIPE_NONE) {
> + if (pipes_in_use & (1 << output-
> >pending_pipe))
> + goto report_dup;
>
> - pipes_in_use |= output->pending_crtc_idx_mask;
> + pipes_in_use |= 1 << output->pending_pipe;
> + }
>
> if (output->force_reprobe)
> igt_output_refresh(output);
> @@ -1975,11 +1975,11 @@ report_dup:
> for (; i > 0; i--) {
> igt_output_t *b = &display->outputs[i - 1];
>
> - igt_assert_f(output->pending_crtc_idx_mask !=
> - b->pending_crtc_idx_mask,
> + igt_assert_f(output->pending_pipe !=
> + b->pending_pipe,
> "%s and %s are both trying to use pipe
> %s\n",
> igt_output_name(output),
> igt_output_name(b),
> - kmstest_pipe_name(ffs(b-
> >pending_crtc_idx_mask) - 1));
> + kmstest_pipe_name(output-
> >pending_pipe));
> }
> }
>
> @@ -1988,7 +1988,7 @@ static igt_pipe_t
> *igt_output_get_driving_pipe(igt_output_t *output)
> igt_display_t *display = output->display;
> enum pipe pipe;
>
> - if (!output->pending_crtc_idx_mask) {
> + if (output->pending_pipe == PIPE_NONE) {
> /*
> * The user hasn't specified a pipe to use, return
> none.
> */
> @@ -1998,7 +1998,7 @@ static igt_pipe_t
> *igt_output_get_driving_pipe(igt_output_t *output)
> * Otherwise, return the pending pipe (ie the pipe
> that should
> * drive this output after the commit()
> */
> - pipe = ffs(output->pending_crtc_idx_mask) - 1;
> + pipe = output->pending_pipe;
> }
>
> igt_assert(pipe >= 0 && pipe < display->n_pipes);
> @@ -2051,7 +2051,7 @@ static igt_output_t
> *igt_pipe_get_output(igt_pipe_t *pipe)
> for (i = 0; i < display->n_outputs; i++) {
> igt_output_t *output = &display->outputs[i];
>
> - if (output->pending_crtc_idx_mask == (1 << pipe-
> >pipe))
> + if (output->pending_pipe == pipe->pipe)
> return output;
> }
>
> @@ -2860,22 +2860,18 @@ void igt_output_set_pipe(igt_output_t
> *output, enum pipe pipe)
>
> igt_assert(output->name);
>
> - if (output->pending_crtc_idx_mask) {
> + if (output->pending_pipe != PIPE_NONE) {
> old_pipe = igt_output_get_driving_pipe(output);
>
> old_pipe->mode_changed = true;
> }
>
> - if (pipe == PIPE_NONE) {
> - LOG(display, "%s: set_pipe(any)\n",
> igt_output_name(output));
> - output->pending_crtc_idx_mask = 0;
> - } else {
> - LOG(display, "%s: set_pipe(%s)\n",
> igt_output_name(output),
> - kmstest_pipe_name(pipe));
> - output->pending_crtc_idx_mask = 1 << pipe;
> + LOG(display, "%s: set_pipe(%s)\n", igt_output_name(output),
> + kmstest_pipe_name(pipe));
> + output->pending_pipe = pipe;
>
> + if (pipe != PIPE_NONE)
> display->pipes[pipe].mode_changed = true;
> - }
>
> output->config.pipe_changed = true;
>
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 62197dcfea7b..8dc118c961b7 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -361,7 +361,7 @@ typedef struct {
> struct kmstest_connector_config config;
> char *name;
> bool force_reprobe;
> - unsigned long pending_crtc_idx_mask;
> + enum pipe pending_pipe;
> bool use_override_mode;
> drmModeModeInfo override_mode;
> } igt_output_t;
> diff --git a/tests/kms_atomic_transition.c
> b/tests/kms_atomic_transition.c
> index 48823a09aed2..2ae75f2d6630 100644
> --- a/tests/kms_atomic_transition.c
> +++ b/tests/kms_atomic_transition.c
> @@ -644,7 +644,7 @@ static unsigned set_combinations(igt_display_t
> *display, unsigned mask, struct i
> event_mask |= 1 << pipe;
>
> for_each_valid_output_on_pipe(display, pipe, output)
> {
> - if (output->pending_crtc_idx_mask)
> + if (output->pending_pipe != PIPE_NONE)
> continue;
>
> mode = igt_output_get_mode(output);
> @@ -726,7 +726,7 @@ static void run_modeset_tests(igt_display_t
> *display, int howmany, bool nonblock
> pipe_crcs[i] = igt_pipe_crc_new(display-
> >drm_fd, i, INTEL_PIPE_CRC_SOURCE_AUTO);
>
> for_each_valid_output_on_pipe(display, i, output) {
> - if (output->pending_crtc_idx_mask)
> + if (output->pending_pipe != PIPE_NONE)
> continue;
>
> igt_output_set_pipe(output, i);
> diff --git a/tests/kms_busy.c b/tests/kms_busy.c
> index f430beaf7373..0828a8b38a06 100644
> --- a/tests/kms_busy.c
> +++ b/tests/kms_busy.c
> @@ -41,7 +41,7 @@ set_fb_on_crtc(igt_display_t *dpy, int pipe, struct
> igt_fb *fb)
> drmModeModeInfoPtr mode;
> igt_plane_t *primary;
>
> - if (output->pending_crtc_idx_mask)
> + if (output->pending_pipe != PIPE_NONE)
> continue;
>
> igt_output_set_pipe(output, pipe);
> diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
> index 65a001a9dec0..fc7526833673 100644
> --- a/tests/kms_cursor_legacy.c
> +++ b/tests/kms_cursor_legacy.c
> @@ -155,7 +155,7 @@ static igt_output_t *set_fb_on_crtc(igt_display_t
> *display, enum pipe pipe, stru
> drmModeModeInfoPtr mode;
> igt_plane_t *primary;
>
> - if (output->pending_crtc_idx_mask)
> + if (output->pending_pipe != PIPE_NONE)
> continue;
>
> igt_output_set_pipe(output, pipe);
--
Mika Kahola - Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH i-g-t v4 3/7] lib/igt_kms: Commit primary plane when a modeset is forced on a pipe
2017-09-29 9:59 ` [PATCH i-g-t v4 3/7] lib/igt_kms: Commit primary plane when a modeset is forced on a pipe Maarten Lankhorst
@ 2017-10-02 11:02 ` Mika Kahola
0 siblings, 0 replies; 25+ messages in thread
From: Mika Kahola @ 2017-10-02 11:02 UTC (permalink / raw)
To: Maarten Lankhorst, intel-gfx
On Fri, 2017-09-29 at 11:59 +0200, Maarten Lankhorst wrote:
> In between tests, some tests can do the following sequence:
>
> (pipe C configured with FB)
> igt_plane_set_fb(primary (pipe C), NULL);
> /* Clear rotation property first */
> igt_display_commit2(display, COMMIT_UNIVERSAL);
>
> /* disable pipe */
> igt_display_commit2(display, COMMIT_LEGACY);
>
> This would result in PIPE_C not being properly disabled, which
> will cause an error on the next mode. This can be seen when running
> the full kms_rotation_crc testcase without --subtest, it will fail
> on exhaust-fences because the bad-tiling subtest wasn't able to
> disable pipe C correctly.
>
> Testcase: kms_rotation_crc
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
> ---
> lib/igt_kms.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index a5db6bc493c2..d25090b05c70 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -2332,7 +2332,7 @@ static int
> igt_primary_plane_commit_legacy(igt_plane_t *primary,
> igt_assert(!primary->rotation_changed);
>
> if (!primary->fb_changed && !primary->position_changed &&
> - !primary->size_changed)
> + !primary->size_changed && !primary->pipe->mode_changed)
> return 0;
>
> crtc_id = pipe->crtc_id;
--
Mika Kahola - Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH i-g-t v4 4/7] lib/igt_kms: Rework connector properties to be more atomic, v2.
2017-09-29 9:59 ` [PATCH i-g-t v4 4/7] lib/igt_kms: Rework connector properties to be more atomic, v2 Maarten Lankhorst
@ 2017-10-02 12:22 ` Mika Kahola
0 siblings, 0 replies; 25+ messages in thread
From: Mika Kahola @ 2017-10-02 12:22 UTC (permalink / raw)
To: Maarten Lankhorst, intel-gfx
On Fri, 2017-09-29 at 11:59 +0200, Maarten Lankhorst wrote:
> In the future I want to allow tests to commit more properties,
> but for this to work I have to fix all properties to work better
> with atomic commit. Instead of special casing each
> property make a bitmask for all property changed flags, and try to
> commit all properties.
>
> Changs since v1:
> - Mention which properties we set to what.
> - Assert the property to be set is valid.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
> ---
> lib/igt_kms.c | 44 +++++++++++++++++++-----------
> ----------
> lib/igt_kms.h | 35 +++++++++++++++++++-----------
> --
> tests/kms_atomic_interruptible.c | 4 ++--
> tests/kms_panel_fitting.c | 2 +-
> 4 files changed, 45 insertions(+), 40 deletions(-)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index d25090b05c70..07d2074c2b1a 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -248,7 +248,7 @@ igt_atomic_fill_connector_props(igt_display_t
> *display, igt_output_t *output,
> if (strcmp(prop->name, conn_prop_names[j])
> != 0)
> continue;
>
> - output->config.atomic_props_connector[j] =
> props->props[i];
> + output->props[j] = props->props[i];
> break;
> }
>
> @@ -1834,7 +1834,7 @@ void igt_display_init(igt_display_t *display,
> int drm_fd)
>
> igt_output_refresh(output);
>
> - output->config.pipe_changed = true;
> + igt_output_set_prop_changed(output,
> IGT_CONNECTOR_CRTC_ID);
> }
>
> drmModeFreePlaneResources(plane_resources);
> @@ -2514,23 +2514,24 @@ static void
> igt_atomic_prepare_crtc_commit(igt_pipe_t *pipe_obj, drmModeAtomicRe
> static void igt_atomic_prepare_connector_commit(igt_output_t
> *output, drmModeAtomicReq *req)
> {
>
> - struct kmstest_connector_config *config = &output->config;
> + int i;
>
> - if (config->connector_scaling_mode_changed)
> - igt_atomic_populate_connector_req(req, output,
> IGT_CONNECTOR_SCALING_MODE, config->connector_scaling_mode);
> + for (i = 0; i < IGT_NUM_CONNECTOR_PROPS; i++) {
> + if (!igt_output_is_prop_changed(output, i))
> + continue;
>
> - if (config->pipe_changed) {
> - uint32_t crtc_id = 0;
> + /* it's an error to try an unsupported feature */
> + igt_assert(output->props[i]);
>
> - if (output->config.pipe != PIPE_NONE)
> - crtc_id = output->config.crtc->crtc_id;
> + igt_debug("%s: Setting property \"%s\" to
> 0x%"PRIx64"/%"PRIi64"\n",
> + igt_output_name(output),
> igt_connector_prop_names[i],
> + output->values[i], output->values[i]);
>
> - igt_atomic_populate_connector_req(req, output,
> IGT_CONNECTOR_CRTC_ID, crtc_id);
> + igt_assert_lt(0, drmModeAtomicAddProperty(req,
> + output->config.connector-
> >connector_id,
> + output->props[i],
> + output->values[i]));
> }
> - /*
> - * TODO: Add all other connector level properties
> here
> - */
> -
> }
>
> /*
> @@ -2625,11 +2626,10 @@ display_commit_changed(igt_display_t
> *display, enum igt_commit_style s)
> for (i = 0; i < display->n_outputs; i++) {
> igt_output_t *output = &display->outputs[i];
>
> - if (s != COMMIT_UNIVERSAL)
> - output->config.pipe_changed = false;
> -
> if (s == COMMIT_ATOMIC)
> - output-
> >config.connector_scaling_mode_changed = false;
> + output->changed = 0;
> + else if (s != COMMIT_UNIVERSAL)
> + igt_output_clear_prop_changed(output,
> IGT_CONNECTOR_CRTC_ID);
> }
> }
>
> @@ -2873,18 +2873,16 @@ void igt_output_set_pipe(igt_output_t
> *output, enum pipe pipe)
> if (pipe != PIPE_NONE)
> display->pipes[pipe].mode_changed = true;
>
> - output->config.pipe_changed = true;
> + igt_output_set_prop_value(output, IGT_CONNECTOR_CRTC_ID,
> pipe == PIPE_NONE ? 0 : display->pipes[pipe].crtc_id);
>
> igt_output_refresh(output);
> }
>
> void igt_output_set_scaling_mode(igt_output_t *output, uint64_t
> scaling_mode)
> {
> - output->config.connector_scaling_mode_changed = true;
> -
> - output->config.connector_scaling_mode = scaling_mode;
> + igt_output_set_prop_value(output,
> IGT_CONNECTOR_SCALING_MODE, scaling_mode);
>
> - igt_require(output-
> >config.atomic_props_connector[IGT_CONNECTOR_SCALING_MODE]);
> + igt_require(output->props[IGT_CONNECTOR_SCALING_MODE]);
> }
>
> igt_plane_t *igt_output_get_plane(igt_output_t *output, int
> plane_idx)
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 8dc118c961b7..1ef10e7d525c 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -131,10 +131,7 @@ struct kmstest_connector_config {
> drmModeConnector *connector;
> drmModeEncoder *encoder;
> drmModeModeInfo default_mode;
> - uint64_t connector_scaling_mode;
> - bool connector_scaling_mode_changed;
> - bool pipe_changed;
> - uint32_t atomic_props_connector[IGT_NUM_CONNECTOR_PROPS];
> +
> int pipe;
> unsigned valid_crtc_idx_mask;
> };
> @@ -364,6 +361,12 @@ typedef struct {
> enum pipe pending_pipe;
> bool use_override_mode;
> drmModeModeInfo override_mode;
> +
> + /* bitmask of changed properties */
> + uint64_t changed;
> +
> + uint32_t props[IGT_NUM_CONNECTOR_PROPS];
> + uint64_t values[IGT_NUM_CONNECTOR_PROPS];
> } igt_output_t;
>
> struct igt_display {
> @@ -545,16 +548,20 @@ static inline bool
> igt_output_is_connected(igt_output_t *output)
> #define igt_atomic_populate_crtc_req(req, pipe, prop, value) \
> igt_assert_lt(0, drmModeAtomicAddProperty(req, pipe-
> >crtc_id,\
> pipe-
> >atomic_props_crtc[prop], value))
> -/**
> - * igt_atomic_populate_connector_req:
> - * @req: A pointer to drmModeAtomicReq
> - * @output: A pointer igt_output_t
> - * @prop: one of igt_atomic_connector_properties
> - * @value: the value to add
> - */
> -#define igt_atomic_populate_connector_req(req, output, prop, value)
> \
> - igt_assert_lt(0, drmModeAtomicAddProperty(req, output-
> >config.connector->connector_id,\
> - output-
> >config.atomic_props_connector[prop], value))
> +
> +#define igt_output_is_prop_changed(output, prop) \
> + (!!((output)->changed & (1 << (prop))))
> +#define igt_output_set_prop_changed(output, prop) \
> + (output)->changed |= 1 << (prop)
> +
> +#define igt_output_clear_prop_changed(output, prop) \
> + (output)->changed &= ~(1 << (prop))
> +
> +#define igt_output_set_prop_value(output, prop, value) \
> + do { \
> + (output)->values[prop] = (value); \
> + igt_output_set_prop_changed(output, prop); \
> + } while (0)
>
> /*
> * igt_pipe_refresh:
> diff --git a/tests/kms_atomic_interruptible.c
> b/tests/kms_atomic_interruptible.c
> index 4e06ee4e2d6b..2d19fe967809 100644
> --- a/tests/kms_atomic_interruptible.c
> +++ b/tests/kms_atomic_interruptible.c
> @@ -159,7 +159,7 @@ static void run_plane_test(igt_display_t
> *display, enum pipe pipe, igt_output_t
> plane->pipe-
> >atomic_props_crtc[IGT_CRTC_MODE_ID],
> plane->pipe-
> >atomic_props_crtc[IGT_CRTC_ACTIVE],
> /* connector: 1 prop */
> - output-
> >config.atomic_props_connector[IGT_CONNECTOR_CRTC_ID],
> + output-
> >props[IGT_CONNECTOR_CRTC_ID],
> /* plane: remainder props */
> plane-
> >atomic_props_plane[IGT_PLANE_CRTC_ID],
> plane-
> >atomic_props_plane[IGT_PLANE_FB_ID],
> @@ -204,7 +204,7 @@ static void run_plane_test(igt_display_t
> *display, enum pipe pipe, igt_output_t
> case test_legacy_dpms: {
> struct
> drm_mode_connector_set_property prop = {
> .value = DRM_MODE_DPMS_OFF,
> - .prop_id = output-
> >config.atomic_props_connector[IGT_CONNECTOR_DPMS],
> + .prop_id = output-
> >props[IGT_CONNECTOR_DPMS],
> .connector_id = output->id,
> };
>
> diff --git a/tests/kms_panel_fitting.c b/tests/kms_panel_fitting.c
> index 85a231e60ea2..e4ea355611c3 100644
> --- a/tests/kms_panel_fitting.c
> +++ b/tests/kms_panel_fitting.c
> @@ -275,7 +275,7 @@ static void test_atomic_fastset(igt_display_t
> *display)
> igt_require(intel_gen(intel_get_drm_devid(display->drm_fd))
> >= 5);
>
> for_each_pipe_with_valid_output(display, pipe, output) {
> - if (!output-
> >config.atomic_props_connector[IGT_CONNECTOR_SCALING_MODE])
> + if (!output->props[IGT_CONNECTOR_SCALING_MODE])
> continue;
>
> test_panel_fitting_fastset(display, pipe, output);
--
Mika Kahola - Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH i-g-t] lib/igt_kms: Rework pipe properties to be more atomic, v5.
2017-09-29 9:59 ` [PATCH i-g-t v4 6/7] lib/igt_kms: Rework pipe properties to be more atomic, v4.1 Maarten Lankhorst
@ 2017-10-03 7:45 ` Maarten Lankhorst
2017-10-04 13:55 ` [PATCH i-g-t] lib/igt_kms: Rework pipe properties to be more atomic, v6 Maarten Lankhorst
0 siblings, 1 reply; 25+ messages in thread
From: Maarten Lankhorst @ 2017-10-03 7:45 UTC (permalink / raw)
To: intel-gfx
In the future I want to allow tests to commit more properties,
but for this to work I have to fix all properties to work better
with atomic commit. Instead of special casing each
property make a bitmask for all property changed flags, and try to
commit all properties.
This has been the most involved one, since legacy pipe commit still
handles a lot of the properties differently from the rest.
Changes since v1:
- Dump all changed properties on commit.
- Fix bug in igt_pipe_refresh().
Changes since v2:
- Set pipe ACTIVE property changed flag on init.
Changes since v3:
- Add a missing igt_pipe_refresh() to kms_atomic_interruptible.
Changes since v4:
- Perform error handling when setting custom crtc properties.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
lib/igt_kms.c | 229 ++++++++++++++++++++------------------
lib/igt_kms.h | 77 +++++--------
tests/kms_atomic_interruptible.c | 8 +-
tests/kms_atomic_transition.c | 2 +-
tests/kms_crtc_background_color.c | 2 +-
5 files changed, 157 insertions(+), 161 deletions(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 6e0052ebe7a7..fc603af8db67 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -259,8 +259,8 @@ igt_atomic_fill_connector_props(igt_display_t *display, igt_output_t *output,
}
static void
-igt_atomic_fill_pipe_props(igt_display_t *display, igt_pipe_t *pipe,
- int num_crtc_props, const char **crtc_prop_names)
+igt_fill_pipe_props(igt_display_t *display, igt_pipe_t *pipe,
+ int num_crtc_props, const char **crtc_prop_names)
{
drmModeObjectPropertiesPtr props;
int i, j, fd;
@@ -278,7 +278,7 @@ igt_atomic_fill_pipe_props(igt_display_t *display, igt_pipe_t *pipe,
if (strcmp(prop->name, crtc_prop_names[j]) != 0)
continue;
- pipe->atomic_props_crtc[j] = props->props[i];
+ pipe->props[j] = props->props[i];
break;
}
@@ -1620,13 +1620,6 @@ get_crtc_property(int drm_fd, uint32_t crtc_id, const char *name,
name, prop_id, value, prop);
}
-static void
-igt_crtc_set_property(igt_pipe_t *pipe, uint32_t prop_id, uint64_t value)
-{
- drmModeObjectSetProperty(pipe->display->drm_fd,
- pipe->crtc_id, DRM_MODE_OBJECT_CRTC, prop_id, value);
-}
-
/*
* Walk a plane's property list to determine its type. If we don't
* find a type property, then the kernel doesn't support universal
@@ -1690,7 +1683,6 @@ void igt_display_init(igt_display_t *display, int drm_fd)
int p = 1;
int j, type;
uint8_t last_plane = 0, n_planes = 0;
- uint64_t prop_value;
pipe->crtc_id = resources->crtcs[i];
pipe->display = display;
@@ -1700,29 +1692,16 @@ void igt_display_init(igt_display_t *display, int drm_fd)
pipe->planes = NULL;
pipe->out_fence_fd = -1;
+ igt_fill_pipe_props(display, pipe, IGT_NUM_CRTC_PROPS, igt_crtc_prop_names);
+
+ /* Force modeset disable on first commit */
+ igt_pipe_obj_set_prop_changed(pipe, IGT_CRTC_MODE_ID);
+ igt_pipe_obj_set_prop_changed(pipe, IGT_CRTC_ACTIVE);
+
get_crtc_property(display->drm_fd, pipe->crtc_id,
- "background_color",
- &pipe->background_property,
- &prop_value,
+ "background_color", NULL,
+ &pipe->values[IGT_CRTC_BACKGROUND],
NULL);
- pipe->background = (uint32_t)prop_value;
- get_crtc_property(display->drm_fd, pipe->crtc_id,
- "DEGAMMA_LUT",
- &pipe->degamma_property,
- NULL,
- NULL);
- get_crtc_property(display->drm_fd, pipe->crtc_id,
- "CTM",
- &pipe->ctm_property,
- NULL,
- NULL);
- get_crtc_property(display->drm_fd, pipe->crtc_id,
- "GAMMA_LUT",
- &pipe->gamma_property,
- NULL,
- NULL);
-
- igt_atomic_fill_pipe_props(display, pipe, IGT_NUM_CRTC_PROPS, igt_crtc_prop_names);
/* count number of valid planes */
for (j = 0; j < plane_resources->count_planes; j++) {
@@ -1805,8 +1784,6 @@ void igt_display_init(igt_display_t *display, int drm_fd)
igt_assert_eq(p, n_planes);
pipe->n_planes = n_planes;
-
- pipe->mode_changed = true;
}
/*
@@ -2283,7 +2260,7 @@ static int igt_primary_plane_commit_legacy(igt_plane_t *primary,
if (!igt_plane_is_prop_changed(primary, IGT_PLANE_FB_ID) &&
!(primary->changed & IGT_PLANE_COORD_CHANGED_MASK) &&
- !primary->pipe->mode_changed)
+ !igt_pipe_obj_is_prop_changed(primary->pipe, IGT_CRTC_MODE_ID))
return 0;
crtc_id = pipe->crtc_id;
@@ -2352,6 +2329,16 @@ static int igt_plane_commit(igt_plane_t *plane,
}
}
+static bool is_atomic_prop(enum igt_atomic_crtc_properties prop)
+{
+ if (prop == IGT_CRTC_MODE_ID ||
+ prop == IGT_CRTC_ACTIVE ||
+ prop == IGT_CRTC_OUT_FENCE_PTR)
+ return true;
+
+ return false;
+}
+
/*
* Commit all plane changes to an output. Note that if @s is COMMIT_LEGACY,
* enabling/disabling the primary plane will also enable/disable the CRTC.
@@ -2369,19 +2356,16 @@ static int igt_pipe_commit(igt_pipe_t *pipe,
int i;
int ret;
- if (pipe->background_changed) {
- igt_crtc_set_property(pipe, pipe->background_property,
- pipe->background);
- }
+ for (i = 0; i < IGT_NUM_CRTC_PROPS; i++)
+ if (!is_atomic_prop(i)) {
+ igt_assert(pipe->props[i]);
- if (pipe->color_mgmt_changed) {
- igt_crtc_set_property(pipe, pipe->degamma_property,
- pipe->degamma_blob);
- igt_crtc_set_property(pipe, pipe->ctm_property,
- pipe->ctm_blob);
- igt_crtc_set_property(pipe, pipe->gamma_property,
- pipe->gamma_blob);
- }
+ ret = drmModeObjectSetProperty(pipe->display->drm_fd,
+ pipe->crtc_id, DRM_MODE_OBJECT_CRTC,
+ pipe->props[i], pipe->values[i]);
+
+ CHECK_RETURN(ret, fail_on_error);
+ }
for (i = 0; i < pipe->n_planes; i++) {
igt_plane_t *plane = &pipe->planes[i];
@@ -2394,9 +2378,10 @@ static int igt_pipe_commit(igt_pipe_t *pipe,
}
static void
-igt_pipe_replace_blob(igt_pipe_t *pipe, uint64_t *blob, void *ptr, size_t length)
+igt_pipe_replace_blob(igt_pipe_t *pipe, enum igt_atomic_crtc_properties prop, void *ptr, size_t length)
{
igt_display_t *display = pipe->display;
+ uint64_t *blob = &pipe->values[prop];
uint32_t blob_id = 0;
if (*blob != 0)
@@ -2408,6 +2393,7 @@ igt_pipe_replace_blob(igt_pipe_t *pipe, uint64_t *blob, void *ptr, size_t length
ptr, length, &blob_id) == 0);
*blob = blob_id;
+ igt_pipe_obj_set_prop_changed(pipe, prop);
}
/*
@@ -2415,51 +2401,23 @@ igt_pipe_replace_blob(igt_pipe_t *pipe, uint64_t *blob, void *ptr, size_t length
*/
static void igt_atomic_prepare_crtc_commit(igt_pipe_t *pipe_obj, drmModeAtomicReq *req)
{
- if (pipe_obj->background_changed)
- igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_BACKGROUND, pipe_obj->background);
-
- if (pipe_obj->color_mgmt_changed) {
- igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_DEGAMMA_LUT, pipe_obj->degamma_blob);
- igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_CTM, pipe_obj->ctm_blob);
- igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_GAMMA_LUT, pipe_obj->gamma_blob);
- }
-
- if (pipe_obj->mode_changed) {
- igt_output_t *output = igt_pipe_get_output(pipe_obj);
-
- if (!output) {
- igt_pipe_replace_blob(pipe_obj, &pipe_obj->mode_blob, NULL, 0);
-
- LOG(pipe_obj->display, "%s: Setting NULL mode\n",
- kmstest_pipe_name(pipe_obj->pipe));
- } else {
- drmModeModeInfo *mode = igt_output_get_mode(output);
+ int i;
- igt_pipe_replace_blob(pipe_obj, &pipe_obj->mode_blob, mode, sizeof(*mode));
+ for (i = 0; i < IGT_NUM_CRTC_PROPS; i++) {
+ if (!igt_pipe_obj_is_prop_changed(pipe_obj, i))
+ continue;
- LOG(pipe_obj->display, "%s: Setting mode %s from %s\n",
- kmstest_pipe_name(pipe_obj->pipe),
- mode->name, igt_output_name(output));
- }
+ igt_debug("Pipe %s: Setting property \"%s\" to 0x%"PRIx64"/%"PRIi64"\n",
+ kmstest_pipe_name(pipe_obj->pipe), igt_crtc_prop_names[i],
+ pipe_obj->values[i], pipe_obj->values[i]);
- igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_MODE_ID, pipe_obj->mode_blob);
- igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_ACTIVE, !!output);
+ igt_assert_lt(0, drmModeAtomicAddProperty(req, pipe_obj->crtc_id, pipe_obj->props[i], pipe_obj->values[i]));
}
if (pipe_obj->out_fence_fd != -1) {
close(pipe_obj->out_fence_fd);
pipe_obj->out_fence_fd = -1;
}
-
- if (pipe_obj->out_fence_requested)
- {
- igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_OUT_FENCE_PTR,
- (uint64_t)(uintptr_t) &pipe_obj->out_fence_fd);
- }
-
- /*
- * TODO: Add all crtc level properties here
- */
}
/*
@@ -2550,15 +2508,21 @@ display_commit_changed(igt_display_t *display, enum igt_commit_style s)
igt_pipe_t *pipe_obj = &display->pipes[pipe];
igt_plane_t *plane;
- pipe_obj->color_mgmt_changed = false;
- pipe_obj->background_changed = false;
+ if (s == COMMIT_ATOMIC) {
+ if (igt_pipe_obj_is_prop_changed(pipe_obj, IGT_CRTC_OUT_FENCE_PTR))
+ igt_assert(pipe_obj->out_fence_fd >= 0);
- if (s != COMMIT_UNIVERSAL)
- pipe_obj->mode_changed = false;
-
- if (s == COMMIT_ATOMIC && pipe_obj->out_fence_requested) {
- pipe_obj->out_fence_requested = false;
- igt_assert(pipe_obj->out_fence_fd >= 0);
+ pipe_obj->changed = 0;
+ } else {
+ igt_pipe_obj_clear_prop_changed(pipe_obj, IGT_CRTC_BACKGROUND);
+ igt_pipe_obj_clear_prop_changed(pipe_obj, IGT_CRTC_CTM);
+ igt_pipe_obj_clear_prop_changed(pipe_obj, IGT_CRTC_DEGAMMA_LUT);
+ igt_pipe_obj_clear_prop_changed(pipe_obj, IGT_CRTC_GAMMA_LUT);
+
+ if (s != COMMIT_UNIVERSAL) {
+ igt_pipe_obj_clear_prop_changed(pipe_obj, IGT_CRTC_MODE_ID);
+ igt_pipe_obj_clear_prop_changed(pipe_obj, IGT_CRTC_ACTIVE);
+ }
}
for_each_plane_on_pipe(display, pipe, plane) {
@@ -2812,33 +2776,83 @@ void igt_output_override_mode(igt_output_t *output, drmModeModeInfo *mode)
output->use_override_mode = !!mode;
- if (pipe)
- pipe->mode_changed = true;
+ if (pipe) {
+ if (output->display->is_atomic)
+ igt_pipe_replace_blob(pipe, IGT_CRTC_MODE_ID, igt_output_get_mode(output), sizeof(*mode));
+ else
+ igt_pipe_obj_set_prop_changed(pipe, IGT_CRTC_MODE_ID);
+ }
}
void igt_output_set_pipe(igt_output_t *output, enum pipe pipe)
{
igt_display_t *display = output->display;
- igt_pipe_t *old_pipe;
+ igt_pipe_t *old_pipe = NULL, *pipe_obj = NULL;;
igt_assert(output->name);
- if (output->pending_pipe != PIPE_NONE) {
+ if (output->pending_pipe != PIPE_NONE)
old_pipe = igt_output_get_driving_pipe(output);
- old_pipe->mode_changed = true;
- }
+ if (pipe != PIPE_NONE)
+ pipe_obj = &display->pipes[pipe];
LOG(display, "%s: set_pipe(%s)\n", igt_output_name(output),
kmstest_pipe_name(pipe));
output->pending_pipe = pipe;
- if (pipe != PIPE_NONE)
- display->pipes[pipe].mode_changed = true;
+ if (old_pipe) {
+ igt_output_t *old_output;
+
+ old_output = igt_pipe_get_output(old_pipe);
+ if (!old_output) {
+ if (display->is_atomic)
+ igt_pipe_replace_blob(old_pipe, IGT_CRTC_MODE_ID, NULL, 0);
+ else
+ igt_pipe_obj_set_prop_changed(old_pipe, IGT_CRTC_MODE_ID);
+
+ igt_pipe_obj_set_prop_value(old_pipe, IGT_CRTC_ACTIVE, 0);
+ }
+ }
igt_output_set_prop_value(output, IGT_CONNECTOR_CRTC_ID, pipe == PIPE_NONE ? 0 : display->pipes[pipe].crtc_id);
igt_output_refresh(output);
+
+ if (pipe_obj) {
+ if (display->is_atomic)
+ igt_pipe_replace_blob(pipe_obj, IGT_CRTC_MODE_ID, igt_output_get_mode(output), sizeof(drmModeModeInfo));
+ else
+ igt_pipe_obj_set_prop_changed(pipe_obj, IGT_CRTC_MODE_ID);
+
+ igt_pipe_obj_set_prop_value(pipe_obj, IGT_CRTC_ACTIVE, 1);
+ }
+}
+
+/*
+ * igt_pipe_refresh:
+ * @display: a pointer to an #igt_display_t structure
+ * @pipe: Pipe to refresh
+ * @force: Should be set to true if mode_blob is no longer considered
+ * to be valid, for example after doing an atomic commit during fork or closing display fd.
+ *
+ * Requests the pipe to be part of the state on next update.
+ * This is useful when state may have been out of sync after
+ * a fork, or we just want to be sure the pipe is included
+ * in the next commit.
+ */
+void igt_pipe_refresh(igt_display_t *display, enum pipe pipe, bool force)
+{
+ igt_pipe_t *pipe_obj = &display->pipes[pipe];
+
+ if (force && display->is_atomic) {
+ igt_output_t *output = igt_pipe_get_output(pipe_obj);
+
+ pipe_obj->values[IGT_CRTC_MODE_ID] = 0;
+ if (output)
+ igt_pipe_replace_blob(pipe_obj, IGT_CRTC_MODE_ID, igt_output_get_mode(output), sizeof(drmModeModeInfo));
+ } else
+ igt_pipe_obj_set_prop_changed(pipe_obj, IGT_CRTC_MODE_ID);
}
void igt_output_set_scaling_mode(igt_output_t *output, uint64_t scaling_mode)
@@ -3046,28 +3060,25 @@ void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation)
*/
void igt_pipe_request_out_fence(igt_pipe_t *pipe)
{
- pipe->out_fence_requested = true;
+ igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_OUT_FENCE_PTR, (ptrdiff_t)&pipe->out_fence_fd);
}
void
igt_pipe_set_degamma_lut(igt_pipe_t *pipe, void *ptr, size_t length)
{
- igt_pipe_replace_blob(pipe, &pipe->degamma_blob, ptr, length);
- pipe->color_mgmt_changed = 1;
+ igt_pipe_replace_blob(pipe, IGT_CRTC_DEGAMMA_LUT, ptr, length);
}
void
igt_pipe_set_ctm_matrix(igt_pipe_t *pipe, void *ptr, size_t length)
{
- igt_pipe_replace_blob(pipe, &pipe->ctm_blob, ptr, length);
- pipe->color_mgmt_changed = 1;
+ igt_pipe_replace_blob(pipe, IGT_CRTC_CTM, ptr, length);
}
void
igt_pipe_set_gamma_lut(igt_pipe_t *pipe, void *ptr, size_t length)
{
- igt_pipe_replace_blob(pipe, &pipe->gamma_blob, ptr, length);
- pipe->color_mgmt_changed = 1;
+ igt_pipe_replace_blob(pipe, IGT_CRTC_GAMMA_LUT, ptr, length);
}
/**
@@ -3088,9 +3099,7 @@ void igt_crtc_set_background(igt_pipe_t *pipe, uint64_t background)
kmstest_pipe_name(pipe->pipe),
pipe->pipe, background);
- pipe->background = background;
-
- pipe->background_changed = true;
+ igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_BACKGROUND, background);
}
void igt_wait_for_vblank_count(int drm_fd, enum pipe pipe, int count)
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index f87f8be31421..b53127ffef5f 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -313,27 +313,13 @@ struct igt_pipe {
int plane_primary;
igt_plane_t *planes;
- uint32_t atomic_props_crtc[IGT_NUM_CRTC_PROPS];
-
- uint64_t background; /* Background color MSB BGR 16bpc LSB */
- uint32_t background_changed : 1;
- uint32_t background_property;
-
- uint64_t degamma_blob;
- uint32_t degamma_property;
- uint64_t ctm_blob;
- uint32_t ctm_property;
- uint64_t gamma_blob;
- uint32_t gamma_property;
- uint32_t color_mgmt_changed : 1;
+ uint64_t changed;
+ uint32_t props[IGT_NUM_CRTC_PROPS];
+ uint64_t values[IGT_NUM_CRTC_PROPS];
uint32_t crtc_id;
- uint64_t mode_blob;
- bool mode_changed;
-
int32_t out_fence_fd;
- bool out_fence_requested;
};
typedef struct {
@@ -527,17 +513,6 @@ static inline bool igt_output_is_connected(igt_output_t *output)
igt_plane_set_prop_changed(plane, prop); \
} while (0)
-/**
- * igt_atomic_populate_crtc_req:
- * @req: A pointer to drmModeAtomicReq
- * @pipe: A pointer igt_pipe_t
- * @prop: one of igt_atomic_crtc_properties
- * @value: the value to add
- */
-#define igt_atomic_populate_crtc_req(req, pipe, prop, value) \
- igt_assert_lt(0, drmModeAtomicAddProperty(req, pipe->crtc_id,\
- pipe->atomic_props_crtc[prop], value))
-
#define igt_output_is_prop_changed(output, prop) \
(!!((output)->changed & (1 << (prop))))
#define igt_output_set_prop_changed(output, prop) \
@@ -552,26 +527,34 @@ static inline bool igt_output_is_connected(igt_output_t *output)
igt_output_set_prop_changed(output, prop); \
} while (0)
-/*
- * igt_pipe_refresh:
- * @display: a pointer to an #igt_display_t structure
- * @pipe: Pipe to refresh
- * @force: Should be set to true if mode_blob is no longer considered
- * to be valid, for example after doing an atomic commit during fork or closing display fd.
- *
- * Requests the pipe to be part of the state on next update.
- * This is useful when state may have been out of sync after
- * a fork, or we just want to be sure the pipe is included
- * in the next commit.
- */
-static inline void
-igt_pipe_refresh(igt_display_t *display, enum pipe pipe, bool force)
-{
- if (force)
- display->pipes[pipe].mode_blob = 0;
+#define igt_pipe_obj_is_prop_changed(pipe_obj, prop) \
+ (!!((pipe_obj)->changed & (1 << (prop))))
- display->pipes[pipe].mode_changed = true;
-}
+#define igt_pipe_is_prop_changed(display, pipe, prop) \
+ igt_pipe_obj_is_prop_changed(&(display)->pipes[(pipe)], prop)
+
+#define igt_pipe_obj_set_prop_changed(pipe_obj, prop) \
+ (pipe_obj)->changed |= 1 << (prop)
+
+#define igt_pipe_set_prop_changed(display, pipe, prop) \
+ igt_pipe_obj_set_prop_changed(&(display)->pipes[(pipe)], prop)
+
+#define igt_pipe_obj_clear_prop_changed(pipe_obj, prop) \
+ (pipe_obj)->changed &= ~(1 << (prop))
+
+#define igt_pipe_clear_prop_changed(display, pipe, prop) \
+ igt_pipe_obj_clear_prop_changed(&(display)->pipes[(pipe)], prop)
+
+#define igt_pipe_obj_set_prop_value(pipe_obj, prop, value) \
+ do { \
+ (pipe_obj)->values[prop] = (value); \
+ igt_pipe_obj_set_prop_changed(pipe_obj, prop); \
+ } while (0)
+
+#define igt_pipe_set_prop_value(display, pipe, prop, value) \
+ igt_pipe_obj_set_prop_value(&(display)->pipes[(pipe)], prop, value)
+
+void igt_pipe_refresh(igt_display_t *display, enum pipe pipe, bool force);
void igt_enable_connectors(void);
void igt_reset_connectors(void);
diff --git a/tests/kms_atomic_interruptible.c b/tests/kms_atomic_interruptible.c
index 5570854390ea..0270c8f870bf 100644
--- a/tests/kms_atomic_interruptible.c
+++ b/tests/kms_atomic_interruptible.c
@@ -156,8 +156,8 @@ static void run_plane_test(igt_display_t *display, enum pipe pipe, igt_output_t
uint32_t count_props[3] = { 2, 1, 6 };
uint32_t props[] = {
/* crtc: 2 props */
- plane->pipe->atomic_props_crtc[IGT_CRTC_MODE_ID],
- plane->pipe->atomic_props_crtc[IGT_CRTC_ACTIVE],
+ plane->pipe->props[IGT_CRTC_MODE_ID],
+ plane->pipe->props[IGT_CRTC_ACTIVE],
/* connector: 1 prop */
output->props[IGT_CONNECTOR_CRTC_ID],
/* plane: remainder props */
@@ -253,6 +253,10 @@ static void run_plane_test(igt_display_t *display, enum pipe pipe, igt_output_t
igt_waitchildren();
+ /* The mode is unset by the forked helper, force a refresh here */
+ if (test_type == test_legacy_modeset || test_type == test_atomic_modeset)
+ igt_pipe_refresh(display, pipe, true);
+
igt_plane_set_fb(plane, NULL);
igt_plane_set_fb(primary, NULL);
igt_output_set_pipe(output, PIPE_NONE);
diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 2ae75f2d6630..7ddb65cea183 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -633,7 +633,7 @@ static unsigned set_combinations(igt_display_t *display, unsigned mask, struct i
drmModeModeInfo *mode = NULL;
if (!(mask & (1 << pipe))) {
- if (display->pipes[pipe].mode_blob) {
+ if (igt_pipe_is_prop_changed(display, pipe, IGT_CRTC_ACTIVE)) {
event_mask |= 1 << pipe;
igt_plane_set_fb(plane, NULL);
}
diff --git a/tests/kms_crtc_background_color.c b/tests/kms_crtc_background_color.c
index e12e163449f8..659a30b90219 100644
--- a/tests/kms_crtc_background_color.c
+++ b/tests/kms_crtc_background_color.c
@@ -137,7 +137,7 @@ static void test_crtc_background(data_t *data)
igt_output_set_pipe(output, pipe);
plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
- igt_require(plane->pipe->background_property);
+ igt_require(plane->pipe->props[IGT_CRTC_BACKGROUND]);
prepare_crtc(data, output, pipe, plane, 1, PURPLE, BLACK64);
--
2.14.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 25+ messages in thread
* ✗ Fi.CI.BAT: failure for lib/igt_kms: Convert properties to be more atomic-like. (rev9)
2017-09-29 9:59 [PATCH i-g-t v4 0/7] lib/igt_kms: Convert properties to be more atomic-like Maarten Lankhorst
` (8 preceding siblings ...)
2017-09-29 12:13 ` ✗ Fi.CI.IGT: failure " Patchwork
@ 2017-10-03 9:08 ` Patchwork
2017-10-03 10:22 ` Petri Latvala
2017-10-04 18:00 ` ✓ Fi.CI.BAT: success for lib/igt_kms: Convert properties to be more atomic-like. (rev11) Patchwork
2017-10-04 22:08 ` ✗ Fi.CI.IGT: warning " Patchwork
11 siblings, 1 reply; 25+ messages in thread
From: Patchwork @ 2017-10-03 9:08 UTC (permalink / raw)
To: Maarten Lankhorst; +Cc: intel-gfx
== Series Details ==
Series: lib/igt_kms: Convert properties to be more atomic-like. (rev9)
URL : https://patchwork.freedesktop.org/series/30903/
State : failure
== Summary ==
IGT patchset tested on top of latest successful build
1e3db6500dd5c5aa2cc8cb03501b50ef17d06564 lib/igt_kms: Commit primary plane when a modeset is forced on a pipe
with latest DRM-Tip kernel build CI_DRM_3164
94b58b30561d drm-tip: 2017y-10m-03d-07h-32m-14s UTC integration manifest
No testlist changes.
Test chamelium:
Subgroup dp-crc-fast:
pass -> DMESG-FAIL (fi-kbl-7500u) fdo#102514
Subgroup hdmi-crc-fast:
pass -> FAIL (fi-skl-6700k) fdo#103019
Test kms_busy:
Subgroup basic-flip-a:
pass -> FAIL (fi-blb-e6850)
pass -> FAIL (fi-bwr-2160)
pass -> FAIL (fi-elk-e7500)
pass -> FAIL (fi-ilk-650)
pass -> FAIL (fi-snb-2520m)
pass -> FAIL (fi-snb-2600)
pass -> FAIL (fi-ivb-3520m)
pass -> FAIL (fi-ivb-3770)
pass -> FAIL (fi-byt-j1900)
pass -> FAIL (fi-byt-n2820)
pass -> FAIL (fi-hsw-4770)
pass -> FAIL (fi-hsw-4770r)
pass -> FAIL (fi-bdw-5557u)
pass -> FAIL (fi-bdw-gvtdvm)
pass -> FAIL (fi-skl-6260u)
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-skl-6770hq)
pass -> FAIL (fi-skl-gvtdvm)
pass -> FAIL (fi-bxt-dsi)
pass -> FAIL (fi-bxt-j4205)
pass -> FAIL (fi-kbl-7500u)
pass -> FAIL (fi-kbl-7560u)
pass -> FAIL (fi-kbl-7567u) fdo#102294 +12
pass -> FAIL (fi-kbl-r)
pass -> FAIL (fi-glk-1)
pass -> FAIL (fi-cfl-s)
pass -> FAIL (fi-cnl-y)
Subgroup basic-flip-b:
pass -> FAIL (fi-blb-e6850)
pass -> FAIL (fi-bwr-2160)
pass -> FAIL (fi-elk-e7500)
pass -> FAIL (fi-ilk-650)
pass -> FAIL (fi-snb-2520m)
pass -> FAIL (fi-snb-2600)
pass -> FAIL (fi-ivb-3520m)
pass -> FAIL (fi-ivb-3770)
pass -> FAIL (fi-byt-j1900)
pass -> FAIL (fi-byt-n2820)
pass -> FAIL (fi-hsw-4770)
pass -> FAIL (fi-hsw-4770r)
pass -> FAIL (fi-bdw-5557u)
pass -> FAIL (fi-bdw-gvtdvm)
pass -> FAIL (fi-skl-6260u)
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-skl-6770hq)
pass -> FAIL (fi-skl-gvtdvm)
pass -> FAIL (fi-bxt-dsi) fdo#103020
pass -> FAIL (fi-bxt-j4205)
pass -> FAIL (fi-kbl-7500u)
pass -> FAIL (fi-kbl-7560u)
pass -> FAIL (fi-kbl-r)
pass -> FAIL (fi-glk-1)
pass -> FAIL (fi-cfl-s)
pass -> FAIL (fi-cnl-y)
Subgroup basic-flip-c:
pass -> FAIL (fi-ivb-3520m)
pass -> FAIL (fi-ivb-3770)
pass -> FAIL (fi-hsw-4770)
pass -> FAIL (fi-hsw-4770r)
pass -> FAIL (fi-bdw-5557u)
pass -> FAIL (fi-bdw-gvtdvm)
pass -> FAIL (fi-bsw-n3050)
pass -> FAIL (fi-skl-6260u)
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-skl-6770hq)
pass -> FAIL (fi-skl-gvtdvm)
pass -> FAIL (fi-bxt-dsi)
pass -> FAIL (fi-bxt-j4205) fdo#102035 +1
pass -> FAIL (fi-kbl-7500u)
pass -> FAIL (fi-kbl-7560u)
pass -> FAIL (fi-kbl-7567u)
pass -> FAIL (fi-kbl-r)
pass -> FAIL (fi-glk-1)
pass -> FAIL (fi-cnl-y)
Test kms_cursor_legacy:
Subgroup basic-busy-flip-before-cursor-legacy:
pass -> FAIL (fi-blb-e6850)
pass -> FAIL (fi-bwr-2160)
pass -> FAIL (fi-elk-e7500)
Subgroup basic-flip-after-cursor-legacy:
pass -> FAIL (fi-blb-e6850)
pass -> FAIL (fi-bwr-2160)
pass -> FAIL (fi-elk-e7500)
Subgroup basic-flip-after-cursor-varying-size:
pass -> FAIL (fi-blb-e6850)
pass -> FAIL (fi-bwr-2160)
pass -> FAIL (fi-elk-e7500)
Subgroup basic-flip-before-cursor-legacy:
pass -> FAIL (fi-blb-e6850)
pass -> FAIL (fi-bwr-2160)
pass -> FAIL (fi-elk-e7500)
Subgroup basic-flip-before-cursor-varying-size:
pass -> FAIL (fi-blb-e6850)
pass -> FAIL (fi-bwr-2160)
pass -> FAIL (fi-elk-e7500)
Test kms_force_connector_basic:
Subgroup force-connector-state:
pass -> FAIL (fi-bwr-2160)
pass -> FAIL (fi-elk-e7500)
pass -> FAIL (fi-snb-2520m)
pass -> FAIL (fi-snb-2600)
pass -> FAIL (fi-ivb-3520m)
pass -> FAIL (fi-ivb-3770)
pass -> FAIL (fi-byt-j1900)
Test kms_pipe_crc_basic:
Subgroup hang-read-crc-pipe-a:
pass -> FAIL (fi-blb-e6850)
pass -> FAIL (fi-bwr-2160)
pass -> FAIL (fi-elk-e7500)
pass -> FAIL (fi-ilk-650)
pass -> FAIL (fi-snb-2520m)
pass -> FAIL (fi-snb-2600)
pass -> FAIL (fi-ivb-3520m)
pass -> FAIL (fi-ivb-3770)
pass -> FAIL (fi-byt-j1900)
pass -> FAIL (fi-byt-n2820)
pass -> FAIL (fi-hsw-4770)
pass -> FAIL (fi-hsw-4770r)
pass -> FAIL (fi-bdw-5557u)
pass -> FAIL (fi-bdw-gvtdvm)
pass -> FAIL (fi-skl-6260u)
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-skl-6770hq)
pass -> FAIL (fi-skl-gvtdvm)
pass -> FAIL (fi-bxt-dsi)
pass -> FAIL (fi-bxt-j4205)
pass -> FAIL (fi-kbl-7500u)
pass -> FAIL (fi-kbl-7560u)
pass -> FAIL (fi-kbl-r)
pass -> FAIL (fi-glk-1)
pass -> FAIL (fi-cfl-s)
pass -> FAIL (fi-cnl-y)
Subgroup hang-read-crc-pipe-b:
pass -> FAIL (fi-blb-e6850)
pass -> FAIL (fi-bwr-2160)
pass -> FAIL (fi-elk-e7500)
pass -> FAIL (fi-ilk-650)
pass -> FAIL (fi-snb-2520m)
pass -> FAIL (fi-snb-2600)
pass -> FAIL (fi-ivb-3520m)
pass -> FAIL (fi-ivb-3770)
pass -> FAIL (fi-byt-j1900)
pass -> FAIL (fi-byt-n2820)
pass -> FAIL (fi-hsw-4770)
pass -> FAIL (fi-hsw-4770r)
pass -> FAIL (fi-bdw-5557u)
pass -> FAIL (fi-bdw-gvtdvm)
pass -> FAIL (fi-skl-6260u)
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-skl-6770hq)
pass -> FAIL (fi-skl-gvtdvm)
pass -> FAIL (fi-bxt-dsi)
pass -> FAIL (fi-bxt-j4205)
pass -> FAIL (fi-kbl-7500u)
pass -> FAIL (fi-kbl-7560u)
pass -> FAIL (fi-kbl-r)
pass -> FAIL (fi-glk-1)
pass -> FAIL (fi-cfl-s)
pass -> FAIL (fi-cnl-y)
Subgroup hang-read-crc-pipe-c:
pass -> FAIL (fi-ivb-3520m)
pass -> FAIL (fi-ivb-3770)
pass -> FAIL (fi-hsw-4770)
pass -> FAIL (fi-hsw-4770r)
pass -> FAIL (fi-bdw-5557u)
pass -> FAIL (fi-bdw-gvtdvm)
pass -> FAIL (fi-bsw-n3050)
pass -> FAIL (fi-skl-6260u)
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-skl-6770hq)
pass -> FAIL (fi-skl-gvtdvm)
pass -> FAIL (fi-bxt-dsi)
pass -> FAIL (fi-bxt-j4205)
pass -> FAIL (fi-kbl-7500u)
pass -> FAIL (fi-kbl-7560u)
pass -> FAIL (fi-kbl-7567u)
pass -> FAIL (fi-kbl-r)
pass -> FAIL (fi-glk-1)
pass -> FAIL (fi-cnl-y)
Subgroup nonblocking-crc-pipe-a:
pass -> FAIL (fi-blb-e6850)
pass -> FAIL (fi-bwr-2160)
pass -> FAIL (fi-elk-e7500) fdo#102364 +1
pass -> FAIL (fi-ilk-650)
pass -> FAIL (fi-snb-2520m)
pass -> FAIL (fi-snb-2600)
pass -> FAIL (fi-ivb-3520m)
pass -> FAIL (fi-ivb-3770)
pass -> FAIL (fi-byt-j1900)
pass -> FAIL (fi-byt-n2820)
pass -> FAIL (fi-hsw-4770)
pass -> FAIL (fi-hsw-4770r)
pass -> FAIL (fi-bdw-5557u)
pass -> FAIL (fi-bdw-gvtdvm)
pass -> FAIL (fi-skl-6260u)
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-skl-6770hq)
pass -> FAIL (fi-skl-gvtdvm)
pass -> FAIL (fi-bxt-dsi)
pass -> FAIL (fi-bxt-j4205)
pass -> FAIL (fi-kbl-7500u)
pass -> FAIL (fi-kbl-7560u)
pass -> FAIL (fi-kbl-r)
pass -> FAIL (fi-glk-1)
pass -> FAIL (fi-cfl-s)
pass -> FAIL (fi-cnl-y)
Subgroup nonblocking-crc-pipe-a-frame-sequence:
pass -> FAIL (fi-blb-e6850)
pass -> FAIL (fi-bwr-2160)
pass -> FAIL (fi-ilk-650)
pass -> FAIL (fi-snb-2520m)
pass -> FAIL (fi-snb-2600)
pass -> FAIL (fi-ivb-3520m)
pass -> FAIL (fi-ivb-3770)
pass -> FAIL (fi-byt-j1900)
pass -> FAIL (fi-byt-n2820)
pass -> FAIL (fi-hsw-4770)
pass -> FAIL (fi-hsw-4770r)
pass -> FAIL (fi-bdw-5557u)
pass -> FAIL (fi-bdw-gvtdvm)
pass -> FAIL (fi-skl-6260u)
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-skl-6770hq)
pass -> FAIL (fi-skl-gvtdvm)
pass -> FAIL (fi-bxt-dsi)
pass -> FAIL (fi-bxt-j4205)
pass -> FAIL (fi-kbl-7500u)
pass -> FAIL (fi-kbl-7560u)
pass -> FAIL (fi-kbl-r)
pass -> FAIL (fi-glk-1)
pass -> FAIL (fi-cfl-s)
pass -> FAIL (fi-cnl-y)
Subgroup nonblocking-crc-pipe-b:
pass -> FAIL (fi-blb-e6850)
pass -> FAIL (fi-bwr-2160)
pass -> FAIL (fi-elk-e7500)
pass -> FAIL (fi-ilk-650)
pass -> FAIL (fi-snb-2520m)
pass -> FAIL (fi-snb-2600)
pass -> FAIL (fi-ivb-3520m)
pass -> FAIL (fi-ivb-3770)
pass -> FAIL (fi-byt-j1900)
pass -> FAIL (fi-byt-n2820)
pass -> FAIL (fi-hsw-4770)
pass -> FAIL (fi-hsw-4770r)
pass -> FAIL (fi-bdw-5557u)
pass -> FAIL (fi-bdw-gvtdvm)
pass -> FAIL (fi-skl-6260u)
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-skl-6770hq)
pass -> FAIL (fi-skl-gvtdvm)
pass -> FAIL (fi-bxt-dsi)
pass -> FAIL (fi-kbl-7500u)
pass -> FAIL (fi-kbl-7560u)
pass -> FAIL (fi-kbl-r)
pass -> FAIL (fi-glk-1)
pass -> FAIL (fi-cfl-s)
pass -> FAIL (fi-cnl-y)
Subgroup nonblocking-crc-pipe-b-frame-sequence:
pass -> FAIL (fi-blb-e6850)
pass -> FAIL (fi-bwr-2160)
pass -> FAIL (fi-elk-e7500)
pass -> FAIL (fi-ilk-650)
pass -> FAIL (fi-snb-2520m)
pass -> FAIL (fi-snb-2600)
pass -> FAIL (fi-ivb-3520m)
pass -> FAIL (fi-ivb-3770)
pass -> FAIL (fi-byt-j1900) fdo#102619
pass -> FAIL (fi-byt-n2820)
pass -> FAIL (fi-hsw-4770)
pass -> FAIL (fi-hsw-4770r)
pass -> FAIL (fi-bdw-5557u)
pass -> FAIL (fi-bdw-gvtdvm)
pass -> FAIL (fi-skl-6260u)
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-skl-6770hq)
pass -> FAIL (fi-skl-gvtdvm)
pass -> FAIL (fi-bxt-dsi)
pass -> FAIL (fi-bxt-j4205)
pass -> FAIL (fi-kbl-7500u)
pass -> FAIL (fi-kbl-7560u)
pass -> FAIL (fi-kbl-r)
pass -> FAIL (fi-glk-1)
pass -> FAIL (fi-cfl-s)
pass -> FAIL (fi-cnl-y)
Subgroup nonblocking-crc-pipe-c:
pass -> FAIL (fi-ivb-3520m)
pass -> FAIL (fi-ivb-3770)
pass -> FAIL (fi-hsw-4770)
pass -> FAIL (fi-hsw-4770r)
pass -> FAIL (fi-bdw-5557u)
pass -> FAIL (fi-bdw-gvtdvm)
pass -> FAIL (fi-bsw-n3050)
pass -> FAIL (fi-skl-6260u)
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-skl-6770hq)
pass -> FAIL (fi-skl-gvtdvm)
pass -> FAIL (fi-bxt-dsi)
pass -> FAIL (fi-bxt-j4205)
pass -> FAIL (fi-kbl-7500u)
pass -> FAIL (fi-kbl-7560u)
pass -> FAIL (fi-kbl-7567u)
pass -> FAIL (fi-kbl-r)
pass -> FAIL (fi-glk-1)
pass -> FAIL (fi-cnl-y)
Subgroup nonblocking-crc-pipe-c-frame-sequence:
pass -> FAIL (fi-ivb-3520m)
pass -> FAIL (fi-ivb-3770)
pass -> FAIL (fi-hsw-4770)
pass -> FAIL (fi-hsw-4770r)
pass -> FAIL (fi-bdw-5557u)
pass -> FAIL (fi-bdw-gvtdvm)
pass -> FAIL (fi-bsw-n3050)
pass -> FAIL (fi-skl-6260u)
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-skl-6770hq)
pass -> FAIL (fi-skl-gvtdvm)
pass -> FAIL (fi-bxt-dsi)
pass -> FAIL (fi-bxt-j4205)
pass -> FAIL (fi-kbl-7500u)
pass -> FAIL (fi-kbl-7560u)
pass -> FAIL (fi-kbl-7567u)
pass -> FAIL (fi-kbl-r)
pass -> FAIL (fi-glk-1)
pass -> FAIL (fi-cnl-y)
Subgroup read-crc-pipe-a:
pass -> FAIL (fi-blb-e6850)
pass -> FAIL (fi-bwr-2160)
pass -> FAIL (fi-elk-e7500)
pass -> FAIL (fi-ilk-650)
pass -> FAIL (fi-snb-2520m)
pass -> FAIL (fi-snb-2600)
pass -> FAIL (fi-ivb-3520m)
pass -> FAIL (fi-ivb-3770)
pass -> FAIL (fi-byt-j1900)
pass -> FAIL (fi-byt-n2820)
pass -> FAIL (fi-hsw-4770)
pass -> FAIL (fi-hsw-4770r)
pass -> FAIL (fi-bdw-5557u)
pass -> FAIL (fi-bdw-gvtdvm)
pass -> FAIL (fi-skl-6260u)
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-skl-6770hq)
pass -> FAIL (fi-skl-gvtdvm)
pass -> FAIL (fi-bxt-dsi)
pass -> FAIL (fi-bxt-j4205)
pass -> FAIL (fi-kbl-7500u)
pass -> FAIL (fi-kbl-7560u)
pass -> FAIL (fi-kbl-r)
pass -> FAIL (fi-glk-1)
pass -> FAIL (fi-cfl-s)
pass -> FAIL (fi-cnl-y)
Subgroup read-crc-pipe-a-frame-sequence:
pass -> FAIL (fi-blb-e6850)
pass -> FAIL (fi-bwr-2160)
pass -> FAIL
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_285/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: ✗ Fi.CI.BAT: failure for lib/igt_kms: Convert properties to be more atomic-like. (rev9)
2017-10-03 9:08 ` ✗ Fi.CI.BAT: failure for lib/igt_kms: Convert properties to be more atomic-like. (rev9) Patchwork
@ 2017-10-03 10:22 ` Petri Latvala
0 siblings, 0 replies; 25+ messages in thread
From: Petri Latvala @ 2017-10-03 10:22 UTC (permalink / raw)
To: intel-gfx
On Tue, Oct 03, 2017 at 09:08:37AM +0000, Patchwork wrote:
> == Series Details ==
>
> Series: lib/igt_kms: Convert properties to be more atomic-like. (rev9)
> URL : https://patchwork.freedesktop.org/series/30903/
> State : failure
Maarten, why have you been pushing patches from this series without CI
ever having a success?
kms_color --r ctm-red-to-blue-pipe1 (and other subtests in kms_color
that don't skip) crash now.
Bisect results:
1e3db6500dd5c5aa2cc8cb03501b50ef17d06564 is the first bad commit
commit 1e3db6500dd5c5aa2cc8cb03501b50ef17d06564
Author: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Date: Wed Sep 27 18:17:53 2017 +0200
lib/igt_kms: Commit primary plane when a modeset is forced on a pipe
--
Petri Latvala
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH i-g-t v4 5/7] lib/igt_kms: Rework plane properties to be more atomic, v4.
2017-09-29 9:59 ` [PATCH i-g-t v4 5/7] lib/igt_kms: Rework plane properties to be more atomic, v4 Maarten Lankhorst
@ 2017-10-03 12:05 ` Mika Kahola
2017-10-04 7:26 ` Maarten Lankhorst
2017-10-04 13:54 ` [PATCH i-g-t] lib/igt_kms: Rework plane properties to be more atomic, v5 Maarten Lankhorst
0 siblings, 2 replies; 25+ messages in thread
From: Mika Kahola @ 2017-10-03 12:05 UTC (permalink / raw)
To: Maarten Lankhorst, intel-gfx
On Fri, 2017-09-29 at 11:59 +0200, Maarten Lankhorst wrote:
> In the future I want to allow tests to commit more properties,
> but for this to work I have to fix all properties to work better
> with atomic commit. Instead of special casing each
> property make a bitmask for all property changed flags, and try to
> commit all properties.
>
> Changes since v1:
> - Remove special dumping of src and crtc coordinates.
> - Dump all modified coordinates.
> Changes since v2:
> - Move igt_plane_set_prop_changed up slightly.
> Changes since v3:
> - Fix wrong ordering of set_position in kms_plane_lowres causing a
> test failure.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
> lib/igt_kms.c | 293 +++++++++++++++++----------
> ------------
> lib/igt_kms.h | 59 ++++----
> tests/kms_atomic_interruptible.c | 12 +-
> tests/kms_plane_lowres.c | 2 +-
> tests/kms_rotation_crc.c | 4 +-
> 5 files changed, 160 insertions(+), 210 deletions(-)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 07d2074c2b1a..6e0052ebe7a7 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -192,11 +192,11 @@ const char
> *igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = {
>
> /*
> * Retrieve all the properies specified in props_name and store them
> into
> - * plane->atomic_props_plane.
> + * plane->props.
> */
> static void
> -igt_atomic_fill_plane_props(igt_display_t *display, igt_plane_t
> *plane,
> - int num_props, const char **prop_names)
> +igt_fill_plane_props(igt_display_t *display, igt_plane_t *plane,
> + int num_props, const char **prop_names)
> {
> drmModeObjectPropertiesPtr props;
> int i, j, fd;
> @@ -214,7 +214,7 @@ igt_atomic_fill_plane_props(igt_display_t
> *display, igt_plane_t *plane,
> if (strcmp(prop->name, prop_names[j]) != 0)
> continue;
>
> - plane->atomic_props_plane[j] = props-
> >props[i];
> + plane->props[j] = props->props[i];
> break;
> }
>
> @@ -1659,7 +1659,6 @@ void igt_display_init(igt_display_t *display,
> int drm_fd)
> drmModeRes *resources;
> drmModePlaneRes *plane_resources;
> int i;
> - int is_atomic = 0;
>
> memset(display, 0, sizeof(igt_display_t));
>
> @@ -1679,7 +1678,9 @@ void igt_display_init(igt_display_t *display,
> int drm_fd)
> igt_assert_f(display->pipes, "Failed to allocate memory for
> %d pipes\n", display->n_pipes);
>
> drmSetClientCap(drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
> - is_atomic = drmSetClientCap(drm_fd, DRM_CLIENT_CAP_ATOMIC,
> 1);
> + if (drmSetClientCap(drm_fd, DRM_CLIENT_CAP_ATOMIC, 1) == 0)
> + display->is_atomic = 1;
> +
> plane_resources = drmModeGetPlaneResources(display->drm_fd);
> igt_assert(plane_resources);
>
> @@ -1776,19 +1777,19 @@ void igt_display_init(igt_display_t *display,
> int drm_fd)
> plane->type = type;
> plane->pipe = pipe;
> plane->drm_plane = drm_plane;
> - plane->fence_fd = -1;
> + plane->values[IGT_PLANE_IN_FENCE_FD] =
> ~0ULL;
>
> - if (is_atomic == 0) {
> - display->is_atomic = 1;
> - igt_atomic_fill_plane_props(display,
> plane, IGT_NUM_PLANE_PROPS, igt_plane_prop_names);
> - }
> + igt_fill_plane_props(display, plane,
> IGT_NUM_PLANE_PROPS, igt_plane_prop_names);
>
> get_plane_property(display->drm_fd,
> drm_plane->plane_id,
> "rotation",
> - &plane-
> >rotation_property,
> - &prop_value,
> + &plane-
> >props[IGT_PLANE_ROTATION],
> + &plane-
> >values[IGT_PLANE_ROTATION],
> NULL);
> - plane->rotation =
> (igt_rotation_t)prop_value;
> +
> + /* Clear any residual framebuffer on first
> commit. */
> + igt_plane_set_prop_changed(plane,
> IGT_PLANE_FB_ID);
> + igt_plane_set_prop_changed(plane,
> IGT_PLANE_CRTC_ID);
> }
>
> /*
> @@ -1805,9 +1806,6 @@ void igt_display_init(igt_display_t *display,
> int drm_fd)
>
> pipe->n_planes = n_planes;
>
> - for_each_plane_on_pipe(display, i, plane)
> - plane->fb_changed = true;
> -
> pipe->mode_changed = true;
> }
>
> @@ -2070,18 +2068,7 @@ bool igt_pipe_get_property(igt_pipe_t *pipe,
> const char *name,
>
> static uint32_t igt_plane_get_fb_id(igt_plane_t *plane)
> {
> - if (plane->fb)
> - return plane->fb->fb_id;
> - else
> - return 0;
> -}
> -
> -static uint32_t igt_plane_get_fb_gem_handle(igt_plane_t *plane)
> -{
> - if (plane->fb)
> - return plane->fb->gem_handle;
> - else
> - return 0;
> + return plane->values[IGT_PLANE_FB_ID];
> }
>
> #define CHECK_RETURN(r, fail) { \
> @@ -2090,9 +2077,6 @@ static uint32_t
> igt_plane_get_fb_gem_handle(igt_plane_t *plane)
> igt_assert_eq(r, 0); \
> }
>
> -
> -
> -
> /*
> * Add position and fb changes of a plane to the atomic property set
> */
> @@ -2101,63 +2085,31 @@ igt_atomic_prepare_plane_commit(igt_plane_t
> *plane, igt_pipe_t *pipe,
> drmModeAtomicReq *req)
> {
> igt_display_t *display = pipe->display;
> - uint32_t fb_id, crtc_id;
> + int i;
>
> igt_assert(plane->drm_plane);
>
> - /* it's an error to try an unsupported feature */
> - igt_assert(igt_plane_supports_rotation(plane) ||
> - !plane->rotation_changed);
> -
> - fb_id = igt_plane_get_fb_id(plane);
> - crtc_id = pipe->crtc_id;
> -
> LOG(display,
> "populating plane data: %s.%d, fb %u\n",
> kmstest_pipe_name(pipe->pipe),
> plane->index,
> - fb_id);
> -
> - if (plane->fence_fd >= 0) {
> - uint64_t fence_fd = (int64_t) plane->fence_fd;
> - igt_atomic_populate_plane_req(req, plane,
> IGT_PLANE_IN_FENCE_FD, fence_fd);
> - }
> + igt_plane_get_fb_id(plane));
>
> - if (plane->fb_changed) {
> - igt_atomic_populate_plane_req(req, plane,
> IGT_PLANE_CRTC_ID, fb_id ? crtc_id : 0);
> - igt_atomic_populate_plane_req(req, plane,
> IGT_PLANE_FB_ID, fb_id);
> - }
> -
> - if (plane->position_changed || plane->size_changed) {
> - uint32_t src_x = IGT_FIXED(plane->src_x, 0); /*
> src_x */
> - uint32_t src_y = IGT_FIXED(plane->src_y, 0); /*
> src_y */
> - uint32_t src_w = IGT_FIXED(plane->src_w, 0); /*
> src_w */
> - uint32_t src_h = IGT_FIXED(plane->src_h, 0); /*
> src_h */
> - int32_t crtc_x = plane->crtc_x;
> - int32_t crtc_y = plane->crtc_y;
> - uint32_t crtc_w = plane->crtc_w;
> - uint32_t crtc_h = plane->crtc_h;
> + for (i = 0; i < IGT_NUM_PLANE_PROPS; i++) {
> + if (!igt_plane_is_prop_changed(plane, i))
> + continue;
>
> - LOG(display,
> - "src = (%d, %d) %u x %u "
> - "dst = (%d, %d) %u x %u\n",
> - src_x >> 16, src_y >> 16, src_w >> 16, src_h >> 16,
> - crtc_x, crtc_y, crtc_w, crtc_h);
> + /* it's an error to try an unsupported feature */
> + igt_assert(plane->props[i]);
>
> - igt_atomic_populate_plane_req(req, plane,
> IGT_PLANE_SRC_X, src_x);
> - igt_atomic_populate_plane_req(req, plane,
> IGT_PLANE_SRC_Y, src_y);
> - igt_atomic_populate_plane_req(req, plane,
> IGT_PLANE_SRC_W, src_w);
> - igt_atomic_populate_plane_req(req, plane,
> IGT_PLANE_SRC_H, src_h);
> + igt_debug("plane %s.%d: Setting property \"%s\" to
> 0x%"PRIx64"/%"PRIi64"\n",
> + kmstest_pipe_name(pipe->pipe), plane->index,
> igt_plane_prop_names[i],
> + plane->values[i], plane->values[i]);
>
> - igt_atomic_populate_plane_req(req, plane,
> IGT_PLANE_CRTC_X, crtc_x);
> - igt_atomic_populate_plane_req(req, plane,
> IGT_PLANE_CRTC_Y, crtc_y);
> - igt_atomic_populate_plane_req(req, plane,
> IGT_PLANE_CRTC_W, crtc_w);
> - igt_atomic_populate_plane_req(req, plane,
> IGT_PLANE_CRTC_H, crtc_h);
> + igt_assert_lt(0, drmModeAtomicAddProperty(req,
> plane->drm_plane->plane_id,
> + plane->props[i],
> + plane-
> >values[i]));
> }
> -
> - if (plane->rotation_changed)
> - igt_atomic_populate_plane_req(req, plane,
> - IGT_PLANE_ROTATION, plane->rotation);
> }
>
>
> @@ -2183,17 +2135,20 @@ static int igt_drm_plane_commit(igt_plane_t
> *plane,
> int32_t crtc_y;
> uint32_t crtc_w;
> uint32_t crtc_h;
> + bool setplane =
> + igt_plane_is_prop_changed(plane, IGT_PLANE_FB_ID) ||
> + plane->changed & IGT_PLANE_COORD_CHANGED_MASK;
>
> igt_assert(plane->drm_plane);
>
> /* it's an error to try an unsupported feature */
> igt_assert(igt_plane_supports_rotation(plane) ||
> - !plane->rotation_changed);
> + !igt_plane_is_prop_changed(plane,
> IGT_PLANE_ROTATION));
>
> fb_id = igt_plane_get_fb_id(plane);
> crtc_id = pipe->crtc_id;
>
> - if ((plane->fb_changed || plane->size_changed) && fb_id ==
> 0) {
> + if (setplane && fb_id == 0) {
> LOG(display,
> "SetPlane pipe %s, plane %d, disabling\n",
> kmstest_pipe_name(pipe->pipe),
> @@ -2212,16 +2167,15 @@ static int igt_drm_plane_commit(igt_plane_t
> *plane,
> IGT_FIXED(0,0) /* src_h */);
>
> CHECK_RETURN(ret, fail_on_error);
> - } else if (plane->fb_changed || plane->position_changed ||
> - plane->size_changed) {
> - src_x = IGT_FIXED(plane->src_x,0); /* src_x */
> - src_y = IGT_FIXED(plane->src_y,0); /* src_y */
> - src_w = IGT_FIXED(plane->src_w,0); /* src_w */
> - src_h = IGT_FIXED(plane->src_h,0); /* src_h */
> - crtc_x = plane->crtc_x;
> - crtc_y = plane->crtc_y;
> - crtc_w = plane->crtc_w;
> - crtc_h = plane->crtc_h;
> + } else if (setplane) {
> + src_x = plane->values[IGT_PLANE_SRC_X];
> + src_y = plane->values[IGT_PLANE_SRC_Y];
> + src_w = plane->values[IGT_PLANE_SRC_W];
> + src_h = plane->values[IGT_PLANE_SRC_H];
> + crtc_x = plane->values[IGT_PLANE_CRTC_X];
> + crtc_y = plane->values[IGT_PLANE_CRTC_Y];
> + crtc_w = plane->values[IGT_PLANE_CRTC_W];
> + crtc_h = plane->values[IGT_PLANE_CRTC_H];
>
> LOG(display,
> "SetPlane %s.%d, fb %u, src = (%d, %d) "
> @@ -2245,9 +2199,10 @@ static int igt_drm_plane_commit(igt_plane_t
> *plane,
> CHECK_RETURN(ret, fail_on_error);
> }
>
> - if (plane->rotation_changed) {
> - ret = igt_plane_set_property(plane, plane-
> >rotation_property,
> - plane->rotation);
> + if (igt_plane_is_prop_changed(plane, IGT_PLANE_ROTATION)) {
> + ret = igt_plane_set_property(plane,
> + plane-
> >props[IGT_PLANE_ROTATION],
> + plane-
> >values[IGT_PLANE_ROTATION]);
>
> CHECK_RETURN(ret, fail_on_error);
> }
> @@ -2269,35 +2224,30 @@ static int
> igt_cursor_commit_legacy(igt_plane_t *cursor,
> uint32_t crtc_id = pipe->crtc_id;
> int ret;
>
> - if (cursor->fb_changed) {
> - uint32_t gem_handle =
> igt_plane_get_fb_gem_handle(cursor);
> -
> - if (gem_handle) {
> + if (igt_plane_is_prop_changed(cursor, IGT_PLANE_FB_ID)) {
> + if (cursor->gem_handle)
> LOG(display,
> "SetCursor pipe %s, fb %u %dx%d\n",
> kmstest_pipe_name(pipe->pipe),
> - gem_handle,
> - cursor->crtc_w, cursor->crtc_h);
> -
> - ret = drmModeSetCursor(display->drm_fd,
> crtc_id,
> - gem_handle,
> - cursor->crtc_w,
> - cursor->crtc_h);
> - } else {
> + cursor->gem_handle,
> + (unsigned)cursor-
> >values[IGT_PLANE_CRTC_W],
> + (unsigned)cursor-
> >values[IGT_PLANE_CRTC_H]);
> + else
> LOG(display,
> "SetCursor pipe %s, disabling\n",
> kmstest_pipe_name(pipe->pipe));
>
> - ret = drmModeSetCursor(display->drm_fd,
> crtc_id,
> - 0, 0, 0);
> - }
> -
> + ret = drmModeSetCursor(display->drm_fd, crtc_id,
> + cursor->gem_handle,
> + cursor-
> >values[IGT_PLANE_CRTC_W],
> + cursor-
> >values[IGT_PLANE_CRTC_H]);
> CHECK_RETURN(ret, fail_on_error);
> }
>
> - if (cursor->position_changed) {
> - int x = cursor->crtc_x;
> - int y = cursor->crtc_y;
> + if (igt_plane_is_prop_changed(cursor, IGT_PLANE_CRTC_X) ||
> + igt_plane_is_prop_changed(cursor, IGT_PLANE_CRTC_Y)) {
> + int x = cursor->values[IGT_PLANE_CRTC_X];
> + int y = cursor->values[IGT_PLANE_CRTC_Y];
>
> LOG(display,
> "MoveCursor pipe %s, (%d, %d)\n",
> @@ -2326,13 +2276,14 @@ static int
> igt_primary_plane_commit_legacy(igt_plane_t *primary,
> int ret;
>
> /* Primary planes can't be windowed when using a legacy
> commit */
> - igt_assert((primary->crtc_x == 0 && primary->crtc_y == 0));
> + igt_assert((primary->values[IGT_PLANE_CRTC_X] == 0 &&
> primary->values[IGT_PLANE_CRTC_Y] == 0));
>
> /* nor rotated */
> - igt_assert(!primary->rotation_changed);
> + igt_assert(!igt_plane_is_prop_changed(primary,
> IGT_PLANE_ROTATION));
>
> - if (!primary->fb_changed && !primary->position_changed &&
> - !primary->size_changed && !primary->pipe->mode_changed)
> + if (!igt_plane_is_prop_changed(primary, IGT_PLANE_FB_ID) &&
> + !(primary->changed & IGT_PLANE_COORD_CHANGED_MASK) &&
> + !primary->pipe->mode_changed)
> return 0;
>
> crtc_id = pipe->crtc_id;
> @@ -2343,19 +2294,22 @@ static int
> igt_primary_plane_commit_legacy(igt_plane_t *primary,
> mode = NULL;
>
> if (fb_id) {
> + uint32_t src_x = primary->values[IGT_PLANE_SRC_X] >>
> 16;
> + uint32_t src_y = primary->values[IGT_PLANE_SRC_Y] >>
> 16;
> +
> LOG(display,
> "%s: SetCrtc pipe %s, fb %u, src (%d, %d), "
> "mode %dx%d\n",
> igt_output_name(output),
> kmstest_pipe_name(pipe->pipe),
> fb_id,
> - primary->src_x, primary->src_y,
> + src_x, src_y,
> mode->hdisplay, mode->vdisplay);
>
> ret = drmModeSetCrtc(display->drm_fd,
> crtc_id,
> fb_id,
> - primary->src_x, primary->src_y,
> + src_x, src_y,
> &output->id,
> 1,
> mode);
> @@ -2608,18 +2562,27 @@ display_commit_changed(igt_display_t
> *display, enum igt_commit_style s)
> }
>
> for_each_plane_on_pipe(display, pipe, plane) {
> - plane->fb_changed = false;
> - plane->position_changed = false;
> - plane->size_changed = false;
> + if (s == COMMIT_ATOMIC) {
> + int fd;
> + plane->changed = 0;
>
> - if (s != COMMIT_LEGACY ||
> - !(plane->type == DRM_PLANE_TYPE_PRIMARY
> ||
> - plane->type == DRM_PLANE_TYPE_CURSOR))
> - plane->rotation_changed = false;
> + fd = plane-
> >values[IGT_PLANE_IN_FENCE_FD];
> + if (fd != -1)
> + close(fd);
>
> - if (s == COMMIT_ATOMIC)
> /* reset fence_fd to prevent it from
> being set for the next commit */
> - igt_plane_set_fence_fd(plane, -1);
> + plane->values[IGT_PLANE_IN_FENCE_FD]
> = -1;
> + } else {
> + plane->changed &=
> ~IGT_PLANE_COORD_CHANGED_MASK;
> +
> + igt_plane_clear_prop_changed(plane,
> IGT_PLANE_CRTC_ID);
> + igt_plane_clear_prop_changed(plane,
> IGT_PLANE_FB_ID);
> +
> + if (s != COMMIT_LEGACY ||
> + !(plane->type ==
> DRM_PLANE_TYPE_PRIMARY ||
> + plane->type ==
> DRM_PLANE_TYPE_CURSOR))
> + igt_plane_clear_prop_changed
> (plane, IGT_PLANE_ROTATION);
> + }
> }
> }
>
> @@ -2913,30 +2876,31 @@ void igt_plane_set_fb(igt_plane_t *plane,
> struct igt_fb *fb)
> LOG(display, "%s.%d: plane_set_fb(%d)\n",
> kmstest_pipe_name(pipe->pipe),
> plane->index, fb ? fb->fb_id : 0);
>
> - plane->fb = fb;
> + igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_ID, fb ?
> pipe->crtc_id : 0);
> + igt_plane_set_prop_value(plane, IGT_PLANE_FB_ID, fb ? fb-
> >fb_id : 0);
> +
> + if (plane->type == DRM_PLANE_TYPE_CURSOR && fb)
> + plane->gem_handle = fb->gem_handle;
> + else
> + plane->gem_handle = 0;
> +
> /* hack to keep tests working that don't call
> igt_plane_set_size() */
> if (fb) {
> /* set default plane size as fb size */
> - plane->crtc_w = fb->width;
> - plane->crtc_h = fb->height;
> + igt_plane_set_position(plane, 0, 0);
> + igt_plane_set_size(plane, fb->width, fb->height);
>
> /* set default src pos/size as fb size */
> - plane->src_x = 0;
> - plane->src_y = 0;
> - plane->src_w = fb->width;
> - plane->src_h = fb->height;
> + igt_fb_set_position(fb, plane, 0, 0);
> + igt_fb_set_size(fb, plane, fb->width, fb->height);
> } else {
> - plane->src_x = 0;
> - plane->src_y = 0;
> - plane->src_w = 0;
> - plane->src_h = 0;
> + igt_plane_set_position(plane, 0, 0);
> + igt_plane_set_size(plane, 0, 0);
>
> - plane->crtc_w = 0;
> - plane->crtc_h = 0;
> + /* set default src pos/size as fb size */
> + igt_fb_set_position(fb, plane, 0, 0);
> + igt_fb_set_size(fb, plane, 0, 0);
> }
> -
> - plane->fb_changed = true;
> - plane->size_changed = true;
> }
>
> /**
> @@ -2949,12 +2913,19 @@ void igt_plane_set_fb(igt_plane_t *plane,
> struct igt_fb *fb)
> */
> void igt_plane_set_fence_fd(igt_plane_t *plane, int fence_fd)
> {
> - close(plane->fence_fd);
> + int64_t fd;
>
> - if (fcntl(fence_fd, F_GETFD) != -1)
> - plane->fence_fd = dup(fence_fd);
> - else
> - plane->fence_fd = -1;
> + fd = plane->values[IGT_PLANE_IN_FENCE_FD];
> + if (fd != -1)
> + close(fd);
> +
> + if (fence_fd != -1) {
> + fd = dup(fence_fd);
> + igt_fail_on(fd == -1);
> + } else
> + fd = -1;
> +
> + igt_plane_set_prop_value(plane, IGT_PLANE_IN_FENCE_FD, fd);
> }
>
> void igt_plane_set_position(igt_plane_t *plane, int x, int y)
> @@ -2965,10 +2936,8 @@ void igt_plane_set_position(igt_plane_t
> *plane, int x, int y)
> LOG(display, "%s.%d: plane_set_position(%d,%d)\n",
> kmstest_pipe_name(pipe->pipe), plane->index, x, y);
>
> - plane->crtc_x = x;
> - plane->crtc_y = y;
> -
> - plane->position_changed = true;
> + igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_X, x);
> + igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_Y, y);
> }
>
> /**
> @@ -2989,10 +2958,8 @@ void igt_plane_set_size(igt_plane_t *plane,
> int w, int h)
> LOG(display, "%s.%d: plane_set_size (%dx%d)\n",
> kmstest_pipe_name(pipe->pipe), plane->index, w, h);
>
> - plane->crtc_w = w;
> - plane->crtc_h = h;
> -
> - plane->size_changed = true;
> + igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_W, w);
> + igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_H, h);
> }
>
> /**
> @@ -3014,10 +2981,8 @@ void igt_fb_set_position(struct igt_fb *fb,
> igt_plane_t *plane,
> LOG(display, "%s.%d: fb_set_position(%d,%d)\n",
> kmstest_pipe_name(pipe->pipe), plane->index, x, y);
>
> - plane->src_x = x;
> - plane->src_y = y;
> -
> - plane->fb_changed = true;
> + igt_plane_set_prop_value(plane, IGT_PLANE_SRC_X,
> IGT_FIXED(x, 0));
> + igt_plane_set_prop_value(plane, IGT_PLANE_SRC_Y,
> IGT_FIXED(y, 0));
> }
>
> /**
> @@ -3040,10 +3005,8 @@ void igt_fb_set_size(struct igt_fb *fb,
> igt_plane_t *plane,
> LOG(display, "%s.%d: fb_set_size(%dx%d)\n",
> kmstest_pipe_name(pipe->pipe), plane->index, w, h);
>
> - plane->src_w = w;
> - plane->src_h = h;
> -
> - plane->fb_changed = true;
> + igt_plane_set_prop_value(plane, IGT_PLANE_SRC_W,
> IGT_FIXED(w, 0));
> + igt_plane_set_prop_value(plane, IGT_PLANE_SRC_H,
> IGT_FIXED(h, 0));
> }
>
> static const char *rotation_name(igt_rotation_t rotation)
> @@ -3071,9 +3034,7 @@ void igt_plane_set_rotation(igt_plane_t *plane,
> igt_rotation_t rotation)
> kmstest_pipe_name(pipe->pipe),
> plane->index, rotation_name(rotation));
>
> - plane->rotation = rotation;
> -
> - plane->rotation_changed = true;
> + igt_plane_set_prop_value(plane, IGT_PLANE_ROTATION,
> rotation);
> }
>
> /**
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 1ef10e7d525c..f87f8be31421 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -252,6 +252,9 @@ enum igt_atomic_plane_properties {
> IGT_PLANE_CRTC_W,
> IGT_PLANE_CRTC_H,
>
> +/* Append new properties after IGT_PLANE_COORD_CHANGED_MASK */
> +#define IGT_PLANE_COORD_CHANGED_MASK 0xff
> +
> IGT_PLANE_FB_ID,
> IGT_PLANE_CRTC_ID,
> IGT_PLANE_IN_FENCE_FD,
> @@ -286,37 +289,19 @@ typedef struct {
> int index;
> /* capabilities */
> int type;
> - /* state tracking */
> - unsigned int fb_changed : 1;
> - unsigned int position_changed : 1;
> - unsigned int rotation_changed : 1;
> - unsigned int size_changed : 1;
> +
> /*
> * drm_plane can be NULL for primary and cursor planes (when
> not
> * using the atomic modeset API)
> */
> drmModePlane *drm_plane;
> - struct igt_fb *fb;
> -
> - uint32_t rotation_property;
> -
> - /* position within pipe_src_w x pipe_src_h */
> - int crtc_x, crtc_y;
> - /* size within pipe_src_w x pipe_src_h */
> - int crtc_w, crtc_h;
>
> - /* position within the framebuffer */
> - uint32_t src_x;
> - uint32_t src_y;
> - /* size within the framebuffer*/
> - uint32_t src_w;
> - uint32_t src_h;
> + /* gem handle for fb */
> + uint32_t gem_handle;
>
> - igt_rotation_t rotation;
> -
> - /* in fence fd */
> - int fence_fd;
> - uint32_t atomic_props_plane[IGT_NUM_PLANE_PROPS];
> + uint64_t changed;
> + uint32_t props[IGT_NUM_PLANE_PROPS];
> + uint64_t values[IGT_NUM_PLANE_PROPS];
> } igt_plane_t;
>
> struct igt_pipe {
> @@ -407,7 +392,7 @@ bool igt_pipe_get_property(igt_pipe_t *pipe,
> const char *name,
>
> static inline bool igt_plane_supports_rotation(igt_plane_t *plane)
> {
> - return plane->rotation_property != 0;
> + return plane->props[IGT_PLANE_ROTATION] != 0;
> }
> void igt_pipe_request_out_fence(igt_pipe_t *pipe);
> void igt_pipe_set_degamma_lut(igt_pipe_t *pipe, void *ptr, size_t
> length);
> @@ -527,16 +512,20 @@ static inline bool
> igt_output_is_connected(igt_output_t *output)
>
> #define IGT_FIXED(i,f) ((i) << 16 | (f))
>
> -/**
> - * igt_atomic_populate_plane_req:
> - * @req: A pointer to drmModeAtomicReq
> - * @plane: A pointer igt_plane_t
> - * @prop: one of igt_atomic_plane_properties
> - * @value: the value to add
> - */
> -#define igt_atomic_populate_plane_req(req, plane, prop, value) \
> - igt_assert_lt(0, drmModeAtomicAddProperty(req, plane-
> >drm_plane->plane_id,\
> - plane-
> >atomic_props_plane[prop], value))
> +#define igt_plane_is_prop_changed(plane, prop) \
> + (!!((plane)->changed & (1 << (prop))))
> +
> +#define igt_plane_set_prop_changed(plane, prop) \
> + (plane)->changed |= 1 << (prop)
> +
> +#define igt_plane_clear_prop_changed(plane, prop) \
> + (plane)->changed &= ~(1 << (prop))
> +
> +#define igt_plane_set_prop_value(plane, prop, value) \
> + do { \
> + plane->values[prop] = value; \
> + igt_plane_set_prop_changed(plane, prop); \
> + } while (0)
>
> /**
> * igt_atomic_populate_crtc_req:
> diff --git a/tests/kms_atomic_interruptible.c
> b/tests/kms_atomic_interruptible.c
> index 2d19fe967809..5570854390ea 100644
> --- a/tests/kms_atomic_interruptible.c
> +++ b/tests/kms_atomic_interruptible.c
> @@ -161,12 +161,12 @@ static void run_plane_test(igt_display_t
> *display, enum pipe pipe, igt_output_t
> /* connector: 1 prop */
> output-
> >props[IGT_CONNECTOR_CRTC_ID],
> /* plane: remainder props */
> - plane-
> >atomic_props_plane[IGT_PLANE_CRTC_ID],
> - plane-
> >atomic_props_plane[IGT_PLANE_FB_ID],
> - plane-
> >atomic_props_plane[IGT_PLANE_SRC_W],
> - plane-
> >atomic_props_plane[IGT_PLANE_SRC_H],
> - plane-
> >atomic_props_plane[IGT_PLANE_CRTC_W],
> - plane-
> >atomic_props_plane[IGT_PLANE_CRTC_H]
> + plane-
> >props[IGT_PLANE_CRTC_ID],
> + plane-
> >props[IGT_PLANE_FB_ID],
> + plane-
> >props[IGT_PLANE_SRC_W],
> + plane-
> >props[IGT_PLANE_SRC_H],
> + plane-
> >props[IGT_PLANE_CRTC_W],
> + plane-
> >props[IGT_PLANE_CRTC_H]
> };
> uint64_t prop_vals[] = {
> /* crtc */
> diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c
> index b16c8cd433b2..613f68899601 100644
> --- a/tests/kms_plane_lowres.c
> +++ b/tests/kms_plane_lowres.c
> @@ -227,8 +227,8 @@ test_setup(data_t *data, enum pipe pipe, uint64_t
> modifier, int flags,
> 1.0, 1.0, 0.0,
> &data->fb[i]);
>
> - igt_plane_set_position(data->plane[i], x, y);
> igt_plane_set_fb(data->plane[i], &data->fb[i]);
> + igt_plane_set_position(data->plane[i], x, y);
This part could be split into a separate patch as it fixes an error.
BTW why do we need to igt_plane_set_fb() before
igt_plane_set_position()
> }
>
> return mode;
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> index 4d2ef1c184f0..4932a0d44410 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -122,11 +122,11 @@ static void prepare_crtc(data_t *data,
> igt_output_t *output, enum pipe pipe,
> igt_plane_set_fb(primary, &data->fb_modeset);
>
> if (commit < COMMIT_ATOMIC) {
> - primary->rotation_changed = false;
> + igt_plane_clear_prop_changed(primary,
> IGT_PLANE_ROTATION);
> igt_display_commit(display);
>
> if (plane->type == DRM_PLANE_TYPE_PRIMARY)
> - primary->rotation_changed = true;
> + igt_plane_set_prop_changed(primary,
> IGT_PLANE_ROTATION);
> }
>
> igt_plane_set_fb(plane, NULL);
--
Mika Kahola - Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH i-g-t v4 5/7] lib/igt_kms: Rework plane properties to be more atomic, v4.
2017-10-03 12:05 ` Mika Kahola
@ 2017-10-04 7:26 ` Maarten Lankhorst
2017-10-04 13:54 ` [PATCH i-g-t] lib/igt_kms: Rework plane properties to be more atomic, v5 Maarten Lankhorst
1 sibling, 0 replies; 25+ messages in thread
From: Maarten Lankhorst @ 2017-10-04 7:26 UTC (permalink / raw)
To: mika.kahola, intel-gfx
Op 03-10-17 om 14:05 schreef Mika Kahola:
> On Fri, 2017-09-29 at 11:59 +0200, Maarten Lankhorst wrote:
>> In the future I want to allow tests to commit more properties,
>> but for this to work I have to fix all properties to work better
>> with atomic commit. Instead of special casing each
>> property make a bitmask for all property changed flags, and try to
>> commit all properties.
>>
>> Changes since v1:
>> - Remove special dumping of src and crtc coordinates.
>> - Dump all modified coordinates.
>> Changes since v2:
>> - Move igt_plane_set_prop_changed up slightly.
>> Changes since v3:
>> - Fix wrong ordering of set_position in kms_plane_lowres causing a
>> test failure.
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> ---
>> lib/igt_kms.c | 293 +++++++++++++++++----------
>> ------------
>> lib/igt_kms.h | 59 ++++----
>> tests/kms_atomic_interruptible.c | 12 +-
>> tests/kms_plane_lowres.c | 2 +-
>> tests/kms_rotation_crc.c | 4 +-
>> 5 files changed, 160 insertions(+), 210 deletions(-)
>>
>> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
>> index 07d2074c2b1a..6e0052ebe7a7 100644
>> --- a/lib/igt_kms.c
>> +++ b/lib/igt_kms.c
>> @@ -192,11 +192,11 @@ const char
>> *igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = {
>>
>> /*
>> * Retrieve all the properies specified in props_name and store them
>> into
>> - * plane->atomic_props_plane.
>> + * plane->props.
>> */
>> static void
>> -igt_atomic_fill_plane_props(igt_display_t *display, igt_plane_t
>> *plane,
>> - int num_props, const char **prop_names)
>> +igt_fill_plane_props(igt_display_t *display, igt_plane_t *plane,
>> + int num_props, const char **prop_names)
>> {
>> drmModeObjectPropertiesPtr props;
>> int i, j, fd;
>> @@ -214,7 +214,7 @@ igt_atomic_fill_plane_props(igt_display_t
>> *display, igt_plane_t *plane,
>> if (strcmp(prop->name, prop_names[j]) != 0)
>> continue;
>>
>> - plane->atomic_props_plane[j] = props-
>>> props[i];
>> + plane->props[j] = props->props[i];
>> break;
>> }
>>
>> @@ -1659,7 +1659,6 @@ void igt_display_init(igt_display_t *display,
>> int drm_fd)
>> drmModeRes *resources;
>> drmModePlaneRes *plane_resources;
>> int i;
>> - int is_atomic = 0;
>>
>> memset(display, 0, sizeof(igt_display_t));
>>
>> @@ -1679,7 +1678,9 @@ void igt_display_init(igt_display_t *display,
>> int drm_fd)
>> igt_assert_f(display->pipes, "Failed to allocate memory for
>> %d pipes\n", display->n_pipes);
>>
>> drmSetClientCap(drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
>> - is_atomic = drmSetClientCap(drm_fd, DRM_CLIENT_CAP_ATOMIC,
>> 1);
>> + if (drmSetClientCap(drm_fd, DRM_CLIENT_CAP_ATOMIC, 1) == 0)
>> + display->is_atomic = 1;
>> +
>> plane_resources = drmModeGetPlaneResources(display->drm_fd);
>> igt_assert(plane_resources);
>>
>> @@ -1776,19 +1777,19 @@ void igt_display_init(igt_display_t *display,
>> int drm_fd)
>> plane->type = type;
>> plane->pipe = pipe;
>> plane->drm_plane = drm_plane;
>> - plane->fence_fd = -1;
>> + plane->values[IGT_PLANE_IN_FENCE_FD] =
>> ~0ULL;
>>
>> - if (is_atomic == 0) {
>> - display->is_atomic = 1;
>> - igt_atomic_fill_plane_props(display,
>> plane, IGT_NUM_PLANE_PROPS, igt_plane_prop_names);
>> - }
>> + igt_fill_plane_props(display, plane,
>> IGT_NUM_PLANE_PROPS, igt_plane_prop_names);
>>
>> get_plane_property(display->drm_fd,
>> drm_plane->plane_id,
>> "rotation",
>> - &plane-
>>> rotation_property,
>> - &prop_value,
>> + &plane-
>>> props[IGT_PLANE_ROTATION],
>> + &plane-
>>> values[IGT_PLANE_ROTATION],
>> NULL);
>> - plane->rotation =
>> (igt_rotation_t)prop_value;
>> +
>> + /* Clear any residual framebuffer on first
>> commit. */
>> + igt_plane_set_prop_changed(plane,
>> IGT_PLANE_FB_ID);
>> + igt_plane_set_prop_changed(plane,
>> IGT_PLANE_CRTC_ID);
>> }
>>
>> /*
>> @@ -1805,9 +1806,6 @@ void igt_display_init(igt_display_t *display,
>> int drm_fd)
>>
>> pipe->n_planes = n_planes;
>>
>> - for_each_plane_on_pipe(display, i, plane)
>> - plane->fb_changed = true;
>> -
>> pipe->mode_changed = true;
>> }
>>
>> @@ -2070,18 +2068,7 @@ bool igt_pipe_get_property(igt_pipe_t *pipe,
>> const char *name,
>>
>> static uint32_t igt_plane_get_fb_id(igt_plane_t *plane)
>> {
>> - if (plane->fb)
>> - return plane->fb->fb_id;
>> - else
>> - return 0;
>> -}
>> -
>> -static uint32_t igt_plane_get_fb_gem_handle(igt_plane_t *plane)
>> -{
>> - if (plane->fb)
>> - return plane->fb->gem_handle;
>> - else
>> - return 0;
>> + return plane->values[IGT_PLANE_FB_ID];
>> }
>>
>> #define CHECK_RETURN(r, fail) { \
>> @@ -2090,9 +2077,6 @@ static uint32_t
>> igt_plane_get_fb_gem_handle(igt_plane_t *plane)
>> igt_assert_eq(r, 0); \
>> }
>>
>> -
>> -
>> -
>> /*
>> * Add position and fb changes of a plane to the atomic property set
>> */
>> @@ -2101,63 +2085,31 @@ igt_atomic_prepare_plane_commit(igt_plane_t
>> *plane, igt_pipe_t *pipe,
>> drmModeAtomicReq *req)
>> {
>> igt_display_t *display = pipe->display;
>> - uint32_t fb_id, crtc_id;
>> + int i;
>>
>> igt_assert(plane->drm_plane);
>>
>> - /* it's an error to try an unsupported feature */
>> - igt_assert(igt_plane_supports_rotation(plane) ||
>> - !plane->rotation_changed);
>> -
>> - fb_id = igt_plane_get_fb_id(plane);
>> - crtc_id = pipe->crtc_id;
>> -
>> LOG(display,
>> "populating plane data: %s.%d, fb %u\n",
>> kmstest_pipe_name(pipe->pipe),
>> plane->index,
>> - fb_id);
>> -
>> - if (plane->fence_fd >= 0) {
>> - uint64_t fence_fd = (int64_t) plane->fence_fd;
>> - igt_atomic_populate_plane_req(req, plane,
>> IGT_PLANE_IN_FENCE_FD, fence_fd);
>> - }
>> + igt_plane_get_fb_id(plane));
>>
>> - if (plane->fb_changed) {
>> - igt_atomic_populate_plane_req(req, plane,
>> IGT_PLANE_CRTC_ID, fb_id ? crtc_id : 0);
>> - igt_atomic_populate_plane_req(req, plane,
>> IGT_PLANE_FB_ID, fb_id);
>> - }
>> -
>> - if (plane->position_changed || plane->size_changed) {
>> - uint32_t src_x = IGT_FIXED(plane->src_x, 0); /*
>> src_x */
>> - uint32_t src_y = IGT_FIXED(plane->src_y, 0); /*
>> src_y */
>> - uint32_t src_w = IGT_FIXED(plane->src_w, 0); /*
>> src_w */
>> - uint32_t src_h = IGT_FIXED(plane->src_h, 0); /*
>> src_h */
>> - int32_t crtc_x = plane->crtc_x;
>> - int32_t crtc_y = plane->crtc_y;
>> - uint32_t crtc_w = plane->crtc_w;
>> - uint32_t crtc_h = plane->crtc_h;
>> + for (i = 0; i < IGT_NUM_PLANE_PROPS; i++) {
>> + if (!igt_plane_is_prop_changed(plane, i))
>> + continue;
>>
>> - LOG(display,
>> - "src = (%d, %d) %u x %u "
>> - "dst = (%d, %d) %u x %u\n",
>> - src_x >> 16, src_y >> 16, src_w >> 16, src_h >> 16,
>> - crtc_x, crtc_y, crtc_w, crtc_h);
>> + /* it's an error to try an unsupported feature */
>> + igt_assert(plane->props[i]);
>>
>> - igt_atomic_populate_plane_req(req, plane,
>> IGT_PLANE_SRC_X, src_x);
>> - igt_atomic_populate_plane_req(req, plane,
>> IGT_PLANE_SRC_Y, src_y);
>> - igt_atomic_populate_plane_req(req, plane,
>> IGT_PLANE_SRC_W, src_w);
>> - igt_atomic_populate_plane_req(req, plane,
>> IGT_PLANE_SRC_H, src_h);
>> + igt_debug("plane %s.%d: Setting property \"%s\" to
>> 0x%"PRIx64"/%"PRIi64"\n",
>> + kmstest_pipe_name(pipe->pipe), plane->index,
>> igt_plane_prop_names[i],
>> + plane->values[i], plane->values[i]);
>>
>> - igt_atomic_populate_plane_req(req, plane,
>> IGT_PLANE_CRTC_X, crtc_x);
>> - igt_atomic_populate_plane_req(req, plane,
>> IGT_PLANE_CRTC_Y, crtc_y);
>> - igt_atomic_populate_plane_req(req, plane,
>> IGT_PLANE_CRTC_W, crtc_w);
>> - igt_atomic_populate_plane_req(req, plane,
>> IGT_PLANE_CRTC_H, crtc_h);
>> + igt_assert_lt(0, drmModeAtomicAddProperty(req,
>> plane->drm_plane->plane_id,
>> + plane->props[i],
>> + plane-
>>> values[i]));
>> }
>> -
>> - if (plane->rotation_changed)
>> - igt_atomic_populate_plane_req(req, plane,
>> - IGT_PLANE_ROTATION, plane->rotation);
>> }
>>
>>
>> @@ -2183,17 +2135,20 @@ static int igt_drm_plane_commit(igt_plane_t
>> *plane,
>> int32_t crtc_y;
>> uint32_t crtc_w;
>> uint32_t crtc_h;
>> + bool setplane =
>> + igt_plane_is_prop_changed(plane, IGT_PLANE_FB_ID) ||
>> + plane->changed & IGT_PLANE_COORD_CHANGED_MASK;
>>
>> igt_assert(plane->drm_plane);
>>
>> /* it's an error to try an unsupported feature */
>> igt_assert(igt_plane_supports_rotation(plane) ||
>> - !plane->rotation_changed);
>> + !igt_plane_is_prop_changed(plane,
>> IGT_PLANE_ROTATION));
>>
>> fb_id = igt_plane_get_fb_id(plane);
>> crtc_id = pipe->crtc_id;
>>
>> - if ((plane->fb_changed || plane->size_changed) && fb_id ==
>> 0) {
>> + if (setplane && fb_id == 0) {
>> LOG(display,
>> "SetPlane pipe %s, plane %d, disabling\n",
>> kmstest_pipe_name(pipe->pipe),
>> @@ -2212,16 +2167,15 @@ static int igt_drm_plane_commit(igt_plane_t
>> *plane,
>> IGT_FIXED(0,0) /* src_h */);
>>
>> CHECK_RETURN(ret, fail_on_error);
>> - } else if (plane->fb_changed || plane->position_changed ||
>> - plane->size_changed) {
>> - src_x = IGT_FIXED(plane->src_x,0); /* src_x */
>> - src_y = IGT_FIXED(plane->src_y,0); /* src_y */
>> - src_w = IGT_FIXED(plane->src_w,0); /* src_w */
>> - src_h = IGT_FIXED(plane->src_h,0); /* src_h */
>> - crtc_x = plane->crtc_x;
>> - crtc_y = plane->crtc_y;
>> - crtc_w = plane->crtc_w;
>> - crtc_h = plane->crtc_h;
>> + } else if (setplane) {
>> + src_x = plane->values[IGT_PLANE_SRC_X];
>> + src_y = plane->values[IGT_PLANE_SRC_Y];
>> + src_w = plane->values[IGT_PLANE_SRC_W];
>> + src_h = plane->values[IGT_PLANE_SRC_H];
>> + crtc_x = plane->values[IGT_PLANE_CRTC_X];
>> + crtc_y = plane->values[IGT_PLANE_CRTC_Y];
>> + crtc_w = plane->values[IGT_PLANE_CRTC_W];
>> + crtc_h = plane->values[IGT_PLANE_CRTC_H];
>>
>> LOG(display,
>> "SetPlane %s.%d, fb %u, src = (%d, %d) "
>> @@ -2245,9 +2199,10 @@ static int igt_drm_plane_commit(igt_plane_t
>> *plane,
>> CHECK_RETURN(ret, fail_on_error);
>> }
>>
>> - if (plane->rotation_changed) {
>> - ret = igt_plane_set_property(plane, plane-
>>> rotation_property,
>> - plane->rotation);
>> + if (igt_plane_is_prop_changed(plane, IGT_PLANE_ROTATION)) {
>> + ret = igt_plane_set_property(plane,
>> + plane-
>>> props[IGT_PLANE_ROTATION],
>> + plane-
>>> values[IGT_PLANE_ROTATION]);
>>
>> CHECK_RETURN(ret, fail_on_error);
>> }
>> @@ -2269,35 +2224,30 @@ static int
>> igt_cursor_commit_legacy(igt_plane_t *cursor,
>> uint32_t crtc_id = pipe->crtc_id;
>> int ret;
>>
>> - if (cursor->fb_changed) {
>> - uint32_t gem_handle =
>> igt_plane_get_fb_gem_handle(cursor);
>> -
>> - if (gem_handle) {
>> + if (igt_plane_is_prop_changed(cursor, IGT_PLANE_FB_ID)) {
>> + if (cursor->gem_handle)
>> LOG(display,
>> "SetCursor pipe %s, fb %u %dx%d\n",
>> kmstest_pipe_name(pipe->pipe),
>> - gem_handle,
>> - cursor->crtc_w, cursor->crtc_h);
>> -
>> - ret = drmModeSetCursor(display->drm_fd,
>> crtc_id,
>> - gem_handle,
>> - cursor->crtc_w,
>> - cursor->crtc_h);
>> - } else {
>> + cursor->gem_handle,
>> + (unsigned)cursor-
>>> values[IGT_PLANE_CRTC_W],
>> + (unsigned)cursor-
>>> values[IGT_PLANE_CRTC_H]);
>> + else
>> LOG(display,
>> "SetCursor pipe %s, disabling\n",
>> kmstest_pipe_name(pipe->pipe));
>>
>> - ret = drmModeSetCursor(display->drm_fd,
>> crtc_id,
>> - 0, 0, 0);
>> - }
>> -
>> + ret = drmModeSetCursor(display->drm_fd, crtc_id,
>> + cursor->gem_handle,
>> + cursor-
>>> values[IGT_PLANE_CRTC_W],
>> + cursor-
>>> values[IGT_PLANE_CRTC_H]);
>> CHECK_RETURN(ret, fail_on_error);
>> }
>>
>> - if (cursor->position_changed) {
>> - int x = cursor->crtc_x;
>> - int y = cursor->crtc_y;
>> + if (igt_plane_is_prop_changed(cursor, IGT_PLANE_CRTC_X) ||
>> + igt_plane_is_prop_changed(cursor, IGT_PLANE_CRTC_Y)) {
>> + int x = cursor->values[IGT_PLANE_CRTC_X];
>> + int y = cursor->values[IGT_PLANE_CRTC_Y];
>>
>> LOG(display,
>> "MoveCursor pipe %s, (%d, %d)\n",
>> @@ -2326,13 +2276,14 @@ static int
>> igt_primary_plane_commit_legacy(igt_plane_t *primary,
>> int ret;
>>
>> /* Primary planes can't be windowed when using a legacy
>> commit */
>> - igt_assert((primary->crtc_x == 0 && primary->crtc_y == 0));
>> + igt_assert((primary->values[IGT_PLANE_CRTC_X] == 0 &&
>> primary->values[IGT_PLANE_CRTC_Y] == 0));
>>
>> /* nor rotated */
>> - igt_assert(!primary->rotation_changed);
>> + igt_assert(!igt_plane_is_prop_changed(primary,
>> IGT_PLANE_ROTATION));
>>
>> - if (!primary->fb_changed && !primary->position_changed &&
>> - !primary->size_changed && !primary->pipe->mode_changed)
>> + if (!igt_plane_is_prop_changed(primary, IGT_PLANE_FB_ID) &&
>> + !(primary->changed & IGT_PLANE_COORD_CHANGED_MASK) &&
>> + !primary->pipe->mode_changed)
>> return 0;
>>
>> crtc_id = pipe->crtc_id;
>> @@ -2343,19 +2294,22 @@ static int
>> igt_primary_plane_commit_legacy(igt_plane_t *primary,
>> mode = NULL;
>>
>> if (fb_id) {
>> + uint32_t src_x = primary->values[IGT_PLANE_SRC_X] >>
>> 16;
>> + uint32_t src_y = primary->values[IGT_PLANE_SRC_Y] >>
>> 16;
>> +
>> LOG(display,
>> "%s: SetCrtc pipe %s, fb %u, src (%d, %d), "
>> "mode %dx%d\n",
>> igt_output_name(output),
>> kmstest_pipe_name(pipe->pipe),
>> fb_id,
>> - primary->src_x, primary->src_y,
>> + src_x, src_y,
>> mode->hdisplay, mode->vdisplay);
>>
>> ret = drmModeSetCrtc(display->drm_fd,
>> crtc_id,
>> fb_id,
>> - primary->src_x, primary->src_y,
>> + src_x, src_y,
>> &output->id,
>> 1,
>> mode);
>> @@ -2608,18 +2562,27 @@ display_commit_changed(igt_display_t
>> *display, enum igt_commit_style s)
>> }
>>
>> for_each_plane_on_pipe(display, pipe, plane) {
>> - plane->fb_changed = false;
>> - plane->position_changed = false;
>> - plane->size_changed = false;
>> + if (s == COMMIT_ATOMIC) {
>> + int fd;
>> + plane->changed = 0;
>>
>> - if (s != COMMIT_LEGACY ||
>> - !(plane->type == DRM_PLANE_TYPE_PRIMARY
>> ||
>> - plane->type == DRM_PLANE_TYPE_CURSOR))
>> - plane->rotation_changed = false;
>> + fd = plane-
>>> values[IGT_PLANE_IN_FENCE_FD];
>> + if (fd != -1)
>> + close(fd);
>>
>> - if (s == COMMIT_ATOMIC)
>> /* reset fence_fd to prevent it from
>> being set for the next commit */
>> - igt_plane_set_fence_fd(plane, -1);
>> + plane->values[IGT_PLANE_IN_FENCE_FD]
>> = -1;
>> + } else {
>> + plane->changed &=
>> ~IGT_PLANE_COORD_CHANGED_MASK;
>> +
>> + igt_plane_clear_prop_changed(plane,
>> IGT_PLANE_CRTC_ID);
>> + igt_plane_clear_prop_changed(plane,
>> IGT_PLANE_FB_ID);
>> +
>> + if (s != COMMIT_LEGACY ||
>> + !(plane->type ==
>> DRM_PLANE_TYPE_PRIMARY ||
>> + plane->type ==
>> DRM_PLANE_TYPE_CURSOR))
>> + igt_plane_clear_prop_changed
>> (plane, IGT_PLANE_ROTATION);
>> + }
>> }
>> }
>>
>> @@ -2913,30 +2876,31 @@ void igt_plane_set_fb(igt_plane_t *plane,
>> struct igt_fb *fb)
>> LOG(display, "%s.%d: plane_set_fb(%d)\n",
>> kmstest_pipe_name(pipe->pipe),
>> plane->index, fb ? fb->fb_id : 0);
>>
>> - plane->fb = fb;
>> + igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_ID, fb ?
>> pipe->crtc_id : 0);
>> + igt_plane_set_prop_value(plane, IGT_PLANE_FB_ID, fb ? fb-
>>> fb_id : 0);
>> +
>> + if (plane->type == DRM_PLANE_TYPE_CURSOR && fb)
>> + plane->gem_handle = fb->gem_handle;
>> + else
>> + plane->gem_handle = 0;
>> +
>> /* hack to keep tests working that don't call
>> igt_plane_set_size() */
>> if (fb) {
>> /* set default plane size as fb size */
>> - plane->crtc_w = fb->width;
>> - plane->crtc_h = fb->height;
>> + igt_plane_set_position(plane, 0, 0);
>> + igt_plane_set_size(plane, fb->width, fb->height);
>>
>> /* set default src pos/size as fb size */
>> - plane->src_x = 0;
>> - plane->src_y = 0;
>> - plane->src_w = fb->width;
>> - plane->src_h = fb->height;
>> + igt_fb_set_position(fb, plane, 0, 0);
>> + igt_fb_set_size(fb, plane, fb->width, fb->height);
>> } else {
>> - plane->src_x = 0;
>> - plane->src_y = 0;
>> - plane->src_w = 0;
>> - plane->src_h = 0;
>> + igt_plane_set_position(plane, 0, 0);
>> + igt_plane_set_size(plane, 0, 0);
>>
>> - plane->crtc_w = 0;
>> - plane->crtc_h = 0;
>> + /* set default src pos/size as fb size */
>> + igt_fb_set_position(fb, plane, 0, 0);
>> + igt_fb_set_size(fb, plane, 0, 0);
>> }
>> -
>> - plane->fb_changed = true;
>> - plane->size_changed = true;
>> }
>>
>> /**
>> @@ -2949,12 +2913,19 @@ void igt_plane_set_fb(igt_plane_t *plane,
>> struct igt_fb *fb)
>> */
>> void igt_plane_set_fence_fd(igt_plane_t *plane, int fence_fd)
>> {
>> - close(plane->fence_fd);
>> + int64_t fd;
>>
>> - if (fcntl(fence_fd, F_GETFD) != -1)
>> - plane->fence_fd = dup(fence_fd);
>> - else
>> - plane->fence_fd = -1;
>> + fd = plane->values[IGT_PLANE_IN_FENCE_FD];
>> + if (fd != -1)
>> + close(fd);
>> +
>> + if (fence_fd != -1) {
>> + fd = dup(fence_fd);
>> + igt_fail_on(fd == -1);
>> + } else
>> + fd = -1;
>> +
>> + igt_plane_set_prop_value(plane, IGT_PLANE_IN_FENCE_FD, fd);
>> }
>>
>> void igt_plane_set_position(igt_plane_t *plane, int x, int y)
>> @@ -2965,10 +2936,8 @@ void igt_plane_set_position(igt_plane_t
>> *plane, int x, int y)
>> LOG(display, "%s.%d: plane_set_position(%d,%d)\n",
>> kmstest_pipe_name(pipe->pipe), plane->index, x, y);
>>
>> - plane->crtc_x = x;
>> - plane->crtc_y = y;
>> -
>> - plane->position_changed = true;
>> + igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_X, x);
>> + igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_Y, y);
>> }
>>
>> /**
>> @@ -2989,10 +2958,8 @@ void igt_plane_set_size(igt_plane_t *plane,
>> int w, int h)
>> LOG(display, "%s.%d: plane_set_size (%dx%d)\n",
>> kmstest_pipe_name(pipe->pipe), plane->index, w, h);
>>
>> - plane->crtc_w = w;
>> - plane->crtc_h = h;
>> -
>> - plane->size_changed = true;
>> + igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_W, w);
>> + igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_H, h);
>> }
>>
>> /**
>> @@ -3014,10 +2981,8 @@ void igt_fb_set_position(struct igt_fb *fb,
>> igt_plane_t *plane,
>> LOG(display, "%s.%d: fb_set_position(%d,%d)\n",
>> kmstest_pipe_name(pipe->pipe), plane->index, x, y);
>>
>> - plane->src_x = x;
>> - plane->src_y = y;
>> -
>> - plane->fb_changed = true;
>> + igt_plane_set_prop_value(plane, IGT_PLANE_SRC_X,
>> IGT_FIXED(x, 0));
>> + igt_plane_set_prop_value(plane, IGT_PLANE_SRC_Y,
>> IGT_FIXED(y, 0));
>> }
>>
>> /**
>> @@ -3040,10 +3005,8 @@ void igt_fb_set_size(struct igt_fb *fb,
>> igt_plane_t *plane,
>> LOG(display, "%s.%d: fb_set_size(%dx%d)\n",
>> kmstest_pipe_name(pipe->pipe), plane->index, w, h);
>>
>> - plane->src_w = w;
>> - plane->src_h = h;
>> -
>> - plane->fb_changed = true;
>> + igt_plane_set_prop_value(plane, IGT_PLANE_SRC_W,
>> IGT_FIXED(w, 0));
>> + igt_plane_set_prop_value(plane, IGT_PLANE_SRC_H,
>> IGT_FIXED(h, 0));
>> }
>>
>> static const char *rotation_name(igt_rotation_t rotation)
>> @@ -3071,9 +3034,7 @@ void igt_plane_set_rotation(igt_plane_t *plane,
>> igt_rotation_t rotation)
>> kmstest_pipe_name(pipe->pipe),
>> plane->index, rotation_name(rotation));
>>
>> - plane->rotation = rotation;
>> -
>> - plane->rotation_changed = true;
>> + igt_plane_set_prop_value(plane, IGT_PLANE_ROTATION,
>> rotation);
>> }
>>
>> /**
>> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
>> index 1ef10e7d525c..f87f8be31421 100644
>> --- a/lib/igt_kms.h
>> +++ b/lib/igt_kms.h
>> @@ -252,6 +252,9 @@ enum igt_atomic_plane_properties {
>> IGT_PLANE_CRTC_W,
>> IGT_PLANE_CRTC_H,
>>
>> +/* Append new properties after IGT_PLANE_COORD_CHANGED_MASK */
>> +#define IGT_PLANE_COORD_CHANGED_MASK 0xff
>> +
>> IGT_PLANE_FB_ID,
>> IGT_PLANE_CRTC_ID,
>> IGT_PLANE_IN_FENCE_FD,
>> @@ -286,37 +289,19 @@ typedef struct {
>> int index;
>> /* capabilities */
>> int type;
>> - /* state tracking */
>> - unsigned int fb_changed : 1;
>> - unsigned int position_changed : 1;
>> - unsigned int rotation_changed : 1;
>> - unsigned int size_changed : 1;
>> +
>> /*
>> * drm_plane can be NULL for primary and cursor planes (when
>> not
>> * using the atomic modeset API)
>> */
>> drmModePlane *drm_plane;
>> - struct igt_fb *fb;
>> -
>> - uint32_t rotation_property;
>> -
>> - /* position within pipe_src_w x pipe_src_h */
>> - int crtc_x, crtc_y;
>> - /* size within pipe_src_w x pipe_src_h */
>> - int crtc_w, crtc_h;
>>
>> - /* position within the framebuffer */
>> - uint32_t src_x;
>> - uint32_t src_y;
>> - /* size within the framebuffer*/
>> - uint32_t src_w;
>> - uint32_t src_h;
>> + /* gem handle for fb */
>> + uint32_t gem_handle;
>>
>> - igt_rotation_t rotation;
>> -
>> - /* in fence fd */
>> - int fence_fd;
>> - uint32_t atomic_props_plane[IGT_NUM_PLANE_PROPS];
>> + uint64_t changed;
>> + uint32_t props[IGT_NUM_PLANE_PROPS];
>> + uint64_t values[IGT_NUM_PLANE_PROPS];
>> } igt_plane_t;
>>
>> struct igt_pipe {
>> @@ -407,7 +392,7 @@ bool igt_pipe_get_property(igt_pipe_t *pipe,
>> const char *name,
>>
>> static inline bool igt_plane_supports_rotation(igt_plane_t *plane)
>> {
>> - return plane->rotation_property != 0;
>> + return plane->props[IGT_PLANE_ROTATION] != 0;
>> }
>> void igt_pipe_request_out_fence(igt_pipe_t *pipe);
>> void igt_pipe_set_degamma_lut(igt_pipe_t *pipe, void *ptr, size_t
>> length);
>> @@ -527,16 +512,20 @@ static inline bool
>> igt_output_is_connected(igt_output_t *output)
>>
>> #define IGT_FIXED(i,f) ((i) << 16 | (f))
>>
>> -/**
>> - * igt_atomic_populate_plane_req:
>> - * @req: A pointer to drmModeAtomicReq
>> - * @plane: A pointer igt_plane_t
>> - * @prop: one of igt_atomic_plane_properties
>> - * @value: the value to add
>> - */
>> -#define igt_atomic_populate_plane_req(req, plane, prop, value) \
>> - igt_assert_lt(0, drmModeAtomicAddProperty(req, plane-
>>> drm_plane->plane_id,\
>> - plane-
>>> atomic_props_plane[prop], value))
>> +#define igt_plane_is_prop_changed(plane, prop) \
>> + (!!((plane)->changed & (1 << (prop))))
>> +
>> +#define igt_plane_set_prop_changed(plane, prop) \
>> + (plane)->changed |= 1 << (prop)
>> +
>> +#define igt_plane_clear_prop_changed(plane, prop) \
>> + (plane)->changed &= ~(1 << (prop))
>> +
>> +#define igt_plane_set_prop_value(plane, prop, value) \
>> + do { \
>> + plane->values[prop] = value; \
>> + igt_plane_set_prop_changed(plane, prop); \
>> + } while (0)
>>
>> /**
>> * igt_atomic_populate_crtc_req:
>> diff --git a/tests/kms_atomic_interruptible.c
>> b/tests/kms_atomic_interruptible.c
>> index 2d19fe967809..5570854390ea 100644
>> --- a/tests/kms_atomic_interruptible.c
>> +++ b/tests/kms_atomic_interruptible.c
>> @@ -161,12 +161,12 @@ static void run_plane_test(igt_display_t
>> *display, enum pipe pipe, igt_output_t
>> /* connector: 1 prop */
>> output-
>>> props[IGT_CONNECTOR_CRTC_ID],
>> /* plane: remainder props */
>> - plane-
>>> atomic_props_plane[IGT_PLANE_CRTC_ID],
>> - plane-
>>> atomic_props_plane[IGT_PLANE_FB_ID],
>> - plane-
>>> atomic_props_plane[IGT_PLANE_SRC_W],
>> - plane-
>>> atomic_props_plane[IGT_PLANE_SRC_H],
>> - plane-
>>> atomic_props_plane[IGT_PLANE_CRTC_W],
>> - plane-
>>> atomic_props_plane[IGT_PLANE_CRTC_H]
>> + plane-
>>> props[IGT_PLANE_CRTC_ID],
>> + plane-
>>> props[IGT_PLANE_FB_ID],
>> + plane-
>>> props[IGT_PLANE_SRC_W],
>> + plane-
>>> props[IGT_PLANE_SRC_H],
>> + plane-
>>> props[IGT_PLANE_CRTC_W],
>> + plane-
>>> props[IGT_PLANE_CRTC_H]
>> };
>> uint64_t prop_vals[] = {
>> /* crtc */
>> diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c
>> index b16c8cd433b2..613f68899601 100644
>> --- a/tests/kms_plane_lowres.c
>> +++ b/tests/kms_plane_lowres.c
>> @@ -227,8 +227,8 @@ test_setup(data_t *data, enum pipe pipe, uint64_t
>> modifier, int flags,
>> 1.0, 1.0, 0.0,
>> &data->fb[i]);
>>
>> - igt_plane_set_position(data->plane[i], x, y);
>> igt_plane_set_fb(data->plane[i], &data->fb[i]);
>> + igt_plane_set_position(data->plane[i], x, y);
> This part could be split into a separate patch as it fixes an error.
> BTW why do we need to igt_plane_set_fb() before
> igt_plane_set_position()
It wasn't an error before, igt_plane_set_fb cleared everything to defaults except position, but with this patch I felt it should clear position too because why keep it special?
Hmm though it seems multiple tests assume that position is untouched by igt_plane_set_fb, I think it might be better to revert this hunk. Perhaps clean it up later..
I'll just drop this part for now. Reality is clashing with ideals again. :(
>> }
>>
>> return mode;
>> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
>> index 4d2ef1c184f0..4932a0d44410 100644
>> --- a/tests/kms_rotation_crc.c
>> +++ b/tests/kms_rotation_crc.c
>> @@ -122,11 +122,11 @@ static void prepare_crtc(data_t *data,
>> igt_output_t *output, enum pipe pipe,
>> igt_plane_set_fb(primary, &data->fb_modeset);
>>
>> if (commit < COMMIT_ATOMIC) {
>> - primary->rotation_changed = false;
>> + igt_plane_clear_prop_changed(primary,
>> IGT_PLANE_ROTATION);
>> igt_display_commit(display);
>>
>> if (plane->type == DRM_PLANE_TYPE_PRIMARY)
>> - primary->rotation_changed = true;
>> + igt_plane_set_prop_changed(primary,
>> IGT_PLANE_ROTATION);
>> }
>>
>> igt_plane_set_fb(plane, NULL);
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH i-g-t] lib/igt_kms: Rework plane properties to be more atomic, v5.
2017-10-03 12:05 ` Mika Kahola
2017-10-04 7:26 ` Maarten Lankhorst
@ 2017-10-04 13:54 ` Maarten Lankhorst
1 sibling, 0 replies; 25+ messages in thread
From: Maarten Lankhorst @ 2017-10-04 13:54 UTC (permalink / raw)
To: intel-gfx
In the future I want to allow tests to commit more properties,
but for this to work I have to fix all properties to work better
with atomic commit. Instead of special casing each
property make a bitmask for all property changed flags, and try to
commit all properties.
Changes since v1:
- Remove special dumping of src and crtc coordinates.
- Dump all modified coordinates.
Changes since v2:
- Move igt_plane_set_prop_changed up slightly.
Changes since v3:
- Fix wrong ordering of set_position in kms_plane_lowres causing a test failure.
Changes since v4:
- Back out resetting crtc position in igt_plane_set_fb() and
document it during init. Tests appear to rely on it being preserved.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
lib/igt_kms.c | 299 +++++++++++++++++----------------------
lib/igt_kms.h | 59 ++++----
tests/kms_atomic_interruptible.c | 12 +-
tests/kms_rotation_crc.c | 4 +-
4 files changed, 165 insertions(+), 209 deletions(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index e3534ee80659..44d2d9452989 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -192,11 +192,11 @@ const char *igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = {
/*
* Retrieve all the properies specified in props_name and store them into
- * plane->atomic_props_plane.
+ * plane->props.
*/
static void
-igt_atomic_fill_plane_props(igt_display_t *display, igt_plane_t *plane,
- int num_props, const char **prop_names)
+igt_fill_plane_props(igt_display_t *display, igt_plane_t *plane,
+ int num_props, const char **prop_names)
{
drmModeObjectPropertiesPtr props;
int i, j, fd;
@@ -214,7 +214,7 @@ igt_atomic_fill_plane_props(igt_display_t *display, igt_plane_t *plane,
if (strcmp(prop->name, prop_names[j]) != 0)
continue;
- plane->atomic_props_plane[j] = props->props[i];
+ plane->props[j] = props->props[i];
break;
}
@@ -1659,7 +1659,6 @@ void igt_display_init(igt_display_t *display, int drm_fd)
drmModeRes *resources;
drmModePlaneRes *plane_resources;
int i;
- int is_atomic = 0;
memset(display, 0, sizeof(igt_display_t));
@@ -1679,7 +1678,9 @@ void igt_display_init(igt_display_t *display, int drm_fd)
igt_assert_f(display->pipes, "Failed to allocate memory for %d pipes\n", display->n_pipes);
drmSetClientCap(drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
- is_atomic = drmSetClientCap(drm_fd, DRM_CLIENT_CAP_ATOMIC, 1);
+ if (drmSetClientCap(drm_fd, DRM_CLIENT_CAP_ATOMIC, 1) == 0)
+ display->is_atomic = 1;
+
plane_resources = drmModeGetPlaneResources(display->drm_fd);
igt_assert(plane_resources);
@@ -1776,19 +1777,27 @@ void igt_display_init(igt_display_t *display, int drm_fd)
plane->type = type;
plane->pipe = pipe;
plane->drm_plane = drm_plane;
- plane->fence_fd = -1;
+ plane->values[IGT_PLANE_IN_FENCE_FD] = ~0ULL;
- if (is_atomic == 0) {
- display->is_atomic = 1;
- igt_atomic_fill_plane_props(display, plane, IGT_NUM_PLANE_PROPS, igt_plane_prop_names);
- }
+ igt_fill_plane_props(display, plane, IGT_NUM_PLANE_PROPS, igt_plane_prop_names);
get_plane_property(display->drm_fd, drm_plane->plane_id,
"rotation",
- &plane->rotation_property,
- &prop_value,
+ &plane->props[IGT_PLANE_ROTATION],
+ &plane->values[IGT_PLANE_ROTATION],
NULL);
- plane->rotation = (igt_rotation_t)prop_value;
+
+ /* Clear any residual framebuffer info on first commit. */
+ igt_plane_set_prop_changed(plane, IGT_PLANE_FB_ID);
+ igt_plane_set_prop_changed(plane, IGT_PLANE_CRTC_ID);
+
+ /*
+ * CRTC_X/Y are not changed in igt_plane_set_fb, so
+ * force them to be sanitized in case they contain
+ * garbage.
+ */
+ igt_plane_set_prop_changed(plane, IGT_PLANE_CRTC_X);
+ igt_plane_set_prop_changed(plane, IGT_PLANE_CRTC_Y);
}
/*
@@ -1805,9 +1814,6 @@ void igt_display_init(igt_display_t *display, int drm_fd)
pipe->n_planes = n_planes;
- for_each_plane_on_pipe(display, i, plane)
- plane->fb_changed = true;
-
pipe->mode_changed = true;
}
@@ -2070,18 +2076,7 @@ bool igt_pipe_get_property(igt_pipe_t *pipe, const char *name,
static uint32_t igt_plane_get_fb_id(igt_plane_t *plane)
{
- if (plane->fb)
- return plane->fb->fb_id;
- else
- return 0;
-}
-
-static uint32_t igt_plane_get_fb_gem_handle(igt_plane_t *plane)
-{
- if (plane->fb)
- return plane->fb->gem_handle;
- else
- return 0;
+ return plane->values[IGT_PLANE_FB_ID];
}
#define CHECK_RETURN(r, fail) { \
@@ -2090,9 +2085,6 @@ static uint32_t igt_plane_get_fb_gem_handle(igt_plane_t *plane)
igt_assert_eq(r, 0); \
}
-
-
-
/*
* Add position and fb changes of a plane to the atomic property set
*/
@@ -2101,63 +2093,31 @@ igt_atomic_prepare_plane_commit(igt_plane_t *plane, igt_pipe_t *pipe,
drmModeAtomicReq *req)
{
igt_display_t *display = pipe->display;
- uint32_t fb_id, crtc_id;
+ int i;
igt_assert(plane->drm_plane);
- /* it's an error to try an unsupported feature */
- igt_assert(igt_plane_supports_rotation(plane) ||
- !plane->rotation_changed);
-
- fb_id = igt_plane_get_fb_id(plane);
- crtc_id = pipe->crtc_id;
-
LOG(display,
"populating plane data: %s.%d, fb %u\n",
kmstest_pipe_name(pipe->pipe),
plane->index,
- fb_id);
-
- if (plane->fence_fd >= 0) {
- uint64_t fence_fd = (int64_t) plane->fence_fd;
- igt_atomic_populate_plane_req(req, plane, IGT_PLANE_IN_FENCE_FD, fence_fd);
- }
+ igt_plane_get_fb_id(plane));
- if (plane->fb_changed) {
- igt_atomic_populate_plane_req(req, plane, IGT_PLANE_CRTC_ID, fb_id ? crtc_id : 0);
- igt_atomic_populate_plane_req(req, plane, IGT_PLANE_FB_ID, fb_id);
- }
-
- if (plane->position_changed || plane->size_changed) {
- uint32_t src_x = IGT_FIXED(plane->src_x, 0); /* src_x */
- uint32_t src_y = IGT_FIXED(plane->src_y, 0); /* src_y */
- uint32_t src_w = IGT_FIXED(plane->src_w, 0); /* src_w */
- uint32_t src_h = IGT_FIXED(plane->src_h, 0); /* src_h */
- int32_t crtc_x = plane->crtc_x;
- int32_t crtc_y = plane->crtc_y;
- uint32_t crtc_w = plane->crtc_w;
- uint32_t crtc_h = plane->crtc_h;
+ for (i = 0; i < IGT_NUM_PLANE_PROPS; i++) {
+ if (!igt_plane_is_prop_changed(plane, i))
+ continue;
- LOG(display,
- "src = (%d, %d) %u x %u "
- "dst = (%d, %d) %u x %u\n",
- src_x >> 16, src_y >> 16, src_w >> 16, src_h >> 16,
- crtc_x, crtc_y, crtc_w, crtc_h);
+ /* it's an error to try an unsupported feature */
+ igt_assert(plane->props[i]);
- igt_atomic_populate_plane_req(req, plane, IGT_PLANE_SRC_X, src_x);
- igt_atomic_populate_plane_req(req, plane, IGT_PLANE_SRC_Y, src_y);
- igt_atomic_populate_plane_req(req, plane, IGT_PLANE_SRC_W, src_w);
- igt_atomic_populate_plane_req(req, plane, IGT_PLANE_SRC_H, src_h);
+ igt_debug("plane %s.%d: Setting property \"%s\" to 0x%"PRIx64"/%"PRIi64"\n",
+ kmstest_pipe_name(pipe->pipe), plane->index, igt_plane_prop_names[i],
+ plane->values[i], plane->values[i]);
- igt_atomic_populate_plane_req(req, plane, IGT_PLANE_CRTC_X, crtc_x);
- igt_atomic_populate_plane_req(req, plane, IGT_PLANE_CRTC_Y, crtc_y);
- igt_atomic_populate_plane_req(req, plane, IGT_PLANE_CRTC_W, crtc_w);
- igt_atomic_populate_plane_req(req, plane, IGT_PLANE_CRTC_H, crtc_h);
+ igt_assert_lt(0, drmModeAtomicAddProperty(req, plane->drm_plane->plane_id,
+ plane->props[i],
+ plane->values[i]));
}
-
- if (plane->rotation_changed)
- igt_atomic_populate_plane_req(req, plane,
- IGT_PLANE_ROTATION, plane->rotation);
}
@@ -2183,17 +2143,20 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
int32_t crtc_y;
uint32_t crtc_w;
uint32_t crtc_h;
+ bool setplane =
+ igt_plane_is_prop_changed(plane, IGT_PLANE_FB_ID) ||
+ plane->changed & IGT_PLANE_COORD_CHANGED_MASK;
igt_assert(plane->drm_plane);
/* it's an error to try an unsupported feature */
igt_assert(igt_plane_supports_rotation(plane) ||
- !plane->rotation_changed);
+ !igt_plane_is_prop_changed(plane, IGT_PLANE_ROTATION));
fb_id = igt_plane_get_fb_id(plane);
crtc_id = pipe->crtc_id;
- if ((plane->fb_changed || plane->size_changed) && fb_id == 0) {
+ if (setplane && fb_id == 0) {
LOG(display,
"SetPlane pipe %s, plane %d, disabling\n",
kmstest_pipe_name(pipe->pipe),
@@ -2212,16 +2175,15 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
IGT_FIXED(0,0) /* src_h */);
CHECK_RETURN(ret, fail_on_error);
- } else if (plane->fb_changed || plane->position_changed ||
- plane->size_changed) {
- src_x = IGT_FIXED(plane->src_x,0); /* src_x */
- src_y = IGT_FIXED(plane->src_y,0); /* src_y */
- src_w = IGT_FIXED(plane->src_w,0); /* src_w */
- src_h = IGT_FIXED(plane->src_h,0); /* src_h */
- crtc_x = plane->crtc_x;
- crtc_y = plane->crtc_y;
- crtc_w = plane->crtc_w;
- crtc_h = plane->crtc_h;
+ } else if (setplane) {
+ src_x = plane->values[IGT_PLANE_SRC_X];
+ src_y = plane->values[IGT_PLANE_SRC_Y];
+ src_w = plane->values[IGT_PLANE_SRC_W];
+ src_h = plane->values[IGT_PLANE_SRC_H];
+ crtc_x = plane->values[IGT_PLANE_CRTC_X];
+ crtc_y = plane->values[IGT_PLANE_CRTC_Y];
+ crtc_w = plane->values[IGT_PLANE_CRTC_W];
+ crtc_h = plane->values[IGT_PLANE_CRTC_H];
LOG(display,
"SetPlane %s.%d, fb %u, src = (%d, %d) "
@@ -2245,9 +2207,10 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
CHECK_RETURN(ret, fail_on_error);
}
- if (plane->rotation_changed) {
- ret = igt_plane_set_property(plane, plane->rotation_property,
- plane->rotation);
+ if (igt_plane_is_prop_changed(plane, IGT_PLANE_ROTATION)) {
+ ret = igt_plane_set_property(plane,
+ plane->props[IGT_PLANE_ROTATION],
+ plane->values[IGT_PLANE_ROTATION]);
CHECK_RETURN(ret, fail_on_error);
}
@@ -2269,35 +2232,30 @@ static int igt_cursor_commit_legacy(igt_plane_t *cursor,
uint32_t crtc_id = pipe->crtc_id;
int ret;
- if (cursor->fb_changed) {
- uint32_t gem_handle = igt_plane_get_fb_gem_handle(cursor);
-
- if (gem_handle) {
+ if (igt_plane_is_prop_changed(cursor, IGT_PLANE_FB_ID)) {
+ if (cursor->gem_handle)
LOG(display,
"SetCursor pipe %s, fb %u %dx%d\n",
kmstest_pipe_name(pipe->pipe),
- gem_handle,
- cursor->crtc_w, cursor->crtc_h);
-
- ret = drmModeSetCursor(display->drm_fd, crtc_id,
- gem_handle,
- cursor->crtc_w,
- cursor->crtc_h);
- } else {
+ cursor->gem_handle,
+ (unsigned)cursor->values[IGT_PLANE_CRTC_W],
+ (unsigned)cursor->values[IGT_PLANE_CRTC_H]);
+ else
LOG(display,
"SetCursor pipe %s, disabling\n",
kmstest_pipe_name(pipe->pipe));
- ret = drmModeSetCursor(display->drm_fd, crtc_id,
- 0, 0, 0);
- }
-
+ ret = drmModeSetCursor(display->drm_fd, crtc_id,
+ cursor->gem_handle,
+ cursor->values[IGT_PLANE_CRTC_W],
+ cursor->values[IGT_PLANE_CRTC_H]);
CHECK_RETURN(ret, fail_on_error);
}
- if (cursor->position_changed) {
- int x = cursor->crtc_x;
- int y = cursor->crtc_y;
+ if (igt_plane_is_prop_changed(cursor, IGT_PLANE_CRTC_X) ||
+ igt_plane_is_prop_changed(cursor, IGT_PLANE_CRTC_Y)) {
+ int x = cursor->values[IGT_PLANE_CRTC_X];
+ int y = cursor->values[IGT_PLANE_CRTC_Y];
LOG(display,
"MoveCursor pipe %s, (%d, %d)\n",
@@ -2326,13 +2284,14 @@ static int igt_primary_plane_commit_legacy(igt_plane_t *primary,
int ret;
/* Primary planes can't be windowed when using a legacy commit */
- igt_assert((primary->crtc_x == 0 && primary->crtc_y == 0));
+ igt_assert((primary->values[IGT_PLANE_CRTC_X] == 0 && primary->values[IGT_PLANE_CRTC_Y] == 0));
/* nor rotated */
- igt_assert(!primary->rotation_changed);
+ igt_assert(!igt_plane_is_prop_changed(primary, IGT_PLANE_ROTATION));
- if (!primary->fb_changed && !primary->position_changed &&
- !primary->size_changed && !primary->pipe->mode_changed)
+ if (!igt_plane_is_prop_changed(primary, IGT_PLANE_FB_ID) &&
+ !(primary->changed & IGT_PLANE_COORD_CHANGED_MASK) &&
+ !primary->pipe->mode_changed)
return 0;
crtc_id = pipe->crtc_id;
@@ -2343,19 +2302,22 @@ static int igt_primary_plane_commit_legacy(igt_plane_t *primary,
mode = NULL;
if (fb_id) {
+ uint32_t src_x = primary->values[IGT_PLANE_SRC_X] >> 16;
+ uint32_t src_y = primary->values[IGT_PLANE_SRC_Y] >> 16;
+
LOG(display,
"%s: SetCrtc pipe %s, fb %u, src (%d, %d), "
"mode %dx%d\n",
igt_output_name(output),
kmstest_pipe_name(pipe->pipe),
fb_id,
- primary->src_x, primary->src_y,
+ src_x, src_y,
mode->hdisplay, mode->vdisplay);
ret = drmModeSetCrtc(display->drm_fd,
crtc_id,
fb_id,
- primary->src_x, primary->src_y,
+ src_x, src_y,
&output->id,
1,
mode);
@@ -2608,18 +2570,27 @@ display_commit_changed(igt_display_t *display, enum igt_commit_style s)
}
for_each_plane_on_pipe(display, pipe, plane) {
- plane->fb_changed = false;
- plane->position_changed = false;
- plane->size_changed = false;
+ if (s == COMMIT_ATOMIC) {
+ int fd;
+ plane->changed = 0;
- if (s != COMMIT_LEGACY ||
- !(plane->type == DRM_PLANE_TYPE_PRIMARY ||
- plane->type == DRM_PLANE_TYPE_CURSOR))
- plane->rotation_changed = false;
+ fd = plane->values[IGT_PLANE_IN_FENCE_FD];
+ if (fd != -1)
+ close(fd);
- if (s == COMMIT_ATOMIC)
/* reset fence_fd to prevent it from being set for the next commit */
- igt_plane_set_fence_fd(plane, -1);
+ plane->values[IGT_PLANE_IN_FENCE_FD] = -1;
+ } else {
+ plane->changed &= ~IGT_PLANE_COORD_CHANGED_MASK;
+
+ igt_plane_clear_prop_changed(plane, IGT_PLANE_CRTC_ID);
+ igt_plane_clear_prop_changed(plane, IGT_PLANE_FB_ID);
+
+ if (s != COMMIT_LEGACY ||
+ !(plane->type == DRM_PLANE_TYPE_PRIMARY ||
+ plane->type == DRM_PLANE_TYPE_CURSOR))
+ igt_plane_clear_prop_changed(plane, IGT_PLANE_ROTATION);
+ }
}
}
@@ -2913,30 +2884,29 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)
LOG(display, "%s.%d: plane_set_fb(%d)\n", kmstest_pipe_name(pipe->pipe),
plane->index, fb ? fb->fb_id : 0);
- plane->fb = fb;
+ igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_ID, fb ? pipe->crtc_id : 0);
+ igt_plane_set_prop_value(plane, IGT_PLANE_FB_ID, fb ? fb->fb_id : 0);
+
+ if (plane->type == DRM_PLANE_TYPE_CURSOR && fb)
+ plane->gem_handle = fb->gem_handle;
+ else
+ plane->gem_handle = 0;
+
/* hack to keep tests working that don't call igt_plane_set_size() */
if (fb) {
/* set default plane size as fb size */
- plane->crtc_w = fb->width;
- plane->crtc_h = fb->height;
+ igt_plane_set_size(plane, fb->width, fb->height);
/* set default src pos/size as fb size */
- plane->src_x = 0;
- plane->src_y = 0;
- plane->src_w = fb->width;
- plane->src_h = fb->height;
+ igt_fb_set_position(fb, plane, 0, 0);
+ igt_fb_set_size(fb, plane, fb->width, fb->height);
} else {
- plane->src_x = 0;
- plane->src_y = 0;
- plane->src_w = 0;
- plane->src_h = 0;
+ igt_plane_set_size(plane, 0, 0);
- plane->crtc_w = 0;
- plane->crtc_h = 0;
+ /* set default src pos/size as fb size */
+ igt_fb_set_position(fb, plane, 0, 0);
+ igt_fb_set_size(fb, plane, 0, 0);
}
-
- plane->fb_changed = true;
- plane->size_changed = true;
}
/**
@@ -2949,12 +2919,19 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)
*/
void igt_plane_set_fence_fd(igt_plane_t *plane, int fence_fd)
{
- close(plane->fence_fd);
+ int64_t fd;
- if (fcntl(fence_fd, F_GETFD) != -1)
- plane->fence_fd = dup(fence_fd);
- else
- plane->fence_fd = -1;
+ fd = plane->values[IGT_PLANE_IN_FENCE_FD];
+ if (fd != -1)
+ close(fd);
+
+ if (fence_fd != -1) {
+ fd = dup(fence_fd);
+ igt_fail_on(fd == -1);
+ } else
+ fd = -1;
+
+ igt_plane_set_prop_value(plane, IGT_PLANE_IN_FENCE_FD, fd);
}
void igt_plane_set_position(igt_plane_t *plane, int x, int y)
@@ -2965,10 +2942,8 @@ void igt_plane_set_position(igt_plane_t *plane, int x, int y)
LOG(display, "%s.%d: plane_set_position(%d,%d)\n",
kmstest_pipe_name(pipe->pipe), plane->index, x, y);
- plane->crtc_x = x;
- plane->crtc_y = y;
-
- plane->position_changed = true;
+ igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_X, x);
+ igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_Y, y);
}
/**
@@ -2989,10 +2964,8 @@ void igt_plane_set_size(igt_plane_t *plane, int w, int h)
LOG(display, "%s.%d: plane_set_size (%dx%d)\n",
kmstest_pipe_name(pipe->pipe), plane->index, w, h);
- plane->crtc_w = w;
- plane->crtc_h = h;
-
- plane->size_changed = true;
+ igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_W, w);
+ igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_H, h);
}
/**
@@ -3014,10 +2987,8 @@ void igt_fb_set_position(struct igt_fb *fb, igt_plane_t *plane,
LOG(display, "%s.%d: fb_set_position(%d,%d)\n",
kmstest_pipe_name(pipe->pipe), plane->index, x, y);
- plane->src_x = x;
- plane->src_y = y;
-
- plane->fb_changed = true;
+ igt_plane_set_prop_value(plane, IGT_PLANE_SRC_X, IGT_FIXED(x, 0));
+ igt_plane_set_prop_value(plane, IGT_PLANE_SRC_Y, IGT_FIXED(y, 0));
}
/**
@@ -3040,10 +3011,8 @@ void igt_fb_set_size(struct igt_fb *fb, igt_plane_t *plane,
LOG(display, "%s.%d: fb_set_size(%dx%d)\n",
kmstest_pipe_name(pipe->pipe), plane->index, w, h);
- plane->src_w = w;
- plane->src_h = h;
-
- plane->fb_changed = true;
+ igt_plane_set_prop_value(plane, IGT_PLANE_SRC_W, IGT_FIXED(w, 0));
+ igt_plane_set_prop_value(plane, IGT_PLANE_SRC_H, IGT_FIXED(h, 0));
}
static const char *rotation_name(igt_rotation_t rotation)
@@ -3071,9 +3040,7 @@ void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation)
kmstest_pipe_name(pipe->pipe),
plane->index, rotation_name(rotation));
- plane->rotation = rotation;
-
- plane->rotation_changed = true;
+ igt_plane_set_prop_value(plane, IGT_PLANE_ROTATION, rotation);
}
/**
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 1ef10e7d525c..f87f8be31421 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -252,6 +252,9 @@ enum igt_atomic_plane_properties {
IGT_PLANE_CRTC_W,
IGT_PLANE_CRTC_H,
+/* Append new properties after IGT_PLANE_COORD_CHANGED_MASK */
+#define IGT_PLANE_COORD_CHANGED_MASK 0xff
+
IGT_PLANE_FB_ID,
IGT_PLANE_CRTC_ID,
IGT_PLANE_IN_FENCE_FD,
@@ -286,37 +289,19 @@ typedef struct {
int index;
/* capabilities */
int type;
- /* state tracking */
- unsigned int fb_changed : 1;
- unsigned int position_changed : 1;
- unsigned int rotation_changed : 1;
- unsigned int size_changed : 1;
+
/*
* drm_plane can be NULL for primary and cursor planes (when not
* using the atomic modeset API)
*/
drmModePlane *drm_plane;
- struct igt_fb *fb;
-
- uint32_t rotation_property;
-
- /* position within pipe_src_w x pipe_src_h */
- int crtc_x, crtc_y;
- /* size within pipe_src_w x pipe_src_h */
- int crtc_w, crtc_h;
- /* position within the framebuffer */
- uint32_t src_x;
- uint32_t src_y;
- /* size within the framebuffer*/
- uint32_t src_w;
- uint32_t src_h;
+ /* gem handle for fb */
+ uint32_t gem_handle;
- igt_rotation_t rotation;
-
- /* in fence fd */
- int fence_fd;
- uint32_t atomic_props_plane[IGT_NUM_PLANE_PROPS];
+ uint64_t changed;
+ uint32_t props[IGT_NUM_PLANE_PROPS];
+ uint64_t values[IGT_NUM_PLANE_PROPS];
} igt_plane_t;
struct igt_pipe {
@@ -407,7 +392,7 @@ bool igt_pipe_get_property(igt_pipe_t *pipe, const char *name,
static inline bool igt_plane_supports_rotation(igt_plane_t *plane)
{
- return plane->rotation_property != 0;
+ return plane->props[IGT_PLANE_ROTATION] != 0;
}
void igt_pipe_request_out_fence(igt_pipe_t *pipe);
void igt_pipe_set_degamma_lut(igt_pipe_t *pipe, void *ptr, size_t length);
@@ -527,16 +512,20 @@ static inline bool igt_output_is_connected(igt_output_t *output)
#define IGT_FIXED(i,f) ((i) << 16 | (f))
-/**
- * igt_atomic_populate_plane_req:
- * @req: A pointer to drmModeAtomicReq
- * @plane: A pointer igt_plane_t
- * @prop: one of igt_atomic_plane_properties
- * @value: the value to add
- */
-#define igt_atomic_populate_plane_req(req, plane, prop, value) \
- igt_assert_lt(0, drmModeAtomicAddProperty(req, plane->drm_plane->plane_id,\
- plane->atomic_props_plane[prop], value))
+#define igt_plane_is_prop_changed(plane, prop) \
+ (!!((plane)->changed & (1 << (prop))))
+
+#define igt_plane_set_prop_changed(plane, prop) \
+ (plane)->changed |= 1 << (prop)
+
+#define igt_plane_clear_prop_changed(plane, prop) \
+ (plane)->changed &= ~(1 << (prop))
+
+#define igt_plane_set_prop_value(plane, prop, value) \
+ do { \
+ plane->values[prop] = value; \
+ igt_plane_set_prop_changed(plane, prop); \
+ } while (0)
/**
* igt_atomic_populate_crtc_req:
diff --git a/tests/kms_atomic_interruptible.c b/tests/kms_atomic_interruptible.c
index dcdbc267d3ef..4a2a577412cc 100644
--- a/tests/kms_atomic_interruptible.c
+++ b/tests/kms_atomic_interruptible.c
@@ -163,12 +163,12 @@ static void run_plane_test(igt_display_t *display, enum pipe pipe, igt_output_t
/* connector: 1 prop */
output->props[IGT_CONNECTOR_CRTC_ID],
/* plane: remainder props */
- plane->atomic_props_plane[IGT_PLANE_CRTC_ID],
- plane->atomic_props_plane[IGT_PLANE_FB_ID],
- plane->atomic_props_plane[IGT_PLANE_SRC_W],
- plane->atomic_props_plane[IGT_PLANE_SRC_H],
- plane->atomic_props_plane[IGT_PLANE_CRTC_W],
- plane->atomic_props_plane[IGT_PLANE_CRTC_H]
+ plane->props[IGT_PLANE_CRTC_ID],
+ plane->props[IGT_PLANE_FB_ID],
+ plane->props[IGT_PLANE_SRC_W],
+ plane->props[IGT_PLANE_SRC_H],
+ plane->props[IGT_PLANE_CRTC_W],
+ plane->props[IGT_PLANE_CRTC_H]
};
uint64_t prop_vals[] = {
/* crtc */
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 5aec8fa39671..b8327dfa0d83 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -122,11 +122,11 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
igt_plane_set_fb(primary, &data->fb_modeset);
if (commit < COMMIT_ATOMIC) {
- primary->rotation_changed = false;
+ igt_plane_clear_prop_changed(primary, IGT_PLANE_ROTATION);
igt_display_commit(display);
if (plane->type == DRM_PLANE_TYPE_PRIMARY)
- primary->rotation_changed = true;
+ igt_plane_set_prop_changed(primary, IGT_PLANE_ROTATION);
}
igt_plane_set_fb(plane, NULL);
--
2.14.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH i-g-t] lib/igt_kms: Rework pipe properties to be more atomic, v6.
2017-10-03 7:45 ` [PATCH i-g-t] lib/igt_kms: Rework pipe properties to be more atomic, v5 Maarten Lankhorst
@ 2017-10-04 13:55 ` Maarten Lankhorst
0 siblings, 0 replies; 25+ messages in thread
From: Maarten Lankhorst @ 2017-10-04 13:55 UTC (permalink / raw)
To: intel-gfx
In the future I want to allow tests to commit more properties,
but for this to work I have to fix all properties to work better
with atomic commit. Instead of special casing each
property make a bitmask for all property changed flags, and try to
commit all properties.
This has been the most involved one, since legacy pipe commit still
handles a lot of the properties differently from the rest.
Changes since v1:
- Dump all changed properties on commit.
- Fix bug in igt_pipe_refresh().
Changes since v2:
- Set pipe ACTIVE property changed flag on init.
Changes since v3:
- Add a missing igt_pipe_refresh() to kms_atomic_interruptible.
Changes since v4:
- Perform error handling when setting custom crtc properties.
Changes since v5:
- Only attempt to commit changes properties.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
lib/igt_kms.c | 230 ++++++++++++++++++++------------------
lib/igt_kms.h | 77 +++++--------
tests/kms_atomic_interruptible.c | 8 +-
tests/kms_atomic_transition.c | 2 +-
tests/kms_crtc_background_color.c | 2 +-
5 files changed, 158 insertions(+), 161 deletions(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 44d2d9452989..f6f53b8a9a28 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -259,8 +259,8 @@ igt_atomic_fill_connector_props(igt_display_t *display, igt_output_t *output,
}
static void
-igt_atomic_fill_pipe_props(igt_display_t *display, igt_pipe_t *pipe,
- int num_crtc_props, const char **crtc_prop_names)
+igt_fill_pipe_props(igt_display_t *display, igt_pipe_t *pipe,
+ int num_crtc_props, const char **crtc_prop_names)
{
drmModeObjectPropertiesPtr props;
int i, j, fd;
@@ -278,7 +278,7 @@ igt_atomic_fill_pipe_props(igt_display_t *display, igt_pipe_t *pipe,
if (strcmp(prop->name, crtc_prop_names[j]) != 0)
continue;
- pipe->atomic_props_crtc[j] = props->props[i];
+ pipe->props[j] = props->props[i];
break;
}
@@ -1620,13 +1620,6 @@ get_crtc_property(int drm_fd, uint32_t crtc_id, const char *name,
name, prop_id, value, prop);
}
-static void
-igt_crtc_set_property(igt_pipe_t *pipe, uint32_t prop_id, uint64_t value)
-{
- drmModeObjectSetProperty(pipe->display->drm_fd,
- pipe->crtc_id, DRM_MODE_OBJECT_CRTC, prop_id, value);
-}
-
/*
* Walk a plane's property list to determine its type. If we don't
* find a type property, then the kernel doesn't support universal
@@ -1690,7 +1683,6 @@ void igt_display_init(igt_display_t *display, int drm_fd)
int p = 1;
int j, type;
uint8_t last_plane = 0, n_planes = 0;
- uint64_t prop_value;
pipe->crtc_id = resources->crtcs[i];
pipe->display = display;
@@ -1700,29 +1692,16 @@ void igt_display_init(igt_display_t *display, int drm_fd)
pipe->planes = NULL;
pipe->out_fence_fd = -1;
+ igt_fill_pipe_props(display, pipe, IGT_NUM_CRTC_PROPS, igt_crtc_prop_names);
+
+ /* Force modeset disable on first commit */
+ igt_pipe_obj_set_prop_changed(pipe, IGT_CRTC_MODE_ID);
+ igt_pipe_obj_set_prop_changed(pipe, IGT_CRTC_ACTIVE);
+
get_crtc_property(display->drm_fd, pipe->crtc_id,
- "background_color",
- &pipe->background_property,
- &prop_value,
+ "background_color", NULL,
+ &pipe->values[IGT_CRTC_BACKGROUND],
NULL);
- pipe->background = (uint32_t)prop_value;
- get_crtc_property(display->drm_fd, pipe->crtc_id,
- "DEGAMMA_LUT",
- &pipe->degamma_property,
- NULL,
- NULL);
- get_crtc_property(display->drm_fd, pipe->crtc_id,
- "CTM",
- &pipe->ctm_property,
- NULL,
- NULL);
- get_crtc_property(display->drm_fd, pipe->crtc_id,
- "GAMMA_LUT",
- &pipe->gamma_property,
- NULL,
- NULL);
-
- igt_atomic_fill_pipe_props(display, pipe, IGT_NUM_CRTC_PROPS, igt_crtc_prop_names);
/* count number of valid planes */
for (j = 0; j < plane_resources->count_planes; j++) {
@@ -1813,8 +1792,6 @@ void igt_display_init(igt_display_t *display, int drm_fd)
igt_assert_eq(p, n_planes);
pipe->n_planes = n_planes;
-
- pipe->mode_changed = true;
}
/*
@@ -2291,7 +2268,7 @@ static int igt_primary_plane_commit_legacy(igt_plane_t *primary,
if (!igt_plane_is_prop_changed(primary, IGT_PLANE_FB_ID) &&
!(primary->changed & IGT_PLANE_COORD_CHANGED_MASK) &&
- !primary->pipe->mode_changed)
+ !igt_pipe_obj_is_prop_changed(primary->pipe, IGT_CRTC_MODE_ID))
return 0;
crtc_id = pipe->crtc_id;
@@ -2360,6 +2337,16 @@ static int igt_plane_commit(igt_plane_t *plane,
}
}
+static bool is_atomic_prop(enum igt_atomic_crtc_properties prop)
+{
+ if (prop == IGT_CRTC_MODE_ID ||
+ prop == IGT_CRTC_ACTIVE ||
+ prop == IGT_CRTC_OUT_FENCE_PTR)
+ return true;
+
+ return false;
+}
+
/*
* Commit all plane changes to an output. Note that if @s is COMMIT_LEGACY,
* enabling/disabling the primary plane will also enable/disable the CRTC.
@@ -2377,19 +2364,17 @@ static int igt_pipe_commit(igt_pipe_t *pipe,
int i;
int ret;
- if (pipe->background_changed) {
- igt_crtc_set_property(pipe, pipe->background_property,
- pipe->background);
- }
+ for (i = 0; i < IGT_NUM_CRTC_PROPS; i++)
+ if (igt_pipe_obj_is_prop_changed(pipe, i) &&
+ !is_atomic_prop(i)) {
+ igt_assert(pipe->props[i]);
- if (pipe->color_mgmt_changed) {
- igt_crtc_set_property(pipe, pipe->degamma_property,
- pipe->degamma_blob);
- igt_crtc_set_property(pipe, pipe->ctm_property,
- pipe->ctm_blob);
- igt_crtc_set_property(pipe, pipe->gamma_property,
- pipe->gamma_blob);
- }
+ ret = drmModeObjectSetProperty(pipe->display->drm_fd,
+ pipe->crtc_id, DRM_MODE_OBJECT_CRTC,
+ pipe->props[i], pipe->values[i]);
+
+ CHECK_RETURN(ret, fail_on_error);
+ }
for (i = 0; i < pipe->n_planes; i++) {
igt_plane_t *plane = &pipe->planes[i];
@@ -2402,9 +2387,10 @@ static int igt_pipe_commit(igt_pipe_t *pipe,
}
static void
-igt_pipe_replace_blob(igt_pipe_t *pipe, uint64_t *blob, void *ptr, size_t length)
+igt_pipe_replace_blob(igt_pipe_t *pipe, enum igt_atomic_crtc_properties prop, void *ptr, size_t length)
{
igt_display_t *display = pipe->display;
+ uint64_t *blob = &pipe->values[prop];
uint32_t blob_id = 0;
if (*blob != 0)
@@ -2416,6 +2402,7 @@ igt_pipe_replace_blob(igt_pipe_t *pipe, uint64_t *blob, void *ptr, size_t length
ptr, length, &blob_id) == 0);
*blob = blob_id;
+ igt_pipe_obj_set_prop_changed(pipe, prop);
}
/*
@@ -2423,51 +2410,23 @@ igt_pipe_replace_blob(igt_pipe_t *pipe, uint64_t *blob, void *ptr, size_t length
*/
static void igt_atomic_prepare_crtc_commit(igt_pipe_t *pipe_obj, drmModeAtomicReq *req)
{
- if (pipe_obj->background_changed)
- igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_BACKGROUND, pipe_obj->background);
-
- if (pipe_obj->color_mgmt_changed) {
- igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_DEGAMMA_LUT, pipe_obj->degamma_blob);
- igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_CTM, pipe_obj->ctm_blob);
- igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_GAMMA_LUT, pipe_obj->gamma_blob);
- }
-
- if (pipe_obj->mode_changed) {
- igt_output_t *output = igt_pipe_get_output(pipe_obj);
-
- if (!output) {
- igt_pipe_replace_blob(pipe_obj, &pipe_obj->mode_blob, NULL, 0);
-
- LOG(pipe_obj->display, "%s: Setting NULL mode\n",
- kmstest_pipe_name(pipe_obj->pipe));
- } else {
- drmModeModeInfo *mode = igt_output_get_mode(output);
+ int i;
- igt_pipe_replace_blob(pipe_obj, &pipe_obj->mode_blob, mode, sizeof(*mode));
+ for (i = 0; i < IGT_NUM_CRTC_PROPS; i++) {
+ if (!igt_pipe_obj_is_prop_changed(pipe_obj, i))
+ continue;
- LOG(pipe_obj->display, "%s: Setting mode %s from %s\n",
- kmstest_pipe_name(pipe_obj->pipe),
- mode->name, igt_output_name(output));
- }
+ igt_debug("Pipe %s: Setting property \"%s\" to 0x%"PRIx64"/%"PRIi64"\n",
+ kmstest_pipe_name(pipe_obj->pipe), igt_crtc_prop_names[i],
+ pipe_obj->values[i], pipe_obj->values[i]);
- igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_MODE_ID, pipe_obj->mode_blob);
- igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_ACTIVE, !!output);
+ igt_assert_lt(0, drmModeAtomicAddProperty(req, pipe_obj->crtc_id, pipe_obj->props[i], pipe_obj->values[i]));
}
if (pipe_obj->out_fence_fd != -1) {
close(pipe_obj->out_fence_fd);
pipe_obj->out_fence_fd = -1;
}
-
- if (pipe_obj->out_fence_requested)
- {
- igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_OUT_FENCE_PTR,
- (uint64_t)(uintptr_t) &pipe_obj->out_fence_fd);
- }
-
- /*
- * TODO: Add all crtc level properties here
- */
}
/*
@@ -2558,15 +2517,21 @@ display_commit_changed(igt_display_t *display, enum igt_commit_style s)
igt_pipe_t *pipe_obj = &display->pipes[pipe];
igt_plane_t *plane;
- pipe_obj->color_mgmt_changed = false;
- pipe_obj->background_changed = false;
+ if (s == COMMIT_ATOMIC) {
+ if (igt_pipe_obj_is_prop_changed(pipe_obj, IGT_CRTC_OUT_FENCE_PTR))
+ igt_assert(pipe_obj->out_fence_fd >= 0);
- if (s != COMMIT_UNIVERSAL)
- pipe_obj->mode_changed = false;
-
- if (s == COMMIT_ATOMIC && pipe_obj->out_fence_requested) {
- pipe_obj->out_fence_requested = false;
- igt_assert(pipe_obj->out_fence_fd >= 0);
+ pipe_obj->changed = 0;
+ } else {
+ igt_pipe_obj_clear_prop_changed(pipe_obj, IGT_CRTC_BACKGROUND);
+ igt_pipe_obj_clear_prop_changed(pipe_obj, IGT_CRTC_CTM);
+ igt_pipe_obj_clear_prop_changed(pipe_obj, IGT_CRTC_DEGAMMA_LUT);
+ igt_pipe_obj_clear_prop_changed(pipe_obj, IGT_CRTC_GAMMA_LUT);
+
+ if (s != COMMIT_UNIVERSAL) {
+ igt_pipe_obj_clear_prop_changed(pipe_obj, IGT_CRTC_MODE_ID);
+ igt_pipe_obj_clear_prop_changed(pipe_obj, IGT_CRTC_ACTIVE);
+ }
}
for_each_plane_on_pipe(display, pipe, plane) {
@@ -2820,33 +2785,83 @@ void igt_output_override_mode(igt_output_t *output, drmModeModeInfo *mode)
output->use_override_mode = !!mode;
- if (pipe)
- pipe->mode_changed = true;
+ if (pipe) {
+ if (output->display->is_atomic)
+ igt_pipe_replace_blob(pipe, IGT_CRTC_MODE_ID, igt_output_get_mode(output), sizeof(*mode));
+ else
+ igt_pipe_obj_set_prop_changed(pipe, IGT_CRTC_MODE_ID);
+ }
}
void igt_output_set_pipe(igt_output_t *output, enum pipe pipe)
{
igt_display_t *display = output->display;
- igt_pipe_t *old_pipe;
+ igt_pipe_t *old_pipe = NULL, *pipe_obj = NULL;;
igt_assert(output->name);
- if (output->pending_pipe != PIPE_NONE) {
+ if (output->pending_pipe != PIPE_NONE)
old_pipe = igt_output_get_driving_pipe(output);
- old_pipe->mode_changed = true;
- }
+ if (pipe != PIPE_NONE)
+ pipe_obj = &display->pipes[pipe];
LOG(display, "%s: set_pipe(%s)\n", igt_output_name(output),
kmstest_pipe_name(pipe));
output->pending_pipe = pipe;
- if (pipe != PIPE_NONE)
- display->pipes[pipe].mode_changed = true;
+ if (old_pipe) {
+ igt_output_t *old_output;
+
+ old_output = igt_pipe_get_output(old_pipe);
+ if (!old_output) {
+ if (display->is_atomic)
+ igt_pipe_replace_blob(old_pipe, IGT_CRTC_MODE_ID, NULL, 0);
+ else
+ igt_pipe_obj_set_prop_changed(old_pipe, IGT_CRTC_MODE_ID);
+
+ igt_pipe_obj_set_prop_value(old_pipe, IGT_CRTC_ACTIVE, 0);
+ }
+ }
igt_output_set_prop_value(output, IGT_CONNECTOR_CRTC_ID, pipe == PIPE_NONE ? 0 : display->pipes[pipe].crtc_id);
igt_output_refresh(output);
+
+ if (pipe_obj) {
+ if (display->is_atomic)
+ igt_pipe_replace_blob(pipe_obj, IGT_CRTC_MODE_ID, igt_output_get_mode(output), sizeof(drmModeModeInfo));
+ else
+ igt_pipe_obj_set_prop_changed(pipe_obj, IGT_CRTC_MODE_ID);
+
+ igt_pipe_obj_set_prop_value(pipe_obj, IGT_CRTC_ACTIVE, 1);
+ }
+}
+
+/*
+ * igt_pipe_refresh:
+ * @display: a pointer to an #igt_display_t structure
+ * @pipe: Pipe to refresh
+ * @force: Should be set to true if mode_blob is no longer considered
+ * to be valid, for example after doing an atomic commit during fork or closing display fd.
+ *
+ * Requests the pipe to be part of the state on next update.
+ * This is useful when state may have been out of sync after
+ * a fork, or we just want to be sure the pipe is included
+ * in the next commit.
+ */
+void igt_pipe_refresh(igt_display_t *display, enum pipe pipe, bool force)
+{
+ igt_pipe_t *pipe_obj = &display->pipes[pipe];
+
+ if (force && display->is_atomic) {
+ igt_output_t *output = igt_pipe_get_output(pipe_obj);
+
+ pipe_obj->values[IGT_CRTC_MODE_ID] = 0;
+ if (output)
+ igt_pipe_replace_blob(pipe_obj, IGT_CRTC_MODE_ID, igt_output_get_mode(output), sizeof(drmModeModeInfo));
+ } else
+ igt_pipe_obj_set_prop_changed(pipe_obj, IGT_CRTC_MODE_ID);
}
void igt_output_set_scaling_mode(igt_output_t *output, uint64_t scaling_mode)
@@ -3052,28 +3067,25 @@ void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation)
*/
void igt_pipe_request_out_fence(igt_pipe_t *pipe)
{
- pipe->out_fence_requested = true;
+ igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_OUT_FENCE_PTR, (ptrdiff_t)&pipe->out_fence_fd);
}
void
igt_pipe_set_degamma_lut(igt_pipe_t *pipe, void *ptr, size_t length)
{
- igt_pipe_replace_blob(pipe, &pipe->degamma_blob, ptr, length);
- pipe->color_mgmt_changed = 1;
+ igt_pipe_replace_blob(pipe, IGT_CRTC_DEGAMMA_LUT, ptr, length);
}
void
igt_pipe_set_ctm_matrix(igt_pipe_t *pipe, void *ptr, size_t length)
{
- igt_pipe_replace_blob(pipe, &pipe->ctm_blob, ptr, length);
- pipe->color_mgmt_changed = 1;
+ igt_pipe_replace_blob(pipe, IGT_CRTC_CTM, ptr, length);
}
void
igt_pipe_set_gamma_lut(igt_pipe_t *pipe, void *ptr, size_t length)
{
- igt_pipe_replace_blob(pipe, &pipe->gamma_blob, ptr, length);
- pipe->color_mgmt_changed = 1;
+ igt_pipe_replace_blob(pipe, IGT_CRTC_GAMMA_LUT, ptr, length);
}
/**
@@ -3094,9 +3106,7 @@ void igt_crtc_set_background(igt_pipe_t *pipe, uint64_t background)
kmstest_pipe_name(pipe->pipe),
pipe->pipe, background);
- pipe->background = background;
-
- pipe->background_changed = true;
+ igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_BACKGROUND, background);
}
void igt_wait_for_vblank_count(int drm_fd, enum pipe pipe, int count)
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index f87f8be31421..b53127ffef5f 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -313,27 +313,13 @@ struct igt_pipe {
int plane_primary;
igt_plane_t *planes;
- uint32_t atomic_props_crtc[IGT_NUM_CRTC_PROPS];
-
- uint64_t background; /* Background color MSB BGR 16bpc LSB */
- uint32_t background_changed : 1;
- uint32_t background_property;
-
- uint64_t degamma_blob;
- uint32_t degamma_property;
- uint64_t ctm_blob;
- uint32_t ctm_property;
- uint64_t gamma_blob;
- uint32_t gamma_property;
- uint32_t color_mgmt_changed : 1;
+ uint64_t changed;
+ uint32_t props[IGT_NUM_CRTC_PROPS];
+ uint64_t values[IGT_NUM_CRTC_PROPS];
uint32_t crtc_id;
- uint64_t mode_blob;
- bool mode_changed;
-
int32_t out_fence_fd;
- bool out_fence_requested;
};
typedef struct {
@@ -527,17 +513,6 @@ static inline bool igt_output_is_connected(igt_output_t *output)
igt_plane_set_prop_changed(plane, prop); \
} while (0)
-/**
- * igt_atomic_populate_crtc_req:
- * @req: A pointer to drmModeAtomicReq
- * @pipe: A pointer igt_pipe_t
- * @prop: one of igt_atomic_crtc_properties
- * @value: the value to add
- */
-#define igt_atomic_populate_crtc_req(req, pipe, prop, value) \
- igt_assert_lt(0, drmModeAtomicAddProperty(req, pipe->crtc_id,\
- pipe->atomic_props_crtc[prop], value))
-
#define igt_output_is_prop_changed(output, prop) \
(!!((output)->changed & (1 << (prop))))
#define igt_output_set_prop_changed(output, prop) \
@@ -552,26 +527,34 @@ static inline bool igt_output_is_connected(igt_output_t *output)
igt_output_set_prop_changed(output, prop); \
} while (0)
-/*
- * igt_pipe_refresh:
- * @display: a pointer to an #igt_display_t structure
- * @pipe: Pipe to refresh
- * @force: Should be set to true if mode_blob is no longer considered
- * to be valid, for example after doing an atomic commit during fork or closing display fd.
- *
- * Requests the pipe to be part of the state on next update.
- * This is useful when state may have been out of sync after
- * a fork, or we just want to be sure the pipe is included
- * in the next commit.
- */
-static inline void
-igt_pipe_refresh(igt_display_t *display, enum pipe pipe, bool force)
-{
- if (force)
- display->pipes[pipe].mode_blob = 0;
+#define igt_pipe_obj_is_prop_changed(pipe_obj, prop) \
+ (!!((pipe_obj)->changed & (1 << (prop))))
- display->pipes[pipe].mode_changed = true;
-}
+#define igt_pipe_is_prop_changed(display, pipe, prop) \
+ igt_pipe_obj_is_prop_changed(&(display)->pipes[(pipe)], prop)
+
+#define igt_pipe_obj_set_prop_changed(pipe_obj, prop) \
+ (pipe_obj)->changed |= 1 << (prop)
+
+#define igt_pipe_set_prop_changed(display, pipe, prop) \
+ igt_pipe_obj_set_prop_changed(&(display)->pipes[(pipe)], prop)
+
+#define igt_pipe_obj_clear_prop_changed(pipe_obj, prop) \
+ (pipe_obj)->changed &= ~(1 << (prop))
+
+#define igt_pipe_clear_prop_changed(display, pipe, prop) \
+ igt_pipe_obj_clear_prop_changed(&(display)->pipes[(pipe)], prop)
+
+#define igt_pipe_obj_set_prop_value(pipe_obj, prop, value) \
+ do { \
+ (pipe_obj)->values[prop] = (value); \
+ igt_pipe_obj_set_prop_changed(pipe_obj, prop); \
+ } while (0)
+
+#define igt_pipe_set_prop_value(display, pipe, prop, value) \
+ igt_pipe_obj_set_prop_value(&(display)->pipes[(pipe)], prop, value)
+
+void igt_pipe_refresh(igt_display_t *display, enum pipe pipe, bool force);
void igt_enable_connectors(void);
void igt_reset_connectors(void);
diff --git a/tests/kms_atomic_interruptible.c b/tests/kms_atomic_interruptible.c
index 4a2a577412cc..64a005597a21 100644
--- a/tests/kms_atomic_interruptible.c
+++ b/tests/kms_atomic_interruptible.c
@@ -158,8 +158,8 @@ static void run_plane_test(igt_display_t *display, enum pipe pipe, igt_output_t
uint32_t count_props[3] = { 2, 1, 6 };
uint32_t props[] = {
/* crtc: 2 props */
- plane->pipe->atomic_props_crtc[IGT_CRTC_MODE_ID],
- plane->pipe->atomic_props_crtc[IGT_CRTC_ACTIVE],
+ plane->pipe->props[IGT_CRTC_MODE_ID],
+ plane->pipe->props[IGT_CRTC_ACTIVE],
/* connector: 1 prop */
output->props[IGT_CONNECTOR_CRTC_ID],
/* plane: remainder props */
@@ -255,6 +255,10 @@ static void run_plane_test(igt_display_t *display, enum pipe pipe, igt_output_t
igt_waitchildren();
+ /* The mode is unset by the forked helper, force a refresh here */
+ if (test_type == test_legacy_modeset || test_type == test_atomic_modeset)
+ igt_pipe_refresh(display, pipe, true);
+
igt_plane_set_fb(plane, NULL);
igt_plane_set_fb(primary, NULL);
igt_output_set_pipe(output, PIPE_NONE);
diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 2ae75f2d6630..7ddb65cea183 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -633,7 +633,7 @@ static unsigned set_combinations(igt_display_t *display, unsigned mask, struct i
drmModeModeInfo *mode = NULL;
if (!(mask & (1 << pipe))) {
- if (display->pipes[pipe].mode_blob) {
+ if (igt_pipe_is_prop_changed(display, pipe, IGT_CRTC_ACTIVE)) {
event_mask |= 1 << pipe;
igt_plane_set_fb(plane, NULL);
}
diff --git a/tests/kms_crtc_background_color.c b/tests/kms_crtc_background_color.c
index e12e163449f8..659a30b90219 100644
--- a/tests/kms_crtc_background_color.c
+++ b/tests/kms_crtc_background_color.c
@@ -137,7 +137,7 @@ static void test_crtc_background(data_t *data)
igt_output_set_pipe(output, pipe);
plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
- igt_require(plane->pipe->background_property);
+ igt_require(plane->pipe->props[IGT_CRTC_BACKGROUND]);
prepare_crtc(data, output, pipe, plane, 1, PURPLE, BLACK64);
--
2.14.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 25+ messages in thread
* ✓ Fi.CI.BAT: success for lib/igt_kms: Convert properties to be more atomic-like. (rev11)
2017-09-29 9:59 [PATCH i-g-t v4 0/7] lib/igt_kms: Convert properties to be more atomic-like Maarten Lankhorst
` (9 preceding siblings ...)
2017-10-03 9:08 ` ✗ Fi.CI.BAT: failure for lib/igt_kms: Convert properties to be more atomic-like. (rev9) Patchwork
@ 2017-10-04 18:00 ` Patchwork
2017-10-04 22:08 ` ✗ Fi.CI.IGT: warning " Patchwork
11 siblings, 0 replies; 25+ messages in thread
From: Patchwork @ 2017-10-04 18:00 UTC (permalink / raw)
To: Maarten Lankhorst; +Cc: intel-gfx
== Series Details ==
Series: lib/igt_kms: Convert properties to be more atomic-like. (rev11)
URL : https://patchwork.freedesktop.org/series/30903/
State : success
== Summary ==
IGT patchset tested on top of latest successful build
7f93a2632aae7c5865823b4a2fa4cd8c2a1c0977 Update NEWS, bump version to 1.20.
with latest DRM-Tip kernel build CI_DRM_3174
ce6163933673 drm-tip: 2017y-10m-04d-16h-49m-44s UTC integration manifest
No testlist changes.
Test gem_exec_suspend:
Subgroup basic-s3:
dmesg-warn -> PASS (fi-cfl-s) fdo#103026
fdo#103026 https://bugs.freedesktop.org/show_bug.cgi?id=103026
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:462s
fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:478s
fi-blb-e6850 total:289 pass:224 dwarn:1 dfail:0 fail:0 skip:64 time:393s
fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:576s
fi-bwr-2160 total:289 pass:184 dwarn:0 dfail:0 fail:0 skip:105 time:291s
fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:529s
fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:537s
fi-byt-j1900 total:289 pass:254 dwarn:1 dfail:0 fail:0 skip:34 time:547s
fi-byt-n2820 total:289 pass:250 dwarn:1 dfail:0 fail:0 skip:38 time:532s
fi-cfl-s total:289 pass:257 dwarn:0 dfail:0 fail:0 skip:32 time:575s
fi-cnl-y total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:639s
fi-elk-e7500 total:289 pass:230 dwarn:0 dfail:0 fail:0 skip:59 time:444s
fi-glk-1 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:595s
fi-hsw-4770 total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:436s
fi-hsw-4770r total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:421s
fi-ilk-650 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:469s
fi-ivb-3520m total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:502s
fi-ivb-3770 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:476s
fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:509s
fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:578s
fi-kbl-7567u total:289 pass:265 dwarn:4 dfail:0 fail:0 skip:20 time:499s
fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:594s
fi-pnv-d510 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:654s
fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:473s
fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:619s
fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:538s
fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:522s
fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:480s
fi-snb-2520m total:289 pass:251 dwarn:0 dfail:0 fail:0 skip:38 time:590s
fi-snb-2600 total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:439s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_297/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 25+ messages in thread
* ✗ Fi.CI.IGT: warning for lib/igt_kms: Convert properties to be more atomic-like. (rev11)
2017-09-29 9:59 [PATCH i-g-t v4 0/7] lib/igt_kms: Convert properties to be more atomic-like Maarten Lankhorst
` (10 preceding siblings ...)
2017-10-04 18:00 ` ✓ Fi.CI.BAT: success for lib/igt_kms: Convert properties to be more atomic-like. (rev11) Patchwork
@ 2017-10-04 22:08 ` Patchwork
11 siblings, 0 replies; 25+ messages in thread
From: Patchwork @ 2017-10-04 22:08 UTC (permalink / raw)
To: Maarten Lankhorst; +Cc: intel-gfx
== Series Details ==
Series: lib/igt_kms: Convert properties to be more atomic-like. (rev11)
URL : https://patchwork.freedesktop.org/series/30903/
State : warning
== Summary ==
Test kms_flip:
Subgroup plain-flip-fb-recreate-interruptible:
pass -> FAIL (shard-hsw) fdo#100368
Test gem_flink_race:
Subgroup flink_close:
fail -> PASS (shard-hsw) fdo#102655
Test perf:
Subgroup blocking:
fail -> PASS (shard-hsw) fdo#102252
Test gem_eio:
Subgroup in-flight-contexts:
dmesg-warn -> PASS (shard-hsw) fdo#102886
Test kms_addfb_basic:
Subgroup bo-too-small-due-to-tiling:
pass -> DMESG-WARN (shard-hsw)
Test kms_busy:
Subgroup extended-modeset-hang-newfb-render-C:
pass -> SKIP (shard-hsw)
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#102655 https://bugs.freedesktop.org/show_bug.cgi?id=102655
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#102886 https://bugs.freedesktop.org/show_bug.cgi?id=102886
shard-hsw total:2430 pass:1330 dwarn:7 dfail:0 fail:8 skip:1085 time:10067s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_297/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2017-10-04 22:08 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-29 9:59 [PATCH i-g-t v4 0/7] lib/igt_kms: Convert properties to be more atomic-like Maarten Lankhorst
2017-09-29 9:59 ` [PATCH i-g-t v4 1/7] tests: Stop looking at plane private members Maarten Lankhorst
2017-09-29 13:13 ` Mika Kahola
2017-10-02 9:31 ` Maarten Lankhorst
2017-09-29 9:59 ` [PATCH i-g-t v4 2/7] lib/igt_kms: Change output->pending_crtc_idx_mask to output->pending_pipe Maarten Lankhorst
2017-10-02 10:19 ` Mika Kahola
2017-09-29 9:59 ` [PATCH i-g-t v4 3/7] lib/igt_kms: Commit primary plane when a modeset is forced on a pipe Maarten Lankhorst
2017-10-02 11:02 ` Mika Kahola
2017-09-29 9:59 ` [PATCH i-g-t v4 4/7] lib/igt_kms: Rework connector properties to be more atomic, v2 Maarten Lankhorst
2017-10-02 12:22 ` Mika Kahola
2017-09-29 9:59 ` [PATCH i-g-t v4 5/7] lib/igt_kms: Rework plane properties to be more atomic, v4 Maarten Lankhorst
2017-10-03 12:05 ` Mika Kahola
2017-10-04 7:26 ` Maarten Lankhorst
2017-10-04 13:54 ` [PATCH i-g-t] lib/igt_kms: Rework plane properties to be more atomic, v5 Maarten Lankhorst
2017-09-29 9:59 ` [PATCH i-g-t v4 6/7] lib/igt_kms: Rework pipe properties to be more atomic, v4.1 Maarten Lankhorst
2017-10-03 7:45 ` [PATCH i-g-t] lib/igt_kms: Rework pipe properties to be more atomic, v5 Maarten Lankhorst
2017-10-04 13:55 ` [PATCH i-g-t] lib/igt_kms: Rework pipe properties to be more atomic, v6 Maarten Lankhorst
2017-09-29 9:59 ` [PATCH i-g-t v4 7/7] igt/kms_rotation_crc : Fix flip tests for sprite plane Maarten Lankhorst
2017-09-29 10:58 ` Mika Kahola
2017-09-29 11:03 ` ✓ Fi.CI.BAT: success for lib/igt_kms: Convert properties to be more atomic-like. (rev8) Patchwork
2017-09-29 12:13 ` ✗ Fi.CI.IGT: failure " Patchwork
2017-10-03 9:08 ` ✗ Fi.CI.BAT: failure for lib/igt_kms: Convert properties to be more atomic-like. (rev9) Patchwork
2017-10-03 10:22 ` Petri Latvala
2017-10-04 18:00 ` ✓ Fi.CI.BAT: success for lib/igt_kms: Convert properties to be more atomic-like. (rev11) Patchwork
2017-10-04 22:08 ` ✗ Fi.CI.IGT: warning " Patchwork
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.