* [PATCH i-g-t 0/7] kms_flip: cleanups
@ 2019-03-04 15:29 Rodrigo Siqueira
2019-03-04 15:29 ` [PATCH i-g-t 1/7] kms_flip: Removes unreachable code related to TEST_RPM Rodrigo Siqueira
` (6 more replies)
0 siblings, 7 replies; 11+ messages in thread
From: Rodrigo Siqueira @ 2019-03-04 15:29 UTC (permalink / raw)
To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx
[-- Attachment #1.1: Type: text/plain, Size: 1097 bytes --]
The last few weeks, I have been dive into the page flip and vblank with
the goal to learn how the user space interact with DRM; because of this,
I am studying the kms_flip code. As a result, I noticed a bunch of
cleanups that could be useful for improving the overall quality of
kms_flip. This patchset can be seen in two parts:
1. Eliminates unreachable tests
2. Basic cleanups with the goal to improve the code readability
In particular, the patch number three enables kms_flip to work without
any issue in any non-intel drivers.
Rodrigo Siqueira (7):
kms_flip: Removes unreachable code related to TEST_RPM
kms_flip: Removes unreachable code related to TEST_TS_CONT
kms_flip: Fix warning related to i915 gem dependence
kms_flip: Remove unreachable condition in wait_for_events
kms_flip: remove magic constant in run_test_on_crtc_set()
kms_flip: Rework set_mode()
kms_flip: Standardize return value for fb_is_bound
tests/kms_flip.c | 88 +++++++++++++++++-------------------------------
1 file changed, 31 insertions(+), 57 deletions(-)
--
2.21.0
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH i-g-t 1/7] kms_flip: Removes unreachable code related to TEST_RPM
2019-03-04 15:29 [PATCH i-g-t 0/7] kms_flip: cleanups Rodrigo Siqueira
@ 2019-03-04 15:29 ` Rodrigo Siqueira
2019-03-04 15:30 ` [PATCH i-g-t 2/7] kms_flip: Removes unreachable code related to TEST_TS_CONT Rodrigo Siqueira
` (5 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Rodrigo Siqueira @ 2019-03-04 15:29 UTC (permalink / raw)
To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx
[-- Attachment #1.1: Type: text/plain, Size: 2201 bytes --]
This commit removes the code related to TEST_RPM test because the
kms_flip never sets this flags, i.e., TEST_RPM is not used. Take a look
at commit 07a3fccf to see why this flag is never set.
Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
tests/kms_flip.c | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 798fc4e8..f769d30e 100755
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -68,7 +68,6 @@
#define TEST_ENOENT (1 << 22)
#define TEST_FENCE_STRESS (1 << 23)
#define TEST_VBLANK_RACE (1 << 24)
-#define TEST_RPM (1 << 25)
#define TEST_SUSPEND (1 << 26)
#define TEST_TS_CONT (1 << 27)
#define TEST_BO_TOOBIG (1 << 28)
@@ -809,9 +808,6 @@ static unsigned int run_test_step(struct test_output *o)
"failed to disable output: %s\n",
strerror(errno));
- if (o->flags & TEST_RPM)
- igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
-
if (o->flags & TEST_SUSPEND)
igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
SUSPEND_TEST_NONE);
@@ -1321,9 +1317,6 @@ static int run_test(int duration, int flags)
igt_require((flags & TEST_HANG) == 0 || !is_wedged(drm_fd));
- if (flags & TEST_RPM)
- igt_require(igt_setup_runtime_pm());
-
resources = drmModeGetResources(drm_fd);
igt_require(resources);
@@ -1570,10 +1563,6 @@ int main(int argc, char **argv)
if (tests[i].flags & TEST_NO_2X_OUTPUT)
continue;
- /* code doesn't disable all crtcs, so skip rpm tests */
- if (tests[i].flags & TEST_RPM)
- continue;
-
igt_subtest_f( "2x-%s", tests[i].name)
run_pair(tests[i].duration, tests[i].flags);
}
@@ -1592,10 +1581,6 @@ int main(int argc, char **argv)
if (tests[i].flags & TEST_NO_2X_OUTPUT)
continue;
- /* code doesn't disable all crtcs, so skip rpm tests */
- if (tests[i].flags & TEST_RPM)
- continue;
-
igt_subtest_f( "2x-%s-interruptible", tests[i].name)
run_pair(tests[i].duration, tests[i].flags);
}
--
2.21.0
--
Rodrigo Siqueira
https://siqueira.tech
Graduate Student
Department of Computer Science
University of São Paulo
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH i-g-t 2/7] kms_flip: Removes unreachable code related to TEST_TS_CONT
2019-03-04 15:29 [PATCH i-g-t 0/7] kms_flip: cleanups Rodrigo Siqueira
2019-03-04 15:29 ` [PATCH i-g-t 1/7] kms_flip: Removes unreachable code related to TEST_RPM Rodrigo Siqueira
@ 2019-03-04 15:30 ` Rodrigo Siqueira
2019-03-04 15:30 ` [PATCH i-g-t 3/7] kms_flip: Fix warning related to i915 gem dependence Rodrigo Siqueira
` (4 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Rodrigo Siqueira @ 2019-03-04 15:30 UTC (permalink / raw)
To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx
[-- Attachment #1.1: Type: text/plain, Size: 1668 bytes --]
This commit removes the code related to TEST_TS_CONT test because the
kms_flip never sets this flags, i.e., TEST_TS_CONT is not used. Take a
look at commit 07a3fccf to see why this flag is never set.
Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
tests/kms_flip.c | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index f769d30e..0d261b77 100755
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -69,7 +69,6 @@
#define TEST_FENCE_STRESS (1 << 23)
#define TEST_VBLANK_RACE (1 << 24)
#define TEST_SUSPEND (1 << 26)
-#define TEST_TS_CONT (1 << 27)
#define TEST_BO_TOOBIG (1 << 28)
#define TEST_BASIC (1 << 30)
@@ -497,21 +496,6 @@ static void check_state(const struct test_output *o, const struct event_state *e
"unexpected %s seq %u, should be >= %u\n",
es->name, es->current_seq, es->last_seq + o->seq_step);
- /* Check that the vblank frame didn't wrap unexpectedly. */
- if (o->flags & TEST_TS_CONT) {
- /* Ignore seq_step here since vblank waits time out immediately
- * when we kill the crtc. */
- igt_assert_f(es->current_seq - es->last_seq >= 0,
- "unexpected %s seq %u, should be >= %u\n",
- es->name, es->current_seq, es->last_seq);
- igt_assert_f(es->current_seq - es->last_seq <= 150,
- "unexpected %s seq %u, should be < %u\n",
- es->name, es->current_seq, es->last_seq + 150);
-
- igt_debug("testing ts continuity: Current frame %u, old frame %u\n",
- es->current_seq, es->last_seq);
- }
-
if (o->flags & TEST_CHECK_TS) {
double elapsed, expected;
--
2.21.0
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH i-g-t 3/7] kms_flip: Fix warning related to i915 gem dependence
2019-03-04 15:29 [PATCH i-g-t 0/7] kms_flip: cleanups Rodrigo Siqueira
2019-03-04 15:29 ` [PATCH i-g-t 1/7] kms_flip: Removes unreachable code related to TEST_RPM Rodrigo Siqueira
2019-03-04 15:30 ` [PATCH i-g-t 2/7] kms_flip: Removes unreachable code related to TEST_TS_CONT Rodrigo Siqueira
@ 2019-03-04 15:30 ` Rodrigo Siqueira
2019-03-04 15:30 ` [PATCH i-g-t 4/7] kms_flip: Remove unreachable condition in wait_for_events Rodrigo Siqueira
` (3 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Rodrigo Siqueira @ 2019-03-04 15:30 UTC (permalink / raw)
To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx
[-- Attachment #1.1: Type: text/plain, Size: 1400 bytes --]
In the kms_flip tests has an igt_fixture that allocates memory for i915
driver with “drm_intel_bufmgr_gem_init()”, which produces the following
warning:
IGT-Version: 1.23-g8d81c2c2 (x86_64) (Linux: 5.0.0-rc7-VKMS-RULES+ x86_64)
Using monotonic timestamps
DRM_IOCTL_I915_GEM_APERTURE failed: Invalid argument
Assuming 131072kB available aperture size.
May lead to reduced performance or incorrect rendering.
get chip id failed: -1 [22]
This commit handles this specific dependence with the i915 driver which
make the kms_flip logs better.
Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
tests/kms_flip.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 0d261b77..57138ec1 100755
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -1528,10 +1528,12 @@ int main(int argc, char **argv)
igt_install_exit_handler(kms_flip_exit_handler);
get_timestamp_format();
- bufmgr = drm_intel_bufmgr_gem_init(drm_fd, 4096);
- if (bufmgr) {
- devid = intel_get_drm_devid(drm_fd);
- batch = intel_batchbuffer_alloc(bufmgr, devid);
+ if (is_i915_device(drm_fd)) {
+ bufmgr = drm_intel_bufmgr_gem_init(drm_fd, 4096);
+ if (bufmgr) {
+ devid = intel_get_drm_devid(drm_fd);
+ batch = intel_batchbuffer_alloc(bufmgr, devid);
+ }
}
}
--
2.21.0
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH i-g-t 4/7] kms_flip: Remove unreachable condition in wait_for_events
2019-03-04 15:29 [PATCH i-g-t 0/7] kms_flip: cleanups Rodrigo Siqueira
` (2 preceding siblings ...)
2019-03-04 15:30 ` [PATCH i-g-t 3/7] kms_flip: Fix warning related to i915 gem dependence Rodrigo Siqueira
@ 2019-03-04 15:30 ` Rodrigo Siqueira
2019-03-05 10:39 ` Petri Latvala
2019-03-04 15:31 ` [PATCH i-g-t 5/7] kms_flip: Remove magic constant in run_test_on_crtc_set() Rodrigo Siqueira
` (2 subsequent siblings)
6 siblings, 1 reply; 11+ messages in thread
From: Rodrigo Siqueira @ 2019-03-04 15:30 UTC (permalink / raw)
To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx
[-- Attachment #1.1: Type: text/plain, Size: 1145 bytes --]
In the function wait_for_events() has a double check in the select()
function return as described below:
igt_assert_f(ret >= 0,
"select error (errno %i)\n", errno);
igt_assert_f(ret > 0,
"select timed out or error (ret %d)\n", ret);
Note that the second assert condition will not be reached because of the
first assertion. This commit removes the code duplication and update the
error message.
Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
tests/kms_flip.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 57138ec1..9ef77de9 100755
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -1014,9 +1014,7 @@ static unsigned int wait_for_events(struct test_output *o)
} while (ret < 0 && errno == EINTR);
igt_assert_f(ret >= 0,
- "select error (errno %i)\n", errno);
- igt_assert_f(ret > 0,
- "select timed out or error (ret %d)\n", ret);
+ "select error: %s (%d))\n", strerror(errno), ret);
igt_assert_f(!FD_ISSET(0, &fds),
"no fds active, breaking\n");
--
2.21.0
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH i-g-t 5/7] kms_flip: Remove magic constant in run_test_on_crtc_set()
2019-03-04 15:29 [PATCH i-g-t 0/7] kms_flip: cleanups Rodrigo Siqueira
` (3 preceding siblings ...)
2019-03-04 15:30 ` [PATCH i-g-t 4/7] kms_flip: Remove unreachable condition in wait_for_events Rodrigo Siqueira
@ 2019-03-04 15:31 ` Rodrigo Siqueira
2019-03-04 15:31 ` [PATCH i-g-t 6/7] kms_flip: Rework set_mode() Rodrigo Siqueira
2019-03-04 15:32 ` [PATCH i-g-t 7/7] kms_flip: Standardize return value for fb_is_bound Rodrigo Siqueira
6 siblings, 0 replies; 11+ messages in thread
From: Rodrigo Siqueira @ 2019-03-04 15:31 UTC (permalink / raw)
To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx
[-- Attachment #1.1: Type: text/plain, Size: 2041 bytes --]
The function run_test_on_crtc_set() expects a parameter named crtc_count
which slight changes the behavior of the test. If this crtc_count is
‘1’, the test will run in a single CRTC; otherwise, it will run in two
different CRTC. However, this function uses hardcoded literal 1 and 2
for each case. This patch creates two constant with the goal to improve
the readability.
Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
tests/kms_flip.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 9ef77de9..42ae3ebc 100755
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -76,6 +76,9 @@
#define EVENT_FLIP (1 << 0)
#define EVENT_VBLANK (1 << 1)
+#define RUN_TEST 1
+#define RUN_PAIR 2
+
#ifndef DRM_CAP_TIMESTAMP_MONOTONIC
#define DRM_CAP_TIMESTAMP_MONOTONIC 6
#endif
@@ -1164,7 +1167,7 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
int i;
switch (crtc_count) {
- case 1:
+ case RUN_TEST:
connector_find_preferred_mode(o->_connector[0], crtc_idxs[0], o);
if (!o->mode_valid)
return;
@@ -1175,7 +1178,7 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
kmstest_connector_type_str(o->kconnector[0]->connector_type),
o->kconnector[0]->connector_type_id);
break;
- case 2:
+ case RUN_PAIR:
connector_find_compatible_mode(crtc_idxs[0], crtc_idxs[1], o);
if (!o->mode_valid)
return;
@@ -1341,7 +1344,7 @@ static int run_test(int duration, int flags)
o.depth = 24;
crtc_idx = n;
- run_test_on_crtc_set(&o, &crtc_idx, 1, duration);
+ run_test_on_crtc_set(&o, &crtc_idx, RUN_TEST, duration);
}
}
@@ -1410,7 +1413,8 @@ static int run_pair(int duration, int flags)
crtc_idxs[0] = n;
crtc_idxs[1] = m;
- run_test_on_crtc_set(&o, crtc_idxs, 2,
+ run_test_on_crtc_set(&o, crtc_idxs,
+ RUN_PAIR,
duration);
}
}
--
2.21.0
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH i-g-t 6/7] kms_flip: Rework set_mode()
2019-03-04 15:29 [PATCH i-g-t 0/7] kms_flip: cleanups Rodrigo Siqueira
` (4 preceding siblings ...)
2019-03-04 15:31 ` [PATCH i-g-t 5/7] kms_flip: Remove magic constant in run_test_on_crtc_set() Rodrigo Siqueira
@ 2019-03-04 15:31 ` Rodrigo Siqueira
2019-03-04 15:32 ` [PATCH i-g-t 7/7] kms_flip: Standardize return value for fb_is_bound Rodrigo Siqueira
6 siblings, 0 replies; 11+ messages in thread
From: Rodrigo Siqueira @ 2019-03-04 15:31 UTC (permalink / raw)
To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx
[-- Attachment #1.1: Type: text/plain, Size: 1304 bytes --]
This patch removes the duplicate code inside the function set_mode().
Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
tests/kms_flip.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 42ae3ebc..de3ab600 100755
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -609,22 +609,24 @@ static bool is_wedged(int fd)
static int set_mode(struct test_output *o, uint32_t fb, int x, int y)
{
- int n;
+ int n, ret;
for (n = o->count - 1; n >= 0; n--) {
+ uint32_t buffer_id = fb, x_crtc = x, y_crtc = y;
+ uint32_t *conn = &o->_connector[n];
+ int count = 1;
+ drmModeModeInfoPtr mode = &o->kmode[n];
+
if (fb == 0) {
- int ret = drmModeSetCrtc(drm_fd, o->_crtc[n],
- 0, 0, 0,
- 0, 0, 0);
- if (ret)
- return ret;
- } else {
- int ret = drmModeSetCrtc(drm_fd, o->_crtc[n],
- fb, x, y,
- &o->_connector[n], 1, &o->kmode[n]);
- if (ret)
- return ret;
+ buffer_id = x_crtc = y_crtc = count = 0;
+ conn = NULL; mode = NULL;
}
+
+ ret = drmModeSetCrtc(drm_fd, o->_crtc[n],
+ buffer_id, x_crtc, y_crtc,
+ conn, count, mode);
+ if (ret)
+ return ret;
}
return 0;
--
2.21.0
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH i-g-t 7/7] kms_flip: Standardize return value for fb_is_bound
2019-03-04 15:29 [PATCH i-g-t 0/7] kms_flip: cleanups Rodrigo Siqueira
` (5 preceding siblings ...)
2019-03-04 15:31 ` [PATCH i-g-t 6/7] kms_flip: Rework set_mode() Rodrigo Siqueira
@ 2019-03-04 15:32 ` Rodrigo Siqueira
2019-03-06 11:25 ` [igt-dev] " Maarten Lankhorst
6 siblings, 1 reply; 11+ messages in thread
From: Rodrigo Siqueira @ 2019-03-04 15:32 UTC (permalink / raw)
To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx
[-- Attachment #1.1: Type: text/plain, Size: 968 bytes --]
The function fb_is_bound() mix integer value with booleans for handling
the return value. This commit standardizes the return value of
fb_is_bound() for using only booleans.
Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
tests/kms_flip.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index de3ab600..abfdd363 100755
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -947,8 +947,7 @@ static void paint_flip_mode(struct igt_fb *fb, bool odd_frame)
igt_put_cairo_ctx(drm_fd, fb, cr);
}
-static int
-fb_is_bound(struct test_output *o, int fb)
+static bool fb_is_bound(struct test_output *o, int fb)
{
int n;
@@ -958,7 +957,7 @@ fb_is_bound(struct test_output *o, int fb)
};
if (drmIoctl(drm_fd, DRM_IOCTL_MODE_GETCRTC, &mode))
- return 0;
+ return false;
if (!mode.mode_valid || mode.fb_id != fb)
return false;
--
2.21.0
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH i-g-t 4/7] kms_flip: Remove unreachable condition in wait_for_events
2019-03-04 15:30 ` [PATCH i-g-t 4/7] kms_flip: Remove unreachable condition in wait_for_events Rodrigo Siqueira
@ 2019-03-05 10:39 ` Petri Latvala
0 siblings, 0 replies; 11+ messages in thread
From: Petri Latvala @ 2019-03-05 10:39 UTC (permalink / raw)
To: Rodrigo Siqueira; +Cc: igt-dev, intel-gfx
On Mon, Mar 04, 2019 at 12:30:55PM -0300, Rodrigo Siqueira wrote:
> In the function wait_for_events() has a double check in the select()
> function return as described below:
>
> igt_assert_f(ret >= 0,
> "select error (errno %i)\n", errno);
> igt_assert_f(ret > 0,
> "select timed out or error (ret %d)\n", ret);
>
> Note that the second assert condition will not be reached because of the
> first assertion. This commit removes the code duplication and update the
> error message.
It will be reached if ret equals 0.
If select() returns 0, errno is unspecified, the main reason for the
separation.
--
Petri Latvala
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 7/7] kms_flip: Standardize return value for fb_is_bound
2019-03-04 15:32 ` [PATCH i-g-t 7/7] kms_flip: Standardize return value for fb_is_bound Rodrigo Siqueira
@ 2019-03-06 11:25 ` Maarten Lankhorst
2019-03-06 21:40 ` Rodrigo Siqueira
0 siblings, 1 reply; 11+ messages in thread
From: Maarten Lankhorst @ 2019-03-06 11:25 UTC (permalink / raw)
To: Rodrigo Siqueira, Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx
Op 04-03-2019 om 16:32 schreef Rodrigo Siqueira:
> The function fb_is_bound() mix integer value with booleans for handling
> the return value. This commit standardizes the return value of
> fb_is_bound() for using only booleans.
>
> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> ---
> tests/kms_flip.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/tests/kms_flip.c b/tests/kms_flip.c
> index de3ab600..abfdd363 100755
> --- a/tests/kms_flip.c
> +++ b/tests/kms_flip.c
> @@ -947,8 +947,7 @@ static void paint_flip_mode(struct igt_fb *fb, bool odd_frame)
> igt_put_cairo_ctx(drm_fd, fb, cr);
> }
>
> -static int
> -fb_is_bound(struct test_output *o, int fb)
> +static bool fb_is_bound(struct test_output *o, int fb)
> {
> int n;
>
> @@ -958,7 +957,7 @@ fb_is_bound(struct test_output *o, int fb)
> };
>
> if (drmIoctl(drm_fd, DRM_IOCTL_MODE_GETCRTC, &mode))
> - return 0;
> + return false;
>
> if (!mode.mode_valid || mode.fb_id != fb)
> return false;
>
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
Nice cleanup. Hope we can eventually convert kms_flip to igt_display at some point for readability.
For all except patch 4:
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
:)
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 7/7] kms_flip: Standardize return value for fb_is_bound
2019-03-06 11:25 ` [igt-dev] " Maarten Lankhorst
@ 2019-03-06 21:40 ` Rodrigo Siqueira
0 siblings, 0 replies; 11+ messages in thread
From: Rodrigo Siqueira @ 2019-03-06 21:40 UTC (permalink / raw)
To: Maarten Lankhorst; +Cc: igt-dev, intel-gfx
[-- Attachment #1.1: Type: text/plain, Size: 2108 bytes --]
On 03/06, Maarten Lankhorst wrote:
> Op 04-03-2019 om 16:32 schreef Rodrigo Siqueira:
> > The function fb_is_bound() mix integer value with booleans for handling
> > the return value. This commit standardizes the return value of
> > fb_is_bound() for using only booleans.
> >
> > Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> > ---
> > tests/kms_flip.c | 5 ++---
> > 1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/tests/kms_flip.c b/tests/kms_flip.c
> > index de3ab600..abfdd363 100755
> > --- a/tests/kms_flip.c
> > +++ b/tests/kms_flip.c
> > @@ -947,8 +947,7 @@ static void paint_flip_mode(struct igt_fb *fb, bool odd_frame)
> > igt_put_cairo_ctx(drm_fd, fb, cr);
> > }
> >
> > -static int
> > -fb_is_bound(struct test_output *o, int fb)
> > +static bool fb_is_bound(struct test_output *o, int fb)
> > {
> > int n;
> >
> > @@ -958,7 +957,7 @@ fb_is_bound(struct test_output *o, int fb)
> > };
> >
> > if (drmIoctl(drm_fd, DRM_IOCTL_MODE_GETCRTC, &mode))
> > - return 0;
> > + return false;
> >
> > if (!mode.mode_valid || mode.fb_id != fb)
> > return false;
> >
> > _______________________________________________
> > igt-dev mailing list
> > igt-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/igt-dev
>
> Nice cleanup. Hope we can eventually convert kms_flip to igt_display at some point for readability.
Hi Petri and Maarten,
First of all, thanks for your review and the clarification in the patch
4 (I really missed the ret = 0, thanks for highlight this case :)
Maarten, could you give some extra details about the idea of converting
kms_flip to igt_display? Could you point out some links or code
reference? I'm just curious to know a little more about this subject.
Best Regards
Rodrigo Siqueira
> For all except patch 4:
>
> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>
> :)
>
--
Rodrigo Siqueira
https://siqueira.tech
Graduate Student
Department of Computer Science
University of São Paulo
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2019-03-06 21:40 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-04 15:29 [PATCH i-g-t 0/7] kms_flip: cleanups Rodrigo Siqueira
2019-03-04 15:29 ` [PATCH i-g-t 1/7] kms_flip: Removes unreachable code related to TEST_RPM Rodrigo Siqueira
2019-03-04 15:30 ` [PATCH i-g-t 2/7] kms_flip: Removes unreachable code related to TEST_TS_CONT Rodrigo Siqueira
2019-03-04 15:30 ` [PATCH i-g-t 3/7] kms_flip: Fix warning related to i915 gem dependence Rodrigo Siqueira
2019-03-04 15:30 ` [PATCH i-g-t 4/7] kms_flip: Remove unreachable condition in wait_for_events Rodrigo Siqueira
2019-03-05 10:39 ` Petri Latvala
2019-03-04 15:31 ` [PATCH i-g-t 5/7] kms_flip: Remove magic constant in run_test_on_crtc_set() Rodrigo Siqueira
2019-03-04 15:31 ` [PATCH i-g-t 6/7] kms_flip: Rework set_mode() Rodrigo Siqueira
2019-03-04 15:32 ` [PATCH i-g-t 7/7] kms_flip: Standardize return value for fb_is_bound Rodrigo Siqueira
2019-03-06 11:25 ` [igt-dev] " Maarten Lankhorst
2019-03-06 21:40 ` Rodrigo Siqueira
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox