extra debug messages
authorJohn Tsiombikas <nuclear@mutantstargoat.com>
Tue, 16 May 2017 06:07:07 +0000 (09:07 +0300)
committerJohn Tsiombikas <nuclear@mutantstargoat.com>
Tue, 16 May 2017 06:07:07 +0000 (09:07 +0300)
vdummy.c

index 9786d11..565a6b8 100644 (file)
--- a/vdummy.c
+++ b/vdummy.c
@@ -167,7 +167,7 @@ static int init(void)
                return res;
        }
 
-       printk(KERN_INFO "vdummy device initialized\n");
+       printk(KERN_INFO "vdummy: initialized\n");
        return 0;
 }
 
@@ -314,6 +314,7 @@ static void buf_queue(struct vb2_buffer *vb)
        struct buffer *buf = (struct buffer*)((char*)vb - offsetof(struct buffer, vb));
 
        spin_lock(&blist_lock);
+       printk(KERN_INFO "vdummy: enqueue buffer\n");
        if(buflist) {
                buflist_tail->next = buf;
                buflist_tail = buf;
@@ -326,14 +327,20 @@ static void buf_queue(struct vb2_buffer *vb)
 
 static void clear_queue(enum vb2_buffer_state st)
 {
+       struct buffer *list;
+
+       printk(KERN_INFO "vdummy: clear_queue\n");
+
        spin_lock(&blist_lock);
-       while(buflist) {
-               struct buffer *buf = buflist;
-               buflist = buflist->next;
-               vb2_buffer_done(&buf->vb.vb2_buf, st);
-       }
+       list = buflist;
        buflist = buflist_tail = 0;
        spin_unlock(&blist_lock);
+
+       while(list) {
+               struct buffer *buf = list;
+               list = list->next;
+               vb2_buffer_done(&buf->vb.vb2_buf, st);
+       }
 }
 
 static int start_streaming(struct vb2_queue *vbq, unsigned int count)
@@ -350,12 +357,15 @@ static int start_streaming(struct vb2_queue *vbq, unsigned int count)
                frame_interval = ktime_set(0, 1000000000ul / (unsigned long)framerate);
        }
 
+       printk(KERN_INFO "vdummy: start streaming (interval: %ld ms)\n",
+                       (long)ktime_to_ms(frame_interval));
        hrtimer_start(&timer, frame_interval, HRTIMER_MODE_REL);
        return 0;
 }
 
 static void stop_streaming(struct vb2_queue *vbq)
 {
+       printk(KERN_INFO "vdummy: stop streaming\n");
        hrtimer_cancel(&timer);
 
        streaming = 0;
@@ -402,6 +412,8 @@ static int gen_frame(void)
 {
        struct buffer *buf = 0;
 
+       printk(KERN_INFO "vdummy: gen_frame\n");
+
        spin_lock(&blist_lock);
        if(buflist) {
                buf = buflist;
@@ -428,6 +440,7 @@ static int gen_frame(void)
 
 enum hrtimer_restart timer_func(struct hrtimer *timer)
 {
-       gen_frame();
+       printk(KERN_INFO "vdummy: timer!\n");
+       //gen_frame();
        return streaming ? HRTIMER_RESTART : HRTIMER_NORESTART;
 }