mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: "Timothy Pearson" <tpearson@raptorengineering.com>,
	"René Rebe" <rene@exactco.de>
Cc: dri-devel <dri-devel@lists.freedesktop.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Dave Airlie <airlied@redhat.com>
Subject: Re: [PATCH] drm/ast: Fix big-endian support
Date: Fri, 5 Dec 2025 20:46:55 +0100	[thread overview]
Message-ID: <9191ea89-81ce-4200-a356-39fa4a155062@suse.de> (raw)
In-Reply-To: <758090394.145092.1764959517083.JavaMail.zimbra@raptorengineeringinc.com>

Hi

Am 05.12.25 um 19:31 schrieb Timothy Pearson:
>
> ----- Original Message -----
>> From: "René Rebe" <rene@exactco.de>
>> To: tzimmermann@suse.de
>> Cc: "dri-devel" <dri-devel@lists.freedesktop.org>, "linux-kernel" <linux-kernel@vger.kernel.org>, "Dave Airlie"
>> <airlied@redhat.com>, "Timothy Pearson" <tpearson@raptorengineering.com>
>> Sent: Friday, December 5, 2025 9:14:59 AM
>> Subject: Re: [PATCH] drm/ast: Fix big-endian support
>> Hello Thomas,
>>
>> On Wed, 3 Dec 2025 10:40:17 +0100, Thomas Zimmermann <tzimmermann@suse.de>
>> wrote:
>>
>>> [2]
>>> https://gitlab.freedesktop.org/drm/misc/kernel/-/blob/drm-misc-next-2025-12-01-1/drivers/gpu/drm/ast/ast_mode.c?ref_type=tags#L559
>>> [3]
>>> https://gitlab.freedesktop.org/drm/misc/kernel/-/blob/drm-misc-next-2025-12-01-1/drivers/gpu/drm/ast/ast_cursor.c?ref_type=tags#L209
>>>
>>>> +	case DRM_FORMAT_RGB565:
>>>> + ast_set_index_reg_mask(ast, AST_IO_VGACRI, AST_IO_VGACRA2, 0x3f,
>>>> 0x40);
>>>> +		break;
>>>> +	case DRM_FORMAT_XRGB8888
>> While working on it I discovered that the Big-Endian byte-swapping
>> bits do apparently not just-work on a newer AST2400 in our Power 8
>> while my initial patch did work as tested with an AST2200 in the Sun
>> T4-1 :-/

In the upcoming v6.19-rc1, ast will support per-chip quirks. So we can 
control this by chip version, if necessary

>>
>> Maybe that is what Timothy meant with "This is due to a ppc64 hardware
>> quirk, which when combined with a hardware design fault in the AST2500
>> VGA controller results in a need to use software-based red-blue
>> channel swapping." [1]
>>
>> Is there a way to simply specify the frame-buffer as BGRX8888? In a
>> quick test the drm layer complaint about "not supported" and "no
>> compatible format found"?
> I've been all around that loop.  You can't do that -- the fb code has no idea how to drive such a framebuffer, and elsewhere in the kernel it's made clear that the GPU driver *must* provide a RGBX8888 linear framebuffer if the Linux fb code is going to be able to display a console.
>
> Does the Sun T4 CPU perform automatic byte swapping on PCI[e] data transactions?  That might be the difference; POWER performs the byte swapping, and since the ASpeed device is broken in BE mode we can't swap back by setting the BE register bit in the AST GPU hardware.
>
> Fun fact -- it'll sorta work on the framebuffer side, but we lose the entire control BAR in the process.  ASpeed seems OK with this, they just say something along the lines of "oh, BE is not supported despite our documentation" :facepalm:

On the 2400-and-onwards models, ast could set 
drm_device.mode_config.quirk_addfb_prefer_host_byte_order. If set, the 
format lookup will select a different format on BE machines. [1] For 
example requesting XRGB8888 returns BGRX8888 instead. If ast later sees 
such a format in the atomic_update code, it could transparently swap 
bytes when writing out pixels to the video memory.  IIRC this works 
transparently to DRM clients and fbcon.  I think this would be the 
preferred way of fixing the issue.

[1] 
https://elixir.bootlin.com/linux/v6.18/source/drivers/gpu/drm/drm_fourcc.c#L123

For the pre-2400 chips, I suggest to fix this problem with the hardware 
byte swapping if possible. That seems like the correct approach.

Best regards
Thomas


-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)



  reply	other threads:[~2025-12-05 19:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-02 16:06 René Rebe
2025-12-03  9:40 ` Thomas Zimmermann
2025-12-03 10:14   ` René Rebe
2025-12-03 10:28     ` Thomas Zimmermann
2025-12-05 15:14   ` René Rebe
2025-12-05 18:31     ` Timothy Pearson
2025-12-05 19:46       ` Thomas Zimmermann [this message]
2025-12-05 19:50         ` René Rebe
2025-12-08  8:44           ` Thomas Zimmermann
2025-12-09 12:13             ` René Rebe
2025-12-10  8:55               ` Thomas Zimmermann
2025-12-10 15:33                 ` René Rebe
2025-12-10 15:41                   ` Thomas Zimmermann
2025-12-10 16:56                     ` René Rebe
2025-12-11  7:22                       ` Thomas Zimmermann
2025-12-11 12:43                         ` René Rebe
2025-12-11 14:03                           ` Thomas Zimmermann
2025-12-11 14:31                             ` René Rebe
2025-12-11 14:56                               ` Thomas Zimmermann
2025-12-12 15:14                                 ` Michel Dänzer
2025-12-12 17:54                                   ` René Rebe
2025-12-12 20:15                               ` René Rebe
2025-12-15  7:27                                 ` Thomas Zimmermann

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=9191ea89-81ce-4200-a356-39fa4a155062@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rene@exactco.de \
    --cc=tpearson@raptorengineering.com \
    /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®