From: Aditya Garg <gargaditya08@live.com>
To: "andriy.shevchenko@linux.intel.com" <andriy.shevchenko@linux.intel.com>
Cc: "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>,
Kerem Karabay <kekrby@gmail.com>,
Atharva Tiwari <evepolonium@gmail.com>,
Aun-Ali Zaidi <admin@kodeit.net>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH v4 2/2] drm/tiny: add driver for Apple Touch Bars in x86 Macs
Date: Mon, 24 Feb 2025 15:52:03 +0000 [thread overview]
Message-ID: <PN3PR01MB95970BAFDA466CE04A7297FBB8C02@PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <Z7yVCRIRU5V9JsWC@smile.fi.intel.com>
> On 24 Feb 2025, at 9:19 PM, andriy.shevchenko@linux.intel.com wrote:
>
> On Mon, Feb 24, 2025 at 03:39:56PM +0000, Aditya Garg wrote:
>>>> On 24 Feb 2025, at 9:07 PM, andriy.shevchenko@linux.intel.com wrote:
>>> On Mon, Feb 24, 2025 at 03:20:13PM +0000, Aditya Garg wrote:
>>>>>> On 24 Feb 2025, at 8:41 PM, andriy.shevchenko@linux.intel.com wrote:
>>>>> On Mon, Feb 24, 2025 at 03:03:40PM +0000, Aditya Garg wrote:
>>>>>>>> On 24 Feb 2025, at 8:27 PM, andriy.shevchenko@linux.intel.com wrote:
>>>>>>> On Mon, Feb 24, 2025 at 02:32:37PM +0000, Aditya Garg wrote:
>>>>>>>>> On 24 Feb 2025, at 7:30 PM, andriy.shevchenko@linux.intel.com wrote:
>>>>>>>>> On Mon, Feb 24, 2025 at 01:40:20PM +0000, Aditya Garg wrote:
>
> ...
>
>>>>>>>>>> +#define __APPLETBDRM_MSG_STR4(str4) ((__le32 __force)((str4[0] << 24) | (str4[1] << 16) | (str4[2] << 8) | str4[3]))
>>>>>>>>>
>>>>>>>>> As commented previously this is quite strange what's going on with endianess in
>>>>>>>>> this driver. Especially the above weirdness when get_unaligned_be32() is being
>>>>>>>>> open coded and force-cast to __le32.
>>>>>>>>
>>>>>>>> I would assume it was also mimicked from the Windows driver, though I haven't
>>>>>>>> really tried exploring this there.
>>>>>>>>
>>>>>>>> I’d rather be happy if you give me code change suggestions and let me review
>>>>>>>> and test them
>>>>>>>
>>>>>>> For the starter I would do the following for all related constants and
>>>>>>> drop that weird and ugly macros at the top (it also has an issue with
>>>>>>> the str4 length as it is 5 bytes long, not 4, btw):
>>>>>>>
>>>>>>> #define APPLETBDRM_MSG_CLEAR_DISPLAY cpu_to_le32(0x434c5244) /* CLRD */
>>>>>>
>>>>>> Lemme test this.
>>>>>
>>>>> Just in case it won't work, reverse bytes in the integer. Because I was lost in
>>>>> this conversion.
>>>>
>>>> It works. What I understand is that you used the macro to get the final hex
>>>> and converted it into little endian, which on the x86 macs would technically
>>>> remain the same.
>>
>> The Macro is just converting the letters into their hex form, but simply
>> calculating them and putting the letters in comments is equally good.
>
> Again, it does it in most confusing and weird way. Just kill it.
#define APPLETBDRM_PIXEL_FORMAT cpu_to_le32(0x52474241) /* RGBA, the actual format is BGR888 */
#define APPLETBDRM_BITS_PER_PIXEL 24
#define APPLETBDRM_MSG_CLEAR_DISPLAY cpu_to_le32(0x434c5244) /* CLRD */
#define APPLETBDRM_MSG_GET_INFORMATION cpu_to_le32(0x47494e46) /* GINF */
#define APPLETBDRM_MSG_UPDATE_COMPLETE cpu_to_le32(0x5544434c) /* UDCL */
#define APPLETBDRM_MSG_SIGNAL_READINESS cpu_to_le32(0x52454459) /* REDY */
This should be good.
next prev parent reply other threads:[~2025-02-24 15:52 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-24 13:37 [PATCH v4 0/2] Touch Bar DRM driver for " Aditya Garg
2025-02-24 13:38 ` [PATCH v4 1/2] drm/format-helper: Add conversion from XRGB8888 to BGR888 Aditya Garg
2025-02-24 14:29 ` andriy.shevchenko
2025-02-24 14:54 ` Aditya Garg
2025-02-24 15:00 ` andriy.shevchenko
2025-02-24 15:03 ` Aditya Garg
2025-02-24 15:03 ` andriy.shevchenko
2025-02-25 7:37 ` Thomas Zimmermann
2025-02-25 10:24 ` andriy.shevchenko
2025-02-24 13:40 ` [PATCH v4 2/2] drm/tiny: add driver for Apple Touch Bars in x86 Macs Aditya Garg
2025-02-24 14:00 ` andriy.shevchenko
2025-02-24 14:32 ` Aditya Garg
2025-02-24 14:57 ` andriy.shevchenko
2025-02-24 15:03 ` Aditya Garg
2025-02-24 15:11 ` andriy.shevchenko
2025-02-24 15:20 ` Aditya Garg
2025-02-24 15:32 ` Aditya Garg
2025-02-24 15:38 ` andriy.shevchenko
2025-02-24 15:40 ` Aditya Garg
2025-02-24 15:52 ` andriy.shevchenko
2025-02-24 15:56 ` Aditya Garg
2025-02-24 16:14 ` Aditya Garg
2025-02-24 16:14 ` andriy.shevchenko
2025-02-24 16:38 ` Aditya Garg
2025-02-24 15:36 ` andriy.shevchenko
2025-02-24 15:39 ` Aditya Garg
2025-02-24 15:49 ` andriy.shevchenko
2025-02-24 15:52 ` Aditya Garg [this message]
2025-02-24 16:12 ` andriy.shevchenko
2025-02-24 16:58 ` Aditya Garg
2025-02-25 7:56 ` Thomas Zimmermann
2025-02-25 8:02 ` Aditya Garg
2025-02-25 8:46 ` Thomas Zimmermann
2025-02-25 9:04 ` Aditya Garg
2025-02-25 9:07 ` Aditya Garg
2025-02-25 9:35 ` Thomas Zimmermann
2025-02-25 9:37 ` Aditya Garg
2025-02-25 10:01 ` Aditya Garg
2025-02-25 7:52 ` Thomas Zimmermann
2025-02-25 8:00 ` Aditya Garg
2025-02-25 8:48 ` Thomas Zimmermann
2025-02-25 10:28 ` andriy.shevchenko
2025-02-27 16:54 ` kernel test robot
2025-02-27 17:28 ` Aditya Garg
2025-02-28 12:25 ` andriy.shevchenko
2025-02-27 23:22 ` kernel test robot
2025-02-27 23:59 ` kernel test robot
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=PN3PR01MB95970BAFDA466CE04A7297FBB8C02@PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM \
--to=gargaditya08@live.com \
--cc=admin@kodeit.net \
--cc=airlied@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=evepolonium@gmail.com \
--cc=kekrby@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--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
all inboxes | Powered by JetHome®