From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0957DC433FE for ; Wed, 23 Nov 2022 17:05:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238275AbiKWRFc (ORCPT ); Wed, 23 Nov 2022 12:05:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237966AbiKWRF2 (ORCPT ); Wed, 23 Nov 2022 12:05:28 -0500 Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC0B1A65BF; Wed, 23 Nov 2022 09:05:27 -0800 (PST) Received: by mail-qt1-f175.google.com with SMTP id h16so3185112qtu.2; Wed, 23 Nov 2022 09:05:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ZaUOlJ3sjB7IWYce0/bjUUBOp0Vg9o09HXSbd2ZFOCw=; b=eu7aV3XaUpSZIm1uqkcNLeGbLY/2lr2PhOCuz/ATxrNDrZivdNGWqy1X2H8NtQwund eaImVPW2Ubfj11a6exKlFxBRIfYq6sIm1EfqKf+9BA0Mck3UJyNFhid52wgSl41gtcVa 3Oqyu1cUYRO2WehMB9Eb+s9+avMkqz4tEICbNqcmVR8J5kxHdQrSB7orlRiQPpfmy+dQ pkAutjRwiCo+OPXJPhpT/Eht7o/inweI2gBqatxF5x8HQjYbcNS6zMZE0RJODvGwkwJr c0y9zUAsDqMm6VfT/G3gkDIj7jDqt2HiViSnxqCvQ4DyvV1/TLEvThweABVsW9RQMmO4 eEHw== X-Gm-Message-State: ANoB5pn9VXqv/orbjmNtEEh16m+cjJSdiSVtCb4EzHD2IzgGvjt4PvIS TnzGKJptvM4hpWXZL4ePkn3lrdowUB5dyA== X-Google-Smtp-Source: AA0mqf4U4cQbP3lDDoIoPNW0lToxqJOLRkC1ZMEulZlnPD4J37SPwfDQmdLQgzeCpCX2yfF4AHJW6A== X-Received: by 2002:a05:622a:1aa3:b0:35c:c042:914 with SMTP id s35-20020a05622a1aa300b0035cc0420914mr11391745qtc.179.1669223126503; Wed, 23 Nov 2022 09:05:26 -0800 (PST) Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com. [209.85.219.175]) by smtp.gmail.com with ESMTPSA id fb13-20020a05622a480d00b003999d25e772sm10225888qtb.71.2022.11.23.09.05.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Nov 2022 09:05:25 -0800 (PST) Received: by mail-yb1-f175.google.com with SMTP id d128so3090091ybf.10; Wed, 23 Nov 2022 09:05:24 -0800 (PST) X-Received: by 2002:a25:9e84:0:b0:6de:6183:c5c3 with SMTP id p4-20020a259e84000000b006de6183c5c3mr9395618ybq.89.1669223124469; Wed, 23 Nov 2022 09:05:24 -0800 (PST) MIME-Version: 1.0 References: <3ee1f8144feb96c28742b22384189f1f83bcfc1a.1669221671.git.geert@linux-m68k.org> In-Reply-To: From: Geert Uytterhoeven Date: Wed, 23 Nov 2022 18:05:13 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH resend v2] drm/fourcc: Add missing big-endian XRGB1555 and RGB565 formats To: Daniel Vetter Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Gerd Hoffmann , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Daniel, On Wed, Nov 23, 2022 at 5:57 PM Daniel Vetter wrote: > On Wed, Nov 23, 2022 at 05:43:10PM +0100, Geert Uytterhoeven wrote: > > As of commit eae06120f1974e1a ("drm: refuse ADDFB2 ioctl for broken > > bigendian drivers"), drivers must set the > > quirk_addfb_prefer_host_byte_order quirk to make the drm_mode_addfb() > > compat code work correctly on big-endian machines. > > > > While that works fine for big-endian XRGB8888 and ARGB8888, which are > > mapped to the existing little-endian BGRX8888 and BGRA8888 formats, it > > does not work for big-endian XRGB1555 and RGB565, as the latter are not > > listed in the format database. > > > > Fix this by adding the missing formats. Limit this to big-endian > > platforms, as there is currently no need to support these formats on > > little-endian platforms. > > > > Fixes: 6960e6da9cec3f66 ("drm: fix drm_mode_addfb() on big endian machines.") > > Signed-off-by: Geert Uytterhoeven > > --- > > v2: > > - Use "DRM_FORMAT_foo | DRM_FORMAT_BIG_ENDIAN" instead of > > "DRM_FORMAT_HOST_foo", > > - Turn into a lone patch, as all other patches from series > > https://lore.kernel.org/r/cover.1657300532.git.geert@linux-m68k.org > > were applied to drm-misc/for-linux-next. > > --- a/drivers/gpu/drm/drm_fourcc.c > > +++ b/drivers/gpu/drm/drm_fourcc.c > > @@ -190,6 +190,10 @@ const struct drm_format_info *__drm_format_info(u32 format) > > { .format = DRM_FORMAT_BGRA5551, .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true }, > > { .format = DRM_FORMAT_RGB565, .depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 }, > > { .format = DRM_FORMAT_BGR565, .depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 }, > > +#ifdef __BIG_ENDIAN > > Why do we need the #ifdef here? Iirc some hw has big endian flags in the > scanout registers, so could supprt this unconditionally if there's no > #ifdef around the format defines. Some drivers might then also want a > DRM_FORMAT_FOO_BE define to simplify tables and stuff, but that's more a > bikeshed. "Limit this to big-endian platforms, as there is currently no need to support these formats on little-endian platforms." Will anyone make use of this? In theory, all of the 16-bpp formats can have a big-endian counterpart. I seem to be the first one running into this ;-) > > + { .format = DRM_FORMAT_XRGB1555 | DRM_FORMAT_BIG_ENDIAN, .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 }, > > + { .format = DRM_FORMAT_RGB565 | DRM_FORMAT_BIG_ENDIAN, .depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 }, > > +#endif > > { .format = DRM_FORMAT_RGB888, .depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 }, > > { .format = DRM_FORMAT_BGR888, .depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 }, > > { .format = DRM_FORMAT_XRGB8888, .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 }, Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds From mboxrd@z Thu Jan 1 00:00:00 1970 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 A62A2C43217 for ; Wed, 23 Nov 2022 17:05:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1EDD610E5BB; Wed, 23 Nov 2022 17:05:32 +0000 (UTC) Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3D5C210E5BB for ; Wed, 23 Nov 2022 17:05:27 +0000 (UTC) Received: by mail-qt1-f170.google.com with SMTP id l2so11596331qtq.11 for ; Wed, 23 Nov 2022 09:05:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ZaUOlJ3sjB7IWYce0/bjUUBOp0Vg9o09HXSbd2ZFOCw=; b=uADIdbBNIWvZTAndhpEkMhoEIiQbx20tmlpC3h6QnWa/ip82BrBdBsWEdI4URDP4iM iOGrxWROtlZ9+Snbei6/Mrt/z8gbb0uWWobFolc2MxSfWbsBj40w06rl6ZCFaqy5rruq qvw2/gW49Z5eMoE8AtC/PSi/HKwy/M2OoPn6VCfaoQ+LVLq7llykM1/gdoUyFoNy5V7t IDujq8FtQJwz/fmYyNAeIpxWhyfh7beQwZy2AI8HZtLSrZxeeGAG/LYoVbHrWSyTBtW7 fAYJvP4YyVp9xiwBdJdT2lweowpqtGaLbfWqGLAOsWgxDe+Xxx29LoeBM2hWaMWESO40 Dt5A== X-Gm-Message-State: ANoB5pm7a20t7jMFEzFCNEJs/HAAIzYabVtnZM7ybveUkhxCYdU45oTk 4CBg+eZaECpIQ06StoUpgegU5J0sV52hQg== X-Google-Smtp-Source: AA0mqf5OmvbWgfeZlGcr2mlVVaB2ytMj6uVC67WfqB3TmwYaLfwDCFaQwLwSFsc6hyPSHr5CWIXLNQ== X-Received: by 2002:a05:622a:1c11:b0:3a5:13b0:e040 with SMTP id bq17-20020a05622a1c1100b003a513b0e040mr9209512qtb.625.1669223126075; Wed, 23 Nov 2022 09:05:26 -0800 (PST) Received: from mail-yb1-f172.google.com (mail-yb1-f172.google.com. [209.85.219.172]) by smtp.gmail.com with ESMTPSA id r12-20020ac87eec000000b003a57eb7f212sm9942878qtc.10.2022.11.23.09.05.24 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Nov 2022 09:05:25 -0800 (PST) Received: by mail-yb1-f172.google.com with SMTP id k84so21581016ybk.3 for ; Wed, 23 Nov 2022 09:05:24 -0800 (PST) X-Received: by 2002:a25:9e84:0:b0:6de:6183:c5c3 with SMTP id p4-20020a259e84000000b006de6183c5c3mr9395618ybq.89.1669223124469; Wed, 23 Nov 2022 09:05:24 -0800 (PST) MIME-Version: 1.0 References: <3ee1f8144feb96c28742b22384189f1f83bcfc1a.1669221671.git.geert@linux-m68k.org> In-Reply-To: From: Geert Uytterhoeven Date: Wed, 23 Nov 2022 18:05:13 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH resend v2] drm/fourcc: Add missing big-endian XRGB1555 and RGB565 formats To: Daniel Vetter Content-Type: text/plain; charset="UTF-8" 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: , Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-m68k@lists.linux-m68k.org, Thomas Zimmermann , Gerd Hoffmann Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi Daniel, On Wed, Nov 23, 2022 at 5:57 PM Daniel Vetter wrote: > On Wed, Nov 23, 2022 at 05:43:10PM +0100, Geert Uytterhoeven wrote: > > As of commit eae06120f1974e1a ("drm: refuse ADDFB2 ioctl for broken > > bigendian drivers"), drivers must set the > > quirk_addfb_prefer_host_byte_order quirk to make the drm_mode_addfb() > > compat code work correctly on big-endian machines. > > > > While that works fine for big-endian XRGB8888 and ARGB8888, which are > > mapped to the existing little-endian BGRX8888 and BGRA8888 formats, it > > does not work for big-endian XRGB1555 and RGB565, as the latter are not > > listed in the format database. > > > > Fix this by adding the missing formats. Limit this to big-endian > > platforms, as there is currently no need to support these formats on > > little-endian platforms. > > > > Fixes: 6960e6da9cec3f66 ("drm: fix drm_mode_addfb() on big endian machines.") > > Signed-off-by: Geert Uytterhoeven > > --- > > v2: > > - Use "DRM_FORMAT_foo | DRM_FORMAT_BIG_ENDIAN" instead of > > "DRM_FORMAT_HOST_foo", > > - Turn into a lone patch, as all other patches from series > > https://lore.kernel.org/r/cover.1657300532.git.geert@linux-m68k.org > > were applied to drm-misc/for-linux-next. > > --- a/drivers/gpu/drm/drm_fourcc.c > > +++ b/drivers/gpu/drm/drm_fourcc.c > > @@ -190,6 +190,10 @@ const struct drm_format_info *__drm_format_info(u32 format) > > { .format = DRM_FORMAT_BGRA5551, .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true }, > > { .format = DRM_FORMAT_RGB565, .depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 }, > > { .format = DRM_FORMAT_BGR565, .depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 }, > > +#ifdef __BIG_ENDIAN > > Why do we need the #ifdef here? Iirc some hw has big endian flags in the > scanout registers, so could supprt this unconditionally if there's no > #ifdef around the format defines. Some drivers might then also want a > DRM_FORMAT_FOO_BE define to simplify tables and stuff, but that's more a > bikeshed. "Limit this to big-endian platforms, as there is currently no need to support these formats on little-endian platforms." Will anyone make use of this? In theory, all of the 16-bpp formats can have a big-endian counterpart. I seem to be the first one running into this ;-) > > + { .format = DRM_FORMAT_XRGB1555 | DRM_FORMAT_BIG_ENDIAN, .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 }, > > + { .format = DRM_FORMAT_RGB565 | DRM_FORMAT_BIG_ENDIAN, .depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 }, > > +#endif > > { .format = DRM_FORMAT_RGB888, .depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 }, > > { .format = DRM_FORMAT_BGR888, .depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 }, > > { .format = DRM_FORMAT_XRGB8888, .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 }, Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds