Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp771198imw; Fri, 8 Jul 2022 11:22:28 -0700 (PDT) X-Google-Smtp-Source: AGRyM1taEn0lVZ/8BAH9sxY1h0kBMtm6v2JSBn6TWhCzMdbEnKEWF1la34IEPWzWSr8qBxAfkJsi X-Received: by 2002:a17:902:ea0a:b0:168:d8ce:4a63 with SMTP id s10-20020a170902ea0a00b00168d8ce4a63mr4835887plg.57.1657304548042; Fri, 08 Jul 2022 11:22:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657304548; cv=none; d=google.com; s=arc-20160816; b=OoRGWSE09NzRmCA+ApH7pBh5mvSFOVrjuIFMMSsurytc0sC91suvi+GR3lMwUJCqKo YTdT/esnHGc935RIG0WjCiTjA7VW8iJvMp4rwTn6L6vUaVFJ3x1sKKS2otL8MLDSwcVF axFGj4bGRdgC5I54i2sz19vBZvMJpc9X23/L31PnXE11R0zq9ftOJbGC9xiyapoIcbMG VU4dKpq5Hoar4LZ/PPsrggiIkUYHNda5NulX1PG+cU/awMkQgHGXDX7BfFyfrDI11DJE qDcy6RPGMYkNW6EZnOubcS4ZtRhNziFYCoN59K0Q76wX56sRUESv7FRo4vlOzl5XXzYz BYxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=+eBoFeyo9CAiuhaozdpghi7TRUr3Mru1bQaqlsEfW/o=; b=qnk0ztJ8KueTi+yp188yJ4Zl3vRB20RjMLGWtW/SUFT8zyOegf7mql5dh5IFrRk7w3 snQBaPhM9ow6ky92fPda4yBZgR2ia0jgQy+SkO2bSVAgw0bQNU8AdPQI0O/j6M4FsSqm IXaDsE3J5yW3omNch6iUnUxTDlg6PXYpv1oVKo2bBPFj9ZilqUw8deit33txQlDGCeTf sHSt8CzA8Ezh5/PWPkTN80sLeBvEP2lF8Oz1DsDp4nuhnbMsuxCNMPKQrNQCxcB0aRaI mI5xuNE8JvT2JFP6FhG8XIvm7Ktiqs2quPdayufAvipI0DHMfLBsUAtfEDcEs6h6zmmh DKFA== 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 pj2-20020a17090b4f4200b001efce056397si1302062pjb.146.2022.07.08.11.22.15; Fri, 08 Jul 2022 11:22:28 -0700 (PDT) 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 S239192AbiGHSV1 (ORCPT + 99 others); Fri, 8 Jul 2022 14:21:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238972AbiGHSVO (ORCPT ); Fri, 8 Jul 2022 14:21:14 -0400 Received: from albert.telenet-ops.be (albert.telenet-ops.be [IPv6:2a02:1800:110:4::f00:1a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDFAF82385 for ; Fri, 8 Jul 2022 11:21:10 -0700 (PDT) Received: from ramsan.of.borg ([84.195.186.194]) by albert.telenet-ops.be with bizsmtp id siM7270084C55Sk06iM7Vz; Fri, 08 Jul 2022 20:21:08 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1o9sbC-002fGd-Lc; Fri, 08 Jul 2022 20:21:06 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1o9sbC-00BtJG-9J; Fri, 08 Jul 2022 20:21:06 +0200 From: Geert Uytterhoeven To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven , Javier Martinez Canillas Subject: [PATCH v3 02/10] drm/fourcc: Add drm_format_info.is_color_indexed flag Date: Fri, 8 Jul 2022 20:20:47 +0200 Message-Id: <90cd390b2b4d481661f966de7b504f1702d80dfd.1657294931.git.geert@linux-m68k.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Add a flag to struct drm_format_info to indicate if a format is color-indexed, similar to the existing .is_yuv flag. This way generic code and drivers can just check this flag, instead of checking against a list of fourcc formats. Signed-off-by: Geert Uytterhoeven Reviewed-by: Javier Martinez Canillas --- v3: - Add Reviewed-by, v2: - New. --- drivers/gpu/drm/drm_fourcc.c | 2 +- include/drm/drm_fourcc.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c index cf48ea0b2cb70ba8..6c76bd821d17e7c7 100644 --- a/drivers/gpu/drm/drm_fourcc.c +++ b/drivers/gpu/drm/drm_fourcc.c @@ -132,7 +132,7 @@ EXPORT_SYMBOL(drm_driver_legacy_fb_format); const struct drm_format_info *__drm_format_info(u32 format) { static const struct drm_format_info formats[] = { - { .format = DRM_FORMAT_C8, .depth = 8, .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 }, + { .format = DRM_FORMAT_C8, .depth = 8, .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1, .is_color_indexed = true }, { .format = DRM_FORMAT_R8, .depth = 8, .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 }, { .format = DRM_FORMAT_R10, .depth = 10, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 }, { .format = DRM_FORMAT_R12, .depth = 12, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 }, diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h index 3800a7ad7f0cda7a..532ae78ca747e6c4 100644 --- a/include/drm/drm_fourcc.h +++ b/include/drm/drm_fourcc.h @@ -138,6 +138,9 @@ struct drm_format_info { /** @is_yuv: Is it a YUV format? */ bool is_yuv; + + /** @is_color_indexed: Is it a color-indexed format? */ + bool is_color_indexed; }; /** -- 2.25.1