From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 2/5] tests/kms_tiled_display: Replace the igt_display pointer with a struct
Date: Fri, 13 Mar 2020 18:11:30 +0200 [thread overview]
Message-ID: <20200313161133.2012-2-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20200313161133.2012-1-ville.syrjala@linux.intel.com>
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
No point in storing a pointer when we can just store the struct itself.
The lifetime is the same.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
tests/kms_tiled_display.c | 32 +++++++++++++++-----------------
1 file changed, 15 insertions(+), 17 deletions(-)
diff --git a/tests/kms_tiled_display.c b/tests/kms_tiled_display.c
index f01152f86395..0671ac6c2249 100644
--- a/tests/kms_tiled_display.c
+++ b/tests/kms_tiled_display.c
@@ -55,7 +55,7 @@ typedef struct {
int drm_fd;
int num_h_tiles;
igt_fb_t fb_test_pattern;
- igt_display_t *display;
+ igt_display_t display;
data_connector_t *conns;
enum igt_commit_style commit;
struct timeval first_ts;
@@ -131,8 +131,8 @@ static void get_connectors(data_t *data)
igt_output_t *output;
data_connector_t *conns = data->conns;
- for_each_connected_output(data->display, output) {
- conns[count].connector = drmModeGetConnector(data->display->drm_fd,
+ for_each_connected_output(&data->display, output) {
+ conns[count].connector = drmModeGetConnector(data->display.drm_fd,
output->id);
igt_assert(conns[count].connector);
@@ -177,11 +177,11 @@ static void reset_mode(data_t *data)
data_connector_t *conns = data->conns;
for (count = 0; count < data->num_h_tiles; count++) {
- output = igt_output_from_connector(data->display,
+ output = igt_output_from_connector(&data->display,
conns[count].connector);
igt_output_set_pipe(output, PIPE_NONE);
}
- igt_display_commit2(data->display, data->commit);
+ igt_display_commit2(&data->display, data->commit);
}
static void test_cleanup(data_t *data)
@@ -196,7 +196,7 @@ static void test_cleanup(data_t *data)
}
}
igt_remove_fb(data->drm_fd, &data->fb_test_pattern);
- igt_display_commit2(data->display, data->commit);
+ igt_display_commit2(&data->display, data->commit);
memset(conns, 0, sizeof(data_connector_t) * data->num_h_tiles);
}
@@ -217,10 +217,10 @@ static void setup_mode(data_t *data)
reset_mode(data);
for (count = 0; count < data->num_h_tiles; count++) {
- output = igt_output_from_connector(data->display,
+ output = igt_output_from_connector(&data->display,
conns[count].connector);
- for_each_pipe(data->display, pipe) {
+ for_each_pipe(&data->display, pipe) {
pipe_in_use = false;
found = false;
@@ -257,7 +257,7 @@ static void setup_mode(data_t *data)
igt_require(found);
igt_output_override_mode(output, mode);
}
- igt_display_commit_atomic(data->display, DRM_MODE_ATOMIC_ALLOW_MODESET,
+ igt_display_commit_atomic(&data->display, DRM_MODE_ATOMIC_ALLOW_MODESET,
NULL);
}
@@ -316,7 +316,7 @@ static data_connector_t *conn_for_crtc(data_t *data, unsigned int crtc_id)
for (int i = 0; i < data->num_h_tiles; i++) {
data_connector_t *conn = &data->conns[i];
- if (data->display->pipes[conn->pipe].crtc_id == crtc_id)
+ if (data->display.pipes[conn->pipe].crtc_id == crtc_id)
return conn;
}
@@ -375,7 +375,6 @@ static bool got_all_page_flips(data_t *data)
igt_main
{
- igt_display_t display;
data_t data = {0};
struct pollfd pfd = {0};
drmEventContext drm_event = {0};
@@ -385,15 +384,14 @@ igt_main
data.drm_fd = drm_open_driver_master(DRIVER_ANY);
kmstest_set_vt_graphics_mode();
- igt_display_require(&display, data.drm_fd);
- igt_display_reset(&display);
+ igt_display_require(&data.display, data.drm_fd);
+ igt_display_reset(&data.display);
- data.display = &display;
pfd.fd = data.drm_fd;
pfd.events = POLLIN;
drm_event.version = 3;
drm_event.page_flip_handler2 = page_flip_handler;
- data.commit = data.display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY;
+ data.commit = data.display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY;
igt_require(data.commit == COMMIT_ATOMIC);
get_number_of_h_tiles(&data);
@@ -411,7 +409,7 @@ igt_main
setup_mode(&data);
setup_framebuffer(&data);
timerclear(&data.first_ts);
- igt_display_commit_atomic(data.display, DRM_MODE_ATOMIC_NONBLOCK |
+ igt_display_commit_atomic(&data.display, DRM_MODE_ATOMIC_NONBLOCK |
DRM_MODE_PAGE_FLIP_EVENT, &data);
while (!got_all_page_flips(&data)) {
ret = poll(&pfd, 1, 1000);
@@ -426,6 +424,6 @@ igt_main
free(data.conns);
close(data.drm_fd);
kmstest_restore_vt_mode();
- igt_display_fini(data.display);
+ igt_display_fini(&data.display);
}
}
--
2.24.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2020-03-13 16:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-13 16:11 [igt-dev] [PATCH i-g-t 1/5] tests/kms_tiled_display: Get rid of DP stuff Ville Syrjala
2020-03-13 16:11 ` Ville Syrjala [this message]
2020-03-13 16:11 ` [igt-dev] [PATCH i-g-t 3/5] tests/kms_tiled_display: Limit the difference in the timestamps to one scanline Ville Syrjala
2020-03-13 16:11 ` [igt-dev] [PATCH i-g-t 4/5] lib/edid: Add support for making DisplayID tile blocks Ville Syrjala
2020-03-13 16:11 ` [igt-dev] [PATCH i-g-t 5/5] tests/kms_tiled_display: Override the EDID to fake some tiles Ville Syrjala
2020-03-13 17:11 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/5] tests/kms_tiled_display: Get rid of DP stuff Patchwork
2020-03-13 23:10 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2021-10-19 20:19 [igt-dev] [PATCH i-g-t 0/5] kms: Run tiled display tests on any set of connectors Ville Syrjala
2021-10-19 20:19 ` [igt-dev] [PATCH i-g-t 2/5] tests/kms_tiled_display: Replace the igt_display pointer with a struct Ville Syrjala
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200313161133.2012-2-ville.syrjala@linux.intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox