]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/kmscube.git/blobdiff - kmscube.c
kmscube.c: init_drm(): enable AM3 support
[glsdk/kmscube.git] / kmscube.c
index bc2e89d19a772f623431b0fd832416db7f90e69e..919b3e7e90f3a37fc251cf0d1a24100c3133f4e5 100644 (file)
--- a/kmscube.c
+++ b/kmscube.c
@@ -84,7 +84,7 @@ struct drm_fb {
 static int init_drm(void)
 {
        static const char *modules[] = {
-                       "omapdrm", "i915", "radeon", "nouveau", "vmwgfx", "exynos"
+                       "omapdrm", "tilcdc", "i915", "radeon", "nouveau", "vmwgfx", "exynos"
        };
        drmModeRes *resources;
        drmModeConnector *connector = NULL;
@@ -628,14 +628,18 @@ void print_usage()
        printf("\t-h : Help\n");
        printf("\t-a : Enable all displays\n");
        printf("\t-c <id> : Display using connector_id [if not specified, use the first connected connector]\n");
+       printf("\t-n <number> (optional): Number of frames to render\n");
 }
 
 int kms_signalhandler(int signum)
 {
        switch(signum) {
        case SIGINT:
-       case SIGTERM:
-               printf("Handling signal number = %d\n", signum);
+        case SIGTERM:
+                /* Allow the pending page flip requests to be completed before
+                 * the teardown sequence */
+                sleep(1);
+                printf("Handling signal number = %d\n", signum);
                cleanup_kmscube();
                break;
        default:
@@ -657,11 +661,12 @@ int main(int argc, char *argv[])
        uint32_t i = 0;
        int ret;
        int opt;
+       int frame_count = -1;
 
        signal(SIGINT, kms_signalhandler);
        signal(SIGTERM, kms_signalhandler);
 
-       while ((opt = getopt(argc, argv, "ahc:")) != -1) {
+       while ((opt = getopt(argc, argv, "ahc:n:")) != -1) {
                switch(opt) {
                case 'a':
                        all_display = 1;
@@ -674,6 +679,10 @@ int main(int argc, char *argv[])
                case 'c':
                        connector_id = atoi(optarg);
                        break;
+               case 'n':
+                       frame_count = atoi(optarg);
+                       break;
+
 
                default:
                        printf("Undefined option %s\n", argv[optind]);
@@ -737,7 +746,7 @@ int main(int argc, char *argv[])
                }
        }
 
-       while (1) {
+       while (frame_count != 0) {
                struct gbm_bo *next_bo;
                int waiting_for_flip = 1;
 
@@ -776,6 +785,9 @@ int main(int argc, char *argv[])
                /* release last buffer to render on again: */
                gbm_surface_release_buffer(gbm.surface, bo);
                bo = next_bo;
+
+                if(frame_count >= 0)
+                       frame_count--;
        }
 
        cleanup_kmscube();