Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4083145imw; Tue, 12 Jul 2022 01:05:44 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sQtEviZRof0nyBibpAKoEC8lIpGwyOXBVfwormW2eP34TBGv8lwdy4g3e35L/Pi+ow3tue X-Received: by 2002:a17:906:4313:b0:726:3b55:704b with SMTP id j19-20020a170906431300b007263b55704bmr22670348ejm.398.1657613144557; Tue, 12 Jul 2022 01:05:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657613144; cv=none; d=google.com; s=arc-20160816; b=uK10ZZMkok/5L3i/WNF0QIf1j4HMCbOa/t/9H2YgVEgusa1WXrkFLX9KH+U9+YGhc3 +g0s59Hbs4abMawuDug9enn83YfNUCDTh1H52tZc7MT+mqfNGR+KcIv7nZdtybqMwBXE V8YGMWNVlbjzqus+G1cwCUgbQm41sFNQ+Tb5QIyJLMgoFHF8NiH4no1xYDLnXLZRtfmi tH0cxa4m6wkex4Khtro7CHhgQXQBrGdGXp4GdblGrcEaxe9kGjcw6cswFq+6SVxm3sio j0ZoWXlQKks0C8lWt4y68Yv67fbdw+NFWRHgV1dzKioEslL84GXpIBqRYnQeJKpHGE95 SjMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=IwKfKFbx4WwviqtMMacQ0C+SYHYAOQOV85TH5GU4PBI=; b=vzowYZM1P3WP4bV+DxkEpVwZpc05fkGTeTWHCO1rJePL5jiVEFrTSYCRypxD0iFUNe WjR3Rr6e+7VkhJnfbrYjAY0GKxxn7StJ3BVVRIdxovYxSXe141vVv6CLi/MJm1mOBDXs RXUmPMzuvfkECqgAY9jQY56LPRZ9D3j2hH2LgEG/Dw6cv+gEvErGwYjjwtVudfZq/o3q ZEbTV8IOwIOf0NEyZ7l1mW55dYilYS2BPnn4jJ8aOUcFQS48W1nwig9hAssCVqrQc1jZ NDrmERlmFl8pENGE7YDDBQbypQePtO6m3FwSfJM1tGiOwujcFQGZJpwBeXYxvLowPljF j5nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HXZ5cqUd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hq16-20020a1709073f1000b0072b4f140c57si10872120ejc.592.2022.07.12.01.04.42; Tue, 12 Jul 2022 01:05:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HXZ5cqUd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232070AbiGLHra (ORCPT + 99 others); Tue, 12 Jul 2022 03:47:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbiGLHr0 (ORCPT ); Tue, 12 Jul 2022 03:47:26 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5A4699C264 for ; Tue, 12 Jul 2022 00:47:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657612043; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=IwKfKFbx4WwviqtMMacQ0C+SYHYAOQOV85TH5GU4PBI=; b=HXZ5cqUdnOYg+KkchxmmV0VMLNPePmWMIcLxoXNp9NuRSFQ+WZZtc7sWJak3ZKL6YJA9bE Mge+r0GuEm9zyZZ2DWl08MVnr68ef4t6NUIF6mNjPTT3ZGnol6UlmkjoI3ZAX64mZSdG0t 7RuQKIsbGydTkzm8w+500VYrwZ4Clt0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-486-lWqTc9k-NwOQ2KkLNRlK6g-1; Tue, 12 Jul 2022 03:47:18 -0400 X-MC-Unique: lWqTc9k-NwOQ2KkLNRlK6g-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 736ED8037AA; Tue, 12 Jul 2022 07:47:17 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 08618C15D58; Tue, 12 Jul 2022 07:47:17 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id A946318000A9; Tue, 12 Jul 2022 09:47:15 +0200 (CEST) Date: Tue, 12 Jul 2022 09:47:15 +0200 From: Gerd Hoffmann To: Geert Uytterhoeven Cc: Michel =?utf-8?Q?D=C3=A4nzer?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Noralf =?utf-8?Q?Tr=C3=B8nnes?= , Linux Fbdev development list , Linux/m68k , DRI Development , Linux Kernel Mailing List Subject: Re: [PATCH 1/3] drm/fourcc: Add missing big-endian XRGB1555 and RGB565 formats Message-ID: <20220712074715.kopstlvz4q6npaye@sirius.home.kraxel.org> References: <0744671ac096a12f0d538906bd324efa71b11400.1657300532.git.geert@linux-m68k.org> <96a87833-d878-dde9-e335-9ea51a4ba406@mailbox.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 11, 2022 at 05:30:30PM +0200, Geert Uytterhoeven wrote: > Hi Michel, > > > > Cirrus is the only driver setting quirk_addfb_prefer_host_byte_order > > > and supporting RGB565 or XRGB1555, but no one tried that on big-endian? > > > Cirrus does not support DRM_FORMAT_RGB565 | DRM_FORMAT_BIG_ENDIAN > > > in cirrus_fb_create, so you cannot get a graphical text console. > > > > > > Do we need these definitions on little-endian platforms, too? > > > Would it be better to use "DRM_FORMAT_{XRGB1555,RGB565} | > > > DRM_FORMAT_BIG_ENDIAN" instead of "DRM_FORMAT_HOST_{XRGB1555,RGB565}" in > > > formats[]? > > > > The intention of DRM_FORMAT_HOST_* is that they are macros in > > include/drm/drm_fourcc.h which just map to little endian formats > > defined in drivers/gpu/drm/drm_fourcc.c. Since this is not possible > > for big endian hosts for XRGB1555 or RGB565 (or any other format > > with non-8-bit components), this isn't applicable here. It IMHO is not applicable to any physical hardware. It's used by virtio-gpu where the supported format depends on the byte order (it is argb8888 in native byte order). Only virtual hardware can have that kind of behavior. And we can probably drop the DRM_FORMAT_HOST_* variants for 1555 and 565, they are not used anywhere. > I read that as that you prefer to write "DRM_FORMAT_{XRGB1555,RGB565} > | DRM_FORMAT_BIG_ENDIAN" in formats[]? Agree. > > It's also doubtful that Cirrus hardware would access these formats > > as big endian (drivers/gpu/drm/tiny/cirrus.c has no endianness > > references at all, and the hardware was surely designed for x86 > > first and foremost). Yes. qemu mimics physical cirrus hardware which uses little endian. > > Instead, fbcon (and user space) needs to convert to little endian > > when using DRM_FORMAT_HOST_{XRGB1555,RGB565} with the cirrus driver > > on big endian hosts. Well, the cirrus driver uses shadow framebuffers anyway (the only workable approach given it has 4M vram only), and it also supports converting formats on-the-fly when copying from shadow to vram. So adding support for bigendian formats to the driver shouldn't be much of a problem. The vram will continue to run in little endian RGB565, the shadow will be big endian RGB565, and the driver must byteswap when copying. > Yeah, probably the cirrus driver can use some fixes... I'd call it improvements. It's not like the cirrus driver is broken. take care, Gerd