[Mesa-dev] [PATCH] amd/addrlib: Rename the GB_ADDR_CONFIGs to GB_ADDR_CONFIG_{SI, GFX9}

Nicolai Hähnle nhaehnle at gmail.com
Wed Sep 27 18:53:39 UTC 2017


On 27.09.2017 20:42, Nicholas Miell wrote:
> Giving the same name to two different types violates the C++ One Definition
> Rule and gcc will complain about it in LTO builds.

Oh my. What does the gcc warning look like? (I assume it's just a warning.)

Since these are auto-generated headers which are very much standardized 
inside AMD, I'm hesitant to apply this particular patch. Certainly there 
can't be a bug here in reality, since those are just dumb unions.

I think internally we'd rather want a namespace-based solution. Any 
ideas? I need to reflect on this a bit...

Thanks,
Nicolai


> 
> Signed-off-by: Nicholas Miell <nmiell at gmail.com>
> ---
>   src/amd/addrlib/gfx9/gfx9addrlib.cpp        | 2 +-
>   src/amd/addrlib/inc/chip/gfx9/gfx9_gb_reg.h | 2 +-
>   src/amd/addrlib/inc/chip/r800/si_gb_reg.h   | 2 +-
>   src/amd/addrlib/r800/siaddrlib.cpp          | 4 ++--
>   4 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/amd/addrlib/gfx9/gfx9addrlib.cpp b/src/amd/addrlib/gfx9/gfx9addrlib.cpp
> index edb4c6e636a..6837e0a3d9b 100644
> --- a/src/amd/addrlib/gfx9/gfx9addrlib.cpp
> +++ b/src/amd/addrlib/gfx9/gfx9addrlib.cpp
> @@ -992,7 +992,7 @@ BOOL_32 Gfx9Lib::HwlInitGlobalParams(
>   
>       if (m_settings.isArcticIsland)
>       {
> -        GB_ADDR_CONFIG gbAddrConfig;
> +        GB_ADDR_CONFIG_GFX9 gbAddrConfig;
>   
>           gbAddrConfig.u32All = pCreateIn->regValue.gbAddrConfig;
>   
> diff --git a/src/amd/addrlib/inc/chip/gfx9/gfx9_gb_reg.h b/src/amd/addrlib/inc/chip/gfx9/gfx9_gb_reg.h
> index 823710cc189..d387dba2271 100644
> --- a/src/amd/addrlib/inc/chip/gfx9/gfx9_gb_reg.h
> +++ b/src/amd/addrlib/inc/chip/gfx9/gfx9_gb_reg.h
> @@ -36,7 +36,7 @@
>   #error "BIGENDIAN_CPU or LITTLEENDIAN_CPU must be defined"
>   #endif
>   
> -union GB_ADDR_CONFIG {
> +union GB_ADDR_CONFIG_GFX9 {
>       struct {
>   #if        defined(LITTLEENDIAN_CPU)
>           unsigned int                       NUM_PIPES : 3;
> diff --git a/src/amd/addrlib/inc/chip/r800/si_gb_reg.h b/src/amd/addrlib/inc/chip/r800/si_gb_reg.h
> index cf67f602bdf..99a2879048b 100644
> --- a/src/amd/addrlib/inc/chip/r800/si_gb_reg.h
> +++ b/src/amd/addrlib/inc/chip/r800/si_gb_reg.h
> @@ -89,7 +89,7 @@
>   typedef union {
>        unsigned int val : 32;
>        GB_ADDR_CONFIG_T f;
> -} GB_ADDR_CONFIG;
> +} GB_ADDR_CONFIG_SI;
>   
>   #if       defined(LITTLEENDIAN_CPU)
>   
> diff --git a/src/amd/addrlib/r800/siaddrlib.cpp b/src/amd/addrlib/r800/siaddrlib.cpp
> index 9ee1335b3ae..af794c2dbea 100644
> --- a/src/amd/addrlib/r800/siaddrlib.cpp
> +++ b/src/amd/addrlib/r800/siaddrlib.cpp
> @@ -2239,7 +2239,7 @@ VOID SiLib::HwlSetupTileInfo(
>   *   SiLib::DecodeGbRegs
>   *
>   *   @brief
> -*       Decodes GB_ADDR_CONFIG and noOfBanks/noOfRanks
> +*       Decodes GB_ADDR_CONFIG_SI and noOfBanks/noOfRanks
>   *
>   *   @return
>   *       TRUE if all settings are valid
> @@ -2249,7 +2249,7 @@ VOID SiLib::HwlSetupTileInfo(
>   BOOL_32 SiLib::DecodeGbRegs(
>       const ADDR_REGISTER_VALUE* pRegValue) ///< [in] create input
>   {
> -    GB_ADDR_CONFIG  reg;
> +    GB_ADDR_CONFIG_SI  reg;
>       BOOL_32         valid = TRUE;
>   
>       reg.val = pRegValue->gbAddrConfig;
> 


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list