Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8533190rwb; Thu, 24 Nov 2022 00:24:06 -0800 (PST) X-Google-Smtp-Source: AA0mqf70X38j2fgH9lDx1RYxp3M7IO1d96UjhSgyHkGSFndDZqNJgMQuzpNHWrXz9/HohoR85AqH X-Received: by 2002:a17:90a:fc84:b0:217:ff37:2fe9 with SMTP id ci4-20020a17090afc8400b00217ff372fe9mr40721974pjb.242.1669278245904; Thu, 24 Nov 2022 00:24:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669278245; cv=none; d=google.com; s=arc-20160816; b=bKnYRatP0jaGMUjh0YaVEM22V42Rw5yMqOy8rE8Tvp49Is/W6k6MzeGGGUtdl1AXrZ ALgA2ZW5f+nZjgp/A9qNdrQUo5yKnoLrjPJdRtlASxDfg2cA8nGUB5sQ5QzEDKiKhJ+F 3kRbW2S1EEh1FAyneLMIuLcjsLX8i62I2jL+m/+Ob9M7HQa+GLMMqqoC/kIYlbR98VwJ 9cFpW3uWhmZfIw9BoRzzEgkIfr6eIsz8zAJi0YUZ5k9PoZfzKjukQFA6R2N+hebfnJG1 eQteXZWsMSn0VMSu6lFgaQz54lCclz64EWm3OVYRrZduJVd1+2ESsoT9U0YS0TYHdC0T QUXg== 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=NxhodYFDmdQqVB4ltzcytu+P4hXGUv/V9/mCUnkpmmg=; b=Qb75OvzCS3JfTdjW2UNcCQp2YnWZBWTHbPL8KNgbTely0RaoNWMgSgnu5fL+20EaDh A3QTmipew3n6sNn8rjLT0n1iU7HHrg225fiW27ABg5UfxHH2M9MCOKEHsjKebWKsisaY tHH6tOxu7lvpMpkznI9E/usFE/5qHKIE0/XRqowwbQ0VSv9EeqW1U2VCSI4ae8BsAtrH nevar/NUbwVynm1S2X8BOPe0JGRhQ+FTBwuVhHmoMUE1QWsHE9FbIp4eT2CFG2YOKf6E 4x6qhAggjPEKgcUfBzEPKFJYTKHrZUDkJEw6185odrA+8heSwDo8jFmE7Wp2nGcShlXn sk/A== ARC-Authentication-Results: i=1; mx.google.com; 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 c16-20020a170903235000b001893d5da3cdsi560296plh.331.2022.11.24.00.23.55; Thu, 24 Nov 2022 00:24:05 -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; 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 S229686AbiKXIDP (ORCPT + 87 others); Thu, 24 Nov 2022 03:03:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229463AbiKXIDN (ORCPT ); Thu, 24 Nov 2022 03:03:13 -0500 Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7307088F85; Thu, 24 Nov 2022 00:03:07 -0800 (PST) Received: by mail-qk1-f181.google.com with SMTP id x18so573904qki.4; Thu, 24 Nov 2022 00:03:07 -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=NxhodYFDmdQqVB4ltzcytu+P4hXGUv/V9/mCUnkpmmg=; b=TjQExKhIg+vBdXYkhLv4WSk8cKOUj0L6okTupVgp3IkDeqkqTxbAUMEd0mjbGEKszS mNSeNrMoSd1qDuiudOFyIfB3p+CpIYUmc9fC0t7mI3BN4b0KzaY0x9Z/X3bvQ1anYO5F cSdwnmA5EmJCKVbMcwpCeoEzLyvU7tBJkDZDyBul6vc5SFaK4//X/TUsrTS/vkvewzrT /lj1Fa4mW0abRE7BJk/PUCTzbcgff9SunnFM2Jh5IadCaSHOJjvrraQ5STIEh4kSUVcl Po8YiKX4oQUmR2+m+tsUGzbu63t4vCkfwz8g0j7po+sclam6sHj8SEDK01ng/UTGJOzO habA== X-Gm-Message-State: ANoB5pkL/IJTMgtChoKWEfrV0tB3DeIgcQBvP5+G/jdKek9pA1G/N3Nf vfRxkPG8DF+6GUliwmWhiribdu74dig73g== X-Received: by 2002:a37:b986:0:b0:6fa:3244:cf6e with SMTP id j128-20020a37b986000000b006fa3244cf6emr11425612qkf.656.1669276986320; Thu, 24 Nov 2022 00:03:06 -0800 (PST) Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com. [209.85.128.180]) by smtp.gmail.com with ESMTPSA id i13-20020a05620a248d00b006fbdeecad51sm474190qkn.48.2022.11.24.00.03.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Nov 2022 00:03:05 -0800 (PST) Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-3b56782b3f6so8002357b3.13; Thu, 24 Nov 2022 00:03:05 -0800 (PST) X-Received: by 2002:a81:f80f:0:b0:38e:e541:d8ca with SMTP id z15-20020a81f80f000000b0038ee541d8camr29389264ywm.283.1669276985156; Thu, 24 Nov 2022 00:03:05 -0800 (PST) MIME-Version: 1.0 References: <3ee1f8144feb96c28742b22384189f1f83bcfc1a.1669221671.git.geert@linux-m68k.org> <20221124065148.7v4m3qli2k74mic6@sirius.home.kraxel.org> In-Reply-To: <20221124065148.7v4m3qli2k74mic6@sirius.home.kraxel.org> From: Geert Uytterhoeven Date: Thu, 24 Nov 2022 09:02:53 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH resend v2] drm/fourcc: Add missing big-endian XRGB1555 and RGB565 formats To: Gerd Hoffmann Cc: Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , 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=-1.5 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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 Hi Gerd, On Thu, Nov 24, 2022 at 8:29 AM Gerd Hoffmann wrote: > > > > +#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. > > Highly unlikely. Dealing with 16-bpp formats in non-native byte order > is a PITA because it isn't enough to simply adjust the masks and shifts > to pick the correct bits and be done with it. > > The qemu stdvga happens to have a register to switch framebuffer > byteorder (so both x64 and ppc are happy), and the bochs drm driver > actually supports that no matter what the cpu byte order is, but it > supports only DRM_FORMAT_XRGB8888 + DRM_FORMAT_BGRX8888. > > Supporting 16 bpp in the driver wouldn't be that much of a problem, but > processing the framebuffer on the host side when emulating a big endian > guest on a little endian host is painful. I think I can't ask pixman to > do a conversation from DRM_FORMAT_RGB565 | DRM_FORMAT_BIG_ENDIAN to > DRM_FORMAT_XRGB8888 on a little endian machine. Indeed. But you can do a quick 16-bit byteswap, and convert from DRM_FORMAT_RGB565 to DRM_FORMAT_XRGB8888? There's a similar issue with Cairo, cfr. '[PATCH libdrm v2 08/10] util: Fix pwetty on big-endian"[1]. BTW, does pixman support converting DRM_FORMAT_RGB565 to DRM_FORMAT_XRGB8888 on a big-endian machine? [1] https://lore.kernel.org/all/e8597038478f12e9eda5e86b309b52988f69f2eb.1657302103.git.geert@linux-m68k.org 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