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: Tue, 19 Oct 2021 23:19:37 +0300 [thread overview]
Message-ID: <20211019201940.31729-3-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20211019201940.31729-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 | 35 +++++++++++++++++------------------
1 file changed, 17 insertions(+), 18 deletions(-)
diff --git a/tests/kms_tiled_display.c b/tests/kms_tiled_display.c
index 9eb980285b02..cb4762d7c6b1 100644
--- a/tests/kms_tiled_display.c
+++ b/tests/kms_tiled_display.c
@@ -56,7 +56,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;
@@ -139,8 +139,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);
@@ -185,11 +185,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)
@@ -204,7 +204,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);
}
static void setup_mode(data_t *data)
@@ -224,10 +224,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;
@@ -264,7 +264,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);
}
@@ -323,7 +323,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;
}
@@ -408,7 +408,7 @@ static void test_with_chamelium(data_t *data)
data->ports[i], data->edids[i]);
chamelium_plug(data->chamelium,
data->ports[i]);
- chamelium_wait_for_conn_status_change(data->display,
+ chamelium_wait_for_conn_status_change(&data->display,
data->chamelium,
data->ports[i],
DRM_MODE_CONNECTED);
@@ -436,7 +436,7 @@ void basic_test(data_t *data, drmEventContext *drm_event, struct pollfd *pfd)
setup_mode(data);
setup_framebuffer(data);
timerclear(&data->first_ts);
- igt_display_commit_atomic(data->display,
+ igt_display_commit_atomic(&data->display,
DRM_MODE_ATOMIC_NONBLOCK |
DRM_MODE_PAGE_FLIP_EVENT, data);
while (!got_all_page_flips(data)) {
@@ -448,21 +448,20 @@ void basic_test(data_t *data, drmEventContext *drm_event, struct pollfd *pfd)
igt_main
{
- igt_display_t display;
data_t data = {0};
struct pollfd pfd = {0};
drmEventContext drm_event = {0};
igt_fixture {
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);
- data.display = &display;
+ igt_display_require(&data.display, data.drm_fd);
+ igt_display_reset(&data.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);
}
@@ -492,6 +491,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.32.0
next prev parent reply other threads:[~2021-10-19 20:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
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 1/5] tests/kms_tiled_display: Get rid of DP stuff Ville Syrjala
2021-10-19 20:19 ` Ville Syrjala [this message]
2021-10-19 22:07 ` [igt-dev] [PATCH i-g-t v2 2/5] tests/kms_tiled_display: Replace the igt_display pointer with a struct Ville Syrjala
2021-10-19 20:19 ` [igt-dev] [PATCH i-g-t 3/5] tests/kms_tiled_display: Limit the difference in the timestamps to one scanline Ville Syrjala
2021-10-19 20:19 ` [igt-dev] [PATCH i-g-t 4/5] lib/edid: Add support for making DisplayID tile blocks Ville Syrjala
2021-10-19 20:19 ` [igt-dev] [PATCH i-g-t 5/5] tests/kms_tiled_display: Override the EDID to fake some tiles Ville Syrjala
2021-10-19 20:48 ` [igt-dev] ✗ Fi.CI.BUILD: failure for kms: Run tiled display tests on any set of connectors Patchwork
2021-10-19 20:51 ` [igt-dev] ✗ GitLab.Pipeline: warning " Patchwork
2021-10-19 22:50 ` [igt-dev] ✓ Fi.CI.BAT: success for kms: Run tiled display tests on any set of connectors (rev2) Patchwork
2021-10-20 3:37 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
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 ` [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=20211019201940.31729-3-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