diff options
author | Leo (Sunpeng) Li <sunpeng.li@amd.com> | 2018-03-28 10:27:08 -0400 |
---|---|---|
committer | Leo (Sunpeng) Li <sunpeng.li@amd.com> | 2018-05-02 10:13:31 -0400 |
commit | 1610c58420e173238656ad11d5f26bf0b0d91edd (patch) | |
tree | 4ce63e041293b1548d141e31796f6ac6ec949dad | |
parent | 9134c143c9b776f814d4ff1f3531199709499dc3 (diff) |
Add output option, modify help text accordingly.
Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
-rw-r--r-- | demo.c | 15 | ||||
-rw-r--r-- | help.txt | 8 |
2 files changed, 19 insertions, 4 deletions
@@ -609,18 +609,21 @@ int main(int argc, char *const argv[]) char *degamma_opt = NULL; char *ctm_opt = NULL; char *regamma_opt = NULL; + char *output_name = NULL; int degamma_changed, degamma_is_srgb; int ctm_changed; int regamma_changed, regamma_is_srgb; - while ((opt = getopt(argc, argv, "hd:c:r:")) != -1) { + while ((opt = getopt(argc, argv, "ho:d:c:r:")) != -1) { if (opt == 'd') degamma_opt = optarg; else if (opt == 'c') ctm_opt = optarg; else if (opt == 'r') regamma_opt = optarg; + else if (opt == 'o') + output_name = optarg; else if (opt == 'h') { printf("%s", HELP_STR); return 0; @@ -631,6 +634,12 @@ int main(int argc, char *const argv[]) } } + /* Check that output is given */ + if (!output_name) { + print_short_help(); + return 0; + } + /* Parse the input, and generate the intermediate coefficient arrays */ degamma_changed = parse_user_degamma(degamma_opt, degamma_coeffs, °amma_is_srgb); @@ -661,9 +670,9 @@ int main(int argc, char *const argv[]) /* RandR needs to know which output we're setting the property on. * Since we only have a name to work with, find the RROutput using the * name. */ - output = find_output_by_name(dpy, res, "DisplayPort-0"); + output = find_output_by_name(dpy, res, output_name); if (!output) { - printf("Cannot find output!\n"); + printf("Cannot find output %s.\n", output_name); goto done; } @@ -1,9 +1,15 @@ -Usage: demo [-d DEGAMMA_OPTS] [-c CTM_OPTS] [-r REGAMMA_OPTS] [-h] +Usage: demo -o OUTPUT_NAME [-d DEGAMMA_OPTS] [-c CTM_OPTS] [-r REGAMMA_OPTS] [-h] Demo app for for creating DRM color/CTM blobs, then setting it via xrandr. Note that this requires updates to the amdpgu DDX driver for color management support. +Mandatory arguments: + + -o OUTPUT_NAME + The output name, as listed in xrandr + + Optional arguments: -d DEGAMMA_OPTS |