Re: [PATCH 1/1] lib/vsprintf: Add support for printing V4L2 and DRM fourccs

From: Pekka Paalanen
Date: Mon Apr 06 2020 - 03:38:11 EST


On Wed, 1 Apr 2020 18:13:32 +0300
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:

> On Wed, Apr 01, 2020 at 04:13:51PM +0200, Hans Verkuil wrote:
> > On 4/1/20 4:05 PM, Sakari Ailus wrote:
> > > Add a printk modifier %ppf (for pixel format) for printing V4L2 and DRM
> > > pixel formats denoted by 4ccs. The 4cc encoding is the same for both so
> > > the same implementation can be used.
>
> %p4cc ?
>

> Another possibility
>
> u8 ch[8];
>
> if (*fourcc & BIT(31)) {
> put_unaligned_be32(tmp, &ch[0]);
> strcpy(&ch[4], "-BE");
> } else {
> put_unaligned_le32(tmp, &ch[0]);
> strcpy(&ch[4], "-LE");
> }
> return string(buf, end, &ch[0], spec);
>

Hi,

mind, if I guess right what that code does, I think this would confuse
the fourcc code endianness and the pixel data endianness. I think fourcc
codes are always crafted machine-endian, regardless of how the pixel
data is. At least, that is what drm_fourcc.h seems to be doing with
fourcc_code(). That has nothing to do with DRM_FORMAT_BIG_ENDIAN which
refers to the pixel data.


Thanks,
pq

Attachment: pgpkHSubIollL.pgp
Description: OpenPGP digital signature