From: Aditya Garg <gargaditya08@live.com>
To: "andriy.shevchenko@linux.intel.com" <andriy.shevchenko@linux.intel.com>
Cc: "pmladek@suse.com" <pmladek@suse.com>,
"rostedt@goodmis.org" <rostedt@goodmis.org>,
"linux@rasmusvillemoes.dk" <linux@rasmusvillemoes.dk>,
"senozhatsky@chromium.org" <senozhatsky@chromium.org>,
"corbet@lwn.net" <corbet@lwn.net>,
"maarten.lankhorst@linux.intel.com"
<maarten.lankhorst@linux.intel.com>,
"mripard@kernel.org" <mripard@kernel.org>,
"tzimmermann@suse.de" <tzimmermann@suse.de>,
"airlied@gmail.com" <airlied@gmail.com>,
"simona@ffwll.ch" <simona@ffwll.ch>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"apw@canonical.com" <apw@canonical.com>,
"joe@perches.com" <joe@perches.com>,
"dwaipayanray1@gmail.com" <dwaipayanray1@gmail.com>,
"lukas.bulwahn@gmail.com" <lukas.bulwahn@gmail.com>,
"sumit.semwal@linaro.org" <sumit.semwal@linaro.org>,
"christian.koenig@amd.com" <christian.koenig@amd.com>,
"kekrby@gmail.com" <kekrby@gmail.com>,
"admin@kodeit.net" <admin@kodeit.net>,
Orlando Chamberlain <orlandoch.dev@gmail.com>,
"evepolonium@gmail.com" <evepolonium@gmail.com>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"linaro-mm-sig@lists.linaro.org" <linaro-mm-sig@lists.linaro.org>,
Hector Martin <marcan@marcan.st>,
"linux@armlinux.org.uk" <linux@armlinux.org.uk>,
"asahi@lists.linux.dev" <asahi@lists.linux.dev>,
Sven Peter <sven@svenpeter.dev>, Janne Grunau <j@jannau.net>
Subject: Re: [PATCH v2 2/3] lib/vsprintf: Add support for generic FOURCCs by extending %p4cc
Date: Mon, 24 Feb 2025 10:43:54 +0000 [thread overview]
Message-ID: <PN3PR01MB9597DDF5CD7965128C2075DBB8C02@PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <Z7xMt2Kp1pFuMar2@smile.fi.intel.com>
> On 24 Feb 2025, at 4:11 PM, andriy.shevchenko@linux.intel.com wrote:
>
> On Mon, Feb 24, 2025 at 10:32:27AM +0000, Aditya Garg wrote:
>>>> On 24 Feb 2025, at 3:54 PM, andriy.shevchenko@linux.intel.com wrote:
>>> On Mon, Feb 24, 2025 at 10:18:48AM +0000, Aditya Garg wrote:
>>>>>> On 24 Feb 2025, at 3:28 PM, andriy.shevchenko@linux.intel.com wrote:
>>>>> On Sat, Feb 22, 2025 at 03:46:03PM +0000, Aditya Garg wrote:
>>>>>>>> On 20 Feb 2025, at 10:09 PM, Aditya Garg <gargaditya08@live.com> wrote:
>
> ...
>
>>>>>>> %p4cc is designed for DRM/V4L2 FOURCCs with their specific quirks, but
>>>>>>> it's useful to be able to print generic 4-character codes formatted as
>>>>>>> an integer. Extend it to add format specifiers for printing generic
>>>>>>> 32-bit FOURCCs with various endian semantics:
>>>>>>>
>>>>>>> %p4ch Host-endian
>>>>>>> %p4cl Little-endian
>>>>>>> %p4cb Big-endian
>>>>>>> %p4cr Reverse-endian
>>>>>>>
>>>>>>> The endianness determines how bytes are interpreted as a u32, and the
>>>>>>> FOURCC is then always printed MSByte-first (this is the opposite of
>>>>>>> V4L/DRM FOURCCs). This covers most practical cases, e.g. %p4cr would
>>>>>>> allow printing LSByte-first FOURCCs stored in host endian order
>>>>>>> (other than the hex form being in character order, not the integer
>>>>>>> value).
>>>>>
>>>>> ...
>>>>>
>>>>>> BTW, after looking at the comments by Martin [1], its actually better to use
>>>>>> existing specifiers for the appletbdrm driver. The driver needs the host
>>>>>> endian as proposed by this patch, so instead of that, we can use %.4s
>>>>>
>>>>> Do you mean this patch will not be needed? If this a case, that would be the
>>>>> best solution.
>>>>
>>>> I tested with %4pE, and the results are different from expected. So this
>>>> would be preferred. Kindly see my latest email with a proposed workaround for
>>>> the sparse warnings.
>>>
>>> %.4s sounded okay, but %4pE is always about escaping and the result may occupy
>>> %4x memory (octal escaping of non-printable characters). Of course, you may vary
>>> the escaping classes, but IIRC the octal or hex escaping is unconditional.
>>
>> %.4s is used for unsigned int iirc, here it's __le32.
>
> No, it's used to 'char *'. in case one may guarantee that it at least is
> four characters long.
Still the argument here is __le32. %p4h is showing reverse values than what %4pE as well as %.4s shows.
>
>>>>>> [1]: https://lore.kernel.org/asahi/E753B391-D2CB-4213-AF82-678ADD5A7644@cutebit.org/
>>>>>>
>>>>>> Alternatively we could add a host endian only. Other endians are not really
>>>>>> used by any driver AFAIK. The host endian is being used by appletbdrm and
>>>>>> Asahi Linux’ SMC driver only.
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
next prev parent reply other threads:[~2025-02-24 10:44 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-20 16:38 [PATCH v2 1/3] drm/format-helper: Add conversion from XRGB8888 to BGR888 Aditya Garg
2025-02-20 16:39 ` [PATCH v2 2/3] lib/vsprintf: Add support for generic FOURCCs by extending %p4cc Aditya Garg
2025-02-21 10:29 ` Rasmus Villemoes
2025-02-21 11:40 ` Aditya Garg
2025-02-21 15:27 ` andriy.shevchenko
2025-02-21 19:35 ` Aditya Garg
2025-02-21 20:06 ` Aditya Garg
2025-02-21 20:23 ` andriy.shevchenko
2025-02-22 12:11 ` Aditya Garg
2025-02-22 15:46 ` Aditya Garg
2025-02-24 9:58 ` andriy.shevchenko
2025-02-24 10:18 ` Aditya Garg
2025-02-24 10:24 ` andriy.shevchenko
2025-02-24 10:32 ` Aditya Garg
2025-02-24 10:40 ` andriy.shevchenko
2025-02-24 10:43 ` Aditya Garg [this message]
2025-02-24 10:48 ` andriy.shevchenko
2025-02-24 10:52 ` Aditya Garg
2025-02-24 16:17 ` Aditya Garg
2025-02-27 11:21 ` Aditya Garg
2025-02-20 16:40 ` [PATCH v2 3/3] drm/tiny: add driver for Apple Touch Bars in x86 Macs Aditya Garg
2025-02-20 18:34 ` Neal Gompa
2025-02-20 20:41 ` Aditya Garg
-- strict thread matches above, loose matches on Subject: below --
2025-02-23 6:39 [PATCH v2 2/3] lib/vsprintf: Add support for generic FOURCCs by extending %p4cc Aditya Garg
2025-02-24 11:08 ` andriy.shevchenko
[not found] <16F819E8-E866-4552-BB08-31486D2BA8C5@live.com>
2025-02-23 15:16 ` Aditya Garg
2025-02-24 10:57 ` andriy.shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=PN3PR01MB9597DDF5CD7965128C2075DBB8C02@PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM \
--to=gargaditya08@live.com \
--cc=admin@kodeit.net \
--cc=airlied@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=apw@canonical.com \
--cc=asahi@lists.linux.dev \
--cc=christian.koenig@amd.com \
--cc=corbet@lwn.net \
--cc=dri-devel@lists.freedesktop.org \
--cc=dwaipayanray1@gmail.com \
--cc=evepolonium@gmail.com \
--cc=j@jannau.net \
--cc=joe@perches.com \
--cc=kekrby@gmail.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linux@rasmusvillemoes.dk \
--cc=lukas.bulwahn@gmail.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marcan@marcan.st \
--cc=mripard@kernel.org \
--cc=orlandoch.dev@gmail.com \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=simona@ffwll.ch \
--cc=sumit.semwal@linaro.org \
--cc=sven@svenpeter.dev \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox