Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3000866AbdDZN5w convert rfc822-to-8bit (ORCPT ); Wed, 26 Apr 2017 09:57:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46786 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S3000848AbdDZN5p (ORCPT ); Wed, 26 Apr 2017 09:57:45 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AB91180F6D Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kraxel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com AB91180F6D Message-ID: <1493215062.23739.34.camel@redhat.com> Subject: Re: [PATCH 3/6] drm: fourcc byteorder: add bigendian support to drm_mode_legacy_fb_format From: Gerd Hoffmann To: Eric Engestrom Cc: Michel =?ISO-8859-1?Q?D=E4nzer?= , Daniel Vetter , amd-gfx@lists.freedesktop.org, open list , dri-devel@lists.freedesktop.org Date: Wed, 26 Apr 2017 15:57:42 +0200 In-Reply-To: <20170426132801.lldz7uwwlp3euozy@imgtec.com> References: <20170424062532.26722-1-kraxel@redhat.com> <20170424062532.26722-4-kraxel@redhat.com> <3b872a56-80b5-0c44-712f-a9517489eb24@daenzer.net> <1493185990.23739.7.camel@redhat.com> <20170426132801.lldz7uwwlp3euozy@imgtec.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Mime-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 26 Apr 2017 13:57:45 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 585 Lines: 24 > uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth) > { > uint32_t fmt; > #ifdef __BIG_ENDIAN > enum { LITTLE_ENDIAN = 0 }; > #else > enum { LITTLE_ENDIAN = 1 }; > #endif > /* ... */ > > (using an enum for compile-time constness) > > and then > fmt = DRM_FORMAT_ARGB8888; > becomes > fmt = LITTLE_ENDIAN ? DRM_FORMAT_ARGB8888 : DRM_FORMAT_BGRA8888; > > Might be easier to read than duplicating the whole switch? Well, there are more differences, like rgb565 and xrgb2101010 not being supported for bigendian, so it isn't *that* simple. cheers, Gerd