Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7678521rwb; Wed, 23 Nov 2022 09:20:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf4vQZCACyrDoj3WRhfIp3EZkThwvXpZqV2Xm8ySnd0BCYm/GR37fahz02aWa1XYtiRpyKgA X-Received: by 2002:a17:90b:2541:b0:213:30c4:e803 with SMTP id nw1-20020a17090b254100b0021330c4e803mr36657844pjb.209.1669224038739; Wed, 23 Nov 2022 09:20:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669224038; cv=none; d=google.com; s=arc-20160816; b=MKDexsZ1Ed5WXiaxsEEMpRFoMAfMFVKHIql1N+fiktb01L05NaiI8/gHLl7Rw8x5UK KLGrh3d5Ju8tZfIbolXksRj7aRxBikXyveODe20ayBp7gKkQtv610Z0hxcCb7ehaUlQT oHuDjQezAxRZEVEqv4cnSILsfZesykuF1G2Nq6mOoR9yFI/hVEG3LD+/FZnZZVSxe+Cp 2YjkpgKubvhU6gxQKqmBbBdP08Xc4Lc0xkFau9lqM1nRFHMGoMIjjwAyGgxB1IhRk/2k tBHIezQqwA1G8UWVXLFP3I3TebMsxSn7eOkOYiNl8pkAiRVZOgzwPnS7D7OGT+k1qXE7 m2yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Ao3E5mmZY2BE7Mq2QSnVGZzueBJmpG2ELG9Gjslte28=; b=O8zJfZyVopvh3+jg11Br+FVzhsKzHMCrGYbOXrBwfjDwrACgeKjQK1O3eVk6klJrpR ANKmaMdyOAmjSAHhECkEkawfuvuJkHqndBP1JrvcGohmiPONJbCYppFaetIOTTEGscoY k1lFENwu/j3NAHGo/WtqrYmdUtuVVHmWfMl3Li7pJKWUbGtujv3TpSVAE+kOzndVUye6 HgKdTlSOsLcIEOyVL2GfJN8nZyXvCWNgpOfmqViFu+bCeLTJxIRkOVfrjn3qOeZoXxGa P7RPQoJF72qEZeURxeuO0GNwT+cC5O1lsIgDYOmd+wDUnxUpFyaEzre0HAz6Y475eab7 CuUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=kZshbUkm; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f7-20020a056a00238700b0056e69d7f44asi18390210pfc.113.2022.11.23.09.20.26; Wed, 23 Nov 2022 09:20:38 -0800 (PST) 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=@ffwll.ch header.s=google header.b=kZshbUkm; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239150AbiKWRJ5 (ORCPT + 88 others); Wed, 23 Nov 2022 12:09:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238974AbiKWRJb (ORCPT ); Wed, 23 Nov 2022 12:09:31 -0500 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F00623A3 for ; Wed, 23 Nov 2022 09:09:29 -0800 (PST) Received: by mail-ej1-x62e.google.com with SMTP id i10so44162854ejg.6 for ; Wed, 23 Nov 2022 09:09:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Ao3E5mmZY2BE7Mq2QSnVGZzueBJmpG2ELG9Gjslte28=; b=kZshbUkmC1/2mIzv9SvCF2T8ZZGOYUBqkEiM4sX+iZt1o46GZhcQM9OYq6XElW0g5z kEyDrdr3Dz+DyrJayxX0Vmj3ks7rydZNR/b7QwoOwcPfgFutFPxhjtB+AkYMEVWFKa+y elcIJ46P2bUfy3ZmXouwAkiExxrp9P/DEkYT8= 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=Ao3E5mmZY2BE7Mq2QSnVGZzueBJmpG2ELG9Gjslte28=; b=Nu7CyFQaSn22W/vWjlEbpbySHcbKzXUdfOPb17C3TJRcmjb17PW8FLwcF7JutC/nAV vX18K2n0MXDq9YfOfEL06AmOMw7jwDAJF/UPsPKzQNSzp/dfYv5JGXMSguV37fdzRPyo IaUaBT9P46YmqywuTchiYLxOoSLDI2qsCL9+USwDwkhqfJsO9+0S3Yw6RnmKXeWjzvWF ahrmGf7szsgudLmklrEyOsQfxjsbj0ezgZZI6CXrYFI2C0pgrN6x+R3ps+J0Tj8ZJMMJ 1hXtyzVqG0DFy9VMPPKwnqGfDr3u9fqC5NbwJV1NHZgWZKQLoaCPhazdL8aRFZ6Bb37R 57eQ== X-Gm-Message-State: ANoB5pm4vYntayvyREOPJSN8pO6Yg7TtOyMbzObpg96CrWPS42eqXtnx W8trVw1rnZWZNQlZkHiOhSdeKCGvAR2D51RM5tCJCA== X-Received: by 2002:a17:906:d7b8:b0:79f:9ff6:6576 with SMTP id pk24-20020a170906d7b800b0079f9ff66576mr23542543ejb.414.1669223368277; Wed, 23 Nov 2022 09:09:28 -0800 (PST) MIME-Version: 1.0 References: <3ee1f8144feb96c28742b22384189f1f83bcfc1a.1669221671.git.geert@linux-m68k.org> In-Reply-To: From: Daniel Vetter Date: Wed, 23 Nov 2022 18:09:16 +0100 Message-ID: Subject: Re: [PATCH resend v2] drm/fourcc: Add missing big-endian XRGB1555 and RGB565 formats To: Geert Uytterhoeven 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" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 Wed, 23 Nov 2022 at 18:05, Geert Uytterhoeven wrote: > > 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 ;-) It should make testing easier, at least for drivers that can be used on both be and le platforms. But also, we can fix that whenever someone actually asks for it, same that we can add the #define since the full flag version is a bit long. I'll apply the patch to drm-misc-next. -Daniel > > > > + { .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 -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch