From b696439a676b95c7331e4c3987d325f17cab2c0c Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Tue, 16 May 2023 07:41:09 +0200 Subject: [PATCH] intel_gpu_drv: fix build errors with `-std=gnu++20` Fixes #4883 --- repos/base/include/util/register.h | 34 ++++++++++++-------------- repos/base/include/util/register_set.h | 10 ++++---- repos/os/src/drivers/gpu/intel/main.cc | 6 ++--- 3 files changed, 23 insertions(+), 27 deletions(-) diff --git a/repos/base/include/util/register.h b/repos/base/include/util/register.h index 5a5e3c2492..58aebe0fc3 100644 --- a/repos/base/include/util/register.h +++ b/repos/base/include/util/register.h @@ -115,11 +115,9 @@ namespace Genode { namespace Trait { template struct Genode::Register { - enum { - ACCESS_WIDTH = _ACCESS_WIDTH, - ACCESS_WIDTH_LOG2 = Trait::Uint_width::WIDTH_LOG2, - BITFIELD_WIDTH = ACCESS_WIDTH, - }; + static constexpr size_t ACCESS_WIDTH = _ACCESS_WIDTH; + static constexpr size_t ACCESS_WIDTH_LOG2 = Trait::Uint_width::WIDTH_LOG2; + static constexpr size_t BITFIELD_WIDTH = ACCESS_WIDTH; typedef typename Trait::Uint_width::Type access_t; @@ -228,12 +226,12 @@ struct Genode::Bitset_2 { typedef _BITS_0 Bits_0; typedef _BITS_1 Bits_1; - enum { - WIDTH = Bits_0::BITFIELD_WIDTH + - Bits_1::BITFIELD_WIDTH, - BITFIELD_WIDTH = WIDTH, - ACCESS_WIDTH = Trait::Raise_to_uint_width::WIDTH, - }; + + static constexpr size_t WIDTH = Bits_0::BITFIELD_WIDTH + + Bits_1::BITFIELD_WIDTH; + static constexpr size_t BITFIELD_WIDTH = WIDTH; + static constexpr size_t ACCESS_WIDTH = Trait::Raise_to_uint_width::WIDTH; + typedef typename Trait::Uint_width::Type access_t; typedef Bitset_2 Bitset_2_base; @@ -297,13 +295,13 @@ struct Genode::Bitset_3 typedef _BITS_1 Bits_1; typedef _BITS_2 Bits_2; typedef Bitset_2 Bits_0_1; - enum { - WIDTH = Bits_0::BITFIELD_WIDTH + - Bits_1::BITFIELD_WIDTH + - Bits_2::BITFIELD_WIDTH, - BITFIELD_WIDTH = WIDTH, - ACCESS_WIDTH = Trait::Raise_to_uint_width::WIDTH, - }; + + static constexpr size_t WIDTH = Bits_0::BITFIELD_WIDTH + + Bits_1::BITFIELD_WIDTH + + Bits_2::BITFIELD_WIDTH; + static constexpr size_t BITFIELD_WIDTH = WIDTH; + static constexpr size_t ACCESS_WIDTH = Trait::Raise_to_uint_width::WIDTH; + typedef typename Trait::Uint_width::Type access_t; typedef Bitset_3 Bitset_3_base; diff --git a/repos/base/include/util/register_set.h b/repos/base/include/util/register_set.h index 7c8f4629d6..d4e3399f6a 100644 --- a/repos/base/include/util/register_set.h +++ b/repos/base/include/util/register_set.h @@ -637,11 +637,11 @@ class Genode::Register_set : Noncopyable typedef typename T::Bitset_3_base::Bits_1 Bits_1; typedef typename T::Bitset_3_base::Bits_2 Bits_2; typedef typename T::Bitset_3_base::access_t access_t; - enum { - BITS_0_WIDTH = Bits_0::BITFIELD_WIDTH, - BITS_1_WIDTH = Bits_1::BITFIELD_WIDTH, - V1_SHIFT = BITS_0_WIDTH + BITS_1_WIDTH, - }; + + static constexpr size_t BITS_0_WIDTH = Bits_0::BITFIELD_WIDTH; + static constexpr size_t BITS_1_WIDTH = Bits_1::BITFIELD_WIDTH; + static constexpr size_t V1_SHIFT = BITS_0_WIDTH + BITS_1_WIDTH; + access_t const v0 = read >(); access_t const v1 = read(); return v0 | (v1 << V1_SHIFT); diff --git a/repos/os/src/drivers/gpu/intel/main.cc b/repos/os/src/drivers/gpu/intel/main.cc index c9fce636a8..8075fa2440 100644 --- a/repos/os/src/drivers/gpu/intel/main.cc +++ b/repos/os/src/drivers/gpu/intel/main.cc @@ -472,10 +472,8 @@ struct Igd::Device template struct Engine { - enum { - CONTEXT_PAGES = CONTEXT::CONTEXT_PAGES, - RING_PAGES = CONTEXT::RING_PAGES, - }; + static constexpr size_t CONTEXT_PAGES = CONTEXT::CONTEXT_PAGES; + static constexpr size_t RING_PAGES = CONTEXT::RING_PAGES; Ggtt_map_memory ctx; /* context memory */ Ggtt_map_memory ring; /* ring memory */