Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1044070pxm; Wed, 23 Feb 2022 16:42:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJz8VN2QOEk1ZzWZAut9D4YOPkfToRYLXoHBoSAnK7CTOKVGozfpCvjAUkAe6Kbnaf5cMBnt X-Received: by 2002:a63:27c7:0:b0:372:c656:20b2 with SMTP id n190-20020a6327c7000000b00372c65620b2mr286764pgn.545.1645663328069; Wed, 23 Feb 2022 16:42:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645663328; cv=none; d=google.com; s=arc-20160816; b=eGUZpVCl4eow9kBd8/ehW6gBhNileuLLgsBxWB28kBofMU1yBFbLhYFolAhph9Gs/d B+WjvXjBnoAc6fKwuqEDNQg6yZlBKYxAiO0Z3yPH5wlwOHxVwc2S4HJ6D2m7iCEm4Vdg TOPSwLcG2M8zg5rx1U3XWzHPRf/8Vgh4XbfH+nn6okgORX41Gtu73v3gHDbWgCmBw7+l fgD77z3JhZn9tlHxX4CS/le3RlxLQFToyjtUr0MGg0G/86hmfnmHXisoUu79ddSQo316 m0hRRUUc7rAwpMFr1YMErPN+e+ujKtX/OwQmNwqUGRcplTqrQYrDPlg9b3Uot6LitPQQ vtRg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=XthWtcx8CQQ6z/Lfovl9ePMxpx3VHx/bDsastA+Xo/Y=; b=Pbtwp0E54YQMqCJk/P8cP7+6df28qnRzL7TKKEKdQOYnlZYnOvcIWZlisXhvn5wE0+ HI2qWmUwmKBp5SfbbjYeK2jGGBqEwTEo9tfTegLVodi7be4usLgyEpStAP+c6eO90o/E 0FSTfgXSC02dq6zrO0wvXsENSFap89K1Cx+b9rsnzZXKT3in6A9HZ4m7xEW8+nH/e6jA wVXig7L+EybPuEeCc4zXgdpqMNEA4wHXpWFsDroYdWiCIsibbMgWopI2OeXpv0RiE7qv FrL7n2K8CFh59LBt0S0u07tNDbC4kF7s1kXQZmf5DBOPB6Cz2D0UURqz7qLUiVdzkpA5 XOmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Y22cedrx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q91-20020a17090a17e400b001bc299f7cf9si3469121pja.109.2022.02.23.16.42.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 16:42:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Y22cedrx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D08B2B23A7; Wed, 23 Feb 2022 16:39:26 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240343AbiBWMKm (ORCPT + 99 others); Wed, 23 Feb 2022 07:10:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240394AbiBWMKc (ORCPT ); Wed, 23 Feb 2022 07:10:32 -0500 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A17CF9D06E; Wed, 23 Feb 2022 04:09:25 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id i19so13604817wmq.5; Wed, 23 Feb 2022 04:09:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=XthWtcx8CQQ6z/Lfovl9ePMxpx3VHx/bDsastA+Xo/Y=; b=Y22cedrxeR+ywyVnUEBJ3MqpAQqnxuukkkbsAQRovrWabWEHabwzrgc17KdGiGOdno IcSfsG9xcKK/PzvfrAjNob+muSRsfRTssCmuqTuG2BcIK+G5n7awdRq11RmEftEXZvnh PCT24MiKvnplpPn91CXRNja1ceFgaPanB3ZtW3+5KplWtYVJtR2pm6BkopWOTggGr4MS fmfN8LKpVjtncGQs8v1RFqREMxuSg4hop2IeekPD+7BaebKmkEfRS3ZqoYIoUYHB2RRZ ffRba93CCry6mCGYojsiRTXVXoL7uzphXPQVl8sBZZSt8wYt/+IstT9JYggESauX2jFg BfpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=XthWtcx8CQQ6z/Lfovl9ePMxpx3VHx/bDsastA+Xo/Y=; b=vkHGYdX0zBerX6SHDNEoqiaQhRtveFr6uoYjvhCfSdWND6PTbnqmAHmywUcTj71N47 Rnj1/CShSnrIsgJoQ6h7lvfg00PxWCzSegokApgXocKvH+bscZ5ZqPnlbouqxzIKN6BN tzYZBY0fCIEQxjVULwCQxP4RuApBVHyeVKHcg7u78Rgb/PnaabSoXh+3wNhTqg24KUdk EnLheIzX2yYwe7V9Z84PpwmTWDw9Y4whR6jaNLQxsMW8wL7I0g+UiHcspxKhRgHBXbZi kLKhjKuUYz/2BsIT3bBqRW6eVTki2jpxy/Y+TmQSxCqu9UBQKZo/Jeiu4BCG7P7xw14J kDmQ== X-Gm-Message-State: AOAM533S5sVA8RY6I1Thza8ATyVT3v92Xfqu46NEm90hMCSLrL/KTeS0 B42gN14iY8w5wytjd0f9vRA= X-Received: by 2002:a05:600c:48a:b0:380:3f3a:e08e with SMTP id d10-20020a05600c048a00b003803f3ae08emr7160797wme.1.1645618164119; Wed, 23 Feb 2022 04:09:24 -0800 (PST) Received: from localhost (cpc154979-craw9-2-0-cust193.16-3.cable.virginm.net. [80.193.200.194]) by smtp.gmail.com with ESMTPSA id j10sm6733042wmq.20.2022.02.23.04.09.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 04:09:23 -0800 (PST) From: Colin Ian King To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][V2] drm/i915: make a handful of read-only arrays static const Date: Wed, 23 Feb 2022 12:09:23 +0000 Message-Id: <20220223120923.239867-1-colin.i.king@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 Don't populate the read-only arrays on the stack but instead make them static const and signed 8 bit ints. Also makes the object code a little smaller. Reformat the statements to clear up checkpatch warning. Signed-off-by: Colin Ian King --- V2: Make arrays signed 8 bit integers as requested by Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_vdsc.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_vdsc.c b/drivers/gpu/drm/i915/display/intel_vdsc.c index 3faea903b9ae..d49f66237ec3 100644 --- a/drivers/gpu/drm/i915/display/intel_vdsc.c +++ b/drivers/gpu/drm/i915/display/intel_vdsc.c @@ -378,10 +378,18 @@ calculate_rc_params(struct rc_parameters *rc, { int bpc = vdsc_cfg->bits_per_component; int bpp = vdsc_cfg->bits_per_pixel >> 4; - int ofs_und6[] = { 0, -2, -2, -4, -6, -6, -8, -8, -8, -10, -10, -12, -12, -12, -12 }; - int ofs_und8[] = { 2, 0, 0, -2, -4, -6, -8, -8, -8, -10, -10, -10, -12, -12, -12 }; - int ofs_und12[] = { 2, 0, 0, -2, -4, -6, -8, -8, -8, -10, -10, -10, -12, -12, -12 }; - int ofs_und15[] = { 10, 8, 6, 4, 2, 0, -2, -4, -6, -8, -10, -10, -12, -12, -12 }; + static const s8 ofs_und6[] = { + 0, -2, -2, -4, -6, -6, -8, -8, -8, -10, -10, -12, -12, -12, -12 + }; + static const s8 ofs_und8[] = { + 2, 0, 0, -2, -4, -6, -8, -8, -8, -10, -10, -10, -12, -12, -12 + }; + static const s8 ofs_und12[] = { + 2, 0, 0, -2, -4, -6, -8, -8, -8, -10, -10, -10, -12, -12, -12 + }; + static const s8 ofs_und15[] = { + 10, 8, 6, 4, 2, 0, -2, -4, -6, -8, -10, -10, -12, -12, -12 + }; int qp_bpc_modifier = (bpc - 8) * 2; u32 res, buf_i, bpp_i; -- 2.34.1