diff options
author | Rob Clark <robdclark@gmail.com> | 2017-02-22 11:36:12 -0500 |
---|---|---|
committer | Rob Clark <robdclark@gmail.com> | 2017-02-25 10:48:22 -0500 |
commit | 87e3ff5683ee54228b3e6e75f7d4de83901fadb0 (patch) | |
tree | 0aa767fb89bbf7c64670fb117f5a2b65cda9db4a /kmscube.c | |
parent | 1f1158fe1279e845420d3cb838eff3bbf2e5701a (diff) | |
download | kmscube-87e3ff5683ee54228b3e6e75f7d4de83901fadb0.tar.gz |
add atomic kms support
Based mostly on original atomic conversion from Gustavo Padovan.
Diffstat (limited to 'kmscube.c')
-rw-r--r-- | kmscube.c | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -38,9 +38,10 @@ static const struct egl *egl; static const struct gbm *gbm; static const struct drm *drm; -static const char *shortopts = "D:M:"; +static const char *shortopts = "AD:M:"; static const struct option longopts[] = { + {"atomic", no_argument, 0, 'M'}, {"device", required_argument, 0, 'D'}, {"mode", required_argument, 0, 'M'}, {0, 0, 0, 0} @@ -48,9 +49,10 @@ static const struct option longopts[] = { static void usage(const char *name) { - printf("Usage: %s [-D]\n" + printf("Usage: %s [-ADM]\n" "\n" "options:\n" + " -A, --atomic use atomic modesetting and fencing\n" " -D, --device=DEVICE use the given device\n" " -M, --mode=MODE specify mode, one of:\n" " smooth - smooth shaded cube (default)\n" @@ -64,10 +66,14 @@ int main(int argc, char *argv[]) { const char *device = "/dev/dri/card0"; enum mode mode = SMOOTH; + int atomic = 0; int opt, ret; while ((opt = getopt_long_only(argc, argv, shortopts, longopts, NULL)) != -1) { switch (opt) { + case 'A': + atomic = 1; + break; case 'D': device = optarg; break; @@ -92,9 +98,12 @@ int main(int argc, char *argv[]) } } - drm = init_drm_legacy(device); + if (atomic) + drm = init_drm_atomic(device); + else + drm = init_drm_legacy(device); if (!drm) { - printf("failed to initialize DRM\n"); + printf("failed to initialize %s DRM\n", atomic ? "atomic" : "legacy"); return ret; } |