From patchwork Tue Jul 2 12:17:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 13719541 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 36241C3064D for ; Tue, 2 Jul 2024 12:18:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9DBF810E199; Tue, 2 Jul 2024 12:18:04 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="HOSD5cVr"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id E34D410E199 for ; Tue, 2 Jul 2024 12:18:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719922681; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=V6GUg8qJdzfUKFkObYqAigKWCFdCLA/o1qUky7ru9B0=; b=HOSD5cVrSZLH7ofIFagI2mdS1TVEklyY7szMBEt9lwL2IUoGokofwLY93+RtcJbF59jd0q waJTMuhqnL+PXZ0jN1TH6wRCgoY8ouUe8J/Nb9J+fk4oWOUgTpYQP8hlqIY2ZqWdrozEWO 4gCnBbYtMswDGt9p1A822LIlGD+5L+o= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-83-lJRGdo3UPRecJTpGrx0DQg-1; Tue, 02 Jul 2024 08:17:56 -0400 X-MC-Unique: lJRGdo3UPRecJTpGrx0DQg-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B3B8C1979201; Tue, 2 Jul 2024 12:17:54 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.116]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C8C0C3000221; Tue, 2 Jul 2024 12:17:49 +0000 (UTC) From: Thomas Huth To: dri-devel@lists.freedesktop.org, Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Geert Uytterhoeven Cc: linux-kernel@vger.kernel.org, David Airlie , Daniel Vetter , Javier Martinez Canillas , Thomas Huth Subject: [PATCH] drm/fbdev-dma: Fix framebuffer mode for big endian devices Date: Tue, 2 Jul 2024 14:17:37 +0200 Message-ID: <20240702121737.522878-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The drm_mode_legacy_fb_format() function only generates formats suitable for little endian devices. switch to drm_driver_legacy_fb_format() here instead to take the device endianness into consideration, too. Suggested-by: Thomas Zimmermann Signed-off-by: Thomas Huth Reviewed-by: Thomas Zimmermann Reviewed-by: Javier Martinez Canillas --- Note: Patch has only been compile-tested since I lack an environment for testing it. But it's the same fix as I required for the drm_mode_legacy_fb_format() in drm_fbdev_generic.c / drm_fbdev_ttm.c so I think this should be fine. drivers/gpu/drm/drm_fbdev_dma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_fbdev_dma.c b/drivers/gpu/drm/drm_fbdev_dma.c index 97ef6300d47e..fdef4a2f883f 100644 --- a/drivers/gpu/drm/drm_fbdev_dma.c +++ b/drivers/gpu/drm/drm_fbdev_dma.c @@ -101,7 +101,8 @@ static int drm_fbdev_dma_helper_fb_probe(struct drm_fb_helper *fb_helper, sizes->surface_width, sizes->surface_height, sizes->surface_bpp); - format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth); + format = drm_driver_legacy_fb_format(dev, sizes->surface_bpp, + sizes->surface_depth); buffer = drm_client_framebuffer_create(client, sizes->surface_width, sizes->surface_height, format); if (IS_ERR(buffer))