[PATCH v6 19/23] modetest: Rename struct connector_arg to struct pipe_arg
This prepares the code for handling multiple connectors in a single pipeline in a cloned configuration. Signed-off-by: Laurent Pinchart --- tests/modetest/modetest.c | 162 -- 1 file changed, 85 insertions(+), 77 deletions(-) diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index 93a0864..922d9b0 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -635,7 +635,7 @@ error: } /* - - * Connectors and planes + * Pipes and planes */ /* @@ -645,8 +645,8 @@ error: * Then you need to find the encoder attached to that connector so you * can bind it with a free crtc. */ -struct connector_arg { - uint32_t id; +struct pipe_arg { + uint32_t con_id; uint32_t crtc_id; char mode_str[64]; char format_str[5]; @@ -669,14 +669,14 @@ struct plane_arg { unsigned int fourcc; }; -static void connector_find_mode(struct device *dev, struct connector_arg *c) +static void pipe_find_mode(struct device *dev, struct pipe_arg *pipe) { drmModeConnector *connector; drmModeEncoder *encoder; int i, j; /* First, find the connector & mode */ - c->mode = NULL; + pipe->mode = NULL; for (i = 0; i < dev->resources->res->count_connectors; i++) { connector = dev->resources->connectors[i].connector; if (!connector) @@ -685,50 +685,50 @@ static void connector_find_mode(struct device *dev, struct connector_arg *c) if (!connector->count_modes) continue; - if (connector->connector_id != c->id) + if (connector->connector_id != pipe->con_id) continue; for (j = 0; j < connector->count_modes; j++) { - c->mode = >modes[j]; - if (!strcmp(c->mode->name, c->mode_str)) + pipe->mode = >modes[j]; + if (!strcmp(pipe->mode->name, pipe->mode_str)) break; } /* Found it, break out */ - if (c->mode) + if (pipe->mode) break; } - if (!c->mode) { - fprintf(stderr, "failed to find mode \"%s\"\n", c->mode_str); + if (!pipe->mode) { + fprintf(stderr, "failed to find mode \"%s\"\n", pipe->mode_str); return; } /* If the CRTC ID was specified, get the corresponding CRTC. Otherwise * locate a CRTC that can be attached to the connector. */ - if (c->crtc_id == (uint32_t)-1) { + if (pipe->crtc_id == (uint32_t)-1) { for (i = 0; i < dev->resources->res->count_encoders; i++) { encoder = dev->resources->encoders[i].encoder; if (!encoder) continue; if (encoder->encoder_id == connector->encoder_id) { - c->crtc_id = encoder->crtc_id; + pipe->crtc_id = encoder->crtc_id; break; } } } - if (c->crtc_id == (uint32_t)-1) + if (pipe->crtc_id == (uint32_t)-1) return; for (i = 0; i < dev->resources->res->count_crtcs; i++) { struct crtc *crtc = >resources->crtcs[i]; - if (c->crtc_id == crtc->crtc->crtc_id) { - crtc->mode = c->mode; - c->crtc = crtc; + if (pipe->crtc_id == crtc->crtc->crtc_id) { + crtc->mode = pipe->mode; + pipe->crtc = crtc; break; } } @@ -815,28 +815,28 @@ static void page_flip_handler(int fd, unsigned int frame, unsigned int sec, unsigned int usec, void *data) { - struct connector_arg *c; + struct pipe_arg *pipe; unsigned int new_fb_id; struct timeval end; double t; - c = data; - if (c->current_fb_id == c->fb_id[0]) - new_fb_id = c->fb_id[1]; + pipe = data; + if (pipe->current_fb_id == pipe->fb_id[0]) + new_fb_id = pipe->fb_id[1]; else - new_fb_id = c->fb_id[0]; + new_fb_id = pipe->fb_id[0]; - drmModePageFlip(fd, c->crtc_id, new_fb_id, - DRM_MODE_PAGE_FLIP_EVENT, c); - c->current_fb_id = new_fb_id; - c->swap_count++; - if (c->swap_count == 60) { + drmModePageFlip(fd, pipe->crtc_id, new_fb_id, + DRM_MODE_PAGE_FLIP_EVENT, pipe); + pipe->current_fb_id = new_fb_id; + pipe->swap_count++; + if (pipe->swap_count == 60) { gettimeofday(, NULL);
[PATCH v6 19/23] modetest: Rename struct connector_arg to struct pipe_arg
This prepares the code for handling multiple connectors in a single pipeline in a cloned configuration. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- tests/modetest/modetest.c | 162 -- 1 file changed, 85 insertions(+), 77 deletions(-) diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index 93a0864..922d9b0 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -635,7 +635,7 @@ error: } /* - - * Connectors and planes + * Pipes and planes */ /* @@ -645,8 +645,8 @@ error: * Then you need to find the encoder attached to that connector so you * can bind it with a free crtc. */ -struct connector_arg { - uint32_t id; +struct pipe_arg { + uint32_t con_id; uint32_t crtc_id; char mode_str[64]; char format_str[5]; @@ -669,14 +669,14 @@ struct plane_arg { unsigned int fourcc; }; -static void connector_find_mode(struct device *dev, struct connector_arg *c) +static void pipe_find_mode(struct device *dev, struct pipe_arg *pipe) { drmModeConnector *connector; drmModeEncoder *encoder; int i, j; /* First, find the connector mode */ - c-mode = NULL; + pipe-mode = NULL; for (i = 0; i dev-resources-res-count_connectors; i++) { connector = dev-resources-connectors[i].connector; if (!connector) @@ -685,50 +685,50 @@ static void connector_find_mode(struct device *dev, struct connector_arg *c) if (!connector-count_modes) continue; - if (connector-connector_id != c-id) + if (connector-connector_id != pipe-con_id) continue; for (j = 0; j connector-count_modes; j++) { - c-mode = connector-modes[j]; - if (!strcmp(c-mode-name, c-mode_str)) + pipe-mode = connector-modes[j]; + if (!strcmp(pipe-mode-name, pipe-mode_str)) break; } /* Found it, break out */ - if (c-mode) + if (pipe-mode) break; } - if (!c-mode) { - fprintf(stderr, failed to find mode \%s\\n, c-mode_str); + if (!pipe-mode) { + fprintf(stderr, failed to find mode \%s\\n, pipe-mode_str); return; } /* If the CRTC ID was specified, get the corresponding CRTC. Otherwise * locate a CRTC that can be attached to the connector. */ - if (c-crtc_id == (uint32_t)-1) { + if (pipe-crtc_id == (uint32_t)-1) { for (i = 0; i dev-resources-res-count_encoders; i++) { encoder = dev-resources-encoders[i].encoder; if (!encoder) continue; if (encoder-encoder_id == connector-encoder_id) { - c-crtc_id = encoder-crtc_id; + pipe-crtc_id = encoder-crtc_id; break; } } } - if (c-crtc_id == (uint32_t)-1) + if (pipe-crtc_id == (uint32_t)-1) return; for (i = 0; i dev-resources-res-count_crtcs; i++) { struct crtc *crtc = dev-resources-crtcs[i]; - if (c-crtc_id == crtc-crtc-crtc_id) { - crtc-mode = c-mode; - c-crtc = crtc; + if (pipe-crtc_id == crtc-crtc-crtc_id) { + crtc-mode = pipe-mode; + pipe-crtc = crtc; break; } } @@ -815,28 +815,28 @@ static void page_flip_handler(int fd, unsigned int frame, unsigned int sec, unsigned int usec, void *data) { - struct connector_arg *c; + struct pipe_arg *pipe; unsigned int new_fb_id; struct timeval end; double t; - c = data; - if (c-current_fb_id == c-fb_id[0]) - new_fb_id = c-fb_id[1]; + pipe = data; + if (pipe-current_fb_id == pipe-fb_id[0]) + new_fb_id = pipe-fb_id[1]; else - new_fb_id = c-fb_id[0]; + new_fb_id = pipe-fb_id[0]; - drmModePageFlip(fd, c-crtc_id, new_fb_id, - DRM_MODE_PAGE_FLIP_EVENT, c); - c-current_fb_id = new_fb_id; - c-swap_count++; - if (c-swap_count == 60) { + drmModePageFlip(fd, pipe-crtc_id, new_fb_id, + DRM_MODE_PAGE_FLIP_EVENT, pipe); + pipe-current_fb_id = new_fb_id; + pipe-swap_count++; + if (pipe-swap_count == 60) { gettimeofday(end, NULL);