diff mbox series

[1/2] media: vim2m: improve debug messages

Message ID 627b2c823606801a9d2cf0bb2ea15ad83942e6dd.1551202610.git.mchehab+samsung@kernel.org (mailing list archive)
State New, archived
Headers show
Series [1/2] media: vim2m: improve debug messages | expand

Commit Message

Mauro Carvalho Chehab Feb. 26, 2019, 5:36 p.m. UTC
1) Use two levels for debug:
	- level 1: setup stuff
	- level 2: add queue/dequeue messages

2) Better display the debug output, translating buffer
   type, fourcc and making some messages clearer.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
---
 drivers/media/platform/vim2m.c | 44 ++++++++++++++++++++++++----------
 1 file changed, 31 insertions(+), 13 deletions(-)

Comments

kernel test robot Feb. 27, 2019, 12:13 p.m. UTC | #1
Hi Mauro,

I love your patch! Yet something to improve:

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on next-20190226]
[cannot apply to v5.0-rc8]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Mauro-Carvalho-Chehab/media-vim2m-improve-debug-messages/20190227-194011
base:   git://linuxtv.org/media_tree.git master
config: i386-randconfig-x001-201908 (attached as .config)
compiler: gcc-8 (Debian 8.2.0-20) 8.2.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   In file included from include/media/v4l2-subdev.h:24,
                    from include/media/v4l2-device.h:25,
                    from drivers/media//platform/vim2m.c:28:
   drivers/media//platform/vim2m.c: In function 'vim2m_buf_prepare':
>> include/media/v4l2-common.h:84:13: warning: comparison between pointer and integer
      if (debug >= (level))     \
                ^~
   drivers/media//platform/vim2m.c:71:2: note: in expansion of macro 'v4l2_dbg'
     v4l2_dbg(lvl, debug, &dev->v4l2_dev, "%s: " fmt, __func__, ## arg)
     ^~~~~~~~
   drivers/media//platform/vim2m.c:893:3: note: in expansion of macro 'dprintk'
      dprintk(ctx->dev, "%s data will not fit into plane (%lu < %lu)\n",
      ^~~~~~~
>> drivers/media//platform/vim2m.c:894:5: error: expected ')' before '__func__'
        __func__, vb2_plane_size(vb, 0), (long)q_data->sizeimage);
        ^~~~~~~~
   include/media/v4l2-common.h:69:22: note: in definition of macro 'v4l2_printk'
     printk(level "%s: " fmt, (dev)->name , ## arg)
                         ^~~
   drivers/media//platform/vim2m.c:71:2: note: in expansion of macro 'v4l2_dbg'
     v4l2_dbg(lvl, debug, &dev->v4l2_dev, "%s: " fmt, __func__, ## arg)
     ^~~~~~~~
   drivers/media//platform/vim2m.c:893:3: note: in expansion of macro 'dprintk'
      dprintk(ctx->dev, "%s data will not fit into plane (%lu < %lu)\n",
      ^~~~~~~
>> include/linux/kern_levels.h:5:18: warning: format '%s' expects a matching 'char *' argument [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^~~~~~
   include/media/v4l2-common.h:69:9: note: in definition of macro 'v4l2_printk'
     printk(level "%s: " fmt, (dev)->name , ## arg)
            ^~~~~
   include/linux/kern_levels.h:15:20: note: in expansion of macro 'KERN_SOH'
    #define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
                       ^~~~~~~~
   include/media/v4l2-common.h:85:16: note: in expansion of macro 'KERN_DEBUG'
       v4l2_printk(KERN_DEBUG, dev, fmt , ## arg); \
                   ^~~~~~~~~~
   drivers/media//platform/vim2m.c:71:2: note: in expansion of macro 'v4l2_dbg'
     v4l2_dbg(lvl, debug, &dev->v4l2_dev, "%s: " fmt, __func__, ## arg)
     ^~~~~~~~
   drivers/media//platform/vim2m.c:893:3: note: in expansion of macro 'dprintk'
      dprintk(ctx->dev, "%s data will not fit into plane (%lu < %lu)\n",
      ^~~~~~~
   include/media/v4l2-common.h:69:17: note: format string is defined here
     printk(level "%s: " fmt, (dev)->name , ## arg)
                   ~^
>> include/linux/kern_levels.h:5:18: warning: format '%s' expects a matching 'char *' argument [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^~~~~~
   include/media/v4l2-common.h:69:9: note: in definition of macro 'v4l2_printk'
     printk(level "%s: " fmt, (dev)->name , ## arg)
            ^~~~~
   include/linux/kern_levels.h:15:20: note: in expansion of macro 'KERN_SOH'
    #define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
                       ^~~~~~~~
   include/media/v4l2-common.h:85:16: note: in expansion of macro 'KERN_DEBUG'
       v4l2_printk(KERN_DEBUG, dev, fmt , ## arg); \
                   ^~~~~~~~~~
   drivers/media//platform/vim2m.c:71:2: note: in expansion of macro 'v4l2_dbg'
     v4l2_dbg(lvl, debug, &dev->v4l2_dev, "%s: " fmt, __func__, ## arg)
     ^~~~~~~~
   drivers/media//platform/vim2m.c:893:3: note: in expansion of macro 'dprintk'
      dprintk(ctx->dev, "%s data will not fit into plane (%lu < %lu)\n",
      ^~~~~~~
   drivers/media//platform/vim2m.c:71:41: note: format string is defined here
     v4l2_dbg(lvl, debug, &dev->v4l2_dev, "%s: " fmt, __func__, ## arg)
                                           ~^
--
   In file included from include/media/v4l2-subdev.h:24,
                    from include/media/v4l2-device.h:25,
                    from drivers/media/platform/vim2m.c:28:
   drivers/media/platform/vim2m.c: In function 'vim2m_buf_prepare':
>> include/media/v4l2-common.h:84:13: warning: comparison between pointer and integer
      if (debug >= (level))     \
                ^~
   drivers/media/platform/vim2m.c:71:2: note: in expansion of macro 'v4l2_dbg'
     v4l2_dbg(lvl, debug, &dev->v4l2_dev, "%s: " fmt, __func__, ## arg)
     ^~~~~~~~
   drivers/media/platform/vim2m.c:893:3: note: in expansion of macro 'dprintk'
      dprintk(ctx->dev, "%s data will not fit into plane (%lu < %lu)\n",
      ^~~~~~~
   drivers/media/platform/vim2m.c:894:5: error: expected ')' before '__func__'
        __func__, vb2_plane_size(vb, 0), (long)q_data->sizeimage);
        ^~~~~~~~
   include/media/v4l2-common.h:69:22: note: in definition of macro 'v4l2_printk'
     printk(level "%s: " fmt, (dev)->name , ## arg)
                         ^~~
   drivers/media/platform/vim2m.c:71:2: note: in expansion of macro 'v4l2_dbg'
     v4l2_dbg(lvl, debug, &dev->v4l2_dev, "%s: " fmt, __func__, ## arg)
     ^~~~~~~~
   drivers/media/platform/vim2m.c:893:3: note: in expansion of macro 'dprintk'
      dprintk(ctx->dev, "%s data will not fit into plane (%lu < %lu)\n",
      ^~~~~~~
>> include/linux/kern_levels.h:5:18: warning: format '%s' expects a matching 'char *' argument [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^~~~~~
   include/media/v4l2-common.h:69:9: note: in definition of macro 'v4l2_printk'
     printk(level "%s: " fmt, (dev)->name , ## arg)
            ^~~~~
   include/linux/kern_levels.h:15:20: note: in expansion of macro 'KERN_SOH'
    #define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
                       ^~~~~~~~
   include/media/v4l2-common.h:85:16: note: in expansion of macro 'KERN_DEBUG'
       v4l2_printk(KERN_DEBUG, dev, fmt , ## arg); \
                   ^~~~~~~~~~
   drivers/media/platform/vim2m.c:71:2: note: in expansion of macro 'v4l2_dbg'
     v4l2_dbg(lvl, debug, &dev->v4l2_dev, "%s: " fmt, __func__, ## arg)
     ^~~~~~~~
   drivers/media/platform/vim2m.c:893:3: note: in expansion of macro 'dprintk'
      dprintk(ctx->dev, "%s data will not fit into plane (%lu < %lu)\n",
      ^~~~~~~
   include/media/v4l2-common.h:69:17: note: format string is defined here
     printk(level "%s: " fmt, (dev)->name , ## arg)
                   ~^
>> include/linux/kern_levels.h:5:18: warning: format '%s' expects a matching 'char *' argument [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^~~~~~
   include/media/v4l2-common.h:69:9: note: in definition of macro 'v4l2_printk'
     printk(level "%s: " fmt, (dev)->name , ## arg)
            ^~~~~
   include/linux/kern_levels.h:15:20: note: in expansion of macro 'KERN_SOH'
    #define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
                       ^~~~~~~~
   include/media/v4l2-common.h:85:16: note: in expansion of macro 'KERN_DEBUG'
       v4l2_printk(KERN_DEBUG, dev, fmt , ## arg); \
                   ^~~~~~~~~~
   drivers/media/platform/vim2m.c:71:2: note: in expansion of macro 'v4l2_dbg'
     v4l2_dbg(lvl, debug, &dev->v4l2_dev, "%s: " fmt, __func__, ## arg)
     ^~~~~~~~
   drivers/media/platform/vim2m.c:893:3: note: in expansion of macro 'dprintk'
      dprintk(ctx->dev, "%s data will not fit into plane (%lu < %lu)\n",
      ^~~~~~~
   drivers/media/platform/vim2m.c:71:41: note: format string is defined here
     v4l2_dbg(lvl, debug, &dev->v4l2_dev, "%s: " fmt, __func__, ## arg)
                                           ~^

vim +894 drivers/media//platform/vim2m.c

96d8eab5d drivers/media/video/mem2mem_testdev.c Pawel Osciak          2010-04-23  883  
ab7afaf33 drivers/media/platform/vim2m.c        Hans Verkuil          2019-01-16  884  static int vim2m_buf_prepare(struct vb2_buffer *vb)
ab7afaf33 drivers/media/platform/vim2m.c        Hans Verkuil          2019-01-16  885  {
ab7afaf33 drivers/media/platform/vim2m.c        Hans Verkuil          2019-01-16  886  	struct vim2m_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
ab7afaf33 drivers/media/platform/vim2m.c        Hans Verkuil          2019-01-16  887  	struct vim2m_q_data *q_data;
ab7afaf33 drivers/media/platform/vim2m.c        Hans Verkuil          2019-01-16  888  
4bd10b032 drivers/media/platform/vim2m.c        Mauro Carvalho Chehab 2019-02-26  889  	dprintk(ctx->dev, 2, "type: %s\n", type_name(vb->vb2_queue->type));
ab7afaf33 drivers/media/platform/vim2m.c        Hans Verkuil          2019-01-16  890  
ab7afaf33 drivers/media/platform/vim2m.c        Hans Verkuil          2019-01-16  891  	q_data = get_q_data(ctx, vb->vb2_queue->type);
d80ee38cd drivers/media/video/mem2mem_testdev.c Marek Szyprowski      2011-01-12  892  	if (vb2_plane_size(vb, 0) < q_data->sizeimage) {
d80ee38cd drivers/media/video/mem2mem_testdev.c Marek Szyprowski      2011-01-12  893  		dprintk(ctx->dev, "%s data will not fit into plane (%lu < %lu)\n",
d80ee38cd drivers/media/video/mem2mem_testdev.c Marek Szyprowski      2011-01-12 @894  				__func__, vb2_plane_size(vb, 0), (long)q_data->sizeimage);
96d8eab5d drivers/media/video/mem2mem_testdev.c Pawel Osciak          2010-04-23  895  		return -EINVAL;
96d8eab5d drivers/media/video/mem2mem_testdev.c Pawel Osciak          2010-04-23  896  	}
96d8eab5d drivers/media/video/mem2mem_testdev.c Pawel Osciak          2010-04-23  897  
d80ee38cd drivers/media/video/mem2mem_testdev.c Marek Szyprowski      2011-01-12  898  	vb2_set_plane_payload(vb, 0, q_data->sizeimage);
96d8eab5d drivers/media/video/mem2mem_testdev.c Pawel Osciak          2010-04-23  899  
96d8eab5d drivers/media/video/mem2mem_testdev.c Pawel Osciak          2010-04-23  900  	return 0;
96d8eab5d drivers/media/video/mem2mem_testdev.c Pawel Osciak          2010-04-23  901  }
96d8eab5d drivers/media/video/mem2mem_testdev.c Pawel Osciak          2010-04-23  902  

:::::: The code at line 894 was first introduced by commit
:::::: d80ee38cd845baadef175893b99df24e7a03ec40 [media] v4l: mem2mem: port m2m_testdev to vb2

:::::: TO: Marek Szyprowski <m.szyprowski@samsung.com>
:::::: CC: Mauro Carvalho Chehab <mchehab@redhat.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot Feb. 27, 2019, 12:55 p.m. UTC | #2
Hi Mauro,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on next-20190226]
[cannot apply to v5.0-rc8]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Mauro-Carvalho-Chehab/media-vim2m-improve-debug-messages/20190227-194011
base:   git://linuxtv.org/media_tree.git master
config: nds32-allyesconfig (attached as .config)
compiler: nds32le-linux-gcc (GCC) 6.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=6.4.0 make.cross ARCH=nds32 

All warnings (new ones prefixed by >>):

   In file included from include/media/v4l2-subdev.h:24:0,
                    from include/media/v4l2-device.h:25,
                    from drivers/media/platform/vim2m.c:28:
   drivers/media/platform/vim2m.c: In function 'vim2m_buf_prepare':
   include/media/v4l2-common.h:84:13: warning: comparison between pointer and integer
      if (debug >= (level))     \
                ^
>> drivers/media/platform/vim2m.c:71:2: note: in expansion of macro 'v4l2_dbg'
     v4l2_dbg(lvl, debug, &dev->v4l2_dev, "%s: " fmt, __func__, ## arg)
     ^~~~~~~~
>> drivers/media/platform/vim2m.c:893:3: note: in expansion of macro 'dprintk'
      dprintk(ctx->dev, "%s data will not fit into plane (%lu < %lu)\n",
      ^~~~~~~
   drivers/media/platform/vim2m.c:894:5: error: expected ')' before '__func__'
        __func__, vb2_plane_size(vb, 0), (long)q_data->sizeimage);
        ^
   include/media/v4l2-common.h:69:22: note: in definition of macro 'v4l2_printk'
     printk(level "%s: " fmt, (dev)->name , ## arg)
                         ^~~
>> drivers/media/platform/vim2m.c:71:2: note: in expansion of macro 'v4l2_dbg'
     v4l2_dbg(lvl, debug, &dev->v4l2_dev, "%s: " fmt, __func__, ## arg)
     ^~~~~~~~
>> drivers/media/platform/vim2m.c:893:3: note: in expansion of macro 'dprintk'
      dprintk(ctx->dev, "%s data will not fit into plane (%lu < %lu)\n",
      ^~~~~~~
   include/linux/kern_levels.h:5:18: warning: format '%s' expects a matching 'char *' argument [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/media/v4l2-common.h:69:9: note: in definition of macro 'v4l2_printk'
     printk(level "%s: " fmt, (dev)->name , ## arg)
            ^~~~~
   include/linux/kern_levels.h:15:20: note: in expansion of macro 'KERN_SOH'
    #define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
                       ^~~~~~~~
   include/media/v4l2-common.h:85:16: note: in expansion of macro 'KERN_DEBUG'
       v4l2_printk(KERN_DEBUG, dev, fmt , ## arg); \
                   ^~~~~~~~~~
>> drivers/media/platform/vim2m.c:71:2: note: in expansion of macro 'v4l2_dbg'
     v4l2_dbg(lvl, debug, &dev->v4l2_dev, "%s: " fmt, __func__, ## arg)
     ^~~~~~~~
>> drivers/media/platform/vim2m.c:893:3: note: in expansion of macro 'dprintk'
      dprintk(ctx->dev, "%s data will not fit into plane (%lu < %lu)\n",
      ^~~~~~~
   include/linux/kern_levels.h:5:18: warning: format '%s' expects a matching 'char *' argument [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/media/v4l2-common.h:69:9: note: in definition of macro 'v4l2_printk'
     printk(level "%s: " fmt, (dev)->name , ## arg)
            ^~~~~
   include/linux/kern_levels.h:15:20: note: in expansion of macro 'KERN_SOH'
    #define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
                       ^~~~~~~~
   include/media/v4l2-common.h:85:16: note: in expansion of macro 'KERN_DEBUG'
       v4l2_printk(KERN_DEBUG, dev, fmt , ## arg); \
                   ^~~~~~~~~~
>> drivers/media/platform/vim2m.c:71:2: note: in expansion of macro 'v4l2_dbg'
     v4l2_dbg(lvl, debug, &dev->v4l2_dev, "%s: " fmt, __func__, ## arg)
     ^~~~~~~~
>> drivers/media/platform/vim2m.c:893:3: note: in expansion of macro 'dprintk'
      dprintk(ctx->dev, "%s data will not fit into plane (%lu < %lu)\n",
      ^~~~~~~

vim +/v4l2_dbg +71 drivers/media/platform/vim2m.c

    25	
    26	#include <linux/platform_device.h>
    27	#include <media/v4l2-mem2mem.h>
  > 28	#include <media/v4l2-device.h>
    29	#include <media/v4l2-ioctl.h>
    30	#include <media/v4l2-ctrls.h>
    31	#include <media/v4l2-event.h>
    32	#include <media/videobuf2-vmalloc.h>
    33	
    34	MODULE_DESCRIPTION("Virtual device for mem2mem framework testing");
    35	MODULE_AUTHOR("Pawel Osciak, <pawel@osciak.com>");
    36	MODULE_LICENSE("GPL");
    37	MODULE_VERSION("0.1.1");
    38	MODULE_ALIAS("mem2mem_testdev");
    39	
    40	static unsigned debug;
    41	module_param(debug, uint, 0644);
    42	MODULE_PARM_DESC(debug, "debug level");
    43	
    44	/* Default transaction time in msec */
    45	static unsigned int default_transtime = 40; /* Max 25 fps */
    46	module_param(default_transtime, uint, 0644);
    47	MODULE_PARM_DESC(default_transtime, "default transaction time in ms");
    48	
    49	#define MIN_W 32
    50	#define MIN_H 32
    51	#define MAX_W 640
    52	#define MAX_H 480
    53	#define DIM_ALIGN_MASK 7 /* 8-byte alignment for line length */
    54	
    55	/* Flags that indicate a format can be used for capture/output */
    56	#define MEM2MEM_CAPTURE	(1 << 0)
    57	#define MEM2MEM_OUTPUT	(1 << 1)
    58	
    59	#define MEM2MEM_NAME		"vim2m"
    60	
    61	/* Per queue */
    62	#define MEM2MEM_DEF_NUM_BUFS	VIDEO_MAX_FRAME
    63	/* In bytes, per queue */
    64	#define MEM2MEM_VID_MEM_LIMIT	(16 * 1024 * 1024)
    65	
    66	/* Flags that indicate processing mode */
    67	#define MEM2MEM_HFLIP	(1 << 0)
    68	#define MEM2MEM_VFLIP	(1 << 1)
    69	
    70	#define dprintk(dev, lvl, fmt, arg...) \
  > 71		v4l2_dbg(lvl, debug, &dev->v4l2_dev, "%s: " fmt, __func__, ## arg)
    72	
    73	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox series

Patch

diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c
index d95a905bdfc5..ab288e8377f1 100644
--- a/drivers/media/platform/vim2m.c
+++ b/drivers/media/platform/vim2m.c
@@ -39,7 +39,7 @@  MODULE_ALIAS("mem2mem_testdev");
 
 static unsigned debug;
 module_param(debug, uint, 0644);
-MODULE_PARM_DESC(debug, "activates debug info");
+MODULE_PARM_DESC(debug, "debug level");
 
 /* Default transaction time in msec */
 static unsigned int default_transtime = 40; /* Max 25 fps */
@@ -67,8 +67,8 @@  MODULE_PARM_DESC(default_transtime, "default transaction time in ms");
 #define MEM2MEM_HFLIP	(1 << 0)
 #define MEM2MEM_VFLIP	(1 << 1)
 
-#define dprintk(dev, fmt, arg...) \
-	v4l2_dbg(1, debug, &dev->v4l2_dev, "%s: " fmt, __func__, ## arg)
+#define dprintk(dev, lvl, fmt, arg...) \
+	v4l2_dbg(lvl, debug, &dev->v4l2_dev, "%s: " fmt, __func__, ## arg)
 
 
 static void vim2m_dev_release(struct device *dev)
@@ -227,6 +227,18 @@  static struct vim2m_q_data *get_q_data(struct vim2m_ctx *ctx,
 	return NULL;
 }
 
+static const char *type_name(enum v4l2_buf_type type)
+{
+	switch (type) {
+	case V4L2_BUF_TYPE_VIDEO_OUTPUT:
+		return "Output";
+	case V4L2_BUF_TYPE_VIDEO_CAPTURE:
+		return "Capture";
+	default:
+		return "Invalid";
+	}
+}
+
 #define CLIP(__color) \
 	(u8)(((__color) > 0xff) ? 0xff : (((__color) < 0) ? 0 : (__color)))
 
@@ -530,7 +542,7 @@  static int job_ready(void *priv)
 
 	if (v4l2_m2m_num_src_bufs_ready(ctx->fh.m2m_ctx) < ctx->translen
 	    || v4l2_m2m_num_dst_bufs_ready(ctx->fh.m2m_ctx) < ctx->translen) {
-		dprintk(ctx->dev, "Not enough buffers available\n");
+		dprintk(ctx->dev, 1, "Not enough buffers available\n");
 		return 0;
 	}
 
@@ -601,7 +613,7 @@  static void device_work(struct work_struct *w)
 
 	if (curr_ctx->num_processed == curr_ctx->translen
 	    || curr_ctx->aborting) {
-		dprintk(curr_ctx->dev, "Finishing transaction\n");
+		dprintk(curr_ctx->dev, 2, "Finishing capture buffer fill\n");
 		curr_ctx->num_processed = 0;
 		v4l2_m2m_job_finish(vim2m_dev->m2m_dev, curr_ctx->fh.m2m_ctx);
 	} else {
@@ -794,9 +806,14 @@  static int vidioc_s_fmt(struct vim2m_ctx *ctx, struct v4l2_format *f)
 	q_data->sizeimage	= q_data->width * q_data->height
 				* q_data->fmt->depth >> 3;
 
-	dprintk(ctx->dev,
-		"Setting format for type %d, wxh: %dx%d, fmt: %d\n",
-		f->type, q_data->width, q_data->height, q_data->fmt->fourcc);
+	dprintk(ctx->dev, 1,
+		"Format for type %s: %dx%d (%d bpp), fmt: %c%c%c%c\n",
+		type_name(f->type), q_data->width, q_data->height,
+                q_data->fmt->depth,
+                (q_data->fmt->fourcc & 0xff),
+		(q_data->fmt->fourcc >>  8) & 0xff,
+		(q_data->fmt->fourcc >> 16) & 0xff,
+		(q_data->fmt->fourcc >> 24) & 0xff);
 
 	return 0;
 }
@@ -931,7 +948,8 @@  static int vim2m_queue_setup(struct vb2_queue *vq,
 	*nplanes = 1;
 	sizes[0] = size;
 
-	dprintk(ctx->dev, "get %d buffer(s) of size %d each.\n", count, size);
+	dprintk(ctx->dev, 1, "%s: get %d buffer(s) of size %d each.\n",
+                type_name(vq->type), count, size);
 
 	return 0;
 }
@@ -944,7 +962,7 @@  static int vim2m_buf_out_validate(struct vb2_buffer *vb)
 	if (vbuf->field == V4L2_FIELD_ANY)
 		vbuf->field = V4L2_FIELD_NONE;
 	if (vbuf->field != V4L2_FIELD_NONE) {
-		dprintk(ctx->dev, "%s field isn't supported\n", __func__);
+		dprintk(ctx->dev, 1, "%s field isn't supported\n", __func__);
 		return -EINVAL;
 	}
 
@@ -956,7 +974,7 @@  static int vim2m_buf_prepare(struct vb2_buffer *vb)
 	struct vim2m_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
 	struct vim2m_q_data *q_data;
 
-	dprintk(ctx->dev, "type: %d\n", vb->vb2_queue->type);
+	dprintk(ctx->dev, 2, "type: %s\n", type_name(vb->vb2_queue->type));
 
 	q_data = get_q_data(ctx, vb->vb2_queue->type);
 	if (vb2_plane_size(vb, 0) < q_data->sizeimage) {
@@ -1147,7 +1165,7 @@  static int vim2m_open(struct file *file)
 	v4l2_fh_add(&ctx->fh);
 	atomic_inc(&dev->num_inst);
 
-	dprintk(dev, "Created instance: %p, m2m_ctx: %p\n",
+	dprintk(dev, 1, "Created instance: %p, m2m_ctx: %p\n",
 		ctx, ctx->fh.m2m_ctx);
 
 open_unlock:
@@ -1160,7 +1178,7 @@  static int vim2m_release(struct file *file)
 	struct vim2m_dev *dev = video_drvdata(file);
 	struct vim2m_ctx *ctx = file2ctx(file);
 
-	dprintk(dev, "Releasing instance %p\n", ctx);
+	dprintk(dev, 1, "Releasing instance %p\n", ctx);
 
 	v4l2_fh_del(&ctx->fh);
 	v4l2_fh_exit(&ctx->fh);