lib/vsprintf: Add support for printing V4L2 and DRM fourccs
Subsystems (4)
PATCH 1/1 lib/vsprintf: Add support for printing V4L2 and DRM fourccs
Add a printk modifier %p4cc (for pixel format) for printing V4L2 and DRM pixel formats denoted by fourccs. The fourcc encoding is the same for both so the same implementation can be used.
Suggested-by Mauro Carvalho Chehab <[email protected]>
Signed-off-by Sakari Ailus <[email protected]>
--- Documentation/core-api/printk-formats.rst | 12 ++++ lib/test_printf.c | 17 +++++ lib/vsprintf.c | 86 +++++++++++++++++++++++ 3 files changed, 115 insertions(+)
Documentation/core-api/printk-formats.rst +12 -0
@@ -545,6 +545,18 @@ For printing netdev_features_t. Passed by reference. +V4L2 and DRM FourCC code (pixel format) +--------------------------------------- + +:: + + %p4cc + +Print a FourCC code used by V4L2 or DRM, including format endianness and +its numerical value as hexadecimal. + +Passed by reference. + Thanks ======
lib/test_printf.c +17 -0
@@ -624,6 +624,22 @@ static void __init fwnode_pointer(void)software_node_unregister_nodes (softnodes); } +static void __init fourcc_pointer (void ) +{ +struct { +u32 code; +char *str; + }const try[] = { + {0x20104646 ,"FF(10) little-endian (0x20104646)" , }, + {0xa0104646 ,"FF(10) big-endian (0xa0104646)" , }, + {0x10111213 ,"(13)(12)(11)(10) little-endian (0x10111213)" , }, + }; +unsigned int i; + +for (i =0 ; i <ARRAY_SIZE (try); i++) +test (try[i].str,"%p4cc" , &try[i].code); +} +static void __init errptr (void ) {
@@ -668,6 +684,7 @@ test_pointer(void)flags ();errptr ();fwnode_pointer (); +fourcc_pointer (); }static void __init selftest (void )
lib/vsprintf.c +86 -0
104 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 6 lines · Sakari Ailus
Add a printk modifier %p4cc (for pixel format) for printing V4L2 and DRM pixel formats denoted by fourccs. The fourcc encoding is the same for both so the same implementation can be used.
Suggested-by Mauro Carvalho Chehab <[email protected]>Signed-off-by Sakari Ailus <[email protected]>
Please ignore this one.
Signature · 1 line
Sakari Ailus