OSDN Git Service

modetest: move pipe_resolve_connectors() further up
authorEmil Velikov <emil.velikov@collabora.com>
Wed, 15 Apr 2020 08:57:09 +0000 (09:57 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Tue, 19 May 2020 20:09:35 +0000 (21:09 +0100)
Move the function above set_mode, since we'll be using it from there as
of next commit.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
tests/modetest/modetest.c

index 376f203..b08cb78 100644 (file)
@@ -1403,6 +1403,32 @@ static void clear_planes(struct device *dev, struct plane_arg *p, unsigned int c
        }
 }
 
+static int pipe_resolve_connectors(struct device *dev, struct pipe_arg *pipe)
+{
+       drmModeConnector *connector;
+       unsigned int i;
+       uint32_t id;
+       char *endp;
+
+       for (i = 0; i < pipe->num_cons; i++) {
+               id = strtoul(pipe->cons[i], &endp, 10);
+               if (endp == pipe->cons[i]) {
+                       connector = get_connector_by_name(dev, pipe->cons[i]);
+                       if (!connector) {
+                               fprintf(stderr, "no connector named '%s'\n",
+                                       pipe->cons[i]);
+                               return -ENODEV;
+                       }
+
+                       id = connector->connector_id;
+               }
+
+               pipe->con_ids[i] = id;
+       }
+
+       return 0;
+}
+
 static void set_mode(struct device *dev, struct pipe_arg *pipes, unsigned int count)
 {
        unsigned int i, j;
@@ -1819,32 +1845,6 @@ static void usage(char *name)
        exit(0);
 }
 
-static int pipe_resolve_connectors(struct device *dev, struct pipe_arg *pipe)
-{
-       drmModeConnector *connector;
-       unsigned int i;
-       uint32_t id;
-       char *endp;
-
-       for (i = 0; i < pipe->num_cons; i++) {
-               id = strtoul(pipe->cons[i], &endp, 10);
-               if (endp == pipe->cons[i]) {
-                       connector = get_connector_by_name(dev, pipe->cons[i]);
-                       if (!connector) {
-                               fprintf(stderr, "no connector named '%s'\n",
-                                       pipe->cons[i]);
-                               return -ENODEV;
-                       }
-
-                       id = connector->connector_id;
-               }
-
-               pipe->con_ids[i] = id;
-       }
-
-       return 0;
-}
-
 static char optstr[] = "acdD:efF:M:P:ps:Cvw:";
 
 int main(int argc, char **argv)