* [PATCH] drm/v3d: Fix compile with CONFIG_WERROR
@ 2024-06-04 2:40 Ashutosh Dixit
2024-06-04 7:30 ` Jani Nikula
0 siblings, 1 reply; 2+ messages in thread
From: Ashutosh Dixit @ 2024-06-04 2:40 UTC (permalink / raw)
To: dri-devel; +Cc: mcanal
Fix compile with CONFIG_WERROR by explicitly computing the max number of
7.1 and 4.2 counters.
In file included from ../drivers/gpu/drm/v3d/v3d_drv.h:14,
from ../drivers/gpu/drm/v3d/v3d_bo.c:26:
../drivers/gpu/drm/v3d/v3d_performance_counters.h:118:43: \
error: ‘v3d_v42_performance_counters’ defined but not used \
[-Werror=unused-const-variable=]
Fixes: 3cbcbe016c31 ("drm/v3d: Add Performance Counters descriptions for V3D 4.2 and 7.1")
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
---
drivers/gpu/drm/v3d/v3d_drv.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/v3d/v3d_drv.h b/drivers/gpu/drm/v3d/v3d_drv.h
index 556cbb400ba0..93dccb5f4c23 100644
--- a/drivers/gpu/drm/v3d/v3d_drv.h
+++ b/drivers/gpu/drm/v3d/v3d_drv.h
@@ -352,7 +352,9 @@ struct v3d_timestamp_query {
};
/* Maximum number of performance counters supported by any version of V3D */
-#define V3D_MAX_COUNTERS ARRAY_SIZE(v3d_v71_performance_counters)
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#define V3D_MAX_COUNTERS MAX(ARRAY_SIZE(v3d_v71_performance_counters), \
+ ARRAY_SIZE(v3d_v42_performance_counters))
/* Number of perfmons required to handle all supported performance counters */
#define V3D_MAX_PERFMONS DIV_ROUND_UP(V3D_MAX_COUNTERS, \
--
2.41.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] drm/v3d: Fix compile with CONFIG_WERROR
2024-06-04 2:40 [PATCH] drm/v3d: Fix compile with CONFIG_WERROR Ashutosh Dixit
@ 2024-06-04 7:30 ` Jani Nikula
0 siblings, 0 replies; 2+ messages in thread
From: Jani Nikula @ 2024-06-04 7:30 UTC (permalink / raw)
To: Ashutosh Dixit, dri-devel; +Cc: mcanal
On Mon, 03 Jun 2024, Ashutosh Dixit <ashutosh.dixit@intel.com> wrote:
> Fix compile with CONFIG_WERROR by explicitly computing the max number of
> 7.1 and 4.2 counters.
Nitpick, the warning you're hitting is unused-const-variable. Werror
just turns it into an error.
>
> In file included from ../drivers/gpu/drm/v3d/v3d_drv.h:14,
> from ../drivers/gpu/drm/v3d/v3d_bo.c:26:
> ../drivers/gpu/drm/v3d/v3d_performance_counters.h:118:43: \
> error: ‘v3d_v42_performance_counters’ defined but not used \
> [-Werror=unused-const-variable=]
>
> Fixes: 3cbcbe016c31 ("drm/v3d: Add Performance Counters descriptions for V3D 4.2 and 7.1")
> Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
This is not the fix that should be done. See [1].
BR,
Jani.
[1] https://lore.kernel.org/r/87msojqv89.fsf@intel.com
> ---
> drivers/gpu/drm/v3d/v3d_drv.h | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/v3d/v3d_drv.h b/drivers/gpu/drm/v3d/v3d_drv.h
> index 556cbb400ba0..93dccb5f4c23 100644
> --- a/drivers/gpu/drm/v3d/v3d_drv.h
> +++ b/drivers/gpu/drm/v3d/v3d_drv.h
> @@ -352,7 +352,9 @@ struct v3d_timestamp_query {
> };
>
> /* Maximum number of performance counters supported by any version of V3D */
> -#define V3D_MAX_COUNTERS ARRAY_SIZE(v3d_v71_performance_counters)
> +#define MAX(a, b) ((a) > (b) ? (a) : (b))
> +#define V3D_MAX_COUNTERS MAX(ARRAY_SIZE(v3d_v71_performance_counters), \
> + ARRAY_SIZE(v3d_v42_performance_counters))
>
> /* Number of perfmons required to handle all supported performance counters */
> #define V3D_MAX_PERFMONS DIV_ROUND_UP(V3D_MAX_COUNTERS, \
--
Jani Nikula, Intel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-04 7:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-04 2:40 [PATCH] drm/v3d: Fix compile with CONFIG_WERROR Ashutosh Dixit
2024-06-04 7:30 ` Jani Nikula
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.