From patchwork Fri Jan 7 05:29:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 12706283 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8F415C433EF for ; Fri, 7 Jan 2022 05:33:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RAbNsFKU9VAGh8PY0ZKtAtboVr5/RG42dEXUvw0Z0G0=; b=CcS7Sn9uS3cjLD lowV2ujZ+FyW6FiytIp0R3tyLmh+fVrqfJtSuhkjm6vuFgd6EYqsNdKEl4/8seGmETe5JI9NKKD90 nYc9oRXndryLtvfpeOjDd4SYm1W0jiaLZSrmGGhdGaFF5PvPLW/z7pdmTctH7ea6hts6HWrhK80eF Ar8EZ2k8xG174Emu9DZ+4ubAcfPcBX2EdiIKoK7vj0I6qk+B3liFhpNWzI9yV1RTH5BXXqS4WZH3q FYL/pNSC8DnXb8OiWS5i0cuX9X5CGlrilt0QYUHsemotPQJYBXUor5SCxyTL3QnIbVLlNsMFYI9JL yJHY5vOEfGuniVeS7G6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5hr5-002OU8-VK; Fri, 07 Jan 2022 05:32:00 +0000 Received: from mail-il1-x136.google.com ([2607:f8b0:4864:20::136]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5hp9-002NK5-4O for linux-arm-kernel@lists.infradead.org; Fri, 07 Jan 2022 05:30:00 +0000 Received: by mail-il1-x136.google.com with SMTP id d3so3774464ilr.10 for ; Thu, 06 Jan 2022 21:29:59 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=KuUpo8N7O6zfCcQlim8LLc328KIOMpVIHmOBAPahhn4=; b=bJ/n5Q/dPqC+YFPh92aeruYamwdqsuJZrluEKsrTDhwqmu8Fb4JTaPyRt5ppFFUgkJ +naYVaSeN+LIgNQsfRVtctMtWqzkwjq2WzzFqJ2qE/B91Y6WH3a1gVw7PtofKY+9/jKk HpuSX9xGFF3YYHcYpHzZkkXHQ8i6RFqifCkt6raVeU7hilf1KPsiARZKkm2pjgnt+fzg DtS6h+lnsUno5cNenvFVUBSx745HI3tL0Bbfg2E9KMDsfcvIYLSA4tiaIHUKZzW5Ciw9 yZH5W9pJ5bVQtZERKqmG6p9llU0RE8hgM4ymHzrKsH5TmcEfxPwjM940iF8HakEwvs60 amXQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=KuUpo8N7O6zfCcQlim8LLc328KIOMpVIHmOBAPahhn4=; b=CHw41Xf/4bynYjTeBJuwt3OdqlBOtt/CoDAwyekqJKki5zgXs1sJ1oU5hoxsk6dLkm jHn+MMZsaZOJ33lVasLXORT9/eFJwSGNCqKivEYX93xAP81J3SKsYmtmlsAW7mzGgpja 8TKS+RIQqidritxs5JQ8Nf7RoXfbP+lBZxR9dE+7ZqYpn5FadIvpuPWDdqCAKzQi/ABZ x1Ve6q0FROFkrAY4DFgHOX1/BnV8ctCeYn4vbIsWGTdIEvOlcXRJl31iL1Rhzv7XbWVt cBksRpXDrhkaQLQWspU6w1h0ph/P3YvFTwMFaYpqDU+xNQI6mUcY8CyI7XJ9zdOj+J+y F75g== X-Gm-Message-State: AOAM531VuimlLAJpmvMVlOzJ0vm58CTEMQXmyOkqAnVu0T3LcEmTZ2pI bTJ3I4WMqiNuQgXPgkz5D30= X-Google-Smtp-Source: ABdhPJy2rvSWBjxrv0s0L+Dd40rEcbOGWkDTDS7wEKky+oaA8kMgIOWAJ3OBBEACDrV+n0KZGzNJKA== X-Received: by 2002:a05:6e02:20c9:: with SMTP id 9mr29967785ilq.108.1641533398507; Thu, 06 Jan 2022 21:29:58 -0800 (PST) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id c18sm1843446iod.18.2022.01.06.21.29.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 21:29:58 -0800 (PST) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux@rasmusvillemoes.dk, rostedt@goodmis.org, mathieu.desnoyers@efficios.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v11 07/19] drm_print: condense enum drm_debug_category Date: Thu, 6 Jan 2022 22:29:30 -0700 Message-Id: <20220107052942.1349447-8-jim.cromie@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220107052942.1349447-1-jim.cromie@gmail.com> References: <20220107052942.1349447-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220106_212959_242449_74872F51 X-CRM114-Status: GOOD ( 13.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org enum drm_debug_category has 10 hardcoded values, which could be "simplified" as sequential BIT(x)s. But lets take it one step further, removing the explicit initializations (other than starting at 1), and move the BIT() operation into drm_debug_enabled(). This gives us a more compact representation (4 bits), without loss of info; all DRM.debug api calls pass an enum parameter (and not a bit-OR of them), and the bitmask-iness of the enum's values is merely a micro-optimization to avoid doing BIT(category) at runtime. I doubt the extra bit-shift would be measurable here. And the 4-bit representation means it fits into struct _ddebug.class_id (commit:HEAD~1), setting up for further integration. The enum starts at 1, which respects the "reservation" of 0 as a special case; it is a non-category, and shouldn't get treated like one. Signed-off-by: Jim Cromie --- include/drm/drm_print.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 22fabdeed297..b4355bfd7888 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -279,49 +279,49 @@ enum drm_debug_category { * @DRM_UT_CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, * drm_memory.c, ... */ - DRM_UT_CORE = 0x01, + DRM_UT_CORE = 1, /** * @DRM_UT_DRIVER: Used in the vendor specific part of the driver: i915, * radeon, ... macro. */ - DRM_UT_DRIVER = 0x02, + DRM_UT_DRIVER, /** * @DRM_UT_KMS: Used in the modesetting code. */ - DRM_UT_KMS = 0x04, + DRM_UT_KMS, /** * @DRM_UT_PRIME: Used in the prime code. */ - DRM_UT_PRIME = 0x08, + DRM_UT_PRIME, /** * @DRM_UT_ATOMIC: Used in the atomic code. */ - DRM_UT_ATOMIC = 0x10, + DRM_UT_ATOMIC, /** * @DRM_UT_VBL: Used for verbose debug message in the vblank code. */ - DRM_UT_VBL = 0x20, + DRM_UT_VBL, /** * @DRM_UT_STATE: Used for verbose atomic state debugging. */ - DRM_UT_STATE = 0x40, + DRM_UT_STATE, /** * @DRM_UT_LEASE: Used in the lease code. */ - DRM_UT_LEASE = 0x80, + DRM_UT_LEASE, /** * @DRM_UT_DP: Used in the DP code. */ - DRM_UT_DP = 0x100, + DRM_UT_DP, /** * @DRM_UT_DRMRES: Used in the drm managed resources code. */ - DRM_UT_DRMRES = 0x200, + DRM_UT_DRMRES }; static inline bool drm_debug_enabled(enum drm_debug_category category) { - return unlikely(__drm_debug & category); + return unlikely(__drm_debug & BIT(category)); } /*