This is helpful for differentiating between multiple devices that use the same module.
Signed-off-by: Ilia Mirkin imirkin@alum.mit.edu --- tests/modetest/modetest.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index f0ed56b..9d6e279 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -1303,7 +1303,7 @@ static int parse_property(struct property_arg *p, const char *arg)
static void usage(char *name) { - fprintf(stderr, "usage: %s [-cdefMmPpsvw]\n", name); + fprintf(stderr, "usage: %s [-cDdefMPpsvw]\n", name);
fprintf(stderr, "\n Query options:\n\n"); fprintf(stderr, "\t-c\tlist connectors\n"); @@ -1320,6 +1320,7 @@ static void usage(char *name) fprintf(stderr, "\n Generic options:\n\n"); fprintf(stderr, "\t-d\tdrop master after mode set\n"); fprintf(stderr, "\t-M module\tuse the given driver\n"); + fprintf(stderr, "\t-D device\tuse the given device\n");
fprintf(stderr, "\n\tDefault is to dump all info.\n"); exit(0); @@ -1346,7 +1347,7 @@ static int page_flipping_supported(void) #endif }
-static char optstr[] = "cdefM:P:ps:vw:"; +static char optstr[] = "cdD:efM:P:ps:vw:";
int main(int argc, char **argv) { @@ -1357,6 +1358,7 @@ int main(int argc, char **argv) int drop_master = 0; int test_vsync = 0; const char *modules[] = { "i915", "radeon", "nouveau", "vmwgfx", "omapdrm", "exynos", "tilcdc", "msm" }; + char *device = NULL; char *module = NULL; unsigned int i; int count = 0, plane_count = 0; @@ -1377,6 +1379,10 @@ int main(int argc, char **argv) case 'c': connectors = 1; break; + case 'D': + device = optarg; + args--; + break; case 'd': drop_master = 1; break; @@ -1447,7 +1453,7 @@ int main(int argc, char **argv) encoders = connectors = crtcs = planes = framebuffers = 1;
if (module) { - dev.fd = drmOpen(module, NULL); + dev.fd = drmOpen(module, device); if (dev.fd < 0) { fprintf(stderr, "failed to open device '%s'.\n", module); return 1; @@ -1455,7 +1461,7 @@ int main(int argc, char **argv) } else { for (i = 0; i < ARRAY_SIZE(modules); i++) { printf("trying to open device '%s'...", modules[i]); - dev.fd = drmOpen(modules[i], NULL); + dev.fd = drmOpen(modules[i], device); if (dev.fd < 0) { printf("failed.\n"); } else {
Signed-off-by: Ilia Mirkin imirkin@alum.mit.edu --- tests/modetest/modetest.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index 9d6e279..51c4e6d 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -707,6 +707,7 @@ struct plane_arg { bool has_position; int32_t x, y; uint32_t w, h; + double scale; unsigned int fb_id; char format_str[5]; /* need to leave room for terminating \0 */ unsigned int fourcc; @@ -988,16 +989,16 @@ static int set_plane(struct device *dev, struct plane_arg *p) return -1; }
+ crtc_w = p->w * p->scale; + crtc_h = p->h * p->scale; if (!p->has_position) { /* Default to the middle of the screen */ - crtc_x = (crtc->mode->hdisplay - p->w) / 2; - crtc_y = (crtc->mode->vdisplay - p->h) / 2; + crtc_x = (crtc->mode->hdisplay - crtc_w) / 2; + crtc_y = (crtc->mode->vdisplay - crtc_h) / 2; } else { crtc_x = p->x; crtc_y = p->y; } - crtc_w = p->w; - crtc_h = p->h;
/* note src coords (last 4 args) are in Q16 format */ if (drmModeSetPlane(dev->fd, plane_id, crtc->crtc->crtc_id, p->fb_id, @@ -1271,6 +1272,15 @@ static int parse_plane(struct plane_arg *plane, const char *p) plane->has_position = true; }
+ if (*end == '*') { + p = end + 1; + plane->scale = strtod(p, &end); + if (plane->scale <= 0.0) + return -EINVAL; + } else { + plane->scale = 1.0; + } + if (*end == '@') { p = end + 1; if (strlen(p) != 4) @@ -1312,7 +1322,7 @@ static void usage(char *name) fprintf(stderr, "\t-p\tlist CRTCs and planes (pipes)\n");
fprintf(stderr, "\n Test options:\n\n"); - fprintf(stderr, "\t-P <crtc_id>:<w>x<h>[+<x>+<y>][@<format>]\tset a plane\n"); + fprintf(stderr, "\t-P <crtc_id>:<w>x<h>[+<x>+<y>][*<scale>][@<format>]\tset a plane\n"); fprintf(stderr, "\t-s <connector_id>[,<connector_id>][@<crtc_id>]:<mode>[@<format>]\tset a mode\n"); fprintf(stderr, "\t-v\ttest vsynced page flipping\n"); fprintf(stderr, "\t-w <obj_id>:<prop_name>:<value>\tset property\n");
On Sat, Sep 7, 2013 at 9:36 PM, Ilia Mirkin imirkin@alum.mit.edu wrote:
Signed-off-by: Ilia Mirkin imirkin@alum.mit.edu
Reviewed-by: Rob Clark robdclark@gmail.com
tests/modetest/modetest.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index 9d6e279..51c4e6d 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -707,6 +707,7 @@ struct plane_arg { bool has_position; int32_t x, y; uint32_t w, h;
double scale; unsigned int fb_id; char format_str[5]; /* need to leave room for terminating \0 */ unsigned int fourcc;
@@ -988,16 +989,16 @@ static int set_plane(struct device *dev, struct plane_arg *p) return -1; }
crtc_w = p->w * p->scale;
crtc_h = p->h * p->scale; if (!p->has_position) { /* Default to the middle of the screen */
crtc_x = (crtc->mode->hdisplay - p->w) / 2;
crtc_y = (crtc->mode->vdisplay - p->h) / 2;
crtc_x = (crtc->mode->hdisplay - crtc_w) / 2;
crtc_y = (crtc->mode->vdisplay - crtc_h) / 2; } else { crtc_x = p->x; crtc_y = p->y; }
crtc_w = p->w;
crtc_h = p->h; /* note src coords (last 4 args) are in Q16 format */ if (drmModeSetPlane(dev->fd, plane_id, crtc->crtc->crtc_id, p->fb_id,
@@ -1271,6 +1272,15 @@ static int parse_plane(struct plane_arg *plane, const char *p) plane->has_position = true; }
if (*end == '*') {
p = end + 1;
plane->scale = strtod(p, &end);
if (plane->scale <= 0.0)
return -EINVAL;
} else {
plane->scale = 1.0;
}
if (*end == '@') { p = end + 1; if (strlen(p) != 4)
@@ -1312,7 +1322,7 @@ static void usage(char *name) fprintf(stderr, "\t-p\tlist CRTCs and planes (pipes)\n");
fprintf(stderr, "\n Test options:\n\n");
fprintf(stderr, "\t-P <crtc_id>:<w>x<h>[+<x>+<y>][@<format>]\tset a plane\n");
fprintf(stderr, "\t-P <crtc_id>:<w>x<h>[+<x>+<y>][*<scale>][@<format>]\tset a plane\n"); fprintf(stderr, "\t-s <connector_id>[,<connector_id>][@<crtc_id>]:<mode>[@<format>]\tset a mode\n"); fprintf(stderr, "\t-v\ttest vsynced page flipping\n"); fprintf(stderr, "\t-w <obj_id>:<prop_name>:<value>\tset property\n");
-- 1.8.1.5
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
On Tue, Sep 10, 2013 at 12:08 PM, Rob Clark robdclark@gmail.com wrote:
On Sat, Sep 7, 2013 at 9:36 PM, Ilia Mirkin imirkin@alum.mit.edu wrote:
Signed-off-by: Ilia Mirkin imirkin@alum.mit.edu
Reviewed-by: Rob Clark robdclark@gmail.com
Reviewed-and-tested-by: Ben Skeggs bskeggs@redhat.com
tests/modetest/modetest.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index 9d6e279..51c4e6d 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -707,6 +707,7 @@ struct plane_arg { bool has_position; int32_t x, y; uint32_t w, h;
double scale; unsigned int fb_id; char format_str[5]; /* need to leave room for terminating \0 */ unsigned int fourcc;
@@ -988,16 +989,16 @@ static int set_plane(struct device *dev, struct plane_arg *p) return -1; }
crtc_w = p->w * p->scale;
crtc_h = p->h * p->scale; if (!p->has_position) { /* Default to the middle of the screen */
crtc_x = (crtc->mode->hdisplay - p->w) / 2;
crtc_y = (crtc->mode->vdisplay - p->h) / 2;
crtc_x = (crtc->mode->hdisplay - crtc_w) / 2;
crtc_y = (crtc->mode->vdisplay - crtc_h) / 2; } else { crtc_x = p->x; crtc_y = p->y; }
crtc_w = p->w;
crtc_h = p->h; /* note src coords (last 4 args) are in Q16 format */ if (drmModeSetPlane(dev->fd, plane_id, crtc->crtc->crtc_id, p->fb_id,
@@ -1271,6 +1272,15 @@ static int parse_plane(struct plane_arg *plane, const char *p) plane->has_position = true; }
if (*end == '*') {
p = end + 1;
plane->scale = strtod(p, &end);
if (plane->scale <= 0.0)
return -EINVAL;
} else {
plane->scale = 1.0;
}
if (*end == '@') { p = end + 1; if (strlen(p) != 4)
@@ -1312,7 +1322,7 @@ static void usage(char *name) fprintf(stderr, "\t-p\tlist CRTCs and planes (pipes)\n");
fprintf(stderr, "\n Test options:\n\n");
fprintf(stderr, "\t-P <crtc_id>:<w>x<h>[+<x>+<y>][@<format>]\tset a plane\n");
fprintf(stderr, "\t-P <crtc_id>:<w>x<h>[+<x>+<y>][*<scale>][@<format>]\tset a plane\n"); fprintf(stderr, "\t-s <connector_id>[,<connector_id>][@<crtc_id>]:<mode>[@<format>]\tset a mode\n"); fprintf(stderr, "\t-v\ttest vsynced page flipping\n"); fprintf(stderr, "\t-w <obj_id>:<prop_name>:<value>\tset property\n");
-- 1.8.1.5
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
On Sat, Sep 7, 2013 at 9:36 PM, Ilia Mirkin imirkin@alum.mit.edu wrote:
This is helpful for differentiating between multiple devices that use the same module.
Signed-off-by: Ilia Mirkin imirkin@alum.mit.edu
Reviewed-by: Rob Clark robdclark@gmail.com
tests/modetest/modetest.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index f0ed56b..9d6e279 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -1303,7 +1303,7 @@ static int parse_property(struct property_arg *p, const char *arg)
static void usage(char *name) {
fprintf(stderr, "usage: %s [-cdefMmPpsvw]\n", name);
fprintf(stderr, "usage: %s [-cDdefMPpsvw]\n", name); fprintf(stderr, "\n Query options:\n\n"); fprintf(stderr, "\t-c\tlist connectors\n");
@@ -1320,6 +1320,7 @@ static void usage(char *name) fprintf(stderr, "\n Generic options:\n\n"); fprintf(stderr, "\t-d\tdrop master after mode set\n"); fprintf(stderr, "\t-M module\tuse the given driver\n");
fprintf(stderr, "\t-D device\tuse the given device\n"); fprintf(stderr, "\n\tDefault is to dump all info.\n"); exit(0);
@@ -1346,7 +1347,7 @@ static int page_flipping_supported(void) #endif }
-static char optstr[] = "cdefM:P:ps:vw:"; +static char optstr[] = "cdD:efM:P:ps:vw:";
int main(int argc, char **argv) { @@ -1357,6 +1358,7 @@ int main(int argc, char **argv) int drop_master = 0; int test_vsync = 0; const char *modules[] = { "i915", "radeon", "nouveau", "vmwgfx", "omapdrm", "exynos", "tilcdc", "msm" };
char *device = NULL; char *module = NULL; unsigned int i; int count = 0, plane_count = 0;
@@ -1377,6 +1379,10 @@ int main(int argc, char **argv) case 'c': connectors = 1; break;
case 'D':
device = optarg;
args--;
break; case 'd': drop_master = 1; break;
@@ -1447,7 +1453,7 @@ int main(int argc, char **argv) encoders = connectors = crtcs = planes = framebuffers = 1;
if (module) {
dev.fd = drmOpen(module, NULL);
dev.fd = drmOpen(module, device); if (dev.fd < 0) { fprintf(stderr, "failed to open device '%s'.\n", module); return 1;
@@ -1455,7 +1461,7 @@ int main(int argc, char **argv) } else { for (i = 0; i < ARRAY_SIZE(modules); i++) { printf("trying to open device '%s'...", modules[i]);
dev.fd = drmOpen(modules[i], NULL);
dev.fd = drmOpen(modules[i], device); if (dev.fd < 0) { printf("failed.\n"); } else {
-- 1.8.1.5
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
dri-devel@lists.freedesktop.org