Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp952101pxp; Wed, 16 Mar 2022 22:26:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHjZh2XVisaB1rgSd+bMQWvmMD2m1GThk/VtBoK6yVJOZfPHrYP3LKkcwvxU0fgMZlpo5B X-Received: by 2002:a63:4f43:0:b0:378:8ec6:7936 with SMTP id p3-20020a634f43000000b003788ec67936mr2269183pgl.329.1647494794792; Wed, 16 Mar 2022 22:26:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647494794; cv=none; d=google.com; s=arc-20160816; b=qmggKxik9P+WUUDfpMT51SIxlrsi/7EXjiXGifu61LXaPrJqCYbrASF8vHaloNR8qF wheuSiUNcN7FDcJ0tUIe+7VDFsyrrkCadpJynt8EaeMgDA15I6JubdkiVNnkEAlvWY2H RZX1Rbza8+FAE9I/xFxRJJzspFuNwEJbNbWM0BxLBi+lAx1MCGAyc6kFgxEzdCqH2Ktn C9AWyngqklj9FpIVn2e6+WAge5Mo0EZfBkrdznriG/wShHX8MBEQGVqzUy15VfNjVX/r j62VLDJThaXP6DkIpOuLrqxO2bnrA0jXxXJCHNQ2zhmslPdXGRbTusprIIyFjlgkr0jA hSbg== 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; bh=7ESmoGYKvForOfgnFNNl3bul8J0TvzMfyrdSY3ncE6E=; b=yfhB622/jSfmjIslrTu/yjG0ZiI5zckNj36D7b67p3ElvXhLFveF7pmBX0Tr/H82GY UK5/CZNNA5qmiBngWAdePlWLj6ZSt+GvCpX23QJKXvAKu360fsXBgluVa+P733OeAhA8 VALq6QBTN+wcHPPeum8r7C/Jy7be/RDvTWbJMMTnalAutUKmoIZf6SMYfdGrpwunidg7 JrOfIRbiS7X7oV8Ey7/tNHmynMeESZjocTJKFHcrfLWFqNqcqsYaEG3jJMGf67+U69NT zIaq9khjLcuDPdzVdZBdyb5f0wkRLXkOrQKkC31ZnyvXe92l0yeETiBOgfKFlL2AALb1 YIDQ== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id w10-20020a170902d10a00b00153b31fd7b7si3236603plw.526.2022.03.16.22.26.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 22:26:34 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CE36B23D773; Wed, 16 Mar 2022 21:34:15 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233207AbiCNNbo (ORCPT + 99 others); Mon, 14 Mar 2022 09:31:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233166AbiCNNbn (ORCPT ); Mon, 14 Mar 2022 09:31:43 -0400 Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77B7A13D73; Mon, 14 Mar 2022 06:30:32 -0700 (PDT) Received: by mail-qk1-f176.google.com with SMTP id q4so12660482qki.11; Mon, 14 Mar 2022 06:30:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7ESmoGYKvForOfgnFNNl3bul8J0TvzMfyrdSY3ncE6E=; b=uO+Um3ZMkaOLd27w4397t+Fkci9z8p3BGpG5jW0zNEyNevdQQ3tfMYRQx9pNG+RhSO QAsxZlkwXCeoTcUeUAe1swxy98G/HDfoZh//jGFz/JX6ZKfggiHzqsgI+1hKpkYMkCLA Xq1e6uM7YUAZmXhnNKlGjDNL+YA4lkbjb05Rb4WQ+9jzlcWCsd7NdS5v+Yovyyq+B6Xt HauZd5YXzbkC71oZgaILvTVBcKFwPBMBzjYNbXUuvK4uP/8H+VVg4nMW9Y/R9aeqq3o0 wjayk+HwknTMqAXIUBrL3IFro1AQ69neLCqIjCTYulhrVSLFgMyMk2CNKgUWwxUTlhEO vUpw== X-Gm-Message-State: AOAM530oWWKWLE09SRWpWTbka181do3MQbbMp7Uj40CiL+jDxlcKW9b/ XefFAtyX4Fne666Zy+onTgYoCxKduszn7w== X-Received: by 2002:a05:620a:4085:b0:67b:315b:a09f with SMTP id f5-20020a05620a408500b0067b315ba09fmr14881685qko.334.1647264631247; Mon, 14 Mar 2022 06:30:31 -0700 (PDT) Received: from mail-yw1-f175.google.com (mail-yw1-f175.google.com. [209.85.128.175]) by smtp.gmail.com with ESMTPSA id h8-20020ac87d48000000b002e1c6faae9csm5564977qtb.28.2022.03.14.06.30.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Mar 2022 06:30:30 -0700 (PDT) Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-2db2add4516so163661667b3.1; Mon, 14 Mar 2022 06:30:30 -0700 (PDT) X-Received: by 2002:a0d:f1c7:0:b0:2db:d2bc:be11 with SMTP id a190-20020a0df1c7000000b002dbd2bcbe11mr18928111ywf.62.1647264630398; Mon, 14 Mar 2022 06:30:30 -0700 (PDT) MIME-Version: 1.0 References: <8d3c0cc370b0214244b01a64c588e5e506531716.1646683502.git.geert@linux-m68k.org> In-Reply-To: <8d3c0cc370b0214244b01a64c588e5e506531716.1646683502.git.geert@linux-m68k.org> From: Geert Uytterhoeven Date: Mon, 14 Mar 2022 14:30:18 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 05/10] drm/fourcc: Add DRM_FORMAT_C[124] To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Javier Martinez Canillas , Sam Ravnborg , Helge Deller Cc: DRI Development , Linux Fbdev development list , "Linux/m68k" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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, Mar 7, 2022 at 9:53 PM Geert Uytterhoeven wrote: > Introduce fourcc codes for color-indexed frame buffer formats with two, > four, and sixteen colors, and provide a mapping from bit per pixel and > depth to fourcc codes. > > As the number of bits per pixel is less than eight, these rely on proper > block handling for the calculation of bits per pixel and pitch. > > Signed-off-by: Geert Uytterhoeven > --- a/include/uapi/drm/drm_fourcc.h > +++ b/include/uapi/drm/drm_fourcc.h > @@ -99,7 +99,10 @@ extern "C" { > #define DRM_FORMAT_INVALID 0 > > /* color index */ > -#define DRM_FORMAT_C8 fourcc_code('C', '8', ' ', ' ') /* [7:0] C */ > +#define DRM_FORMAT_C1 fourcc_code('C', '1', ' ', ' ') /* [7:0] C0:C1:C2:C3:C4:C5:C6:C7 1:1:1:1:1:1:1:1 eight pixels/byte */ > +#define DRM_FORMAT_C2 fourcc_code('C', '2', ' ', ' ') /* [7:0] C0:C1:C2:C3 2:2:2:2 four pixels/byte */ > +#define DRM_FORMAT_C4 fourcc_code('C', '4', ' ', ' ') /* [7:0] C0:C1 4:4 two pixels/byte */ > +#define DRM_FORMAT_C8 fourcc_code('C', '8', ' ', ' ') /* [7:0] C 8 one pixel/byte */ > > /* 8 bpp Red */ > #define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ') /* [7:0] R */ After replying to Ilia's comment[1], I realized the CFB drawing operations use native byte and bit ordering, unless FBINFO_FOREIGN_ENDIAN is set. While Amiga, Atari, and Sun-3 use big-endian bit ordering, e.g. Acorn VIDC[2] uses little endian, and SH7760[3] is configurable (sh7760fb configures ordering to match host order). BTW, ssd130{7fb,x}_update_rect() both assume little-endian, so I guess they are broken on big-endian. Fbtest uses big-endian bit ordering, so < 8 bpp is probably broken on little-endian. Hence the above should become: #define DRM_FORMAT_C1 fourcc_code('C', '1', ' ', ' ') /* [7:0] C7:C6:C5:C4:C3:C2:C1:C0 1:1:1:1:1:1:1:1 eight pixels/byte */ #define DRM_FORMAT_C2 fourcc_code('C', '2', ' ', ' ') /* [7:0] C3:C2:C1:C0 2:2:2:2 four pixels/byte */ #define DRM_FORMAT_C4 fourcc_code('C', '4', ' ', ' ') /* [7:0] C1:C0 4:4 two pixels/byte */ The same changes should be made for DRM_FORMAT_[RD][124]. The fbdev emulation code should gain support for these with and without DRM_FORMAT_BIG_ENDIAN, the latter perhaps only on big-endian platforms? [1] https://lore.kernel.org/r/CAKb7UvgEdm9U=+RyRwL0TGRfA_Qc7NbhCWoZOft2DKdXggtKYw@mail.gmail.com/ [2] See p.30 of the VIDC datasheet http://chrisacorns.computinghistory.org.uk/docs/Acorn/Misc/Acorn_VIDC_Datasheet.pdf [3] See p.1178 of the SH7660 datasheet https://datasheet.octopart.com/HD6417760BL200AV-Renesas-datasheet-14105759.pdf 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